From f8a91f3f4f7404b2165de9883e1164fa585a13ef Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Wed, 8 May 2019 20:32:29 +0200 Subject: [PATCH] #200 fixed filter select for account status --- lam/lib/lists.inc | 27 +++++++++++++++++++-------- lam/lib/types/user.inc | 22 ++++++++-------------- 2 files changed, 27 insertions(+), 22 deletions(-) diff --git a/lam/lib/lists.inc b/lam/lib/lists.inc index f913aed1..df06bef1 100644 --- a/lam/lib/lists.inc +++ b/lam/lib/lists.inc @@ -480,14 +480,7 @@ class lamList { foreach ($this->attrArray as $attributeName) { $attributeName = strtolower($attributeName); if ($this->canBeFiltered($attributeName)) { - $value = ""; - if (!$clearFilter && isset($this->filters[$attributeName])) { - $value = $this->filters[$attributeName]; - } - $filterInput = new htmlInputField('filter' . $attributeName, $value, null); - $filterInput->setCSSClasses(array($this->type->getScope() . '-bright')); - $filterInput->setOnKeyPress("SubmitForm('apply_filter', event);"); - $filterElements[] = $filterInput; + $filterElements[] = $this->getFilterArea($attributeName, $clearFilter); } else { $filterElements[] = new htmlOutputText(''); @@ -496,6 +489,24 @@ class lamList { return $filterElements; } + /** + * Prints the content of a single attribute filter area. + * + * @param String $attrName attribute name + * @param boolean $clearFilter true if filter value should be cleared + * @return htmlElement element to show + */ + protected function getFilterArea($attrName, $clearFilter) { + $value = ""; + if (!$clearFilter && isset($this->filters[$attrName])) { + $value = $this->filters[$attrName]; + } + $filterInput = new htmlInputField('filter' . $attrName, $value, null); + $filterInput->setCSSClasses(array($this->type->getScope() . '-bright')); + $filterInput->setOnKeyPress("SubmitForm('apply_filter', event);"); + return $filterInput; + } + /** * Adds the LDAP data elements to the given array. * diff --git a/lam/lib/types/user.inc b/lam/lib/types/user.inc index 1b219b5f..3b42152f 100644 --- a/lam/lib/types/user.inc +++ b/lam/lib/types/user.inc @@ -706,7 +706,6 @@ class lamUserList extends lamList { */ protected function refreshPrimaryGroupTranslation() { $this->trans_primary_hash = array(); - $filter = "objectClass=posixGroup"; $attrs = array("cn", "gidNumber"); $entries = searchLDAPByAttribute(null, null, 'posixGroup', $attrs, array('group')); $entryCount = sizeof($entries); @@ -874,21 +873,16 @@ class lamUserList extends lamList { } /** - * Prints the content of a single attribute filter area. - * - * @param String $attrName attribute name - * @param boolean $clearFilter true if filter value should be cleared + * {@inheritDoc} + * @see lamList::getFilterArea() */ - protected function printFilterArea($attrName, $clearFilter) { + protected function getFilterArea($attrName, $clearFilter) { if ($attrName != self::ATTR_ACCOUNT_STATUS) { - parent::printFilterArea($attrName, $clearFilter); - return; + return parent::getFilterArea($attrName, $clearFilter); } $value = "-"; - if (!$clearFilter) { - if (isset($this->filters[strtolower($attrName)])) { - $value = $this->filters[strtolower($attrName)]; - } + if (!$clearFilter && isset($this->filters[$attrName])) { + $value = $this->filters[$attrName]; } $filterOptions = array( '' => '', @@ -898,10 +892,10 @@ class lamUserList extends lamList { _('Expired') => self::FILTER_EXPIRED, ); $filterInput = new htmlSelect('filter' . strtolower($attrName), $filterOptions, array($value)); - $filterInput->setCSSClasses(array($this->type->getScope() . '-dark')); + $filterInput->setCSSClasses(array($this->type->getScope() . '-bright')); $filterInput->setHasDescriptiveElements(true); $filterInput->setOnchangeEvent('document.getElementsByName(\'apply_filter\')[0].click();'); - parseHtml(null, $filterInput, array(), false, $this->tabindex, $this->type->getScope()); + return $filterInput; } /**