-- vim:set ft=lua:
dofile(mg.script_name:gsub('[^\\/]*$','')..'util.lua')
ct={title='EPG予約'}
edcb.htmlEscape=15
a=edcb.EnumAutoAdd()
pageIndex=GetVarInt(mg.request_info.query_string,'page',0,100000) or 0
PAGE_COUNT=tonumber(edcb.GetPrivateProfile('SET','PAGE_COUNT','30',ini))
if PAGE_COUNT==0 then PAGE_COUNT=#a end
if math.ceil((#a/PAGE_COUNT)-1)>0 then
pg='0 and 'href="autoaddepg.html"' or 'disabled')..'>first_page\n'
..'0 and 'href="autoaddepg.html?page='..(pageIndex-1)..'"' or 'disabled')..'>chevron_left\n'
n=pageIndex>(#a/PAGE_COUNT-2) and math.floor(#a/PAGE_COUNT)-4 or math.max(0,pageIndex-2)
for i=n, n+4 do
pg=pg..(i>=0 and i<#a/PAGE_COUNT and ''..(i+1)..'\n' or '')
end
pg=pg..'chevron_right\n'
..'last_page\n'
pg='
\n'..pg..'
\n'
end
ct.main='\n'
if sidePanel then
ct.macro=true
ct.main=ct.main..[=[
\n'
ctt={}
for i=pageIndex*PAGE_COUNT+1,math.min(#a,(pageIndex+1)*PAGE_COUNT) 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
disAndKey=string.match(v.andKey, '^^!{999}(.*)')
caseAndKey=(disAndKey or v.andKey):match('^C!{999}(.*)')
table.insert(ctt, '
'..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
ct.main=ct.main..table.concat(ctt)..'
\n
\n'..(pg or '')..'
'
..'add'
ct=template(ct)
mg.write(ct:Pop(Response(200,'text/html','utf-8',ct.len)..(ct.gzip and 'Content-Encoding: gzip\r\n' or '')..'\r\n'))