Mercurial > hg > fapweb
changeset 142:d2e9285b69ad
More work on the party info system.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 23 Oct 2013 00:47:33 +0300 |
parents | 04af508ffb14 |
children | 20893a5442b7 |
files | createdb.php show.php showajax.php |
diffstat | 3 files changed, 38 insertions(+), 31 deletions(-) [+] |
line wrap: on
line diff
--- a/createdb.php Wed Oct 23 00:13:46 2013 +0300 +++ b/createdb.php Wed Oct 23 00:47:33 2013 +0300 @@ -153,18 +153,18 @@ ); $siteDisplayVars = array( - "tempSlideDuration" => array(VT_INT, 120, "Temporary slide display time (seconds)"), + "tempDuration" => array(VT_INT, 120, "Temporary slide display time (seconds)"), "tempSlide" => array(VT_INT, 0, "Temporary slide ID"), - "showMode" => array(VT_INT, 0, "Currently active display mode"), + "showMode" => array(VT_INT, 0, "Currently active display mode"), "activeSlideMode" => array(VT_INT, 0, "Current active slide display mode"), "activeSlide" => array(VT_INT, 0, "Current active slide"), "activeSlideExpire" => array(VT_INT, 0, "Expiration timestamp of current slide"), - "rotateDuration" => array(VT_INT, 60, "Slide rotation time per slide (seconds)"), - "rotateList" => array(VT_INT, 0, "Current rotation list ID"), - "rotateListIndex" => array(VT_INT, 0, "Current index in rotation list"), + "rotateDuration" => array(VT_INT, 15, "Slide rotation time per slide (seconds)"), + "rotateList" => array(VT_INT, 0, "Current rotation list ID"), + "rotateListIndex" => array(VT_INT, 0, "Current index in rotation list"), ); $siteTestData = array( @@ -212,8 +212,8 @@ "title,text", "%s,%s", array("Next Up", "<h1>Next up: 4k intro</h1><h2>4k intro compo is about to begin</h2>... in about 10 minutes."), - array("Astu to infodesk", "<h1>Astu</h1>Please come to orga info desk!"), - array("Gentle Eye mainos", "<h1>Buy Amiga stuff!</h1><h2>Gentle Eye Oy is selling Amiga-related stuff near organizer desk!"), + array("Astu to infodesk", "<b>Astu</b> - please come to info desk!"), + array("Gentle Eye mainos", "<b>Buy Amiga stuff!</b><br />Gentle Eye Oy is selling Amiga-related stuff near organizer desk!"), ), "displayListData" => array(
--- a/show.php Wed Oct 23 00:13:46 2013 +0300 +++ b/show.php Wed Oct 23 00:47:33 2013 +0300 @@ -51,6 +51,16 @@ } +function updateView(txt) +{ + var view = document.getElementById("mainView"+ activeView); + if (view) + { + view.innerHTML = txt; + } +} + + function displayError() { // Increase failure count @@ -110,6 +120,7 @@ setTimeout("tickMain();", 1000); setInterval("tickAnim();", 25); +viewChanged(); </script> <?
--- a/showajax.php Wed Oct 23 00:13:46 2013 +0300 +++ b/showajax.php Wed Oct 23 00:47:33 2013 +0300 @@ -115,17 +115,17 @@ case "check": // Check if there has been any change $changed = FALSE; - if (stGetDisplayVar("tempSlideDuration") > 0 && stGetDisplayVar("tempSlide") > 0) + if (stGetDisplayVar("tempDuration") > 0 && stGetDisplayVar("tempSlide") > 0) { $sql = stPrepareSQL("SELECT * FROM displaySlides WHERE id=%d", stGetDisplayVar("tempSlide")); if (($res = stFetchSQL($sql)) !== false) { - stSetDisplayVar("tempSlideDuration", 0); + stSetDisplayVar("tempDuration", 0); stSetDisplayVar("activeSlideMode", SMODE_ROTATE); stSetDisplayVar("activeSlide", stGetDisplayVar("tempSlide")); - stSetDisplayVar("activeSlideExpire", time() + stGetDisplayVar("tempSlideDuration")); + stSetDisplayVar("activeSlideExpire", time() + stGetDisplayVar("tempDuration")); $changed = TRUE; } } @@ -146,57 +146,53 @@ if (time() >= stGetDisplayVar("activeSlideExpire") && stGetDisplayVar("rotateList") > 0) { - error_log("slide rotated"); - + error_log("Y"); // Get list of slides from active rotation list $list = stGetDisplayVar("rotateList"); $sql = stPrepareSQL( "SELECT * FROM displayListSlides WHERE list_id=%d ORDER BY id", $list); - if (($slideList = stFetchSQL($sql)) !== false) + if (($slideList = stExecSQL($sql)) !== false) { // Get slide at current index + $slides = array(); + foreach ($slideList as $slide) + $slides[] = $slide; + $index = stGetDisplayVar("rotateListIndex"); - - if (count($slideList) < $index) + if (count($slides) > $index) { - $slide_id = $slideList[$index]["slide_id"]; - stSetDisplayVar("activeSlide", $slide_id); - stSetDisplayVar("activeSlideExpire", time() + stGetDisplayVar("rotateSlideTime")); + $slide_id = $slides[$index]["slide_id"]; + if ($slide_id != stGetDisplayVar("activeSlide")) + { + stSetDisplayVar("activeSlide", $slide_id); + stSetDisplayVar("activeSlideExpire", time() + stGetDisplayVar("rotateDuration")); + $changed = TRUE; + error_log("rotated: ".$slide_id); + } } // Rotate to next slide - if (++$index >= count($slideList)) + if (++$index >= count($slides)) $index = 0; stSetDisplayVar("rotateListIndex", $index); - $changed = TRUE; } } - else - if (stGetDisplayVar("activeSlide") != -1) - { - // Emergency slide - stSetDisplayVar("activeSlide", -1); - stSetDisplayVar("activeSlideExpire", time() + stGetDisplayVar("rotateSlideTime")); - $changed = TRUE; - } break; case SMODE_COMPO: break; } - $changed = FALSE; - - echo $changed ? "changed" : "nochange"; stSetStatus(200, "OK"); break; case "get": // Based on the currently active mode ... + error_log("GET"); switch (stGetDisplayVar("activeSlideMode")) { case SMODE_ROTATE: