view show.php @ 820:e213dca6354d

Add filename as ref variable argument to stSetFileEntryFilename().
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 24 Nov 2014 22:31:47 +0200
parents e1d5c3e19930
children 6c1a67bdcca8
line wrap: on
line source

<?
//
// FAPWeb - Simple Web-based Demoparty Management System
// Party information display system
// (C) Copyright 2012-2014 Tecnic Software productions (TNSP)
//
require_once "mconfig.inc.php";
require_once "msite.inc.php";
require_once "msession.inc.php";
require_once "majax.inc.php";

$pageCSS = "css/show.css";

stSetupCacheControl();

cmPrintPageHeader("PARTY INFORMATION DISPLAY SYSTEM", "", FALSE);
stCommonAJAX("showajax.php", "show.php");
?>

<!-- ========================== -->

<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="mainView"></div>

<!-- ========================== -->

<script type="text/javascript">

var failCount = 0;
var lastUpdate = 0;
var errorView = false;


function updateView(txt)
{
  var view = document.getElementById("mainView");
  if (view && txt != false && txt != "")
    view.innerHTML = txt;
}


function displayError()
{
  // Increase failure count
  if (++failCount > 5 && !errorView)
  {
    errorView = true;
    updateView("<div class=\"guru\">Software Failure.&nbsp;&nbsp;&nbsp;Press left mouse button to continue.<br />Guru Meditation #00000004.0000AAC0</div>");
  }
}


//
// Update view when triggered by main tick
//
function viewChanged()
{
  var msuccess2 = function(txt)
  {
    // Successfully fetched new data, initiate view update
    updateView(txt);
  }

  var msuccess1 = function(txt)
  {
    lastUpdate = txt;
    jsSendPOSTRequest("action=get&type=slide", msuccess2, displayError);
  }

  jsSendPOSTRequest("action=get&type=update", msuccess1, displayError);
}


//
// Main tick function, check for updates from server
//
var timeOutSet = false;

function tickMain()
{
  timeOutSet = false;

  var msuccess = function(txt)
  {
    failCount = 0;
    if (txt == "changed")
    {
      viewChanged();
      if (!timeOutSet)
      {
        setTimeout("tickMain();", 500);
        timeOutSet = true;
      }
    }
    else
    {
      if (!timeOutSet)
      {
        setTimeout("tickMain();", 5000);
        timeOutSet = true;
      }
    }
  }
  
  var mfail = function(txt)
  {
    displayError();
    if (!timeOutSet)
    {
      setTimeout("tickMain();", 5000);
      timeOutSet = true;
    }
  }

  jsSendPOSTRequest("action=check&lastUpdate="+lastUpdate, msuccess, mfail);
}

setTimeout("tickMain();", 100);
viewChanged();

</script>
<?
cmPrintPageFooter(FALSE);
?>