# HG changeset patch # User Matti Hamalainen # Date 1447997333 -7200 # Node ID 8fecb417e6a98ec72557c0fb32a7381a838cb143 # Parent ed22a3a3027f1824070ca2b65be0f6cc33ea2a55 Reintroduce per-entry preview_type. diff -r ed22a3a3027f -r 8fecb417e6a9 admajax.php --- a/admajax.php Fri Nov 20 07:20:39 2015 +0200 +++ b/admajax.php Fri Nov 20 07:28:53 2015 +0200 @@ -87,6 +87,13 @@ stChkRequestItemFail("info", $fake, $res, array(CHK_TYPE, VT_TEXT, "Invalid data."), array(CHK_LTEQ, VT_STR, SET_LEN_ENTRY_INFO, "Entry info text too long (%1 chars, must be less than %2).")); + + if ($full) + { + 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: @@ -1594,6 +1601,7 @@ "compo_id" => $id, "info" => "", "notes" => "", + "preview_type" => 0, "flags" => 0, "evalue" => "", "utime" => 0, diff -r ed22a3a3027f -r 8fecb417e6a9 admin.js --- a/admin.js Fri Nov 20 07:20:39 2015 +0200 +++ b/admin.js Fri Nov 20 07:28:53 2015 +0200 @@ -470,7 +470,7 @@ function updateEntry(cid, id, edit) { - var args = jsMakePostArgs({"name":1, "author":1, "filename":1, "info":1, "notes":1, "compo_id":4, "evalue":2}, "en", id, true); + var args = jsMakePostArgs({"name":1, "author":1, "filename":1, "info":1, "notes":1, "compo_id":4, "evalue":2, "preview_type":4}, "en", id, true); var has_id = "compo_id" in lastPostArgs; var compo_id = lastPostArgs["compo_id"]; diff -r ed22a3a3027f -r 8fecb417e6a9 dbdefs.inc.php --- a/dbdefs.inc.php Fri Nov 20 07:20:39 2015 +0200 +++ b/dbdefs.inc.php Fri Nov 20 07:28:53 2015 +0200 @@ -262,9 +262,8 @@ array("visible" , "INT", "DEFAULT 0"), array("voting" , "INT", "DEFAULT 0"), - // Default preview type (see PREV_* in msite.inc.php) - // Global for the compo (entry-specific overrides if it is != PREV_NONE) - // Preview filename/path is determined internally + // Default preview type (see EFILE_* in msite.inc.php) for this compo. + // Global for the compo (entry-specific overrides if it is != EFILE_NONE) array("preview_type" , "INT", "DEFAULT 0"), array("show_authors" , "INT", "DEFAULT 0"), @@ -287,6 +286,7 @@ array("evalue" , "INT", "DEFAULT 0"), array("file_id" , "INT", "DEFAULT 0"), // uploaded file id from "files" table array("preview_id" , "INT", "DEFAULT 0"), // uploaded preview file id from "files" table + array("preview_type" , "INT", "DEFAULT 0"), // see EFILE_*, overrides compo's general type if != 0 array("utime" , "INT", "DEFAULT 0"), array("owner_id" , "INT", "DEFAULT 0"), // 0 = admin, otherwise votekey id ),