obj.render_search_form(params);
}, 0);
},
- 'on_submit' : function(query) {
+ 'on_submit' : function(query,search_limit,search_sort) {
obj.controller.view.cmd_patron_retrieve.setAttribute('disabled','true');
obj.controller.view.cmd_patron_merge.setAttribute('disabled','true');
var list_frame = obj.right_deck.reset_iframe(
{},
{
'query' : query,
+ 'search_limit' : search_limit,
+ 'search_sort' : search_sort,
'on_select' : function(list) {
if (!list) return;
if (list.length < 1) return;
var obj = this;
+ // The bulk of params.query is getting parsed/rendered by obj.controller.init below, and will be reconstituted from possibly modified XUL elements upon Submit.
+ // But we're going to let search_limit and search_sort be configurable now by those spawning this interface, and let's assume there are no corresponding widgets for now.
+ // I'm going to place them into the "obj" scope for this instance.
+ obj.search_limit = params.param2;
+ obj.search_sort = JSON2js( params.param3 ); // Let's assume this is encoded as JSON
+
JSAN.use('OpenILS.data'); this.OpenILS = {};
obj.OpenILS.data = new OpenILS.data(); obj.OpenILS.data.init({'via':'stash'});
}
}
if (typeof obj.on_submit == 'function') {
- obj.on_submit(query);
+ obj.on_submit(query,obj.search_limit,obj.search_sort);
}
if (typeof window.xulG == 'object'
&& typeof window.xulG.on_submit == 'function') {
obj.error.sdump('D_PATRON','patron.search_form: Calling external .on_submit()\n');
- window.xulG.on_submit(query);
+ window.xulG.on_submit(query,obj.search_limit,obj.search_sort);
} else {
obj.error.sdump('D_PATRON','patron.search_form: No external .on_query()\n');
}
var obj = this;
obj.query = params['query'];
+ obj.search_limit = params['search_limit'];
+ obj.search_sort = params['search_sort'];
JSAN.use('OpenILS.data'); this.OpenILS = {};
obj.OpenILS.data = new OpenILS.data(); obj.OpenILS.data.init({'via':'stash'});
try {
var results = [];
- var params = [ ses(), search_hash, obj.result_cap + 1, [ 'family_name ASC', 'first_given_name ASC', 'second_given_name ASC', 'dob DESC' ] ];
+ var params = [
+ ses(),
+ search_hash,
+ typeof obj.search_limit != 'undefined' && typeof obj.search_limit != 'null' ? obj.search_limit : obj.result_cap + 1,
+ typeof obj.search_sort != 'undefined' ? obj.search_sort : [ 'family_name ASC', 'first_given_name ASC', 'second_given_name ASC', 'dob DESC' ]
+ ];
if (inactive) {
params.push(1);
if (document.getElementById('active')) {
alert($("patronStrings").getString('staff.patron.search_result.search.no_patrons_found'));
return;
}
- if (results.length == obj.result_cap+1) {
+ if (results.length == typeof obj.search_limit != 'undefined' && typeof obj.search_limit != 'null' ? obj.search_limit : obj.result_cap+1) {
results.pop();
- alert($("patronStrings").getFormattedString('staff.patron.search_result.search.capped_results', [obj.result_cap]));
+ alert($("patronStrings").getFormattedString('staff.patron.search_result.search.capped_results', [typeof obj.search_limit != 'undefined' && typeof obj.search_limit != 'null' ? obj.search_limit : obj.result_cap]));
}
} else {
alert($("patronStrings").getString('staff.patron.search_result.search.enter_search_terms'));
}
JSAN.use('patron.search_result'); g.search_result = new patron.search_result();
- g.search_result.init( { 'query' : query } );
+ g.search_result.init( { 'query' : query, 'search_limit' : xulG.search_limit, 'search_sort' : xulG.search_sort } );
} catch(E) {
var err_msg = $("commonStrings").getFormattedString('common.exception', ['patron/search_result.xul', E]);