Verified Commit d4dc61c7 authored by Côme Chilliet's avatar Côme Chilliet
Browse files

:tractor: feat(alias) Migrate alias to new management class

issue #5914
Showing with 12 additions and 68 deletions
+12 -68
......@@ -2,7 +2,7 @@
/*
This code is part of FusionDirectory (http://www.fusiondirectory.org/)
Copyright (C) 2010 Antoine Gallavardin
Copyright (C) 2012-2016 FusionDirectory
Copyright (C) 2012-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
......@@ -19,19 +19,23 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
class aliasManagement extends simpleManagement
class aliasManagement extends management
{
// Tab definition
protected $objectTypes = array('mailAliasDistribution','mailAliasRedirection');
/* Default columns */
public static $columns = array(
array('ObjectTypeColumn', array()),
array('LinkColumn', array('attributes' => 'nameAttr', 'label' => 'Name')),
array('LinkColumn', array('attributes' => 'description', 'label' => 'Description')),
array('UnixTimestampColumn', array('attributes' => 'aliasExpirationDate', 'label' => 'Expiration date')),
array('ActionsColumn', array('label' => 'Actions')),
);
protected $autoFilterAttributes = array('dn', 'cn', 'description', 'aliasExpirationDate');
/* Return plugin information for acl handling */
public static function plInfo()
{
return array(
'plShortName' => _('Aliases'),
'plDescription' => _('Alias management'),
'plTitle' => _('Alias management'),
'plDescription' => _('Manage aliases'),
'plIcon' => 'geticon.php?context=applications&icon=alias&size=48',
'plSection' => 'accounts',
'plPriority' => 26,
......@@ -42,42 +46,4 @@ class aliasManagement extends simpleManagement
'plProvidedAcls' => array()
);
}
function configureHeadpage ()
{
$this->headpage->registerElementFilter('filterDate', 'aliasManagement::filterDate');
parent::configureHeadpage();
}
function parseXML ($file)
{
$data = parent::parseXML($file);
$data['list']['table']['layout'] = '|20px;c|||110px;c|100px;r|';
$data['list']['table']['column'][4] = $data['list']['table']['column'][3];
$data['list']['table']['column'][3] = array(
'label' => 'Expiration date',
'sortAttribute' => 'aliasExpirationDate',
'sortType' => 'integer',
'value' => '%{filter:filterDate(aliasExpirationDate)}',
'export' => 'true',
);
return $data;
}
static function filterDate()
{
if (func_num_args() == 0) {
return ' ';
}
$date = func_get_arg(0);
if (!is_array($date)) {
return ' ';
}
$dateObject = DateTime::createFromFormat('U', $date[0], new DateTimeZone('UTC'));
if (is_object($dateObject)) {
return $dateObject->format('d.m.Y');
}
return ' ';
}
}
?>
<?php
/*
This code is part of FusionDirectory (http://www.fusiondirectory.org)
Copyright (C) 2013-2016 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.
*/
simpleManagement::mainInc('aliasManagement');
?>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment