forked from tkmsst/EDCB
-
Notifications
You must be signed in to change notification settings - Fork 37
/
recinfo.html
65 lines (60 loc) · 2.3 KB
/
recinfo.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
-- vim:set ft=lua:
PAGE_COUNT=50
dofile(mg.script_name:gsub('[^\\/]*$','')..'util.lua')
ct=CreateContentBuilder(GZIP_THRESHOLD_BYTE)
ct:Append([=[
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="ja">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="initial-scale=1">
<link rel="stylesheet" type="text/css" href="default.css">
<title>録画済み一覧 - EDCB</title>
</head>
<body>
<h1>録画済み一覧</h1>
<div class="page-nav">
]=])
edcb.htmlEscape=15
a=edcb.GetRecFileInfoBasic()
table.sort(a, function(a,b) return os.time(a.startTime) > os.time(b.startTime) end)
page=GetVarInt(mg.request_info.query_string,'page',0,(#a-1)/PAGE_COUNT) or 0
pageNav=''
if #a>PAGE_COUNT then
for i=math.max(page-1,1),math.min(math.max(page-1,1)+6,(#a+PAGE_COUNT-1)/PAGE_COUNT) do
pageNav=pageNav..(i-1==page and ((i-1)*PAGE_COUNT+1)..'~ ' or '<a href="recinfo.html?page='..(i-1)..'">'..((i-1)*PAGE_COUNT+1)..'~</a> ')
end
pageNav=(page==0 and '|<< ' or '<a href="recinfo.html">|<<</a> ')..pageNav
..(page==math.floor((#a-1)/PAGE_COUNT) and '>>|' or '<a href="recinfo.html?page='..math.floor((#a-1)/PAGE_COUNT)..'">>>|</a>\n')
end
ct:Append(pageNav)
ct:Append([=[
</div>
<div id="main">
<table>
]=])
for i=page*PAGE_COUNT+1,math.min(#a,(page+1)*PAGE_COUNT) do
v=a[i]
ct:Append(' <tr><td><a href="recinfodesc.html?id='..v.id..'">'
..FormatTimeAndDuration(v.startTime, v.durationSecond)
..'</a><td>'..v.serviceName..'<td>'..v.title..'<td>'..(v.protectFlag and '🔑' or '-')
..'<td'..(v.drops>0 and ' class="drops"' or v.scrambles>0 and ' class="scrambles"' or '')..'>'..v.drops..'/'..v.scrambles
..'<td'..((v.recStatus==1 or v.recStatus==4 or v.recStatus==6) and '' or (v.recStatus==3 or v.recStatus==11 or v.recStatus==13) and ' class="warn"' or ' class="err"')
..'>'..v.comment..'</tr>\n')
end
ct:Append([=[
</table>
</div>
<div class="page-nav">
]=])
ct:Append(pageNav)
ct:Append([=[
</div>
<div id="footer">
<a href="index.html">メニュー</a>
</div>
</body>
</html>
]=])
ct:Finish()
mg.write(ct:Pop(Response(200,'text/html','utf-8',ct.len)..(ct.gzip and 'Content-Encoding: gzip\r\n' or '')..'\r\n'))