From: phasefx Date: Mon, 30 Aug 2010 15:36:18 +0000 (+0000) Subject: label printer context X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=39ef4e872c1ab5dbb3e6ba55d6f9a11e01e1530e;p=evergreen%2Fbjwebb.git label printer context git-svn-id: svn://svn.open-ils.org/ILS/trunk@17376 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/xul/staff_client/chrome/content/util/browser.js b/Open-ILS/xul/staff_client/chrome/content/util/browser.js index de33afa89..5759e36a6 100644 --- a/Open-ILS/xul/staff_client/chrome/content/util/browser.js +++ b/Open-ILS/xul/staff_client/chrome/content/util/browser.js @@ -50,7 +50,7 @@ util.browser.prototype = { try { netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); var content = obj.get_content(); - JSAN.use('util.print'); var p = new util.print(); + JSAN.use('util.print'); var p = new util.print(obj.printer_context); var print_params = {}; if (obj.html_source) { print_params.msg = obj.html_source; @@ -61,14 +61,22 @@ util.browser.prototype = { print_params.content_type = 'text/plain'; } JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.stash_retrieve(); - if ( - !data.print_strategy - || !data.print_strategy[obj.printer_context] - || (data.print_strategy[obj.printer_context] && data.print_strategy[obj.printer_context] == 'webBrowserPrint') - || !data.print_strategy['default'] - || (data.print_strategy['default'] && data.print_strategy['default'] == 'webBrowserPrint') - ) { - // Override the print strategy temporarily in this context + // Override the print strategy temporarily if it's not set or is equal to webBrowserPrint (which is buggy here) + if (data.print_strategy) { + if (data.print_strategy[obj.printer_context] || data.print_strategy['default']) { + if (data.print_strategy[obj.printer_context]) { + if (data.print_strategy[obj.printer_context] == 'webBrowserPrint') { + print_params.print_strategy = 'window.print'; + } + } else { + if (data.print_strategy['default'] == 'webBrowserPrint') { + print_params.print_strategy = 'window.print'; + } + } + } else { + print_params.print_strategy = 'window.print'; + } + } else { print_params.print_strategy = 'window.print'; } p.NSPrint(content,false,print_params); diff --git a/Open-ILS/xul/staff_client/chrome/content/util/browser.xul b/Open-ILS/xul/staff_client/chrome/content/util/browser.xul index 1bba3f3e1..01a10e64b 100644 --- a/Open-ILS/xul/staff_client/chrome/content/util/browser.xul +++ b/Open-ILS/xul/staff_client/chrome/content/util/browser.xul @@ -54,6 +54,7 @@ var p = { 'url' : url, 'push_xulG' : push_xulG, + 'printer_context' : xul_param('printer_context'), 'html_source' : xul_param('html_source'), 'debug_label' : 'debug' }; diff --git a/Open-ILS/xul/staff_client/chrome/content/util/rbrowser.xul b/Open-ILS/xul/staff_client/chrome/content/util/rbrowser.xul index fc4e4f51b..5099a4c32 100644 --- a/Open-ILS/xul/staff_client/chrome/content/util/rbrowser.xul +++ b/Open-ILS/xul/staff_client/chrome/content/util/rbrowser.xul @@ -57,6 +57,7 @@ var p = { 'url' : url, 'push_xulG' : push_xulG, + 'printer_context' : xul_param('printer_context'), 'html_source' : xul_param('html_source'), 'debug_label' : 'debug' }