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

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Nov 9 15:42:57 EST 2010


Author: artunit
Date: 2010-11-09 15:42:52 -0500 (Tue, 09 Nov 2010)
New Revision: 1062

Modified:
   conifer/branches/rel_1_6_1/web/opac/skin/uwin/js/rdetail.js
Log:
physical location mapping support revised

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-08 20:37:05 UTC (rev 1061)
+++ conifer/branches/rel_1_6_1/web/opac/skin/uwin/js/rdetail.js	2010-11-09 20:42:52 UTC (rev 1062)
@@ -60,26 +60,46 @@
 
 /*
 this does simple call number mapping for building locations,
-we use prefix information for lining up location - array
+we use call number regular expression for lining up location - array
 can be left blank if not used
 
-objCN(location id, prefix, location (to be appended to call number),
+objCN(location id, regular expression, 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')
+  new objCN(109, '^[A-G]|^H[A-C]', '2nd Floor', 'circulating')
 */
+/*
+Leddy Mappings - as of Nov. 9, 2010
+
+	Books
+	A - HC	2nd Floor Main Building
+	HD - QE	3rd Floor Main Building
+	QH - ZA	4th Floor Main Building
+
+	Serials
+	A - HC	3rd Floor West Building
+	HD - LA	2nd Floor West Building
+	LB - QC	1st Floor West Building
+	QD - Z	Basement Floor West Building
+*/
 var cnMapping = [
-        new objCN(109, 'L', '3rd Floor', 'circulating'),
-	new objCN(109, 'QA', '2nd Floor', 'circulating')
+        new objCN(109, '^[A-G]|^H[A-C\\d*\\s*]', '- 2nd Floor, Main Bldng', '(circulating)'),
+	new objCN(109, '^HD*|^[I-P]|^Q[A-E]', '- 3rd Floor, Main Bldng', '(circulating)'),
+	new objCN(109, '^Q[H-Z]|^[R-Y]|^Z[A\\d*\\s*]', '- 4th Floor, Main Bldng', '(circulating)'),
+	new objCN(109, '^[A-G]|^H[A-C\\d*\\s*]', '- 3rd Floor, West Bldng', 'Serials'),
+	new objCN(109, '^HD*|^[I-J]|^L[A\\d*\\s*]', '- 2nd Floor, West Bldng', 'Serials'),
+	new objCN(109, '^L[B-Z]|^[M-P]|^Q[A-C\\d*\\s*]', '- 1st Floor, West Bldng', 'Serials'),
+	new objCN(109, '^Q[D-Z]|^[R-Z]', '- Basement Floor, West Bldng', 'Serials')
+
 ];
 
-function objCN(locId, cnPrefix, cnLocation, locStr)
+function objCN(locId, cnRegExp, cnLocation, locStr)
 {
 	//org id
         this.locId = locId;
-	//prefix - what the call number starts with to indicate building location, e.g. 'QA'
-        this.cnPrefix = cnPrefix;
+	//regexp - what to use to match on call number range
+        this.cnRegExp = cnRegExp;
 	//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'
@@ -1195,12 +1215,15 @@
 
 function sortOutCNmaps(orgId, cn, cl) {
 	var cnSuffix = '';
+	var re = null;
+	var match = null;
+
         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)
+			if (cl.indexOf(cnMapping[i].locStr) != -1) {
+				re = new RegExp(cnMapping[i].cnRegExp);
+				match = re.exec(cn);
+				if (match != null)
 					cnSuffix = cnMapping[i].cnLocation;
 			}//if
 		}//if 



More information about the open-ils-commits mailing list