changeset 62:101cde58b267

Add a new setting for ASCII vs. HTML table output for compo results.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 05 Oct 2013 12:34:23 +0300
parents e85ed35585fc
children 922b5192b2ff
files createdb.php results.inc.php
diffstat 2 files changed, 19 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/createdb.php	Sat Oct 05 12:33:59 2013 +0300
+++ b/createdb.php	Sat Oct 05 12:34:23 2013 +0300
@@ -49,12 +49,13 @@
   "userTimeout"      => array(VT_INT, 120, "User pages (voting, entry submission) timeout in minutes"),
   "admTimeout"       => array(VT_INT, 15, "Administration interface timeout in minutes"),
 
-  "showAdmin"        => array(VT_BOOL, false, "Show administration interface link on the menu"),
+  "showAdmin"        => array(VT_BOOL, false, "Always show administration interface link on the menu"),
   "showAttendees"    => array(VT_BOOL, false, "Show attendees list"),
   "allowRegister"    => array(VT_BOOL, false, "Enable event registration"),
   "allowVoting"      => array(VT_BOOL, false, "Enable voting (individual compos must be enabled as well)"),
 
   "showResults"      => array(VT_BOOL, false, "Enable results page"),
+  "showResultsASCII" => array(VT_BOOL, true,  "Show results as ASCII instead of HTML table"),
   "showResAuthors"   => array(VT_BOOL, false, "Show entry authors on results page"),
 
   "requireEMail"     => array(VT_BOOL, false, "Require e-mail address in registrations"),
--- a/results.inc.php	Sat Oct 05 12:33:59 2013 +0300
+++ b/results.inc.php	Sat Oct 05 12:34:23 2013 +0300
@@ -1,13 +1,8 @@
 <?
-$text = TRUE;
+$useASCII = stGetSetting("showResultsASCII");
 $showResults = stGetSetting("showResults");
 $showAuthors = stGetSetting("showResAuthors");
 
-// Show everything for the admin session
-if (stAdmSessionAuth())
-  $showResults = $showAuthors = TRUE;
-
-
 function stChop($str, $len)
 {
   if (strlen($str) > $len)
@@ -19,6 +14,19 @@
 
 
 echo "<h1>Results</h1>\n";
+
+// Show everything for the admin session
+if (stAdmSessionAuth())
+{
+  if (!$showResults)
+    echo "<p>Results hidden from normal users.</p>";
+  if (!$showAuthors)
+    echo "<p>Entry authors hidden from normal users.</p>";
+
+  $showResults = $showAuthors = TRUE;
+}
+
+
 if (!$showResults)
 {
   echo "<p>Sorry, no results available! Nothing to see here, move along.</p>";
@@ -27,7 +35,7 @@
 {
   if (($res = stExecSQL("SELECT * FROM compos WHERE visible<>0 ORDER BY name DESC")) !== FALSE)
   {
-    if ($text) echo "<pre>\n";
+    if ($useASCII) echo "<pre>\n";
     foreach ($res as $compo)
     {
       $sql =
@@ -39,7 +47,7 @@
 
       if (($fres = stExecSQL($sql)) !== FALSE)
       {
-        if ($text)
+        if ($useASCII)
         {
           echo "<b> ".$compo["name"]." </b>\n";
           echo str_repeat("=", strlen($compo["name"]) + 2)."-- - .\n\n";
@@ -95,7 +103,7 @@
         }
       }
     }
-    if ($text) echo "</pre>\n";
+    if ($useASCII) echo "</pre>\n";
   }
 }
 ?>
\ No newline at end of file