From: Joseph Lewis <joehms22@gmail.com> 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=d94433ac4283c8caf481424612e25aa9ac01e833;p=evergreen%2Fmasslnc.git Updated to include search. Signed-off-by: Joseph Lewis <joehms22@gmail.com> Signed-off-by: Thomas Berezansky <tsbere@mvlc.org> Signed-off-by: Jason Etheridge <jason@esilibrary.com> --- diff --git a/Open-ILS/web/opac/locale/en-US/lang.dtd b/Open-ILS/web/opac/locale/en-US/lang.dtd index 4003508bc5..3c56d5d6d1 100644 --- a/Open-ILS/web/opac/locale/en-US/lang.dtd +++ b/Open-ILS/web/opac/locale/en-US/lang.dtd @@ -1795,12 +1795,21 @@ <!ENTITY staff.server.admin.do_not_auto_attempt_print_setting.transit_slip "Transit Slip"> <!ENTITY staff.server.admin.do_not_auto_attempt_print_setting.hold_transit_slip "Hold/Transit Slip"> <!ENTITY staff.server.admin.org_unit_settings.title "Organization Unit Settings"> -<!ENTITY staff.server.admin.org_unit_settings.context "Context Location"> +<!ENTITY staff.server.admin.org_unit_settings.context_loc "Context Location"> <!ENTITY staff.server.admin.org_unit_settings.uninherited " * Indicates the setting is not inherited from the parent org unit at run time"> <!ENTITY staff.server.admin.org_unit_settings.no_perms "You do not have permission to view org unit settings"> <!ENTITY staff.server.admin.org_unit_settings.edit_setting "Edit Setting"> <!ENTITY staff.server.admin.org_unit_settings.delete_setting "Delete Setting"> <!ENTITY staff.server.admin.org_unit_settings.update_setting "Update Setting"> +<!ENTITY staff.server.admin.org_unit_settings.processing "Processing..."> +<!ENTITY staff.server.admin.org_unit_settings.filter "Filter"> +<!ENTITY staff.server.admin.org_unit_settings.clear_filter "Clear Filter"> +<!ENTITY staff.server.admin.org_unit_settings.no_results "There are no results for your filter."> +<!ENTITY staff.server.admin.org_unit_settings.group "Group"> +<!ENTITY staff.server.admin.org_unit_settings.setting "Setting"> +<!ENTITY staff.server.admin.org_unit_settings.context "Context"> +<!ENTITY staff.server.admin.org_unit_settings.value "Value"> +<!ENTITY staff.server.admin.org_unit_settings.edit "Edit"> <!ENTITY staff.server.admin.offline.xacts.caption "Offline Sessions"> <!ENTITY staff.server.admin.offline.xacts.refresh.accesskey "R"> <!ENTITY staff.server.admin.offline.xacts.create.label "Create"> 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 696c8e7659..a1a5c6a5f5 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'); @@ -24,6 +24,7 @@ var ouSettingValues = {}; var osEditAutoWidget; var perm_codes = {}; var osGroups = {}; +var searchAssist = []; function osInit(data) { authtoken = new openils.CGI().param('ses') || dojo.cookie('ses'); @@ -66,8 +67,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) { @@ -78,6 +87,8 @@ function osDraw(specific_setting) { } else { var types = new openils.PermaCrud({authtoken:authtoken}).retrieveAll('coust'); + searchAssist = []; + dojo.forEach(types, function(type) { osSettings[type.name()] = { @@ -88,6 +99,11 @@ function osDraw(specific_setting) { update_perm : type.update_perm(), 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]+/, ''); } ); @@ -95,6 +111,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'], @@ -107,7 +175,8 @@ function osDraw(specific_setting) { for(var key in data) ouSettingValues[key] = data[key]; osLoadGrid(ouSettingValues); - progressDialog.hide(); + + showProcessingDialog(false); } } ); @@ -316,4 +385,3 @@ function osEditSetting(deleteMe) { } ); } - 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 @@ <div dojoType="dijit.layout.LayoutContainer" orientation="vertical" class="tall"> <div dojoType="dijit.layout.ContentPane" layoutAlign='top'> <h1>&staff.server.admin.org_unit_settings.title;</h1><br/> - <span>&staff.server.admin.org_unit_settings.context;</span> + <span>&staff.server.admin.org_unit_settings.context_loc;</span> <span> <select dojoType="openils.widget.OrgUnitFilteringSelect" jsId='osContextSelector' searchAttr="shortname" autocomplete="true" labelAttr='shortname' onchange='osChangeContext();'> </select> </span> <span>&staff.server.admin.org_unit_settings.uninherited;</span> + <form onSubmit="return doSearch()"> + <input type="text" dojoType="dijit.form.TextBox" id="searchBox" /> + <button type="submit" dojoType='dijit.form.Button'>&staff.server.admin.org_unit_settings.filter;</button> + <button dojoType='dijit.form.Button' onClick="clearSearch();">&staff.server.admin.org_unit_settings.clear_filter;</button> + </form> + <button dojoType='dijit.form.Button' onClick="osToJson();">Output</button> </div> <div dojoType="dijit.layout.ContentPane" layoutAlign='client'> <div class='hide_me' id='no-perms'><b>&staff.server.admin.org_unit_settings.no_perms;</b></div> @@ -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'}, ]] }]; </script> @@ -73,7 +79,7 @@ </thead> <tbody> <tr> - <td>Context</td> + <td>&staff.server.admin.org_unit_settings.context;</td> <td> <select dojoType="openils.widget.OrgUnitFilteringSelect" jsId='osEditContextSelector' searchAttr="shortname" autocomplete="true" labelAttr='shortname'> @@ -81,7 +87,7 @@ </td> </tr> <tr> - <td>Value</td> + <td>&staff.server.admin.org_unit_settings.value;</td> <td> <input dojoType='dijit.form.TextBox' jsId='osEditTextBox'/> <input dojoType='dijit.form.CurrencyTextBox' jsId='osEditCurrencyTextBox'/> @@ -107,7 +113,13 @@ <span id='os-true' class='hidden'>&common.true;</span> <span id='os-false' class='hidden'>&common.false;</span> <div dojoType="openils.widget.ProgressDialog" jsId="progressDialog" indeterminate="true"></div> - <div class="hidden"></div> + <div id='proci18n' class="hidden">&staff.server.admin.org_unit_settings.processing;</div> + <div id="noresults" class="hidden">&staff.server.admin.org_unit_settings.no_results;</div> + <div id="jsonoutput" class='hidden' dojoType="dijit.Dialog" jsId='osJSONOutDialog'> + <table> + <tr><td>Copy this to your clipboard and save it to a file to export the settings.</td></tr> + <tr><td><textarea id="jsonOutput"></textarea></td></tr> + </table> + </div> </body> -</html> - +</html> \ 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 3968a6f80d..f73ab08a97 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