added clear filter button

This commit is contained in:
Roland Gruber 2013-01-14 17:10:03 +00:00
parent 81c7792833
commit 4a25ab96b5
1 changed files with 36 additions and 23 deletions

View File

@ -209,6 +209,7 @@ class lamList {
$filter = array(); $filter = array();
$filterParam = ""; $filterParam = "";
$LDAPFilterPart = ""; $LDAPFilterPart = "";
if (!isset($_POST['clear_filter'])) {
// build filter array // build filter array
for ($i = 0; $i < sizeof($this->attrArray); $i++) { for ($i = 0; $i < sizeof($this->attrArray); $i++) {
$foundFilter = null; $foundFilter = null;
@ -228,6 +229,7 @@ class lamList {
} }
} }
} }
}
$this->filterText = $filterParam; $this->filterText = $filterParam;
$this->filterPart = $LDAPFilterPart; $this->filterPart = $LDAPFilterPart;
} }
@ -348,20 +350,31 @@ class lamList {
printHelpLink(getHelp('', '250'), '250'); printHelpLink(getHelp('', '250'), '250');
echo "</td>\n"; echo "</td>\n";
echo "<td>"; echo "<td>";
$filterButton = new htmlButton('apply_filter', _("Filter")); $filterGroup = new htmlGroup();
parseHtml(null, $filterButton, array(), false, $this->tabindex, $this->type); $filterButton = new htmlButton('apply_filter', 'filter.png', true);
$filterButton->setTitle(_("Filter"));
$filterGroup->addElement($filterButton);
if (isset($this->filterPart) && ($this->filterPart != '')) {
$filterGroup->addElement(new htmlSpacer('1px', null));
$clearFilterButton = new htmlButton('clear_filter', 'clearFilter.png', true);
$clearFilterButton->setTitle(_('Clear filter'));
$filterGroup->addElement($clearFilterButton);
}
parseHtml(null, $filterGroup, array(), false, $this->tabindex, $this->type);
echo "</td>\n"; echo "</td>\n";
// print input boxes for filters // print input boxes for filters
for ($k = 0; $k < sizeof ($this->descArray); $k++) { for ($k = 0; $k < sizeof ($this->descArray); $k++) {
echo "<td align=\"left\">"; echo "<td align=\"left\">";
if ($this->canBeFiltered($this->attrArray[$k])) { if ($this->canBeFiltered($this->attrArray[$k])) {
$value = ""; $value = "";
if (!isset($_POST['clear_filter'])) {
if (isset($_GET["filter" . strtolower($this->attrArray[$k])])) { if (isset($_GET["filter" . strtolower($this->attrArray[$k])])) {
$value = $_GET["filter" . strtolower($this->attrArray[$k])]; $value = $_GET["filter" . strtolower($this->attrArray[$k])];
} }
if (isset($_POST["filter" . strtolower($this->attrArray[$k])])) { if (isset($_POST["filter" . strtolower($this->attrArray[$k])])) {
$value = $_POST["filter" . strtolower($this->attrArray[$k])]; $value = $_POST["filter" . strtolower($this->attrArray[$k])];
} }
}
$filterInput = new htmlInputField('filter' . strtolower($this->attrArray[$k]), $value); $filterInput = new htmlInputField('filter' . strtolower($this->attrArray[$k]), $value);
$filterInput->setFieldSize('15'); $filterInput->setFieldSize('15');
$filterInput->setOnKeyPress("SubmitForm('apply_filter', event);"); $filterInput->setOnKeyPress("SubmitForm('apply_filter', event);");
@ -859,7 +872,7 @@ class lamList {
// check if LDAP data should be refreshed // check if LDAP data should be refreshed
$this->refresh = true; $this->refresh = true;
if (isset($_GET['norefresh'])) $this->refresh = false; if (isset($_GET['norefresh'])) $this->refresh = false;
if (isset($_POST['refresh']) || isset($_POST['apply_filter'])) { if (isset($_POST['refresh']) || isset($_POST['apply_filter']) || isset($_POST['clear_filter'])) {
$this->refresh = true; $this->refresh = true;
} }
} }