From: phasefx Date: Tue, 23 Nov 2010 21:52:01 +0000 (+0000) Subject: move all invocations of Volume/Copy Creator and Spine Label interfaces to tabs to... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=10b2f6c4f1fafc53c91c367b29c85f5fda6e1230;p=evergreen%2Fmasslnc.git move all invocations of Volume/Copy Creator and Spine Label interfaces to tabs to workaround https://bugs.launchpad.net/evergreen/+bug/677628 git-svn-id: svn://svn.open-ils.org/ILS/trunk@18841 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/xul/staff_client/chrome/content/cat/opac.js b/Open-ILS/xul/staff_client/chrome/content/cat/opac.js index 15050bbcbf..28da88245e 100644 --- a/Open-ILS/xul/staff_client/chrome/content/cat/opac.js +++ b/Open-ILS/xul/staff_client/chrome/content/cat/opac.js @@ -814,11 +814,9 @@ function add_volumes() { var title = document.getElementById('offlineStrings').getFormattedString('staff.circ.copy_status.add_volumes.title', [docid]); - JSAN.use('util.window'); var win = new util.window(); - var w = win.open( + var w = xulG.new_tab( window.xulG.url_prefix(urls.XUL_VOLUME_COPY_CREATOR), - title, - 'chrome,resizable', + { 'tab_name' : title }, { 'doc_id' : docid, 'ou_ids' : [ ses('ws_ou') ] } ); } catch(E) { diff --git a/Open-ILS/xul/staff_client/chrome/content/main/menu.js b/Open-ILS/xul/staff_client/chrome/content/main/menu.js index 658182f9df..a99794a53e 100644 --- a/Open-ILS/xul/staff_client/chrome/content/main/menu.js +++ b/Open-ILS/xul/staff_client/chrome/content/main/menu.js @@ -1543,11 +1543,9 @@ main.menu.prototype = { }, 'volume_item_creator' : function(params) { var obj = this; - JSAN.use('util.window'); var win = new util.window(); - var w = win.open( + var w = obj.new_tab( obj.url_prefix(urls.XUL_VOLUME_COPY_CREATOR), - document.getElementById('offlineStrings').getString('staff.cat.create_or_rebarcode_items'), - 'chrome,resizable', + { 'tab_name' : document.getElementById('offlineStrings').getString('staff.cat.create_or_rebarcode_items') }, params ); }, diff --git a/Open-ILS/xul/staff_client/server/cat/copy_browser.js b/Open-ILS/xul/staff_client/server/cat/copy_browser.js index 902c52e81a..c4604d3eec 100644 --- a/Open-ILS/xul/staff_client/server/cat/copy_browser.js +++ b/Open-ILS/xul/staff_client/server/cat/copy_browser.js @@ -288,17 +288,16 @@ cat.copy_browser.prototype = { var title = document.getElementById('catStrings').getString('staff.cat.copy_browser.add_item.title'); - JSAN.use('util.window'); var win = new util.window(); - var w = win.open( + var w = xulG.new_tab( window.xulG.url_prefix(urls.XUL_VOLUME_COPY_CREATOR), - //+'?doc_id=' + window.escape(obj.docid) - //+'&ou_ids=' + window.escape( js2JSON(list) ) - //+'©_shortcut=' + window.escape( js2JSON(copy_shortcut) ), - title, - 'chrome,resizable' + { 'tab_name' : title }, + { + 'doc_id' : obj.docid, + 'ou_ids' : list, + 'copy_shortcut' : copy_shortcut, + 'refresh' : function() { obj.refresh_list(); } + } ); - 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(document.getElementById('catStrings').getString('staff.cat.copy_browser.add_item.error'),E); } @@ -485,12 +484,12 @@ cat.copy_browser.prototype = { } ); - obj.data.temp_barcodes_for_labels = util.functional.map_list( list, function(o){return o.barcode();}) ; - obj.data.stash('temp_barcodes_for_labels'); xulG.new_tab( xulG.url_prefix( urls.XUL_SPINE_LABEL ), { 'tab_name' : document.getElementById('catStrings').getString('staff.cat.copy_browser.print_spine.tab') }, - {} + { + 'barcodes' : util.functional.map_list( list, function(o){return o.barcode();}) + } ); } catch(E) { obj.error.standard_unexpected_error_alert(document.getElementById('catStrings').getString('staff.cat.copy_browser.print_spine.error'),E); @@ -537,17 +536,12 @@ cat.copy_browser.prototype = { var title = document.getElementById('catStrings').getString('staff.cat.copy_browser.add_volume.title'); - JSAN.use('util.window'); var win = new util.window(); - var w = win.open( + var w = xulG.new_tab( window.xulG.url_prefix(urls.XUL_VOLUME_COPY_CREATOR), - //+'?doc_id=' + window.escape(obj.docid) - //+'&ou_ids=' + window.escape( js2JSON(list) ), - title, - 'chrome,resizable' + { 'tab_name' : title }, + { 'doc_id' : obj.docid, 'ou_ids' : list, 'refresh' : function() { obj.refresh_list(); } } ); - w.refresh = function() { obj.refresh_list() }; - w.xulG = { 'doc_id' : obj.docid, 'ou_ids' : list }; } catch(E) { obj.error.standard_unexpected_error_alert(document.getElementById('catStrings').getString('staff.cat.copy_browser.add_volume.error'),E); } diff --git a/Open-ILS/xul/staff_client/server/cat/spine_labels.js b/Open-ILS/xul/staff_client/server/cat/spine_labels.js index 8c32d41ea4..35d5d28cde 100644 --- a/Open-ILS/xul/staff_client/server/cat/spine_labels.js +++ b/Open-ILS/xul/staff_client/server/cat/spine_labels.js @@ -20,6 +20,9 @@ g.barcodes = g.barcodes.concat( g.data.temp_barcodes_for_labels ); g.data.temp_barcodes_for_labels = null; g.data.stash('temp_barcodes_for_labels'); } + if (xulG.barcodes) { + g.barcodes = g.barcodes.concat( xulG.barcodes ); + } JSAN.use('circ.util'); g.cols = circ.util.columns( {} ); @@ -579,6 +582,7 @@ var w = win.open( loc, 'spine_preview', 'chrome,resizable,width=750,height=550'); w.xulG = { 'url' : 'about:blank', + 'url_prefix' : function (u) { return xulG.url_prefix(u); }, 'show_print_button' : 1, 'printer_context' : 'label', 'alternate_print' : 1, diff --git a/Open-ILS/xul/staff_client/server/cat/util.js b/Open-ILS/xul/staff_client/server/cat/util.js index 895f51c2d6..5e70b3d3e0 100644 --- a/Open-ILS/xul/staff_client/server/cat/util.js +++ b/Open-ILS/xul/staff_client/server/cat/util.js @@ -189,13 +189,12 @@ cat.util.spawn_spine_editor = function(selection_list) { JSAN.use('util.error'); var error = new util.error(); try { JSAN.use('util.functional'); - JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.stash_retrieve(); - data.temp_barcodes_for_labels = util.functional.map_list( selection_list, function(o){return o.barcode;}) ; - data.stash('temp_barcodes_for_labels'); xulG.new_tab( xulG.url_prefix( urls.XUL_SPINE_LABEL ), { 'tab_name' : $("catStrings").getString('staff.cat.util.spine_editor.tab_name') }, - {} + { + 'barcodes' : util.functional.map_list( selection_list, function(o){return o.barcode;}) + } ); } catch(E) { error.standard_unexpected_error_alert($("catStrings").getString('staff.cat.util.spine_editor.spine_editor_error'),E); diff --git a/Open-ILS/xul/staff_client/server/cat/volume_copy_creator.js b/Open-ILS/xul/staff_client/server/cat/volume_copy_creator.js index ace9f1f4f3..e82366adbf 100644 --- a/Open-ILS/xul/staff_client/server/cat/volume_copy_creator.js +++ b/Open-ILS/xul/staff_client/server/cat/volume_copy_creator.js @@ -486,6 +486,7 @@ g.stash_and_close = function(param) { } } + var dont_close = false; JSAN.use('util.window'); var win = new util.window(); if (copies.length > 0) { JSAN.use('cat.util'); @@ -507,13 +508,13 @@ g.stash_and_close = function(param) { //case 1706 /* ITEM_BARCODE_EXISTS */ : if (copies && copies.length > 0 && $('print_labels').checked) { JSAN.use('util.functional'); - JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.stash_retrieve(); - data.temp_barcodes_for_labels = util.functional.map_list( copies, function(o){return o.barcode();}) ; - data.stash('temp_barcodes_for_labels'); - var w = win.open( + dont_close = true; + xulG.set_tab( urls.XUL_SPINE_LABEL, - 'spine_labels', - 'chrome,resizable,width=750,height=550' + { 'tab_name' : $("catStrings").getString('staff.cat.util.spine_editor.tab_name') }, + { + 'barcodes' : util.functional.map_list( copies, function(o){return o.barcode();}) + } ); } } catch(E) { @@ -521,10 +522,10 @@ g.stash_and_close = function(param) { } } - if (typeof window.refresh == 'function') { window.refresh(); } - if (typeof g.refresh == 'function') { g.refresh(); } + try { if (typeof window.refresh == 'function') { window.refresh(); } } catch(E) { dump(E+'\n'); } + try { if (typeof g.refresh == 'function') { g.refresh(); } } catch(E) { dump(E+'\n'); } - window.close(); + if (! dont_close) { xulG.close_tab(); } } catch(E) { g.error.standard_unexpected_error_alert($(catStrings).getString('staff.cat.volume_copy_creator.stash_and_close.tree_err3'),E); diff --git a/Open-ILS/xul/staff_client/server/circ/copy_status.js b/Open-ILS/xul/staff_client/server/circ/copy_status.js index 581a60ab8e..62a56a31fd 100644 --- a/Open-ILS/xul/staff_client/server/circ/copy_status.js +++ b/Open-ILS/xul/staff_client/server/circ/copy_status.js @@ -532,14 +532,9 @@ circ.copy_status.prototype = { var title = document.getElementById('circStrings').getFormattedString('staff.circ.copy_status.add_items.title', [r]); - JSAN.use('util.window'); var win = new util.window(); - var w = win.open( + var w = xulG.new_tab( window.xulG.url_prefix(urls.XUL_VOLUME_COPY_CREATOR), - //+'?doc_id=' + window.escape(r) - //+'&ou_ids=' + window.escape( js2JSON(list) ) - //+'©_shortcut=' + window.escape( js2JSON(copy_shortcut[r]) ), - title, - 'chrome,resizable', + { 'tab_name' : title }, { 'doc_id' : r, 'ou_ids' : list, 'copy_shortcut' : copy_shortcut[r] } ); } @@ -687,13 +682,9 @@ circ.copy_status.prototype = { var title = document.getElementById('circStrings').getFormattedString('staff.circ.copy_status.add_volumes.title', [r]); - JSAN.use('util.window'); var win = new util.window(); - var w = win.open( + var w = xulG.new_tab( window.xulG.url_prefix(urls.XUL_VOLUME_COPY_CREATOR), - //+'?doc_id=' + window.escape(r) - //+'&ou_ids=' + window.escape( js2JSON(list) ), - title, - 'chrome,resizable', + { 'tab_name' : title }, { 'doc_id' : r, 'ou_ids' : list } );