includes/clientside/static/ajax.js
changeset 211 753dabeca1ee
parent 209 8a00247d1dee
child 213 1316404e4ea8
equal deleted inserted replaced
210:2b283402e4e4 211:753dabeca1ee
  1146   {
  1146   {
  1147     createCookie('admin_keepalive', '0', 3650);
  1147     createCookie('admin_keepalive', '0', 3650);
  1148     if ( keepalive_interval )
  1148     if ( keepalive_interval )
  1149       clearInterval(keepalive_interval);
  1149       clearInterval(keepalive_interval);
  1150     var span = document.getElementById('keepalivestat');
  1150     var span = document.getElementById('keepalivestat');
  1151     span.firstChild.nodeValue = 'Turn on keep-alive';
  1151     span.firstChild.nodeValue = $lang.get('adm_btn_keepalive_off');
  1152   }
  1152   }
  1153   else
  1153   else
  1154   {
  1154   {
  1155     createCookie('admin_keepalive', '1', 3650);
  1155     createCookie('admin_keepalive', '1', 3650);
  1156     if ( !keepalive_interval )
  1156     if ( !keepalive_interval )
  1157       keepalive_interval = setInterval('ajaxPingServer();', 600000);
  1157       keepalive_interval = setInterval('ajaxPingServer();', 600000);
  1158     var span = document.getElementById('keepalivestat');
  1158     var span = document.getElementById('keepalivestat');
  1159     span.firstChild.nodeValue = 'Turn off keep-alive';
  1159     span.firstChild.nodeValue = $lang.get('adm_btn_keepalive_on');
  1160     ajaxPingServer();
  1160     ajaxPingServer();
  1161   }
  1161   }
  1162 }
  1162 }
  1163 
  1163 
  1164 var keepalive_onload = function()
  1164 var keepalive_onload = function()
  1166   if ( readCookie('admin_keepalive') == '1' )
  1166   if ( readCookie('admin_keepalive') == '1' )
  1167   {
  1167   {
  1168     if ( !keepalive_interval )
  1168     if ( !keepalive_interval )
  1169       keepalive_interval = setInterval('ajaxPingServer();', 600000);
  1169       keepalive_interval = setInterval('ajaxPingServer();', 600000);
  1170     var span = document.getElementById('keepalivestat');
  1170     var span = document.getElementById('keepalivestat');
  1171     span.firstChild.nodeValue = 'Turn off keep-alive';
  1171     span.firstChild.nodeValue = $lang.get('adm_btn_keepalive_on');
  1172   }
  1172   }
  1173   else
  1173   else
  1174   {
  1174   {
  1175     if ( keepalive_interval )
  1175     if ( keepalive_interval )
  1176       clearInterval(keepalive_interval);
  1176       clearInterval(keepalive_interval);
  1177     var span = document.getElementById('keepalivestat');
  1177     var span = document.getElementById('keepalivestat');
  1178     span.firstChild.nodeValue = 'Turn on keep-alive';
  1178     span.firstChild.nodeValue = $lang.get('adm_btn_keepalive_off');
  1179   }
  1179   }
  1180 };
  1180 };
  1181 
  1181 
  1182 function aboutKeepAlive()
  1182 function aboutKeepAlive()
  1183 {
  1183 {
  1184   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".<br /><br /><b>For more information:</b><br /><a href="http://docs.enanocms.org/Help:Appendix_B" onclick="window.open(this.href); return false;">Overview of Enano'+"'"+'s security model');
  1184   new messagebox(MB_OK|MB_ICONINFORMATION, $lang.get('user_keepalive_info_title'), $lang.get('user_keepalive_info_body'));
  1185 }
  1185 }
  1186 
  1186 
  1187 function ajaxShowCaptcha(code)
  1187 function ajaxShowCaptcha(code)
  1188 {
  1188 {
  1189   var mydiv = document.createElement('div');
  1189   var mydiv = document.createElement('div');