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 */
var TERM;
var STYPE;
var LOCATION;
+var LASSO;
var DEPTH;
var FORM;
var OFFSET;
/* 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;
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;}
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') )
/* 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) {
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();
/* 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();
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();
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();