changeset 867:74ee30f5b34d

Cleanups.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 26 Nov 2014 12:11:25 +0200
parents db9810510670
children 6829da58c17c
files admajax.php admin.js
diffstat 2 files changed, 26 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/admajax.php	Wed Nov 26 11:45:48 2014 +0200
+++ b/admajax.php	Wed Nov 26 12:11:25 2014 +0200
@@ -417,7 +417,7 @@
 }
 
 
-function stGetInfoOneEntryData($show_id, $compo_id)
+function stGetInfoEntryData($show_id, $compo_id)
 {
   if ($show_id > 0)
   {
@@ -426,17 +426,27 @@
 
     if (($entry = stFetchSQL($sql)) !== false)
     {
-      return
-        "<b>#".$entry["show_id"]." - ".chentities($entry["name"]).
-        " by ".chentities($entry["author"])."</b><br />".
-        "<i>".chentities(substr($entry["filename"], 0, 40))."</i>";
+      $str =
+        "<div class=\"entryInfo\">#".$entry["show_id"]." - ".chentities($entry["name"]).
+        " by ".chentities($entry["author"])."</div>";
+
+      if (($efile = stFetchSQL("SELECT * FROM files WHERE id=".$entry["file_id"])) !== false)
+      {
+        $str .=
+          "<div class=\"entryFile\">".chentities($efile["filename"])."</div>".
+          "<div class=\"entryFile\">".chentities($efile["origname"])."</div>";
+      }
+      else
+        $str .= "<div class=\"entryFile\">NO FILE</div>";
+
+      return $str;
     }
   }
   return "-";
 }
 
 
-function stGetInfoCurrEntryData($indent)
+function stGetInfoCurrCompoData($indent)
 {
   $compoID = stGetDisplayVar("compoID");
   if ($compoID > 0)
@@ -445,16 +455,16 @@
     if (($entry = stFetchSQL($sql)) !== false)
       $strCompo = chentities($entry["name"]);
 
-    $strCurrEntry = stGetInfoOneEntryData(stGetDisplayVar("compoCurrEntry"), $compoID);
-    $strPrevEntry = stGetInfoOneEntryData(stGetDisplayVar("compoPrevEntry"), $compoID);
+    $strCurrEntry = stGetInfoEntryData(stGetDisplayVar("compoCurrEntry"), $compoID);
+    $strPrevEntry = stGetInfoEntryData(stGetDisplayVar("compoPrevEntry"), $compoID);
   }
   else
     $strCompo = $strCurrEntry = $strCurrEntryFile = $strPrevEntry = "-";
 
   return
-    $indent."<div>Compo: <b>".$strCompo."</b></div>\n".
-    $indent."<div>Current entry:<br />".$strCurrEntry."</div>\n".
-    $indent."<div>Previous entry:<br />".$strPrevEntry."</div>\n";
+    $indent."<div class=\"entryData\">Compo: <b>".$strCompo."</b></div>\n".
+    $indent."<div class=\"entryData\"><div class=\"entryDataTitle\">Current entry:</div>".$strCurrEntry."</div>\n".
+    $indent."<div class=\"entryData\"><div class=\"entryDataTitle\">Previous entry:</div>".$strPrevEntry."</div>\n";
 }
 
 
@@ -1079,8 +1089,8 @@
     //
     switch ($type)
     {
-      case "infoCurrEntryData":
-        echo stGetInfoCurrEntryData("", FALSE);
+      case "infoCurrCompoData":
+        echo stGetInfoCurrCompoData("", FALSE);
         break;
 
       case "infoCurrEntryList":
@@ -1209,8 +1219,8 @@
           "      ".stGetFormButtonInput("nextentry", "", "", "Next entry", "switchEntry(1)")."\n".
           "    </div>\n".
           "  </div>\n".
-          "  <div class=\"ctrlDBox2\" id=\"ctrlCurrEntryData\">\n".
-          stGetInfoCurrEntryData("    ").
+          "  <div class=\"ctrlDBox2\" id=\"ctrlCurrCompoData\">\n".
+          stGetInfoCurrCompoData("    ").
           "  </div>\n".
           "</div>\n";
           stGetInfoRotationListEditFull("", TRUE, 0);
--- a/admin.js	Wed Nov 26 11:45:48 2014 +0200
+++ b/admin.js	Wed Nov 26 12:11:25 2014 +0200
@@ -618,7 +618,7 @@
 
 function refreshCurrEntryData()
 {
-  jsRefreshItems("ctrlCurrEntryData", "infoCurrEntryData", "");
+  jsRefreshItems("ctrlCurrCompoData", "infoCurrCompoData", "");
 }