summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDieter Hametner <dh (plus) vdr (at) gekrumbel (dot) de>2007-06-14 20:45:47 +0000
committerDieter Hametner <dh (plus) vdr (at) gekrumbel (dot) de>2007-06-14 20:45:47 +0000
commit3cf762e06f46d1f69e06030b95ffaed3b951b46d (patch)
treec098d96af743ecb620dbdedf6c6cd5eb97511ee8
parentfd959f0313ff97305681e09693b7207d20ced2a6 (diff)
downloadvdr-plugin-live-3cf762e06f46d1f69e06030b95ffaed3b951b46d.tar.gz
vdr-plugin-live-3cf762e06f46d1f69e06030b95ffaed3b951b46d.tar.bz2
- Infobox status update state is remembered in session. Fixes #313
-rw-r--r--doc/ChangeLog7
-rw-r--r--javascript/vdr_status.js30
-rw-r--r--pages/ibox.ecpp12
-rw-r--r--pages/pageelems.ecpp5
4 files changed, 36 insertions, 18 deletions
diff --git a/doc/ChangeLog b/doc/ChangeLog
index 2b2da73..272acde 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,5 +1,12 @@
2007-06-14 Dieter Hametner <dh+vdr at gekrumbel dot de>
+ * infobox: Keep update status of infobox in session. This allows
+ the user to switch off status updates and change live
+ pages. After a page change the status is updated once and then
+ the users choice is respected.
+
+2007-06-14 Dieter Hametner <dh+vdr at gekrumbel dot de>
+
* infobox: show 'user friendly' error message when something went
wrong while updating the status box.
Fixed tooltip message for toggle update on/off of status box.
diff --git a/javascript/vdr_status.js b/javascript/vdr_status.js
index 73a20dd..2fabed6 100644
--- a/javascript/vdr_status.js
+++ b/javascript/vdr_status.js
@@ -40,6 +40,19 @@ function LiveStatusShowInfo(xmldoc, containerId)
LiveStatusSetTextContent(containerId, node.nodeName, textContent);
}
}
+
+ /* check if we still need to update the status */
+ var update = xmldoc.getElementsByTagName('update').item(0);
+ var reload = (update.firstChild.nodeValue == "1");
+
+ if (reload != vst_reload) {
+ vst_reload = reload;
+ var img = document.getElementById('statusReloadBtn');
+ if (img != null) {
+ // change image according to state.
+ img.src = vst_reload ? 'stop_update.png' : 'reload.png';
+ }
+ }
}
function LiveStatusReportError(message, containerId)
@@ -105,22 +118,13 @@ function LiveStatusSetTextContent(containerId, nodeName, textContent)
function LiveStatusToggleUpdate()
{
if (vst_reload) {
- vst_reload = false;
if (vst_timer != null)
window.clearTimeout(vst_timer);
}
- else {
- vst_reload = true;
- LiveStatusRequest(vst_url, vst_boxId);
- }
- var img = document.getElementById('statusReloadBtn');
- if (img != null) {
- // change image according to state.
- img.src = vst_reload ? 'stop_update.png' : 'reload.png';
- }
+ LiveStatusRequest(vst_url, vst_boxId, !vst_reload);
}
-function LiveStatusRequest(url, containerid)
+function LiveStatusRequest(url, containerid, update)
{
if (vst_url == null)
{
@@ -140,7 +144,7 @@ function LiveStatusRequest(url, containerid)
LiveStatusReportError(updateMsg, containerid);
}
if (vst_reload)
- vst_timer = window.setTimeout("LiveStatusRequest('" + url + "', '" + containerid + "')", 1000);
+ vst_timer = window.setTimeout("LiveStatusRequest('" + url + "', '" + containerid + "', true)", 1000);
}
status.onerror = function(message)
{
@@ -148,5 +152,5 @@ function LiveStatusRequest(url, containerid)
LiveStatusToggleUpdate();
LiveStatusReportError(requestMsg, containerid);
}
- status.request("update", vst_reload ? "1" : "0");
+ status.request("update", update ? "1" : "0");
}
diff --git a/pages/ibox.ecpp b/pages/ibox.ecpp
index 666ebc2..4d819f5 100644
--- a/pages/ibox.ecpp
+++ b/pages/ibox.ecpp
@@ -21,6 +21,7 @@ using namespace std;
</%args>
<%session scope="global">
bool logged_in(false);
+int update_status(1);
</%session>
<%cpp>
if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html");
@@ -30,6 +31,9 @@ bool logged_in(false);
tChannelID next_chan;
reply.setContentType( "application/xml" );
+ if (update_status != update) {
+ update_status = update;
+ }
#if VDRVERSNUM >= 10403
const char* NowReplaying = cReplayControl::NowReplaying();
#else
@@ -134,22 +138,22 @@ bool logged_in(false);
if (prev_chan.Valid() && next_chan.Valid())
{
</%cpp>
-<& xmlresponse.ibox update=(update) type=(epg->Id()) caption=(epg->Caption()) currentTime=(epg->CurrentTime(tr("%I:%M:%S %p"))) duration=(epg->StartTime(tr("%I:%M %p")) + string(" - ") + epg->EndTime(tr("%I:%M %p"))) title=(epg->Title()) elapsed=(epg->Elapsed()) prev_chan=(prev_chan) next_chan=(next_chan) &>
+<& xmlresponse.ibox update=(update_status) type=(epg->Id()) caption=(epg->Caption()) currentTime=(epg->CurrentTime(tr("%I:%M:%S %p"))) duration=(epg->StartTime(tr("%I:%M %p")) + string(" - ") + epg->EndTime(tr("%I:%M %p"))) title=(epg->Title()) elapsed=(epg->Elapsed()) prev_chan=(prev_chan) next_chan=(next_chan) &>
<%cpp>
}
else if (prev_chan.Valid()) {
</%cpp>
-<& xmlresponse.ibox update=(update) type=(epg->Id()) caption=(epg->Caption()) currentTime=(epg->CurrentTime(tr("%I:%M:%S %p"))) duration=(epg->StartTime(tr("%I:%M %p")) + string(" - ") + epg->EndTime(tr("%I:%M %p"))) title=(epg->Title()) elapsed=(epg->Elapsed()) prev_chan=(prev_chan) &>
+<& xmlresponse.ibox update=(update_status) type=(epg->Id()) caption=(epg->Caption()) currentTime=(epg->CurrentTime(tr("%I:%M:%S %p"))) duration=(epg->StartTime(tr("%I:%M %p")) + string(" - ") + epg->EndTime(tr("%I:%M %p"))) title=(epg->Title()) elapsed=(epg->Elapsed()) prev_chan=(prev_chan) &>
<%cpp>
}
else if (next_chan.Valid()) {
</%cpp>
-<& xmlresponse.ibox update=(update) type=(epg->Id()) caption=(epg->Caption()) currentTime=(epg->CurrentTime(tr("%I:%M:%S %p"))) duration=(epg->StartTime(tr("%I:%M %p")) + string(" - ") + epg->EndTime(tr("%I:%M %p"))) title=(epg->Title()) elapsed=(epg->Elapsed()) next_chan=(next_chan) &>
+<& xmlresponse.ibox update=(update_status) type=(epg->Id()) caption=(epg->Caption()) currentTime=(epg->CurrentTime(tr("%I:%M:%S %p"))) duration=(epg->StartTime(tr("%I:%M %p")) + string(" - ") + epg->EndTime(tr("%I:%M %p"))) title=(epg->Title()) elapsed=(epg->Elapsed()) next_chan=(next_chan) &>
<%cpp>
}
else {
</%cpp>
-<& xmlresponse.ibox update=(update) type=(epg->Id()) caption=(epg->Caption()) currentTime=(epg->CurrentTime(tr("%I:%M:%S %p"))) duration=(epg->StartTime(tr("%I:%M %p")) + string(" - ") + epg->EndTime(tr("%I:%M %p"))) title=(epg->Title()) elapsed=(epg->Elapsed()) &>
+<& xmlresponse.ibox update=(update_status) type=(epg->Id()) caption=(epg->Caption()) currentTime=(epg->CurrentTime(tr("%I:%M:%S %p"))) duration=(epg->StartTime(tr("%I:%M %p")) + string(" - ") + epg->EndTime(tr("%I:%M %p"))) title=(epg->Title()) elapsed=(epg->Elapsed()) &>
<%cpp>
}
break;
diff --git a/pages/pageelems.ecpp b/pages/pageelems.ecpp
index b6f4f8d..093255a 100644
--- a/pages/pageelems.ecpp
+++ b/pages/pageelems.ecpp
@@ -13,6 +13,9 @@ using namespace std;
using namespace vdrlive;
</%pre>
+<%session scope="global">
+int update_status(1);
+</%session>
<# ---------------------------------------------------------------------- #>
@@ -82,7 +85,7 @@ using namespace vdrlive;
<# ---------------------------------------------------------------------- #>
<%def infobox_start_update>
-<%cpp> { </%cpp>LiveStatusRequest('ibox.xml', 'infobox')<%cpp> } </%cpp>
+<%cpp> { </%cpp>LiveStatusRequest('ibox.xml', 'infobox', <%cpp> if (update_status) { reply.sout() << "true"; } else { reply.sout() << "false"; } </%cpp>)<%cpp> } </%cpp>
</%def>
<# ---------------------------------------------------------------------- #>