more tablelistings and php-related formfields

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2022-02-28 10:51:19 +01:00
parent bebdb3a93f
commit 5133d26f6f
19 changed files with 241 additions and 96 deletions

View File

@@ -0,0 +1,62 @@
<?php
namespace Froxlor\UI\Callbacks;
use Froxlor\Idna\IdnaWrapper;
use Froxlor\UI\Panel\UI;
/**
* 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 PHPConf
{
public static function domainList(array $attributes)
{
$idna = new IdnaWrapper;
$domains = "";
$subdomains_count = count($attributes['fields']['subdomains']);
foreach ($attributes['fields']['domains'] as $configdomain) {
$domains .= $idna->decode($configdomain) . "<br>";
}
if ($subdomains_count == 0 && empty($domains)) {
$domains = UI::getLng('admin.phpsettings.notused');
} else {
$domains .= (!empty($domains) ? '+ ' : '') . $subdomains_count . ' ' . UI::getLng(('customer.subdomains'));
}
return $domains;
}
public static function isNotDefault(array $attributes)
{
return $attributes['fields']['id'] != 1;
}
public static function fpmConfLink(array $attributes)
{
$linker = UI::getLinker();
return [
'type' => 'link',
'data' => [
'text' => $attributes['data'],
'href' => $linker->getLink([
'section' => 'phpsettings',
'page' => 'fpmdaemons',
'action' => 'edit',
'id' => $attributes['fields']['fpmsettingid'],
]),
]
];
}
}

View File

@@ -43,8 +43,11 @@ return array(
'pm' => array(
'label' => $lng['serversettings']['phpfpm_settings']['pm'],
'type' => 'select',
'select_var' => $pm_select,
'selected' => '@TODO'
'select_var' => [
'static' => 'static',
'dynamic' => 'dynamic',
'ondemand' => 'ondemand'
]
),
'max_children' => array(
'label' => $lng['serversettings']['phpfpm_settings']['max_children']['title'],

View File

@@ -44,8 +44,12 @@ return array(
'pm' => array(
'label' => $lng['serversettings']['phpfpm_settings']['pm'],
'type' => 'select',
'select_var' => $pm_select,
'selected' => '@TODO'
'select_var' => [
'static' => 'static',
'dynamic' => 'dynamic',
'ondemand' => 'ondemand'
],
'selected' => $result['pm']
),
'max_children' => array(
'label' => $lng['serversettings']['phpfpm_settings']['max_children']['title'],

View File

@@ -40,7 +40,7 @@ return array(
'label' => $lng['admin']['phpsettings']['fpmdesc'],
'type' => 'select',
'select_var' => $fpmconfigs,
'selected' => '@TODO'
'selected' => 1
),
'file_extensions' => array(
'visible' => (\Froxlor\Settings::Get('system.mod_fcgid') == 1 ? true : false),
@@ -107,8 +107,11 @@ return array(
'label' => $lng['serversettings']['phpfpm_settings']['pm'],
'desc' => $lng['serversettings']['phpfpm_settings']['override_fpmconfig_addinfo'],
'type' => 'select',
'select_var' => $pm_select,
'selected' => '@TODO'
'select_var' => [
'static' => 'static',
'dynamic' => 'dynamic',
'ondemand' => 'ondemand'
]
),
'max_children' => array(
'visible' => (\Froxlor\Settings::Get('phpfpm.enabled') == 1 ? true : false),

View File

@@ -41,7 +41,7 @@ return array(
'label' => $lng['admin']['phpsettings']['fpmdesc'],
'type' => 'select',
'select_var' => $fpmconfigs,
'selected' => '@TODO'
'selected' => $result['fpmsettingid']
),
'file_extensions' => array(
'visible' => (\Froxlor\Settings::Get('system.mod_fcgid') == 1 ? true : false),
@@ -55,13 +55,13 @@ return array(
'visible' => (\Froxlor\Settings::Get('system.mod_fcgid') == 1 ? true : false),
'label' => $lng['admin']['mod_fcgid_starter']['title'],
'type' => 'number',
'value' => ((int) $result['mod_fcgid_starter'] != - 1 ? $result['mod_fcgid_starter'] : '')
'value' => ((int) $result['mod_fcgid_starter'] != -1 ? $result['mod_fcgid_starter'] : '')
),
'mod_fcgid_maxrequests' => array(
'visible' => (\Froxlor\Settings::Get('system.mod_fcgid') == 1 ? true : false),
'label' => $lng['admin']['mod_fcgid_maxrequests']['title'],
'type' => 'number',
'value' => ((int) $result['mod_fcgid_maxrequests'] != - 1 ? $result['mod_fcgid_maxrequests'] : '')
'value' => ((int) $result['mod_fcgid_maxrequests'] != -1 ? $result['mod_fcgid_maxrequests'] : '')
),
'mod_fcgid_umask' => array(
'visible' => (\Froxlor\Settings::Get('system.mod_fcgid') == 1 ? true : false),
@@ -109,8 +109,12 @@ return array(
'label' => $lng['serversettings']['phpfpm_settings']['pm'],
'desc' => $lng['serversettings']['phpfpm_settings']['override_fpmconfig_addinfo'],
'type' => 'select',
'select_var' => $pm_select,
'selected' => '@TODO'
'select_var' => [
'static' => 'static',
'dynamic' => 'dynamic',
'ondemand' => 'ondemand'
],
'selected' => $result['pm']
),
'max_children' => array(
'visible' => (\Froxlor\Settings::Get('phpfpm.enabled') == 1 ? true : false),

View File

@@ -0,0 +1,85 @@
<?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-)
* @author Maurice Preuß <hello@envoyr.com>
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
* @package Tabellisting
*
*/
use Froxlor\UI\Callbacks\PHPConf;
use Froxlor\UI\Listing;
use Froxlor\Settings;
return [
'phpconf_list' => [
'title' => $lng['menue']['phpsettings']['maintitle'],
'icon' => 'fa-brands fa-php',
'columns' => [
'c.description' => [
'label' => $lng['admin']['phpsettings']['description'],
'field' => 'description',
],
'domains' => [
'label' => $lng['admin']['phpsettings']['activedomains'],
'field' => 'domains',
'text' => [PHPConf::class, 'domainList']
],
'fpmdesc' => [
'label' => $lng['admin']['phpsettings']['fpmdesc'],
'field' => 'fpmdesc',
'visible' => (bool) Settings::Get('phpfpm.enabled'),
'format_callback' => [PHPConf::class, 'fpmConfLink']
],
'c.binary' => [
'label' => $lng['admin']['phpsettings']['binary'],
'field' => 'binary',
'visible' => !(bool) Settings::Get('phpfpm.enabled')
],
'c.file_extensions' => [
'label' => $lng['admin']['phpsettings']['file_extensions'],
'field' => 'file_extensions',
],
],
'visible_columns' => Listing::getVisibleColumnsForListing('phpconf_list', [
'c.description',
'domains',
'fpmdesc',
'c.binary',
'c.file_extensions'
]),
'actions' => [
'edit' => [
'icon' => 'fa fa-edit',
'title' => $lng['panel']['edit'],
'href' => [
'section' => 'phpsettings',
'page' => 'overview',
'action' => 'edit',
'id' => ':id'
],
],
'delete' => [
'icon' => 'fa fa-trash',
'title' => $lng['panel']['delete'],
'class' => 'text-danger',
'href' => [
'section' => 'phpsettings',
'page' => 'overview',
'action' => 'delete',
'id' => ':id'
],
'visible' => [PHPConf::class, 'isNotDefault']
]
]
]
];