changeset 427:707213312891

Moar work.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 05 Dec 2013 21:19:41 +0200
parents 249631e194c8
children 7683101418ec
files admajax.php admin.css admin.php main.css
diffstat 4 files changed, 99 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/admajax.php	Thu Dec 05 20:21:55 2013 +0200
+++ b/admajax.php	Thu Dec 05 21:19:41 2013 +0200
@@ -288,7 +288,9 @@
   $str =
     ($outer ? $indent."<div class=\"ctrlBox\" id=\"ctrlRotationListEdit\">\n" : "").
     $indent."  <div class=\"ctrlTitle\">Edit rotation list</div>\n".
-    $indent."  ".stGetFormTextInput(30, SET_LEN_ROT_LIST_NAME, "ctrlEDRotationListName", "", "", "")."<br />\n".
+    $indent."  ".stGetFormTextInput(30, SET_LEN_ROT_LIST_NAME, "ctrlEDRotationListName", "", "", "")."\n".
+    $indent."  ".stGetFormButtonInput("updname", "", "", "Save", "updateRotationListName()")."\n".
+    "<br />\n".
     stGetOptionListStart("ctrlEDDisplaySlides", $indent."  ", TRUE);
 
   $sql = "SELECT * FROM displaySlides";
@@ -306,6 +308,7 @@
     $indent."    ".stGetFormButtonInput("moveslidedn", "", "", "Move Down", "moveRotationListSlide(1)")."\n".
     $indent."    ".stGetFormButtonInput("addslide", "", "", "Add slide", "addRotationListSlide()")."\n".
     $indent."    ".stGetFormButtonInput("delslide", "", "", "Remove slide", "removeRotationListSlide()")."\n".
+    $indent."    ".stGetFormButtonInput("delslide", "", "", "Close", "closeAdminPopup()")."\n".
     $indent."  </div>\n".
     ($outer ? $indent."</div>\n" : "");
 
@@ -616,6 +619,16 @@
         break;
 
       case "newRotationList":
+        $sql = stPrepareSQL("INSERT INTO rotationListData (name) VALUES (%s)", "New list #");
+        if (stExecSQLCond($sql, "Rotation list created.") !== false)
+        {
+          $list_id = $db->lastInsertId();
+          $sql = stPrepareSQL("UPDATE rotationListData SET name=%s WHERE id=%d",
+            "New list #.$list_id", $list_id);
+
+          if (stExecSQLCond($sql, "OK!") !== false)
+            echo stGetInfoRotationListEditFull("", TRUE, $list_id);
+        }
         break;
 
       case "updateRotationList":
@@ -685,11 +698,13 @@
         break;
     
       case "infoRotationListEdit":
-        echo stGetInfoRotationListEditFull("", FALSE);
+        if (stChkRequestItem("id", $list_id, array(CHK_TYPE, VT_INT, "Invalid data.")))
+          echo stGetInfoRotationListEditFull("", TRUE, $list_id);
         break;
 
       case "infoRotationListEditData":
-        echo stGetInfoRotationListEditData("", FALSE);
+        if (stChkRequestItem("id", $list_id, array(CHK_TYPE, VT_INT, "Invalid data.")))
+          echo stGetInfoRotationListEditData("", FALSE, $list_id);
         break;
 
       case "infoEditSlide":
@@ -733,7 +748,6 @@
           stGetFormButtonInput("regenerate", "", "", "ReGenerate ALL show positions", "generateEntryPositions(0, 0)")."\n".
           "</div>\n";
 
-/*
         echo
           "<div class=\"ctrlBox\" id=\"ctrlListRotationLists\">\n".
           "  <div class=\"ctrlTitle\">Rotation lists:</div>\n".
@@ -767,9 +781,7 @@
           "    ".stGetFormButtonInput("newslide", "", "", "New", "newDisplaySlide()")."\n".
           "    ".stGetFormButtonInput("delslide", "", "", "Delete", "deleteDisplaySlide()")."\n".
           "  </div>\n".
-          "</div>\n";
-*/
-        echo
+          "</div>\n".
           "<div class=\"ctrlBox\" id=\"ctrlCompoControl\">\n".
           "  <div class=\"ctrlTitle\">Competition control:</div>\n".
           "  <div class=\"ctrlDBox1\">\n".
