-- vim:set ft=lua:
dofile(mg.script_name:gsub('[^\\/]*$','')..'util.lua')
ct=CreateContentBuilder(GZIP_THRESHOLD_BYTE)
ct:Append(DOCTYPE_HTML4_STRICT..[=[
]=])
focus=nil
post=AssertPost()
if post then
focus=edcb.GetRecFileInfoBasic(GetVarInt(post,'del') or 0)
if focus then
edcb.DelRecFileInfo(focus.id)
ct:Append('
削除しました
\n')
end
end
edcb.htmlEscape=15
a=edcb.GetRecFileInfoBasic()
if not focus then
focus=GetVarInt(mg.request_info.query_string,'id')
focus=focus and BinarySearch(a,{id=focus},CompareFields('id'))
end
table.sort(a, function(a,b) return os.time(a.startTime) > os.time(b.startTime) end)
pageCount=RECINFO_PAGE_COUNT
if focus then
--focusの行を含むページを探す
focusIndex=BinarySearchBound(a,focus,function(a,b) return os.time(a.startTime)>os.time(b.startTime) end)
page=math.floor(math.max(math.min(focusIndex-1,#a-1),0)/pageCount)
else
page=GetVarInt(mg.request_info.query_string,'page',0,(#a-1)/pageCount) or 0
end
pageNav=''
if #a>pageCount then
for i=math.max(page-1,1),math.min(math.max(page-1,1)+6,(#a+pageCount-1)/pageCount) do
pageNav=pageNav..(i-1==page and ((i-1)*pageCount+1)..'~ ' or '
'..((i-1)*pageCount+1)..'~ ')
end
pageNav=(page==0 and '|<< ' or '
|<< ')..pageNav
..(page==math.floor((#a-1)/pageCount) and '>>|' or '
>>|\n')
end
ct:Append(pageNav)
ct:Append([=[