diff admajax.php @ 705:45750a346f3e

Add default preview_type for compos, and remove preview_file element from entries, we will just compute the filename.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 10 Nov 2014 21:26:23 +0200
parents bad79296eb34
children a91a91b8160e
line wrap: on
line diff
--- a/admajax.php	Mon Nov 10 21:25:28 2014 +0200
+++ b/admajax.php	Mon Nov 10 21:26:23 2014 +0200
@@ -41,6 +41,10 @@
   stChkRequestItemFail("show_authors", $fake, $res,
     array(CHK_TYPE, VT_BOOL, "Invalid data."));
 
+  stChkRequestItemFail("preview_type", $fake, $res,
+    array(CHK_TYPE, VT_INT, "Invalid data."),
+    array(CHK_RANGE, VT_INT, array(EPREV_NONE, EPREV_AUDIO), "Invalid preview type value."));
+
   stChkRequestItemFail("cpath", $fake, $res,
     array(CHK_LTEQ, VT_STR, SET_LEN_COMPO_PATH, "Compo file path too long."));
 
@@ -97,7 +101,7 @@
 
 function stGetCompoData($id, $item, $prefix)
 {
-  global $compoModeData;
+  global $compoModeData, $previewTypeList;
 
   // XXX TODO Dropdown menu or so for selecting compo type
   switch ($item["ctype"])
@@ -119,6 +123,7 @@
     "  Name: ".stGetFormTextInput(40, SET_LEN_COMPO_NAME, "name", $id, $prefix, $item["name"])."<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".
+    "  ".stGetFormOptionListFromArray($prefix."preview_type".$id, "  ", FALSE, $previewTypeList, $item["preview_type"], 0)."\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".
@@ -1584,6 +1589,7 @@
             "description" => "Q",
             "visible" => "B",
             "show_authors" => "B",
+            "preview_type" => "D",
             "cpath" => "S",
           );