From a3fa33cc838531a0c16f65bae60020dcac2f12eb Mon Sep 17 00:00:00 2001 From: erickson Date: Fri, 1 Sep 2006 18:43:27 +0000 Subject: [PATCH] resetting the auth timeout on all activity - this handles the issue where activity within a given page will not reset the timeout git-svn-id: svn://svn.open-ils.org/ILS/trunk@5838 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/web/opac/common/js/opac_utils.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Open-ILS/web/opac/common/js/opac_utils.js b/Open-ILS/web/opac/common/js/opac_utils.js index 4faf5ef73d..65aca56861 100644 --- a/Open-ILS/web/opac/common/js/opac_utils.js +++ b/Open-ILS/web/opac/common/js/opac_utils.js @@ -18,6 +18,18 @@ function Request(type) { if(isXUL()) { if(!location.href.match(/^https:/)) this.request.setSecure(false); + + } else { + + if( G.user && G.user.session ) { + /* if the user is logged in, all activity resets the timeout + This is not entirely accurate in the sense that not all + requests will reset the server timeout - this should + get close enough, however. + */ + var at = getAuthtime(); + if(at) new AuthTimer(at).run(); + } } for( var x = 1; x!= arguments.length; x++ ) { @@ -881,11 +893,13 @@ function alertILSEvent(evt, msg) { var __authTimer; function AuthTimer(time) { this.time = (time - LOGOUT_WARNING_TIME) * 1000; + if(__authTimer) + try {clearTimeout(__authTimer.id)} catch(e){} __authTimer = this; } AuthTimer.prototype.run = function() { - setTimeout('_authTimerAlert()', this.time); + this.id = setTimeout('_authTimerAlert()', this.time); } function _authTimerAlert() { -- 2.43.2