changeset 404:d454f7eebddd

Moar work.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 05 Dec 2013 15:59:28 +0200
parents 05debbea33c1
children 9c60412228e9
files admajax.php admin.php
diffstat 2 files changed, 36 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/admajax.php	Thu Dec 05 15:57:48 2013 +0200
+++ b/admajax.php	Thu Dec 05 15:59:28 2013 +0200
@@ -226,8 +226,25 @@
 }
 
 
-function stGet()
+function stGetInfoCurrEntryList()
 {
+  $sql = stPrepareSQL(
+    "SELECT * FROM entries WHERE compo_id=%d ORDER BY show_id ASC",
+    stGetDisplayVar("compoID"));
+
+  $currShowID = stGetDisplayVar("compoCurrEntry");
+  $str = "";
+  if (($res = stExecSQL($sql)) !== false)
+  {
+    foreach ($res as $item)
+    {
+      $str .=
+        "    ".stGetOptionListItem($item["id"],
+        ($item["show_id"] == $currShowID),
+        sprintf("%3d. %s by %s", $item["show_id"], $item["name"], $item["author"]));
+    }
+  }
+  return $str;
 }
 
 
@@ -500,6 +517,10 @@
       case "infoCurrEntryData":
         echo stGetInfoCurrEntryData();
         break;
+
+      case "infoCurrEntryList":
+        echo stGetInfoCurrEntryList();
+        break;
     
       case "infoEditRotationList":
         echo
@@ -655,24 +676,8 @@
         
         echo
           "<div class=\"ctrlDBox1\">\n".
-          "  ".stGetOptionListStart("ctrlEntryList");
-
-        $sql = stPrepareSQL(
-          "SELECT * FROM entries WHERE compo_id=%d ORDER BY show_id ASC",
-          $currCompoID);
-
-        $currShowID = stGetDisplayVar("compoCurrEntry");
-        if (($res = stExecSQL($sql)) !== false)
-        {
-          foreach ($res as $item)
-          {
-            echo "    ".stGetOptionListItem($item["id"],
-              ($item["show_id"] == $currShowID),
-              sprintf("%3d. %s by %s", $item["show_id"], $item["name"], $item["author"]));
-          }
-        }
-
-        echo
+          "  ".stGetOptionListStart("ctrlEntryList").
+          stGetInfoCurrEntryList().
           "  ".stGetOptionListEnd().
           "  <div class=\"ctrlButtons\">\n".
           "    ".stGetFormButtonInput("setentry", "", "", "Set selected entry", "setSelectedEntry()")."\n".
--- a/admin.php	Thu Dec 05 15:57:48 2013 +0200
+++ b/admin.php	Thu Dec 05 15:59:28 2013 +0200
@@ -505,6 +505,18 @@
 }
 
 
+function activateCompo()
+{
+  var msuccess = function ()
+  {
+    jsRefreshItems("ctrlEntryList", "infoCurrEntryList", "");
+    jsRefreshItems("ctrlCurrEntryData", "infoCurrEntryData", "");
+  }
+
+  jsSendPOSTRequest("action=ctrl&type=setCompoID&id="+jsGetValue("ctrlCompoList", 4), msuccess);
+}
+
+
 function updateTabList(tabset, extra)
 {
   var tabs = "";