[open-ils-commits] r16461 - in trunk/Open-ILS: web/opac/locale/en-US xul/staff_client/chrome/content/util xul/staff_client/chrome/locale/en-US xul/staff_client/server/admin xul/staff_client/server/cat (phasefx)

svn at svn.open-ils.org svn at svn.open-ils.org
Thu May 20 00:55:43 EDT 2010


Author: phasefx
Date: 2010-05-20 00:55:40 -0400 (Thu, 20 May 2010)
New Revision: 16461

Modified:
   trunk/Open-ILS/web/opac/locale/en-US/lang.dtd
   trunk/Open-ILS/xul/staff_client/chrome/content/util/browser.js
   trunk/Open-ILS/xul/staff_client/chrome/content/util/browser.xul
   trunk/Open-ILS/xul/staff_client/chrome/content/util/print.js
   trunk/Open-ILS/xul/staff_client/chrome/content/util/rbrowser.xul
   trunk/Open-ILS/xul/staff_client/chrome/content/util/text.js
   trunk/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties
   trunk/Open-ILS/xul/staff_client/server/admin/printer_settings.html
   trunk/Open-ILS/xul/staff_client/server/admin/printer_settings.js
   trunk/Open-ILS/xul/staff_client/server/cat/spine_labels.js
Log:
* I18N for print admin interface
* custom/external print strategy (where you dictate an external command and feed it %receipt.txt% and/or %receipt.html%)
* DOS LPT1 Print strategy preserved as a legacy option, but without serving double-duty with the external linux commands
* label printing now honors plain text print strategies, but we're still stuck with system defaults for print dialogs
* @hex attribute for generating control characters when using HTML in templates being rendered with plain text print strategies

  For example, <p hex="0C">Hello World</p> will transform into form feed + Hello World if used with DOS LPT1 Print or with the
  %receipt.txt% macro for the Custom/External Print strategy.  <p>Hello World</p hex="0C"> will yield Hello World + form feed.


Modified: trunk/Open-ILS/web/opac/locale/en-US/lang.dtd
===================================================================
--- trunk/Open-ILS/web/opac/locale/en-US/lang.dtd	2010-05-20 04:54:15 UTC (rev 16460)
+++ trunk/Open-ILS/web/opac/locale/en-US/lang.dtd	2010-05-20 04:55:40 UTC (rev 16461)
@@ -3241,5 +3241,16 @@
 <!ENTITY staff.util.timestamp_dialog.remove_btn.accesskey "R">
 <!ENTITY staff.util.timestamp_dialog.apply_btn.label "Apply">
 <!ENTITY staff.util.timestamp_dialog.apply_btn.accesskey "A">
-
-
+<!ENTITY staff.printing.set_default "Set Default Printer and Print Test Page">
+<!ENTITY staff.printing.page_settings "Page Settings">
+<!ENTITY staff.printing.normal_settings.header "Normal Settings">
+<!ENTITY staff.printing.advanced_settings.header "Advanced Settings">
+<!ENTITY staff.printing.advanced.mozilla_print "Use default print strategy (Mozilla Print)">
+<!ENTITY staff.printing.advanced.dos_print "Use alternate print strategy (DOS LPT1 Print)">
+<!ENTITY staff.printing.advanced.custom_print "Use alternate print strategy (Custom/External Print)">
+<!ENTITY staff.printing.advanced.dos_print.warning.header "Note on DOS LPT1 Print">
+<!ENTITY staff.printing.advanced.dos_print.warning.text "This print strategy will ignore the printer settings in the &quot;Normal Settings&quot; section. In Windows, you must map your printer to the LPT1 port, under Start Menu -&gt; Printers and Faxes -&gt; your printer -&gt; right-click, Properties -&gt; Ports. Also, HTML styling such as different font weights and sizes will be lost, and any advanced templates using Javascript will not work.  Data is sent to the printer as simple text.  This option is here for legacy purposes, and the Custom/External Print strategy is more flexible.">
+<!ENTITY staff.printing.advanced.custom_print.warning.header "Note on Custom/External Print">
+<!ENTITY staff.printing.advanced.custom_print.warning.text "This print strategy will ignore the printer settings in the &quot;Normal Settings&quot; section. Advanced templates using Javascript may not work, even if the external tool can take the receipt.html file.">
+<!ENTITY staff.printing.advanced.html_templates.warning.header "Also...">
+<!ENTITY staff.printing.advanced.html_templates.warning.text "If using Receipt Templates with either the DOS LPT1 Print strategy or the Custom/External Print strategy (with &quot;receipt.txt&quot;), the client will try to translate any HTML markup to text, but this process may be imperfect, and for the best fidelity you should consider reworking your templates to be plain text if you are using a plain text print strategy.  However, if using a plain text print strategy with HTML markup, you may include special character codes in 2-digit hexadecimal in a &quot;hex&quot; attribute for any given element.  Such codes will be converted to actual characters and inserted at the place of the tag.  For example, &amp;lt;p hex=&amp;quot;0C&amp;quot;&amp;gt;Hello World&amp;lt;/p&amp;gt; will translate to form feed control character + Hello World. &amp;lt;p&amp;gt;Hello World&amp;lt;/p hex=&amp;quot;0C&amp;quot;&amp;gt; will translate to Hello World + form feed control character.">

