[open-ils-commits] r14844 - in trunk/Open-ILS/xul/staff_client/chrome: content/OpenILS content/util locale/en-US (phasefx)

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Nov 9 13:46:40 EST 2009


Author: phasefx
Date: 2009-11-09 13:46:36 -0500 (Mon, 09 Nov 2009)
New Revision: 14844

Modified:
   trunk/Open-ILS/xul/staff_client/chrome/content/OpenILS/data.js
   trunk/Open-ILS/xul/staff_client/chrome/content/util/print.js
   trunk/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties
Log:
Mozilla has a printer settings object which we serialize when saving the settings.  But those objects are not necessarily compatible across xulrunner versions.  This changeset will load what settings it can and warn the user that they need to reconfigure their printer settings.  We also attempt to load the printer settings up-front during the login process for earlier warning.

Modified: trunk/Open-ILS/xul/staff_client/chrome/content/OpenILS/data.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/OpenILS/data.js	2009-11-09 18:30:11 UTC (rev 14843)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/OpenILS/data.js	2009-11-09 18:46:36 UTC (rev 14844)
@@ -445,6 +445,9 @@
         }
         file.close();
 
+        JSAN.use('util.print'); (new util.print()).GetPrintSettings();
+        obj.data_progress('Printer settings retrieved. ');
+
         JSAN.use('util.functional');
         JSAN.use('util.fm_utils');
 

Modified: trunk/Open-ILS/xul/staff_client/chrome/content/util/print.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/chrome/content/util/print.js	2009-11-09 18:30:11 UTC (rev 14843)
+++ trunk/Open-ILS/xul/staff_client/chrome/content/util/print.js	2009-11-09 18:46:36 UTC (rev 14844)
@@ -411,12 +411,13 @@
 
     'load_settings' : function() {
         try {
+            var error_msg = '';
             netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
             var file = new util.file('gPrintSettings');
             if (file._file.exists()) {
                 temp = file.get_object(); file.close();
                 for (var i in temp) {
-                    this.gPrintSettings[i] = temp[i];
+                    try { this.gPrintSettings[i] = temp[i]; } catch(E) { error_msg += 'Error trying to set gPrintSettings.'+i+'='+temp[i]+' : ' + js2JSON(E) + '\n'; }
                 }
             } else {
                 this.gPrintSettings.marginTop = 0;
@@ -430,6 +431,17 @@
                 this.gPrintSettings.footerStrCenter = '';
                 this.gPrintSettings.footerStrRight = '';
             }
+            if (error_msg) {
+                this.error.sdump('D_PRINT',error_msg);
+                this.error.yns_alert(
+                    document.getElementById('offlineStrings').getString('load_printer_settings_error_description'),
+                    document.getElementById('offlineStrings').getString('load_printer_settings_error_title'),
+                    document.getElementById('offlineStrings').getString('common.ok'),
+                    null,
+                    null,
+                    null
+                );
+            }
         } catch(E) {
             this.error.standard_unexpected_error_alert("load_settings()",E);
         }

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	2009-11-09 18:30:11 UTC (rev 14843)
+++ trunk/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties	2009-11-09 18:46:36 UTC (rev 14844)
@@ -231,3 +231,5 @@
 menu.local_admin.circ_matrix_matchpoint.tab=Circulation Policies
 menu.local_admin.hold_matrix_matchpoint.tab=Hold Policies
 menu.local_admin.work_log.tab=Work Log
+load_printer_settings_error_description=Printer settings did not load cleanly with this version of Evergreen.  You should reconfigure your printer under Printer Settings Editor.
+load_printer_settings_error_title=Printer Settings



More information about the open-ils-commits mailing list