From 042da73f6987316f3ad972e803f414f0369efc23 Mon Sep 17 00:00:00 2001 From: phasefx Date: Thu, 1 Apr 2010 21:25:38 +0000 Subject: [PATCH] Adds a xulG.get_new_session() convenience function that can be called by embedded dojo interfaces, etc. Side effect: Sets a session cookie and updates the global OpenILS.data store with the newly acquired authtoken. Return Value: True if a new authtoken was acquired, otherwise False. Optional Param: Object with optional keys 'callback' and 'operator_change'. If 'operator_change' is passed in with a value of true, then the dialog will resemble the Admin->Operator Change dialog, but it is not yet completely implemented (doesn't preserve the existing authtoken). Otherwise, we get the normal Session Expired dialog. Callback may be a function that resembles this: function( success, authtoken, authtime ) { return success; // whatever gets returned here will also be returned by xulG.get_new_session() } git-svn-id: svn://svn.open-ils.org/ILS/trunk@16099 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/xul/staff_client/chrome/content/main/menu.js | 11 +++++++++++ .../xul/staff_client/chrome/content/util/browser.js | 1 + 2 files changed, 12 insertions(+) diff --git a/Open-ILS/xul/staff_client/chrome/content/main/menu.js b/Open-ILS/xul/staff_client/chrome/content/main/menu.js index 714244c9e2..eca544c774 100644 --- a/Open-ILS/xul/staff_client/chrome/content/main/menu.js +++ b/Open-ILS/xul/staff_client/chrome/content/main/menu.js @@ -1359,6 +1359,16 @@ main.menu.prototype = { var url = obj.url_prefix( urls.XUL_COPY_VOLUME_BROWSE ); obj.new_tab(url,params || {}, content_params); }, + 'get_new_session' : function(params) { + var obj = this; + if (!params) { params = {}; } + JSAN.use('util.network'); var net = new util.network(); + var result = net.get_new_session(null,{'url_prefix':obj.url_prefix},!params.operator_change); + if (typeof params.callback == 'function') { + return params.callback( result, ses(), ses('authtime') ); + } + return result; + }, 'set_tab' : function(url,params,content_params) { var obj = this; if (!url) url = '/xul/server/'; @@ -1378,6 +1388,7 @@ main.menu.prototype = { content_params.new_patron_tab = function(a,b) { return obj.new_patron_tab(a,b); }; content_params.set_patron_tab = function(a,b) { return obj.set_patron_tab(a,b); }; content_params.volume_item_creator = function(a) { return obj.volume_item_creator(a); }; + content_params.get_new_session = function(a) { return obj.get_new_session(a); }; content_params.holdings_maintenance_tab = function(a,b,c) { return obj.holdings_maintenance_tab(a,b,c); }; content_params.set_tab_name = function(name) { tab.setAttribute('label',(idx + 1) + ' ' + name); }; content_params.open_chrome_window = function(a,b,c) { return xulG.window.open(a,b,c); }; diff --git a/Open-ILS/xul/staff_client/chrome/content/util/browser.js b/Open-ILS/xul/staff_client/chrome/content/util/browser.js index 6cd7a3bb24..6ceb15aefa 100644 --- a/Open-ILS/xul/staff_client/chrome/content/util/browser.js +++ b/Open-ILS/xul/staff_client/chrome/content/util/browser.js @@ -147,6 +147,7 @@ util.browser.prototype = { cw.xulG.new_patron_tab = window.xulG.new_patron_tab; cw.xulG.set_patron_tab = window.xulG.set_patron_tab; cw.xulG.volume_item_creator = window.xulG.volume_item_creator; + cw.xulG.get_new_session = window.xulG.get_new_session; cw.xulG.holdings_maintenance_tab = window.xulG.holdings_maintenance_tab; cw.xulG.url_prefix = window.xulG.url_prefix; cw.xulG.urls = window.urls; -- 2.43.2