[open-ils-commits] r7684 -
branches/rel_1_2/Open-ILS/xul/staff_client/server/patron
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed Aug 15 17:55:23 EDT 2007
Author: phasefx
Date: 2007-08-15 17:51:26 -0400 (Wed, 15 Aug 2007)
New Revision: 7684
Modified:
branches/rel_1_2/Open-ILS/xul/staff_client/server/patron/search_form.js
branches/rel_1_2/Open-ILS/xul/staff_client/server/patron/search_form_overlay.xul
branches/rel_1_2/Open-ILS/xul/staff_client/server/patron/search_result.js
Log:
UI for patron search range/depth selection
Modified: branches/rel_1_2/Open-ILS/xul/staff_client/server/patron/search_form.js
===================================================================
--- branches/rel_1_2/Open-ILS/xul/staff_client/server/patron/search_form.js 2007-08-15 21:50:30 UTC (rev 7683)
+++ branches/rel_1_2/Open-ILS/xul/staff_client/server/patron/search_form.js 2007-08-15 21:51:26 UTC (rev 7684)
@@ -187,7 +187,14 @@
};
}
],
- 'inactive' : [ ['render'], function(e) { return function() {}; } ],
+ 'inactive' : [ ['render'], function(e) {
+ return function() {};
+ }
+ ],
+ 'search_depth' : [ ['render'],function(e) {
+ return function() {};
+ }
+ ],
}
}
);
@@ -202,6 +209,47 @@
}
document.getElementById('family_name').focus();
+ JSAN.use('util.file'); JSAN.use('util.widgets'); JSAN.use('util.functional');
+ util.widgets.remove_children(obj.controller.view.search_depth);
+ var ml = util.widgets.make_menulist(
+ util.functional.map_list( obj.OpenILS.data.list.aout,
+ function(el,idx) {
+ return [ el.opac_label(), el.depth() ]
+ }
+ ).sort(
+ function(a,b) {
+ if (a[1] < b[1]) return -1;
+ if (a[1] > b[1]) return 1;
+ return 0;
+ }
+ )
+ );
+ ml.addEventListener('command', function() {
+ ml.parentNode.setAttribute('value',ml.value);
+ var file = new util.file('patron_search_prefs.'+obj.OpenILS.data.server_unadorned);
+ util.widgets.save_attributes(file, { 'search_depth_ml' : [ 'value' ], 'inactive' : [ 'value' ] });
+ }, false
+ );
+ ml.setAttribute('id','search_depth_ml');
+ obj.controller.view.search_depth.appendChild(ml);
+
+ var file = new util.file('patron_search_prefs.'+obj.OpenILS.data.server_unadorned);
+ util.widgets.load_attributes(file);
+ ml.value = ml.getAttribute('value');
+ if (! ml.value) {
+ ml.value = 0
+ ml.setAttribute('value',ml.value);
+ }
+
+ var cb = obj.controller.view.inactive;
+ cb.addEventListener('command',function() {
+ cb.setAttribute('value',cb.checked ? "true" : "false");
+ var file = new util.file('patron_search_prefs.'+obj.OpenILS.data.server_unadorned);
+ util.widgets.save_attributes(file, { 'search_depth_ml' : [ 'value' ], 'inactive' : [ 'value' ] });
+ }, false
+ );
+ cb.checked = cb.getAttribute('value') == "true" ? true : false;
+
},
'on_submit' : function(q) {
@@ -214,27 +262,31 @@
var obj = this;
var query = {};
for (var i = 0; i < obj.controller.render_list.length; i++) {
- var id = obj.controller.render_list[i][0];
- var node = document.getElementById(id);
+ var id = obj.controller.render_list[i][0];
+ var node = document.getElementById(id);
if (node && node.value != '') {
if (id == 'inactive') {
query[id] = node.getAttribute('value');
obj.error.sdump('D_DEBUG','id = ' + id + ' value = ' + node.getAttribute('value') + '\n');
- } else {
- var value = node.value.replace(/^\s+/,'').replace(/[\\\s]+$/,'');
- //value = value.replace(/\d/g,'');
- switch(id) {
- case 'family_name' :
- case 'first_given_name' :
- case 'second_given_name' :
- value = value.replace(/^\W+/g,'').replace(/\W+$/g,'');
- break;
- }
- if (value != '') {
- query[id] = value;
- obj.error.sdump('D_DEBUG','id = ' + id + ' value = ' + value + '\n');
- }
- }
+ } else {
+ if (id == 'search_depth') {
+ query[id] = node.firstChild.getAttribute('value');
+ } else {
+ var value = node.value.replace(/^\s+/,'').replace(/[\\\s]+$/,'');
+ //value = value.replace(/\d/g,'');
+ switch(id) {
+ case 'family_name' :
+ case 'first_given_name' :
+ case 'second_given_name' :
+ value = value.replace(/^\W+/g,'').replace(/\W+$/g,'');
+ break;
+ }
+ if (value != '') {
+ query[id] = value;
+ obj.error.sdump('D_DEBUG','id = ' + id + ' value = ' + value + '\n');
+ }
+ }
+ }
}
}
if (typeof obj.on_submit == 'function') {
Modified: branches/rel_1_2/Open-ILS/xul/staff_client/server/patron/search_form_overlay.xul
===================================================================
--- branches/rel_1_2/Open-ILS/xul/staff_client/server/patron/search_form_overlay.xul 2007-08-15 21:50:30 UTC (rev 7683)
+++ branches/rel_1_2/Open-ILS/xul/staff_client/server/patron/search_form_overlay.xul 2007-08-15 21:51:26 UTC (rev 7684)
@@ -31,11 +31,12 @@
</columns>
<rows id="psr">
<row>
- <spacer />
- <hbox>
- <label control="inactive" accesskey="I" value="Include inactive patrons?"/>
- <checkbox id="inactive" value="unchecked" oncommand="if (this.getAttribute('value') == 'unchecked') this.setAttribute('value','checked'); else this.setAttribute('value','unchecked');"/>
- </hbox>
+ <label control="inactive" accesskey="I" value="Include inactive patrons?"/>
+ <checkbox id="inactive" />
+ </row>
+ <row>
+ <label control="search_range_menu" value="Limit results to patrons in"/>
+ <hbox id="search_depth" />
</row>
<row id="psr1">
<label id="psl1" control="family_name"
Modified: branches/rel_1_2/Open-ILS/xul/staff_client/server/patron/search_result.js
===================================================================
--- branches/rel_1_2/Open-ILS/xul/staff_client/server/patron/search_result.js 2007-08-15 21:50:30 UTC (rev 7683)
+++ branches/rel_1_2/Open-ILS/xul/staff_client/server/patron/search_result.js 2007-08-15 21:51:26 UTC (rev 7684)
@@ -154,6 +154,7 @@
var search_hash = {};
obj.search_term_count = 0;
var inactive = false;
+ var search_depth = 0;
for (var i in query) {
switch( i ) {
case 'phone': case 'ident':
@@ -183,6 +184,10 @@
case 'inactive':
if (query[i] == 'checked') inactive = true;
break;
+
+ case 'search_depth':
+ search_depth = function(a){return a;}(query[i]);
+ break;
}
}
try {
@@ -195,7 +200,10 @@
document.getElementById('active').setAttribute('hidden','false');
document.getElementById('active').hidden = false;
}
- }
+ } else {
+ params.push(0);
+ }
+ params.push(search_depth);
if (obj.search_term_count > 0) {
//alert('search params = ' + obj.error.pretty_print( js2JSON( params ) ) );
results = this.network.simple_request( 'FM_AU_IDS_RETRIEVE_VIA_HASH', params );
More information about the open-ils-commits
mailing list