Create custom.js for staff client
authorJeff Godin <jgodin@tadl.org>
Thu, 26 Jul 2012 06:26:13 +0000 (02:26 -0400)
committerJeff Godin <jgodin@tadl.org>
Thu, 26 Jul 2012 06:26:13 +0000 (02:26 -0400)
Using custom.js, specify a jspac skin name for the staff client in a
tpac-aware fashion.

The "tadl-staff" skin will likely just be a copy of the default
skin, or possibly a symlink.

We want to be able to redirect requests for the "default" skin's xml
pages to tpac without redirecting staff.

Signed-off-by: Jeff Godin <jgodin@tadl.org>
Open-ILS/xul/staff_client/server/index.xhtml
Open-ILS/xul/staff_client/server/skin/custom.js [new file with mode: 0644]

index 15d77c2..64ab098 100644 (file)
@@ -76,6 +76,8 @@
 </script>
   <script type="text/javascript" src="main/JSAN.js">
 </script>
+  <script type="text/javascript" src="skin/custom.js">
+</script>
   <script type="text/javascript">
       // <![CDATA[
         
diff --git a/Open-ILS/xul/staff_client/server/skin/custom.js b/Open-ILS/xul/staff_client/server/skin/custom.js
new file mode 100644 (file)
index 0000000..a665966
--- /dev/null
@@ -0,0 +1,35 @@
+/* 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 {
+    LOCALE = pref.getCharPref('general.useragent.locale');
+} catch (E) {
+    dump("Failed to fetch a locale from preferences: " + E + "\n");
+}
+
+/* Fall back to en-US if we didn't get a locale from the preferences */
+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");
+}
+
+urls['opac'] = '/opac/' + LOCALE + '/skin/tadl-staff/xml/advanced.xml?nps=1';
+urls['opac_rdetail'] = '/opac/' + LOCALE + '/skin/tadl-staff/xml/rdetail.xml';
+urls['opac_rresult'] = '/opac/' + LOCALE + '/skin/tadl-staff/xml/rresult.xml';
+urls['browser'] = '/opac/' + LOCALE + '/skin/tadl-staff/xml/advanced.xml?nps=1';
+
+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;
+    pref.setBoolPref('oils.secure_opac',true);
+}