TFORM = cgi.param(PARAM_TFORM);
RDEPTH = cgi.param(PARAM_RDEPTH);
AVAIL = cgi.param(PARAM_AVAIL);
+ COPYLOCS = cgi.param(PARAM_COPYLOCS);
+
/* set up some sane defaults */
//if(isNaN(DEPTH)) DEPTH = 0;
LANGUAGE = null;
RDEPTH = null;
AVAIL = null;
+ COPYLOCS = null;
}
function getLanguage() { return LANGUAGE; }
function getRdepth() { return RDEPTH; }
function getAvail() { return AVAIL; }
+function getCopyLocs() { return COPYLOCS; }
function findBasePath() {
string += _appendParam(SORT_DIR, PARAM_SORT_DIR, args, getSortDir, string);
if(getAvail())
string += _appendParam(AVAIL, PARAM_AVAIL, args, getAvail, string);
+ if(getCopyLocs())
+ string += _appendParam(COPYLOCS, PARAM_COPYLOCS, args, getCopyLocs, string);
return string.replace(/\&$/,'').replace(/\?\&/,"?");
}
attachEvt("common", "run", advgInit);
+attachEvt("common", "locationChanged", advSyncCopyLocLink );
var COOKIE_NOGROUP_RECORDS = 'grpt';
+var advSelectedOrg = null;
function advgInit() {
$('opac.result.limit2avail').checked = true;
initSearchBoxes();
+
+ advSyncCopyLocLink(getLocation());
+}
+
+function advSyncCopyLocLink(org) {
+ // display the option to filter by copy location
+ advLocationsLoaded = false;
+ advSelectedOrg = org;
+ removeChildren($('adv_copy_location_filter_select'));
+
+ if(isTrue(findOrgType(findOrgUnit(org).ou_type()).can_have_vols())) {
+ unHideMe($('adv_copy_location_filter_row'));
+ advLoadCopyLocations(org);
+ } else {
+ hideMe($('adv_copy_location_filter_row'));
+ }
+
}
function initSearchBoxes() {
var itemforms = advGetVisSelectorVals('adv_global_item_form');
var itemtypes = advGetVisSelectorVals('adv_global_item_type');
var audiences = advGetVisSelectorVals('adv_global_audience');
+ var locations = advGetVisSelectorVals('adv_copy_location_filter_select');
var languages = getSelectedList($('adv_global_lang')) + '';
var limit2avail = $('opac.result.limit2avail').checked ? 1 : ''
args[PARAM_LITFORM] = litforms;
args[PARAM_AUDIENCE] = audiences;
args[PARAM_LANGUAGE] = languages;
+ args[PARAM_COPYLOCS] = locations;
//args[PARAM_SEARCHES] = js2JSON(searches); /* break these out */
args[PARAM_DEPTH] = depthSelGetDepth();
args[PARAM_LOCATION] = depthSelGetNewLoc();
}
+// retrieves the shelving locations
+var advLocationsLoaded = false;
+function advLoadCopyLocations(org) {
+ if(org == null)
+ org = advSelectedOrg;
+ var req = new Request(FETCH_COPY_LOCATIONS, org);
+ req.callback(advShowCopyLocations);
+ req.send();
+ advLocationsLoaded = true;
+}
+
+// inserts the shelving locations into the multi-select
+function advShowCopyLocations(r) {
+ var locations = r.getResultObject();
+ var sel = $('adv_copy_location_filter_select');
+ for(var i = 0; i < locations.length; i++)
+ insertSelectorVal(sel, -1, locations[i].name(), locations[i].id());
+}