printing the contents of iframes is sometimes problematic, especially with complex...
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 12 Jul 2010 18:12:50 +0000 (18:12 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 12 Jul 2010 18:12:50 +0000 (18:12 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@16911 dcc99617-32d9-48b4-a31d-7c20da2025e4

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

index ab877db..2b48aa8 100644 (file)
@@ -54,6 +54,9 @@ util.browser.prototype = {
                                     if (obj.html_source) {
                                         print_params.msg = obj.html_source;
                                     }
+                                    if (typeof content.printable_output == 'function') {
+                                        print_params.msg = content.printable_output();
+                                    }
                                     JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.stash_retrieve();
                                     if (data.print_strategy == 'webBrowserPrint' || !data.print_strategy) {
                                         // Override the print strategy temporarily in this context
index 15c5159..9f2bab6 100644 (file)
@@ -315,14 +315,39 @@ dump('params.print_strategy = ' + params.print_strategy + ' || obj.data.print_st
                         obj._NSPrint_custom_print(w,silent,params);
                     break;    
                     case 'window.print':
-                        w.print();
+                        if (! params.msg) {
+                            w.print();
+                        } else {
+                            w = window.open('data:text/plain,'+escape(params.msg));
+                            setTimeout(
+                                function() {
+                                    w.print();
+                                    setTimeout(
+                                        function() {
+                                            w.close(); 
+                                        }, 2000
+                                    );
+                                }, 0
+                            );
+                        }
                     break;    
                     case 'webBrowserPrint':
-                        obj._NSPrint_webBrowserPrint(w,silent,params);
-                    break;    
                     default:
-                        //w.print();
-                        obj._NSPrint_webBrowserPrint(w,silent,params);
+                        if (! params.msg) {
+                            obj._NSPrint_webBrowserPrint(w,silent,params);
+                        } else {
+                            w = window.open('data:text/plain,'+escape(params.msg));
+                            setTimeout(
+                                function() {
+                                    obj._NSPrint_webBrowserPrint(w,silent,params);
+                                    setTimeout(
+                                        function() {
+                                            w.close(); 
+                                        }, 2000
+                                    );
+                                }, 0
+                            );
+                        }
                     break;    
                 }