refactoring callbacks, add class for table rows

This commit is contained in:
envoyr
2022-02-27 16:36:23 +01:00
parent d9f909150d
commit 1a6b899c67
17 changed files with 222 additions and 143 deletions

View File

@@ -2,6 +2,7 @@
namespace Froxlor\UI\Callbacks; namespace Froxlor\UI\Callbacks;
use Froxlor\FileDir;
use Froxlor\UI\Panel\UI; use Froxlor\UI\Panel\UI;
/** /**
@@ -15,33 +16,32 @@ use Froxlor\UI\Panel\UI;
* @copyright (c) the authors * @copyright (c) the authors
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Listing * @package Froxlor\UI\Callbacks
* *
*/ */
class Domain class Domain
{ {
public static function domainTarget(string $data, array $attributes): mixed public static function domainTarget(array $attributes)
{ {
if (empty($attributes['aliasdomain'])) { if (empty($attributes['fields']['aliasdomain'])) {
// path or redirect // path or redirect
if (preg_match('/^https?\:\/\//', $attributes['documentroot'])) { if (preg_match('/^https?\:\/\//', $attributes['fields']['documentroot'])) {
return [ return [
'type' => 'link', 'type' => 'link',
'data' => [ 'data' => [
'text' => $attributes['documentroot'], 'text' => $attributes['fields']['documentroot'],
'href' => $attributes['documentroot'], 'href' => $attributes['fields']['documentroot'],
'target' => '_blank' 'target' => '_blank'
] ]
]; ];
} else { } else {
// show docroot nicely // show docroot nicely
if (strpos($attributes['documentroot'], UI::getCurrentUser()['documentroot']) === 0) { if (strpos($attributes['fields']['documentroot'], UI::getCurrentUser()['documentroot']) === 0) {
$attributes['documentroot'] = \Froxlor\FileDir::makeCorrectDir(str_replace(UI::getCurrentUser()['documentroot'], "/", $attributes['documentroot'])); $attributes['fields']['documentroot'] = FileDir::makeCorrectDir(str_replace(UI::getCurrentUser()['documentroot'], "/", $attributes['fields']['documentroot']));
} }
return $attributes['documentroot']; return $attributes['fields']['documentroot'];
} }
} }
return UI::getLng('domains.aliasdomain') . ' ' . $attributes['aliasdomain']; return UI::getLng('domains.aliasdomain') . ' ' . $attributes['fields']['aliasdomain'];
} }
} }

View File

