added filter function to html.inc

This commit is contained in:
Roland Gruber 2016-03-19 09:06:53 +00:00
parent fcd03fd509
commit e8ede90eb5
4 changed files with 15 additions and 5 deletions

View File

@ -3,7 +3,7 @@
$Id$ $Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2010 - 2014 Roland Gruber Copyright (C) 2010 - 2016 Roland Gruber
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -767,6 +767,16 @@ class htmlInputField extends htmlElement {
$this->sameValueFieldID = $sameValueFieldID; $this->sameValueFieldID = $sameValueFieldID;
} }
/**
* Turns this field into a live filter for a select box.
* Cannot be used together with setOnKeyUp().
*
* @param String $name select box name
*/
public function filterSelectBox($name) {
$this->setOnKeyUp('filterSelect(\'' . $this->fieldName . '\', \'' . $name . '\', event);');
}
} }
/** /**

View File

@ -117,7 +117,7 @@ class nisNetGroupHost extends nisNetGroupUser {
$filterGroup->addElement(new htmlOutputText(_('Filter') . ' ')); $filterGroup->addElement(new htmlOutputText(_('Filter') . ' '));
$filter = new htmlInputField('group_filter'); $filter = new htmlInputField('group_filter');
$filter->setFieldSize('5em'); $filter->setFieldSize('5em');
$filter->setOnKeyUp('filterSelect(\'group_filter\', \'group_add\', event);'); $filter->filterSelectBox('group_add');
$filterGroup->addElement($filter); $filterGroup->addElement($filter);
$return->addElement($filterGroup, true); $return->addElement($filterGroup, true);

View File

@ -197,7 +197,7 @@ class nisNetGroupUser extends baseModule {
$filterGroup->addElement(new htmlOutputText(_('Filter') . ' ')); $filterGroup->addElement(new htmlOutputText(_('Filter') . ' '));
$filter = new htmlInputField('group_filter'); $filter = new htmlInputField('group_filter');
$filter->setFieldSize('5em'); $filter->setFieldSize('5em');
$filter->setOnKeyUp('filterSelect(\'group_filter\', \'group_add\', event);'); $filter->filterSelectBox('group_add');
$filterGroup->addElement($filter); $filterGroup->addElement($filter);
$return->addElement($filterGroup, true); $return->addElement($filterGroup, true);

View File

@ -3,7 +3,7 @@
$Id$ $Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2013 - 2015 Roland Gruber Copyright (C) 2013 - 2016 Roland Gruber
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -649,7 +649,7 @@ class windowsGroup extends baseModule {
$filterGroup->addElement(new htmlOutputText(_('Filter') . ' ')); $filterGroup->addElement(new htmlOutputText(_('Filter') . ' '));
$filter = new htmlInputField('windows_filter'); $filter = new htmlInputField('windows_filter');
$filter->setFieldSize('5em'); $filter->setFieldSize('5em');
$filter->setOnKeyUp('filterSelect(\'windows_filter\', \'members\', event);'); $filter->filterSelectBox('members');
$filterGroup->addElement($filter); $filterGroup->addElement($filter);
$return->addElement($filterGroup, true); $return->addElement($filterGroup, true);