# HG changeset patch # User Matti Hamalainen # Date 1415647583 -7200 # Node ID 45750a346f3e79d14649c80c6a1a0d551a14f809 # Parent de13b834249fa08f345c06d56963982a9d08a828 Add default preview_type for compos, and remove preview_file element from entries, we will just compute the filename. diff -r de13b834249f -r 45750a346f3e admajax.php --- 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"])."
\n". " File path: ".stGetFormTextInput(40, SET_LEN_COMPO_PATH, "cpath", $id, $prefix, $item["cpath"])."
\n". " ".stGetFormTextArea(8, 60, "description", $id, $prefix, $item["description"])."
\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", ); diff -r de13b834249f -r 45750a346f3e admin.js --- a/admin.js Mon Nov 10 21:25:28 2014 +0200 +++ b/admin.js Mon Nov 10 21:26:23 2014 +0200 @@ -293,7 +293,7 @@ function updateCompo(id) { - var args = jsMakePostArgs({"name":1, "description":1, "visible":3, "voting":3, "show_authors":3, "cpath":1}, "co", id, true); + var args = jsMakePostArgs({"name":1, "description":1, "visible":3, "voting":3, "show_authors":3, "cpath":1, "preview_type":4}, "co", id, true); var msuccess = function(txt) { diff -r de13b834249f -r 45750a346f3e dbdefs.inc.php --- a/dbdefs.inc.php Mon Nov 10 21:25:28 2014 +0200 +++ b/dbdefs.inc.php Mon Nov 10 21:26:23 2014 +0200 @@ -1,6 +1,6 @@