# HG changeset patch # User Matti Hamalainen # Date 1416861737 -7200 # Node ID f27dccdde8ef4e9b950fff601994709abf1667c5 # Parent e213dca6354da6939681ca31b1ca3495fa588155 Partially remove old filename stuff from entries. Still some vestiges remain, however. diff -r e213dca6354d -r f27dccdde8ef admajax.php --- a/admajax.php Mon Nov 24 22:31:47 2014 +0200 +++ b/admajax.php Mon Nov 24 22:42:17 2014 +0200 @@ -82,10 +82,6 @@ array(CHK_ISGT, VT_STR, 0, "Author name not set."), array(CHK_LTEQ, VT_STR, SET_LEN_ENTRY_AUTHOR, "Entry author too long (%1 chars, must be less than %2).")); - stChkRequestItemFail("filename", $fake, $res, - array(CHK_TYPE, VT_TEXT, "Invalid data."), - array(CHK_LTEQ, VT_STR, SET_LEN_ENTRY_FILENAME, "Entry filename too long (%1 chars, must be less than %2).")); - 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).")); @@ -183,6 +179,11 @@ } +function stGetFileUploadAndSelector($mode, $prefix, $name, $entry, $what) +{ +} + + function stPrintEntryItemData($item, $row, $tr, $prefix, $compo, $mode) { global $entryFlagsList, $previewTypeList, $compoModeData; @@ -216,20 +217,8 @@ " ".stGetEditFormTextInput($mode, "Author", 20, SET_LEN_ENTRY_AUTHOR, "author", $eid, $prefix, $item["author"])."\n". " \n". "
\n". - " ".stGetEditFormTextInput($mode, "Scratch filename", 25, SET_LEN_ENTRY_FILENAME, "filename", $eid, $prefix, $item["filename"])."\n"; - - switch ($mode) - { - case 0: - - break; - - case 2: - echo "
Set above filename only if entry file not available. Otherwise, add entry, then upload.
"; - break; - } - - echo + stGetFileUploadAndSelector($mode, $prefix, "entryFileUpload", $entry, "file_id"). + stGetFileUploadAndSelector($mode, $prefix, "previewFileUpload", $entry, "preview_id"). "
\n". "
\n". " ".stGetEditFormTextArea($mode, "Info shown during compo", 2, 25, "info", $eid, $prefix, $item["info"])."\n". @@ -1512,12 +1501,12 @@ "name" => "", "author" => "", "compo_id" => $id, - "filename" => "", "info" => "", "notes" => "", "preview_type" => 0, "flags" => 0, "evalue" => 0, + "utime" => 0, ), 0, TRUE, "ne", $compo, EEMODE_ADD); @@ -1663,15 +1652,15 @@ { case COMPO_NORMAL: $sql = stPrepareSQL( - "INSERT INTO entries (name,author,compo_id,filename,info,notes,preview_type) VALUES (%S,%S,%d,%S,%Q,%Q,%D)", - "name", "author", $compo["id"], "filename", "info", "notes", "preview_type"); + "INSERT INTO entries (name,author,compo_id,info,notes,preview_type,utime,owner_id) VALUES (%S,%S,%d,%Q,%Q,%D,%d,0)", + "name", "author", $compo["id"], "info", "notes", "preview_type", time()); break; case COMPO_POINTS: case COMPO_ASSIGN: $sql = stPrepareSQL( - "INSERT INTO entries (name,compo_id,notes,evalue) VALUES (%S,%d,%Q,%D)", - "name", $compo["id"], "notes", "evalue"); + "INSERT INTO entries (name,compo_id,notes,evalue,utime,owner_id) VALUES (%S,%d,%Q,%D,%d,0)", + "name", $compo["id"], "notes", "evalue", time()); break; } stExecSQLCond($sql, "OK, entry added."); @@ -1783,7 +1772,6 @@ case COMPO_NORMAL: $cdata = array( "author" => "S", - "filename" => "S", "info" => "Q", "preview_type" => "D", "compo_id" => "D", diff -r e213dca6354d -r f27dccdde8ef dbdefs.inc.php --- a/dbdefs.inc.php Mon Nov 24 22:31:47 2014 +0200 +++ b/dbdefs.inc.php Mon Nov 24 22:42:17 2014 +0200 @@ -280,12 +280,15 @@ array("name" , "VARCHAR(".SET_LEN_ENTRY_NAME.")"), array("author" , "VARCHAR(".SET_LEN_ENTRY_AUTHOR.")"), array("compo_id" , "INT", "DEFAULT 0"), - array("filename" , "VARCHAR(".SET_LEN_ENTRY_FILENAME.")", "DEFAULT NULL"), array("info" , "VARCHAR(".SET_LEN_ENTRY_INFO.")", "DEFAULT NULL"), array("notes" , "VARCHAR(".SET_LEN_ENTRY_NOTES.")", "DEFAULT NULL"), - array("preview_type" , "INT", "DEFAULT 0"), array("flags" , "INT", "DEFAULT 0"), array("evalue" , "INT", "DEFAULT 0"), + array("file_id" , "INT", "DEFAULT 0"), // currently default file from "files" table + array("preview_type" , "INT", "DEFAULT 0"), // see EPREV_*, overrides compo's general type if != 0 + array("utime" , "INT", "DEFAULT 0"), + array("owner_id" , "INT", "DEFAULT 0"), // 0 = admin, otherwise votekey id + ), ), "attendees" => array(