expose the print.always_print_silent preference in the Printer Settings Editor
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 24 Jan 2011 21:05:04 +0000 (21:05 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 24 Jan 2011 21:05:04 +0000 (21:05 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@19269 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/opac/locale/en-US/lang.dtd
Open-ILS/xul/staff_client/server/admin/printer_settings.html
Open-ILS/xul/staff_client/server/admin/printer_settings.js

index 5a48c9d..79866ab 100644 (file)
 <!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.mozilla_print.print_silent "Print silently when using 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">
index 3ab42ec..fdd0db3 100644 (file)
@@ -41,6 +41,9 @@
     <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>
+    <form>
+        <input type='checkbox' id='print_silent' onclick='g.toggle_silent_print(event);'>&staff.printing.advanced.mozilla_print.print_silent;</input>
+    </form>
     <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>
index f9d9ed4..671360f 100644 (file)
@@ -13,6 +13,13 @@ function my_init() {
 
         g.prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces['nsIPrefBranch']);
 
+        var print_silent_pref = false;
+        if (g.prefs.prefHasUserValue('print.always_print_silent')) {
+            print_silent_pref = g.prefs.getBoolPref('print.always_print_silent');
+        }
+        var x = document.getElementById('print_silent');
+        x.checked = print_silent_pref;
+
         /*
         netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
         g.PSSVC = Components.classes["@mozilla.org/gfx/printsettings-service;1"].getService(Components.interfaces.nsIPrintSettingsService);
@@ -26,6 +33,13 @@ function my_init() {
     }
 }
 
+g.toggle_silent_print = function() {
+    var x = document.getElementById('print_silent');
+    netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+    g.prefs.setBoolPref('print.always_print_silent', x.checked);
+    dump('Setting print.always_print_silent to ' + x.checked + '\n');
+}
+
 g.set_printer_context = function(context) {
     g.context = context || 'default';
     JSAN.use('util.print'); g.print = new util.print(g.context);