physical location mapping support, need to get confirmation from leddy before putting...
authorartunit <artunit@6d9bc8c9-1ec2-4278-b937-99fde70a366f>
Mon, 8 Nov 2010 01:52:55 +0000 (01:52 +0000)
committerartunit <artunit@6d9bc8c9-1ec2-4278-b937-99fde70a366f>
Mon, 8 Nov 2010 01:52:55 +0000 (01:52 +0000)
git-svn-id: svn://svn.open-ils.org/ILS-Contrib/conifer/branches/rel_1_6_1@1059 6d9bc8c9-1ec2-4278-b937-99fde70a366f

web/opac/skin/uwin/js/copy_details.js
web/opac/skin/uwin/js/rdetail.js

index b04c660..a064791 100644 (file)
@@ -34,7 +34,8 @@ function cpdBuild( contextTbody, contextRow, record, callnumber, orgid, depth, c
                unHideMe($n(templateRow, 'holdable_label'));
        }
 
-       if (isXUL() || showDueDate) {
+       //if (isXUL() || showDueDate) {
+       if (isXUL()) { 
                unHideMe($n(templateRow, 'due_date_label'));
        }
 
@@ -42,7 +43,7 @@ function cpdBuild( contextTbody, contextRow, record, callnumber, orgid, depth, c
 
        var print = $n(templateRow,'print');
        print.onclick = function() { cpdBuildPrintPane(
-               contextRow, record, callnumber, orgid, depth) };
+               contextRow, record, callnumber, orgid, depth, copy_location) };
 
        var mainTbody = $n(templateRow, 'copies_tbody');
        var extrasRow = mainTbody.removeChild($n(mainTbody, 'copy_extras_row'));
