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
dojo.require('openils.CGI');
dojo.require('openils.Event');
dojo.require('openils.Util');
+dojo.require('openils.XUL');
function oilsSetupUser() {
var cgi = new openils.CGI();
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;
}
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');