[open-ils-commits] r16585 - trunk/Open-ILS/web/opac/skin/default/js (erickson)

svn at svn.open-ils.org svn at svn.open-ils.org
Thu Jun 3 15:56:58 EDT 2010


Author: erickson
Date: 2010-06-03 15:56:53 -0400 (Thu, 03 Jun 2010)
New Revision: 16585

Modified:
   trunk/Open-ILS/web/opac/skin/default/js/rdetail.js
Log:
implemented a simple mechanism to allow for linking to record detail pages by ISBN.  If no record ID is present in the URL and the URL has a search type of isbn and an isbn value, do an ISBN lookup and display the first record we get back from the search.

Modified: trunk/Open-ILS/web/opac/skin/default/js/rdetail.js
===================================================================
--- trunk/Open-ILS/web/opac/skin/default/js/rdetail.js	2010-06-03 19:33:11 UTC (rev 16584)
+++ trunk/Open-ILS/web/opac/skin/default/js/rdetail.js	2010-06-03 19:56:53 UTC (rev 16585)
@@ -1,3 +1,4 @@
+
 /* */
 
 detachAllEvt('common', 'run');
@@ -123,10 +124,34 @@
 	if(getLocation() == globalOrgTree.id())
 		hideMe(G.ui.rdetail.cp_info_all);
 
-	var req = new Request(FETCH_RMODS, getRid());
-	req.callback(_rdetailDraw);
-	req.send();
+    if(getRid()) {
 
+	    var req = new Request(FETCH_RMODS, getRid());
+	    req.callback(_rdetailDraw);
+	    req.send();
+
+    } else { // No record ID was specified
+
+       // If we have an ISBN in the URL, let's try to find that record
+       // This allows direct linking by ISBN.
+       // Note, this uses the first record it finds
+       if(getRtype() == RTYPE_ISBN) { 
+            var req = new Request(FETCH_ADV_ISBN_RIDS, getAdvTerm() );
+            req.callback(
+                function(r) {
+                    var blob = r.getResultObject();
+                    if(blob && blob.count > 0) 
+                        RID = blob.ids[0]; 
+                    var req2 = new Request(FETCH_RMODS, getRid());
+                    req2.callback(_rdetailDraw);
+                    req2.send();
+                }
+            );
+            req.send();
+        }
+    }
+
+
 	if (rdetailDisplaySerialHoldings) {
 		var req = new Request(FETCH_MFHD_SUMMARY, getRid());
 		req.callback(_holdingsDraw);



More information about the open-ils-commits mailing list