@@ -105,11 +106,11 @@ function cpdStylePopupWindow(div) {
 
 
 /* builds a friendly print window for this CNs data */
-function cpdBuildPrintPane(contextRow, record, callnumber, orgid, depth) {
+function cpdBuildPrintPane(contextRow, record, callnumber, orgid, depth, copy_location) {
 
        var div = cpdBuildPrintWindow( record, orgid);
 
-       $n(div, 'cn').appendChild(text(callnumber));
+       $n(div, 'cn').appendChild(sortOutCNmaps(orgid,callnumber,copy_location));
 
        unHideMe($n(div, 'copy_header'));
 
@@ -189,7 +190,8 @@ function cpdDrawCopies(r) {
                unHideMe($n(copyrow, 'copy_holdable_td'));
        }
 
-       if(isXUL() || showDueDate) {
+       //if(isXUL() || showDueDate) {
+       if(isXUL()) {
                unHideMe($n(copyrow, 'copy_due_date_td'));
        }
 
@@ -286,6 +288,8 @@ function cpdDrawCopy(r) {
                                 } else {
                                         $n(row, 'copy_due_date').appendChild(text(dojo.date.locale.format(due_time, {"selector": "date", "formatLength": "medium"})));
                                 }
+                               unHideMe($n(r.args.templateRow, 'due_date_label'));
+                               unHideMe($n(row, 'copy_due_date_td'));
                        }
                }
        }
index ceefcd8..5a79367 100644 (file)
@@ -12,18 +12,25 @@ var rdetailShowLocal = true;
 var rdetailShowCopyLocation = true;
 var rdetailGoogleBookPreview = true;
 var rdetailDisplaySerialHoldings = true;
-var rdetailEnableRefWorks = false;
+var rdetailEnableRefWorks = true;
 var rdetailRefWorksHost = 'http://refworks.scholarsportal.info';
 var enableHoldsOnAvailable = false;
 
 var urlCheck = true; //whether to use a url check to mask legacy urls
 var urlExpr = /webvoy|janus|resolver/i; //regular expression
+        
+/* assume 1 copy unless we look for more */
+var cpCnt = 1;
 
 /* threshold for paging */
 var rdetailBreakUpLargeSets = true; //flag for paging support
 var pgThreshold = 15; //the number of items to invoke paging
 var pgDisplay = 10; //number of items to display at a time
 
+/* used for call number checks */
+String.prototype.startsWith = function(str)
+{return (this.match("^"+str)==str)}
+
 /* vars vars vars */
 var record = null;
 var cp_statuses = null;
@@ -51,7 +58,35 @@ var rdetailNext = null;
 var rdetailStart = null;
 var rdetailEnd = null;
 
-       dojo.require("bibtemplate");
+/*
+this does simple call number mapping for building locations,
+we use prefix information for lining up location - array
+can be left blank if not used
+
+objCN(location id, prefix, location (to be appended to call number),
+       string to use for identifying building location from call number location)
+
+for example:
+  new objCN(109, 'QA', '2nd Floor', 'circulating')
+*/
+var cnMapping = [
+        new objCN(109, 'L', '3rd Floor', 'circulating'),
+       new objCN(109, 'QA', '2nd Floor', 'circulating')
+];
+
+function objCN(locId, cnPrefix, cnLocation, locStr)
+{
+       //org id
+        this.locId = locId;
+       //prefix - what the call number starts with to indicate building location, e.g. 'QA'
+        this.cnPrefix = cnPrefix;
+       //the location string to append to the call number
+        this.cnLocation = cnLocation;
+       //this is the string from the call number location that flags material, e.g. 'circulating', 'monographs'
+        this.locStr = locStr;
+}
+       
+dojo.require("bibtemplate");
 /* serials are currently the only use of Dojo strings in the OPAC */
 if (rdetailDisplaySerialHoldings) {
        dojo.require("dijit.Menu");
@@ -749,7 +784,6 @@ function rdetailShowTOC(r) {
 function rdetailBuildInfoRows() {
         var req;
         var method = FETCH_COPY_COUNTS_SUMMARY;
-        var cpCnt = 0;
 
         //we figure out the number of copies
         if (rdetailBreakUpLargeSets)
@@ -964,7 +998,7 @@ function _rdetailBuildInfoRows(r) {
                 unHideMe(rowNode);
 
                 rdetailSetPath( thisOrg, isLocal );
-                rdetailBuildBrowseInfo( rowNode, arr[1], isLocal, thisOrg, cl );
+                rdetailBuildBrowseInfo( rowNode, arr[1], isLocal, thisOrg, cl);
 
                 if( i == summary.length - 1 && !defaultCN) defaultCN = arr[1];
         }
@@ -1159,6 +1193,21 @@ function fillOutLinks(node, cpstart, cpsize, ssize, pieces) {
         }//if node
 }
 
+function sortOutCNmaps(orgId, cn, cl) {
+       var cnSuffix = '';
+        for (var i = 0; i < cnMapping.length && cnSuffix.length==0; i++) {
+               if (cnMapping[i].locId == orgId) {
+                       var pos = cl.indexOf(cnMapping[i].locStr);
+                       if (cn.startsWith(cnMapping[i].cnPrefix)) {
+                               //does call number location contain string?
+                               if (cl.indexOf(cnMapping[i].locStr) != -1)
+                                       cnSuffix = cnMapping[i].cnLocation;
+                       }//if
+               }//if 
+        }//for
+       return (text(cn + ' ' + cnSuffix));
+}//sortOutCNmaps
+
 function rdetailBuildBrowseInfo(row, cn, local, orgNode, cl) {
 
        if(local) {
@@ -1169,8 +1218,8 @@ function rdetailBuildBrowseInfo(row, cn, local, orgNode, cl) {
 
        var depth = getDepth();
        if( !local ) depth = findOrgDepth(globalOrgTree);
-
-       $n(row, 'rdetail_callnumber_cell').appendChild(text(cn));
+               
+        $n(row, 'rdetail_callnumber_cell').appendChild(sortOutCNmaps(orgNode.id(),cn, cl));
 
        if (rdetailShowCopyLocation) {
                var cl_cell = $n(row, 'rdetail_copylocation_cell');
@@ -1202,6 +1251,9 @@ function rdetailBuildBrowseInfo(row, cn, local, orgNode, cl) {
                                    );
                        req.send();
                };
+       } else {
+               if (cpCnt <= 1)
+                       eval(dHref);
        }
 }