try this in windows
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sun, 24 Jul 2005 19:20:44 +0000 (19:20 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sun, 24 Jul 2005 19:20:44 +0000 (19:20 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@1385 dcc99617-32d9-48b4-a31d-7c20da2025e4

Evergreen/staff_client/chrome/content/evergreen/util/error.js
Evergreen/staff_client/chrome/content/evergreen/util/print.js
Evergreen/staff_client/chrome/content/evergreen/util/win.js

index 5ad045b..6175bcc 100644 (file)
@@ -57,7 +57,7 @@ var sdump_levels = {
 
        'D_EXPLODE' : false,
        'D_FM_UTILS' : false,
-       'D_PRINT' : false,
+       'D_PRINT' : true,
        'D_SES' : true,
        'D_SES_FUNC' : false,
        'D_SES_RESULT' : true,
index 3ad4542..58713d5 100644 (file)
@@ -5,6 +5,7 @@ var print_crlf = '<br />\r\n';
 // Higher-level
 
 function print_checkout_receipt(params) {
+       sdump('D_PRINT',arg_dump(arguments));
 
 
 }
@@ -12,33 +13,18 @@ function print_checkout_receipt(params) {
 // Lower-level
 
 function sPrint(s) {
-       //var w = window.open('about:blank','print_win','alwaysLowered,minimizable,resizable,height=100,width=100,sizemode=minimized');
-       //var w = SafeWindowOpen('about:blank','print_win','alwaysLowered,minimizable,resizable,height=100,width=100,sizemode=minimized');
-       var w = new_window('data:text/html,<html>' + s + '</html>\r\n');
+       sdump('D_PRINT',arg_dump(arguments));
+       var w = new_window('data:text/html,<html>' + s + '</html>\r\n', { 'window_name':'LastPrint' });
+       w.minimize(); mw.minimize();
        this.focus();
        NSPrint(w);
-       w.close();
-}
-
-function sPrint_old(s) {
-       sdump('D_PRINT','Printing "' + s + '"\n');
-       //var deck = mw.document.getElementById('main_deck');
-       var iframe = mw.document.getElementById('print_frame');
-       //deck.appendChild(iframe);
-       iframe.setAttribute('src','about:blank');
-       /*while (iframe.contentWindow.document.lastChild) { 
-               iframe.contentWindow.document.removeChild(
-                       iframe.contentWindow.document.lastChild
-               );
-       }*/
-       //iframe.contentDocument.write(s);
-       iframe.contentWindow.document.write(s);
-       NSPrint2(iframe.contentWindow);
-       //deck.removeChild(iframe);
+       w.minimize(); mw.minimize();
+       //w.close();
 }
 
 function NSPrint(w)
 {
+       sdump('D_PRINT',arg_dump(arguments));
        if (!w) { w = this; }
        try {
                var webBrowserPrint = w
@@ -47,7 +33,6 @@ function NSPrint(w)
                if (webBrowserPrint) {
                        var gPrintSettings = GetPrintSettings();
                        gPrintSettings.printSilent = true;
-                       webBrowserPrint.print(gPrintSettings, null);
                         gPrintSettings.marginTop = 0;
                         gPrintSettings.marginLeft = 0;
                         gPrintSettings.marginBottom = 0;
@@ -58,6 +43,7 @@ function NSPrint(w)
                         gPrintSettings.footerStrLeft = '';
                         gPrintSettings.footerStrCenter = '';
                         gPrintSettings.footerStrRight = '';
+                       webBrowserPrint.print(gPrintSettings, null);
                        //alert('Should be printing\n');
                } else {
                        //alert('Should not be printing\n');
@@ -71,32 +57,11 @@ function NSPrint(w)
        }
 }
 
-function NSPrint2(w) {
-       if (!w) { w = this; }
-       try {
-               var webBrowserPrint = w
-                       .QueryInterface(Components.interfaces.nsIInterfaceRequestor)
-                       .getInterface(Components.interfaces.nsIWebBrowserPrint);
-               if (webBrowserPrint) {
-                       webBrowserPrint.print(null, null);
-                       //alert('Should be printing\n');
-               } else {
-                       //alert('Should not be printing\n');
-               }
-       } catch (e) {
-               //alert('Probably not printing: ' + e);
-       // Pressing cancel is expressed as an NS_ERROR_ABORT return value,
-       // causing an exception to be thrown which we catch here.
-       // Unfortunately this will also consume helpful failures, so add a
-               sdump('D_PRINT','PRINT EXCEPTION: ' + js2JSON(e) + '\n'); // if you need to debug
-       }
-
-}
-
 var gPrintSettings = null;
 
 function GetPrintSettings()
  {
+       sdump('D_PRINT',arg_dump(arguments));
    try {
      if (gPrintSettings == null) {
        var pref = Components.classes["@mozilla.org/preferences-service;1"]
@@ -125,6 +90,7 @@ function GetPrintSettings()
 
 function setPrinterDefaultsForSelectedPrinter(aPrintService)
  {
+       sdump('D_PRINT',arg_dump(arguments));
    if (gPrintSettings.printerName == "") {
      gPrintSettings.printerName = aPrintService.defaultPrinterName;
    }
index 799d7c3..9bacbb9 100644 (file)
@@ -1,6 +1,7 @@
-sdump('D_WIN','Loading win.js\n');
+sdump('D_TRACE','Loading win.js\n');
 
 function s_alert(s) {
+       sdump('D_WIN',arg_dump(arguments));
        // alert() replacement, intended to stop barcode scanners from "scanning through" the dialog
 
        // get a reference to the prompt service component.
@@ -36,6 +37,7 @@ function s_alert(s) {
 }
 
 function yns_alert(s,title,b1,b2,b3,c) {
+       sdump('D_WIN',arg_dump(arguments));
        // alert() replacement, intended to stop barcode scanners from "scanning through" the dialog
 
        // get a reference to the prompt service component.
@@ -67,6 +69,7 @@ function yns_alert(s,title,b1,b2,b3,c) {
 }
 
 function new_window(chrome,params) {
+       sdump('D_WIN',arg_dump(arguments));
        var name = self.name + '_' + ++mw.G['window_name_increment'];
        var options = 'chrome,resizable=yes,scrollbars=yes,width=800,height=600,fullscreen=yes';
        try {
@@ -102,6 +105,7 @@ function new_window(chrome,params) {
 // Modified to return window handler, and do errors differently
 function SafeWindowOpen(url,title,features)
 {
+       sdump('D_WIN',arg_dump(arguments));
        var w;
 
    netscape.security.PrivilegeManager