add dns-editor in twig/tablelisting/formfield
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
27
lib/Froxlor/UI/Callbacks/Dns.php
Normal file
27
lib/Froxlor/UI/Callbacks/Dns.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace Froxlor\UI\Callbacks;
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2010 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Froxlor\UI\Callbacks
|
||||
*
|
||||
*/
|
||||
class Dns
|
||||
{
|
||||
public static function prio(array $attributes): string
|
||||
{
|
||||
return ($attributes['fields']['prio'] <= 0
|
||||
&& $attributes['fields']['type'] != 'MX'
|
||||
&& $attributes['fields']['type'] != 'SRV') ? '' : $attributes['data'];
|
||||
}
|
||||
}
|
||||
@@ -60,4 +60,9 @@ class Text
|
||||
{
|
||||
return substr($attributes['data'], 0, 20) . '...';
|
||||
}
|
||||
|
||||
public static function wordwrap(array $attributes): string
|
||||
{
|
||||
return wordwrap($attributes['data'], 100, '<br>', true);
|
||||
}
|
||||
}
|
||||
|
||||
69
lib/formfields/formfield.dns_add.php
Normal file
69
lib/formfields/formfield.dns_add.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2010 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Formfields
|
||||
*
|
||||
*/
|
||||
return array(
|
||||
'dns_add' => array(
|
||||
'title' => 'DNS Editor',
|
||||
'image' => 'fa-solid fa-globe',
|
||||
'sections' => array(
|
||||
'section_a' => array(
|
||||
'fields' => array(
|
||||
'dns_record' => array(
|
||||
'label' => 'Record',
|
||||
'type' => 'text',
|
||||
'value' => $record,
|
||||
'mandatory' => true
|
||||
),
|
||||
'dns_type' => array(
|
||||
'label' => 'Type',
|
||||
'type' => 'select',
|
||||
'select_var' => [
|
||||
'A' => 'A',
|
||||
'AAAA' => 'AAAA',
|
||||
'CAA' => 'CAA',
|
||||
'CNAME' => 'CNAME',
|
||||
'DNAME' => 'DNAME',
|
||||
'LOC' => 'LOC',
|
||||
'MX' => 'MX',
|
||||
'NS' => 'NS',
|
||||
'RP' => 'RP',
|
||||
'SRV' => 'SRV',
|
||||
'SSHFP' => 'SSHFP',
|
||||
'TXT' => 'TXT'
|
||||
],
|
||||
'selected' => $type
|
||||
),
|
||||
'dns_mxp' => array(
|
||||
'label' => 'Priority',
|
||||
'type' => 'number',
|
||||
'value' => $prio
|
||||
),
|
||||
'dns_content' => array(
|
||||
'label' => 'Content',
|
||||
'type' => 'text',
|
||||
'value' => $content
|
||||
),
|
||||
'dns_ttl' => array(
|
||||
'label' => 'TTL',
|
||||
'type' => 'number',
|
||||
'min' => 30,
|
||||
'value' => $ttl
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
72
lib/tablelisting/tablelisting.dns.php
Normal file
72
lib/tablelisting/tablelisting.dns.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2010 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Tabellisting
|
||||
*
|
||||
*/
|
||||
|
||||
use Froxlor\UI\Callbacks\Dns;
|
||||
use Froxlor\UI\Callbacks\Text;
|
||||
use Froxlor\UI\Listing;
|
||||
|
||||
return [
|
||||
'dns_list' => [
|
||||
'title' => 'DNS Entries',
|
||||
'icon' => 'fa-solid fa-globe',
|
||||
'columns' => [
|
||||
'record' => [
|
||||
'label' => 'Record',
|
||||
'field' => 'record'
|
||||
],
|
||||
'type' => [
|
||||
'label' => 'Type',
|
||||
'field' => 'type'
|
||||
],
|
||||
'prio' => [
|
||||
'label' => 'Priority',
|
||||
'field' => 'prio',
|
||||
'callback' => [Dns::class, 'prio'],
|
||||
],
|
||||
'content' => [
|
||||
'label' => 'Content',
|
||||
'field' => 'content',
|
||||
'callback' => [Text::class, 'wordwrap'],
|
||||
],
|
||||
'ttl' => [
|
||||
'label' => 'TTL',
|
||||
'field' => 'ttl'
|
||||
]
|
||||
],
|
||||
'visible_columns' => Listing::getVisibleColumnsForListing('dns_list', [
|
||||
'record',
|
||||
'type',
|
||||
'prio',
|
||||
'content',
|
||||
'ttl'
|
||||
]),
|
||||
'actions' => [
|
||||
'delete' => [
|
||||
'icon' => 'fa fa-trash',
|
||||
'title' => $lng['panel']['delete'],
|
||||
'class' => 'text-danger',
|
||||
'href' => [
|
||||
'section' => 'domains',
|
||||
'page' => 'domaindnseditor',
|
||||
'action' => 'delete',
|
||||
'domain_id' => $domain_id,
|
||||
'id' => ':id'
|
||||
],
|
||||
],
|
||||
]
|
||||
]
|
||||
];
|
||||
Reference in New Issue
Block a user