Not tested, but let the keys 'search_limit' and 'search_sort' be useable in the JSON...
authorphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 15 Jul 2009 19:17:50 +0000 (19:17 +0000)
committerphasefx <phasefx@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 15 Jul 2009 19:17:50 +0000 (19:17 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@13607 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/server/patron/display.js
Open-ILS/xul/staff_client/server/patron/search_form.js
Open-ILS/xul/staff_client/server/patron/search_result.js
Open-ILS/xul/staff_client/server/patron/search_result.xul

index 35aadb9..e4350f5 100644 (file)
@@ -698,7 +698,7 @@ patron.display.prototype = {
                                                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(
@@ -706,6 +706,8 @@ patron.display.prototype = {
                                                {},
                                                {
                                                        'query' : query,
+                                                       'search_limit' : search_limit,
+                                                       'search_sort' : search_sort,
                                                        'on_select' : function(list) {
                                                                if (!list) return;
                                                                if (list.length < 1) return;
index 7675904..b0b101e 100644 (file)
@@ -14,6 +14,12 @@ patron.search_form.prototype = {
 
                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'});
 
@@ -329,12 +335,12 @@ patron.search_form.prototype = {
                        }
                }
                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');
                }
index 44ba0a0..9f304d6 100644 (file)
@@ -19,6 +19,8 @@ patron.search_result.prototype = {
                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'});
@@ -183,7 +185,12 @@ patron.search_result.prototype = {
                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')) {
@@ -203,9 +210,9 @@ patron.search_result.prototype = {
                                        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'));
index 53b7781..a037dce 100644 (file)
@@ -56,7 +56,7 @@
                                }
 
                                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]);