[open-ils-commits] r9234 - in trunk/Open-ILS/web/opac: common/js skin/default/js

svn at svn.open-ils.org svn at svn.open-ils.org
Fri Apr 4 17:54:46 EDT 2008


Author: miker
Date: 2008-04-04 17:18:09 -0400 (Fri, 04 Apr 2008)
New Revision: 9234

Modified:
   trunk/Open-ILS/web/opac/common/js/config.js
   trunk/Open-ILS/web/opac/common/js/opac_utils.js
   trunk/Open-ILS/web/opac/common/js/org_utils.js
   trunk/Open-ILS/web/opac/skin/default/js/result_common.js
   trunk/Open-ILS/web/opac/skin/default/js/rresult.js
Log:
copy counts come back, but must be interpreted differently

Modified: trunk/Open-ILS/web/opac/common/js/config.js
===================================================================
--- trunk/Open-ILS/web/opac/common/js/config.js	2008-04-04 20:32:28 UTC (rev 9233)
+++ trunk/Open-ILS/web/opac/common/js/config.js	2008-04-04 21:18:09 UTC (rev 9234)
@@ -9,6 +9,7 @@
 var PARAM_TERM			= "t";			/* search term */
 var PARAM_STYPE		= "tp";			/* search type */
 var PARAM_LOCATION	= "l";			/* current location */
+var PARAM_LASSO	= "sg";			/* current location */
 var PARAM_DEPTH		= "d";			/* search depth */
 var PARAM_FORM			= "f";			/* search format */
 var PARAM_OFFSET		= "o";			/* search offset */
@@ -42,6 +43,7 @@
 var TERM;  
 var STYPE;  
 var LOCATION;  
+var LASSO;  
 var DEPTH;  
 var FORM; 
 var OFFSET;

Modified: trunk/Open-ILS/web/opac/common/js/opac_utils.js
===================================================================
--- trunk/Open-ILS/web/opac/common/js/opac_utils.js	2008-04-04 20:32:28 UTC (rev 9233)
+++ trunk/Open-ILS/web/opac/common/js/opac_utils.js	2008-04-04 21:18:09 UTC (rev 9234)
@@ -109,21 +109,21 @@
 	/* handle the location var */
 	var org;
 	var loc = cgi.param(PARAM_LOCATION);
+	var lasso = cgi.param(PARAM_LASSO);
 
+    if ( lasso ) {
+		lasso = findOrgLasso( lasso );
+		LASSO = lasso ? lasso.id() : null;
+	}
+
     if (loc) {
 		org = findOrgUnit(loc);
 		LOCATION = org ? org.id() : null;
 
-	    if( !LOCATION ) {
-            if ( loc < 0 ) {
-				org = findOrgLasso( -loc );
-				LOCATION = org ? -org.id() : null;
-			}
-			if ( !LOCATION ){
-				org = findOrgUnit(loc);
-				LOCATION = org ? org.id() : null;
-			}
-    	} 
+		if ( !LOCATION ){
+			org = findOrgUnit(loc);
+			LOCATION = org ? org.id() : null;
+		}
     }
 
 	org = null;
@@ -224,6 +224,7 @@
 function getTerm(){return TERM;}
 function getStype(){return STYPE;}
 function getLocation(){return LOCATION;}
+function getLasso(){return LASSO;}
 function getDepth(){return DEPTH;}
 function getForm(){return FORM;}
 function getTform(){return TFORM;}
@@ -357,6 +358,8 @@
 		string += _appendParam(STYPE,		PARAM_STYPE, args, getStype, string);
 	if(getLocation() != 1) 
 		string += _appendParam(LOCATION, PARAM_LOCATION, args, getLocation, string);
+	if(getLasso() != null) 
+		string += _appendParam(LASSO, PARAM_LASSO, args, getLasso, string);
 	if(getDepth() != null) 
 		string += _appendParam(DEPTH,		PARAM_DEPTH, args, getDepth, string);
 	if(getForm() && (getForm() != 'all') ) 

Modified: trunk/Open-ILS/web/opac/common/js/org_utils.js
===================================================================
--- trunk/Open-ILS/web/opac/common/js/org_utils.js	2008-04-04 20:32:28 UTC (rev 9233)
+++ trunk/Open-ILS/web/opac/common/js/org_utils.js	2008-04-04 21:18:09 UTC (rev 9234)
@@ -44,9 +44,7 @@
 /* returns an org unit by id.  if an object is passed in as the id,
 	then the object is assumed to be an org unit and is returned */
 function findOrgUnit(org_id) {
-	var o = (typeof org_id == 'object') ? org_id : orgArraySearcher[org_id];
-	if (!o) o = new aou();
-	return o;
+	return (typeof org_id == 'object') ? org_id : orgArraySearcher[org_id];
 }
 
 function findOrgLasso(lasso_id) {

Modified: trunk/Open-ILS/web/opac/skin/default/js/result_common.js
===================================================================
--- trunk/Open-ILS/web/opac/skin/default/js/result_common.js	2008-04-04 20:32:28 UTC (rev 9233)
+++ trunk/Open-ILS/web/opac/skin/default/js/result_common.js	2008-04-04 21:18:09 UTC (rev 9234)
@@ -63,7 +63,11 @@
 			limit = getHitCount() - getOffset();
 	}
 
-	args.org_unit = getLocation();
+	var lasso = getLasso();
+
+	if (lasso) args.org_unit = -lasso;
+	else args.org_unit = getLocation();
+
 	args.depth    = getDepth();
 	args.limit    = limit;
 	args.offset   = getOffset();
@@ -673,7 +677,12 @@
 /* collect copy counts for a record using method 'methodName' */
 function resultCollectCopyCounts(rec, pagePosition, methodName) {
 	if(rec == null || rec.doc_id() == null) return;
-	var req = new Request(methodName, getLocation(), rec.doc_id(), getForm() );
+
+	var loc = getLasso();
+	if (loc) loc = -loc;
+	else loc= getLocation();
+
+	var req = new Request(methodName, loc, rec.doc_id(), getForm() );
 	req.request.userdata = [ rec, pagePosition ];
 	req.callback(resultHandleCopyCounts);
 	req.send();

Modified: trunk/Open-ILS/web/opac/skin/default/js/rresult.js
===================================================================
--- trunk/Open-ILS/web/opac/skin/default/js/rresult.js	2008-04-04 20:32:28 UTC (rev 9233)
+++ trunk/Open-ILS/web/opac/skin/default/js/rresult.js	2008-04-04 21:18:09 UTC (rev 9234)
@@ -76,6 +76,10 @@
 		defaut:
 			var form = rresultGetForm();
 			var args = { format : form, org : getLocation(), depth : rresultGetDepth() };
+
+			var lasso = getLasso();
+			if (lasso) args.org = -lasso;
+
 			var req = new Request(FETCH_RIDS, getMrid(), args);
 			req.callback( rresultHandleRIds );
 			req.send();
@@ -210,6 +214,10 @@
 		rresultTries++;
 		var form = rresultGetForm();
 		var args = { format : form, org : getLocation(), depth : findOrgDepth(globalOrgTree) };
+
+		var lasso = getLasso();
+		if (lasso) args.org = -lasso;
+
 		var req = new Request(FETCH_RIDS, getMrid(), args );
 		req.callback( rresultHandleRIds );
 		req.send();



More information about the open-ils-commits mailing list