use the stash instead of the url for data passing
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 26 Jun 2006 20:37:09 +0000 (20:37 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 26 Jun 2006 20:37:09 +0000 (20:37 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@4789 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/server/cat/copy_editor.js
Open-ILS/xul/staff_client/server/cat/util.js
Open-ILS/xul/staff_client/server/cat/volume_copy_creator.js

index 53deb07..0594b41 100644 (file)
@@ -28,6 +28,7 @@ function my_init() {
                if (g.cgi.param('copy_ids')) copy_ids = JSON2js( g.cgi.param('copy_ids') );
                if (!copy_ids) copy_ids = [];
                if (window.xulG && window.xulG.copy_ids) copy_ids = copy_ids.concat( window.xulG.copy_ids );
+               if (g.data.temp_copy_ids != 'undefined') copy_ids = copy_ids.concat( JSON2js( g.data.temp_copy_ids ) );
 
                if (copy_ids.length > 0) g.copies = g.network.request(
                        api.FM_ACP_FLESHED_BATCH_RETRIEVE.app,
@@ -41,12 +42,14 @@ function my_init() {
                if (!g.copies) g.copies = [];
                if (window.xulG && window.xulG.copies) g.copies = g.copies.concat( window.xulG.copies );
                if (g.cgi.param('copies')) g.copies = g.copies.concat( JSON2js( g.cgi.param('copies') ) );
+               if (g.data.temp_copies != 'undefined') g.copies = g.copies.concat( JSON2js( g.data.temp_copies ) );
 
                /******************************************************************************************************/
                /* We try to retrieve callnumbers for existing copies, but for new copies, we rely on this */
 
                if (window.xulG && window.xulG.callnumbers) g.callnumbers = window.xulG.callnumbers;
                if (g.cgi.param('callnumbers')) g.callnumbers =  JSON2js( g.cgi.param('callnumbers') );
+               if (g.data.temp_callnumbers != 'undefined') g.callnumbers = JSON2js( g.data.temp_callnumbers );
 
                /******************************************************************************************************/
                /* Is the interface an editor or a viewer, single or multi copy, existing copies or new copies? */
@@ -189,7 +192,7 @@ g.retrieve_templates = function() {
                g.templates = {};
                var robj = g.network.simple_request('FM_AUS_RETRIEVE',[ses(),g.data.list.au[0].id()]);
                if (typeof robj['staff_client.copy_editor.templates'] != 'undefined') {
-                       g.templates = JSON2js( robj['staff_client.copy_editor.templates'] );
+                       g.templates = robj['staff_client.copy_editor.templates'];
                }
                util.widgets.remove_children('template_placeholder');
                var list = util.functional.map_object_to_list( g.templates, function(obj,i) { return [i, i]; } );
@@ -237,7 +240,7 @@ g.save_template = function() {
                if (!name) return;
                g.templates[name] = g.changed;
                var robj = g.network.simple_request(
-                       'FM_AUS_UPDATE',[ses(),g.data.list.au[0].id(), { 'staff_client.copy_editor.templates' : js2JSON(g.templates) }]
+                       'FM_AUS_UPDATE',[ses(),g.data.list.au[0].id(), { 'staff_client.copy_editor.templates' : g.templates }]
                );
                if (typeof robj.ilsevent != 'undefined') {
                        throw(robj);
@@ -268,7 +271,7 @@ g.delete_template = function() {
                if (! window.confirm('Delete template "' + name + '"?') ) return;
                delete(g.templates[name]);
                var robj = g.network.simple_request(
-                       'FM_AUS_UPDATE',[ses(),g.data.list.au[0].id(), { 'staff_client.copy_editor.templates' : js2JSON(g.templates) }]
+                       'FM_AUS_UPDATE',[ses(),g.data.list.au[0].id(), { 'staff_client.copy_editor.templates' : g.templates }]
                );
                if (typeof robj.ilsevent != 'undefined') {
                        throw(robj);
index 8fd7ab4..ac93c53 100644 (file)
@@ -86,6 +86,8 @@ cat.util.spawn_copy_editor = function(list,edit) {
        JSAN.use('util.window'); var win = new util.window();
        obj.data.temp = '';
        obj.data.stash('temp');
+       obj.data.temp_copy_ids = js2JSON(list);
+       obj.data.stash('temp_copy_ids');
        var w = win.open(
                window.xulG.url_prefix(urls.XUL_COPY_EDITOR)
                        +'?copy_ids='+window.escape(js2JSON(list))
@@ -95,7 +97,10 @@ cat.util.spawn_copy_editor = function(list,edit) {
        );
        /* FIXME -- need to unique the temp space, and not rely on modalness of window */
        obj.data.stash_retrieve();
+       obj.data.temp_copy_ids = null; obj.data.stash('temp_copy_ids');
        var copies = JSON2js( obj.data.temp_copies );
+       obj.data.temp_copies = null; obj.data.stash('temp_copies');
+       obj.data.temp_callnumbers = null; obj.data.stash('temp_callnumbers');
        obj.error.sdump('D_CAT','in cat/copy_status, copy editor, copies =\n<<' + copies + '>>');
        if (edit=='1' && copies!='' && typeof copies != 'undefined') {
                try {
index dcea458..c5315c3 100644 (file)
@@ -351,17 +351,20 @@ g.stash_and_close = function() {
 
                JSAN.use('util.window'); var win = new util.window();
                if (copies.length > 0) {
+                       g.data.temp_copies = js2JSON(copies); g.data.stash('temp_copies');
+                       g.data.temp_callnumbers = js2JSON(volume_labels); g.data.stash('temp_callnumbers');
                        var w = win.open(
                                urls.XUL_COPY_EDITOR
-                                       +'?copies='+window.escape(js2JSON(copies))
-                                       +'&callnumbers='+window.escape(js2JSON(volume_labels))
-                                       +'&edit=1',
+                                       +'?edit=1',
                                title,
                                'chrome,modal,resizable'
                        );
                        /* FIXME -- need to unique the temp space, and not rely on modalness of window */
                        g.data.stash_retrieve();
+                       g.data.temp_copy_ids = null; g.data.stash('temp_copy_ids');
                        copies = JSON2js( g.data.temp_copies );
+                       g.data.temp_copies = null; g.data.stash('temp_copies');
+                       g.data.temp_callnumbers = null; g.data.stash('temp_callnumbers');
                        if (!copies) {
                                alert('Items were not created.');
                                return;