Enhance RefWorks support on a per-skin basis:
authordbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 14 Jul 2009 02:24:21 +0000 (02:24 +0000)
committerdbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 14 Jul 2009 02:24:21 +0000 (02:24 +0000)
  * Add the ability to disable it entirely (rdetailEnableRefWorks variable)
  * Add the ability to specify a different host for the RefWorks application (rdetailRefWorksHost)

Also, collect the growing list of configuration variables in rdetail.js at the head of the file.

git-svn-id: svn://svn.open-ils.org/ILS/trunk@13580 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/opac/skin/default/js/rdetail.js
Open-ILS/web/opac/skin/default/xml/page_rdetail.xml

index ff81d9f..c2db9d8 100644 (file)
@@ -1,12 +1,21 @@
 /* */
 
-
 detachAllEvt('common', 'run');
 attachEvt("common", "run", rdetailDraw);
 attachEvt("rdetail", "recordDrawn", rdetailBuildStatusColumns);
 attachEvt("rdetail", "recordDrawn", rdetailBuildInfoRows);
 attachEvt("rdetail", "recordDrawn", rdetailGetPageIds);
 
+/* Per-skin configuration settings */
+var rdetailLocalOnly = true;
+var rdetailShowLocal = true;
+var rdetailShowCopyLocation = true;
+var rdetailGoogleBookPreview = true;
+var rdetailDisplaySerialHoldings = true;
+var rdetailEnableRefWorks = true;
+var rdetailRefWorksHost = 'http://www.refworks.com';
+
+/* vars vars vars */
 var record = null;
 var cp_statuses = null;
 var recordsCache = [];
@@ -17,33 +26,14 @@ var statusRow = null;
 var numStatuses = null;
 var defaultCN;
 var callnumberCache = {};
-var rdetailLocalOnly = true;
 var globalCNCache = {};
 var localTOC;
 var cachedRecords;
 var _statusPositions = {};
-
-var rdetailShowLocal = true;
-var rdetailShowCopyLocation = true;
-var googleBookPreview = true;
-var displaySerialHoldings = true;
 var opac_strings;
 
-/* serials are currently the only use of Dojo strings in the OPAC */
-if (displaySerialHoldings) {
-       dojo.requireLocalization("openils.opac", "opac");
-       opac_strings = dojo.i18n.getLocalization("openils.opac", "opac");
-}
-
 var nextContainerIndex;
 
-function rdetailReload() {
-       var args = {};
-       args[PARAM_LOCATION] = getNewSearchLocation();
-       args[PARAM_DEPTH] = depthSelGetDepth();
-       goTo(buildOPACLink(args));
-}
-
 var nextRecord;
 var prevRecord;
 
@@ -52,7 +42,18 @@ var rdetailNext = null;
 var rdetailStart = null;
 var rdetailEnd = null;
 
+/* serials are currently the only use of Dojo strings in the OPAC */
+if (rdetailDisplaySerialHoldings) {
+       dojo.requireLocalization("openils.opac", "opac");
+       opac_strings = dojo.i18n.getLocalization("openils.opac", "opac");
+}
 
+function rdetailReload() {
+       var args = {};
+       args[PARAM_LOCATION] = getNewSearchLocation();
+       args[PARAM_DEPTH] = depthSelGetDepth();
+       goTo(buildOPACLink(args));
+}
 
 /* looks to see if we have a next and/or previous record in the
    record cache, if so, set up the nav links */
@@ -124,7 +125,7 @@ function rdetailDraw() {
        req.callback(_rdetailDraw);
        req.send();
 
-       if (displaySerialHoldings) {
+       if (rdetailDisplaySerialHoldings) {
                var req = new Request(FETCH_MFHD_SUMMARY, getRid());
                req.callback(_holdingsDraw);
                req.send();
@@ -368,24 +369,26 @@ function _rdetailDraw(r) {
        $('rdetail_place_hold').setAttribute(
                        'href','javascript:holdsDrawEditor({record:"'+record.doc_id()+'",type:"T"});');
 
-    var RW = $('rdetail_exp_refworks');
-    if (RW) {
-
-        var here = (findOrgUnit(getLocation())).name();
-        var org_name = here.replace(" ", "+");
-        var cgi = new CGI();
-        
-       RW.setAttribute(
-                'href',
-                'http://www.refworks.com/express/expressimport.asp?vendor='
-                    + org_name
-                    + '&filter=MARC+Format&database=All+MARC+Formats&encoding=65001&url=http%3A%2F%2F'
-                    + cgi.server_name+'/opac/extras/supercat/marctxt/record/'
-                    + record.doc_id()
-        );
-
-       RW.setAttribute('target', 'RefWorksMain');
-    }
+       var RW = $('rdetail_exp_refworks');
+       if (RW && rdetailEnableRefWorks) {
+
+               var here = (findOrgUnit(getLocation())).name();
+               var org_name = here.replace(" ", "+");
+               var cgi = new CGI();
+
+               RW.setAttribute(
+                       'href',
+                       rdetailRefWorksHost + '/express/expressimport.asp?vendor='
+                       + org_name
+                       + '&filter=MARC+Format&database=All+MARC+Formats&encoding=65001&url=http%3A%2F%2F'
+                       + cgi.server_name + '/opac/extras/supercat/marctxt/record/'
+                       + record.doc_id()
+              );
+
+               RW.setAttribute('target', 'RefWorksMain');
+
+               unHideMe($('rdetail_exp_refworks_span'));
+       }
 
        $('rdetail_img_link').setAttribute('href', buildISBNSrc(cleanISBN(record.isbn()), 'large'));
        G.ui.rdetail.image.setAttribute("src", buildISBNSrc(cleanISBN(record.isbn())));
@@ -933,7 +936,7 @@ function _rdetailSortStatuses(a, b) {
  * Check for a Google Book preview 
  */
 function rdetailCheckForGBPreview() {
-       if (!googleBookPreview) return;
+       if (!rdetailGoogleBookPreview) return;
        searchForGBPreview( cleanISBN(record.isbn()) );
 }
 
index b91dbd4..88b7a24 100644 (file)
                                        <span>&rdetail.detailMain.headerLabel;</span>
                                </td>
 
-                <td align='right' style='padding-right: 7px;' width='33%'>
-                                   <span style='padding-right: 7px;'>
-                        <a id='rdetail_exp_refworks'>&opac.holds.exportRefWorks;</a>
-                   </span>
-                   <span style='padding-right: 7px;'>
-
+                               <td align='right' style='padding-right: 7px;' width='33%'>
+                                       <span id='rdetail_exp_refworks_span' class='hide_me' style='padding-right: 7px;'>
+                                               <a id='rdetail_exp_refworks'>&opac.holds.exportRefWorks;</a>
+                                       </span>
+                                       <span style='padding-right: 7px;'>
                                                <a id='rdetail_place_hold' class='classic_link'>&opac.holds.placeHold;</a>
                                        </span>
                                        <span style='padding-right: 7px;' class='hide_me' id='rdetail_more_actions'>