changeset 407:eaea1ae2bc3d

Moar work.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 05 Dec 2013 16:57:38 +0200
parents 2bb206b4d358
children db85700cb258
files admajax.php admin.php msite.inc.php showajax.php
diffstat 4 files changed, 49 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/admajax.php	Thu Dec 05 16:28:13 2013 +0200
+++ b/admajax.php	Thu Dec 05 16:57:38 2013 +0200
@@ -220,9 +220,9 @@
     $strCompo = $strCurrEntry = $strPrevEntry = "-";
 
   return
-    "  <div>Current compo:<br /><b>".$strCompo."</b></div>\n".
-    "  <div>Current entry:<br /><b>".$strCurrEntry."</b></div>\n".
-    "  <div>Previous entry:<br /><b>".$strPrevEntry."</b></div>\n";
+    "    <div>Current compo:<br /><b>".$strCompo."</b></div>\n".
+    "    <div>Current entry:<br /><b>".$strCurrEntry."</b></div>\n".
+    "    <div>Previous entry:<br /><b>".$strPrevEntry."</b></div>\n";
 }
 
 
@@ -233,18 +233,19 @@
     stGetDisplayVar("compoID"));
 
   $currShowID = stGetDisplayVar("compoCurrEntry");
-  $str = "";
+  $str = "    ".stGetOptionListStart("ctrlEntryList");
+
   if (($res = stExecSQL($sql)) !== false)
   {
     foreach ($res as $item)
     {
       $str .=
-        "    ".stGetOptionListItem($item["id"],
+        "    ".stGetOptionListItem($item["show_id"],
         ($item["show_id"] == $currShowID),
         sprintf("%3d. %s by %s", $item["show_id"], $item["name"], $item["author"]));
     }
   }
-  return $str;
+  return $str."    ".stGetOptionListEnd();
 }
 
 
@@ -257,7 +258,8 @@
 function stGetOptionListStart($id, $onChange = "")
 {
   return
-    "<select class=\"selectBox\" id=\"".$id."\" size=\"10\"".
+    "<div id=\"".$id."\">\n".
+    "<select class=\"selectBox\" id=\"".$id."Sel\" size=\"10\"".
     ($onChange != "" ? " onChange=\"".$onChange."\"" : "").">\n";
 }
 
@@ -273,7 +275,7 @@
 
 function stGetOptionListEnd()
 {
-  return "</select>\n";
+  return "</select>\n"."</div>\n";
 }
 
 
@@ -447,7 +449,7 @@
           $prev = stGetDisplayVar("showMode");
           if ($prev != $mode)
           {
-            stSetDisplayVar("lastUpdate", time());
+            stDisplayUpdated();
             stSetDisplayVar("showMode", $mode);
           }
         }
@@ -463,9 +465,10 @@
             $prev = stGetDisplayVar("compoID");
             if ($prev != $compo_id)
             {
-              stSetDisplayVar("compoCurrEntry", 1);
+              stSetDisplayVar("compoCurrEntry", 0);
               stSetDisplayVar("compoPrevEntry", 0);
               stSetDisplayVar("compoID", $compo_id);
+              stDisplayUpdated();
             }
           }
         }
@@ -500,6 +503,7 @@
           {
             stSetDisplayVar("compoCurrEntry", $curr);
             stSetDisplayVar("compoPrevEntry", $prev);
+            stDisplayUpdated();
           }
         }
         else
