"limit": 10,
"last_fetch": null,
+ "org_unit_getter": null,
"constructor": function(/* object */ args) {
dojo.mixin(this, args); /* XXX very sloppy */
var limit = (!isNaN(req.count) && req.count != Infinity) ?
req.count : this.limit;
- if (!term || term.length < 1 || term == "*")
- return null;
-
- if (term.match(/[^\s*]$/))
- term += " ";
+ if (!term || term.length < 1 || term == "*") return null;
+ if (term.match(/[^\s*]$/)) term += " ";
term = term.replace(/\*$/, "");
- return "/opac/extras/autosuggest?" + [
+ var params = [
"query=" + encodeURI(term),
"search_class=" + this.type_selector.value,
"limit=" + limit
- ].join("&");
+ ];
+
+ if (typeof this.org_unit_getter == "function")
+ params.push("org_unit=" + this.org_unit_getter());
+
+ return "/opac/extras/autosuggest?" + params.join("&");
},
/* *** Begin dojo.data.api.Read methods *** */
function autoSuggestInit() {
var widg = new openils.widget.AutoSuggest(
{
- "storeArgs": {"type_selector": G.ui.searchbar.type_selector},
+ "storeArgs": {
+ "type_selector": G.ui.searchbar.type_selector,
+ "org_unit_getter": depthSelGetNewLoc
+ },
"onChange": function(value) {
if (typeof value.field == "number")
updateSearchTypeSelector(value.field);