Mercurial > hg > fapweb
view show.php @ 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 | 75cf14ee99a7 |
children | c030c3cf0d80 |
line wrap: on
line source
<? // // FAPWeb Simple Demoparty System // Party information display system // (C) Copyright 2012-2013 Tecnic Software productions (TNSP) // require "mconfig.inc.php"; require "msite.inc.php"; require "mcommon.inc.php"; require "majax.php"; stSetupCacheControl(); cmPrintPageHeader("PARTY INFORMATION DISPLAY SYSTEM", "", FALSE); stCommonAJAX("showajax.php", "show.php", TRUE); ?> <!-- ========================== --> <noscript> <div class="notice"> <h1>Javascript required</h1> <p> The compo system page requires Javascript to be enabled for the AJAX functionality. <br /> <a href="#">Please enable Javascript and reload this page</a>. </p> </div> </noscript> <div class="showView" id="mainView0"></div> <div class="showView" id="mainView1"></div> <!-- ========================== --> <script type="text/javascript"> var failCount = 0; var prevView = -1, activeView = 0; var errorView = false; function tickAnim() { if (activeView != prevView) { document.getElementById("mainView0").style.display = (activeView == 0) ? "block" : "none"; document.getElementById("mainView1").style.display = (activeView == 1) ? "block" : "none"; prevView = activeView; } } function updateView(txt) { var view = document.getElementById("mainView"+ activeView); if (view) { view.innerHTML = txt; } } function displayError() { // Increase failure count if (++failCount > 5 && !errorView) { errorView = true; updateView("... error ..."); } } // // Update view when triggered by main tick // function viewChanged() { var msuccess = function(txt) { // Successfully fetched new data, initiate view update failCount = 0; errorView = false; updateView(txt); } sendPOSTRequest("action=get", msuccess, displayError); } // // Main tick function, check for updates from server // function tickMain() { var msuccess = function(txt) { failCount = 0; if (txt == "changed") { viewChanged(); setTimeout("tickMain();", 500); } else { setTimeout("tickMain();", 2000); } } var mfail = function(txt) { displayError(); setTimeout("tickMain();", 5000); } sendPOSTRequest("action=check", msuccess, mfail); } setTimeout("tickMain();", 1000); setInterval("tickAnim();", 25); viewChanged(); </script> <? cmPrintPageFooter(FALSE); ?>