From 5deb1068b2902ab6945bb92fb2a69d47c0a3a123 Mon Sep 17 00:00:00 2001 From: phasefx Date: Mon, 9 Nov 2009 18:54:18 +0000 Subject: [PATCH] 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. git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_1_6_0@14846 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/xul/staff_client/chrome/content/OpenILS/data.js | 3 +++ Open-ILS/xul/staff_client/chrome/content/util/print.js | 14 +++++++++++++- .../staff_client/chrome/locale/en-US/offline.properties | 2 ++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/Open-ILS/xul/staff_client/chrome/content/OpenILS/data.js b/Open-ILS/xul/staff_client/chrome/content/OpenILS/data.js index d8fae73d8f..8a23cf40ab 100644 --- a/Open-ILS/xul/staff_client/chrome/content/OpenILS/data.js +++ b/Open-ILS/xul/staff_client/chrome/content/OpenILS/data.js @@ -416,6 +416,9 @@ OpenILS.data.prototype = { } 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'); diff --git a/Open-ILS/xul/staff_client/chrome/content/util/print.js b/Open-ILS/xul/staff_client/chrome/content/util/print.js index 619dbc2206..a00f3eeebf 100644 --- a/Open-ILS/xul/staff_client/chrome/content/util/print.js +++ b/Open-ILS/xul/staff_client/chrome/content/util/print.js @@ -405,12 +405,13 @@ util.print.prototype = { '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 @@ util.print.prototype = { 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); } diff --git a/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties b/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties index 97381f4387..b7ac048899 100644 --- a/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties +++ b/Open-ILS/xul/staff_client/chrome/locale/en-US/offline.properties @@ -230,3 +230,5 @@ menu.cmd_acq_view_exchange_rate.tab=Exchange Rates 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 -- 2.11.0