#200 fixed filter select for account status

This commit is contained in:
Roland Gruber 2019-05-08 20:32:29 +02:00
parent 9bac92a4a5
commit f8a91f3f4f
2 changed files with 27 additions and 22 deletions

View File

@ -480,14 +480,7 @@ class lamList {
foreach ($this->attrArray as $attributeName) { foreach ($this->attrArray as $attributeName) {
$attributeName = strtolower($attributeName); $attributeName = strtolower($attributeName);
if ($this->canBeFiltered($attributeName)) { if ($this->canBeFiltered($attributeName)) {
$value = ""; $filterElements[] = $this->getFilterArea($attributeName, $clearFilter);
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;
} }
else { else {
$filterElements[] = new htmlOutputText(''); $filterElements[] = new htmlOutputText('');
@ -496,6 +489,24 @@ class lamList {
return $filterElements; 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. * Adds the LDAP data elements to the given array.
* *

View File

@ -706,7 +706,6 @@ class lamUserList extends lamList {
*/ */
protected function refreshPrimaryGroupTranslation() { protected function refreshPrimaryGroupTranslation() {
$this->trans_primary_hash = array(); $this->trans_primary_hash = array();
$filter = "objectClass=posixGroup";
$attrs = array("cn", "gidNumber"); $attrs = array("cn", "gidNumber");
$entries = searchLDAPByAttribute(null, null, 'posixGroup', $attrs, array('group')); $entries = searchLDAPByAttribute(null, null, 'posixGroup', $attrs, array('group'));
$entryCount = sizeof($entries); $entryCount = sizeof($entries);
@ -874,21 +873,16 @@ class lamUserList extends lamList {
} }
/** /**
* Prints the content of a single attribute filter area. * {@inheritDoc}
* * @see lamList::getFilterArea()
* @param String $attrName attribute name
* @param boolean $clearFilter true if filter value should be cleared
*/ */
protected function printFilterArea($attrName, $clearFilter) { protected function getFilterArea($attrName, $clearFilter) {
if ($attrName != self::ATTR_ACCOUNT_STATUS) { if ($attrName != self::ATTR_ACCOUNT_STATUS) {
parent::printFilterArea($attrName, $clearFilter); return parent::getFilterArea($attrName, $clearFilter);
return;
} }
$value = "-"; $value = "-";
if (!$clearFilter) { if (!$clearFilter && isset($this->filters[$attrName])) {
if (isset($this->filters[strtolower($attrName)])) { $value = $this->filters[$attrName];
$value = $this->filters[strtolower($attrName)];
}
} }
$filterOptions = array( $filterOptions = array(
'' => '', '' => '',
@ -898,10 +892,10 @@ class lamUserList extends lamList {
_('Expired') => self::FILTER_EXPIRED, _('Expired') => self::FILTER_EXPIRED,
); );
$filterInput = new htmlSelect('filter' . strtolower($attrName), $filterOptions, array($value)); $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->setHasDescriptiveElements(true);
$filterInput->setOnchangeEvent('document.getElementsByName(\'apply_filter\')[0].click();'); $filterInput->setOnchangeEvent('document.getElementsByName(\'apply_filter\')[0].click();');
parseHtml(null, $filterInput, array(), false, $this->tabindex, $this->type->getScope()); return $filterInput;
} }
/** /**