Files
Facilitor/APPL/Shared/refresher.asp
Jos Groot Lipman 2759bace19 AAIT#28073 3D plattegrond ook aanklikbaar
svn path=/Website/trunk/; revision=20684
2014-02-18 14:33:04 +00:00

142 lines
4.4 KiB
Plaintext

<%@language = "javascript" %>
<% /*
$Revision$
$Id$
File: refresher.asp
Description: Toon een bepaald scherm en ververs deze regelmatig
Parameters: verplichte parameters
url= de geescape-te url die ververst moet worden
Bij voorkeur een bookmark met een PRS_PERSLID_KEY_AUTH (fallback_user_key)
zodat een nachtelijke reset overleeft wordt
optional parameters
refreshrate=60 report refresht elke 60 seconde
default 600 (10 minuten)
doublebuf=1 Unsupported
'Toggle' twee workFrame's om knipperen te voorkomen
Let op: onderliggende scherm *moet* dan onload code
parent & parent.Activate && parent.Activate()
doen als hij klaar is met laden
Let op: doubleauto is veel simpeler en heeft de voorkeur
doubleauto=3 Als doublebuf maar onderliggende code hoeft niets te doen
Automatisch wordt na S("refresher_doubleauto") (default 3) seconde
verondersteld dat het scherm klaar is.
Context: Bijvoorbeeld als je bij een bookmark een refreshrate invult
http://sgf12/facilitor5iwork/?fac_id=AAIT&u=VXlrSVAqUpAzFocg
Notes:
*/
ANONYMOUS_Allowed = 1; // We doen echt niets geheims.
%>
<!--#include file="../Shared/common.inc" -->
<%
FCLTHeader.Requires({plugins: ["jQuery"]});
var url = getQParam("url");
var refreshrate = getQParamInt("refreshrate", 600);
var doublebuf = getQParamInt("doublebuf", 0) == 1;
var doubleauto = getQParamInt("doubleauto", S("refresher_doubleauto"));
%>
<html>
<head>
<%
FCLTHeader.Generate();
%>
<script language="javascript">
window.activeFrame = "A";
window.refreshtimerId = -1;
window.myurl = "<%=rooturl + safe.jsstring(url)%>";
function refreshPage()
{
doResize();
<% if (doublebuf || doubleauto > 0) { %>
if (window.activeFrame == "A")
$("#workFrameB")[0].src = window.myurl;
else
$("#workFrameA")[0].src = window.myurl;
<% if (doubleauto > 0) { %>
if (window.doubletimerId > 0)
clearTimeout(window.doubletimerId);
window.doubletimerId = setTimeout('doActivate();', <%=doubleauto*1000%>);
<% } %>
<% } else { %>
$("#workFrameA")[0].src = window.myurl;
<% } %>
}
// ondersteun de deprecated doublebuf
function Activate()
{
<% if (doublebuf && doubleauto <= 0) { %>
doActivate();
<% } %>
}
// Activeer het 'andere' workframe
function doActivate()
{
var d2 = $("#workFrameA");
var d3 = $("#workFrameB");
if (window.activeFrame == "A")
{
d2.css("zIndex", -1);
d3.css("zIndex", 1);
window.activeFrame = "B";
}
else
{
d2.css("zIndex", 1);
d3.css("zIndex", -1);
window.activeFrame = "A";
}
}
// Ongeacht grootte content resizen naar window
function doResize()
{
$("#workFrameA").width($(window).width());
$("#workFrameB").width($(window).width());
$("#workFrameA").height($(window).height());
$("#workFrameB").height($(window).height());
}
function startAutoRefreshTimer() {
if (<%=refreshrate%> != -1) {
window.refreshtimerId = setInterval('refreshPage();', <%=refreshrate*1000%>);
}
}
function resetReload()
{
if (window.refreshtimerId)
clearTimeout(window.refreshtimerId);
startAutoRefreshTimer();
}
</script>
</head>
<body style="margin:0;"
onLoad="refreshPage();
startAutoRefreshTimer()">
<iframe width="100%" height="100%"
style="position:absolute;left:0px;top:0px; height:100%;z-index:0;"
src="../Shared/empty.asp" id="workFrameA" frameborder="no"
marginwidth="0" marginheight="0"
scrolling="none" onload="doResize()">
</iframe>
<iframe width="100%" height="100%"
style="position:absolute;left:0px;top:0px;height:100%;z-index:-1;"
src="../Shared/empty.asp" id="workFrameB" frameborder="no"
marginwidth="0" marginheight="0"
scrolling="none" onload="doResize()">
</iframe>
</body>
</html>