xul_param and modal xulG conversion
authorpines <pines@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sun, 13 May 2007 16:31:25 +0000 (16:31 +0000)
committerpines <pines@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sun, 13 May 2007 16:31:25 +0000 (16:31 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@7296 dcc99617-32d9-48b4-a31d-7c20da2025e4

72 files changed:
Evergreen/xul/staff_client/server/patron/ue.js
Evergreen/xul/staff_client/server/patron/ue_config.js
Open-ILS/xul/staff_client/chrome/content/OpenILS/global_util.js
Open-ILS/xul/staff_client/chrome/content/main/simple_auth.xul
Open-ILS/xul/staff_client/chrome/content/util/browser.xul
Open-ILS/xul/staff_client/chrome/content/util/error.js
Open-ILS/xul/staff_client/chrome/content/util/fancy_prompt.xul
Open-ILS/xul/staff_client/chrome/content/util/network.js
Open-ILS/xul/staff_client/chrome/content/util/rbrowser.xul
Open-ILS/xul/staff_client/chrome/content/util/window.js
Open-ILS/xul/staff_client/server/admin/hold_pull_list.xul
Open-ILS/xul/staff_client/server/admin/offline_manage_xacts.js
Open-ILS/xul/staff_client/server/admin/offline_manage_xacts.xul
Open-ILS/xul/staff_client/server/admin/upload_xacts.js
Open-ILS/xul/staff_client/server/admin/upload_xacts.xhtml
Open-ILS/xul/staff_client/server/cat/bib_brief.xul
Open-ILS/xul/staff_client/server/cat/copy_browser.js
Open-ILS/xul/staff_client/server/cat/copy_browser.xul
Open-ILS/xul/staff_client/server/cat/copy_buckets.js
Open-ILS/xul/staff_client/server/cat/copy_buckets.xul
Open-ILS/xul/staff_client/server/cat/copy_buckets_quick.xul
Open-ILS/xul/staff_client/server/cat/copy_editor.js
Open-ILS/xul/staff_client/server/cat/copy_notes.xul
Open-ILS/xul/staff_client/server/cat/copy_summary.xul
Open-ILS/xul/staff_client/server/cat/marc_view.xul
Open-ILS/xul/staff_client/server/cat/opac.xul
Open-ILS/xul/staff_client/server/cat/record_buckets.js
Open-ILS/xul/staff_client/server/cat/record_buckets.xul
Open-ILS/xul/staff_client/server/cat/record_buckets_quick.xul
Open-ILS/xul/staff_client/server/cat/spine_labels.js
Open-ILS/xul/staff_client/server/cat/util.js
Open-ILS/xul/staff_client/server/cat/volume_copy_creator.js
Open-ILS/xul/staff_client/server/cat/volume_editor.xul
Open-ILS/xul/staff_client/server/cat/z3950.js
Open-ILS/xul/staff_client/server/cat/z3950.xul
Open-ILS/xul/staff_client/server/circ/checkin.xul
Open-ILS/xul/staff_client/server/circ/checkout.xul
Open-ILS/xul/staff_client/server/circ/circ_brief.xul
Open-ILS/xul/staff_client/server/circ/circ_summary.xul
Open-ILS/xul/staff_client/server/circ/copy_details.xul
Open-ILS/xul/staff_client/server/circ/copy_status.js
Open-ILS/xul/staff_client/server/circ/copy_status.xul
Open-ILS/xul/staff_client/server/circ/hold_capture.xul
Open-ILS/xul/staff_client/server/circ/in_house_use.xul
Open-ILS/xul/staff_client/server/circ/print_list_template_editor.xul
Open-ILS/xul/staff_client/server/circ/util.js
Open-ILS/xul/staff_client/server/main/data.xul
Open-ILS/xul/staff_client/server/patron/adv_barcode_entry.xul
Open-ILS/xul/staff_client/server/patron/barcode_entry.xul
Open-ILS/xul/staff_client/server/patron/bill_details.xul
Open-ILS/xul/staff_client/server/patron/bill_history.xul
Open-ILS/xul/staff_client/server/patron/bill_wizard.xul
Open-ILS/xul/staff_client/server/patron/bills.js
Open-ILS/xul/staff_client/server/patron/bills.xul
Open-ILS/xul/staff_client/server/patron/display.js
Open-ILS/xul/staff_client/server/patron/display.xul
Open-ILS/xul/staff_client/server/patron/hold_notices.xul
Open-ILS/xul/staff_client/server/patron/holds.js
Open-ILS/xul/staff_client/server/patron/holds.xul
Open-ILS/xul/staff_client/server/patron/info.xul
Open-ILS/xul/staff_client/server/patron/info_group.xul
Open-ILS/xul/staff_client/server/patron/info_notes.xul
Open-ILS/xul/staff_client/server/patron/info_stat_cats.xul
Open-ILS/xul/staff_client/server/patron/info_surveys.xul
Open-ILS/xul/staff_client/server/patron/items.js
Open-ILS/xul/staff_client/server/patron/items.xul
Open-ILS/xul/staff_client/server/patron/search_result.xul
Open-ILS/xul/staff_client/server/patron/summary.xul
Open-ILS/xul/staff_client/server/patron/ue.js
Open-ILS/xul/staff_client/server/patron/ue_config.js
Open-ILS/xul/staff_client/server/patron/user_edit.js
Open-ILS/xul/staff_client/server/patron/user_editor.js

index ddc7f6a..e2cb510 100644 (file)
@@ -18,8 +18,12 @@ function uEditInit() {
        _debug('uEditInit(): ' + location.search);
 
        cgi             = new CGI();
-       session = cgi.param('ses');
-       clone           = cgi.param('clone');
+       session = cgi.param('ses'); 
+       if (xulG) if (xulG.ses) session = xulG.ses;
+       if (xulG) if (xulG.params) if (xulG.params.ses) session = xulG.params.ses;
+       clone           = cgi.param('clone'); 
+       if (xulG) if (xulG.clone) clone = xulG.clone;
+       if (xulG) if (xulG.params) if (xulG.params.clone) clone = xulG.params.clone;
        if(!session) throw "User session is not defined";
 
        fetchUser(session);
@@ -107,7 +111,10 @@ function uEditBuild() {
        fetchHighestPermOrgs( SESSION, USER.id(), myPerms );
 
        uEditBuildLibSelector();
-       patron = fetchFleshedUser(cgi.param('usr'));
+       var usr = cgi.param('usr'); 
+       if (xulG) if (xulG.usr) usr = xulG.usr;
+       if (xulG) if (xulG.params) if (xulG.params.usr) usr = xulG.params.usr;
+       patron = fetchFleshedUser(usr);
        if(!patron) patron = uEditNewPatron(); 
        
        uEditDraw( 
@@ -554,7 +561,10 @@ function uEditSaveUser(cloneme) {
 
                        !patron.isnew() ) {
                                _debug("xulG clone spawning new interface...");
-                               window.xulG.spawn_editor({ses:cgi.param('ses'),clone:cloneme});
+                               var ses = cgi.param('ses'); 
+                               if (xulG) if (xulG.ses) ses = xulG.ses;
+                               if (xulG) if (xulG.params) if (xulG.params.ses) ses = xulG.params.ses;
+                               window.xulG.spawn_editor({ses:ses,clone:cloneme});
                                uEditRefresh();
 
                } else {
@@ -591,7 +601,9 @@ function uEditCancel() {
        var href = location.href;
        href = href.replace(/\&?usr=\d+/, '');
        href = href.replace(/\&?clone=\d+/, '');
-       var id = cgi.param('usr')
+       var id = cgi.param('usr'); 
+       if (xulG) if (xulG.usr) id = xulG.usr;
+       if (xulG) if (xulG.params) if (xulG.params.usr) id = xulG.params.usr;
        /* reload the current user if available */
        if( id ) href += "&usr=" + id;
        location.href = href;
index 6b6449a..6417e4f 100644 (file)
@@ -999,8 +999,11 @@ function uEditCheckSharedAddr(patron, address, tbody, row) {
                        
                                } else {
                        
+                                       var ses = cgi.param('ses'); 
+                                       if (xulG) if (xulG.ses) ses = xulG.ses;
+                                       if (xulG) if (xulG.params) if (xulG.params.ses) ses = xulG.params.ses;
                                        link.onclick = 
-                                               function() { window.xulG.spawn_editor({ses:cgi.param('ses'),usr:id}) };
+                                               function() { window.xulG.spawn_editor({ses:ses,usr:id}) };
                                
                                        if( userCache[id] ) {
                         var usr = userCache[id];
index ae38052..290764d 100644 (file)
                }
        }
 
+       function update_modal_xulG(v) {
+               try {
+                       JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
+                       var key = location.pathname + location.search + location.hash;
+                       if (typeof data.modal_xulG_stack != 'undefined' && typeof data.modal_xulG_stack[key] != 'undefined') {
+                               data.modal_xulG_stack[key][ data.modal_xulG_stack[key].length - 1 ] = v;
+                               data.stash('modal_xulG_stack');
+                       }
+               } catch(E) {
+                       alert('FIXME: update_modal_xulG => ' + E);
+               }
+       }
+
+       function xul_param(param_name,_params) {
+               /* By default, this function looks for a CGI-style query param identified by param_name.  If one isn't found, it then looks in xulG.  If one still isn't found, and _params.stash_name is true, it looks in the global xpcom stash for the field identified by stash_name.  If _params.concat is true, then it looks in all these places and concatenates the results.  There are also options for converting JSON to javascript objects, and clearing the xpcom stash_name field after retrieval.  Also added, ability to search a specific spot in the xpcom stash that implements a stack to hold xulG's for modal windows */
+               try {
+                       dump('xul_param('+param_name+','+js2JSON(_params)+')\n');
+                       var value = undefined; if (!_params) _params = {};
+                       if (typeof _params.no_cgi == 'undefined') {
+                               var cgi = new CGI();
+                               if (cgi.param(param_name)) {
+                                       var x = cgi.param(param_name);
+                                       dump('\tfound via location.href = ' + x + '\n');
+                                       if (typeof _params.JSON2js_if_cgi != 'undefined') {
+                                               x = JSON2js( x );
+                                               dump('\tJSON2js = ' + x + '\n');
+                                       }
+                                       if (typeof _params.concat == 'undefined') {
+                                               //alert(param_name + ' x = ' + x);
+                                               return x; // value
+                                       } else {
+                                               if (value) {
+                                                       if (value.constructor != Array) value = [ value ];
+                                                       value = value.concat(x);
+                                               } else {
+                                                       value = x;
+                                               }
+                                       }
+                               }
+                       }
+                       if (typeof _params.no_xulG == 'undefined') {
+                               if (typeof _params.modal_xulG != 'undefined') {
+                                       JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
+                                       var key = location.pathname + location.search + location.hash;
+                                       dump('xul_param, considering modal key = ' + key + '\n');
+                                       if (typeof data.modal_xulG_stack != 'undefined' && typeof data.modal_xulG_stack[key] != 'undefined') {
+                                               xulG = data.modal_xulG_stack[key][ data.modal_xulG_stack[key].length - 1 ];
+                                       }
+                               }
+                               if (typeof xulG == 'object' && typeof xulG[ param_name ] != 'undefined') {
+                                       var x = xulG[ param_name ];
+                                       dump('\tfound via xulG = ' + x + '\n');
+                                       if (typeof _params.JSON2js_if_xulG != 'undefined') {
+                                               x = JSON2js( x );
+                                               dump('\tJSON2js = ' + x + '\n');
+                                       }
+                                       if (typeof _params.concat == 'undefined') {
+                                               //alert(param_name + ' x = ' + x);
+                                               return x; // value
+                                       } else {
+                                               if (value) {
+                                                       if (value.constructor != Array) value = [ value ];
+                                                       value = value.concat(x);
+                                               } else {
+                                                       value = x;
+                                               }
+                                       }
+                               }
+                       }
+                       if (typeof _params.no_xpcom == 'undefined') {
+                               /* the field names used for temp variables in the global stash tend to be more unique than xuLG or CGI param names, to avoid collisions */
+                               if (typeof _params.stash_name != 'undefined') { 
+                                       JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
+                                       if (typeof data[ _params.stash_name ] != 'undefined') {
+                                               var x = data[ _params.stash_name ];
+                                               dump('\tfound via xpcom = ' + x + '\n');
+                                               if (typeof _params.JSON2js_if_xpcom != 'undefined') {
+                                                       x = JSON2js( x );
+                                                       dump('\tJSON2js = ' + x + '\n');
+                                               }
+                                               if (_params.clear_xpcom) { 
+                                                       data[ _params.stash_name ] = undefined; data.stash( _params.stash_name ); 
+                                               }
+                                               if (typeof _params.concat == 'undefined') {
+                                                       //alert(param_name + ' x = ' + x);
+                                                       return x; // value
+                                               } else {
+                                                       if (value) {
+                                                               if (value.constructor != Array) value = [ value ];
+                                                               value = value.concat(x);
+                                                       } else {
+                                                               value = x;
+                                                       }
+                                               }
+                                       }
+                               }
+                       }
+                       //alert(param_name + ' value = ' + value);
+                       return value;
+               } catch(E) {
+                       dump('xul_param error: ' + E + '\n');
+               }
+       }
+
        function get_bool(a) {
                // Normal javascript interpretation except 'f' == false, per postgres, and 'F' == false
                // So false includes 'f', '', 0, null, and undefined
index e4890c0..5114692 100644 (file)
 
                                $('server').value = g.data.server_unadorned;
 
-                               g.cgi = new CGI();
-                               addCSSClass(document.documentElement,g.cgi.param('login_type'))
+                               addCSSClass(document.documentElement,xul_param('login_type',{'modal_xulG':true}))
 
-                               if (g.cgi.param('desc_brief')) {
+                               if (xul_param('desc_brief',{'modal_xulG':true})) {
                                        $('desc').hidden = false;
-                                       $('desc_brief').appendChild( document.createTextNode( g.cgi.param('desc_brief') ) );
+                                       $('desc_brief').appendChild( document.createTextNode( xul_param('desc_brief',{'modal_xulG':true}) ) );
                                }
-                               if (g.cgi.param('desc_full')) {
+                               if (xul_param('desc_full',{'modal_xulG':true})) {
                                        $('desc').hidden = false;
-                                       $('desc_full').appendChild( document.createTextNode( g.cgi.param('desc_full') ) );
+                                       $('desc_full').appendChild( document.createTextNode( xul_param('desc_full',{'modal_xulG':true}) ) );
                                }
 
                                $('username').focus();
                                                'password_prompt' : $('password'),
                                                'server_prompt' : $('server'),
                                        },
-                                       g.cgi.param('login_type') || 'temp'
+                                       xul_param('login_type',{'modal_xulG':true}) || 'temp'
                                );
                                g.session.on_init = function() { 
-                                       JSAN.use('util.network'); var n = new util.network();
-                                       var staff = n.simple_request('FM_AU_RETRIEVE_VIA_SESSION',[ g.session.key ]);
-                                       g.data.temporary_session = { 'key' : g.session.key, 'authtime' : g.session.authtime, 'usr' : js2JSON(staff) };
-                                       g.data.stash('temporary_session');
-                                       window.close();
+                                       try {
+                                               JSAN.use('util.network'); var n = new util.network();
+                                               var staff = n.simple_request('FM_AU_RETRIEVE_VIA_SESSION',[ g.session.key ]);
+                                               g.data.temporary_session = {  // old way because of local chrome still out there
+                                                       'key' : g.session.key, 
+                                                       'authtime' : g.session.authtime, 
+                                                       'usr' : js2JSON(staff)
+                                               }
+                                               g.data.stash('temporary_session');
+                                               var my_xulG = { // new way, to minimize the use of global spaces
+                                                       'temporary_session' : g.data.temporary_session
+                                               };
+                                               update_modal_xulG(my_xulG);
+                                               window.close();
+                                       } catch(E) {
+                                               g.error.standard_unexpected_error_alert('simple_auth.session.on_init',E);
+                                       }
                                }
                                g.session.on_init_error = function() { 
                                        $('password').value = '';
index 3f6deff..47ea663 100644 (file)
                                JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
                                XML_HTTP_SERVER = data.server_unadorned;
 
-                               g.cgi = new CGI();
-                               var name = g.cgi.param('tab_name') || g.cgi.param('name') || null;
-                               if (!name) {
-                                       if (typeof window.xulG == 'object') {
-                                               name = window.xulG.name || window.xulG.tab_name || null;
-                                       }
-                               }
-                               var url; try { url = g.cgi.param('url') || xulG.url } catch(E) { dump(E + '\n'); };
+                               var name = xul_param('tab_name') || xul_param('name') || null;
+                               var url; try { url = xul_param('url'); } catch(E) { dump(E + '\n'); };
                                if (!url) url = urls.browser;
 
                                JSAN.use('util.browser'); g.browser = new util.browser();
 
                                var push_xulG = true;
-                               if (g.cgi.param('no_xulG') || (typeof xulG == 'object' ? xulG.no_xulG : false)) push_xulG = false;
+                               if (xul_param('no_xulG')) push_xulG = false;
 
                                var alt_print = false;
-                               if (g.cgi.param('alternate_print') || (typeof xulG == 'object' ? xulG.alternate_print : false)) alt_print = true;
+                               if (xul_param('alternate_print')) alt_print = true;
 
                                var p = { 
                                        'url' : url,
                                if (typeof window.xulG == 'object' && typeof window.xulG.set_tab_name == 'function') {
                                        if (name) try { window.xulG.set_tab_name(name); } catch(E) { alert(E); }
                                }
-                               if (g.cgi.param('show_nav_buttons')||(typeof window.xulG == 'object' && window.xulG.show_nav_buttons)) {
+                               if (xul_param('show_nav_buttons')) {
                                        document.getElementById('back').hidden = false;
                                        document.getElementById('forward').hidden = false;
                                }
-                               if (g.cgi.param('show_print_button')||(typeof window.xulG == 'object' && window.xulG.show_print_button)) {
+                               if (xul_param('show_print_button')) {
                                        document.getElementById('browser_print').hidden = false;
                                }
 
-                               if (g.cgi.param('title')) {
-                                       try { document.title = g.cgi.param('title'); } catch(E) {}
-                                       try { window.title = g.cgi.param('title'); } catch(E) {}
+                               if (xul_param('title')) {
+                                       try { document.title = xul_param('title'); } catch(E) {}
+                                       try { window.title = xul_param('title'); } catch(E) {}
                                }
 
                        } catch(E) {
index 6820f7a..cd5b612 100644 (file)
@@ -106,7 +106,7 @@ util.error.prototype = {
                'D_SPAWN' : false, 
                'D_STRING' : false,
                'D_UTIL' : false, 
-               'D_WIN' : false
+               'D_WIN' : { 'dump' : true }
                'D_WIDGETS' : false
        },
 
@@ -347,16 +347,16 @@ util.error.prototype = {
                if (b3) xml += '<button id="b3" accesskey="' + b3_key + '" label="' + (b3) + '" name="fancy_submit" value="b3"/>'
                xml += '</hbox></groupbox></vbox>';
                JSAN.use('OpenILS.data');
-               var data = new OpenILS.data(); data.init({'via':'stash'});
-               data.temp_yns_xml = xml; data.stash('temp_yns_xml');
-               var url = urls.XUL_FANCY_PROMPT + '?xml_in_stash=temp_yns_xml' + '&title=' + window.escape(title);
+               //var data = new OpenILS.data(); data.init({'via':'stash'});
+               //data.temp_yns_xml = xml; data.stash('temp_yns_xml');
+               var url = urls.XUL_FANCY_PROMPT; // + '?xml_in_stash=temp_yns_xml' + '&title=' + window.escape(title);
                if (typeof xulG != 'undefined') if (typeof xulG.url_prefix == 'function') url = xulG.url_prefix( url );
-               window.open(
-                       url, 'fancy_prompt', 'chrome,resizable,modal,width=700,height=500'
+               JSAN.use('util.window'); var win = new util.window();
+               var fancy_prompt_data = win.open(
+                       url, 'fancy_prompt', 'chrome,resizable,modal,width=700,height=500', { 'xml' : xml, 'title' : title }
                );
-               data.init({'via':'stash'});
-               if (data.fancy_prompt_data != '') {
-                       switch(data.fancy_prompt_data.fancy_submit) {
+               if (fancy_prompt_data.fancy_status == 'complete') {
+                       switch(fancy_prompt_data.fancy_submit) {
                                case 'b1' : return 0; break;
                                case 'b2' : return 1; break;
                                case 'b3' : return 2; break;
@@ -416,16 +416,16 @@ util.error.prototype = {
                if (b3) xml += '<button id="b3" accesskey="' + b3_key + '" label="' + (b3) + '" name="fancy_submit" value="b3"/>'
                xml += '</hbox></groupbox></vbox>';
                JSAN.use('OpenILS.data');
-               var data = new OpenILS.data(); data.init({'via':'stash'});
-               data.temp_yns_xml = xml; data.stash('temp_yns_xml');
-               var url = urls.XUL_FANCY_PROMPT + '?xml_in_stash=temp_yns_xml' + '&title=' + window.escape(title);
+               //var data = new OpenILS.data(); data.init({'via':'stash'});
+               //data.temp_yns_xml = xml; data.stash('temp_yns_xml');
+               var url = urls.XUL_FANCY_PROMPT; // + '?xml_in_stash=temp_yns_xml' + '&title=' + window.escape(title);
                if (typeof xulG != 'undefined') if (typeof xulG.url_prefix == 'function') url = xulG.url_prefix( url );
-               window.open(
-                       url, 'fancy_prompt', 'chrome,resizable,modal,width=700,height=500'
+               JSAN.use('util.window'); var win = new util.window();
+               var fancy_prompt_data = win.open(
+                       url, 'fancy_prompt', 'chrome,resizable,modal,width=700,height=500', { 'xml' : xml, 'title' : title }
                );
-               data.init({'via':'stash'});
-               if (data.fancy_prompt_data != '') {
-                       switch(data.fancy_prompt_data.fancy_submit) {
+               if (fancy_prompt_data == 'complete') {
+                       switch(fancy_prompt_data.fancy_submit) {
                                case 'b1' : return 0; break;
                                case 'b2' : return 1; break;
                                case 'b3' : return 2; break;
index 27a9731..02d2f7d 100644 (file)
@@ -32,6 +32,9 @@
        <script type="text/javascript" src="/xul/server/main/JSAN.js"/>
        <script>
        <![CDATA[
+
+               var xulG = {};
+
                function my_init() {
                        try {
                                netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
                                JSAN.use('util.error'); g.error = new util.error();
                                g.error.sdump('D_TRACE','my_init() for fancy_prompt.xul');
 
-                               JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.init({'via':'stash'});
-                               g.data.fancy_prompt_data = ''; g.data.stash('fancy_prompt_data');
-                               g.data.fancy_prompt_data = {};
+                               //JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.init({'via':'stash'});
+                               //g.data.fancy_prompt_data = ''; g.data.stash('fancy_prompt_data');
+                               //g.data.fancy_prompt_data = {};
+
+                               xulG.fancy_status = 'incomplete';
 
-                               g.cgi = new CGI();
+                               //var key = location.pathname + location.search + location.hash;
+                               //if (typeof g.data.modal_xulG_stack != 'undefined' && typeof g.data.modal_xulG_stack[key] != 'undefined') {
+                               //      xulG = g.data.modal_xulG_stack[key][ g.data.modal_xulG_stack[key].length - 1 ];
+                               //}
 
-                               var top_xml = g.cgi.param('top_xml') || g.data[ g.cgi.param('top_xml_in_stash') ];
+                               var top_xml = xul_param('top_xml',{'stash_name':xul_param('top_xml_in_stash',{'modal_xulG':true}),'modal_xulG':true});
                                if (top_xml) {
                                        var parser = new DOMParser();
                                        var doc = parser.parseFromString( top_xml, 'text/xml' );
@@ -55,7 +63,7 @@
                                        if (node) document.getElementById('fancy_prompt_topbar').appendChild(node);
                                }
 
-                               var my_xml = g.cgi.param('xml') || g.data[ g.cgi.param('xml_in_stash') ];
+                               var my_xml = xul_param('xml',{'stash_name':xul_param('xml_in_stash',{'modal_xulG':true}),'modal_xulG':true});
                                if (my_xml) {
                                        var parser = new DOMParser();
                                        var doc = parser.parseFromString( my_xml, 'text/xml' );
@@ -63,7 +71,7 @@
                                        if (node) document.getElementById('fancy_prompt_main').appendChild(node);
                                }
 
-                               var bot_xml = g.cgi.param('bot_xml') || g.data[ g.cgi.param('bottom_xml_in_stash') ];
+                               var bot_xml = xul_param('bot_xml',{'stash_name':xul_param('bottom_xml_in_stash',{'modal_xulG':true}),'modal_xulG':true});;
                                if (bot_xml) {
                                        var parser = new DOMParser();
                                        var doc = parser.parseFromString( bot_xml, 'text/xml' );
                                        nl[i].addEventListener('command',function(ev) { window.close(); },false);
                                }
 
-                               if (g.cgi.param('title')) {
-                                       try { window.title = g.cgi.param('title'); } catch(E) {}
-                                       try { document.title = g.cgi.param('title'); } catch(E) {}
+                               if (xul_param('title',{'modal_xulG':true})) {
+                                       try { window.title = xul_param('title',{'modal_xulG':true}); } catch(E) {}
+                                       try { document.title = xul_param('title',{'modal_xulG':true}); } catch(E) {}
                                }
 
-                               if (g.cgi.param('focus')) document.getElementById(g.cgi.param('focus')).focus();
+                               if (xul_param('focus',{'modal_xulG':true})) document.getElementById(xul_param('focus',{'modal_xulG':true})).focus();
 
                        } catch(E) {
                                var err_msg = "!! This software has encountered an error.  Please tell your friendly " +
                }
 
                function fancy_save(ev) {
-                       if (ev.target.id) g.data.fancy_prompt_data[ ev.target.id ] = ev.target.value || ev.target.getAttribute('value');
-                       g.data.fancy_prompt_data[ 'fancy_submit' ] = ev.target.value || ev.target.getAttribute('value');
-                       var nl = document.getElementsByAttribute('name','fancy_data');
-                       for (var i = 0; i < nl.length; i++) {
-                               g.data.fancy_prompt_data[ nl[i].id ] = nl[i].nodeName == 'checkbox' ? nl[i].checked : nl[i].value;
+                       try {
+                               //if (ev.target.id) g.data.fancy_prompt_data[ ev.target.id ] = ev.target.value || ev.target.getAttribute('value');
+                               //g.data.fancy_prompt_data[ 'fancy_submit' ] = ev.target.value || ev.target.getAttribute('value');
+                               //var nl = document.getElementsByAttribute('name','fancy_data');
+                               //for (var i = 0; i < nl.length; i++) {
+                               //      g.data.fancy_prompt_data[ nl[i].id ] = nl[i].nodeName == 'checkbox' ? nl[i].checked : nl[i].value;
+                               //}
+                               //g.data.stash('fancy_prompt_data');
+       
+                               JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
+                               if (ev.target.id) xulG[ ev.target.id ] = ev.target.value || ev.target.getAttribute('value');
+                               xulG[ 'fancy_submit' ] = ev.target.value || ev.target.getAttribute('value');
+                               var nl = document.getElementsByAttribute('name','fancy_data');
+                                       for (var i = 0; i < nl.length; i++) {
+                                       xulG[ nl[i].id ] = nl[i].nodeName == 'checkbox' ? nl[i].checked : nl[i].value;
+                               }
+                               xulG.fancy_status = 'complete';
+                               var key = location.pathname + location.search + location.hash;
+                               data.modal_xulG_stack[key][ data.modal_xulG_stack[key].length - 1 ] = xulG;
+                               data.stash('modal_xulG_stack');
+       
+                               window.close();
+                       } catch(E) {
+                               try { g.error.standard_unexpected_error_alert('fancy_save',E); } catch(F) { alert('fancy_save ' + E + ' ' + F); }
                        }
-                       g.data.stash('fancy_prompt_data');
-                       window.close();
                }
        ]]>
        </script>
index 2d1bcf4..501f73c 100644 (file)
@@ -65,6 +65,7 @@ util.network.prototype = {
                                obj.error.sdump('D_CACHE','Cached request found for key = \n' + key + '\n' + js2JSON(x) + '\n');                
                                switch(x.status) {
                                        case 'pending' :
+                                               if ( Number(new Date()) - Number(x.status_time) > 60000 ) break; // if pending request is taking too long
                                                if (f) { // Setup a self-destroying observer on the pending request to handle this request
                                                        obj.error.sdump('D_CACHE','Cached request pending, adding watch to handle current asynchronous request. key = \n' + key + '\n');
                                                        var id = data.observers.add('cached_request.'+key+'.status',function(p,o,n) {
@@ -308,26 +309,34 @@ util.network.prototype = {
                netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserWrite');
                var url = urls.XUL_AUTH_SIMPLE;
                if (typeof xulG != 'undefined' && typeof xulG.url_prefix == 'function') url = xulG.url_prefix( url );
-               window.open(
-                       url
-                       + '?login_type=staff'
-                       + '&desc_brief=' + window.escape( text ? 'Session Expired' : 'Operator Change' )
-                       + '&desc_full=' + window.escape( text ? 'Please enter the credentials for a new login session.' : 'Please enter the credentials for the new login session.  Note that the previous session is still active.'),
-                       'simple_auth' + (new Date()).toString(),
-                       'chrome,resizable,modal,width=700,height=500'
+               JSAN.use('util.window'); var win = new util.window();
+               var my_xulG = win.open(
+                       url,
+                       //+ '?login_type=staff'
+                       //+ '&desc_brief=' + window.escape( text ? 'Session Expired' : 'Operator Change' )
+                       //+ '&desc_full=' + window.escape( text ? 'Please enter the credentials for a new login session.' : 'Please enter the credentials for the new login session.  Note that the previous session is still active.'),
+                       //'simple_auth' + (new Date()).toString(),
+                       'Authorize',
+                       'chrome,resizable,modal,width=700,height=500',
+                       {
+                               'login_type' : 'staff',
+                               'desc_brief' : text ? 'Session Expired' : 'Operator Change',
+                               'desc_full' : text ? 'Please enter the credentials for a new login session.' : 'Please enter the credentials for the new login session.  Note that the previous session is still active.',
+                               //'simple_auth' : (new Date()).toString(),
+                       }
                );
                JSAN.use('OpenILS.data');
                var data = new OpenILS.data(); data.init({'via':'stash'});
-               if (typeof data.temporary_session != 'undefined' && data.temporary_session != '') {
-                       data.session.key = data.temporary_session.key; 
-                       data.session.authtime = data.temporary_session.authtime; 
+               if (typeof my_xulG.temporary_session != 'undefined' && my_xulG.temporary_session != '') {
+                       data.session.key = my_xulG.temporary_session.key; 
+                       data.session.authtime = my_xulG.temporary_session.authtime; 
                        data.stash('session');
                        if (! data.list.au ) data.list.au = [];
-                       data.list.au[0] = JSON2js(data.temporary_session.usr);
+                       data.list.au[0] = JSON2js( my_xulG.temporary_session.usr );
                        data.stash('list');
                        obj.reset_titlebars(data);
                        return true;
-               }
+               } else { alert('here2'); }
                return false;
 
                } catch(E) {
@@ -362,18 +371,26 @@ util.network.prototype = {
                                if (location.href.match(/^chrome/)) {
                                        //alert('Permission denied.');
                                } else {
-                                       window.open(
-                                               urls.XUL_AUTH_SIMPLE
-                                               + '?login_type=temp'
-                                               + '&desc_brief=' + window.escape('Permission Denied: ' + robj.ilsperm)
-                                               + '&desc_full=' + window.escape('Another staff member with the above permission may authorize this specific action.  Please notify your library administrator if you need this permission.  If you feel you have received this exception in error, inform your friendly Evergreen developers of the above permission and this debug information: ' + name),
-                                               'simple_auth' + (new Date()).toString(),
-                                               'chrome,resizable,modal,width=700,height=500'
+                                       JSAN.use('util.window'); var win = new util.window();
+                                       var my_xulG = win.open(
+                                               urls.XUL_AUTH_SIMPLE,
+                                               //+ '?login_type=temp'
+                                               //+ '&desc_brief=' + window.escape('Permission Denied: ' + robj.ilsperm)
+                                               //+ '&desc_full=' + window.escape('Another staff member with the above permission may authorize this specific action.  Please notify your library administrator if you need this permission.  If you feel you have received this exception in error, inform your friendly Evergreen developers of the above permission and this debug information: ' + name),
+                                               //'simple_auth' + (new Date()).toString(),
+                                               'Authorize',
+                                               'chrome,resizable,modal,width=700,height=500',
+                                               {
+                                                       'login_type' : 'temp',
+                                                       'desc_brief' : 'Permission Denied: ' + robj.ilsperm,
+                                                       'desc_full' : 'Another staff member with the above permission may authorize this specific action.  Please notify your library administrator if you need this permission.  If you feel you have received this exception in error, please inform your friendly Evergreen developers or helpdesk staff of the above permission and this debug information: ' + name,
+                                                       //'simple_auth' : (new Date()).toString(),
+                                               }
                                        );
                                        JSAN.use('OpenILS.data');
-                                       var data = new OpenILS.data(); data.init({'via':'stash'});
-                                       if (typeof data.temporary_session != 'undefined' && data.temporary_session != '') {
-                                               params[0] = data.temporary_session.key;
+                                       //var data = new OpenILS.data(); data.init({'via':'stash'});
+                                       if (typeof my_xulG.temporary_session != 'undefined' && my_xulG.temporary_session != '') {
+                                               params[0] = my_xulG.temporary_session.key;
                                                req = obj._request(app,name,params,null,override_params,_params);
                                        }
                                }
@@ -409,17 +426,18 @@ util.network.prototype = {
                                                '<description>Force this action?</description>' + 
                                                '<button accesskey="N" label="No" name="fancy_cancel"/>' + 
                                                '<button id="override" accesskey="Y" label="Yes" name="fancy_submit" value="override"/></hbox></groupbox></vbox>';
-                                       JSAN.use('OpenILS.data');
-                                       var data = new OpenILS.data(); data.init({'via':'stash'});
-                                       data.temp_override_xml = xml; data.stash('temp_override_xml');
-                                       window.open(
-                                               urls.XUL_FANCY_PROMPT
-                                               + '?xml_in_stash=temp_override_xml'
-                                               + '&title=' + window.escape(override_params.title),
-                                               'fancy_prompt', 'chrome,resizable,modal,width=700,height=500'
+                                       //JSAN.use('OpenILS.data');
+                                       //var data = new OpenILS.data(); data.init({'via':'stash'});
+                                       //data.temp_override_xml = xml; data.stash('temp_override_xml');
+                                       JSAN.use('util.window'); var win = new util.window();
+                                       var fancy_prompt_data = win.open(
+                                               urls.XUL_FANCY_PROMPT,
+                                               //+ '?xml_in_stash=temp_override_xml'
+                                               //+ '&title=' + window.escape(override_params.title),
+                                               'fancy_prompt', 'chrome,resizable,modal,width=700,height=500',
+                                               { 'xml' : xml, 'title' : override_params.title }
                                        );
-                                       data.init({'via':'stash'});
-                                       if (data.fancy_prompt_data != '') {
+                                       if (fancy_prompt_data.fancy_status == 'complete') {
                                                req = obj._request(app,name + '.override',params);
                                        }
                                        return req;
index 4dd9aa2..0062dde 100644 (file)
                                JSAN.use('util.error'); g.error = new util.error();
                                g.error.sdump('D_TRACE','my_init() for util_browser.xul');
 
-                               g.cgi = new CGI();
-                               var name = g.cgi.param('tab_name') || g.cgi.param('name') || null;
-                               if (!name) {
-                                       if (typeof window.xulG == 'object') {
-                                               name = window.xulG.name || window.xulG.tab_name || null;
-                                       }
-                               }
-                               var url; try { url = g.cgi.param('url') || xulG.url } catch(E) { dump(E + '\n'); };
+                               var name = xul_param('tab_name') || xul_param('name') || null;
+                               var url; try { url = xul_param('url'); } catch(E) { dump(E + '\n'); };
                                if (!url) url = urls.browser;
 
                                if (!g.browser) {
                                }
 
                                var push_xulG = true;
-                               if (g.cgi.param('no_xulG') || (typeof xulG == 'object' ? xulG.no_xulG : false)) push_xulG = false;
+                               if (xul_param('no_xulG')) push_xulG = false;
 
                                var alt_print = false;
-                               if (g.cgi.param('alternate_print') || (typeof xulG == 'object' ? xulG.alternate_print : false)) alt_print = true;
+                               if (xul_param('alternate_print')) alt_print = true;
 
                                var p = { 
                                        'url' : url,
                                if (typeof window.xulG == 'object' && typeof window.xulG.set_tab_name == 'function') {
                                        if (name) try { window.xulG.set_tab_name(name); } catch(E) { alert(E); }
                                }
-                               if (g.cgi.param('show_nav_buttons')||(typeof window.xulG == 'object' && window.xulG.show_nav_buttons)) {
+                               if (xul_param('show_nav_buttons')) {
                                        document.getElementById('back').hidden = false;
                                        document.getElementById('forward').hidden = false;
                                }
-                               if (g.cgi.param('show_print_button')||(typeof window.xulG == 'object' && window.xulG.show_print_button)) {
+                               if (xul_param('show_print_button')) {
                                        document.getElementById('browser_print').hidden = false;
                                }
 
-                               if (g.cgi.param('title')) {
-                                       try { document.title = g.cgi.param('title'); } catch(E) {}
-                                       try { window.title = g.cgi.param('title'); } catch(E) {}
+                               if (xul_param('title')) {
+                                       try { document.title = xul_param('title'); } catch(E) {}
+                                       try { window.title = xul_param('title'); } catch(E) {}
                                }
 
                        } catch(E) {
index e21e1a1..c7a73bf 100644 (file)
@@ -71,13 +71,40 @@ util.window.prototype = {
                return w;
        },
 
-       'open' : function(url,title,features) {
+       'open' : function(url,title,features,my_xulG) {
                netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+               var key;
                if (!title) title = 'anon' + this.window_name_increment();
                if (!features) features = 'chrome';
-               this.error.sdump('D_WIN',
-                       'opening ' + url + ', ' + title + ', ' + features + ' from ' + this.win + '\n');
+               this.error.sdump('D_WIN', 'opening ' + url + ', ' + title + ', ' + features + ' from ' + this.win + '\n');
+               var data;
+               if (features.match(/modal/) && my_xulG) {
+                       JSAN.use('OpenILS.data'); data = new OpenILS.data(); data.init({'via':'stash'});
+                       if (typeof data.modal_xulG_stack == 'undefined') data.modal_xulG_stack = {}; 
+                       /* FIXME - not a perfect key.. could imagine two top-level windows both opening modal windows */
+                       key = url; 
+                       if (typeof xulG == 'object') if (typeof xulG.url_prefix == 'function') {
+                               key = key.replace( xulG.url_prefix('/'), '/' ); 
+                       }
+                       if (typeof data.modal_xulG_stack[key] == 'undefined') data.modal_xulG_stack[key] = [];
+                       data.modal_xulG_stack[key].push( my_xulG );
+                       data.stash('modal_xulG_stack');
+                       this.error.sdump('D_WIN','modal key = ' + key);
+               }
                var w = this.SafeWindowOpen(url,title,features);
+               if (features.match(/modal/) && my_xulG) { 
+                       var x = data.modal_xulG_stack[key].pop();
+                       data.stash('modal_xulG_stack');
+                       return x;
+               } else {
+                       if (my_xulG) {
+                               if (w.contentWindow) {
+                                       w.contentWindow.xulG = my_xulG;
+                               } else {
+                                       w.xulG = my_xulG;
+                               }
+                       }
+               }
                /*
                setTimeout( 
                        function() { 
index 22963fd..99e565f 100644 (file)
                                JSAN.use('util.error'); g.error = new util.error();
                                g.error.sdump('D_TRACE','my_init() for holds.xul');
 
-                               g.cgi = new CGI();
-
                                JSAN.use('patron.holds'); g.holds = new patron.holds();
                                g.holds.init( 
                                        { 
                                                'tree_id' : 'holds_pull_list',
-                                               'patron_id' : g.cgi.param('patron_id'), 
-                                               'docid' : g.cgi.param('docid'),
-                                               'shelf' : g.cgi.param('shelf'),
-                                               'pull' : g.cgi.param('pull'),
+                                               'patron_id' : xul_param('patron_id'),
+                                               'docid' : xul_param('docid'),
+                                               'shelf' : xul_param('shelf'),
+                                               'pull' : xul_param('pull'),
                                        } 
                                );
                                window.refresh = function(p) { g.holds.retrieve(p); }
index aed9b2a..9e3d4b4 100644 (file)
@@ -522,6 +522,7 @@ admin.offline_manage_xacts.prototype = {
                x.setAttribute(
                        'src',
                        window.xulG.url_prefix( urls.XUL_REMOTE_BROWSER )
+                       /*
                        + '?url=' + window.escape(
                                urls.XUL_OFFLINE_UPLOAD_XACTS
                                + '?ses=' + window.escape(ses())
@@ -530,10 +531,17 @@ admin.offline_manage_xacts.prototype = {
                                + '&delta=' + window.escape('0')
                                + '&filename=' + window.escape( obj.transition_filename )
                        )
+                       */
                );
                var newG = { 
+                       'url' : urls.XUL_OFFLINE_UPLOAD_XACTS,
                        'url_prefix' : window.xulG.url_prefix, 
                        'passthru_content_params' : {
+                               'ses' : ses(),
+                               'seskey' : seskey,
+                               'ws' : obj.data.ws_name,
+                               'delta' : 0,
+                               'filename' : obj.transition_filename,
                                'url_prefix' : window.xulG.url_prefix,
                                'handle_event' : function(robj){
                                        netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
@@ -687,8 +695,8 @@ admin.offline_manage_xacts.prototype = {
                        funcs.push( 
                                function(idx,row){ 
                                        return function(){
-                                               obj.list.append( { 'retrieve_id' : idx, 'row' : row, 'no_auto_select' : true } );
-                                               if (idx == old_idx) obj.list.node.view.selection.select(idx);
+                                               obj.list.append( { 'retrieve_id' : idx, 'row' : row, 'no_auto_select' : true, 'to_bottom' : true } );
+                                               //if (idx == old_idx) obj.list.node.view.selection.select(idx);
                                        };
                                }(i,{ 'my' : obj.seslist[i] }) 
                        );
@@ -795,10 +803,10 @@ admin.offline_manage_xacts.prototype = {
                        }
                        if (typeof window.xulG == 'object' && typeof window.xulG.new_tab == 'function') {
                                try {
-                                       var url = urls.XUL_COPY_STATUS
-                                               + '?barcodes=' + window.escape( js2JSON(barcodes) );
+                                       var url = urls.XUL_COPY_STATUS;
+                                               //+ '?barcodes=' + window.escape( js2JSON(barcodes) );
                                        window.xulG.new_tab(
-                                               url
+                                               url, {}, { 'barcodes' : barcodes }
                                        );
                                } catch(E) {
                                        alert(E);
@@ -811,22 +819,27 @@ admin.offline_manage_xacts.prototype = {
 
        'retrieve_patron' : function() {
                var obj = this;
+               var patrons = {};
                try {
                        for (var i = 0; i < obj.sel_errors.length; i++) {
                                var error = obj.errors[ obj.sel_errors[i] ];
                                if ( ! error.command.patron_barcode ) continue; 
                                if ( [ '', ' ', '???' ].indexOf( error.command.patron_barcode ) != -1 ) continue;
+                               patrons[ error.command.patron_barcode ] = true;
+                       }
+                       for (var barcode in patrons) {
                                if (typeof window.xulG == 'object' && typeof window.xulG.new_tab == 'function') {
                                        try {
-                                               var url = urls.XUL_PATRON_DISPLAY
-                                                       + '?barcode=' + window.escape( error.command.patron_barcode );
+                                               var url = urls.XUL_PATRON_DISPLAY;
+                                                       //+ '?barcode=' + window.escape( error.command.patron_barcode );
                                                window.xulG.new_tab(
-                                                       url
+                                                       url, {}, { 'barcode' : barcode }
                                                );
                                        } catch(E) {
                                                alert(E);
                                        }
                                }
+
                        }
                } catch(E) {
                        alert(E);
@@ -844,7 +857,7 @@ admin.offline_manage_xacts.prototype = {
                                                'Details:\n' + obj.error.pretty_print(js2JSON(error))
                                        ),
                                        'offline_error_details',
-                                       'height=240,width=320,scrollbars=yes,chrome,resizable,modal'
+                                       'height=780,width=580,scrollbars=yes,chrome,resizable,modal'
                                );
                        }
                } catch(E) {
index c8d991c..0bf9973 100644 (file)
@@ -40,8 +40,6 @@
                                JSAN.use('util.error'); g.error = new util.error();
                                g.error.sdump('D_TRACE','my_init() for admin_offline_manage_xacts.xul');
 
-                               g.cgi = new CGI();
-
                                JSAN.use('admin.offline_manage_xacts'); g.admin = new admin.offline_manage_xacts();
                                g.admin.init({});
 
index e4ec653..12dec91 100644 (file)
@@ -11,15 +11,13 @@ function my_init() {
                JSAN.errorLevel = "die"; // none, warn, or die
                JSAN.addRepository('..');
                JSAN.use('util.error'); g.error = new util.error();
-               g.error.sdump('D_TRACE','my_init() for offline_checkout.html');
+               g.error.sdump('D_TRACE','my_init() for upload_xacts.html');
 
                if (typeof window.xulG == 'object' && typeof window.xulG.set_tab_name == 'function') {
                        try { window.xulG.set_tab_name('Upload Offline Transactions'); } catch(E) { alert(E); }
                }
 
-               g.cgi = new CGI();
-
-               JSAN.use('util.file'); g.file = new util.file( g.cgi.param('filename') );
+               JSAN.use('util.file'); g.file = new util.file( xul_param('filename') );
 
                if (g.file._file.exists()) {
                        $('submit').disabled = false;
@@ -29,10 +27,10 @@ function my_init() {
                        return;
                }
 
-               $( 'ws' ).setAttribute('value', g.cgi.param('ws'));
-               $( 'ses' ).setAttribute('value', g.cgi.param('ses'));
-               $( 'seskey' ).setAttribute('value', g.cgi.param('seskey'));
-               $( 'delta' ).setAttribute('value', g.cgi.param('delta'));
+               $( 'ws' ).setAttribute('value', xul_param('ws'));
+               $( 'ses' ).setAttribute('value', xul_param('ses'));
+               $( 'seskey' ).setAttribute('value', xul_param('seskey'));
+               $( 'delta' ).setAttribute('value', xul_param('delta'));
 
                $( 'form' ).setAttribute('action', xulG.url_prefix(urls.XUL_OFFLINE_MANAGE_XACTS_CGI));
 
index ce5fee3..d3c13f8 100644 (file)
@@ -14,6 +14,7 @@
        <link rel="stylesheet" type="text/css" media="all" href="chrome://global/skin/" title="chrome_skin" />
        <script type="text/javascript" src="/xul/server/main/JSAN.js"></script>
        <script type="text/javascript" src="/xul/server/main/constants.js" />
+       <script type="text/javascript" src="/xul/server/OpenILS/global_util.js" />
 
        <script type="text/javascript" src="/opac/common/js/utils.js" />
        <script type="text/javascript" src="/opac/common/js/CGI.js" />
index 2032ce1..fa11522 100644 (file)
                                JSAN.use('util.error'); g.error = new util.error();
                                g.error.sdump('D_TRACE','my_init() for cat_bib_brief.xul');
 
-                               g.cgi = new CGI();
-                               docid = g.cgi.param('docid');
+                               JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
+
+                               docid = xul_param('docid');
+
+                               var key = location.pathname + location.search + location.hash;
+                               if (!docid && typeof data.modal_xulG_stack != 'undefined' && typeof data.modal_xulG_stack[key] != 'undefined') {
+                                       var xulG = data.modal_xulG_stack[key][ data.modal_xulG_stack[key].length - 1 ];
+                                       if (typeof xulG == 'object') {
+                                               docid = xulG.docid;
+                                       }
+                               }
 
                                JSAN.use('util.network'); g.network = new util.network();
                                JSAN.use('util.date');
@@ -55,7 +64,6 @@
 
                                if (docid > -1) {
 
-                                       JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
                                        data.last_record = docid; data.stash('last_record');
 
                                        g.network.request(
                }
 
                function view_marc() {
-                       JSAN.use('util.window'); var win = new util.window();
-                       if (docid < 0) {
-                               alert('Item not cataloged.');
-                       } else {
-                               win.open( urls.XUL_MARC_VIEW + '?noprint=1&docid=' + docid, 'marc_view', 'chrome,resizable,modal,width=400,height=400');
+                       try {
+                               JSAN.use('util.window'); var win = new util.window();
+                               if (docid < 0) {
+                                       alert('Item not cataloged.');
+                               } else {
+                                       netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+                                       //win.open( urls.XUL_MARC_VIEW + '?noprint=1&docid=' + docid, 'marc_view', 'chrome,resizable,modal,width=400,height=400');
+                                       win.open( urls.XUL_MARC_VIEW, 'marc_view', 'chrome,resizable,modal,width=400,height=400',{'noprint':1,'docid':docid});
+                               }
+                       } catch(E) {
+                g.error.standard_unexpected_error_alert('spawning marc display',E);
                        }
                }
 
index 8c31a51..70ee346 100644 (file)
@@ -197,14 +197,15 @@ cat.copy_browser.prototype = {
 
                                                                        JSAN.use('util.window'); var win = new util.window();
                                                                        var w = win.open(
-                                                                               window.xulG.url_prefix(urls.XUL_VOLUME_COPY_CREATOR)
-                                                                                       +'?doc_id=' + window.escape(obj.docid)
-                                                                                       +'&ou_ids=' + window.escape( js2JSON(list) )
-                                                                                       +'&copy_shortcut=' + window.escape( js2JSON(copy_shortcut) ),
+                                                                               window.xulG.url_prefix(urls.XUL_VOLUME_COPY_CREATOR),
+                                                                                       //+'?doc_id=' + window.escape(obj.docid)
+                                                                                       //+'&ou_ids=' + window.escape( js2JSON(list) )
+                                                                                       //+'&copy_shortcut=' + window.escape( js2JSON(copy_shortcut) ),
                                                                                title,
                                                                                'chrome,resizable'
                                                                        );
                                                                        w.refresh = function() { obj.refresh_list(); }
+                                                                       w.xulG = { 'doc_id':obj.docid, 'ou_ids' : list, 'copy_shortcut' : copy_shortcut };
                                                                } catch(E) {
                                                                        obj.error.standard_unexpected_error_alert('copy browser -> add copies',E);
                                                                }
@@ -465,14 +466,15 @@ cat.copy_browser.prototype = {
 
                                                                        JSAN.use('util.window'); var win = new util.window();
                                                                        var w = win.open(
-                                                                               window.xulG.url_prefix(urls.XUL_VOLUME_COPY_CREATOR)
-                                                                                       +'?doc_id=' + window.escape(obj.docid)
-                                                                                       +'&ou_ids=' + window.escape( js2JSON(list) ),
+                                                                               window.xulG.url_prefix(urls.XUL_VOLUME_COPY_CREATOR),
+                                                                                       //+'?doc_id=' + window.escape(obj.docid)
+                                                                                       //+'&ou_ids=' + window.escape( js2JSON(list) ),
                                                                                title,
                                                                                'chrome,resizable'
                                                                        );
 
                                                                        w.refresh = function() { obj.refresh_list() };
+                                                                       w.xulG = { 'doc_id' : obj.docid, 'ou_ids' : list };
                                                                } catch(E) {
                                                                        obj.error.standard_unexpected_error_alert('copy browser -> add volumes',E);
                                                                }
@@ -533,19 +535,19 @@ cat.copy_browser.prototype = {
                                                                        var title = list.length == 1 ? 'Volume' : 'Volumes';
 
                                                                        JSAN.use('util.window'); var win = new util.window();
-                                                                       obj.data.volumes_temp = js2JSON( list );
-                                                                       obj.data.stash('volumes_temp');
-                                                                       var w = win.open(
+                                                                       //obj.data.volumes_temp = js2JSON( list );
+                                                                       //obj.data.stash('volumes_temp');
+                                                                       var my_xulG = win.open(
                                                                                window.xulG.url_prefix(urls.XUL_VOLUME_EDITOR),
                                                                                title,
-                                                                               'chrome,modal,resizable'
+                                                                               'chrome,modal,resizable',
+                                                                               { 'volumes' : list }
                                                                        );
 
                                                                        /* FIXME -- need to unique the temp space, and not rely on modalness of window */
-                                                                       obj.data.stash_retrieve();
-                                                                       var volumes = JSON2js( obj.data.volumes_temp );
-                                                                       obj.error.sdump('D_CAT','in browse, obj.data.temp =\n' + obj.data.temp);
-                                                                       if (volumes=='') return;
+                                                                       //obj.data.stash_retrieve();
+                                                                       var volumes = my_xulG.volumes;
+                                                                       if (!volumes) return;
                                                                
                                                                        volumes = util.functional.filter_list(
                                                                                volumes,
@@ -748,16 +750,17 @@ cat.copy_browser.prototype = {
                                                                        xml += '</vbox>';
                                                                        JSAN.use('OpenILS.data');
                                                                        var data = new OpenILS.data(); data.init({'via':'stash'});
-                                                                       data.temp_transfer = xml; data.stash('temp_transfer');
-                                                                       window.open(
-                                                                               urls.XUL_FANCY_PROMPT
-                                                                               + '?xml_in_stash=temp_transfer'
-                                                                               + '&title=' + window.escape('Volume Transfer'),
-                                                                               'fancy_prompt', 'chrome,resizable,modal,width=500,height=300'
+                                                                       //data.temp_transfer = xml; data.stash('temp_transfer');
+                                                                       JSAN.use('util.window'); var win = new util.window();
+                                                                       var fancy_prompt_data = win.open(
+                                                                               urls.XUL_FANCY_PROMPT,
+                                                                               //+ '?xml_in_stash=temp_transfer'
+                                                                               //+ '&title=' + window.escape('Volume Transfer'),
+                                                                               'fancy_prompt', 'chrome,resizable,modal,width=500,height=300',
+                                                                               { 'xml' : xml, 'title' : 'Volume Transfer' }
                                                                        );
-                                                                       data.init({'via':'stash'});
 
-                                                                       if (data.fancy_prompt_data == '') { alert('Transfer Aborted'); return; }
+                                                                       if (fancy_prompt_data.fancy_status == 'incomplete') { alert('Transfer Aborted'); return; }
 
                                                                        var robj = obj.network.simple_request(
                                                                                'FM_ACN_TRANSFER', 
index b9b6e96..a83a535 100644 (file)
                                JSAN.use('util.error'); g.error = new util.error();
                                g.error.sdump('D_TRACE','my_init() for cat_copy_browser.xul');
 
-                               g.cgi = new CGI();
-
                                JSAN.use('cat.copy_browser'); g.copy_browser = new cat.copy_browser();
 
-                               g.copy_browser.init( { 'docid' : g.cgi.param('docid') } );
+                               g.copy_browser.init( { 'docid' : xul_param('docid') } );
 
                                //if (typeof window.xulG == 'object' && typeof window.xulG.set_tab_name == 'function') {
                                //      try { window.xulG.set_tab_name('Holdings Maintenance'); } catch(E) { alert(E); }
index 21c7169..fb45b1b 100644 (file)
@@ -344,7 +344,13 @@ cat.copy_buckets.prototype = {
 
                                                                        var robj = obj.network.simple_request('BUCKET_CREATE',[ses(),'copy',bucket]);
 
-                                                                       if (typeof robj == 'object') throw robj;
+                                                                       if (typeof robj == 'object') {
+                                                                               if (robj.ilsevent == 1710 /* CONTAINER_EXISTS */) {
+                                                                                       alert('You already have a bucket with that name.');
+                                                                                       return;
+                                                                               }
+                                                                               throw robj;
+                                                                       }
 
                                                                        alert('Bucket "' + name + '" created.');
 
@@ -645,10 +651,10 @@ cat.copy_buckets.prototype = {
                                                                        function(o) { return JSON2js(o)[1]; }
                                                                );
                                                                var url = urls.XUL_COPY_STATUS; // + '?barcodes=' + window.escape( js2JSON(barcodes) );
-                                                               JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.stash_retrieve();
-                                                               data.temp_barcodes_for_copy_status = barcodes;
-                                                               data.stash('temp_barcodes_for_copy_status');
-                                                               xulG.new_tab( url, {}, {});
+                                                               //JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.stash_retrieve();
+                                                               //data.temp_barcodes_for_copy_status = barcodes;
+                                                               //data.stash('temp_barcodes_for_copy_status');
+                                                               xulG.new_tab( url, {}, { 'barcodes' : barcodes });
                                                        } catch(E) {
                                                                obj.error.standard_unexpected_error_alert('Copy Status from Copy Buckets',E);
                                                        }
index d4097b3..f29afff 100644 (file)
                                g.error.sdump('D_TRACE','my_init() for copy_buckets.xul');
                                JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.init({'via':'stash'});
 
-                               g.cgi = new CGI();
-                               var copy_ids = [];
-                               if (g.cgi.param('copy_ids')) copy_ids = copy_ids.concat( JSON2js( g.cgi.param('copy_ids') ) );
-                               if (typeof window.xuLG == 'object' && typeof window.xulG.copy_ids != 'undefined')
-                                       copy_ids = copy_ids.concat( window.xulG.copy_ids );
-                               if (typeof g.data.cb_temp_copy_ids != 'undefined' && g.data.cb_temp_copy_ids != null) {
-                                       copy_ids = copy_ids.concat( JSON2js( g.data.cb_temp_copy_ids ) );
-                                       g.data.cb_temp_copy_ids = undefined; g.data.stash('cb_temp_copy_ids');
-                               }
+                               var copy_ids = xul_param(
+                                       'copy_ids',{
+                                               'concat' : true,
+                                               'JSON2js_if_cgi' : true,
+                                               'JSON2js_if_xpcom' : true,
+                                               'stash_name':'cb_temp_copy_ids',
+                                               'clear_xpcom' : true,
+                                       }
+                               );
 
                                JSAN.use('cat.copy_buckets'); g.copy_buckets = new cat.copy_buckets();
                                g.copy_buckets.init( 
index 716d5e0..8a189e0 100644 (file)
                                JSAN.use('util.network'); g.network = new util.network();
                                JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.init({'via':'stash'});
 
-                               g.cgi = new CGI();
-                               g.copy_ids = [];
-                               if (g.cgi.param('copy_ids')) g.copy_ids = g.copy_ids.concat( JSON2js( g.cgi.param('copy_ids') ) );
-                               if (typeof window.xuLG == 'object' && typeof window.xulG.copy_ids != 'undefined')
-                                       g.copy_ids = g.copy_ids.concat( window.xulG.copy_ids );
-                               if (typeof g.data.cb_temp_copy_ids != 'undefined' && g.data.cb_temp_copy_ids != null) {
-                                       g.copy_ids = g.copy_ids.concat( JSON2js( g.data.cb_temp_copy_ids ) );
-                                       g.data.cb_temp_copy_ids = undefined; g.data.stash('cb_temp_copy_ids');
-                               }
+                               g.copy_ids = xul_param(
+                                       'copy_ids',{
+                                               'concat' : true,
+                                               'JSON2js_if_cgi' : true,
+                                               'JSON2js_if_xpcom' : true,
+                                               'stash_name':'cb_temp_copy_ids',
+                                               'clear_xpcom' : true,
+                                       }
+                               );
 
                                $('desc').appendChild( document.createTextNode( 
                                        (g.copy_ids.length == 1 ?
index 3e4b8f6..f81fc2b 100644 (file)
@@ -1,5 +1,7 @@
 var g = {};
 
+var xulG = {};
+
 function my_init() {
        try {
                /******************************************************************************************************/
@@ -16,23 +18,17 @@ function my_init() {
                JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.init({'via':'stash'});
                JSAN.use('util.network'); g.network = new util.network();
 
-               g.cgi = new CGI();
-
-               g.docid = g.cgi.param('docid');
-               g.handle_update = g.cgi.param('handle_update');
+               g.docid = xul_param('docid',{'modal_xulG':true});
+               g.handle_update = xul_param('handle_update',{'modal_xulG':true});
 
                /******************************************************************************************************/
                /* Get the copy ids from various sources and flesh them */
 
-               var copy_ids = [];
-               if (g.cgi.param('copy_ids')) copy_ids = JSON2js( g.cgi.param('copy_ids') );
-               if (window.xulG && window.xulG.copy_ids) copy_ids = copy_ids.concat( window.xulG.copy_ids );
-               if (typeof g.data.temp_copy_ids != 'undefined' && g.data.temp_copy_ids != null) copy_ids = copy_ids.concat( JSON2js( g.data.temp_copy_ids ) );
+               var copy_ids = xul_param('copy_ids',{'concat':true,'JSON2js_if_cgi':true,'JSON2js_if_xulG':true,'JSON2js_if_xpcom':true,'stash_name':'temp_copy_ids','clear_xpcom':true,'modal_xulG':true});
                if (!copy_ids) copy_ids = [];
 
-               if (copy_ids.length > 0) g.copies = g.network.request(
-                       api.FM_ACP_FLESHED_BATCH_RETRIEVE.app,
-                       api.FM_ACP_FLESHED_BATCH_RETRIEVE.method,
+               if (copy_ids.length > 0) g.copies = g.network.simple_request(
+                       'FM_ACP_FLESHED_BATCH_RETRIEVE',
                        [ copy_ids ]
                );
 
@@ -40,22 +36,18 @@ function my_init() {
                /* And other fleshed copies if any */
 
                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.data.temp_copies) g.copies = g.copies.concat( JSON2js( g.data.temp_copies ) );
-               g.data.temp_copies = null; g.data.stash('temp_copies');
+               var c = xul_param('copies',{'concat':true,'JSON2js_if_cgi':true,'JSON2js_if_xpcom':true,'stash_name':'temp_copies','clear_xpcom':true,'modal_xulG':true})
+               if (c) g.copies = g.copies.concat(c);
 
                /******************************************************************************************************/
                /* 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 );
+               g.callnumbers = xul_param('callnumbers',{'concat':true,'JSON2js_if_cgi':true,'JSON2js_if_xpcom':true,'stash_name':'temp_callnumbers','clear_xpcom':true,'modal_xulG':true});
 
                /******************************************************************************************************/
                /* Is the interface an editor or a viewer, single or multi copy, existing copies or new copies? */
 
-               if (g.cgi.param('edit') == '1') { 
+               if (xul_param('edit',{'modal_xulG':true}) == '1') { 
                        g.edit = true;
                        document.getElementById('caption').setAttribute('label','Copy Editor'); 
                        document.getElementById('save').setAttribute('hidden','false'); 
@@ -1117,27 +1109,32 @@ g.render_input = function(node,blob) {
 /* store the copies in the global xpcom stash */
 
 g.stash_and_close = function() {
-       if (g.handle_update) {
-               try {
-                       var r = g.network.request(
-                               api.FM_ACP_FLESHED_BATCH_UPDATE.app,
-                               api.FM_ACP_FLESHED_BATCH_UPDATE.method,
-                               [ ses(), g.copies, true ]
-                       );
-                       if (typeof r.ilsevent != 'undefined') {
-                               g.error.standard_unexpected_error_alert('copy update',r);
-                       } else {
-                               alert('Items added/modified.');
+       try {
+               if (g.handle_update) {
+                       try {
+                               var r = g.network.request(
+                                       api.FM_ACP_FLESHED_BATCH_UPDATE.app,
+                                       api.FM_ACP_FLESHED_BATCH_UPDATE.method,
+                                       [ ses(), g.copies, true ]
+                               );
+                               if (typeof r.ilsevent != 'undefined') {
+                                       g.error.standard_unexpected_error_alert('copy update',r);
+                               } else {
+                                       alert('Items added/modified.');
+                               }
+                               /* FIXME -- revisit the return value here */
+                       } catch(E) {
+                               alert('copy update error: ' + js2JSON(E));
                        }
-                       /* FIXME -- revisit the return value here */
-               } catch(E) {
-                       alert('copy update error: ' + js2JSON(E));
                }
+               //g.data.temp_copies = js2JSON( g.copies );
+               //g.data.stash('temp_copies');
+               xulG.copies = g.copies;
+               update_modal_xulG(xulG);
+               window.close();
+       } catch(E) {
+               g.error.standard_unexpected_error_alert('stash and close',E);
        }
-       g.data.temp_copies = js2JSON( g.copies );
-       g.data.stash('temp_copies');
-       g.error.sdump('D_CAT','in modal window, g.data.temp_copies = \n' + g.data.temp_copies + '\n');
-       window.close();
 }
 
 /******************************************************************************************************/
@@ -1145,6 +1142,11 @@ g.stash_and_close = function() {
 
 g.copy_notes = function() {
        JSAN.use('util.window'); var win = new util.window();
-       win.open(urls.XUL_COPY_NOTES + '?copy_id=' + window.escape(g.copies[0].id()),'Copy Notes','chrome,resizable,modal');
+       win.open(
+               urls.XUL_COPY_NOTES, 
+               //+ '?copy_id=' + window.escape(g.copies[0].id()),
+               'Copy Notes','chrome,resizable,modal',
+               { 'copy_id' : g.copies[0].id() }
+       );
 }
 
index 8b12908..95f1718 100644 (file)
@@ -48,8 +48,7 @@
 
                                g.error.sdump('D_TRACE','my_init() for copy_notes.xul');
 
-                               g.cgi = new CGI();
-                               g.copy_id = g.cgi.param('copy_id');
+                               g.copy_id = xul_param('copy_id',{'modal_xulG':true});
 
                                refresh();
 
                        try {
                                netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect UniversalBrowserWrite");
                                var xml = '<groupbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" flex="1"><caption label="New Note"/><grid flex="1"><columns><column/><column flex="1"/></columns><rows><row><label value="Public?"/><checkbox id="pub" name="fancy_data" checked="false"/></row><row><label value="Title"/><textbox id="title" name="fancy_data"/></row><row><label value="Note"/><textbox multiline="true" id="note" name="fancy_data"/></row><row><spacer/><hbox><button label="Cancel" name="fancy_cancel" accesskey="C"/><button label="Add Note" accesskey="A" name="fancy_submit"/></hbox></row></rows></grid></groupbox>';
-                               g.data.init({'via':'stash'});
-                               g.data.temp_note_xml = xml; g.data.stash('temp_note_xml');
-                               window.open(
-                                       urls.XUL_FANCY_PROMPT
-                                       + '?xml_in_stash=temp_note_xml'
-                                       + '&focus=' + window.escape('title')
-                                       + '&title=' + window.escape('Add Note'),
-                                       'fancy_prompt', 'chrome,resizable,modal,width=700,height=500'
+                               //g.data.init({'via':'stash'});
+                               //g.data.temp_note_xml = xml; g.data.stash('temp_note_xml');
+                               JSAN.use('util.window'); var win = new util.window();
+                               var fancy_prompt_data = win.open(
+                                       urls.XUL_FANCY_PROMPT,
+                                       //+ '?xml_in_stash=temp_note_xml'
+                                       //+ '&focus=' + window.escape('title')
+                                       //+ '&title=' + window.escape('Add Note'),
+                                       'fancy_prompt', 'chrome,resizable,modal,width=700,height=500',
+                                       { 'xml' : xml, 'focus' : 'title', 'title' : 'Add Note' }
                                );
-                               g.data.init({'via':'stash'});
-                               if (g.data.fancy_prompt_data != '') {
+                               //g.data.init({'via':'stash'});
+                               if (fancy_prompt_data.fancy_status == 'complete') {
                                        //alert(js2JSON(g.data.fancy_prompt_data));
                                        var note = new acpn();
                                        note.isnew(1);
-                                       note.title( g.data.fancy_prompt_data.title );
-                                       note.value( g.data.fancy_prompt_data.note );
-                                       note.pub( get_bool( g.data.fancy_prompt_data.pub ) ? get_db_true() : get_db_false() );
+                                       note.title( fancy_prompt_data.title );
+                                       note.value( fancy_prompt_data.note );
+                                       note.pub( get_bool( fancy_prompt_data.pub ) ? get_db_true() : get_db_false() );
                                        note.owning_copy( g.copy_id );
                                        var r = g.network.simple_request('FM_ACPN_CREATE',[ ses(), note ]);
                                        if (typeof r.ilsevent != 'undefined') throw(r);
index 99eaa7b..15daa05 100644 (file)
                                JSAN.use('util.error'); g.error = new util.error();
                                g.error.sdump('D_TRACE','my_init() for cat_copy_summary.xul');
 
-                               g.cgi = new CGI();
-                               var copy_id = g.cgi.param('copy_id');
+                               var copy_id = xul_param('copy_id');
 
                                JSAN.use('util.network'); g.network = new util.network();
                                JSAN.use('util.date'); JSAN.use('util.widgets');
                                JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.stash_retrieve();
-                               var copy;
-                               if (g.data.temp_copy) {
-                                       copy = g.data.temp_copy; g.data.temp_copy = null; g.data.stash('temp_copy');
-                               }
-                               var callnumber;
-                               if (g.data.temp_callnumber) {
-                                       callnumber = g.data.temp_callnumber; g.data.temp_callnumber = null; g.data.stash('temp_callnumber');
-                               }
+                               var copy = xul_param('copy',{'stash_name':'temp_copy','clear_xpcom':true});
+                               var callnumber = xul_param('callnumber',{'stash_name':'temp_callnumber','clear_xpcom':true});
 
                                $('caption').setAttribute('tooltiptext','Copy ID = ' + (copy_id || copy.id() ) );
 
index acc50be..30e6136 100644 (file)
                                JSAN.use('util.error'); g.error = new util.error();
                                g.error.sdump('D_TRACE','my_init() for cat/marc_view.xul');
 
-                               g.cgi = new CGI();
-                               var docid = g.cgi.param('docid');
+                               var docid = xul_param('docid');
+                               var noprint = xul_param('noprint');
+
+                               JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
+                               var key = location.pathname + location.search + location.hash;
+                               if (!docid && typeof data.modal_xulG_stack != 'undefined' && typeof data.modal_xulG_stack[key] != 'undefined') {
+                                       var modal_xulG = data.modal_xulG_stack[key][ data.modal_xulG_stack[key].length - 1 ];
+                                       if (typeof modal_xulG == 'object') {
+                                               docid = modal_xulG.docid;
+                                               if (modal_xulG.noprint) noprint = modal_xulG.noprint;
+                                       }
+                               }
 
                                JSAN.use('util.network'); g.network = new util.network();
 
@@ -52,7 +62,7 @@
                                        [ docid ],
                                        function(req) {
                                                marc_html = req.getResultObject();
-                                               if (g.cgi.param('noprint')||typeof xulG == 'undefined') marc_html = marc_html.replace(/<button.+?button>/, '');
+                                               if (noprint||typeof xulG == 'undefined') marc_html = marc_html.replace(/<button.+?button>/, '');
                                                document.getElementById('marc_frame').setAttribute('src', 'data:text/html,' + marc_html);
                                        }
                                );
index f23328f..3176fe8 100644 (file)
@@ -39,6 +39,8 @@
                var holdings_obj;
                var holds_obj;
 
+               var iframe_method = 'reset_iframe'; // set_iframe
+
                function my_init() {
                        try {
                                netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
 
                                JSAN.use('util.network'); g.network = new util.network();
 
-                               g.cgi = new CGI();
-                               try { authtime = g.cgi.param('authtime') || xulG.authtime; } catch(E) { g.error.sdump('D_ERROR',E); }
-                               try { docid = g.cgi.param('docid') || xulG.docid; } catch(E) { g.error.sdump('D_ERROR',E); }
-                               try { opac_url = g.cgi.param('opac_url') || xulG.opac_url; } catch(E) { g.error.sdump('D_ERROR',E); }
+                               try { authtime = xul_param('authtime'); } catch(E) { g.error.sdump('D_ERROR',E); }
+                               try { docid = xul_param('docid'); } catch(E) { g.error.sdump('D_ERROR',E); }
+                               try { opac_url = xul_param('opac_url'); } catch(E) { g.error.sdump('D_ERROR',E); }
 
                                JSAN.use('util.deck');
                                top_pane = new util.deck('top_pane');
                }
 
                function set_brief_view() {
-               try {
-                       var url = xulG.url_prefix( urls.XUL_BIB_BRIEF ) + '?docid=' + window.escape(docid); 
-                       dump('spawning ' + url + '\n');
-                       top_pane.set_iframe( 
-                               url,
-                               {}, 
-                               { 
-                                       'set_tab_name' : function(n) { 
-                                               if (typeof window.xulG == 'object' && typeof window.xulG.set_tab_name == 'function') {
-                                                       try { window.xulG.set_tab_name('Bib Record: ' + n); } catch(E) { alert(E); }
-                                               } else {
-                                                       dump('no set_tab_name\n');
+                       try {
+                               var url = xulG.url_prefix( urls.XUL_BIB_BRIEF ); // + '?docid=' + window.escape(docid); 
+                               dump('spawning ' + url + '\n');
+                               top_pane[iframe_method]( 
+                                       url,
+                                       {}, 
+                                       { 
+                                               'docid' : docid,
+                                               'set_tab_name' : function(n) { 
+                                                       if (typeof window.xulG == 'object' && typeof window.xulG.set_tab_name == 'function') {
+                                                               try { window.xulG.set_tab_name('Bib Record: ' + n); } catch(E) { alert(E); }
+                                                       } else {
+                                                               dump('no set_tab_name\n');
+                                                       }
                                                }
-                                       }
-                               }  
-                       );
-               } catch(E) {
-                       alert(E);
-               }
+                                       }  
+                               );
+                       } catch(E) {
+                               alert(E);
+                       }
                }
 
                function set_marc_view() {
-               try {
-                       bottom_pane.set_iframe( xulG.url_prefix( urls.XUL_MARC_VIEW ) + '?docid=' + window.escape(docid),{},xulG);
-               } catch(E) {
-                       alert(E);
-               }
+                       try {
+                               bottom_pane[iframe_method]( 
+                                       xulG.url_prefix( urls.XUL_MARC_VIEW ), // + '?docid=' + window.escape(docid),
+                                       {},
+                                       {
+                                               'docid' : docid,
+                                       }
+                               );
+                       } catch(E) {
+                               alert(E);
+                       }
                }
 
                function set_marc_edit() {
                                                },
                                        },
                                        'url' : xulG.url_prefix( urls.XUL_MARC_EDIT ),
+                                       'name' : 'MarcEditor',
                                };
                                if (editor_obj) return;
                                JSAN.use('util.browser');
                                editor_obj = new util.browser();
                                editor_obj.init(
                                        {
-                                               'url' : xulG.url_prefix(urls.XUL_REMOTE_BROWSER) + '?name=MarcEditor',
+                                               'url' : xulG.url_prefix(urls.XUL_REMOTE_BROWSER), // + '?name=MarcEditor',
                                                'push_xulG' : true,
                                                'alt_print' : false,
                                                'browser_id' : 'editor',
                function set_copy_browser() {
                        try {
                                bottom_pane.node.selectedIndex = 2;
+                               xulG.docid = docid;
                                var content_params = { 
                                        'show_nav_buttons' : false,
                                        'show_print_button' : false,
                                        'passthru_content_params' : xulG,
-                                       'url' : xulG.url_prefix( urls.XUL_COPY_VOLUME_BROWSE ) + '?docid=' + window.escape(docid),
+                                       'url' : xulG.url_prefix( urls.XUL_COPY_VOLUME_BROWSE ), // + '?docid=' + window.escape(docid),
+                                       'name' : 'HoldingsMaintenance',
                                };
                                if (holdings_obj) return;
                                JSAN.use('util.browser');
                                holdings_obj = new util.browser();
                                holdings_obj.init(
                                        {
-                                               'url' : xulG.url_prefix(urls.XUL_REMOTE_BROWSER) + '?name=HoldingsMaintenance',
+                                               'url' : xulG.url_prefix(urls.XUL_REMOTE_BROWSER), // + '?name=HoldingsMaintenance',
                                                'push_xulG' : true,
                                                'alt_print' : false,
                                                'browser_id' : 'holdings',
                function set_hold_browser() {
                        try {
                                bottom_pane.node.selectedIndex = 3;
+                               xulG.docid = docid;
                                var content_params = { 
                                        'show_nav_buttons' : false,
                                        'show_print_button' : false,
                                        'passthru_content_params' : xulG,
-                                       'url' : xulG.url_prefix( urls.XUL_HOLDS_BROWSER ) + '?docid=' + window.escape(docid),
+                                       'url' : xulG.url_prefix( urls.XUL_HOLDS_BROWSER ), // + '?docid=' + window.escape(docid),
+                                       'name' : 'Holds',
                                };
                                if (holds_obj) return;
                                JSAN.use('util.browser');
                                holds_obj = new util.browser();
                                holds_obj.init(
                                        {
-                                               'url' : xulG.url_prefix(urls.XUL_REMOTE_BROWSER) + '?name=Holds',
+                                               'url' : xulG.url_prefix(urls.XUL_REMOTE_BROWSER), // + '?name=Holds',
                                                'push_xulG' : true,
                                                'alt_print' : false,
                                                'browser_id' : 'holds',
                                                win.attachEvt("rdetail", "recordRetrieved",
                                                        function(id){
                                                                try {
-                                                                       var url = xulG.url_prefix( urls.XUL_BIB_BRIEF ) + '?docid=' + window.escape(docid) 
-                                                                       dump('removing ' + url + '\n');
-                                                                       try { top_pane.remove_iframe( url ); } catch(E) { dump(E + '\n'); }
                                                                        docid = id;
+                                                                       browser_obj = null; editor_obj = null; holdings_obj = null; holds_obj = null;
+                                                                       top_pane.clear(); bottom_pane.clear();
                                                                        set_brief_view();
                                                                        document.getElementById('nav').setAttribute('hidden','false');
                                                                } catch(E) {
                                                );
                                        },
                                        'url_prefix' : xulG.url_prefix,
+                                       'name' : 'Catalog',
                                };
                                if (opac_url) content_params.url = opac_url;
                                if (browser_obj) return;
                                browser_obj = new util.browser();
                                browser_obj.init(
                                        {
-                                               'url' : xulG.url_prefix(urls.XUL_REMOTE_BROWSER) + '?name=Catalog',
+                                               'url' : xulG.url_prefix(urls.XUL_REMOTE_BROWSER), // + '?name=Catalog',
                                                'push_xulG' : true,
                                                'alt_print' : false,
                                                'browser_id' : 'browser',
 
                function remove_me() {
                        try {
-                       var url = xulG.url_prefix( urls.XUL_BIB_BRIEF ) + '?docid=' + window.escape(docid);
-                       dump('removing ' + url + '\n');
-                       try { top_pane.remove_iframe( url ); } catch(E) { dump(E + '\n'); }
-                       document.getElementById('nav').setAttribute('hidden','true');
+                               browser_obj = null; editor_obj = null; holdings_obj = null; holds_obj = null;
+                               top_pane.clear(); bottom_pane.clear();
+                               document.getElementById('nav').setAttribute('hidden','true');
                        } catch(E) {
                                alert(E);
                        }
                }
 
                function add_to_bucket() {
-               try {
-                       JSAN.use('util.window'); var win = new util.window();
-                       win.open(
-                               xulG.url_prefix(urls.XUL_RECORD_BUCKETS)
-                               + '?record_ids=' + js2JSON( [ docid ] ),
-                               'sel_bucket_win' + win.window_name_increment(),
-                               'chrome,resizable,modal,center'
-                       );
-               } catch(E) {
-                       alert(E);
-               }
+                       try {
+                               JSAN.use('util.window'); var win = new util.window();
+                               win.open(
+                                       xulG.url_prefix(urls.XUL_RECORD_BUCKETS),
+                                       //+ '?record_ids=' + js2JSON( [ docid ] ),
+                                       'sel_bucket_win' + win.window_name_increment(),
+                                       'chrome,resizable,modal,center',
+                                       { 'record_ids' : [ docid ] }
+                               );
+                       } catch(E) {
+                               alert(E);
+                       }
                }
 
                function refresh() {
index 491b178..a0f9b14 100644 (file)
@@ -356,7 +356,14 @@ cat.record_buckets.prototype = {
 
                                                                        var robj = obj.network.simple_request('BUCKET_CREATE',[ses(),'biblio',bucket]);
 
-                                                                       if (typeof robj == 'object') throw robj;
+                                                                       if (typeof robj == 'object') {
+                                                                               if (robj.ilsevent == 1710 /* CONTAINER_EXISTS */) {
+                                                                                       alert('You already have a bucket with that name.');
+                                                                                       return;
+                                                                               }
+                                                                               throw robj;
+                                                                       }
+
 
                                                                        alert('Bucket "' + name + '" created.');
 
@@ -493,14 +500,17 @@ cat.record_buckets.prototype = {
                                                                        xml += '<td nowrap="nowrap"><iframe style="min-height: 1000px; min-width: 300px;" flex="1" src="data:text/html,' + window.escape(html) + '"/></td>';
                                                                }
                                                                xml += '</tr></table></form>';
-                                                               obj.data.temp_merge_top = top_xml; obj.data.stash('temp_merge_top');
-                                                               obj.data.temp_merge_mid = xml; obj.data.stash('temp_merge_mid');
+                                                               //obj.data.temp_merge_top = top_xml; obj.data.stash('temp_merge_top');
+                                                               //obj.data.temp_merge_mid = xml; obj.data.stash('temp_merge_mid');
                                                                window.open(
-                                                                       urls.XUL_FANCY_PROMPT
-                                                                       + '?xml_in_stash=temp_merge_mid'
-                                                                       + '&top_xml_in_stash=temp_merge_top'
-                                                                       + '&title=' + window.escape('Record Merging'),
-                                                                       'fancy_prompt', 'chrome,resizable,modal,width=700,height=500'
+                                                                       urls.XUL_FANCY_PROMPT,
+                                                                       //+ '?xml_in_stash=temp_merge_mid'
+                                                                       //+ '&top_xml_in_stash=temp_merge_top'
+                                                                       //+ '&title=' + window.escape('Record Merging'),
+                                                                       'fancy_prompt', 'chrome,resizable,modal,width=700,height=500',
+                                                                       {
+                                                                               'top_xml' : top_xml, 'xml' : xml, 'title' : 'Record Merging'
+                                                                       }
                                                                );
                                                                obj.data.stash_retrieve();
                                                                if (obj.data.fancy_prompt_data == '') { alert('Merge Aborted'); return; }
index 1d4658f..bfcac3c 100644 (file)
                                g.error.sdump('D_TRACE','my_init() for record_buckets.xul');
                                JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.init({'via':'stash'});
 
-                               g.cgi = new CGI();
-                               var record_ids = [];
-                               if (g.cgi.param('record_ids')) record_ids = record_ids.concat( JSON2js( g.cgi.param('record_ids') ) );
-                               if (typeof window.xuLG == 'object' && typeof window.xulG.record_ids != 'undefined')
-                                       record_ids = record_ids.concat( window.xulG.record_ids );
-                               if (typeof g.data.rb_temp_record_ids != 'undefined' && g.data.rb_temp_record_ids != null) {
-                                       record_ids = record_ids.concat( JSON2js( g.data.rb_temp_record_ids ) );
-                                       g.data.rb_temp_record_ids = undefined; g.data.stash('rb_temp_record_ids');
-                               }
-
+                               var record_ids = xul_param(
+                                       'record_ids',{
+                                               'concat' : true,
+                                               'JSON2js_if_cgi' : true,
+                                               'JSON2js_if_xpcom' : true,
+                                               'stash_name':'rb_temp_record_ids',
+                                               'clear_xpcom' : true,
+                                       }
+                               );
 
                                JSAN.use('cat.record_buckets'); g.record_buckets = new cat.record_buckets();
                                g.record_buckets.init( 
index 3e01a45..bd7d031 100644 (file)
                                JSAN.use('util.network'); g.network = new util.network();
                                JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.init({'via':'stash'});
 
-                               g.cgi = new CGI();
-                               g.record_ids = [];
-                               if (g.cgi.param('record_ids')) g.record_ids = g.record_ids.concat( JSON2js( g.cgi.param('record_ids') ) );
-                               if (typeof window.xuLG == 'object' && typeof window.xulG.record_ids != 'undefined')
-                                       g.record_ids = g.record_ids.concat( window.xulG.record_ids );
-                               if (typeof g.data.rb_temp_record_ids != 'undefined' && g.data.rb_temp_record_ids != null) {
-                                       g.record_ids = g.record_ids.concat( JSON2js( g.data.rb_temp_record_ids ) );
-                                       g.data.rb_temp_record_ids = undefined; g.data.stash('rb_temp_record_ids');
-                               }
+                               g.record_ids = xul_param(
+                                       'record_ids',{
+                                               'concat' : true,
+                                               'JSON2js_if_cgi' : true,
+                                               'JSON2js_if_xpcom' : true,
+                                               'stash_name':'rb_temp_record_ids',
+                                               'clear_xpcom' : true,
+                                       }
+                               );
 
                                $('desc').appendChild( document.createTextNode( 
                                        (g.record_ids.length == 1 ?
index 5346e92..45ae03e 100644 (file)
                                        }
                                        html += '</body></html>';
                                        JSAN.use('util.window'); var win = new util.window();
-                                       var loc = ( urls.XUL_REMOTE_BROWSER ) + '?url=' + window.escape('about:blank') + '&show_print_button=1&alternate_print=1&no_xulG=1&title=' + window.escape('Spine Labels');
+                                       var loc = ( urls.XUL_REMOTE_BROWSER );
+                                       //+ '?url=' + window.escape('about:blank') + '&show_print_button=1&alternate_print=1&no_xulG=1&title=' + window.escape('Spine Labels');
                                        var w = win.open( loc, 'spine_preview', 'chrome,resizable,width=750,height=550');
-                                       w.xulG = { 'on_url_load' : function(b) { 
-                                               try { 
-                                                       netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
-                                                       if (typeof w.xulG.written == 'undefined') {
-                                                               w.xulG.written = true;
-                                                               w.g.browser.get_content().document.write(html);
-                                                               w.g.browser.get_content().document.close();
+                                       w.xulG = { 
+                                               'url' : 'about:blank',
+                                               'show_print_button' : 1,
+                                               'alternate_print' : 1,
+                                               'no_xulG' : 1,
+                                               'title' : 'Spine Labels',
+                                               'on_url_load' : function(b) { 
+                                                       try { 
+                                                               netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
+                                                               if (typeof w.xulG.written == 'undefined') {
+                                                                       w.xulG.written = true;
+                                                                       w.g.browser.get_content().document.write(html);
+                                                                       w.g.browser.get_content().document.close();
+                                                               }
+                                                       } catch(E) {
+                                                               alert(E);
                                                        }
-                                               } catch(E) {
-                                                       alert(E);
-                                               }
-                                       } };
+                                               },
+                                       };
                        } catch(E) {
                                g.error.standard_unexpected_error_alert('Preview and Print',E);
                        }
index bceb1ed..627e232 100644 (file)
@@ -71,15 +71,16 @@ cat.util.transfer_copies = function(params) {
                xml += '<button label="Cancel" accesskey="C" name="fancy_cancel"/></hbox>';
                xml += '<iframe style="overflow: scroll" flex="1" src="' + urls.XUL_BIB_BRIEF + '?docid=' + params.docid + '"/>';
                xml += '</vbox>';
-               data.temp_transfer = xml; data.stash('temp_transfer');
-               window.open(
-                       urls.XUL_FANCY_PROMPT
-                       + '?xml_in_stash=temp_transfer'
-                       + '&title=' + window.escape('Item Transfer'),
-                       'fancy_prompt', 'chrome,resizable,modal,width=500,height=300'
+               //data.temp_transfer = xml; data.stash('temp_transfer');
+               JSAN.use('util.window'); var win = new util.window();
+               var fancy_prompt_data = win.open(
+                       urls.XUL_FANCY_PROMPT,
+                       //+ '?xml_in_stash=temp_transfer'
+                       //+ '&title=' + window.escape('Item Transfer'),
+                       'fancy_prompt', 'chrome,resizable,modal,width=500,height=300',
+                       { 'xml' : xml, 'title' : 'Item Transfer' }
                );
-               data.stash_retrieve();
-               if (data.fancy_prompt_data == '') { alert('Transfer Aborted'); return; }
+               if (fancy_prompt_data.fancy_status == 'incomplete') { alert('Transfer Aborted'); return; }
 
                JSAN.use('util.functional');
 
@@ -190,7 +191,6 @@ cat.util.add_copies_to_bucket = function(selection_list) {
 cat.util.spawn_copy_editor = function(list,edit) {
        try {
                var obj = {};
-               JSAN.use('OpenILS.data'); obj.data = new OpenILS.data(); obj.data.init({'via':'stash'});
                JSAN.use('util.network'); obj.network = new util.network();
                JSAN.use('util.error'); obj.error = new util.error();
        
@@ -201,22 +201,26 @@ cat.util.spawn_copy_editor = function(list,edit) {
                title += ' Copy Attributes';
        
                JSAN.use('util.window'); var win = new util.window();
-               obj.data.temp_copies = undefined; obj.data.stash('temp_copies');
-               obj.data.temp_callnumbers = undefined; obj.data.stash('temp_callnumbers');
-               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)
-                               +'?handle_update=1&edit='+edit,
+               //JSAN.use('OpenILS.data'); obj.data = new OpenILS.data(); obj.data.init({'via':'stash'});
+               //obj.data.temp_copies = undefined; obj.data.stash('temp_copies');
+               //obj.data.temp_callnumbers = undefined; obj.data.stash('temp_callnumbers');
+               //obj.data.temp_copy_ids = js2JSON(list); obj.data.stash('temp_copy_ids');
+               var my_xulG = win.open(
+                       //window.xulG.url_prefix(urls.XUL_COPY_EDITOR),
+                       (urls.XUL_COPY_EDITOR),
+                       //      +'?handle_update=1&edit='+edit,
                        title,
-                       'chrome,modal,resizable'
+                       'chrome,modal,resizable',
+                       {
+                               'handle_update' : 1,
+                               'edit' : edit,
+                               'copy_ids' : js2JSON(list),
+                       }
                );
-               /* FIXME -- need to unique the temp space, and not rely on modalness of window */
-               obj.data.stash_retrieve();
-               if (!obj.data.temp_copies) alert('Copies not modified.');
-               obj.data.temp_copies = undefined; obj.data.stash('temp_copies');
-               obj.data.temp_callnumbers = undefined; obj.data.stash('temp_callnumbers');
-               obj.data.temp_copy_ids = undefined; obj.data.stash('temp_copy_ids');
+               //obj.data.stash_retrieve();
+               if (!my_xulG.copies) alert('Copies not modified.');
+               //if (!obj.data.temp_copies) alert('Copies not modified.');
+               //obj.data.temp_copies = undefined; obj.data.stash('temp_copies');
        } catch(E) {
                JSAN.use('util.error'); var error = new util.error();
                error.standard_unexpected_error_alert('error in cat.util.spawn_copy_editor',E);
index 3118216..fb8c3ff 100644 (file)
@@ -16,24 +16,17 @@ function my_init() {
 
                JSAN.use('util.network'); g.network = new util.network();
 
-               g.cgi = new CGI();
-
                /***********************************************************************************************************/
                /* What record am I dealing with?  Am I adding just copies or copies and volumes? */
 
-               g.doc_id = g.cgi.param('doc_id');
-               document.getElementById('summary').setAttribute('src',urls.XUL_BIB_BRIEF + '?docid=' + window.escape(g.doc_id));
+               g.doc_id = xul_param('doc_id');
+               document.getElementById('summary').setAttribute('src',urls.XUL_BIB_BRIEF); // + '?docid=' + window.escape(g.doc_id));
+               document.getElementById('summary').contentWindow.xulG = { 'docid' : g.doc_id };
 
-               g.copy_shortcut = g.cgi.param('copy_shortcut');
-               g.error.sdump('D_ERROR','location.href = ' + location.href + '\n\ncopy_short cut = ' + g.copy_shortcut + '\n\nou_ids = ' + g.cgi.param('ou_ids'));
-               if (g.copy_shortcut) g.copy_shortcut = JSON2js( g.copy_shortcut );
+               g.copy_shortcut = xul_param('copy_shortcut',{'JSON2js_if_cgi':true});
+               g.error.sdump('D_ERROR','location.href = ' + location.href + '\n\ncopy_short cut = ' + g.copy_shortcut + '\n\nou_ids = ' + xul_param('ou_ids'));
 
-               var ou_ids = [];
-               if (g.cgi.param('ou_ids')) 
-                       ou_ids = JSON2js( g.cgi.param('ou_ids') );
-               if (!ou_ids) ou_ids = [];
-               if (window.xulG && window.xulG.ou_ids) 
-                       ou_ids = ou_ids.concat( window.xulG.ou_ids );
+               var ou_ids = xul_param('ou_ids',{'JSON2js_if_cgi' : true, 'concat' : true});;
 
                /***********************************************************************************************************/
                /* For the call number drop down */
@@ -381,22 +374,24 @@ 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_copy_ids = undefined; g.data.stash('temp_copy_ids');
-                       //g.data.temp_callnumbers = js2JSON(volume_labels); g.data.stash('temp_callnumbers');
-                       g.data.temp_callnumbers = undefined; g.data.stash('temp_callnumbers');
-                       var w = win.open(
-                               urls.XUL_COPY_EDITOR
-                                       +'?edit=1&handle_update=1&docid='+window.escape(g.doc_id),
+                       //g.data.temp_copies = js2JSON(copies); g.data.stash('temp_copies');
+                       //g.data.temp_copy_ids = undefined; g.data.stash('temp_copy_ids');
+                       ////g.data.temp_callnumbers = js2JSON(volume_labels); g.data.stash('temp_callnumbers');
+                       //g.data.temp_callnumbers = undefined; g.data.stash('temp_callnumbers');
+                       var my_xulG = win.open(
+                               urls.XUL_COPY_EDITOR,
+                                       //+'?edit=1&handle_update=1&docid='+window.escape(g.doc_id),
                                title,
-                               'chrome,modal,resizable'
+                               'chrome,modal,resizable',
+                               { 'edit' : 1, 'handle_update' : 1, 'docid' : g.doc_id, 'copies' : copies }
                        );
                        /* FIXME -- need to unique the temp space, and not rely on modalness of window */
-                       g.data.stash_retrieve();
-                       copies = JSON2js( g.data.temp_copies );
-                       g.data.temp_copy_ids = undefined; g.data.stash('temp_copy_ids');
-                       g.data.temp_copies = undefined; g.data.stash('temp_copies');
-                       g.data.temp_callnumbers = undefined; g.data.stash('temp_callnumbers');
+                       //g.data.stash_retrieve();
+                       //copies = JSON2js( g.data.temp_copies );
+                       copies = my_xulG.copies;
+                       //g.data.temp_copy_ids = undefined; g.data.stash('temp_copy_ids');
+                       //g.data.temp_copies = undefined; g.data.stash('temp_copies');
+                       //g.data.temp_callnumbers = undefined; g.data.stash('temp_callnumbers');
                        if (!copies) {
                                alert('Items were not created.');
                                return;
index 6db09c0..ac6f315 100644 (file)
@@ -34,6 +34,8 @@
        <script>
        <![CDATA[
 
+               var xulG = {};
+
                function my_init() {
                        try {
                                netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
 
                                JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.init({'via':'stash'});
 
-                               g.cgi = new CGI();
-
                                JSAN.use('util.network'); g.network = new util.network();
 
                                JSAN.use('util.functional');
 
-                               g.volumes = JSON2js( g.data.volumes_temp );
-                               g.data.volumes_temp = ''; g.data.stash('volumes_temp');
+                               g.volumes = xul_param('volumes',{'stash_name':'volumes_temp','clear_xpcom':true,'modal_xulG':true}); //JSON2js( g.data.volumes_temp );
+                               //g.data.volumes_temp = ''; g.data.stash('volumes_temp');
 
                                var rows = document.getElementById('rows');
 
@@ -70,7 +70,7 @@
                                        }
 
                                        tb.setAttribute('value',g.volumes[i].label());
-                                       tb.setAttribute('onchange','var v = g.volumes['+i+']; v.ischanged("1"); v.label( this.value );');
+                                       tb.setAttribute('onchange','try { var v = g.volumes['+i+']; v.ischanged("1"); v.label( this.value ); } catch(E) { alert(E); }');
                                }
 
                        } catch(E) {
                }
 
                g.stash_and_close = function() {
-                       g.data.volumes_temp = js2JSON( g.volumes );
-                       g.error.sdump('D_CAT','in modal window, g.data.volumes_temp = \n' + g.data.volumes_temp + '\n');
-                       g.data.stash('volumes_temp');
-                       window.close();
+                       try {
+                               //g.data.volumes_temp = js2JSON( g.volumes );
+                               //g.error.sdump('D_CAT','in modal window, g.data.volumes_temp = \n' + g.data.volumes_temp + '\n');
+                               //g.data.stash('volumes_temp');
+                               xulG.volumes = g.volumes;
+                               update_modal_xulG(xulG);
+                               window.close();
+                       } catch(E) {
+                               alert('FIXME: volume editor -> ' + E);
+                       }
                }
 
        ]]>
index 3dfa820..efa4f3d 100644 (file)
@@ -560,7 +560,7 @@ cat.z3950.prototype = {
        },
 
        'confirm_overlay' : function(record_ids) {
-               var obj = this; JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
+               var obj = this; // JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
                netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect UniversalBrowserWrite');
                var top_xml = '<vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" flex="1" >';
                top_xml += '<description>Overlay this record?</description>';
@@ -578,17 +578,19 @@ cat.z3950.prototype = {
                        xml += '<td nowrap="nowrap"><iframe style="min-height: 1000px; min-width: 300px;" flex="1" src="data:text/html,' + window.escape(html) + '"/></td>';
                }
                xml += '</tr></table></form>';
-               data.temp_merge_top = top_xml; data.stash('temp_merge_top');
-               data.temp_merge_mid = xml; data.stash('temp_merge_mid');
-               window.open(
-                       urls.XUL_FANCY_PROMPT
-                       + '?xml_in_stash=temp_merge_mid'
-                       + '&top_xml_in_stash=temp_merge_top'
-                       + '&title=' + window.escape('Record Overlay'),
-                       'fancy_prompt', 'chrome,resizable,modal,width=700,height=500'
+               // data.temp_merge_top = top_xml; data.stash('temp_merge_top');
+               // data.temp_merge_mid = xml; data.stash('temp_merge_mid');
+               JSAN.use('util.window'); var win = new util.window();
+               var fancy_prompt_data = win.open(
+                       urls.XUL_FANCY_PROMPT,
+                       // + '?xml_in_stash=temp_merge_mid'
+                       // + '&top_xml_in_stash=temp_merge_top'
+                       // + '&title=' + window.escape('Record Overlay'),
+                       'fancy_prompt', 'chrome,resizable,modal,width=700,height=500',
+                       { 'top_xml' : top_xml, 'xml' : xml, 'title' : 'Record Overlay' }
                );
-               data.stash_retrieve();
-               if (data.fancy_prompt_data == '') { alert('Overlay Aborted'); return false; }
+               //data.stash_retrieve();
+               if (fancy_prompt_data.fancy_status == 'incomplete') { alert('Overlay Aborted'); return false; }
                return true;
        },
 
index 3aefdfb..63abbc2 100644 (file)
@@ -43,8 +43,6 @@
                                JSAN.use('util.error'); g.error = new util.error();
                                g.error.sdump('D_TRACE','my_init() for cat_z3950.xul');
 
-                               g.cgi = new CGI();
-
                                JSAN.use('cat.z3950'); g.z3950 = new cat.z3950();
 
                                g.z3950.init( 
index 77ca067..1f34f5c 100644 (file)
@@ -41,8 +41,8 @@
                                JSAN.use('util.error'); g.error = new util.error();
                                g.error.sdump('D_TRACE','my_init() for checkin.xul');
 
-                               g.cgi = new CGI(); var tab_name;
-                               if (g.cgi.param('hold_capture') == 1) {
+                               var tab_name;
+                               if (xul_param('hold_capture')) {
                                        document.getElementById('checkin_auto').checked = true;
                                        document.getElementById('checkin_auto').hidden = true;
                                        document.getElementById('checkin_effective_date_hbox').hidden = true;
index 1291a8e..3f5c76a 100644 (file)
@@ -41,9 +41,7 @@
                                JSAN.use('util.error'); g.error = new util.error();
                                g.error.sdump('D_TRACE','my_init() for checkout.xul');
 
-                               g.cgi = new CGI();
-
-                               var patron_id = g.cgi.param('patron_id') || xulG.patron_id;
+                               var patron_id = xul_param('patron_id');
 
                                JSAN.use('circ.checkout'); g.checkout = new circ.checkout();
                                g.checkout.init( 
index b084bce..55fe393 100644 (file)
                                JSAN.use('util.error'); g.error = new util.error();
                                g.error.sdump('D_TRACE','my_init() for circ_circ_brief.xul');
 
-                               g.cgi = new CGI();
-                               g.circ_id = g.cgi.param('circ_id');
+                               g.circ_id = xul_param('circ_id');
 
-                               if (g.cgi.param('caption')) $('caption').setAttribute('label',g.cgi.param('caption'));
-                               if (g.cgi.param('no_border')) $('gb').setAttribute('style','border: none');
+                               var caption = xul_param('caption'); if (caption) $('caption').setAttribute('label',caption);
+                               if (xul_param('no_border')) $('gb').setAttribute('style','border: none');
 
                                JSAN.use('util.network'); g.network = new util.network();
                                JSAN.use('util.date');
                        JSAN.use('util.window');
                        var win = new util.window();
                        var w = win.open(
-                               urls.XUL_PATRON_BILL_WIZARD
-                                       + '?patron_id=' + window.escape(g.patron_id)
-                                       + '&xact_id=' + window.escape( g.circ_id ),
+                               urls.XUL_PATRON_BILL_WIZARD,
+                                       //+ '?patron_id=' + window.escape(g.patron_id)
+                                       //+ '&xact_id=' + window.escape( g.circ_id ),
                                'billwizard',
-                               'chrome,resizable,modal'
+                               'chrome,resizable,modal',
+                               { 'patron_id' : g.patron_id, 'xact_id' : g.circ_id }
                        );
                }
 
index 955816c..00abb79 100644 (file)
@@ -37,6 +37,8 @@
        <![CDATA[
                function $(id) { return document.getElementById(id); }
 
+               var xulG = {};
+
                function my_init() {
                        try {
                                netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
@@ -46,9 +48,8 @@
                                JSAN.use('util.error'); g.error = new util.error();
                                g.error.sdump('D_TRACE','my_init() for circ_circ_brief.xul');
 
-                               g.cgi = new CGI();
-                               g.copy_id = g.cgi.param('copy_id');
-                               g.count = g.cgi.param('count');
+                               g.copy_id = xul_param('copy_id',{'modal_xulG':true});
+                               g.count = xul_param('count',{'modal_xulG':true});
 
                                JSAN.use('util.network'); g.network = new util.network();
                                JSAN.use('util.date');
                                g.callnumber = g.network.simple_request('FM_ACN_RETRIEVE',[ g.copy.call_number() ]);
                                if (typeof g.callnumber.ilsevent != 'undefined') throw(g.callnumber);
 
-                               $('top').setAttribute('src',urls.XUL_BIB_BRIEF + '?docid=' + g.callnumber.record());
-                               $('mid').setAttribute('src',urls.XUL_COPY_SUMMARY + '?copy_id=' + g.copy.id());
+                               $('top').setAttribute('src',urls.XUL_BIB_BRIEF);// + '?docid=' + g.callnumber.record());
+                               $('top').contentWindow.xulG = { 'docid' : g.callnumber.record() };
+                               $('mid').setAttribute('src',urls.XUL_COPY_SUMMARY); // + '?copy_id=' + g.copy.id());
+                               $('mid').contentWindow.xulG = { 'copy_id' : g.copy.id() };
 
                                show_circs();
 
@@ -85,7 +88,8 @@
                                        iframe.setAttribute('style','overflow: none; min-height: 100px;');
                                        iframe.setAttribute('flex','1');
                                        gb.appendChild(iframe);
-                                       iframe.setAttribute('src', urls.XUL_CIRC_BRIEF + '?circ_id=' + g.circs[j].id() );
+                                       iframe.setAttribute('src', urls.XUL_CIRC_BRIEF); // + '?circ_id=' + g.circs[j].id() );
+                                       iframe.contentWindow.xulG = { 'circ_id' : g.circs[j].id() };
                                }
                        } catch(E) {
                                g.error.standard_unexpected_error_alert('error showing circs',E);
                }
 
                function retrieve_last() {
-                       g.data.fancy_prompt_data = js2JSON( [ g.circs[0].usr() ] );
-                       g.data.stash('fancy_prompt_data');
-                       window.close();
+                       try {
+                               //g.data.fancy_prompt_data = js2JSON( [ g.circs[0].usr() ] );
+                               //g.data.stash('fancy_prompt_data');
+                               xulG.retrieve_these_patrons = [ g.circs[0].usr() ];
+                               update_modal_xulG(xulG);
+                               window.close();
+                       } catch(E) {
+                               g.error.standard_unexpected_error_alert('retrieve_last',E);
+                       }
                }
 
                function retrieve_all() {
-                       var patrons = []; var p_hash = {};
-                       for (var i = 0; i < g.circs.length; i++) {
-                               var usr = g.circs[i].usr();
-                               if (typeof p_hash[usr] != 'undefined') { continue; }
-                               p_hash[usr] = true;
-                               patrons.push( function(a){return a;}(usr) );
+                       try {
+                               var patrons = []; var p_hash = {};
+                               for (var i = 0; i < g.circs.length; i++) {
+                                       var usr = g.circs[i].usr();
+                                       if (typeof p_hash[usr] != 'undefined') { continue; }
+                                       p_hash[usr] = true;
+                                       patrons.push( function(a){return a;}(usr) );
+                               }
+                               //g.data.fancy_prompt_data = js2JSON(patrons);
+                               //g.data.stash('fancy_prompt_data');
+                               xulG.retrieve_these_patrons = patrons;
+                               update_modal_xulG(xulG);
+                               window.close();
+                       } catch(E) {
+                               g.error.standard_unexpected_error_alert('retrieve_all',E);
                        }
-                       g.data.fancy_prompt_data = js2JSON(patrons);
-                       g.data.stash('fancy_prompt_data');
-                       window.close();
                }
 
        ]]>
index 3bb79a2..7a1d876 100644 (file)
@@ -37,6 +37,8 @@
        <![CDATA[
                function $(id) { return document.getElementById(id); }
 
+               var xulG = {};
+
                function my_init() {
                        try {
                                netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
@@ -46,8 +48,7 @@
                                JSAN.use('util.error'); g.error = new util.error();
                                g.error.sdump('D_TRACE','my_init() for circ_copy_details.xul');
 
-                               g.cgi = new CGI();
-                               g.copy_id = g.cgi.param('copy_id');
+                               g.copy_id = xul_param('copy_id',{'modal_xulG':true});
 
                                JSAN.use('util.network'); g.network = new util.network();
                                JSAN.use('util.date');
                                //g.callnumber = g.network.simple_request('FM_ACN_RETRIEVE',[ g.copy.call_number() ]);
                                //if (typeof g.callnumber.ilsevent != 'undefined') throw(g.callnumber);
 
-                               $('top').setAttribute('src',urls.XUL_BIB_BRIEF + '?docid=' + g.callnumber.record());
-                               g.data.temp_copy = g.copy; g.data.stash('temp_copy'); 
-                               g.data.temp_callnumber = g.callnumber; g.data.stash('temp_callnumber'); 
+                               $('top').setAttribute('src',urls.XUL_BIB_BRIEF); // + '?docid=' + g.callnumber.record());
+                               $('top').contentWindow.xulG = { 'docid' : g.callnumber.record() };
+                               //g.data.temp_copy = g.copy; g.data.stash('temp_copy'); 
+                               //g.data.temp_callnumber = g.callnumber; g.data.stash('temp_callnumber'); 
                                $('item_summary').setAttribute('src',urls.XUL_COPY_SUMMARY);
+                               $('item_summary').contentWindow.xulG = { 'copy' : g.copy, 'callnumber' : g.callnumber };
 
                                $('r_last').disabled = true;
                                if (g.circ) {
                                        $('r_last').disabled = false;
                                        g.data.temp_circ = g.circ; g.data.stash('temp_circ');
-                                       $('circ').setAttribute('src',urls.XUL_CIRC_BRIEF + '?no_border=1');
+                                       $('circ').setAttribute('src',urls.XUL_CIRC_BRIEF); // + '?no_border=1');
+                                       $('circ').contentWindow.xulG = { 'no_border' : 1 };
                                        if (g.circ.checkin_time()) {
                                                $('circ_caption').setAttribute('label','Last Circulation');
                                        } else {
 
                function retrieve_last_patron() {
                        try {
-                               g.data.fancy_prompt_data = js2JSON( [ g.circ.usr() ] );
-                               g.data.stash('fancy_prompt_data');
+                               //g.data.fancy_prompt_data = js2JSON( [ g.circ.usr() ] );
+                               //g.data.stash('fancy_prompt_data');
+                               xulG.retrieve_these_patrons = [ g.circ.user() ];
+                               update_modal_xulG(xulG);
                                window.close();
                        } catch(E) {
                                alert(E);
 
                function retrieve_hold_patron() {
                        try {
-                               g.data.fancy_prompt_data = js2JSON( [ g.hold.usr() ] );
-                               g.data.stash('fancy_prompt_data');
+                               //g.data.fancy_prompt_data = js2JSON( [ g.hold.usr() ] );
+                               //g.data.stash('fancy_prompt_data');
+                               xulG.retrieve_these_patrons = [ g.hold.user() ];
+                               update_modal_xulG(xulG);
                                window.close();
                        } catch(E) {
                                alert(E);
index 0cc79cf..d4604c1 100644 (file)
@@ -8,6 +8,7 @@ circ.copy_status = function (params) {
        JSAN.use('util.barcode');
        JSAN.use('util.date');
        JSAN.use('OpenILS.data'); this.data = new OpenILS.data(); this.data.init({'via':'stash'});
+       JSAN.use('util.sound'); this.sound = new util.sound();
 }
 
 circ.copy_status.prototype = {
@@ -412,12 +413,13 @@ circ.copy_status.prototype = {
        
                                                                        JSAN.use('util.window'); var win = new util.window();
                                                                        var w = win.open(
-                                                                               window.xulG.url_prefix(urls.XUL_VOLUME_COPY_CREATOR)
-                                                                                       +'?doc_id=' + window.escape(r)
-                                                                                       +'&ou_ids=' + window.escape( js2JSON(list) )
-                                                                                       +'&copy_shortcut=' + window.escape( js2JSON(copy_shortcut[r]) ),
+                                                                               window.xulG.url_prefix(urls.XUL_VOLUME_COPY_CREATOR),
+                                                                                       //+'?doc_id=' + window.escape(r)
+                                                                                       //+'&ou_ids=' + window.escape( js2JSON(list) )
+                                                                                       //+'&copy_shortcut=' + window.escape( js2JSON(copy_shortcut[r]) ),
                                                                                title,
-                                                                               'chrome,resizable'
+                                                                               'chrome,resizable',
+                                                                               { 'doc_id' : r, 'ou_ids' : list, 'copy_shortcut' : copy_shortcut[r] }
                                                                        );
                                                                }
 
@@ -562,11 +564,12 @@ circ.copy_status.prototype = {
 
                                                                        JSAN.use('util.window'); var win = new util.window();
                                                                        var w = win.open(
-                                                                               window.xulG.url_prefix(urls.XUL_VOLUME_COPY_CREATOR)
-                                                                                       +'?doc_id=' + window.escape(r)
-                                                                                       +'&ou_ids=' + window.escape( js2JSON(list) ),
+                                                                               window.xulG.url_prefix(urls.XUL_VOLUME_COPY_CREATOR),
+                                                                                       //+'?doc_id=' + window.escape(r)
+                                                                                       //+'&ou_ids=' + window.escape( js2JSON(list) ),
                                                                                title,
-                                                                               'chrome,resizable'
+                                                                               'chrome,resizable',
+                                                                               { 'doc_id' : r, 'ou_ids' : list }
                                                                        );
 
                                                                }
@@ -632,19 +635,20 @@ circ.copy_status.prototype = {
                                                                        var title = (list.length == 1 ? 'Volume' : 'Volumes') + ' for record # ' + rec;
 
                                                                        JSAN.use('util.window'); var win = new util.window();
-                                                                       obj.data.volumes_temp = js2JSON( list );
-                                                                       obj.data.stash('volumes_temp');
-                                                                       var w = win.open(
+                                                                       //obj.data.volumes_temp = js2JSON( list );
+                                                                       //obj.data.stash('volumes_temp');
+                                                                       var my_xulG = win.open(
                                                                                window.xulG.url_prefix(urls.XUL_VOLUME_EDITOR),
                                                                                title,
-                                                                               'chrome,modal,resizable'
+                                                                               'chrome,modal,resizable',
+                                                                               { 'volumes' : list }
                                                                        );
 
                                                                        /* FIXME -- need to unique the temp space, and not rely on modalness of window */
-                                                                       obj.data.stash_retrieve();
-                                                                       var volumes = JSON2js( obj.data.volumes_temp );
-                                                                       obj.error.sdump('D_CAT','in browse, obj.data.temp =\n' + obj.data.temp);
-                                                                       if (volumes=='') return;
+                                                                       //obj.data.stash_retrieve();
+                                                                       //var volumes = JSON2js( obj.data.volumes_temp );
+                                                                       var volumes = my_xulG.volumes;
+                                                                       if (!volumes) return;
                                                                
                                                                        volumes = util.functional.filter_list(
                                                                                volumes,
@@ -821,17 +825,18 @@ circ.copy_status.prototype = {
                                                                        xml += '<iframe style="overflow: scroll" flex="1" src="' + urls.XUL_BIB_BRIEF + '?docid=' + obj.data.marked_library.docid + '"/>';
                                                                        xml += '</vbox>';
                                                                        JSAN.use('OpenILS.data');
-                                                                       var data = new OpenILS.data(); data.init({'via':'stash'});
-                                                                       data.temp_transfer = xml; data.stash('temp_transfer');
-                                                                       window.open(
-                                                                               urls.XUL_FANCY_PROMPT
-                                                                               + '?xml_in_stash=temp_transfer'
-                                                                               + '&title=' + window.escape('Volume Transfer'),
-                                                                               'fancy_prompt', 'chrome,resizable,modal,width=500,height=300'
+                                                                       //var data = new OpenILS.data(); data.init({'via':'stash'});
+                                                                       //data.temp_transfer = xml; data.stash('temp_transfer');
+                                                                       JSAN.use('util.window'); var win = new util.window();
+                                                                       var fancy_prompt_data = win.open(
+                                                                               urls.XUL_FANCY_PROMPT,
+                                                                               //+ '?xml_in_stash=temp_transfer'
+                                                                               //+ '&title=' + window.escape('Volume Transfer'),
+                                                                               'fancy_prompt', 'chrome,resizable,modal,width=500,height=300',
+                                                                               { 'xml' : xml, 'title' : 'Volume Transfer' }
                                                                        );
                                                                
-                                                                       data.init({'via':'stash'});
-                                                                       if (data.fancy_prompt_data == '') { alert('Transfer Aborted'); return; }
+                                                                       if (fancy_prompt_data.fancy_status == 'incomplete') { alert('Transfer Aborted'); return; }
 
                                                                        var robj = obj.network.simple_request(
                                                                                'FM_ACN_TRANSFER', 
@@ -904,7 +909,7 @@ circ.copy_status.prototype = {
                                if ( obj.test_barcode(barcode) ) { /* good */ } else { /* bad */ return; }
                        }
                        JSAN.use('circ.util');
-                       obj.network.simple_request('FM_ACP_DETAILS_VIA_BARCODE', [ ses(), barcode ], function(req) {
+                       function handle_req(req) {
                                try {
                                        var details = req.getResultObject();
                                        if (details == null) {
@@ -966,7 +971,9 @@ circ.copy_status.prototype = {
                                } catch(E) {
                                        obj.error.standard_unexpected_error_alert('',E);
                                }
-                       } );
+                       }
+                       var result = obj.network.simple_request('FM_ACP_DETAILS_VIA_BARCODE', [ ses(), barcode ]);
+                       handle_req({'getResultObject':function(){return result;}}); // used to be async
                        obj.controller.view.copy_status_barcode_entry_textbox.value = '';
                        obj.controller.view.copy_status_barcode_entry_textbox.focus();
                        
index c012f87..ca2ec27 100644 (file)
@@ -41,8 +41,6 @@
                                JSAN.use('util.error'); g.error = new util.error();
                                g.error.sdump('D_TRACE','my_init() for copy_status.xul');
 
-                               g.cgi = new CGI();
-
                                JSAN.use('circ.copy_status'); g.copy_status = new circ.copy_status();
                                g.copy_status.init( 
                                        { 
                                        try { window.xulG.set_tab_name('Item Status'); } catch(E) { alert(E); }
                                }
 
-                               g.barcodes = [];
-                               if (g.cgi.param('barcodes')) {
-                                       g.barcodes = g.barcodes.concat( JSON2js(g.cgi.param('barcodes')) );
-                               }
                                JSAN.use('OpenILS.data'); g.data = new OpenILS.data(); g.data.stash_retrieve();
-                               if (g.data.temp_barcodes_for_copy_status) {
-                                       g.barcodes = g.barcodes.concat( g.data.temp_barcodes_for_copy_status );
-                                       g.data.temp_barcodes_for_copy_status = null; g.data.stash('temp_barcodes_for_copy_status');
-                               }
 
+                               g.barcodes = xul_param(
+                                       'barcodes',{
+                                               'concat' : true,
+                                               'JSON2js_if_cgi' : true,
+                                               'stash_name':'temp_barcodes_for_copy_status',
+                                               'clear_xpcom' : true,
+                                       }
+                               ) || [];
+                               
                                if (g.barcodes.length > 0) {
                                        JSAN.use('util.exec'); var exec = new util.exec();
                                        var funcs = [];
index 4e7830f..55f7cad 100644 (file)
@@ -41,8 +41,6 @@
                                JSAN.use('util.error'); g.error = new util.error();
                                g.error.sdump('D_TRACE','my_init() for hold_capture.xul');
 
-                               g.cgi = new CGI();
-
                                JSAN.use('circ.hold_capture'); g.hold_capture = new circ.hold_capture();
                                g.hold_capture.init( 
                                        { 
index b6907dc..db11262 100644 (file)
@@ -40,8 +40,6 @@
                                JSAN.use('util.error'); g.error = new util.error();
                                g.error.sdump('D_TRACE','my_init() for in_house_use.xul');
 
-                               g.cgi = new CGI();
-
                                JSAN.use('circ.in_house_use'); g.in_house_use = new circ.in_house_use();
                                g.in_house_use.init( 
                                        { 
index a2b4eb9..36d2a34 100644 (file)
@@ -41,8 +41,6 @@
                                JSAN.use('util.error'); g.error = new util.error();
                                g.error.sdump('D_TRACE','my_init() for print_list.xul');
 
-                               g.cgi = new CGI();
-
                                JSAN.use('circ.print_list_template_editor');
                                g.editor = new circ.print_list_template_editor();
 
index f8e8047..23927e3 100644 (file)
@@ -55,18 +55,16 @@ circ.util.show_copy_details = function(copy_id) {
        if (typeof copy_id == 'object' && copy_id != null) copy_id = copy_id.id();
 
        try {
-               obj.data.fancy_prompt_data = null; obj.data.stash('fancy_prompt_data');
-               var url = xulG.url_prefix( urls.XUL_COPY_DETAILS ) + '?copy_id=' + copy_id;
-               obj.win.open( url, 'show_copy_details', 'chrome,resizable,modal' );
-               obj.data.stash_retrieve();
+               var url = xulG.url_prefix( urls.XUL_COPY_DETAILS ); // + '?copy_id=' + copy_id;
+               var my_xulG = obj.win.open( url, 'show_copy_details', 'chrome,resizable,modal', { 'copy_id' : copy_id } );
 
-               if (! obj.data.fancy_prompt_data) return;
-               var patrons = JSON2js( obj.data.fancy_prompt_data );
+               if (typeof my_xulG.retrieve_these_patrons == 'undefined') return;
+               var patrons = my_xulG.retrieve_these_patrons;
                for (var j = 0; j < patrons.length; j++) {
                        if (typeof window.xulG == 'object' && typeof window.xulG.new_tab == 'function') {
                                try {
-                                       var url = urls.XUL_PATRON_DISPLAY + '?id=' + window.escape( patrons[j] );
-                                       window.xulG.new_tab( url );
+                                       var url = urls.XUL_PATRON_DISPLAY; // + '?id=' + window.escape( patrons[j] );
+                                       window.xulG.new_tab( url, {}, { 'id' : patrons[j] } );
                                } catch(E) {
                                        obj.error.standard_unexpected_error_alert('Problem retrieving patron.',E);
                                }
@@ -91,18 +89,16 @@ circ.util.show_last_few_circs = function(selection_list,count) {
        for (var i = 0; i < selection_list.length; i++) {
                try {
                        if (typeof selection_list[i].copy_id == 'undefined' || selection_list[i].copy_id == null) continue;
-                       obj.data.fancy_prompt_data = null; obj.data.stash('fancy_prompt_data');
-                       var url = xulG.url_prefix( urls.XUL_CIRC_SUMMARY ) + '?copy_id=' + selection_list[i].copy_id + '&count=' + count;
-                       obj.win.open( url, 'show_last_few_circs', 'chrome,resizable,modal' );
-                       obj.data.stash_retrieve();
+                       var url = xulG.url_prefix( urls.XUL_CIRC_SUMMARY ); // + '?copy_id=' + selection_list[i].copy_id + '&count=' + count;
+                       var my_xulG = obj.win.open( url, 'show_last_few_circs', 'chrome,resizable,modal', { 'copy_id' : selection_list[i].copy_id, 'count' : count } );
 
-                       if (! obj.data.fancy_prompt_data) continue;
-                       var patrons = JSON2js( obj.data.fancy_prompt_data );
+                       if (typeof my_xulG.retrieve_these_patrons == 'undefined') continue;
+                       var patrons = my_xulG.retrieve_these_patrons;
                        for (var j = 0; j < patrons.length; j++) {
                                if (typeof window.xulG == 'object' && typeof window.xulG.new_tab == 'function') {
                                        try {
-                                               var url = urls.XUL_PATRON_DISPLAY + '?id=' + window.escape( patrons[j] );
-                                               window.xulG.new_tab( url );
+                                               var url = urls.XUL_PATRON_DISPLAY; // + '?id=' + window.escape( patrons[j] );
+                                               window.xulG.new_tab( url, {}, { 'id' : patrons[j] } );
                                        } catch(E) {
                                                obj.error.standard_unexpected_error_alert('Problem retrieving patron.',E);
                                        }
@@ -727,6 +723,17 @@ circ.util.hold_columns = function(modify,params) {
 
        var c = [
                {
+                       'persist' : 'hidden width ordinal', 'id' : 'request_lib', 'label' : 'Request Lib (Full Name)', 'flex' : 1,
+                       'primary' : false, 'hidden' : true,  
+                       'render' : function(my) { if (Number(my.ahr.request_lib())>=0) return data.hash.aou[ my.ahr.request_lib() ].name(); else return my.ahr.request_lib().name(); },
+               },
+               {
+                       'persist' : 'hidden width ordinal', 'id' : 'request_lib_shortname', 'label' : 'Request Lib', 'flex' : 0,
+                       'primary' : false, 'hidden' : true,  
+                       'render' : function(my) { if (Number(my.ahr.request_lib())>=0) return data.hash.aou[ my.ahr.request_lib() ].shortname(); else return my.ahr.request_lib().shortname(); },
+               },
+
+               {
                        'persist' : 'hidden width ordinal', 'id' : 'request_timestamp', 'label' : 'Request Timestamp', 'flex' : 0,
                        'primary' : false, 'hidden' : true,  
                        'render' : function(my) { return my.ahr.request_time().toString(); },
index ad2f17c..94b340c 100644 (file)
@@ -5,6 +5,8 @@
 <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
 <!-- PRESENTATION -->
 <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
+<?xml-stylesheet href="chrome://open_ils_staff_client/skin/global.css" type="text/css"?>
+<?xml-stylesheet href="chrome://open_ils_staff_client/skin/auth.css" type="text/css"?>
 <!-- Load these just to cache them -->
 <?xml-stylesheet href="/xul/server/skin/global.css" type="text/css"?>
 <?xml-stylesheet href="/xul/server/skin/cat.css" type="text/css"?>
@@ -13,6 +15,7 @@
 <?xml-stylesheet href="/xul/server/skin/patron_summary.css" type="text/css"?>
 <?xml-stylesheet href="/xul/server/skin/simple_auth.css" type="text/css"?>
 
+
 <!-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////// -->
 <!-- LOCALIZATION -->
 <!DOCTYPE window PUBLIC "" ""[
@@ -34,8 +37,9 @@
        <script type="text/javascript">var myPackageDir = 'open_ils_staff_client'; var IAMXUL = true; var g = {};</script>
        <scripts id="openils_util_scripts"/>
 
+       <script type="text/javascript" src="chrome://open_ils_staff_client/content/main/lang.js"/>
        <script type="text/javascript" src="/xul/server/main/lang.js"/>
-       <script type="text/javascript" src="/xul/server/main/JSAN.js"/>
+       <script type="text/javascript" src="chrome://open_ils_staff_client/content/main/JSAN.js"/>
        <script>
        <![CDATA[
                dump("entities['lang.version'] = " + entities['lang.version'] + '\n');
                        JSAN.errorLevel = "die"; // none, warn, or die
                        JSAN.addRepository('/xul/server/');
 
-
-                       function data_progress(msg) {
+                       function cache_me(msg,how) {
                                try {
+                                       switch(how) {
+                                               case 'jsan' : JSAN.use(msg); break;
+                                               case 'http' :
+                                                       var x = new XMLHttpRequest();
+                                                       x.open("GET",msg,true);
+                                                       x.send(null);
+                                               break;
+                                       }
+                                       dump(msg + '\n');
                                        var x = document.getElementById('data_progress');
                                        if (x) {
                                                x.appendChild( document.createTextNode( msg + ' ') );
                                }
                        }
 
-
                        // load these just so they'll get cached
-                       JSAN.use('util.exec'); data_progress('util.exec');
-                       JSAN.use('util.barcode'); data_progress('util.barcode');  
-                       JSAN.use('util.controller'); data_progress('util.controller');  
-                       JSAN.use('util.deck'); data_progress('util.deck');  
-                       JSAN.use('util.fm_utils'); data_progress('util.fm_utils');  
-                       JSAN.use('util.list'); data_progress('util.list');  
-                       JSAN.use('util.network'); data_progress('util.network'); 
-                       JSAN.use('util.sound'); data_progress('util.sound'); 
-                       JSAN.use('util.widgets'); data_progress('util.widgets');  
-                       JSAN.use('util.browser'); data_progress('util.browser');  
-                       JSAN.use('util.error'); data_progress('util.error');  
-                       JSAN.use('util.file'); data_progress('util.file'); 
-                       JSAN.use('util.functional'); data_progress('util.functional');  
-                       JSAN.use('util.money'); data_progress('util.money');  
-                       JSAN.use('util.print'); data_progress('util.print');  
-                       JSAN.use('util.text'); data_progress('util.text'); 
-                       JSAN.use('util.window'); data_progress('util.window'); 
-
-                       JSAN.use('patron.bills'); data_progress('patron.bills');  
-                       JSAN.use('patron.display'); data_progress('patron.display');  
-                       JSAN.use('patron.holds'); data_progress('patron.holds');  
-                       JSAN.use('patron.items'); data_progress('patron.items'); 
-                       JSAN.use('patron.search_form'); data_progress('patron.search_form');  
-                       JSAN.use('patron.search_result'); data_progress('patron.search_result');  
-                       JSAN.use('patron.summary'); data_progress('patron.summary'); 
-                       JSAN.use('patron.util'); data_progress('patron.util'); 
-
-                       JSAN.use('circ.checkin'); data_progress('circ.checkin');  
-                       JSAN.use('circ.checkout'); data_progress('circ.checkout');  
-                       JSAN.use('circ.copy_status'); data_progress('circ.copy_status'); 
-                       JSAN.use('circ.hold_capture'); data_progress('circ.hold_capture'); 
-                       JSAN.use('circ.in_house_use'); data_progress('circ.in_house_use');  
-                       JSAN.use('circ.util'); data_progress('circ.util'); 
-
-                       {
-                               var x = new XMLHttpRequest();
-                               x.open("GET",'/xul/server/circ/checkout_overlay.xul',true);
-                               x.send(null);
-                               data_progress('checkout_overlay.xul');
-                       }
-                       {
-                               var x = new XMLHttpRequest();
-                               x.open("GET",'/xul/server/circ/checkout.xul',true);
-                               x.send(null);
-                               data_progress('checkout.xul');
-                       }
-                       {
-                               var x = new XMLHttpRequest();
-                               x.open("GET",'/xul/server/patron/barcode_entry.xul',true);
-                               x.send(null);
-                               data_progress('barcode_entry.xul');
-                       }
-                       {
-                               var x = new XMLHttpRequest();
-                               x.open("GET",'/xul/server/util/fancy_prompt.xul',true);
-                               x.send(null);
-                               data_progress('fancy_prompt.xul');
-                       }
-                       {
-                               var x = new XMLHttpRequest();
-                               x.open("GET",'/xul/server/circ/checkin_overlay.xul',true);
-                               x.send(null);
-                               data_progress('checkin_overlay.xul');
-                       }
-                       {
-                               var x = new XMLHttpRequest();
-                               x.open("GET",'/xul/server/circ/checkin.xul',true);
-                               x.send(null);
-                               data_progress('checkin.xul');
-                       }
-                       {
-                               var x = new XMLHttpRequest();
-                               x.open("GET",'/xul/server/circ/circ_brief.xul',true);
-                               x.send(null);
-                               data_progress('circ_brief.xul');
-                       }
-                       {
-                               var x = new XMLHttpRequest();
-                               x.open("GET",'/xul/server/circ/circ_summary.xul',true);
-                               x.send(null);
-                               data_progress('circ_summary.xul');
-                       }
-                       {
-                               var x = new XMLHttpRequest();
-                               x.open("GET",'/xul/server/circ/copy_status.xul',true);
-                               x.send(null);
-                               data_progress('copy_status.xul');
-                       }
-                       {
-                               var x = new XMLHttpRequest();
-                               x.open("GET",'/xul/server/circ/copy_status_overlay.xul',true);
-                               x.send(null);
-                               data_progress('copy_status_overlay.xul');
-                       }
-
+                       cache_me('/xul/server//util/exec.js','http');
+                       cache_me('/xul/server//util/barcode.js','http');  
+                       cache_me('/xul/server//util/controller.js','http');  
+                       cache_me('/xul/server//util/deck.js','http');  
+                       cache_me('/xul/server//util/fm_utils.js','http');  
+                       cache_me('/xul/server//util/list.js','http');  
+                       cache_me('/xul/server//util/network.js','http'); 
+                       cache_me('/xul/server//util/sound.js','http'); 
+                       cache_me('/xul/server//util/widgets.js','http');  
+                       cache_me('/xul/server//util/browser.js','http');  
+                       cache_me('/xul/server//util/error.js','http');  
+                       cache_me('/xul/server//util/file.js','http'); 
+                       cache_me('/xul/server//util/functional.js','http');  
+                       cache_me('/xul/server//util/money.js','http');  
+                       cache_me('/xul/server//util/print.js','http');  
+                       cache_me('/xul/server//util/text.js','http'); 
+                       cache_me('/xul/server//util/window.js','http'); 
+
+                       cache_me('/xul/server/util/fancy_prompt.xul','http');
+                       cache_me('/xul/server/util/browser.xul','http');
+                       cache_me('/xul/server/util/rbrowser.xul','http');
+
+                       cache_me('/xul/server//patron/display.js','http');  
+                       cache_me('/xul/server//patron/bills.js','http');  
+                       cache_me('/xul/server//patron/holds.js','http');  
+                       cache_me('/xul/server//patron/items.js','http'); 
+                       cache_me('/xul/server//patron/search_form.js','http');  
+                       cache_me('/xul/server//patron/search_result.js','http');  
+                       cache_me('/xul/server//patron/summary.js','http'); 
+                       cache_me('/xul/server//patron/util.js','http'); 
+
+                       cache_me('/xul/server/patron/display.xul','http');  
+                       cache_me('/xul/server/patron/display_overlay.xul','http');  
+                       cache_me('/xul/server/patron/bills.xul','http');  
+                       cache_me('/xul/server/patron/bills_overlay.xul','http');  
+                       cache_me('/xul/server/patron/holds.xul','http');  
+                       cache_me('/xul/server/patron/holds_overlay.xul','http');  
+                       cache_me('/xul/server/patron/items.xul','http'); 
+                       cache_me('/xul/server/patron/items_overlay.xul','http'); 
+                       cache_me('/xul/server/patron/search_form.xul','http');  
+                       cache_me('/xul/server/patron/search_form_overlay.xul','http');  
+                       cache_me('/xul/server/patron/search_result.xul','http');  
+                       cache_me('/xul/server/patron/search_result_overlay.xul','http');  
+                       cache_me('/xul/server/patron/summary.xul','http'); 
+                       cache_me('/xul/server/patron/summary_overlay.xul','http'); 
+                       cache_me('/xul/server/patron/barcode_entry.xul','http');
+
+                       cache_me('/xul/server/patron/ue.xhtml','http');
+                       cache_me('/xul/server/admin/adminlib.js','http');
+                       cache_me('/xul/server/admin/admin.css','http');
+                       cache_me('/xul/server/patron/ue_config.js','http');
+                       cache_me('/xul/server/patron/ue_ui.js','http');
+                       cache_me('/xul/server/patron/ue.js','http');
+                       cache_me('/opac/common/js//config.js','http');
+                       cache_me('/opac/common/js/Cookie.js','http');
+                       cache_me('/opac/common/js/Cookies.js','http');
+                       cache_me('/opac/common/js/opac_utils.js','http');
+                       cache_me('/opac/common/js/init.js','http');
+                       cache_me('/opac/common/js/jscalendar/calendar-brown.css','http');
+                       cache_me('/opac/common/js/jscalendar/calendar.js','http');
+                       cache_me('/opac/common/js/jscalendar/lang/calendar-en.js','http');
+                       cache_me('/opac/common/js/jscalendar/calendar-setup.js','http');
+                       cache_me('/opac/common/js/jscalendar/img.gif','http');
+
+                       cache_me('/xul/server/skin/media/images/stop_sign.png','http');
+                       cache_me('/xul/server/skin/media/images/bad_barcode.png','http');
+                       cache_me('/xul/server/skin/media/images/grinder.gif','http');     
+                       cache_me('/xul/server/skin/media/images/patron_left_arrow.png','http');
+                       cache_me('/xul/server/skin/media/images/skull.png','http');
+                       cache_me('/xul/server/skin/media/images/tools.png','http');
+                       cache_me('/xul/server/skin/media/images/up_arrow.gif','http');
+                       cache_me('/xul/server/skin/media/images/book_question.png','http');
+                       cache_me('/xul/server/skin/media/images/down_arrow.gif','http');
+                       cache_me('/xul/server/skin/media/images/icon_delete.gif','http');
+                       cache_me('/xul/server/skin/media/images/patron_right_arrow.png','http');
+                       cache_me('/xul/server/skin/media/images/turtle.gif','http');
+                       cache_me('/xul/server/skin/media/audio/bonus.wav','http');
+                       cache_me('/xul/server/skin/media/audio/question.wav','http');
+                       cache_me('/xul/server/skin/media/audio/redalert.wav','http');
+                       cache_me('/xul/server/skin/media/audio/toggled.wav','http');
+
+                       cache_me('/xul/server//circ/checkin.js','http');  
+                       cache_me('/xul/server//circ/checkout.js','http');  
+                       cache_me('/xul/server//circ/copy_status.js','http'); 
+                       cache_me('/xul/server//circ/hold_capture.js','http'); 
+                       cache_me('/xul/server//circ/in_house_use.js','http');  
+                       cache_me('/xul/server//circ/util.js','http'); 
+
+                       cache_me('/xul/server/circ/checkout_overlay.xul','http');
+                       cache_me('/xul/server/circ/checkout.xul','http');
+                       cache_me('/xul/server/circ/checkin_overlay.xul','http');
+                       cache_me('/xul/server/circ/checkin.xul','http');
+                       cache_me('/xul/server/circ/circ_brief.xul','http');
+                       cache_me('/xul/server/circ/circ_summary.xul','http');
+                       cache_me('/xul/server/circ/copy_status.xul','http');
+                       cache_me('/xul/server/circ/copy_status_overlay.xul','http');
 
                        // ----
 
index cbf9129..48e98f7 100644 (file)
@@ -39,8 +39,6 @@
                                JSAN.use('util.error'); g.error = new util.error();
                                g.error.sdump('D_TRACE','my_init() for patron/barcode_entry.xul');
 
-                               g.cgi = new CGI();
-
                                var tb = document.getElementById('barcode_tb');
                                tb.addEventListener(
                                        'keypress',
@@ -61,8 +59,8 @@
                                        try { window.xulG.set_tab_name('User Permission Editor'); } catch(E) { alert(E); }
                                }
 
-                               if (g.cgi.param('error')) { 
-                                       var error = g.cgi.param('error');
+                               if (xul_param('error')) { 
+                                       var error = xul_param('error');
                                        alert(error);
                                }
 
index 60c9d0b..98b9821 100644 (file)
@@ -39,8 +39,6 @@
                                JSAN.use('util.error'); g.error = new util.error();
                                g.error.sdump('D_TRACE','my_init() for patron/barcode_entry.xul');
 
-                               g.cgi = new CGI();
-
                                var tb = document.getElementById('barcode_tb');
                                tb.addEventListener(
                                        'keypress',
@@ -61,8 +59,8 @@
                                        try { window.xulG.set_tab_name('Check Out'); } catch(E) { alert(E); }
                                }
 
-                               if (g.cgi.param('error')) { 
-                                       var error = g.cgi.param('error');
+                               if (xul_param('error')) { 
+                                       var error = xul_param('error');
                                        alert(error);
                                }
 
index 6c452a8..43320d2 100644 (file)
@@ -37,7 +37,7 @@
                function $(id) { return document.getElementById(id); }
 
                function retrieve_patron() {
-                       g.patron_id = g.cgi.param('patron_id');
+                       g.patron_id = xul_param('patron_id');
 
                        if (g.patron_id) {
                                JSAN.use('patron.util'); 
                                                if (get_bool(r_circ.phone_renewal() ) ) r += 'PHONE ';
                                                $('renewal').value = r || 'No';
 
-                                               $('copy_summary').setAttribute('src',urls.XUL_COPY_SUMMARY + '?copy_id=' + r_circ.target_copy());
+                                               netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+                                               $('copy_summary').setAttribute('src',urls.XUL_COPY_SUMMARY); // + '?copy_id=' + r_circ.target_copy());
+                                               $('copy_summary').contentWindow.xulG = { 'copy_id' : r_circ.target_copy() };
                                                $('copy_summary').hidden=false;
 
                                                g.network.simple_request(
 
                                g.error.sdump('D_TRACE','my_init() for bill_details.xul');
 
-                               g.cgi = new CGI();
-
-                               g.mbts_id = g.cgi.param('mbts_id');
+                               g.mbts_id = xul_param('mbts_id');
 
                                retrieve_patron();
 
index 3d70921..a90c083 100644 (file)
@@ -37,7 +37,7 @@
                function $(id) { return document.getElementById(id); }
 
                function retrieve_patron() {
-                       g.patron_id = g.cgi.param('patron_id');
+                       g.patron_id = xul_param('patron_id');
 
                        if (g.patron_id) {
                                JSAN.use('patron.util'); 
@@ -58,7 +58,7 @@
                function retrieve_mbts_for_list() {
                        //var method = 'FM_MBTS_IDS_RETRIEVE_ALL_HAVING_CHARGE';
                        var method = 'FM_MBTS_IDS_RETRIEVE_FOR_HISTORY';
-                       if (g.cgi.param('current')) method = 'FM_MBTS_IDS_RETRIEVE_ALL_HAVING_BALANCE';
+                       if (xul_param('current')) method = 'FM_MBTS_IDS_RETRIEVE_ALL_HAVING_BALANCE';
                        g.mbts_ids = g.network.simple_request(method,[ses(),g.patron_id]);
                        if (g.mbts_ids.ilsevent) {
                                switch(g.mbts_ids.ilsevent) {
                                                $('checked_in').value = r_circ.checkin_time() ? r_circ.checkin_time().toString().substr(0,10) : '';
                                                $('due').value = r_circ.due_date() ? r_circ.due_date().toString().substr(0,10) : '';
 
-                                               $('copy_summary').setAttribute('src',urls.XUL_COPY_SUMMARY + '?copy_id=' + r_circ.target_copy());
+                                               netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+                                               $('copy_summary').setAttribute('src',urls.XUL_COPY_SUMMARY); // + '?copy_id=' + r_circ.target_copy());
+                                               $('copy_summary').contentWindow.xulG = { 'copy_id' : r_circ.target_copy() };
                                                $('copy_summary').hidden=false;
 
                                                g.network.simple_request(
 
                                g.error.sdump('D_TRACE','my_init() for bill_history.xul');
 
-                               g.cgi = new CGI();
-
                                retrieve_patron();
 
                                init_lists();
                                        false
                                );
 
-                               if (g.cgi.param('current')) {
+                               if (xul_param('current')) {
                                        $('caption').setAttribute('label','Current Bills');
                                        document.title = 'Current Bills';
                                } else {
                                JSAN.use('util.window');
                                var win = new util.window();
                                var w = win.open(
-                                       urls.XUL_PATRON_BILL_WIZARD
-                                               + '?patron_id=' + window.escape(g.patron_id)
-                                               + '&xact_id=' + window.escape( g.bill_list_selection[0] ),
+                                       urls.XUL_PATRON_BILL_WIZARD,
+                                               //+ '?patron_id=' + window.escape(g.patron_id)
+                                               //+ '&xact_id=' + window.escape( g.bill_list_selection[0] ),
                                        'billwizard',
-                                       'chrome,resizable,modal'
+                                       'chrome,resizable,modal',
+                                       { 'patron_id' : g.patron_id, 'xact_id' : g.bill_list_selection[0] }
                                );
                                g.bill_list.clear();
                                retrieve_mbts_for_list();
 
                function handle_details() {
                        JSAN.use('util.window'); var win = new util.window();
-                       var w = win.open(
-                               urls.XUL_PATRON_BILL_DETAILS 
-                               + '?patron_id=' + window.escape(g.patron_id)
-                               + '&mbts_id=' + window.escape( g.bill_list_selection[0] ),
+                       var my_xulG = win.open(
+                               urls.XUL_PATRON_BILL_DETAILS,
+                               //+ '?patron_id=' + window.escape(g.patron_id)
+                               //+ '&mbts_id=' + window.escape( g.bill_list_selection[0] ),
                                'test_billdetails',
-                               'chrome,resizable'
+                               'chrome,resizable',
+                               {
+                                       'patron_id' : g.patron_id,
+                                       'mbts_id' : g.bill_list_selection[0],
+                                       'refresh' : function() { 
+                                               if (typeof window.refresh == 'function') window.refresh();
+                                               if (typeof window.xulG == 'object' && typeof window.xulG.refresh == 'function') window.xulG.refresh();
+                                       }, 
+                               }
                        );
-                       w.xulG = { 'refresh' : function() { 
-                               if (typeof window.refresh == 'function') window.refresh();
-                               if (typeof window.xulG == 'object' && typeof window.xulG.refresh == 'function') window.xulG.refresh();
-                       } };
                }
 
                function print_bills() {
                        try {
                                g.bill_list.on_all_fleshed = function() {
                                        try {
-                                               var template = 'bills_historical'; if (g.cgi.param('current')) template = 'bills_current';
+                                               var template = 'bills_historical'; if (xul_param('current')) template = 'bills_current';
                                                JSAN.use('patron.util');
                                                var params = { 
                                                        'patron' : patron.util.retrieve_au_via_id(ses(),g.patron_id), 
index df2ca9f..a633947 100644 (file)
                }
 
                function retrieve_patron() {
-                       g.patron_id = g.cgi.param('patron_id');
+                       g.patron_id = xul_param('patron_id',{'modal_xulG':true});
 
                        if (g.patron_id) {
                                JSAN.use('patron.util'); 
                                ml.setAttribute('id','billing_type');
                                document.getElementById('menu_placeholder').appendChild(ml);
 
-                               g.cgi = new CGI();
-
                                retrieve_patron();
 
                                $('billing_location').setAttribute('value', g.OpenILS.data.hash.aou[ g.OpenILS.data.list.au[0].ws_ou() ].name() );
 
                                $('bill_amount').focus();
 
-                               if (g.cgi.param('xact_id')) { 
-                                       g.mbts_id = g.cgi.param('xact_id');
+                               if (xul_param('xact_id',{'modal_xulG':true})) { 
+                                       g.mbts_id = xul_param('xact_id',{'modal_xulG':true});
                                        $('summary').hidden = false; 
                                        retrieve_mbts();
                                        retrieve_circ();
 
                function patron_bill_finish() {
                        try {
-                               var xact_id = g.cgi.param('xact_id');
+                               var xact_id = xul_param('xact_id',{'modal_xulG':true});
                                if (!xact_id) {
                                                var grocery = new mg();
                                                        grocery.isnew('1');
index ded6603..79157d9 100644 (file)
@@ -163,11 +163,12 @@ patron.bills.prototype = {
                                                                        try {
                                                                                JSAN.use('util.window');
                                                                                var win = new util.window();
-                                                                               var w = win.open(
-                                                                                       urls.XUL_PATRON_BILL_WIZARD
-                                                                                               + '?patron_id=' + window.escape(obj.patron_id),
+                                                                               var my_xulG = win.open(
+                                                                                       urls.XUL_PATRON_BILL_WIZARD,
+                                                                                               //+ '?patron_id=' + window.escape(obj.patron_id),
                                                                                        'billwizard',
-                                                                                       'chrome,resizable,modal'
+                                                                                       'chrome,resizable,modal',
+                                                                                       { 'patron_id' : obj.patron_id }
                                                                                );
                                                                                obj.refresh();
                                                                        } catch(E) {
@@ -182,15 +183,17 @@ patron.bills.prototype = {
                                                                                JSAN.use('util.window');
                                                                                var win = new util.window();
                                                                                //obj.OpenILS.data.init({'via':'stash'}); obj.OpenILS.data.temp = ''; obj.OpenILS.data.stash('temp');
-                                                                               var w = win.open(
-                                                                                       urls.XUL_PATRON_BILL_HISTORY
-                                                                                               + '?patron_id=' + window.escape(obj.patron_id),
+                                                                               var my_xulG = win.open(
+                                                                                       urls.XUL_PATRON_BILL_HISTORY,
+                                                                                               //+ '?patron_id=' + window.escape(obj.patron_id),
                                                                                        'billhistory',
                                                                                        //'chrome,resizable,modal'
-                                                                                       'chrome,resizable'
+                                                                                       'chrome,resizable',
+                                                                                       {
+                                                                                               'patron_id' : obj.patron_id,
+                                                                                               'refresh' : function() { obj.refresh(); }
+                                                                                       }
                                                                                );
-                                                                               w.xulG = { 'refresh' : function() { obj.refresh(); } };
-                                                                               //w.refresh = function() { obj.refresh(); };
                                                                        } catch(E) {
                                                                                obj.error.standard_unexpected_error_alert('bills -> cmd_bill_history',E);       
                                                                        }
@@ -203,15 +206,18 @@ patron.bills.prototype = {
                                                                                JSAN.use('util.window');
                                                                                var win = new util.window();
                                                                                //obj.OpenILS.data.init({'via':'stash'}); obj.OpenILS.data.temp = ''; obj.OpenILS.data.stash('temp');
-                                                                               var w = win.open(
-                                                                                       urls.XUL_PATRON_BILL_HISTORY
-                                                                                               + '?current=1&patron_id=' + window.escape(obj.patron_id),
+                                                                               var my_xulG = win.open(
+                                                                                       urls.XUL_PATRON_BILL_HISTORY,
+                                                                                               //+ '?current=1&patron_id=' + window.escape(obj.patron_id),
                                                                                        'billhistory',
                                                                                        //'chrome,resizable,modal'
-                                                                                       'chrome,resizable'
+                                                                                       'chrome,resizable',
+                                                                                       {
+                                                                                               'current' : 1,
+                                                                                               'patron_id' : obj.patron_id,
+                                                                                               'refresh' : function() { obj.refresh(); },
+                                                                                       }
                                                                                );
-                                                                               w.xulG = { 'refresh' : function() { obj.refresh(); } };
-                                                                               //w.refresh = function() { obj.refresh(); };
                                                                        } catch(E) {
                                                                                obj.error.standard_unexpected_error_alert('bills -> cmd_alternate_view',E);     
                                                                        }
@@ -448,28 +454,26 @@ patron.bills.prototype = {
                                var win = new util.window();
                                switch(obj.controller.view.payment_type.value) {
                                        case 'credit_card_payment' :
-                                               obj.OpenILS.data.temp = '';
-                                               obj.OpenILS.data.stash('temp');
-                                               var w = win.open(
+                                               //obj.OpenILS.data.temp = '';
+                                               //obj.OpenILS.data.stash('temp');
+                                               var my_xulG = win.open(
                                                        urls.XUL_PATRON_BILL_CC_INFO,
                                                        'billccinfo',
                                                        'chrome,resizable,modal'
                                                );
-                                               obj.OpenILS.data.stash_retrieve();
-                                               /* FIXME -- need unique temp space name */
-                                               payment_blob = JSON2js( obj.OpenILS.data.temp );
+                                               //obj.OpenILS.data.stash_retrieve();
+                                               payment_blob = my_xulG.payment_blob; //JSON2js( obj.OpenILS.data.temp );
                                        break;
                                        case 'check_payment' :
-                                               obj.OpenILS.data.temp = '';
-                                               obj.OpenILS.data.stash('temp');
-                                               var w = win.open(
+                                               //obj.OpenILS.data.temp = '';
+                                               //obj.OpenILS.data.stash('temp');
+                                               var my_xulG = win.open(
                                                        urls.XUL_PATRON_BILL_CHECK_INFO,
                                                        'billcheckinfo',
                                                        'chrome,resizable,modal'
                                                );
-                                               obj.OpenILS.data.stash_retrieve();
-                                               /* FIXME -- need unique temp space name */
-                                               payment_blob = JSON2js( obj.OpenILS.data.temp );
+                                               //obj.OpenILS.data.stash_retrieve();
+                                               payment_blob = my_xulG.payment_blob; //JSON2js( obj.OpenILS.data.temp );
                                        break;
                                }
                                if (payment_blob=='' || payment_blob.cancelled=='true') { alert('cancelled'); return; }
@@ -892,14 +896,18 @@ patron.bills.prototype = {
                                                                        'command',
                                                                        function(ev) {
                                                                                JSAN.use('util.window'); var win = new util.window();
-                                                                               var w = win.open(
-                                                                                       urls.XUL_PATRON_BILL_DETAILS 
-                                                                                       + '?patron_id=' + window.escape(obj.patron_id)
-                                                                                       + '&mbts_id=' + window.escape(my.mobts.id()),
+                                                                               var my_xulG = win.open(
+                                                                                       urls.XUL_PATRON_BILL_DETAILS,
+                                                                                       //+ '?patron_id=' + window.escape(obj.patron_id)
+                                                                                       //+ '&mbts_id=' + window.escape(my.mobts.id()),
                                                                                        'test' + my.mobts.id(),
-                                                                                       'chrome,resizable'
+                                                                                       'chrome,resizable',
+                                                                                       {
+                                                                                               'patron_id' : obj.patron_id,
+                                                                                               'mbts_id' : my.mobts.id(),
+                                                                                               'refresh' : function() { obj.refresh(); },
+                                                                                       }
                                                                                );
-                                                                               w.xulG = { 'refresh' : function() { obj.refresh(); } };
                                                                        },
                                                                        false
                                                                );
@@ -912,12 +920,16 @@ patron.bills.prototype = {
                                                                        function(ev) {
                                                                                JSAN.use('util.window');
                                                                                var win = new util.window();
-                                                                               var w = win.open(
-                                                                                       urls.XUL_PATRON_BILL_WIZARD
-                                                                                               + '?patron_id=' + window.escape(obj.patron_id)
-                                                                                               + '&xact_id=' + window.escape( my.mobts.id() ),
+                                                                               var my_xulG = win.open(
+                                                                                       urls.XUL_PATRON_BILL_WIZARD,
+                                                                                               //+ '?patron_id=' + window.escape(obj.patron_id)
+                                                                                               //+ '&xact_id=' + window.escape( my.mobts.id() ),
                                                                                        'billwizard',
-                                                                                       'chrome,resizable,modal'
+                                                                                       'chrome,resizable,modal',
+                                                                                       {
+                                                                                               'patron_id' : obj.patron_id,
+                                                                                               'xact_id' : my.mobts.id(),
+                                                                                       }
                                                                                );
                                                                                obj.refresh();
                                                                        },
index c9d81d5..2608e78 100644 (file)
                                JSAN.use('util.error'); g.error = new util.error();
                                g.error.sdump('D_TRACE','my_init() for bills.xul');
 
-                               g.cgi = new CGI();
-
                                JSAN.use('patron.bills'); g.bills = new patron.bills();
                                g.bills.init( 
                                        { 
-                                               'patron_id' : g.cgi.param('patron_id'), 
+                                               'patron_id' : xul_param('patron_id'), 
                                        } 
                                );
                                window.refresh = function(p) { g.bills.refresh(p); }
index 4c238f9..1480e24 100644 (file)
@@ -150,10 +150,11 @@ patron.display.prototype = {
                                                function(ev) {
                                                        obj.reset_nav_styling('cmd_patron_items');
                                                        var frame = obj.right_deck.set_iframe(
-                                                               urls.XUL_PATRON_ITEMS
-                                                               + '?patron_id=' + window.escape( obj.patron.id() ),
+                                                               urls.XUL_PATRON_ITEMS,
+                                                               //+ '?patron_id=' + window.escape( obj.patron.id() ),
                                                                {},
                                                                {
+                                                                       'patron_id' : obj.patron.id(),
                                                                        'on_list_change' : function(b) {
                                                                                netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
                                                                                obj.summary_window.g.summary.controller.render('patron_checkouts');
@@ -178,22 +179,23 @@ patron.display.prototype = {
                                                                        obj.error.sdump('D_TRACE', 'Editor would like to search for: ' + js2JSON(s) ); 
                                                                        obj.data.stash_retrieve();
                                                                        var loc = xulG.url_prefix(urls.XUL_PATRON_DISPLAY);
-                                                                       loc += '?doit=1&query=' + window.escape(js2JSON(s));
-                                                                       xulG.new_tab( loc, {}, {} );
+                                                                       //loc += '?doit=1&query=' + window.escape(js2JSON(s));
+                                                                       xulG.new_tab( loc, {}, { 'doit' : 1, 'query' : s } );
                                                                }
 
                                                                function spawn_editor(p) {
                                                                        var url = urls.XUL_PATRON_EDIT;
-                                                                       var param_count = 0;
-                                                                       for (var i in p) {
-                                                                               if (param_count++ == 0) url += '?'; else url += '&';
-                                                                               url += i + '=' + window.escape(p[i]);
-                                                                       }
-                                                                       var loc = xulG.url_prefix( urls.XUL_REMOTE_BROWSER ) + '?url=' + window.escape( url );
+                                                                       //var param_count = 0;
+                                                                       //for (var i in p) {
+                                                                       //      if (param_count++ == 0) url += '?'; else url += '&';
+                                                                       //      url += i + '=' + window.escape(p[i]);
+                                                                       //}
+                                                                       var loc = xulG.url_prefix( urls.XUL_REMOTE_BROWSER ); // + '?url=' + window.escape( url );
                                                                        xulG.new_tab(
                                                                                loc, 
                                                                                {}, 
                                                                                { 
+                                                                                       'url' : url,
                                                                                        'show_print_button' : true , 
                                                                                        'tab_name' : 'Editing Related Patron' ,
                                                                                        'passthru_content_params' : {
@@ -201,21 +203,27 @@ patron.display.prototype = {
                                                                                                'spawn_editor' : spawn_editor,
                                                               &n