From: Joseph Lewis Date: Wed, 8 Jun 2011 20:07:27 +0000 (-0600) Subject: Updated to include search. X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=5015b47425b89887b6dd88c65fa7a7080214d609;p=working%2FEvergreen.git Updated to include search. Signed-off-by: Joseph Lewis --- diff --git a/Open-ILS/web/opac/locale/en-US/lang.dtd b/Open-ILS/web/opac/locale/en-US/lang.dtd index b0e907f56f..f832d30c40 100644 --- a/Open-ILS/web/opac/locale/en-US/lang.dtd +++ b/Open-ILS/web/opac/locale/en-US/lang.dtd @@ -1792,12 +1792,21 @@ - + + + + + + + + + + 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 24667f792e..98914ca949 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 @@ -1,12 +1,12 @@ dojo.require('fieldmapper.AutoIDL'); -dojo.require("dijit.layout.LayoutContainer"); -dojo.require("dijit.layout.ContentPane"); +dojo.require('dijit.layout.LayoutContainer'); +dojo.require('dijit.layout.ContentPane'); dojo.require('dijit.form.FilteringSelect'); dojo.require('dijit.Dialog'); -dojo.require("dojox.grid.Grid"); -dojo.require("fieldmapper.Fieldmapper"); -dojo.require("fieldmapper.dojoData"); -dojo.require("fieldmapper.OrgUtils"); +dojo.require('dojox.grid.Grid'); +dojo.require('fieldmapper.Fieldmapper'); +dojo.require('fieldmapper.dojoData'); +dojo.require('fieldmapper.OrgUtils'); dojo.require('dojo.cookie'); dojo.require('openils.CGI'); dojo.require('openils.User'); @@ -23,6 +23,7 @@ var osSettings = {}; var ouSettingValues = {}; var osEditAutoWidget; var osGroups = {}; +var searchAssist = []; function osInit(data) { authtoken = new openils.CGI().param('ses') || dojo.cookie('ses'); @@ -51,8 +52,16 @@ function osInit(data) { } dojo.addOnLoad(osInit); +function showProcessingDialog(toggle) { + var proc = dojo.byId('proci18n').innerHTML; + if(toggle) + progressDialog.show(true, proc); + else + progressDialog.hide(); +} + function osDraw(specific_setting) { - progressDialog.show(true, "Processing..."); /* FIXME: I18N */ + showProcessingDialog(true); var names = []; if (specific_setting) { @@ -63,6 +72,8 @@ function osDraw(specific_setting) { } else { var types = new openils.PermaCrud({authtoken:authtoken}).retrieveAll('coust'); + searchAssist = []; + dojo.forEach(types, function(type) { osSettings[type.name()] = { @@ -72,6 +83,11 @@ function osDraw(specific_setting) { fm_class : type.fm_class(), grp : osGroups[type.grp()] } + + var tmp = "" + type.label() + "" + type.description() + "" + type.fm_class() + "" + + osGroups[type.grp()] + "" + type.name(); + + searchAssist[type.name()] = tmp.toLowerCase().replace(/[^a-z0-9]+/, ''); } ); @@ -79,6 +95,58 @@ function osDraw(specific_setting) { names.push(key); } + osDrawNames(names); + +} + +//Limits those functions seen to the ones that have similar text to +//that which is provided. Not case sensitive. +function osLimitSeen(text) { + showProcessingDialog(true); + + text = text.toLowerCase().replace(/[^a-z0-9]+/, ''); + + console.log(text); + + var names = []; + for(var n in searchAssist) + if(searchAssist[n].indexOf(text) != -1) + names.push(n); + + //Don't update on an empty list as this causes bizarre errors. + if(names.length == 0) { + showProcessingDialog(false); + + var noresults = dojo.byId('noresults').innerHTML; + myDialog = new dijit.Dialog({ content: noresults}); + myDialog.show(); + return; + } + + ouSettingValues = {}; // Clear the values. + osDrawNames(names); +} + +function doSearch() { + var query = dojo.byId("searchBox").value; + osLimitSeen(query); + + return false; //Keep form from submitting +} + +function clearSearch() { + dojo.byId("searchBox").value = ""; + osDraw(); +} + +function osToJson() { + //console.log(dojo.toJson(ouSettingValues)); + dojo.byId('jsonOutput').value = dojo.toJson(ouSettingValues); + osJSONOutDialog.show(); +} + +//Draws the grid based upon a given array of items to draw. +function osDrawNames(names) { fieldmapper.standardRequest( [ 'open-ils.actor', 'open-ils.actor.ou_setting.ancestor_default.batch'], @@ -91,7 +159,8 @@ function osDraw(specific_setting) { for(var key in data) ouSettingValues[key] = data[key]; osLoadGrid(ouSettingValues); - progressDialog.hide(); + + showProcessingDialog(false); } } ); @@ -295,5 +364,4 @@ function osEditSetting(deleteMe) { } } ); -} - +} \ No newline at end of file diff --git a/Open-ILS/xul/staff_client/server/admin/org_unit_settings.xhtml b/Open-ILS/xul/staff_client/server/admin/org_unit_settings.xhtml index 16cdabf2cc..5a3c396f8c 100644 --- a/Open-ILS/xul/staff_client/server/admin/org_unit_settings.xhtml +++ b/Open-ILS/xul/staff_client/server/admin/org_unit_settings.xhtml @@ -32,13 +32,19 @@

&staff.server.admin.org_unit_settings.title;


- &staff.server.admin.org_unit_settings.context; + &staff.server.admin.org_unit_settings.context_loc; &staff.server.admin.org_unit_settings.uninherited; +
+ + + +
+
&staff.server.admin.org_unit_settings.no_perms;
@@ -48,15 +54,15 @@ var osGridLayout = [{ defaultCell: {styles: 'text-align: center;'}, cells : [[ - { name: 'Edit', - value: '<a href="javascript:void(0);" onclick="osLaunchEditor(\'SETTING\');">Edit</a>', + { name: '&staff.server.admin.org_unit_settings.edit;', + value: '<a href="javascript:void(0);" onclick="osLaunchEditor(\'SETTING\');">&staff.server.admin.org_unit_settings.edit;</a>', get: osGetEditLink, formatter : osFormatEditLink }, - {name: 'Group', get: osGetGridData, field:'grp'}, - {name: 'Setting', get: osGetGridData, field:'label', width:'auto', styles:'text-align:left;'}, - {name: 'Context', get: osGetGridData, field:'context'}, - {name: 'Value', get: osGetGridData, field:'value', width:'auto'}, + {name: '&staff.server.admin.org_unit_settings.group;', get: osGetGridData, field:'grp'}, + {name: '&staff.server.admin.org_unit_settings.setting;', get: osGetGridData, field:'label', width:'auto', styles:'text-align:left;'}, + {name: '&staff.server.admin.org_unit_settings.context;', get: osGetGridData, field:'context'}, + {name: '&staff.server.admin.org_unit_settings.value;', get: osGetGridData, field:'value', width:'auto'}, ]] }]; @@ -73,7 +79,7 @@ - Context + &staff.server.admin.org_unit_settings.context; @@ -107,7 +113,13 @@
- + + + - - + \ No newline at end of file diff --git a/Open-ILS/xul/staff_client/server/locale/en-US/common.properties b/Open-ILS/xul/staff_client/server/locale/en-US/common.properties index 7f586bb1a7..2e79e62fc3 100644 --- a/Open-ILS/xul/staff_client/server/locale/en-US/common.properties +++ b/Open-ILS/xul/staff_client/server/locale/en-US/common.properties @@ -20,6 +20,7 @@ common.unimplemented=Not yet implemented common.yes=Yes common.no=No common.check_to_confirm=Check here to confirm this message +common.processing=Processing lang.version=remote v1 openils.global_util.clear_cache.error=Problem clearing the cache: %1$s openils.global_util.clipboard.error=Clipboard action failed: %1$s