changeset 1041:f188caaedf0f

Implement force reloading of show screen web-page.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 20 Nov 2015 10:48:18 +0200
parents 3c3a1dc4008a
children b17c41ffe43b
files admajax.php admin.js dbdefs.inc.php show.php showajax.php
diffstat 5 files changed, 30 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/admajax.php	Fri Nov 20 10:39:50 2015 +0200
+++ b/admajax.php	Fri Nov 20 10:48:18 2015 +0200
@@ -825,6 +825,14 @@
     }
     break;
 
+  case "screencmd":
+    if (stChkRequestItem("cmd", $stmp, array(CHK_TYPE, VT_STR, "Invalid data.")))
+    {
+      stSetDisplayVar("screenCmdSet", TRUE);
+      stSetDisplayVarUpd("screenCmd", $stmp);
+    }
+    break;
+
   case "check":
     //
     // Perform systems check
@@ -1204,6 +1212,7 @@
           stGetShowModeButton(SMODE_ROTATE, "Slide rotation", $showMode)."\n".
           stGetShowModeButton(SMODE_COMPO, "Compo mode", $showMode)."\n".
           "<a href=\"show.php\" target=\"_blank\">Open info window</a>\n".
+          stGetFormButtonElement("showForceReload", "", "", "Showscreen reload", "showScreenCmd('reload')")."\n".
           "</div>\n".
           "<div id=\"ctrlSystemControls\">\n".
           stGetFormButtonInput("syscheck", "", "", "Perform system check", "performSystemCheck()")."\n".
--- a/admin.js	Fri Nov 20 10:39:50 2015 +0200
+++ b/admin.js	Fri Nov 20 10:48:18 2015 +0200
@@ -617,6 +617,12 @@
 //
 // Misc functions
 //
+function showScreenCmd(str)
+{
+  jsSendPOSTRequest("action=screencmd&cmd="+str);
+}
+
+
 function performSystemCheck()
 {
   jsSendPOSTRequest("action=check", jsMessageBox);
--- a/dbdefs.inc.php	Fri Nov 20 10:39:50 2015 +0200
+++ b/dbdefs.inc.php	Fri Nov 20 10:48:18 2015 +0200
@@ -387,6 +387,9 @@
   "rotateListIndex"   => array(VT_INT, 0, "Current index in rotation list"),
 
   "lastUpdate"        => array(VT_INT, 0, "Timestamp of last slide update"),
+
+  "screenCmd"         => array(VT_STR, "", "Off-channel showscreen command"),
+  "screenCmdSet"      => array(VT_BOOL, false, "Off-channel showscreen command has been set"),
 );
 
 
--- a/show.php	Fri Nov 20 10:39:50 2015 +0200
+++ b/show.php	Fri Nov 20 10:48:18 2015 +0200
@@ -103,6 +103,11 @@
       }
     }
     else
+    if (txt == "reload")
+    {
+      location.reload();
+    }
+    else
     {
       if (!timeOutSet)
       {
--- a/showajax.php	Fri Nov 20 10:39:50 2015 +0200
+++ b/showajax.php	Fri Nov 20 10:48:18 2015 +0200
@@ -199,7 +199,13 @@
   case "check":
     // Check if there has been any change
     $changed = stGetRequestItem("lastUpdate") != stGetDisplayVar("lastUpdate");
-    echo $changed ? "changed" : "nochange";
+    if (stGetDisplayVar("screenCmdSet"))
+    {
+      echo stGetDisplayVar("screenCmd");
+      stSetDisplayVar("screenCmdSet", FALSE);
+    }
+    else
+      echo $changed ? "changed" : "nochange";
     break;
 
   case "get":