@@ -2,8 +2,8 @@
namespace Froxlor\UI\Callbacks; namespace Froxlor\UI\Callbacks;
use Froxlor\Settings;
use Froxlor\PhpHelper; use Froxlor\PhpHelper;
use Froxlor\Settings;
/** /**
* This file is part of the Froxlor project. * This file is part of the Froxlor project.
@@ -16,19 +16,18 @@ use Froxlor\PhpHelper;
* @copyright (c) the authors * @copyright (c) the authors
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Listing * @package Froxlor\UI\Callbacks
* *
*/ */
class Email class Email
{ {
public static function account(string $data, array $attributes): mixed public static function account(array $attributes)
{ {
return [ return [
'type' => 'booleanWithInfo', 'type' => 'booleanWithInfo',
'data' => [ 'data' => [
'checked' => $data != 0, 'checked' => $attributes['data'] != 0,
'info' => $data != 0 ? PhpHelper::sizeReadable($attributes['mboxsize'], 'GiB', 'bi', '%01.' . (int) Settings::Get('panel.decimal_places') . 'f %s') : '' 'info' => $attributes['data'] != 0 ? PhpHelper::sizeReadable($attributes['fields']['mboxsize'], 'GiB', 'bi', '%01.' . (int)Settings::Get('panel.decimal_places') . 'f %s') : ''
] ]
]; ];
} }

View File

@@ -2,6 +2,7 @@
namespace Froxlor\UI\Callbacks; namespace Froxlor\UI\Callbacks;
use Froxlor\FileDir;
use Froxlor\UI\Panel\UI; use Froxlor\UI\Panel\UI;
/** /**
@@ -15,19 +16,18 @@ use Froxlor\UI\Panel\UI;
* @copyright (c) the authors * @copyright (c) the authors
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Listing * @package Froxlor\UI\Callbacks
* *
*/ */
class Ftp class Ftp
{ {
public static function pathRelative(string $data, array $attributes): string public static function pathRelative(array $attributes): string
{ {
if (strpos($data, UI::getCurrentUser()['documentroot']) === 0) { if (strpos($attributes['data'], UI::getCurrentUser()['documentroot']) === 0) {
$data = str_replace(UI::getCurrentUser()['documentroot'], "/", $data); $attributes['data'] = str_replace(UI::getCurrentUser()['documentroot'], "/", $attributes['data']);
} }
$data = \Froxlor\FileDir::makeCorrectDir($data); $attributes['data'] = FileDir::makeCorrectDir($attributes['data']);
return $data; return $attributes['data'];
} }
} }

View File

@@ -16,45 +16,44 @@ use Froxlor\UI\Panel\UI;
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @author Maurice Preuß <hello@envoyr.com> * @author Maurice Preuß <hello@envoyr.com>
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Listing * @package Froxlor\UI\Callbacks
* *
*/ */
class Impersonate class Impersonate
{ {
public static function admin(string $data, array $attributes): mixed public static function admin(array $attributes)
{ {
if (UI::getCurrentUser()['adminid'] != $attributes['adminid']) { if (UI::getCurrentUser()['adminid'] != $attributes['fields']['adminid']) {
$linker = UI::getLinker(); $linker = UI::getLinker();
return [ return [
'type' => 'link', 'type' => 'link',
'data' => [ 'data' => [
'text' => $data, 'text' => $attributes['data'],
'href' => $linker->getLink([ 'href' => $linker->getLink([
'section' => 'admins', 'section' => 'admins',
'page' => 'admins', 'page' => 'admins',
'action' => 'su', 'action' => 'su',
'id' => $attributes['adminid'], 'id' => $attributes['fields']['adminid'],
]), ]),
] ]
]; ];
} }
return $data; return $attributes['data'];
} }
public static function customer(string $data, array $attributes): array public static function customer(array $attributes): array
{ {
$linker = UI::getLinker(); $linker = UI::getLinker();
return [ return [
'type' => 'link', 'type' => 'link',
'data' => [ 'data' => [
'text' => $data, 'text' => $attributes['data'],
'href' => $linker->getLink([ 'href' => $linker->getLink([
'section' => 'customers', 'section' => 'customers',
'page' => 'customers', 'page' => 'customers',
'action' => 'su', 'action' => 'su',
'sort' => $attributes['loginname'], 'sort' => $attributes['fields']['loginname'],
'id' => $attributes['customerid'], 'id' => $attributes['fields']['customerid'],
]), ]),
] ]
]; ];

View File

@@ -15,16 +15,15 @@ use Froxlor\Database\Database;
* @copyright (c) the authors * @copyright (c) the authors
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Listing * @package Froxlor\UI\Callbacks
* *
*/ */
class Mysql class Mysql
{ {
public static function dbserver(string $data, array $attributes): string public static function dbserver(array $attributes): string
{ {
// get sql-root access data // get sql-root access data
Database::needRoot(true, (int) $data); Database::needRoot(true, (int)$attributes['data']);
Database::needSqlData(); Database::needSqlData();
$sql_root = Database::getSqlData(); $sql_root = Database::getSqlData();
Database::needRoot(false); Database::needRoot(false);

View File

@@ -3,6 +3,7 @@
namespace Froxlor\UI\Callbacks; namespace Froxlor\UI\Callbacks;
use Froxlor\PhpHelper; use Froxlor\PhpHelper;
use Froxlor\Settings;
use Froxlor\UI\Panel\UI; use Froxlor\UI\Panel\UI;
/** /**
@@ -17,42 +18,40 @@ use Froxlor\UI\Panel\UI;
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @author Maurice Preuß <hello@envoyr.com> * @author Maurice Preuß <hello@envoyr.com>
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Listing * @package Froxlor\UI\Callbacks
* *
*/ */
class ProgressBar class ProgressBar
{ {
/** /**
* get progressbar data for used diskspace * get progressbar data for used diskspace
* *
* @param string $data * @param array $attributes
* @param array $attributes * @return array
* @return array */
*/ public static function diskspace(array $attributes): array
public static function diskspace(string $data, array $attributes): array
{ {
$infotext = null; $infotext = null;
if (isset($attributes['webspace_used']) && isset($attributes['mailspace_used']) && isset($attributes['dbspace_used'])) { if (isset($attributes['fields']['webspace_used']) && isset($attributes['fields']['mailspace_used']) && isset($attributes['fields']['dbspace_used'])) {
$infotext = UI::getLng('panel.used') . ':<br>'; $infotext = UI::getLng('panel.used') . ':<br>';
$infotext .= 'web: ' . PhpHelper::sizeReadable($attributes['webspace_used'] * 1024, null, 'bi') . '<br>'; $infotext .= 'web: ' . PhpHelper::sizeReadable($attributes['fields']['webspace_used'] * 1024, null, 'bi') . '<br>';
$infotext .= 'mail: ' . PhpHelper::sizeReadable($attributes['mailspace_used'] * 1024, null, 'bi') . '<br>'; $infotext .= 'mail: ' . PhpHelper::sizeReadable($attributes['fields']['mailspace_used'] * 1024, null, 'bi') . '<br>';
$infotext .= 'mysql: ' . PhpHelper::sizeReadable($attributes['dbspace_used'] * 1024, null, 'bi'); $infotext .= 'mysql: ' . PhpHelper::sizeReadable($attributes['fields']['dbspace_used'] * 1024, null, 'bi');
} }
return self::pbData('diskspace', $attributes, 1024, (int)\Froxlor\Settings::Get('system.report_webmax'), $infotext); return self::pbData('diskspace', $attributes['fields'], 1024, (int)Settings::Get('system.report_webmax'), $infotext);
} }
/** /**
* get progressbar data for traffic * get progressbar data for traffic
* *
* @param string $data * @param array $attributes['fields']
* @param array $attributes * @return array
* @return array */
*/ public static function traffic(array $attributes): array
public static function traffic(string $data, array $attributes): array
{ {
return self::pbData('traffic', $attributes, 1024 * 1024, (int)\Froxlor\Settings::Get('system.report_trafficmax')); return self::pbData('traffic', $attributes['fields'], 1024 * 1024, (int)Settings::Get('system.report_trafficmax'));
} }
/** /**
* do needed calculations * do needed calculations
@@ -62,7 +61,7 @@ class ProgressBar
$percent = 0; $percent = 0;
$style = 'bg-info'; $style = 'bg-info';
$text = PhpHelper::sizeReadable($attributes[$field . '_used'] * $size_factor, null, 'bi') . ' / ' . UI::getLng('panel.unlimited'); $text = PhpHelper::sizeReadable($attributes[$field . '_used'] * $size_factor, null, 'bi') . ' / ' . UI::getLng('panel.unlimited');
if ((int) $attributes[$field] >= 0) { if ((int)$attributes[$field] >= 0) {
if (($attributes[$field] / 100) * $report_max < $attributes[$field . '_used']) { if (($attributes[$field] / 100) * $report_max < $attributes[$field . '_used']) {
$style = 'bg-danger'; $style = 'bg-danger';
} elseif (($attributes[$field] / 100) * ($report_max - 15) < $attributes[$field . '_used']) { } elseif (($attributes[$field] / 100) * ($report_max - 15) < $attributes[$field . '_used']) {
@@ -76,13 +75,13 @@ class ProgressBar
} }
return [ return [
'type' => 'progressbar', 'type' => 'progressbar',
'data' => [ 'data' => [
'percent' => $percent, 'percent' => $percent,
'style' => $style, 'style' => $style,
'text' => $text, 'text' => $text,
'infotext' => $infotext 'infotext' => $infotext
] ]
]; ];
} }
} }

View File

@@ -0,0 +1,32 @@
<?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-)
* @author Maurice Preuß <hello@envoyr.com>
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Froxlor\UI\Callbacks
*
*/
class SSLCertificates
{
public static function domainWithSan(array $attributes): array
{
return [
'type' => 'domainWithSan',
'data' => [
'domain' => $attributes['data'],
'san' => implode(', ', $attributes['fields']['san'] ?? []),
]
];
}
}

View File

@@ -0,0 +1,54 @@
<?php
namespace Froxlor\UI\Callbacks;
use Froxlor\PhpHelper;
use Froxlor\Settings;
use Froxlor\UI\Panel\UI;
use Froxlor\User;
/**
* 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-)
* @author Maurice Preuß <hello@envoyr.com>
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Froxlor\UI\Callbacks
*
*/
class Style
{
public static function deactivated(array $attributes): string
{
return $attributes['fields']['deactivated'] ? 'bg-danger' : '';
}
public static function diskspaceWarning(array $attributes): string
{
return self::getWarningStyle('diskspace', $attributes['fields'], (int)Settings::Get('system.report_webmax'));
}
public static function trafficWarning(array $attributes): string
{
return self::getWarningStyle('traffic', $attributes['fields'], (int)Settings::Get('system.report_trafficmax'));
}
private static function getWarningStyle(string $field, array $attributes, int $report_max = 90): string
{
$style = '';
if ((int)$attributes[$field] >= 0) {
if (($attributes[$field] / 100) * $report_max < $attributes[$field . '_used']) {
$style = 'bg-danger';
} elseif (($attributes[$field] / 100) * ($report_max - 15) < $attributes[$field . '_used']) {
$style = 'bg-warning';
}
}
return $style;
}
}

View File

@@ -3,6 +3,9 @@
namespace Froxlor\UI\Callbacks; namespace Froxlor\UI\Callbacks;
use Froxlor\PhpHelper; use Froxlor\PhpHelper;
use Froxlor\Settings;
use Froxlor\UI\Panel\UI;
use Froxlor\User;
/** /**
* This file is part of the Froxlor project. * This file is part of the Froxlor project.
@@ -16,37 +19,26 @@ use Froxlor\PhpHelper;
* @author Froxlor team <team@froxlor.org> (2010-) * @author Froxlor team <team@froxlor.org> (2010-)
* @author Maurice Preuß <hello@envoyr.com> * @author Maurice Preuß <hello@envoyr.com>
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Listing * @package Froxlor\UI\Callbacks
* *
*/ */
class Text class Text
{ {
public static function boolean(?string $data): array public static function boolean(array $attributes): array
{ {
return [ return [
'type' => 'boolean', 'type' => 'boolean',
'data' => (bool) $data 'data' => (bool)$attributes['data']
]; ];
} }
public static function domainWithSan(string $data, array $attributes): array public static function customerfullname(array $attributes): string
{ {
return [ return User::getCorrectFullUserDetails($attributes['fields']);
'type' => 'domainWithSan',
'data' => [
'domain' => $data,
'san' => implode(', ', $attributes['san'] ?? []),
]
];
} }
public static function customerfullname(string $data, array $attributes): string public static function size(array $attributes): string
{ {
return \Froxlor\User::getCorrectFullUserDetails($attributes); return PhpHelper::sizeReadable($attributes['data'], null, 'bi');
}
public static function size(string $data, array $attributes): string
{
return PhpHelper::sizeReadable($data, null, 'bi');
} }
} }

View File

@@ -75,11 +75,11 @@ class Listing
} }
$format_callback = $tabellisting['columns'][$visible_column]['format_callback'] ?? null; $format_callback = $tabellisting['columns'][$visible_column]['format_callback'] ?? null;
$column = $tabellisting['columns'][$visible_column]['column']; $column = $tabellisting['columns'][$visible_column]['field'];
$data = self::getMultiArrayFromString($item, $column); $data = self::getMultiArrayFromString($item, $column);
if ($format_callback) { if ($format_callback) {
$rows[$row]['td'][$col]['data'] = call_user_func($format_callback, $data, $item); $rows[$row]['td'][$col]['data'] = call_user_func($format_callback, ['data' => $data, 'fields' => $item]);
} else { } else {
$rows[$row]['td'][$col]['data'] = $data; $rows[$row]['td'][$col]['data'] = $data;
} }
@@ -87,10 +87,14 @@ class Listing
$rows[$row]['td'][$col]['class'] = $tabellisting['columns'][$visible_column]['class'] ?? null; $rows[$row]['td'][$col]['class'] = $tabellisting['columns'][$visible_column]['class'] ?? null;
} }
// TODO: contextual_class ... // Set row classes from format_callback
//if (...) { if (isset($tabellisting['format_callback'])) {
// $rows[$key]['class'] = '...'; $class = [];
//} foreach ($tabellisting['format_callback'] as $format_callback) {
$class[] = call_user_func($format_callback, ['fields' => $item]);
}
$rows[$row]['class'] = implode(' ', $class);
}
// Set all actions for row // Set all actions for row
if (isset($tabellisting['actions'])) { if (isset($tabellisting['actions'])) {

View File

@@ -17,6 +17,7 @@
*/ */
use Froxlor\UI\Callbacks\ProgressBar; use Froxlor\UI\Callbacks\ProgressBar;
use Froxlor\UI\Callbacks\Style;
use Froxlor\UI\Callbacks\Text; use Froxlor\UI\Callbacks\Text;
use Froxlor\UI\Listing; use Froxlor\UI\Listing;
@@ -27,36 +28,36 @@ return [
'columns' => [ 'columns' => [
'adminid' => [ 'adminid' => [
'label' => '#', 'label' => '#',
'column' => 'adminid', 'field' => 'adminid',
'sortable' => true, 'sortable' => true,
], ],
'loginname' => [ 'loginname' => [
'label' => $lng['login']['username'], 'label' => $lng['login']['username'],
'column' => 'loginname', 'field' => 'loginname',
'sortable' => true, 'sortable' => true,
], ],
'name' => [ 'name' => [
'label' => $lng['customer']['name'], 'label' => $lng['customer']['name'],
'column' => 'name', 'field' => 'name',
], ],
'customers_used' => [ 'customers_used' => [
'label' => $lng['admin']['customers'], 'label' => $lng['admin']['customers'],
'column' => 'customers_used', 'field' => 'customers_used',
'class' => 'text-center', 'class' => 'text-center',
], ],
'diskspace' => [ 'diskspace' => [
'label' => $lng['customer']['diskspace'], 'label' => $lng['customer']['diskspace'],
'column' => 'diskspace', 'field' => 'diskspace',
'format_callback' => [ProgressBar::class, 'diskspace'], 'format_callback' => [ProgressBar::class, 'diskspace'],
], ],
'traffic' => [ 'traffic' => [
'label' => $lng['customer']['traffic'], 'label' => $lng['customer']['traffic'],
'column' => 'traffic', 'field' => 'traffic',
'format_callback' => [ProgressBar::class, 'traffic'], 'format_callback' => [ProgressBar::class, 'traffic'],
], ],
'deactivated' => [ 'deactivated' => [
'label' => $lng['admin']['deactivated'], 'label' => $lng['admin']['deactivated'],
'column' => 'deactivated', 'field' => 'deactivated',
'class' => 'text-center', 'class' => 'text-center',
'format_callback' => [Text::class, 'boolean'], 'format_callback' => [Text::class, 'boolean'],
], ],
@@ -90,11 +91,10 @@ return [
], ],
], ],
], ],
'contextual_class' => [ 'format_callback' => [
'deactivated' => [ [Style::class, 'deactivated'],
'value' => true, [Style::class, 'diskspaceWarning'],
'return' => 'bg-secondary' [Style::class, 'trafficWarning']
]
] ]
] ]
]; ];

View File

@@ -28,31 +28,31 @@ return [
'columns' => [ 'columns' => [
'c.name' => [ 'c.name' => [
'label' => $lng['customer']['name'], 'label' => $lng['customer']['name'],
'column' => 'name', 'field' => 'name',
'format_callback' => [Text::class, 'customerfullname'], 'format_callback' => [Text::class, 'customerfullname'],
], ],
'c.loginname' => [ 'c.loginname' => [
'label' => $lng['login']['username'], 'label' => $lng['login']['username'],
'column' => 'loginname', 'field' => 'loginname',
'format_callback' => [Impersonate::class, 'customer'], 'format_callback' => [Impersonate::class, 'customer'],
], ],
'a.loginname' => [ 'a.loginname' => [
'label' => $lng['admin']['admin'], 'label' => $lng['admin']['admin'],
'column' => 'admin.loginname', 'field' => 'admin.loginname',
'format_callback' => [Impersonate::class, 'admin'], 'format_callback' => [Impersonate::class, 'admin'],
], ],
'c.email' => [ 'c.email' => [
'label' => $lng['customer']['email'], 'label' => $lng['customer']['email'],
'column' => 'email', 'field' => 'email',
], ],
'c.diskspace' => [ 'c.diskspace' => [
'label' => $lng['customer']['diskspace'], 'label' => $lng['customer']['diskspace'],
'column' => 'diskspace', 'field' => 'diskspace',
'format_callback' => [ProgressBar::class, 'diskspace'], 'format_callback' => [ProgressBar::class, 'diskspace'],
], ],
'c.traffic' => [ 'c.traffic' => [
'label' => $lng['customer']['traffic'], 'label' => $lng['customer']['traffic'],
'column' => 'traffic', 'field' => 'traffic',
'format_callback' => [ProgressBar::class, 'traffic'], 'format_callback' => [ProgressBar::class, 'traffic'],
], ],
], ],

View File

@@ -27,21 +27,21 @@ return [
'columns' => [ 'columns' => [
'd.domain_ace' => [ 'd.domain_ace' => [
'label' => $lng['domains']['domainname'], 'label' => $lng['domains']['domainname'],
'column' => 'domain_ace', 'field' => 'domain_ace',
], ],
'c.name' => [ 'c.name' => [
'label' => $lng['customer']['name'], 'label' => $lng['customer']['name'],
'column' => 'customer.name', 'field' => 'customer.name',
'format_callback' => [Text::class, 'customerfullname'], 'format_callback' => [Text::class, 'customerfullname'],
], ],
'c.loginname' => [ 'c.loginname' => [
'label' => $lng['login']['username'], 'label' => $lng['login']['username'],
'column' => 'customer.loginname', 'field' => 'customer.loginname',
'format_callback' => [Impersonate::class, 'customer'], 'format_callback' => [Impersonate::class, 'customer'],
], ],
'd.aliasdomain' => [ 'd.aliasdomain' => [
'label' => $lng['domains']['aliasdomain'], 'label' => $lng['domains']['aliasdomain'],
'column' => 'aliasdomain', 'field' => 'aliasdomain',
], ],
], ],
'visible_columns' => Listing::getVisibleColumnsForListing('domain_list', [ 'visible_columns' => Listing::getVisibleColumnsForListing('domain_list', [

View File

@@ -27,49 +27,49 @@ return [
'columns' => [ 'columns' => [
'ip' => [ 'ip' => [
'label' => $lng['admin']['ipsandports']['ip'], 'label' => $lng['admin']['ipsandports']['ip'],
'column' => 'ip', 'field' => 'ip',
], ],
'port' => [ 'port' => [
'label' => $lng['admin']['ipsandports']['port'], 'label' => $lng['admin']['ipsandports']['port'],
'column' => 'port', 'field' => 'port',
'class' => 'text-center', 'class' => 'text-center',
], ],
'listen' => [ 'listen' => [
'label' => 'Listen', 'label' => 'Listen',
'column' => 'listen_statement', 'field' => 'listen_statement',
'class' => 'text-center', 'class' => 'text-center',
'format_callback' => [Text::class, 'boolean'], 'format_callback' => [Text::class, 'boolean'],
'visible' => Settings::Get('system.webserver') != 'nginx' 'visible' => Settings::Get('system.webserver') != 'nginx'
], ],
'namevirtualhost' => [ 'namevirtualhost' => [
'label' => 'NameVirtualHost', 'label' => 'NameVirtualHost',
'column' => 'namevirtualhost_statement', 'field' => 'namevirtualhost_statement',
'class' => 'text-center', 'class' => 'text-center',
'format_callback' => [Text::class, 'boolean'], 'format_callback' => [Text::class, 'boolean'],
'visible' => Settings::Get('system.webserver') == 'apache2' && (int) Settings::Get('system.apache24') == 0 'visible' => Settings::Get('system.webserver') == 'apache2' && (int) Settings::Get('system.apache24') == 0
], ],
'vhostcontainer' => [ 'vhostcontainer' => [
'label' => 'vHost-Container', 'label' => 'vHost-Container',
'column' => 'vhostcontainer', 'field' => 'vhostcontainer',
'class' => 'text-center', 'class' => 'text-center',
'format_callback' => [Text::class, 'boolean'] 'format_callback' => [Text::class, 'boolean']
], ],
'specialsettings' => [ 'specialsettings' => [
'label' => 'Specialsettings', 'label' => 'Specialsettings',
'column' => 'specialsettings', 'field' => 'specialsettings',
'class' => 'text-center', 'class' => 'text-center',
'format_callback' => [Text::class, 'boolean'] 'format_callback' => [Text::class, 'boolean']
], ],
'servername' => [ 'servername' => [
'label' => 'ServerName', 'label' => 'ServerName',
'column' => 'vhostcontainer_servername_statement', 'field' => 'vhostcontainer_servername_statement',
'class' => 'text-center', 'class' => 'text-center',
'format_callback' => [Text::class, 'boolean'], 'format_callback' => [Text::class, 'boolean'],
'visible' => Settings::Get('system.webserver') == 'apache2' 'visible' => Settings::Get('system.webserver') == 'apache2'
], ],
'ssl' => [ 'ssl' => [
'label' => 'SSL', 'label' => 'SSL',
'column' => 'ssl', 'field' => 'ssl',
'class' => 'text-center', 'class' => 'text-center',
'format_callback' => [Text::class, 'boolean'] 'format_callback' => [Text::class, 'boolean']
], ],

View File

@@ -26,19 +26,19 @@ return [
'columns' => [ 'columns' => [
'p.name' => [ 'p.name' => [
'label' => $lng['admin']['plans']['name'], 'label' => $lng['admin']['plans']['name'],
'column' => 'name', 'field' => 'name',
], ],
'p.description' => [ 'p.description' => [
'label' => $lng['admin']['plans']['description'], 'label' => $lng['admin']['plans']['description'],
'column' => 'description', 'field' => 'description',
], ],
'p.adminname' => [ 'p.adminname' => [
'label' => $lng['admin']['admin'], 'label' => $lng['admin']['admin'],
'column' => 'adminname', 'field' => 'adminname',
], ],
'p.ts' => [ 'p.ts' => [
'label' => $lng['admin']['plans']['last_update'], 'label' => $lng['admin']['plans']['last_update'],
'column' => 'ts', 'field' => 'ts',
], ],
], ],
'visible_columns' => Listing::getVisibleColumnsForListing('sslcertificates_list', [ 'visible_columns' => Listing::getVisibleColumnsForListing('sslcertificates_list', [

View File

@@ -17,6 +17,7 @@
*/ */
use Froxlor\Settings; use Froxlor\Settings;
use Froxlor\UI\Callbacks\SSLCertificates;
use Froxlor\UI\Callbacks\Text; use Froxlor\UI\Callbacks\Text;
use Froxlor\UI\Listing; use Froxlor\UI\Listing;
@@ -27,28 +28,28 @@ return [
'columns' => [ 'columns' => [
'd.domain' => [ 'd.domain' => [
'label' => $lng['domains']['domainname'], 'label' => $lng['domains']['domainname'],
'column' => 'domain', 'field' => 'domain',
], ],
'c.domain' => [ 'c.domain' => [
'label' => $lng['ssl_certificates']['certificate_for'], 'label' => $lng['ssl_certificates']['certificate_for'],
'column' => 'domain', 'field' => 'domain',
'format_callback' => [Text::class, 'domainWithSan'], 'format_callback' => [SSLCertificates::class, 'domainWithSan'],
], ],
'c.issuer' => [ 'c.issuer' => [
'label' => $lng['ssl_certificates']['issuer'], 'label' => $lng['ssl_certificates']['issuer'],
'column' => 'issuer', 'field' => 'issuer',
], ],
'c.validfromdate' => [ 'c.validfromdate' => [
'label' => $lng['ssl_certificates']['valid_from'], 'label' => $lng['ssl_certificates']['valid_from'],
'column' => 'validfromdate', 'field' => 'validfromdate',
], ],
'c.validtodate' => [ 'c.validtodate' => [
'label' => $lng['ssl_certificates']['valid_until'], 'label' => $lng['ssl_certificates']['valid_until'],
'column' => 'validtodate', 'field' => 'validtodate',
], ],
'c.letsencrypt' => [ 'c.letsencrypt' => [
'label' => $lng['panel']['letsencrypt'], 'label' => $lng['panel']['letsencrypt'],
'column' => 'letsencrypt', 'field' => 'letsencrypt',
'class' => 'text-center', 'class' => 'text-center',
'format_callback' => [Text::class, 'boolean'], 'format_callback' => [Text::class, 'boolean'],
'visible' => Settings::Get('system.le_froxlor_enabled'), 'visible' => Settings::Get('system.le_froxlor_enabled'),

View File

@@ -27,20 +27,20 @@ return [
'columns' => [ 'columns' => [
'databasename' => [ 'databasename' => [
'label' => $lng['mysql']['databasename'], 'label' => $lng['mysql']['databasename'],
'column' => 'databasename', 'field' => 'databasename',
], ],
'description' => [ 'description' => [
'label' => $lng['mysql']['databasedescription'], 'label' => $lng['mysql']['databasedescription'],
'column' => 'description' 'field' => 'description'
], ],
'size' => [ 'size' => [
'label' => $lng['mysql']['size'], 'label' => $lng['mysql']['size'],
'column' => 'size', 'field' => 'size',
'format_callback' => [Text::class, 'size'] 'format_callback' => [Text::class, 'size']
], ],
'dbserver' => [ 'dbserver' => [
'label' => $lng['mysql']['mysql_server'], 'label' => $lng['mysql']['mysql_server'],
'column' => 'dbserver', 'field' => 'dbserver',
'format_callback' => [Mysql::class, 'dbserver'], 'format_callback' => [Mysql::class, 'dbserver'],
'visible' => $count_mysqlservers > 1 'visible' => $count_mysqlservers > 1
] ]