@@ -797,9 +809,7 @@
           "    <div class=\"ctrlButtons\">\n".
           "      ".stGetFormButtonInput("setcompo", "", "", "Change compo", "activateCompo()")."\n".
           "    </div>\n".
-          "  </div>\n";
-        
-        echo
+          "  </div>\n".
           "  <div class=\"ctrlDBox1\">\n".
           stGetInfoCurrEntryList("    ", TRUE).
           "    <div class=\"ctrlButtons\">\n".
@@ -812,9 +822,7 @@
           stGetInfoCurrEntryData("    ").
           "  </div>\n".
           "</div>\n";
-//          .
-//          stGetInfoRotationListEditFull("", TRUE, 0);
-
+          stGetInfoRotationListEditFull("", TRUE, 0);
         break;
 
       case "news":
--- a/admin.css	Thu Dec 05 20:21:55 2013 +0200
+++ b/admin.css	Thu Dec 05 21:19:41 2013 +0200
@@ -169,10 +169,6 @@
 	text-align: right;
 }
 
-#ctrlEditRotationList {
-	width: 40em;
-}
-
 #ctrlEditRotationList input {
 	display: inline;
 }
@@ -221,3 +217,30 @@
 	width: 100%;
 }
 
+
+#adminPopup {
+	position: absolute;
+	top: 0px;
+	bottom: 0px;
+	left: 0px;
+	right: 0px;
+	z-index: 50;
+	display: none;
+}
+
+#adminPopup > div {
+	position: absolute;
+	top: 25%;
+	left: 10%;
+	height: auto;
+	min-width: 80%;
+	max-width: 80%;
+	z-index: 52;
+	background: black;
+	border: 1px solid green;
+	padding: 1.5em;
+
+	-moz-border-radius: 1em;
+	border-radius: 1em;
+}
+
--- a/admin.php	Thu Dec 05 20:21:55 2013 +0200
+++ b/admin.php	Thu Dec 05 21:19:41 2013 +0200
@@ -575,13 +575,62 @@
 }
 
 
+function closeAdminPopup()
+{
+  var nitem = document.getElementById("adminPopup");
+  if (nitem)
+  {
+    nitem.innerHTML = "";
+    nitem.style.display = "none";
+  }
+}
+
+
+function openAdminPopup(txt)
+{
+  var nitem = document.getElementById("adminPopup");
+  if (nitem)
+  {
+    nitem.innerHTML = txt;
+    nitem.style.display = "block";
+  }
+}
+
+
 function editRotationList()
 {
+  var id = jsGetValue("ctrlRotationListsSel", 4);
+  if (id > 0)
+    jsSendPOSTRequest("action=get&type=infoRotationListEdit&id="+id, openAdminPopup);
+  else
+    jsMessageBox("No rotation list selected?");
 }
 
 
 function newRotationList()
 {
+  var msuccess = function(txt)
+  {
+    jsRefreshItems("ctrlRotationListsSel", "infoRotationLists", "");
+    openAdminPopup(txt);
+  }
+
+  jsSendPOSTRequest("action=ctrl&type=newRotationList", msuccess);
+}
+
+
+function deleteRotationList()
+{
+  var msuccess = function(txt)
+  {
+    jsRefreshItems("ctrlRotationListsSel", "infoRotationLists", "");
+  }
+
+  var id = jsGetValue("ctrlRotationListsSel", 4);
+  if (id > 0)
+    jsSendPOSTRequest("action=ctrl&type=deleteRotationList&id="+id, msuccess);
+  else
+    jsMessageBox("No rotation list selected?");
 }
 
 
@@ -679,6 +728,7 @@
 
 <!-- ========================== -->
 
+<div id="adminPopup"></div>
 <div id="adminContent">
 
 <div id="nstatus">-</div>
--- a/main.css	Thu Dec 05 20:21:55 2013 +0200
+++ b/main.css	Thu Dec 05 21:19:41 2013 +0200
@@ -217,9 +217,8 @@
 #messageBox div.messageBoxInner {
 	position: absolute;
 	top: 25%;
-	min-width: 25%;
+	left: 10%;
 	height: auto;
-	left: 10%;
 	min-width: 50%;
 	max-width: 80%;
 	z-index: 52;