From 8a61aa441d9842ad86daaa4fc351fc6543546553 Mon Sep 17 00:00:00 2001 From: Lebbeous Fogle-Weekley Date: Sat, 7 Jan 2012 16:07:26 -0500 Subject: [PATCH] pcrudfilterdialog: suppressFilterFields argument now supported You need this, because otherwise we'll try to do very stupid things like provide dropdowns for all bib IDs in the system when a class happens to have a field that links to bre. Signed-off-by: Lebbeous Fogle-Weekley --- .../templates/conify/global/booking/resource_type.tt2 | 1 - Open-ILS/web/js/dojo/openils/widget/AutoGrid.js | 3 ++- Open-ILS/web/js/dojo/openils/widget/PCrudFilterDialog.js | 16 +++++++++++++++- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/Open-ILS/src/templates/conify/global/booking/resource_type.tt2 b/Open-ILS/src/templates/conify/global/booking/resource_type.tt2 index d4c00ae149..3783aa2d77 100644 --- a/Open-ILS/src/templates/conify/global/booking/resource_type.tt2 +++ b/Open-ILS/src/templates/conify/global/booking/resource_type.tt2 @@ -24,7 +24,6 @@ suppressEditFields="['record']" query="{id: '*'}" fmClass='brt' - showLoadFilter='true' showPaginator='true' autoHeight='true' editOnEnter='true'> diff --git a/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js b/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js index 7ceb628e8d..921f97766d 100644 --- a/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js +++ b/Open-ILS/web/js/dojo/openils/widget/AutoGrid.js @@ -23,6 +23,7 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) { editReadOnly : false, suppressFields : null, suppressEditFields : null, + suppressFilterFields : null, hideSelector : false, selectorWidth : '1.5', showColumnPicker : false, @@ -120,7 +121,7 @@ if(!dojo._hasResource['openils.widget.AutoGrid']) { href : 'javascript:void(0);', onclick : function() { if (!self.filterDialog) { - self.filterDialog = new openils.widget.PCrudFilterDialog({fmClass:self.fmClass}) + self.filterDialog = new openils.widget.PCrudFilterDialog({fmClass:self.fmClass, suppressFilterFields:self.suppressFilterFields}) self.filterDialog.onApply = function(filter) { self.resetStore(); self.loadAll(self.cachedQueryOpts, filter); diff --git a/Open-ILS/web/js/dojo/openils/widget/PCrudFilterDialog.js b/Open-ILS/web/js/dojo/openils/widget/PCrudFilterDialog.js index c44ca6555a..8ce549fb5c 100644 --- a/Open-ILS/web/js/dojo/openils/widget/PCrudFilterDialog.js +++ b/Open-ILS/web/js/dojo/openils/widget/PCrudFilterDialog.js @@ -486,7 +486,21 @@ if(!dojo._hasResource['openils.widget.PCrudFilterDialog']) { this.inherited(arguments); this.initAutoEnv(); var realFieldList = this.sortedFieldList.filter( - function(item) { return !(item.virtual || item.nonIdl); }); + function(item) { return !(item.virtual || item.nonIdl); } + ); + + if (dojo.isArray(this.suppressFilterFields)) { + realFieldList = realFieldList.filter( + function(item) { + for (var i = 0; i < self.suppressFilterFields.length; i++) { + if (item.name == self.suppressFilterFields[i]) + return false; + } + return true; + } + ); + } + this.fieldStore = new dojo.data.ItemFileReadStore({ "data": { "identifier": "name", -- 2.11.0