@@ -661,33 +665,31 @@
         {
           foreach ($res as $item)
           {
-            echo "    ".stGetOptionListItem($item["id"],
+            echo "      ".stGetOptionListItem($item["id"],
               ($item["id"] == $currCompoID),
               sprintf("%s (%d entries)", $item["name"], $item["nentries"]));
           }
         }
 
         echo
-          "  ".stGetOptionListEnd().
-          "  <div class=\"ctrlButtons\">\n".
-          "    ".stGetFormButtonInput("setcompo", "", "", "Change compo", "activateCompo()")."\n".
-          "  </div>\n".
-          "</div>\n";
+          "    ".stGetOptionListEnd().
+          "    <div class=\"ctrlButtons\">\n".
+          "      ".stGetFormButtonInput("setcompo", "", "", "Change compo", "activateCompo()")."\n".
+          "    </div>\n".
+          "  </div>\n";
         
         echo
-          "<div class=\"ctrlDBox1\">\n".
-          "  ".stGetOptionListStart("ctrlEntryList").
+          "  <div class=\"ctrlDBox1\">\n".
           stGetInfoCurrEntryList().
-          "  ".stGetOptionListEnd().
-          "  <div class=\"ctrlButtons\">\n".
-          "    ".stGetFormButtonInput("setentry", "", "", "Set selected entry", "setSelectedEntry()")."\n".
-          "    ".stGetFormButtonInput("nextentry", "", "", "Prev entry", "gotoPrevEntry()")."\n".
-          "    ".stGetFormButtonInput("preventry", "", "", "Next entry", "gotoNextEntry()")."\n".
+          "    <div class=\"ctrlButtons\">\n".
+          "      ".stGetFormButtonInput("setentry", "", "", "Set selected entry", "setSelectedEntry()")."\n".
+          "      ".stGetFormButtonInput("preventry", "", "", "Prev entry", "switchEntry(-1)")."\n".
+          "      ".stGetFormButtonInput("nextentry", "", "", "Next entry", "switchEntry(1)")."\n".
+          "    </div>\n".
           "  </div>\n".
-          "</div>\n".
-          "<div class=\"ctrlDBox2\" id=\"ctrlCurrEntryData\">\n".
+          "  <div class=\"ctrlDBox2\" id=\"ctrlCurrEntryData\">\n".
           stGetInfoCurrEntryData().
-          "</div>\n".
+          "  </div>\n".
           "</div>\n";
         break;
 
--- a/admin.php	Thu Dec 05 16:28:13 2013 +0200
+++ b/admin.php	Thu Dec 05 16:57:38 2013 +0200
@@ -505,13 +505,22 @@
 }
 
 
+function refreshCurrEntryData()
+{
+  jsRefreshItems("ctrlCurrEntryData", "infoCurrEntryData", "");
+}
+
+
+function refreshCurrEntryListData()
+{
+  jsRefreshItems("ctrlEntryList", "infoCurrEntryList", "");
+  refreshCurrEntryData();
+}
+
+
 function activateCompo()
 {
-  var msuccess = function ()
-  {
-    jsRefreshItems("ctrlEntryList", "infoCurrEntryList", "");
-    jsRefreshItems("ctrlCurrEntryData", "infoCurrEntryData", "");
-  }
+  jsSendPOSTRequest("action=ctrl&type=setCompoID&id="+jsGetValue("ctrlCompoListSel", 4), refreshCurrEntryListData);
 
   jsSendPOSTRequest("action=ctrl&type=setCompoID&id="+jsGetValue("ctrlCompoList", 4), msuccess);
 }
--- a/msite.inc.php	Thu Dec 05 16:28:13 2013 +0200
+++ b/msite.inc.php	Thu Dec 05 16:57:38 2013 +0200
@@ -87,6 +87,12 @@
 }
 
 
+function stDisplayUpdated()
+{
+  stSetDisplayVar("lastUpdate", time());
+}
+
+
 function stGetDisplayVar($name)
 {
   global $displayVars;
--- a/showajax.php	Thu Dec 05 16:28:13 2013 +0200
+++ b/showajax.php	Thu Dec 05 16:57:38 2013 +0200
@@ -181,7 +181,7 @@
 
 // Check if we need to update the "last updated" timestamp
 if ($updated)
-  stSetDisplayVar("lastUpdate", time());
+  stDisplayUpdated();
 
 
 //