changeset 737:f97498ef28f4

Various minor fixes to the slide handling.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 19 Nov 2014 02:59:55 +0200
parents e1d5c3e19930
children 249cba787da0
files showajax.php
diffstat 1 files changed, 57 insertions(+), 37 deletions(-) [+]
line wrap: on
line diff
--- a/showajax.php	Wed Nov 19 02:42:18 2014 +0200
+++ b/showajax.php	Wed Nov 19 02:59:55 2014 +0200
@@ -174,6 +174,14 @@
       $updated = TRUE;
     }
     break;
+
+  case SMODE_DISABLED:
+    if (stGetDisplayVar("activeSlideMode") != SMODE_DISABLED)
+    {
+      stSetDisplayVar("activeSlideMode", SMODE_DISABLED);
+      $updated = TRUE;
+    }
+    break;
 }
 
 // Check if we need to update the "last updated" timestamp
@@ -201,47 +209,59 @@
         break;
 
       case "slide":
-      // Based on the currently active mode ...
-      switch (stGetDisplayVar("activeSlideMode"))
-      {
-        case SMODE_DISABLED:
-          stGuruMeditation();
-          break;
+        // Based on the currently active mode ...
+        switch (stGetDisplayVar("activeSlideMode"))
+        {
+          case SMODE_ROTATE:
+            // Slide rotation mode, display currently active slide
+            if (stGetDisplayVar("activeSlide") > 0)
+            {
+              $sql = stPrepareSQL("SELECT * FROM display_slides WHERE id=%d",
+                stGetDisplayVar("activeSlide"));
 
-        case SMODE_ROTATE:
-          // Slide rotation mode, display currently active slide
-          if (stGetDisplayVar("activeSlide") > 0)
-          {
-            $sql = stPrepareSQL("SELECT * FROM display_slides WHERE id=%d",
-              stGetDisplayVar("activeSlide"));
+              if (($slide = stFetchSQL($sql)) !== false)
+                stPrintRotationSlide($slide);
+            }
+            else
+              stGuruMeditation();
+            break;
+          
+          case SMODE_COMPO:
+            // Competition mode, show entry data
+            $compo_id = stGetDisplayVar("compoID");
+            $compo = stFetchSQL(stPrepareSQL(
+              "SELECT * FROM compos WHERE id=%d",
+              $compo_id));
 
-            if (($slide = stFetchSQL($sql)) !== false)
-              stPrintRotationSlide($slide);
-          }
-          else
+            $prev = stFetchSQL(stPrepareSQL(
+              "SELECT * FROM entries WHERE compo_id=%d AND show_id=%d AND show_id<>0",
+              $compo_id, stGetDisplayVar("compoPrevEntry")));
+
+            $entry = stFetchSQL(stPrepareSQL(
+              "SELECT * FROM entries WHERE compo_id=%d AND show_id=%d AND show_id<>0",
+              $compo_id, stGetDisplayVar("compoCurrEntry")));
+
+            if ($compo !== false)
+              stPrintCompoSlide($compo, $entry, $prev);
+            break;
+
+          default:
+            echo
+            "  <div class=\"showHeader\">\n".
+            "  </div>\n".
+            "  <div class=\"showText\">\n";
+          
             stGuruMeditation();
-          break;
-        
-        case SMODE_COMPO:
-          // Competition mode, show entry data
-          $compo_id = stGetDisplayVar("compoID");
-          $compo = stFetchSQL(stPrepareSQL(
-            "SELECT * FROM compos WHERE id=%d",
-            $compo_id));
 
-          $prev = stFetchSQL(stPrepareSQL(
-            "SELECT * FROM entries WHERE compo_id=%d AND show_id=%d AND show_id<>0",
-            $compo_id, stGetDisplayVar("compoPrevEntry")));
-
-          $entry = stFetchSQL(stPrepareSQL(
-            "SELECT * FROM entries WHERE compo_id=%d AND show_id=%d AND show_id<>0",
-            $compo_id, stGetDisplayVar("compoCurrEntry")));
-
-          if ($compo !== false)
-            stPrintCompoSlide($compo, $entry, $prev);
-          break;
-      }
-      break;
+            echo
+            "  </div>\n";
+            break;
+        }
+        break;
+      
+      default:
+        stGuruMeditation();
+        break;
     }
     break;