From 0bba2e0c63ba4ed126bf6a77fb1e51ee73a28912 Mon Sep 17 00:00:00 2001 From: Joseph Lewis Date: Thu, 9 Jun 2011 15:14:22 -0600 Subject: [PATCH] Updated the staff_client code to be much better at searching, renamed the sql upgrade script b/c 0549 was just snatched up! Signed-off-by: Joseph Lewis Signed-off-by: Thomas Berezansky Signed-off-by: Jason Etheridge --- ...up.sql => 0550.data.seed_values_ous_groups.sql} | 33 +++++++++++----------- .../staff_client/server/admin/org_unit_settings.js | 23 ++++++++++----- 2 files changed, 33 insertions(+), 23 deletions(-) rename Open-ILS/src/sql/Pg/upgrade/{0549.data.seed_values_admin_cleanup.sql => 0550.data.seed_values_ous_groups.sql} (93%) diff --git a/Open-ILS/src/sql/Pg/upgrade/0549.data.seed_values_admin_cleanup.sql b/Open-ILS/src/sql/Pg/upgrade/0550.data.seed_values_ous_groups.sql similarity index 93% rename from Open-ILS/src/sql/Pg/upgrade/0549.data.seed_values_admin_cleanup.sql rename to Open-ILS/src/sql/Pg/upgrade/0550.data.seed_values_ous_groups.sql index af87cdfc2d..bbff1ef1f3 100644 --- a/Open-ILS/src/sql/Pg/upgrade/0549.data.seed_values_admin_cleanup.sql +++ b/Open-ILS/src/sql/Pg/upgrade/0550.data.seed_values_ous_groups.sql @@ -1,24 +1,25 @@ +-- Add groups to config settings. BEGIN; -INSERT INTO config.upgrade_log (version) VALUES ('0549'); --dbs +INSERT INTO config.upgrade_log (version) VALUES ('0550'); --dbs -- config settings group INSERT INTO config.settings_group (name, label) VALUES -('sys', 'System'), -('finance','Finances'), -('holds','Holds'), -('circ','Circulation'), -('self','Self Check'), -('opac','OPAC'), -('gui','GUI'), -('lib','Library'), -('sec','Security'), -('prog','Program'), -('glob','Global'), -('credit','Credit Card Processing'), -('cat','Cataloging'), -('serial','Serials'), -('recall','Recalls'); +('sys', oils_i18n_gettext('config.settings_group.system', 'System', 'coust', 'label')), +('gui', oils_i18n_gettext('config.settings_group.gui', 'GUI', 'coust', 'label')), +('lib', oils_i18n_gettext('config.settings_group.lib', 'Library', 'coust', 'label')), +('sec', oils_i18n_gettext('config.settings_group.sec', 'Security', 'coust', 'label')), +('cat', oils_i18n_gettext('config.settings_group.cat', 'Cataloging', 'coust', 'label')), +('holds', oils_i18n_gettext('config.settings_group.holds', 'Holds', 'coust', 'label')), +('circ', oils_i18n_gettext('config.settings_group.circulation', 'Circulation', 'coust', 'label')), +('self', oils_i18n_gettext('config.settings_group.self', 'Self Check', 'coust', 'label')), +('opac', oils_i18n_gettext('config.settings_group.opac', 'OPAC', 'coust', 'label')), +('prog', oils_i18n_gettext('config.settings_group.program', 'Program', 'coust', 'label')), +('glob', oils_i18n_gettext('config.settings_group.global', 'Global', 'coust', 'label')), +('finance', oils_i18n_gettext('config.settings_group.finances', 'Finanaces', 'coust', 'label')), +('credit', oils_i18n_gettext('config.settings_group.ccp', 'Credit Card Processing', 'coust', 'label')), +('serial', oils_i18n_gettext('config.settings_group.serial', 'Serials', 'coust', 'label')), +('recall', oils_i18n_gettext('config.settings_group.recall', 'Recalls', 'coust', 'label')); -- Set up all of the config.org_unit_setting_type[s] with a proper group. UPDATE config.org_unit_setting_type SET grp = 'cat' WHERE name = 'cat.bib.delete_on_no_copy_via_acq_lineitem_cancel'; diff --git a/Open-ILS/xul/staff_client/server/admin/org_unit_settings.js b/Open-ILS/xul/staff_client/server/admin/org_unit_settings.js index d243c1813a..daea5193d9 100644 --- a/Open-ILS/xul/staff_client/server/admin/org_unit_settings.js +++ b/Open-ILS/xul/staff_client/server/admin/org_unit_settings.js @@ -105,16 +105,15 @@ function osDraw(specific_setting) { var tmp = "" + type.label() + "" + type.description() + "" + type.fm_class() + "" + osGroups[type.grp()] + "" + type.name(); - searchAssist[type.name()] = tmp.toLowerCase().replace(/[^a-z0-9]+/, ''); + searchAssist[type.name()] = tmp.toLowerCase().replace(/[^a-z0-9]+/g, ''); } ); for(var key in osSettings) names.push(key); } - - osDrawNames(names); + osDrawNames(names); } //Limits those functions seen to the ones that have similar text to @@ -122,14 +121,24 @@ function osDraw(specific_setting) { function osLimitSeen(text) { showProcessingDialog(true); - text = text.toLowerCase().replace(/[^a-z0-9]+/, ''); + text = text.split(' '); + + for(t in text) + text[t] = text[t].toLowerCase().replace(/[^a-z0-9]+/g, ''); - console.log(text); + numTerms = text.length; var names = []; - for(var n in searchAssist) - if(searchAssist[n].indexOf(text) != -1) + for(var n in searchAssist) { + var numFound = 0; + + for(var t in text) + if(searchAssist[n].indexOf(text[t]) != -1) + numFound++; + + if(numFound == numTerms) names.push(n); + } //Don't update on an empty list as this causes bizarre errors. if(names.length == 0) { -- 2.11.0