<%pre> #include #include #include "timers.h" #include "tools.h" #include "setup.h" #include "i18n.h" #include "epg_events.h" #include "timerconflict.h" #include "livefeatures.h" using namespace std; using namespace vdrlive; static const size_t maximumDescriptionLength = 300; <%args> // input parameters string timerid; string action; <%session scope="global"> bool logged_in(false); <%request scope="page"> cTimer* timer; TimerConflictNotifier timerNotifier; <%include>page_init.eh <%cpp> if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); pageTitle = trVDR("Timers"); cMutexLock timersLock( &LiveTimerManager() ); SortedTimers& timers = LiveTimerManager().GetTimers(); timer = 0; if ( !timerid.empty() ) { string tId = SortedTimers::DecodeDomId(timerid); // dsyslog("DEBUG: TIMER: tId = %s", tId.c_str()); timer = timers.GetByTimerId(tId); if ( timer == 0 ) throw HtmlError( tr("Couldn't find timer. Maybe you mistyped your request?") ); if (action == "delete") { LiveTimerManager().DelTimer(timer); timerNotifier.SetTimerModification(); } if (action == "toggle") { LiveTimerManager().ToggleTimerActive(timer); timerNotifier.SetTimerModification(); } } string previousDay = ""; <& pageelems.doc_type &> VDR-Live - <$ pageTitle $> <& pageelems.stylesheets &> <& pageelems.ajax_js &> <& pageelems.logo &> <& menu active=("timers") component=("timers.timer_actions")>
% if (timers.size() == 0) { <$ tr("No timer defined") $> % } else { <%cpp> // output of the timer list: for (SortedTimers::iterator timer = timers.begin(); timer != timers.end(); ++timer) { EpgInfoPtr epgEvent; string longDescription; if (!timer->Event()) timer->SetEventFromSchedule(); if (timer->Event()) { epgEvent = EpgEvents::CreateEpgInfo(timer->Channel(), timer->Event()); longDescription = StringEscapeAndBreak(SortedTimers::GetTimerInfo(*timer)) + "
" + StringEscapeAndBreak(StringWordTruncate(epgEvent->LongDescr(), maximumDescriptionLength)) + "

" + tr("Click to view details."); } string currentDay = SortedTimers::GetTimerDays(*timer); SortedTimers::iterator nextTimer = timer; ++nextTimer; bool bottom = false; if (nextTimer == timers.end()) bottom = true; else { string nextDay = SortedTimers::GetTimerDays(*nextTimer); bottom = (currentDay != nextDay); } if (previousDay != currentDay) { if (!previousDay.empty()) { <%cpp> } previousDay = currentDay; <%cpp> } std::string timerStateImg = "transparent.png"; std::string timerStateHint; if (timer->Recording()) { timerStateImg = "arrow_rec.gif"; timerStateHint = tr("Timer is recording."); } else if (timer->Flags() & tfActive) { timerStateImg = "arrow.png"; timerStateHint = tr("Timer is active."); } <%cpp> } }
<$ currentDay $>
<$ trVDR("Channel") $>
<$ trVDR("Start") $>
<$ trVDR("Stop") $>
<$ trVDR("File") $>
">" alt="" <%cpp> if (!timerStateHint.empty()) { <& tooltip.hint text=(timerStateHint) &><%cpp> } > "> ">
<$ FormatDateTime(tr("%I:%M %p"), timer->StartTime()) $>
">
<$ FormatDateTime(tr("%I:%M %p"), timer->StopTime()) $>
"> ">Flags() & tfActive) ? "active.png" : "inactive.png") $>" alt="" <& tooltip.hint text=(tr("Toggle timer active/inactive")) &>> "><& pageelems.edit_timer timerId=(timers.GetTimerId(*timer)) &> ">" alt="" <& tooltip.hint text=(tr("Delete timer")) &>>
<%include>page_exit.eh <%def timer_actions> <$ tr("New timer") $> % if ( LiveFeatures< features::epgsearch >().Recent() ) { | <$ tr("Timer conflicts") $> % }