changeset 846:e0c9bf182bb7

More work, another database change :S
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 25 Nov 2014 23:54:38 +0200
parents 123cd6868b1b
children 7fee98f15c3c
files admajax.php dbdefs.inc.php
diffstat 2 files changed, 24 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/admajax.php	Tue Nov 25 23:49:41 2014 +0200
+++ b/admajax.php	Tue Nov 25 23:54:38 2014 +0200
@@ -181,6 +181,24 @@
 
 function stGetFileUploadAndSelector($mode, $entry, $type, $file_id, $title)
 {
+  if ($mode == 2)
+    return "";
+
+  $eid = $entry["id"];
+  $str = "<div class=\"editControl\"><span class=\"editControlTitle\">".chentities($title)."</span>\n";
+
+  if (($efile = stFetchSQL("SELECT * FROM files WHERE id=".$entry[$file_id])) !== false)
+  {
+    $str .=
+      "<div>File: <b>".chentities($efile["filename"])."</b></div>\n".
+      "<div>Orig: <b>".chentities($efile["origname"])."</b></div>\n";
+  }
+
+  if ($mode == 1)
+  {
+  }
+
+  return $str."</div>\n";
 }
 
 
@@ -721,7 +739,8 @@
     //
     // File upload
     //
-    stHandleGenericFileUpload(0);
+    if (stHandleGenericFileUpload(0))
+      stSetStatus(200, "File successfully uploaded.");
     break;
 
   case "randomize":
--- a/dbdefs.inc.php	Tue Nov 25 23:49:41 2014 +0200
+++ b/dbdefs.inc.php	Tue Nov 25 23:54:38 2014 +0200
@@ -1,6 +1,6 @@
 <?
 
-$dbVersion = 25;
+$dbVersion = 26;
 
 //
 // Site settings and defaults we put in
@@ -284,8 +284,8 @@
     array("notes"        , "VARCHAR(".SET_LEN_ENTRY_NOTES.")", "DEFAULT NULL"),
     array("flags"        , "INT", "DEFAULT 0"),
     array("evalue"       , "INT", "DEFAULT 0"),
-    array("file_id"      , "INT", "DEFAULT 0"), // currently default file from "files" table
-    array("preview_id"   , "INT", "DEFAULT 0"), // currently default preview from "files" table
+    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 EPREV_*, overrides compo's general type if != 0
     array("utime"        , "INT", "DEFAULT 0"),
     array("owner_id"     , "INT", "DEFAULT 0"), // 0 = admin, otherwise votekey id
@@ -293,13 +293,12 @@
 
   "files" => array(
     array("id"           , "INTEGER", "PRIMARY KEY", "AUTOINCREMENT"),
-    array("orig_filename", "VARCHAR(".SET_LEN_ENTRY_FILENAME.")", "DEFAULT NULL"), // original uploaded filename
     array("filename"     , "VARCHAR(".SET_LEN_ENTRY_FILENAME.")", "DEFAULT NULL"), // stored filename
+    array("origname"     , "VARCHAR(".SET_LEN_ENTRY_FILENAME.")", "DEFAULT NULL"), // original uploaded filename
     array("filetype"     , "VARCHAR(32)", "DEFAULT NULL"), // type of the file, if any, as key from $fileTypeData
     array("filesize"     , "INT", "DEFAULT 0"), // uploaded size
     array("entry_id"     , "INT", "DEFAULT 0"), // belongs to this entry (0 = none)
     array("uploader_id"  , "INT", "DEFAULT 0"), // 0 = admin, otherwise votekey id
-    array("deleted"      , "INT", "DEFAULT 0"), // 0 = ok, 1 = to be deleted (don't show in filelists)
     array("utime"        , "INT", "DEFAULT 0"),
   ),