-- vim:set ft=lua:
dofile(mg.script_name:gsub('[^\\/]*$','')..'util.lua')
ct={title='EPG予約'}
focusID=nil
post=AssertPost()
if post then
focusID=GetVarInt(post,'del')
if focusID then
edcb.DelAutoAdd(focusID)
ct.js=''
end
end
edcb.htmlEscape=15
a=edcb.EnumAutoAdd()
pageCount=tonumber(edcb.GetPrivateProfile('SET','PAGE_COUNT','30',INI))
if pageCount==0 then pageCount=#a end
focusID=focusID or GetVarInt(mg.request_info.query_string,'id')
if focusID then
--focusIDの行を含むページを探す
focusIndex=BinarySearchBound(a,{dataID=focusID},CompareFields('dataID'))
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
ctt={}
for i=page*pageCount+1,math.min(#a,(page+1)*pageCount) do
v=a[i].searchInfo
serviceName='なし'
if #v.serviceList>0 then
for j,w in ipairs(edcb.GetChDataList()) do
if w.onid==v.serviceList[1].onid and w.tsid==v.serviceList[1].tsid and w.sid==v.serviceList[1].sid then
serviceName=w.serviceName
break
end
end
end
table.insert(ctt, '
'
..'\n | '..ParseAndKey(v.andKey).andKey
..'\n | block'..ParseNotKey(v.notKey).notKey
..'\n | note'..ParseNotKey(v.notKey).note
..'\n | search'..a[i].addCount..''
..'\n | '..(#v.serviceList>0 and ' ' or '')..''..serviceName..(#v.serviceList>1 and '.他'..(#v.serviceList-1)..'ch' or '')
..'\n | '..(#v.contentList>0 and (v.notContetFlag and '' or '')..edcb.GetGenreName(v.contentList[1].content_nibble)..(#v.contentList>1 and '.他'..(#v.contentList-1)..'' or '') or '全ジャンル')
..'\n | '..(RecModeTextList()[a[i].recSetting.recMode+1] or '')
..'\n')
end
pageNav=Pagination(page, a)
ct.main='\n'
..SidePanelTemplate(true)
..''..pageNav..' '
..' \n'
..''..#a..' 件中 '..math.min(#a,page*pageCount+1)..' - '..math.min(#a,(page+1)*pageCount)..' 件\n'
..'\n\n'
..table.concat(ctt)
..' \n \n'..ThumbContainerTemplate()..pageNav..' \n'
..'add'
ct=Template(ct)
mg.write(ct:Pop(Response(200,'text/html','utf-8',ct.len,ct.gzip)..'\r\n'))
|