<%pre> #include #include #include #include #include #include "setup.h" #include "tools.h" #include "epg_events.h" using namespace std; using namespace vdrlive; <%args> type = "now"; mode = "detail"; string attime; string fixtime; <%session scope="global"> bool logged_in(false); <%request scope="page"> string current_type; string current_mode; string current_attime; string current_fixtime; string current_displaytime; <%include>page_init.eh <{ if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); cSchedulesLock schedulesLock; const cSchedules* Schedules = cSchedules::Schedules(schedulesLock); string head; time_t seektime = 0; string displaytime; current_type = type; current_mode = mode; current_attime = attime; current_fixtime = fixtime; if (type == "now") { head = tr("What's running at")+string(" ")+FormatDateTime(tr("%I:%M %p"), time(0)); } else if (type == "next") { head = tr("What's on next?"); } else if (type == "at") { if (attime != "") displaytime = ExpandTimeString(attime); else if (fixtime != "") displaytime = ExpandTimeString(fixtime); current_displaytime = displaytime; seektime = GetTimeT(displaytime); if (seektime - time(0) + 3600 < 0) // if wanted time is past more then 1h, then use tomorrow seektime += SECSINDAY; head = tr("What's running at") + string(" ") + FormatDateTime(tr("%I:%M %p"), seektime) +string(" (") +FormatDateTime(tr("%a, %b %d"), seektime) + string(")"); } }> <& pageelems.doc_type &> VDR-Live - <$ head $> <& pageelems.stylesheets &> <& tooltip.javascript var=("domTT_styleClass") value=("domTTepg") &> <& pageelems.ajax_js &> <& pageelems.logo &> <& menu active=("whats_on") component=("whats_on.whats_on_actions")>
% if (mode == "list") { % } <{ EpgEvents epgEvents; ReadLock channelsLock( Channels ); if (channelsLock) { bool active_line = false; int evntNr = 0; for (cChannel *Channel = Channels.First(); Channel && Channel->Number() <= LiveSetup().GetLastChannel(); Channel = Channels.Next(Channel)) { if (!Channel->GroupSep()) { const cSchedule *Schedule = Schedules->GetSchedule(Channel); if (Schedule) { const cEvent *Event = NULL; if (type == "now") Event = Schedule->GetPresentEvent(); else if (type == "next") Event = Schedule->GetFollowingEvent(); else if (type == "at") Event = Schedule->GetEventAround(seektime); if (Event) { string evntId("eventId_"); evntId += lexical_cast(++evntNr); EpgEventPtr epgEvent(new EpgEvent(evntId, Event, Channel->Name())); epgEvents.push_back(epgEvent); tChannelID channel_id(Channel->GetChannelID()); tEventID event = Event->EventID(); bool truncated = false; string description(); }> % if (mode == "detail") {
<& pageelems.event_timer channelid=(channel_id) eventid=(event) &> % if (type == "now") { <& pageelems.ajax_action_href action="switch_channel" tip=(tr("Switch to this channel.")) param=(channel_id) image="zap.png" alt="" &> % } % if (LiveSetup().HaveEPGSearch()) { > % } >
<$ (epgEvent->StartTime(tr("%I:%M %p"))) $> - <$ (epgEvent->EndTime(tr("%I:%M %p"))) $>
% if (epgEvent->Elapsed() >= 0) {
<& pageelems.progressbar progress=(epgEvent->Elapsed()) &>
% }
<$ (epgEvent->Title()) $>
<$ (epgEvent->ShortDescr()) $>
<$ (StringWordTruncate(epgEvent->LongDescr(), 150, truncated)) $>
LongDescr(), 300, truncated)) + string("
") + string(tr("Click to view details."))) &><& tooltip.display domId=(epgEvent->Id()) &>><$ (string(tr("more")) + string(" ...")) $>
% } else { // mode == "list"
"> % } <{ } } } } } }>
<$ head $>
<& pageelems.event_timer channelid=(channel_id) eventid=(event) &> % if (type == "now") { <& pageelems.ajax_action_href action="switch_channel" tip=(tr("Switch to this channel.")) param=(channel_id) image="zap.png" alt="" &> % } % if (LiveSetup().HaveEPGSearch()) { > % } >
<$ (epgEvent->StartTime(tr("%I:%M %p"))) $> - <$ (epgEvent->EndTime(tr("%I:%M %p"))) $>
% if (epgEvent->Elapsed() >= 0) {
<& pageelems.progressbar progress=(epgEvent->Elapsed()) &>
% }
LongDescr(), 300, truncated)) + string("
") + string(tr("Click to view details."))) &><& tooltip.display domId=(epgEvent->Id()) &>><$ (epgEvent->Title()) $>
<$ (epgEvent->ShortDescr()) $>
 
 
% }
<%include>page_exit.eh <%def whats_on_actions> " href="whats_on.html?type=now&mode=<$ current_mode $>" id="nowhref"><$ tr("Now") $> | " href="whats_on.html?type=next&mode=<$ current_mode $>" id="nexthref"><$ tr("Next") $> | <$ tr("What's on") $> | <$ tr("at") $> " onchange="showspectime(this)"/> | % if ( current_mode == "list" ) { <$ tr("Details view") $> % } else { <$ tr("List view") $> % }