[open-ils-commits] r16099 - in trunk/Open-ILS/xul/staff_client/chrome/content: main util (phasefx)

svn at svn.open-ils.org svn at svn.open-ils.org
Thu Apr 1 17:25:44 EDT 2010


Author: phasefx
Date: 2010-04-01 17:25:38 -0400 (Thu, 01 Apr 2010)
New Revision: 16099

Modified:
   trunk/Open-ILS/xul/staff_client/chrome/content/main/menu.js
   trunk/Open-ILS/xul/staff_client/chrome/content/util/browser.js
Log:
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()
    }


Modified: trunk/Open-ILS/xul/staff_client/chrome/content/main/menu.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/main/menu.js	2010-04-01 21:00:12 UTC (rev 16098)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/main/menu.js	2010-04-01 21:25:38 UTC (rev 16099)
@@ -1359,6 +1359,16 @@
         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 @@
         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); };

Modified: trunk/Open-ILS/xul/staff_client/chrome/content/util/browser.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/util/browser.js	2010-04-01 21:00:12 UTC (rev 16098)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/util/browser.js	2010-04-01 21:25:38 UTC (rev 16099)
@@ -147,6 +147,7 @@
             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;



More information about the open-ils-commits mailing list