diff options
author | Christian Wieninger <cwieninger (at) gmx (dot) de> | 2007-05-27 08:02:35 +0000 |
---|---|---|
committer | Christian Wieninger <cwieninger (at) gmx (dot) de> | 2007-05-27 08:02:35 +0000 |
commit | ffe665bc701a0e89706394e7180c92e3ea95dd4f (patch) | |
tree | 6900f28499eb0acf095533c25b50d18038f8f312 | |
parent | 7be7e55411a9556ed08107ff5605bfb5f75435d5 (diff) | |
download | vdr-plugin-live-ffe665bc701a0e89706394e7180c92e3ea95dd4f.tar.gz vdr-plugin-live-ffe665bc701a0e89706394e7180c92e3ea95dd4f.tar.bz2 |
- again more flexible handling a lazy input time
- redisplay selected or given time (dropdown / input field) in corresponding field after reload
-rw-r--r-- | pages/whats_on.ecpp | 26 | ||||
-rw-r--r-- | tools.cpp | 10 |
2 files changed, 30 insertions, 6 deletions
diff --git a/pages/whats_on.ecpp b/pages/whats_on.ecpp index a28b381..7e27bc8 100644 --- a/pages/whats_on.ecpp +++ b/pages/whats_on.ecpp @@ -15,6 +15,7 @@ using namespace vdrlive; <%args> type = "now"; string attime; +string fixtime; </%args> <%session scope="global"> @@ -30,14 +31,19 @@ const cSchedules* Schedules = cSchedules::Schedules(schedulesLock); string head; time_t seektime = 0; +string displaytime; 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") { - attime = ExpandTimeString(attime); - seektime = GetTimeT(attime); + if (attime != "") + displaytime = ExpandTimeString(attime); + else if (fixtime != "") + displaytime = ExpandTimeString(fixtime); + + 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(")"); @@ -54,12 +60,24 @@ if (type == "now") { <script type="text/javascript"><!-- function init() { - document.getElementById("spectime").value = "<$ attime $>"; +% if (attime != "") { + document.getElementById("spectime").value = "<$ attime $>"; +% } +<{ + if (fixtime != "") { + vector< string > parts = StringSplit( LiveSetup().GetTimes(), ';' ); + vector< string >::const_iterator part = parts.begin(); + for ( int i = 0; part != parts.end(); ++i, ++part ) { + if (*part == fixtime) { +}> + document.getElementById("userdeftimes").options[<$ i+1 $>].selected = true; +<{ }}} +}> } function showtime(selection) { if (selection.options[selection.selectedIndex].value != "") - window.location.href = "whats_on.html?type=at&attime=" + selection.options[selection.selectedIndex].value; + window.location.href = "whats_on.html?type=at&fixtime=" + selection.options[selection.selectedIndex].value; } function showspectime(selection) { @@ -152,8 +152,14 @@ std::string ExpandTimeString(std::string timestring) string::size_type colonpos = timestring.find(":"); if (colonpos == string::npos) { - timestring += string(std::max(0,(int)(4 - timestring.size())), '0'); - timestring = string(timestring.begin(), timestring.begin() + 2) + ":" + string(timestring.begin() + 2, timestring.end()); + if (timestring.size() == 1) + timestring = "0" + timestring + ":00"; + else if (timestring.size() == 2) + timestring = timestring + ":00"; + else if (timestring.size() == 3) + timestring = "0" + string(timestring.begin(), timestring.begin() + 1) + ":" + string(timestring.begin() + 1, timestring.end()); + else + timestring = string(timestring.begin(), timestring.begin() + 2) + ":" + string(timestring.begin() + 2, timestring.end()); } else { |