From 80ac30bad9e2c0cd8886d2ec7a9ae3137c0cb79c Mon Sep 17 00:00:00 2001 From: phasefx Date: Mon, 9 Nov 2009 18:46:36 +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/trunk@14844 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../staff_client/chrome/content/OpenILS/data.js | 3 +++ .../xul/staff_client/chrome/content/util/print.js | 14 +++++++++++++- .../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 1cf9ab14c2..b6e8e38cab 100644 --- a/Open-ILS/xul/staff_client/chrome/content/OpenILS/data.js +++ b/Open-ILS/xul/staff_client/chrome/content/OpenILS/data.js @@ -445,6 +445,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 97078cbc07..0a757dc552 100644 --- a/Open-ILS/xul/staff_client/chrome/content/util/print.js +++ b/Open-ILS/xul/staff_client/chrome/content/util/print.js @@ -411,12 +411,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; @@ -430,6 +431,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 f95bf1cd31..12f372383d 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 @@ -231,3 +231,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 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 -- 2.43.2