includes/clientside/static/ajax.js
changeset 118 0c5efda996bf
parent 103 a8891e108c95
child 133 af0f6ec48de3
equal deleted inserted replaced
117:7cfdbb2fd17a 118:0c5efda996bf
  1092   linkbox.onclick = function() { ajaxCatToTag(); return false; };
  1092   linkbox.onclick = function() { ajaxCatToTag(); return false; };
  1093   catbox.innerHTML = catHTMLBuf;
  1093   catbox.innerHTML = catHTMLBuf;
  1094   catHTMLBuf = false;
  1094   catHTMLBuf = false;
  1095 }
  1095 }
  1096 
  1096 
       
  1097 var keepalive_interval = false;
       
  1098 
       
  1099 function ajaxPingServer()
       
  1100 {
       
  1101   ajaxGet(stdAjaxPrefix + '&_mode=ping', function()
       
  1102     {
       
  1103     });
       
  1104 }
       
  1105 
       
  1106 function ajaxToggleKeepalive()
       
  1107 {
       
  1108   if ( readCookie('admin_keepalive') == '1' )
       
  1109   {
       
  1110     createCookie('admin_keepalive', '0', 3650);
       
  1111     if ( keepalive_interval )
       
  1112       clearInterval(keepalive_interval);
       
  1113     var span = document.getElementById('keepalivestat');
       
  1114     span.firstChild.nodeValue = 'Turn on keep-alive';
       
  1115   }
       
  1116   else
       
  1117   {
       
  1118     createCookie('admin_keepalive', '1', 3650);
       
  1119     if ( !keepalive_interval )
       
  1120       keepalive_interval = setInterval('ajaxPingServer();', 600000);
       
  1121     var span = document.getElementById('keepalivestat');
       
  1122     span.firstChild.nodeValue = 'Turn off keep-alive';
       
  1123     ajaxPingServer();
       
  1124   }
       
  1125 }
       
  1126 
       
  1127 var keepalive_onload = function()
       
  1128 {
       
  1129   if ( readCookie('admin_keepalive') == '1' )
       
  1130   {
       
  1131     if ( !keepalive_interval )
       
  1132       keepalive_interval = setInterval('ajaxPingServer();', 600000);
       
  1133     var span = document.getElementById('keepalivestat');
       
  1134     span.firstChild.nodeValue = 'Turn off keep-alive';
       
  1135     ajaxPingServer();
       
  1136   }
       
  1137   else
       
  1138   {
       
  1139     if ( keepalive_interval )
       
  1140       clearInterval(keepalive_interval);
       
  1141     var span = document.getElementById('keepalivestat');
       
  1142     span.firstChild.nodeValue = 'Turn on keep-alive';
       
  1143   }
       
  1144 };
       
  1145 
       
  1146 function aboutKeepAlive()
       
  1147 {
       
  1148   new messagebox(MB_OK|MB_ICONINFORMATION, 'About the keep-alive feature', 'Keep-alive is a new Enano feature that keeps your administrative session from timing out while you are using the administration panel. This feature can be useful if you are editing a large page or doing something in the administration interface that will take longer than 15 minutes.<br /><br />For security reasons, Enano mandates that high-privilege logins last only 15 minutes, with the time being reset each time a page is loaded (or, more specifically, each time the session API is started). The consequence of this is that if you are performing an action in the administration panel that takes more than 15 minutes, your session may be terminated. The keep-alive feature attempts to relieve this by sending a "ping" to the server every 10 minutes.<br /><br />Please note that keep-alive state is determined by a cookie. Thus, if you log out and then back in as a different administrator, keep-alive will use the same setting that was used when you were logged in as the first administrative user. In the same way, if you log into the administration panel under your account from another computer, keep-alive will be set to "off".');
       
  1149 }
       
  1150