Modified: trunk/Open-ILS/xul/staff_client/chrome/content/util/browser.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/util/browser.js	2010-05-20 04:54:15 UTC (rev 16460)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/util/browser.js	2010-05-20 04:55:40 UTC (rev 16461)
@@ -21,7 +21,7 @@
 
             obj.url = params['url'];
             obj.push_xulG = params['push_xulG'];
-            obj.alt_print = params['alt_print'];
+            obj.html_source = params['html_source'];
             obj.browser_id = params['browser_id'];
             obj.debug_label = params['debug_label'];
             obj.passthru_content_params = params['passthru_content_params'];
@@ -46,12 +46,22 @@
                         'cmd_print' : [
                             ['command'],
                             function() {
-                                netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
-                                if (obj.alt_print) {
+                                try {
+                                    netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+                                    var content = obj.get_content();
                                     JSAN.use('util.print'); var p = new util.print();
-                                    p.NSPrint(obj.get_content(),false,{});
-                                } else {
-                                    obj.get_content().print();
+                                    var print_params = {};
+                                    if (obj.html_source) {
+                                        print_params.msg = obj.html_source;
+                                    }
+                                    JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.stash_retrieve();
+                                    if (data.print_strategy == 'webBrowserPrint') {
+                                        // Override the print strategy temporarily in this context
+                                        print_params.print_strategy = 'window.print';
+                                    }
+                                    p.NSPrint(content,false,print_params);
+                                } catch(E) {
+                                    alert('browser.js, cmd_print exception: ' + E);
                                 }
                             }
                         ],

Modified: trunk/Open-ILS/xul/staff_client/chrome/content/util/browser.xul
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/util/browser.xul	2010-05-20 04:54:15 UTC (rev 16460)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/util/browser.xul	2010-05-20 04:55:40 UTC (rev 16461)
@@ -51,13 +51,10 @@
                 var push_xulG = true;
                 if (xul_param('no_xulG')) push_xulG = false;
 
-                var alt_print = false;
-                if (xul_param('alternate_print')) alt_print = true;
-
                 var p =    { 
                     'url' : url,
                     'push_xulG' : push_xulG,
-                    'alt_print' : alt_print,
+                    'html_source' : xul_param('html_source'),
                     'debug_label' : 'debug'
                 };
                 if (typeof window.xulG == 'object' && typeof window.xulG.passthru_content_params == 'object') {

Modified: trunk/Open-ILS/xul/staff_client/chrome/content/util/print.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/util/print.js	2010-05-20 04:54:15 UTC (rev 16460)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/util/print.js	2010-05-20 04:55:40 UTC (rev 16461)
@@ -11,6 +11,11 @@
     JSAN.use('util.functional');
     JSAN.use('util.file');
 
+    var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces['nsIPrefBranch']);
+    var key = 'oils.printer.external.cmd';
+    var has_key = prefs.prefHasUserValue(key);
+    this.oils_printer_external_cmd = has_key ? prefs.getCharPref(key) : '';
+
     return this;
 };
 
