[open-ils-commits] r16101 - in trunk/Open-ILS/web/js: dojo/openils ui (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Apr 2 11:16:00 EDT 2010
Author: erickson
Date: 2010-04-02 11:15:58 -0400 (Fri, 02 Apr 2010)
New Revision: 16101
Modified:
trunk/Open-ILS/web/js/dojo/openils/XUL.js
trunk/Open-ILS/web/js/ui/base.js
Log:
added wrapper to new XUL get_new_session call. when embedded ui's lose their session, launch the staff client's login dialog instead of the local web-only dialog
Modified: trunk/Open-ILS/web/js/dojo/openils/XUL.js
===================================================================
--- trunk/Open-ILS/web/js/dojo/openils/XUL.js 2010-04-02 13:25:26 UTC (rev 16100)
+++ trunk/Open-ILS/web/js/dojo/openils/XUL.js 2010-04-02 15:15:58 UTC (rev 16101)
@@ -33,6 +33,13 @@
xulG.new_tab(path, tabInfo, options);
}
+ /**
+ * @return bool True if a new session was successfully created, false otherwise.
+ */
+ openils.XUL.getNewSession = function(callback) {
+ return xulG.get_new_session({callback : callback});
+ }
+
/**
* This can be used by privileged Firefox in addition to XUL.
* To use use in Firefox directly, set signed.applets.codebase_principal_support to true in about:config
Modified: trunk/Open-ILS/web/js/ui/base.js
===================================================================
--- trunk/Open-ILS/web/js/ui/base.js 2010-04-02 13:25:26 UTC (rev 16100)
+++ trunk/Open-ILS/web/js/ui/base.js 2010-04-02 15:15:58 UTC (rev 16101)
@@ -6,6 +6,7 @@
dojo.require('openils.CGI');
dojo.require('openils.Event');
dojo.require('openils.Util');
+dojo.require('openils.XUL');
function oilsSetupUser() {
var cgi = new openils.CGI();
@@ -17,11 +18,17 @@
dojo.cookie('ses', openils.User.authtoken, {expires:-1, path:'/'}); // remove the cookie
openils.User.authtoken = null;
dojo.addOnLoad(function(){
- oilsLoginDialog.show();
- var func = function(){ oilsDoLogin(); };
- openils.Util.registerEnterHandler(dojo.byId('oils-login-username'), func);
- openils.Util.registerEnterHandler(dojo.byId('oils-login-password'), func);
- dojo.byId('oils-login-workstation').innerHTML = workstation || '';
+ if(openils.XUL.isXUL()) {
+ // let XUL handle the login dialog
+ openils.XUL.getNewSession( function() { location.href = location.href } );
+ } else {
+ // in web-only mode, use the dojo login dialog
+ oilsLoginDialog.show();
+ var func = function(){ oilsDoLogin(); };
+ openils.Util.registerEnterHandler(dojo.byId('oils-login-username'), func);
+ openils.Util.registerEnterHandler(dojo.byId('oils-login-password'), func);
+ dojo.byId('oils-login-workstation').innerHTML = workstation || '';
+ }
});
return;
}
@@ -44,7 +51,7 @@
args.workstation = workstation;
if(user.login(args)) {
- dojo.cookie('ses', user.authtoken, {path : '/'});
+ dojo.cookie('ses', user.authtoken, {path : oilsBasePath});
location.href = location.href;
} else {
openils.Util.show('oils-login-failed');
More information about the open-ils-commits
mailing list