[open-ils-commits] r14845 - in branches/rel_1_6/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:53:19 EST 2009


Author: phasefx
Date: 2009-11-09 13:53:15 -0500 (Mon, 09 Nov 2009)
New Revision: 14845

Modified:
   branches/rel_1_6/Open-ILS/xul/staff_client/chrome/content/OpenILS/data.js
   branches/rel_1_6/Open-ILS/xul/staff_client/chrome/content/util/print.js
   branches/rel_1_6/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: branches/rel_1_6/Open-ILS/xul/staff_client/chrome/content/OpenILS/data.js
===================================================================
--- branches/rel_1_6/Open-ILS/xul/staff_client/chrome/content/OpenILS/data.js	2009-11-09 18:46:36 UTC (rev 14844)
+++ branches/rel_1_6/Open-ILS/xul/staff_client/chrome/content/OpenILS/data.js	2009-11-09 18:53:15 UTC (rev 14845)
@@ -416,6 +416,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: branches/rel_1_6/Open-ILS/xul/staff_client/chrome/content/util/print.js
===================================================================
--- branches/rel_1_6/Open-ILS/xul/staff_client/chrome/content/util/print.js	2009-11-09 18:46:36 UTC (rev 14844)
+++ branches/rel_1_6/Open-ILS/xul/staff_client/chrome/content/util/print.js	2009-11-09 18:53:15 UTC (rev 14845)
@@ -405,12 +405,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;
@@ -424,6 +425,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: branches/rel_1_6/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties
===================================================================
--- branches/rel_1_6/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties	2009-11-09 18:46:36 UTC (rev 14844)
+++ branches/rel_1_6/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties	2009-11-09 18:53:15 UTC (rev 14845)
@@ -230,3 +230,5 @@
 menu.cmd_acq_view_distrib_formula.tab=Distribution Formulas
 menu.local_admin.circ_matrix_matchpoint.tab=Circulation Policies
 menu.local_admin.hold_matrix_matchpoint.tab=Hold Policies
+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