Mercurial > hg > fapweb
changeset 753:5fce9011101a
Implement per entry preview type editing.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 20 Nov 2014 08:26:55 +0200 |
parents | c714140541d5 |
children | ba85638cd75f |
files | admajax.php admin.js |
diffstat | 2 files changed, 20 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/admajax.php Thu Nov 20 08:24:30 2014 +0200 +++ b/admajax.php Thu Nov 20 08:26:55 2014 +0200 @@ -81,6 +81,10 @@ stChkRequestItemFail("info", $fake, $res, array(CHK_TYPE, VT_TEXT, "Invalid data."), array(CHK_LTEQ, VT_STR, SET_LEN_ENTRY_INFO, "Entry info too long.")); + + 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.")); break; case COMPO_POINTS: @@ -163,13 +167,13 @@ } -function stPrintEntryItemData($item, $row, $tr, $prefix, $ctype, $mode) +function stPrintEntryItemData($item, $row, $tr, $prefix, $compo, $mode) { global $entryFlagsList, $previewTypeList, $compoModeData; $eid = $item["id"]; - if ($ctype === FALSE) - $ctype = stFetchSQLColumn("SELECT ctype FROM compos WHERE id=".$item["compo_id"]); + if ($compo === FALSE) + $compo = stFetchSQL("SELECT * FROM compos WHERE id=".$item["compo_id"]); if ($tr) { @@ -184,7 +188,7 @@ " <div class=\"entryCell\">".($item["show_id"] > 0 ? $item["show_id"] : "-")."</div>\n"; } - switch ($ctype) + switch ($compo["ctype"]) { case COMPO_NORMAL: echo @@ -205,10 +209,10 @@ if ($mode == 0 || $mode == 1) { - echo " <div class=\"entryCell\">\n"; + echo " <div class=\"entryCell\">".$previewTypeList[$compo["preview_type"]][0]." / \n"; if ($mode) - stGetFormOptionListFromArray($prefix."preview_type".$eid, " ", FALSE, $previewTypeList, $item["preview_type"], 0); + echo stGetFormOptionListFromArray($prefix."preview_type".$eid, " ", FALSE, $previewTypeList, $item["preview_type"], 0, 1); else echo " ".$previewTypeList[$item["preview_type"]][1]; @@ -221,8 +225,12 @@ case COMPO_POINTS: case COMPO_ASSIGN: echo - " <div class=\"entryCell\">".stGetEditFormTextInput($mode, "Name", 15, SET_LEN_ENTRY_AUTHOR, "name", $eid, $prefix, $item["name"])."</div>\n". - " <div class=\"entryCell\">".stGetEditFormTextInput($mode, $compoModeData[$ctype][2], 5, SET_LEN_ENTRY_AUTHOR, "evalue", $eid, $prefix, $item["evalue"])."</div>\n". + " <div class=\"entryCell\">". + stGetEditFormTextInput($mode, "Name", 15, SET_LEN_ENTRY_AUTHOR, "name", $eid, $prefix, $item["name"]). + "</div>\n". + " <div class=\"entryCell\">". + stGetEditFormTextInput($mode, $compoModeData[$compo["ctype"]][2], 5, SET_LEN_ENTRY_AUTHOR, "evalue", $eid, $prefix, $item["evalue"]). + "</div>\n". " <div class=\"entryCell\">\n". " ".stGetEditFormTextArea($mode, "Notes", 2, 30, "notes", $eid, $prefix, $item["notes"])."\n". " </div>\n"; @@ -1441,11 +1449,11 @@ "flags" => 0, "evalue" => 0, ), - 0, TRUE, "ne", $compo["ctype"], 2); + 0, TRUE, "ne", $compo, 2); echo "<div class=\"entries\">\n"; $row = 0; foreach (stExecSQL("SELECT * FROM entries WHERE compo_id=".$id." ORDER BY id ASC") as $entry) - stPrintEntryItemData($entry, $row++, TRUE, "en", $compo["ctype"], 0); + stPrintEntryItemData($entry, $row++, TRUE, "en", $compo, 0); echo "</div>\n"; } break; @@ -1699,6 +1707,7 @@ "author" => "S", "filename" => "S", "info" => "Q", + "preview_type" => "D", ); break;
--- a/admin.js Thu Nov 20 08:24:30 2014 +0200 +++ b/admin.js Thu Nov 20 08:26:55 2014 +0200 @@ -436,7 +436,7 @@ function updateEntry(cid, id) { - var args = jsMakePostArgs({"name":1, "author":1, "filename":1, "info":1, "notes":1, "compo_id":2, "evalue":2}, "en", id, true); + var args = jsMakePostArgs({"name":1, "author":1, "filename":1, "info":1, "notes":1, "compo_id":2, "evalue":2, "preview_type":4}, "en", id, true); var compo_id = lastPostArgs["compo_id"]; var msuccess = function(txt)