-- 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
serviceName=''..serviceName..(#v.serviceList>1 and '.他'..(#v.serviceList-1)..'ch' or '')
end
table.insert(ctt, '
'..(#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)
..'