diff options
author | Christian Wieninger <cwieninger (at) gmx (dot) de> | 2007-05-25 16:58:56 +0000 |
---|---|---|
committer | Christian Wieninger <cwieninger (at) gmx (dot) de> | 2007-05-25 16:58:56 +0000 |
commit | 3a4d59c9ac7226432120633ad394464d37e5f497 (patch) | |
tree | 926d255db984d789a5e8f1768e4f5985735377b1 /pages | |
parent | 181c5487cc5abbd21b0a8352a507aae4504c683c (diff) | |
download | vdr-plugin-live-3a4d59c9ac7226432120633ad394464d37e5f497.tar.gz vdr-plugin-live-3a4d59c9ac7226432120633ad394464d37e5f497.tar.bz2 |
- first version of "userdef. times" in "What's on?"
Diffstat (limited to 'pages')
-rw-r--r-- | pages/setup.ecpp | 11 | ||||
-rw-r--r-- | pages/whats_on.ecpp | 50 |
2 files changed, 54 insertions, 7 deletions
diff --git a/pages/setup.ecpp b/pages/setup.ecpp index 012d798..97fc199 100644 --- a/pages/setup.ecpp +++ b/pages/setup.ecpp @@ -10,6 +10,7 @@ using namespace std; bool useauth = 0; string login; string pass; + string times; </%args> <%session scope="global"> bool logged_in(false); @@ -27,12 +28,14 @@ if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); if (pass != "") LiveSetup().SetAdminPassword(pass); } - LiveSetup().SaveSetup(); + LiveSetup().SetTimes(times); + LiveSetup().SaveSetup(); } pageTitle = tr("Setup"); lastchannel = LiveSetup().GetLastChannel(); login = LiveSetup().GetAdminLogin(); useauth = LiveSetup().UseAuth(); + times = LiveSetup().GetTimes(); </%cpp> <& pageelems.doc_type &> @@ -90,6 +93,12 @@ if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); </tr> <tr> <td class="border" style="border-left: 1px solid black"></td> + <td class="label"><$ tr("additional fixed times in 'What's on?'") $>:</td> + <td><input type="text" name="times" value="<$ times $>" id="times" /></td> + <td class="border" style="border-right: 1px solid black"></td> + </tr> + <tr> + <td class="border" style="border-left: 1px solid black"></td> <td class="buttonpanel" colspan="2"> <button class="green" type="submit" name="save" onclick="return checksearch();"><$ tr("Save") $></button> </td> diff --git a/pages/whats_on.ecpp b/pages/whats_on.ecpp index bab6a57..ed7ff99 100644 --- a/pages/whats_on.ecpp +++ b/pages/whats_on.ecpp @@ -14,6 +14,8 @@ using namespace vdrlive; </%pre> <%args> type = "now"; +string attime; +time_t seektime = 0; </%args> <%session scope="global"> bool logged_in(false); @@ -29,9 +31,13 @@ const cSchedules* Schedules = cSchedules::Schedules(schedulesLock); string head; if (type == "now") { head = tr("What's running at")+string(" ")+FormatDateTime(tr("%I:%M %p"), time(0)); -} else { - type="next"; +} else if (type == "next") { head = tr("What's on next?"); +} else if (type == "at") { + seektime = GetTimeT(attime); + if (seektime - time(0) + 3600 < 0) + seektime += 24 * 60 * 60; + head = tr("What's running at")+string(" ")+FormatDateTime(tr("%a, %b %d"), seektime) + string(" ") + FormatDateTime(tr("%I:%M %p"), seektime); } }> @@ -42,6 +48,13 @@ if (type == "now") { <link rel="stylesheet" type="text/css" href="styles.css" /> <& tooltip.javascript var=("domTT_styleClass") value=("domTTepg") &> <& pageelems.ajax_js &> + <script type="text/javascript"><!-- + function showtime(selection) + { + if (selection.options[selection.selectedIndex].value != "") + window.location.href = "whats_on.html?type=at&attime=" + selection.options[selection.selectedIndex].value; + } + //--></script> </head> <body onload="<& pageelems.infobox_start_update &>"> <& pageelems.logo &> @@ -49,15 +62,28 @@ if (type == "now") { <div class="inhalt"> <{ EpgEvents epgEvents; - + time_t seektime = 0; + if (type == "at") + { + seektime = GetTimeT(attime); + if (seektime - time(0) + 3600 < 0) + seektime += 24 * 60 * 60; + } ReadLock channelsLock( Channels ); if (channelsLock) { 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 = (type == "now" ? Schedule->GetPresentEvent() : Schedule->GetFollowingEvent()); + 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<std::string, int>(++evntNr); @@ -121,5 +147,17 @@ if (type == "now") { <%def whats_on_actions> <a href="whats_on.html?type=now"><$ tr("Now") $></a> -<a href="whats_on.html?type=next"><$ tr("Next") $></a> +<a href="whats_on.html?type=next"><$ tr("Next") $></a> +<select name="userdeftimes" size="1" id="userdeftimes" onchange="showtime(this)"> + <option value="0"/> +<{ + vector< string > parts = StringSplit( LiveSetup().GetTimes(), ';' ); + vector< string >::const_iterator part = parts.begin(); + for ( int i = 0; part != parts.end(); ++i, ++part ) { +}> + <option value="<$ *part $>"> <$ *part $></option> +<{ + } +}> +</select> </%def> |