[open-ils-commits] r1059 - conifer/branches/rel_1_6_1/web/opac/skin/uwin/js (artunit)

svn at svn.open-ils.org svn at svn.open-ils.org
Sun Nov 7 20:52:56 EST 2010


Author: artunit
Date: 2010-11-07 20:52:55 -0500 (Sun, 07 Nov 2010)
New Revision: 1059

Modified:
   conifer/branches/rel_1_6_1/web/opac/skin/uwin/js/copy_details.js
   conifer/branches/rel_1_6_1/web/opac/skin/uwin/js/rdetail.js
Log:
physical location mapping support, need to get confirmation from leddy before putting into production

Modified: conifer/branches/rel_1_6_1/web/opac/skin/uwin/js/copy_details.js
===================================================================
--- conifer/branches/rel_1_6_1/web/opac/skin/uwin/js/copy_details.js	2010-11-07 21:37:08 UTC (rev 1058)
+++ conifer/branches/rel_1_6_1/web/opac/skin/uwin/js/copy_details.js	2010-11-08 01:52:55 UTC (rev 1059)
@@ -34,7 +34,8 @@
 		unHideMe($n(templateRow, 'holdable_label'));
 	}
 
-	if (isXUL() || showDueDate) {
+	//if (isXUL() || showDueDate) {
+	if (isXUL()) { 
 		unHideMe($n(templateRow, 'due_date_label'));
 	}
 
@@ -42,7 +43,7 @@
 
 	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 @@
 
 
 /* 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 @@
 		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 @@
                                 } 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'));
 			}
 		}
 	}

Modified: conifer/branches/rel_1_6_1/web/opac/skin/uwin/js/rdetail.js
===================================================================
--- conifer/branches/rel_1_6_1/web/opac/skin/uwin/js/rdetail.js	2010-11-07 21:37:08 UTC (rev 1058)
+++ conifer/branches/rel_1_6_1/web/opac/skin/uwin/js/rdetail.js	2010-11-08 01:52:55 UTC (rev 1059)
@@ -12,18 +12,25 @@
 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 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 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 @@
                 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 @@
         }//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,9 +1218,9 @@
 
 	var depth = getDepth();
 	if( !local ) depth = findOrgDepth(globalOrgTree);
+		
+        $n(row, 'rdetail_callnumber_cell').appendChild(sortOutCNmaps(orgNode.id(),cn, cl));
 
-	$n(row, 'rdetail_callnumber_cell').appendChild(text(cn));
-
 	if (rdetailShowCopyLocation) {
 		var cl_cell = $n(row, 'rdetail_copylocation_cell');
 		cl_cell.appendChild(text(cl));
@@ -1202,6 +1251,9 @@
 				    );
 			req.send();
 		};
+	} else {
+		if (cpCnt <= 1)
+			eval(dHref);
 	}
 }
 



More information about the open-ils-commits mailing list