From 51283bf4cde53bdae0fc276be61d76b63eec3afa Mon Sep 17 00:00:00 2001 From: artunit Date: Tue, 9 Nov 2010 20:42:52 +0000 Subject: [PATCH] physical location mapping support revised git-svn-id: svn://svn.open-ils.org/ILS-Contrib/conifer/branches/rel_1_6_1@1062 6d9bc8c9-1ec2-4278-b937-99fde70a366f --- web/opac/skin/uwin/js/rdetail.js | 47 ++++++++++++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 12 deletions(-) diff --git a/web/opac/skin/uwin/js/rdetail.js b/web/opac/skin/uwin/js/rdetail.js index 5a79367526..59ce894e87 100644 --- a/web/opac/skin/uwin/js/rdetail.js +++ b/web/opac/skin/uwin/js/rdetail.js @@ -60,26 +60,46 @@ var rdetailEnd = null; /* 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 fillOutLinks(node, cpstart, cpsize, ssize, pieces) { 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 -- 2.11.0