diff --git a/ihtml/themes/breezy/management/filter-element-fixed.tpl b/ihtml/themes/breezy/management/filter-element-fixed.tpl new file mode 100644 index 0000000000000000000000000000000000000000..9123f636764e51aae1192933d31bca7d4680cef5 --- /dev/null +++ b/ihtml/themes/breezy/management/filter-element-fixed.tpl @@ -0,0 +1,10 @@ +<fieldset><legend>{$NAME}</legend> + {foreach from=$INPUTS key="key" item="input"} + <label title="{$input.desc|escape}"> + {if isset($input.icon)} + <img src="{$input.icon|escape}" alt=""/> + {/if} + {$input.name|escape} + </label> + {/foreach} +</fieldset> diff --git a/include/management/class_FixedFilterElement.inc b/include/management/class_FixedFilterElement.inc new file mode 100644 index 0000000000000000000000000000000000000000..aeb43f580a033c5743b58cb3d09c7dda1faf87bf --- /dev/null +++ b/include/management/class_FixedFilterElement.inc @@ -0,0 +1,52 @@ +<?php +/* + This code is part of FusionDirectory (http://www.fusiondirectory.org/) + + Copyright (C) 2018-2019 FusionDirectory + + 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 + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + +class FixedFilterElement extends FilterElement +{ + protected $filter; + + public function __construct (managementFilter $parent, string $filter) + { + parent::__construct($parent); + + $this->filter = $filter; + } + + public function render (): string + { + $inputs = [ + [ + 'name' => $this->filter, + 'desc' => $this->filter, + ] + ]; + $smarty = get_smarty(); + $smarty->assign('NAME', _('Fixed')); + $smarty->assign('INPUTS', $inputs); + return $smarty->fetch(get_template_path('management/filter-element-fixed.tpl')); + } + + public function getFilters (string $type, array &$filters): bool + { + $filters[] = $this->filter; + return FALSE; + } +} diff --git a/include/simpleplugin/attributes/class_PhoneNumberAttribute.inc b/include/simpleplugin/attributes/class_PhoneNumberAttribute.inc index 770932f4b7eb61e2873cec8be32212df6e31c017..401e2ff9d41472ad884e5c4046dea28d7f0d093e 100644 --- a/include/simpleplugin/attributes/class_PhoneNumberAttribute.inc +++ b/include/simpleplugin/attributes/class_PhoneNumberAttribute.inc @@ -30,6 +30,12 @@ class phoneSelect extends selectManagement ['LinkColumn', ['attributes' => 'nameAttr', 'label' => 'Name']], ['LinkColumn', ['attributes' => 'telephoneNumber', 'label' => 'Number']], ]; + + protected function setUpFilter () + { + parent::setUpFilter(); + $this->filter->addElement(new FixedFilterElement($this->filter, '(telephoneNumber=*)')); + } } /*! @@ -141,12 +147,24 @@ class PhoneNumberButtonAttribute extends PhoneNumberAttribute } } - function handleDialogResult ($dn, array $attrs) + function handleDialogResult ($dn, $entry) { - if (isset($attrs['telephoneNumber'][0])) { - $this->setValue($attrs['telephoneNumber'][0]); + if (isset($entry['telephoneNumber'][0])) { + $this->setValue($entry['telephoneNumber'][0]); + } elseif (isset($entry['telephoneNumber'])) { + $this->setValue($entry['telephoneNumber']); } else { $this->setValue(''); } } + + function getFilterBlackList () + { + return []; + } + + function getFilterWhiteList () + { + return []; + } }