changeset 385:8b8b0a83233b

Add compo entry show position buttons to individual compos.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 05 Dec 2013 07:24:12 +0200
parents 357b81e39ab3
children 0693747fa7d3
files admajax.php admin.php
diffstat 2 files changed, 26 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/admajax.php	Wed Dec 04 19:52:23 2013 +0200
+++ b/admajax.php	Thu Dec 05 07:24:12 2013 +0200
@@ -380,12 +380,16 @@
         $showMode = stGetDisplayVar("showMode");
         echo
           "<div id=\"ctrlGlobalControls\">\n".
+          "<div>\n".
           "Active mode:\n".
           stGetShowModeButton(SMODE_ROTATE, "Slide rotation", $showMode)."\n".
           stGetShowModeButton(SMODE_COMPO, "Compo mode", $showMode)."\n".
           stGetFormButtonInput("syscheck", "", "", " Perform system check ", "performSystemCheck()")."\n".
           stGetFormButtonInput("generate", "", "", " Add missing show positions ", "generateEntryPositions(0, 1)")."\n".
-          stGetFormButtonInput("regenerate", "", "", " ReGenerate show positions ", "generateEntryPositions(0, 0)")."\n".
+          stGetFormButtonInput("regenerate", "", "", " ReGenerate ALL show positions ", "generateEntryPositions(0, 0)")."\n".
+          "</div>\n".
+          "<div>\n".
+          "</div>\n".
           "</div>\n";
         break;
 
@@ -655,7 +659,16 @@
           $prefix = "ne";
           echo
             "<h1 style=\"margin-bottom: 0px;\">#".$id." - ".chentities($compo["name"]).
-            " (".$nentries." entries)</h1>\n".
+            " (".$nentries." entries)</h1>\n";
+
+          if ($nentries > 0)
+          {
+            echo
+              stGetFormButtonInput("generate", "", "", " Add missing show positions ", "generateEntryPositions(".$id.", 1)")."\n".
+              stGetFormButtonInput("regenerate", "", "", " ReGenerate show positions ", "generateEntryPositions(".$id.", 0)")."\n";
+          }
+
+          echo
             "<form>\n".
             " <table class=\"misc\">\n".
             "  <tr>\n".
--- a/admin.php	Wed Dec 04 19:52:23 2013 +0200
+++ b/admin.php	Thu Dec 05 07:24:12 2013 +0200
@@ -475,16 +475,25 @@
 
 function generateEntryPositions(id, patch)
 {
+  var msuccess = function (data)
+  {
+    refreshDispatchCM(id);
+  }
+
   var mcb_ok = function (data)
   {
     if (id == 0)
       jsSendPOSTRequest("action=randomize&type=all&patch="+patch);
     else
-      jsSendPOSTRequest("action=randomize&type=compo&id="+id+"&patch="+patch);
+      jsSendPOSTRequest("action=randomize&type=compo&id="+id+"&patch="+patch, msuccess);
   }
   
   if (patch == 0)
-    jsConfirmBox("Are you _sure_ you want to delete and regenerate entry show positions? <b>This will completely annihilate all current show positions!</b>", mcb_ok, 0, 0);
+  {
+    jsConfirmBox("Are you <b>sure</b> you want to delete and regenerate entry show positions "+
+      (id == 0 ? "for ALL compos" : "for this compo") +"? "+
+      "<b>This will completely annihilate current show position numbers!</b>", mcb_ok, 0, 0);
+  }
   else
     mcb_ok(0);
 }