From: erickson Date: Fri, 9 Dec 2005 22:40:34 +0000 (+0000) Subject: getting authtime from xul X-Git-Url: https://git.evergreen-ils.org/?p=Evergreen.git;a=commitdiff_plain;h=b4a274e41d41f6a22a612c495e69323a573025c2 getting authtime from xul git-svn-id: svn://svn.open-ils.org/ILS/trunk@2329 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/web/opac/common/js/init.js b/Open-ILS/web/opac/common/js/init.js index 79c2fdd6ef..236da18f23 100644 --- a/Open-ILS/web/opac/common/js/init.js +++ b/Open-ILS/web/opac/common/js/init.js @@ -14,6 +14,7 @@ try{ attachEvt("common", "unload", cleanRemoteRequests);} catch(e){} function init() { runEvt('common','init'); if( getOrigLocation() == 0 ) ORIGLOC = LOCATION; + if(!isFrontPage) grabUser(); runEvt("common", "run"); //checkUserSkin(); G.ui.common.now_searching.appendChild(text(findOrgUnit(getLocation()).name())); diff --git a/Open-ILS/web/opac/common/js/opac_utils.js b/Open-ILS/web/opac/common/js/opac_utils.js index 11bfbdfa70..c7982271c5 100644 --- a/Open-ILS/web/opac/common/js/opac_utils.js +++ b/Open-ILS/web/opac/common/js/opac_utils.js @@ -1,4 +1,8 @@ /* - Request ------------------------------------------------------------- */ + +/* define it again here for pages that don't load RemoteRequest */ +function isXUL() { try { if(IAMXUL) return true;}catch(e){return false;}; } + function Request(type) { var s = type.split(":"); if(s[2] == "1" && isXUL()) s[1] += ".staff"; @@ -239,12 +243,10 @@ function buildSearchLink(type, string, linknode, trunc) { var cookie = new cookieObject("ses", 1, "/", COOKIE_SES); function grabUser(ses, force) { + if(!ses && isXUL()) ses = xulG['authtoken']; if(!ses) ses = cookie.get(COOKIE_SES); - try{if(!ses && isXUL()) ses = xulG['auth_ses'][0];}catch(e){} if(!ses) return false; - //alert(ses); - if(!force) if(G.user && G.user.session == ses) return G.user; @@ -253,7 +255,6 @@ function grabUser(ses, force) { var request = new Request(FETCH_SESSION, ses, 1 ); request.send(true); var user = request.result(); - //if(checkILSEvent(user)) throw user; /* unable to grab the session */ if(checkILSEvent(user)) { doLogout(); @@ -275,8 +276,9 @@ function grabUser(ses, force) { if(G.user.prefs['opac.hits_per_page']) COUNT = parseInt(G.user.prefs['opac.hits_per_page']); - new AuthTimer(getAuthtime()).run(); - //new AuthTimer(20).run(); + var at = getAuthtime(); + if(isXUL()) at = xulG['authtime']; + new AuthTimer(at).run(); return G.user; } @@ -571,9 +573,7 @@ function setResourcePic( img, resource ) { function msg( text ) { - try { - alert( text ); - } catch(e) {} + try { alert( text ); } catch(e) {} } function findRecord(id,type) {