fix user session management for MARC Batch Edit
authorGalen Charlton <gmc@esilibrary.com>
Fri, 4 Jan 2013 19:33:28 +0000 (14:33 -0500)
committerMike Rylander <mrylander@gmail.com>
Fri, 4 Jan 2013 21:07:46 +0000 (16:07 -0500)
The Javascript in the hardcoded page templates was
not checking the XUL stash for the session key when
run from the staff client; this is now needed as
a result of the XULRunner updates introdued by
commit adee850f.

As a consequence, the list of the user's record buckets
was not retrieved, and attempts to run a batch edit
would spin without updating any records.

This fixes LP#1048707 and LP#1054277.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Open-ILS/src/perlmods/lib/OpenILS/WWW/TemplateBatchBibUpdate.pm

index 6eb3064..5f46799 100644 (file)
@@ -233,11 +233,18 @@ sub show_processing_template {
             dojo.require('fieldmapper.AutoIDL');
             dojo.require('fieldmapper.dojoData');
             dojo.require('openils.User');
+            dojo.require('openils.XUL');
+            dojo.require('dojo.cookie');
             dojo.require('openils.CGI');
             dojo.require('openils.widget.ProgressDialog');
 
             var cgi = new openils.CGI();
-            var u = new openils.User({ authcookie : 'ses' });
+            var authtoken = dojo.cookie('ses') || cgi.param('ses');
+            if (!authtoken && openils.XUL.isXUL()) {
+                var stash = openils.XUL.getStash();
+                authtoken = stash.session.key;
+            }
+            var u = new openils.User({ authtoken: authtoken });
 
             dojo.addOnLoad(function () {
                 progress_dialog.show(true);
@@ -359,9 +366,16 @@ sub show_template {
             dojo.require('fieldmapper.dojoData');
             dojo.require('openils.User');
             dojo.require('openils.CGI');
+            dojo.require('openils.XUL');
+            dojo.require('dojo.cookie');
 
             var cgi = new openils.CGI();
-            var u = new openils.User({ authcookie : 'ses' });
+            var authtoken = dojo.cookie('ses') || cgi.param('ses');
+            if (!authtoken && openils.XUL.isXUL()) {
+                var stash = openils.XUL.getStash();
+                authtoken = stash.session.key;
+            }
+            var u = new openils.User({ authtoken: authtoken });
 
             var bucketStore = new dojo.data.ItemFileReadStore(
                 { data : cbreb.toStoreData(