changeset 640:c78e11aa3162

Rename a database field, so that it does not conflict with AJAX request item name.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 03 Nov 2014 01:58:04 +0200
parents 26ec29d2e728
children 1a123c6c2241
files admajax.php admin.js dbdefs.inc.php msite.inc.php
diffstat 4 files changed, 18 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/admajax.php	Mon Nov 03 01:40:28 2014 +0200
+++ b/admajax.php	Mon Nov 03 01:58:04 2014 +0200
@@ -18,9 +18,9 @@
     !stChkRequestItem("description", $fake,
       array(CHK_ISGT, VT_STR, 10, "Compo description too short"),
       array(CHK_LTEQ, VT_STR, SET_LEN_COMPO_DESC, "Compo description too long.")) ||
-    !stChkRequestItem("path", $fake,
+    !stChkRequestItem("cpath", $fake,
       array(CHK_LTEQ, VT_STR, SET_LEN_COMPO_PATH, "Compo file path too long.")) ||
-    !stChkRequestItem("type", $fake,
+    !stChkRequestItem("ctype", $fake,
       array(CHK_RANGE, VT_INT, array(COMPO_NORMAL, COMPO_ASSIGN), "Invalid compo type.")))
     return FALSE;
   
@@ -85,7 +85,7 @@
 
 function stGetCompoData($id, $item, $prefix)
 {
-  switch ($item["type"])
+  switch ($item["ctype"])
   {
     case COMPO_NORMAL:
       $str = "  ".
@@ -101,13 +101,13 @@
   return
     "  <h2>#".$id." - ".chentities($item["name"])."</h2>\n".
     "  Name: ".stGetFormTextInput(40, SET_LEN_COMPO_NAME, "name", $id, $prefix, $item["name"])."<br />\n".
-    "  File path: ".stGetFormTextInput(40, SET_LEN_COMPO_PATH, "path", $id, $prefix, $item["path"])."<br />\n".
+    "  File path: ".stGetFormTextInput(40, SET_LEN_COMPO_PATH, "cpath", $id, $prefix, $item["cpath"])."<br />\n".
     "  ".stGetFormTextArea(8, 60, "description", $id, $prefix, $item["description"])."<br />\n".
     "  ".stGetFormButtonInput("update", $id, $prefix, "Update", "updateCompo(".$id.")")."\n".
     "  ".stGetFormButtonInput("delete", $id, $prefix, "Delete", "deleteCompo(".$id.")")."\n".
     "  ".stGetFormCheckBoxInput("visible", $id, $prefix, $item["visible"], "Visible", "onChange=\"setCompoData(".$id.",'visible')\"")."\n".
     "  ".stGetFormCheckBoxInput("show_authors", $id, $prefix, $item["show_authors"], "Show authors", "onChange=\"setCompoData(".$id.",'show_authors')\"")."\n".
-    $str;
+    $str."\n";
 }
 
 
@@ -1434,7 +1434,7 @@
     {
       $sql = stPrepareSQL(
         "INSERT INTO compos (name,description,visible,voting,show_authors,path,type) VALUES (%S,%Q,%D,0,0,0,%S,%D)",
-        "name", "description", "path", "type");
+        "name", "description", "cpath", "ctype");
 
       stExecSQLCond($sql, "OK, compo added.");
     }
@@ -1520,8 +1520,8 @@
             "visible" => "B",
             "voting" => "B",
             "show_authors" => "B",
-            "path" => "S",
-            "type" => "D",
+            "cpath" => "S",
+            "ctype" => "D",
           ));
 
         stExecSQLCond($sql, "OK, compo updated.");
--- a/admin.js	Mon Nov 03 01:40:28 2014 +0200
+++ b/admin.js	Mon Nov 03 01:58:04 2014 +0200
@@ -296,7 +296,7 @@
 
 function updateCompo(id)
 {
-  var args = jsMakePostArgs({"name":1, "description":1, "visible":3, "voting":3, "show_authors":3, "path":1}, "co", id);
+  var args = jsMakePostArgs({"name":1, "description":1, "visible":3, "voting":3, "show_authors":3, "cpath":1}, "co", id);
 
   var msuccess = function(txt)
   {
--- a/dbdefs.inc.php	Mon Nov 03 01:40:28 2014 +0200
+++ b/dbdefs.inc.php	Mon Nov 03 01:58:04 2014 +0200
@@ -1,6 +1,6 @@
 <?
 
-$dbVersion = 16;
+$dbVersion = 17;
 
 //
 // Site settings and defaults we put in
@@ -229,8 +229,8 @@
     array("visible"      , "INT", "DEFAULT 0"),
     array("voting"       , "INT", "DEFAULT 0"),
     array("show_authors" , "INT", "DEFAULT 0"),
-    array("type"         , "INT", "DEFAULT 0"),
-    array("path"         , "VARCHAR(".SET_LEN_COMPO_PATH.")"),
+    array("ctype"        , "INT", "DEFAULT 0"),
+    array("cpath"        , "VARCHAR(".SET_LEN_COMPO_PATH.")"),
   ),
   
   "entries" => array(
@@ -414,6 +414,11 @@
   14 => array(
     "settings_groups" => array("table" => FALSE),
   ),
+  
+  17 => array(
+    "ctype" => array("key" => "type"),
+    "cpath" => array("key" => "path"),
+  ),
 );
 
 
--- a/msite.inc.php	Mon Nov 03 01:40:28 2014 +0200
+++ b/msite.inc.php	Mon Nov 03 01:58:04 2014 +0200
@@ -416,7 +416,7 @@
   //
   // Act based on competition type
   //
-  switch ($compo["type"])
+  switch ($compo["ctype"])
   {
     case COMPO_NORMAL:
       //