From cedf3685e166614a7c4fe68b60ac1ae950f88c82 Mon Sep 17 00:00:00 2001 From: Thomas Berezansky Date: Wed, 21 Sep 2011 11:35:24 -0400 Subject: [PATCH] Create preference for opac used in staff client If enabled use the TPac. Otherwise JSPac. Signed-off-by: Thomas Berezansky Signed-off-by: Dan Scott --- .../xul/staff_client/chrome/content/main/constants.js | 19 +++++++++++++++++-- .../xul/staff_client/defaults/preferences/prefs.js | 3 +++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Open-ILS/xul/staff_client/chrome/content/main/constants.js b/Open-ILS/xul/staff_client/chrome/content/main/constants.js index 257dea7cc6..6e2391cbb3 100644 --- a/Open-ILS/xul/staff_client/chrome/content/main/constants.js +++ b/Open-ILS/xul/staff_client/chrome/content/main/constants.js @@ -13,9 +13,9 @@ dump('Loading constants.js\n'); /* Get locale from preferences */ var LOCALE = ''; +netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); +var pref = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch); try { - netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); - var pref = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch); LOCALE = pref.getCharPref('general.useragent.locale'); } catch (E) { dump("Failed to fetch a locale from preferences: " + E + "\n"); @@ -26,6 +26,13 @@ if (!LOCALE) { LOCALE = 'en-US'; } +var use_tpac = false; +try { + use_tpac = pref.getBoolPref('oils.use_tpac'); +} catch (E) { + dump("Failed to get TPac preference: " + E + "\n"); +} + const MODE_RDONLY = 0x01; const MODE_WRONLY = 0x02; const MODE_CREATE = 0x08; @@ -502,3 +509,11 @@ var urls = { 'EG_ACQ_USER_REQUESTS' : '/eg/acq/picklist/user_request', 'XUL_SERIAL_BATCH_RECEIVE': '/xul/server/serial/batch_receive.xul' } + +if(use_tpac) { + urls['opac'] = '/eg/opac/advanced'; + urls['opac_rdetail'] = '/eg/opac/record/'; + urls['opac_rresult'] = '/eg/opac/results'; + urls['opac_rresult_metarecord'] = '/eg/opac/results?metarecord='; + urls['browser'] = urls.opac; +} diff --git a/Open-ILS/xul/staff_client/defaults/preferences/prefs.js b/Open-ILS/xul/staff_client/defaults/preferences/prefs.js index 19dcd2a91f..3870af4686 100644 --- a/Open-ILS/xul/staff_client/defaults/preferences/prefs.js +++ b/Open-ILS/xul/staff_client/defaults/preferences/prefs.js @@ -26,3 +26,6 @@ pref("open-ils.menu.toolbar.iconsize", ""); pref("open-ils.menu.toolbar.mode", ""); pref("open-ils.menu.toolbar.labelbelow", false); pref("open-ils.toolbar.defaultnewtab", false); + +// Template Toolkit Opac Enabled in Staff Client +pref("oils.use_tpac", false); -- 2.11.0