@@ -20,7 +25,9 @@
         try {
             var obj = this; obj.data.init({'via':'stash'});
             if (!obj.data.last_print) {
-                alert('Nothing to re-print');
+                alert(
+                    document.getElementById('offlineStrings').getString('printing.nothing_to_reprint')
+                );
                 return;
             }
             var msg = obj.data.last_print.msg;
@@ -31,9 +38,48 @@
         }
     },
 
+    'html2txt' : function(html) {
+        JSAN.use('util.text');
+        //dump('html2txt, before:\n' + html + '\n');
+        var lines = html.split(/\n/);
+        var new_lines = [];
+        for (var i = 0; i < lines.length; i++) {
+            var line = lines[i];
+            if (line) {
+                // This undoes the util.text.preserve_string_in_html call that spine_label.js does
+                line = util.text.reverse_preserve_string_in_html(line);
+                // This looks for @hex attributes containing 2-digit hex codes, and converts them into real characters
+                line = line.replace(/(<.+?)hex=['"](.+?)['"](.*?>)/gi, function(str,p1,p2,p3,offset,s) {
+                    var raw_chars = '';
+                    var hex_chars = p2.match(/[0-9,a-f,A-F][0-9,a-f,A-F]/g);
+                    for (var j = 0; j < hex_chars.length; j++) {
+                        raw_chars += String.fromCharCode( parseInt(hex_chars[j],16) );
+                    }
+                    return p1 + p3 + raw_chars;
+                });
+                line = line.replace(/<head.*?>.*?<\/head>/gi, '');
+                line = line.replace(/<br.*?>/gi,'\r\n');
+                line = line.replace(/<table.*?>/gi,'');
+                line = line.replace(/<tr.*?>/gi,'');
+                line = line.replace(/<hr.*?>/gi,'\r\n');
+                line = line.replace(/<p.*?>/gi,'');
+                line = line.replace(/<block.*?>/gi,'');
+                line = line.replace(/<li.*?>/gi,' * ');
+                line = line.replace(/<.+?>/gi,'');
+                if (line) { new_lines.push(line); }
+            } else {
+                new_lines.push(line);
+            }
+        }
+        var new_html = new_lines.join('\n');
+        //dump('html2txt, after:\n' + new_html + '\nhtml2txt, done.\n');
+        return new_html;
+    },
+
     'simple' : function(msg,params) {
         try {
             if (!params) params = {};
+            params.msg = msg;
 
             var obj = this;
 
@@ -60,15 +106,18 @@
 
                 switch(params.print_strategy || obj.data.print_strategy) {
                     case 'dos.print':
+                        params.dos_print = true;
+                    case 'custom.print':
                         /* FIXME - this it a kludge.. we're going to sidestep window-based html rendering for printing */
                         /* I'm using regexps to mangle the html receipt templates; it'd be nice to use xsl but the */
-                        /* templates aren't guaranteed to be valid xml */
+                        /* templates aren't guaranteed to be valid xml.  The unadulterated msg is still preserved in */
+                        /* params */
                         if (content_type=='text/html') {
-                            w = msg.replace(/<br.*?>/gi,'\r\n').replace(/<table.*?>/gi,'\r\n').replace(/<tr.*?>/gi,'\r\n').replace(/<hr.*?>/gi,'\r\n').replace(/<p.*?>/gi,'\r\n').replace(/<block.*?>/gi,'\r\n').replace(/<li.*?>/gi,'\r\n * ').replace(/<.+?>/gi,'');
+                            w = obj.html2txt(msg);
                         } else {
                             w = msg;
                         }
-                        if (! params.no_form_feed) { w = w + '\r\n\r\n\r\n\r\n\r\n\r\n\f'; }
+                        if (! params.no_form_feed) { w = w + '\f'; }
                         obj.NSPrint(w, silent, params);
                         return;
                     break;
@@ -246,14 +295,24 @@
 
             if (params.print_strategy || obj.data.print_strategy) {
 
+dump('params.print_strategy = ' + params.print_strategy + ' || obj.data.print_strategy = ' + obj.data.print_strategy + ' => ' + ( params.print_strategy || obj.data.print_strategy ) + '\n');
                 switch(params.print_strategy || obj.data.print_strategy) {
                     case 'dos.print':
+                    case 'custom.print':
                         if (typeof w != 'string') {
-                            netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
-                            w.getSelection().selectAllChildren(w.document.firstChild);
-                            w = w.getSelection().toString();
+                            try {
+                                var temp_w = params.msg || w.document.firstChild.innerHTML;
+                                if (!params.msg) { params.msg = temp_w; }
+                                if (typeof temp_w != 'string') { throw(temp_w); }
+                                w = obj.html2txt(temp_w);
+                            } catch(E) {
+                                dump('util.print: Could not use w.document.firstChild.innerHTML with ' + w + ': ' + E + '\n');
+                                netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+                                w.getSelection().selectAllChildren(w.document.firstChild);
+                                w = w.getSelection().toString();
+                            }
                         }
-                        obj._NSPrint_dos_print(w,silent,params);
+                        obj._NSPrint_custom_print(w,silent,params);
                     break;    
                     case 'window.print':
                         w.print();
@@ -279,28 +338,34 @@
 
     },
 
-    '_NSPrint_dos_print' : function(w,silent,params) {
+    '_NSPrint_custom_print' : function(w,silent,params) {
         var obj = this;
         try {
 
-            /* OLD way: This is a kludge/workaround.  webBrowserPrint doesn't always work.  So we're going to let
-                the html window handle our receipt template rendering, and then force a selection of all
-                the text nodes and dump that to a file, for printing through a dos utility */
+            var text = w;
+            var html = params.msg || w;
 
-            /* NEW way: we just pass in the text */
+            var txt_file = new util.file('receipt.txt');
+            txt_file.write_content('truncate',text); 
+            var text_path = '"' + txt_file._file.path + '"';
+            txt_file.close();
 
-            var text = w;
+            var html_file = new util.file('receipt.html');
+            html_file.write_content('truncate',html); 
+            var html_path = '"' + html_file._file.path + '"';
+            html_file.close();
+            
+            var cmd = params.dos_print ?
+                'copy ' + text_path + ' lpt1 /b\n'
+                : obj.oils_printer_external_cmd.replace('%receipt.txt%',text_path).replace('%receipt.html%',html_path)
+            ;
 
-            var file = new util.file('receipt.txt');
-            file.write_content('truncate',text); 
-            var path = file._file.path;
-            file.close();
-            
             file = new util.file('receipt.bat');
-            file.write_content('truncate+exec','#!/bin/sh\ncopy "' + path + '" lpt1 /b\nlpr ' + path + '\n');
+            file.write_content('truncate+exec',cmd);
             file.close();
             file = new util.file('receipt.bat');
 
+            dump('print exec: ' + cmd + '\n');
             var process = Components.classes["@mozilla.org/process/util;1"].createInstance(Components.interfaces.nsIProcess);
             process.init(file._file);
 
@@ -312,7 +377,7 @@
 
         } catch (e) {
             //alert('Probably not printing: ' + e);
-            this.error.sdump('D_ERROR','_NSPrint_dos_print PRINT EXCEPTION: ' + js2JSON(e) + '\n');
+            this.error.sdump('D_ERROR','_NSPrint_custom_print PRINT EXCEPTION: ' + js2JSON(e) + '\n');
         }
     },
 

Modified: trunk/Open-ILS/xul/staff_client/chrome/content/util/rbrowser.xul
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/util/rbrowser.xul	2010-05-20 04:54:15 UTC (rev 16460)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/util/rbrowser.xul	2010-05-20 04:55:40 UTC (rev 16461)
@@ -54,13 +54,10 @@
                 var push_xulG = true;
                 if (xul_param('no_xulG')) push_xulG = false;
 
-                var alt_print = false;
-                if (xul_param('alternate_print')) alt_print = true;
-
                 var p = { 
                     'url' : url,
                     'push_xulG' : push_xulG,
-                    'alt_print' : alt_print,
+                    'html_source' : xul_param('html_source'),
                     'debug_label' : 'debug'
                 } 
                 if (typeof window.xulG == 'object' && typeof window.xulG.passthru_content_params == 'object') {

Modified: trunk/Open-ILS/xul/staff_client/chrome/content/util/text.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/util/text.js	2010-05-20 04:54:15 UTC (rev 16460)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/util/text.js	2010-05-20 04:55:40 UTC (rev 16461)
@@ -35,4 +35,14 @@
     return text;
 }
 
+util.text.reverse_preserve_string_in_html = function( text ) {
+    text = text.replace(/&amp;/g, '&');
+    text = text.replace(/&quot;/g, '"');
+    text = text.replace(/&#39;/g, "'");
+    text = text.replace(/&nbsp;/g, ' ');
+    text = text.replace(/&lt;/g, '<');
+    text = text.replace(/&gt;/g, '>');
+    return text;
+}
+
 dump('exiting util/text.js\n');

Modified: trunk/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties	2010-05-20 04:54:15 UTC (rev 16460)
+++ trunk/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties	2010-05-20 04:55:40 UTC (rev 16461)
@@ -269,3 +269,6 @@
 staff.cat.opac.title_for_hold_transfer.success.label=Holds transferred.
 staff.cat.opac.title_for_hold_transfer.failure.label=Holds not transferred.
 staff.cat.create_or_rebarcode_items=Create or Re-barcode Items
+printing.nothing_to_reprint=Nothing to re-print
+printing.prompt_for_external_print_cmd=Enter external print command and parameters (use %receipt.txt% or %receipt.html% as the file containing the print data. Those values will be substituted with the proper path.):
+printing.print_strategy_saved=Print strategy (%1$s) saved to file system.

Modified: trunk/Open-ILS/xul/staff_client/server/admin/printer_settings.html
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/admin/printer_settings.html	2010-05-20 04:54:15 UTC (rev 16460)
+++ trunk/Open-ILS/xul/staff_client/server/admin/printer_settings.html	2010-05-20 04:55:40 UTC (rev 16461)
@@ -1,5 +1,16 @@
-<html><head>
+<?xml version='1.0' encoding="UTF-8"?>
 
+<!DOCTYPE html PUBLIC
+    "-//W3C//DTD XHTML 1.0 Transitional//EN"
+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" [
+    <!--#include virtual="/opac/locale/${locale}/lang.dtd"-->
+]>
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+    <style type='text/css'>
+        .messagecatalog { -moz-binding: url( /xul/server/main/bindings.xml#messagecatalog ) }
+    </style>
     <script type="text/javascript" src="/opac/common/js/utils.js"></script>
     <script type="text/javascript" src="/opac/common/js/CGI.js"></script>
     <script type="text/javascript" src="/opac/common/js/md5.js"></script>
@@ -15,15 +26,24 @@
     <script type="text/javascript" src="/xul/server/main/JSAN.js"></script>
     <script type="text/javascript" src="printer_settings.js"></script>
 </head><body onload="try { my_init(); } catch(E) { alert(E); }" style="background: white;">
-    <h1>Normal Settings</h1>
+    <div class="messagecatalog" id="offlineStrings" src="/xul/server/locale/<!--#echo var='locale'-->/offline.properties" />
+    <h1>&staff.printing.normal_settings.header;</h1>
     <iframe id="sample" src="printer_settings.txt"></iframe><br />
-    <button onclick="try { g.printer_settings(); } catch(E) { alert(E); }">Set Default Printer and Print Test Page</button>
-    <button onclick="try { g.page_settings(); } catch(E) { alert(E); }">Page Settings</button><br />
-    <h1>Advanced Settings</h1>
-    <button onclick="try { g.set_print_strategy('webBrowserPrint'); } catch(E) { alert(E); }">Use default print strategy (Mozilla Print)</button>
-    <button onclick="try { g.set_print_strategy('dos.print'); } catch(E) { alert(E); }">Use alternate print strategy (DOS LPT1 Print)</button>
+    <button onclick="try { g.printer_settings(); } catch(E) { alert(E); }">&staff.printing.set_default;</button>
+    <button onclick="try { g.page_settings(); } catch(E) { alert(E); }">&staff.printing.page_settings;</button><br />
+    <h1>&staff.printing.advanced_settings.header;</h1>
+    <button onclick="try { g.set_print_strategy('webBrowserPrint'); } catch(E) { alert(E); }">&staff.printing.advanced.mozilla_print;</button>
+    <button onclick="try { g.set_print_strategy('dos.print'); } catch(E) { alert(E); }">&staff.printing.advanced.dos_print;</button>
+    <button onclick="try { g.set_print_strategy('custom.print'); } catch(E) { alert(E); }">&staff.printing.advanced.custom_print;</button>
     <p>
-        <b>Warning:</b> The alternate (DOS LPT1) print strategy will ignore the printer settings made in the "Normal Settings" section.  In Windows, you must map your printer to the LPT1 port, under Start Menu -&gt; Printers and Faxes -&gt; your printer -&gt; right-click, Properties -&gt; Ports.  Also, HTML styling such as different font weights and sizes will be lost when using the DOS LPT1 print.  Data is sent to the printer as simple text in this case.
+        <dl>
+            <dt><b>&staff.printing.advanced.dos_print.warning.header;</b></dt>
+            <dd>&staff.printing.advanced.dos_print.warning.text;</dd>
+            <dt><b>&staff.printing.advanced.custom_print.warning.header;</b></dt>
+            <dd>&staff.printing.advanced.custom_print.warning.text;</dd>
+            <dt><b>&staff.printing.advanced.html_templates.warning.header;</b></dt>
+            <dd>&staff.printing.advanced.html_templates.warning.text;</dd>
+        </dl>
     </p>
 </body></html>
 

Modified: trunk/Open-ILS/xul/staff_client/server/admin/printer_settings.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/admin/printer_settings.js	2010-05-20 04:54:15 UTC (rev 16460)
+++ trunk/Open-ILS/xul/staff_client/server/admin/printer_settings.js	2010-05-20 04:55:40 UTC (rev 16461)
@@ -11,6 +11,8 @@
 
         JSAN.use('util.print'); g.print = new util.print();
 
+        g.prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces['nsIPrefBranch']);
+
         /*
         netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
         g.PSSVC = Components.classes["@mozilla.org/gfx/printsettings-service;1"].getService(Components.interfaces.nsIPrintSettingsService);
@@ -39,12 +41,25 @@
 
 g.set_print_strategy = function(which) {
     netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
+    if (which == 'custom.print') {
+        var key = 'oils.printer.external.cmd';
+        var has_key = g.prefs.prefHasUserValue(key);
+        var value = has_key ? g.prefs.getCharPref(key) : '';
+        var cmd = window.prompt(
+            document.getElementById('offlineStrings').getString('printing.prompt_for_external_print_cmd'),
+            value
+        );
+        if (!cmd) { return; }
+        g.prefs.setCharPref(key,cmd);
+    }
     JSAN.use('util.file'); var file = new util.file('print_strategy');
     file.write_content( 'truncate', String( which ) );
     file.close();
     JSAN.use('OpenILS.data'); var data = new OpenILS.data(); data.init({'via':'stash'});
     data.print_strategy = which; data.stash('print_strategy');
-    alert('Print strategy (' + which + ') saved to file system.');
+    alert(
+        document.getElementById('offlineStrings').getFormattedString('printing.print_strategy_saved',[which])
+    );
 }
 
 g.save_settings = function() { g.print.save_settings(); }

Modified: trunk/Open-ILS/xul/staff_client/server/cat/spine_labels.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/cat/spine_labels.js	2010-05-20 04:54:15 UTC (rev 16460)
+++ trunk/Open-ILS/xul/staff_client/server/cat/spine_labels.js	2010-05-20 04:55:40 UTC (rev 16461)
@@ -263,7 +263,7 @@
                                 }
                                 html += '\n';
                             }
-                            html += '</pre>\n';
+                            html += '</pre hex="0C">\n';
                         }
                     }
                     html += '</body></html>';
@@ -274,7 +274,8 @@
                             'tab_name' : $("catStrings").getString('staff.cat.spine_labels.preview.title')
                         },
                         { 
-                            'url' : 'data:text/html,'+html,
+                            'url' : 'data:text/html;charset=utf-8,'+window.escape(html),
+                            'html_source' : html,
                             'show_print_button' : 1,
                             'no_xulG' : 1
                         }



More information about the open-ils-commits mailing list