label printer context
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 30 Aug 2010 15:36:18 +0000 (15:36 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 30 Aug 2010 15:36:18 +0000 (15:36 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@17376 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/chrome/content/util/browser.js
Open-ILS/xul/staff_client/chrome/content/util/browser.xul
Open-ILS/xul/staff_client/chrome/content/util/rbrowser.xul

index de33afa..5759e36 100644 (file)
@@ -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);
index 1bba3f3..01a10e6 100644 (file)
@@ -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'
                 };
index fc4e4f5..5099a4c 100644 (file)
@@ -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'
                 }