correction for mandatory fields in forms

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2022-08-26 09:06:42 +02:00
parent 8f64460647
commit 7f6ea29e15
19 changed files with 75 additions and 21 deletions

View File

@@ -53,11 +53,11 @@ if ($page == 'domains' || $page == 'overview') {
$log->logAction(FroxlorLogger::ADM_ACTION, LOG_NOTICE, "viewed admin_domains"); $log->logAction(FroxlorLogger::ADM_ACTION, LOG_NOTICE, "viewed admin_domains");
try { try {
$customerCollection = (new Collection(Customers::class, $userinfo));
$domain_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/admin/tablelisting.domains.php'; $domain_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/admin/tablelisting.domains.php';
$collection = (new Collection(Domains::class, $userinfo)) $collection = (new Collection(Domains::class, $userinfo))
->has('customer', Customers::class, 'customerid', 'customerid') ->has('customer', Customers::class, 'customerid', 'customerid')
->withPagination($domain_list_data['domain_list']['columns']); ->withPagination($domain_list_data['domain_list']['columns']);
$customerCollection = (new Collection(Customers::class, $userinfo));
} catch (Exception $e) { } catch (Exception $e) {
Response::dynamicError($e->getMessage()); Response::dynamicError($e->getMessage());
} }

View File

@@ -27,6 +27,7 @@ const AREA = 'admin';
require __DIR__ . '/lib/init.php'; require __DIR__ . '/lib/init.php';
use Froxlor\Api\Commands\HostingPlans; use Froxlor\Api\Commands\HostingPlans;
use Froxlor\Api\Commands\MysqlServer;
use Froxlor\Database\Database; use Froxlor\Database\Database;
use Froxlor\FroxlorLogger; use Froxlor\FroxlorLogger;
use Froxlor\PhpHelper; use Froxlor\PhpHelper;
@@ -105,6 +106,20 @@ if ($page == '' || $page == 'overview') {
'page' => $page 'page' => $page
]); ]);
} else { } else {
$mysql_servers = [];
try {
$result_json = MysqlServer::getLocal($userinfo)->listing();
$result_decoded = json_decode($result_json, true)['data']['list'];
foreach ($result_decoded as $dbserver => $dbdata) {
$mysql_servers[] = [
'label' => $dbdata['caption'],
'value' => $dbserver
];
}
} catch (Exception $e) {
/* just none */
}
$phpconfigs = []; $phpconfigs = [];
$configs = Database::query(" $configs = Database::query("
SELECT c.*, fc.description as interpreter SELECT c.*, fc.description as interpreter
@@ -128,8 +143,8 @@ if ($page == '' || $page == 'overview') {
// dummy to avoid unknown variables // dummy to avoid unknown variables
$hosting_plans = null; $hosting_plans = null;
$plans_add_data = include_once dirname(__FILE__) . '/lib/formfields/admin/plans/formfield.plans_add.php'; $plans_add_data = include_once __DIR__ . '/lib/formfields/admin/plans/formfield.plans_add.php';
$cust_add_data = include_once dirname(__FILE__) . '/lib/formfields/admin/customer/formfield.customer_add.php'; $cust_add_data = include_once __DIR__ . '/lib/formfields/admin/customer/formfield.customer_add.php';
// unset unneeded stuff // unset unneeded stuff
unset($cust_add_data['customer_add']['sections']['section_a']); unset($cust_add_data['customer_add']['sections']['section_a']);
unset($cust_add_data['customer_add']['sections']['section_b']); unset($cust_add_data['customer_add']['sections']['section_b']);
@@ -171,6 +186,20 @@ if ($page == '' || $page == 'overview') {
'page' => $page 'page' => $page
]); ]);
} else { } else {
$mysql_servers = [];
try {
$result_json = MysqlServer::getLocal($userinfo)->listing();
$result_decoded = json_decode($result_json, true)['data']['list'];
foreach ($result_decoded as $dbserver => $dbdata) {
$mysql_servers[] = [
'label' => $dbdata['caption'],
'value' => $dbserver
];
}
} catch (Exception $e) {
/* just none */
}
$phpconfigs = []; $phpconfigs = [];
$configs = Database::query(" $configs = Database::query("
SELECT c.*, fc.description as interpreter SELECT c.*, fc.description as interpreter
@@ -216,8 +245,8 @@ if ($page == '' || $page == 'overview') {
$hosting_plans = null; $hosting_plans = null;
$admin_select = []; $admin_select = [];
$plans_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/plans/formfield.plans_edit.php'; $plans_edit_data = include_once __DIR__ . '/lib/formfields/admin/plans/formfield.plans_edit.php';
$cust_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/customer/formfield.customer_edit.php'; $cust_edit_data = include_once __DIR__ . '/lib/formfields/admin/customer/formfield.customer_edit.php';
// unset unneeded stuff // unset unneeded stuff
unset($cust_edit_data['customer_edit']['sections']['section_a']); unset($cust_edit_data['customer_edit']['sections']['section_a']);
unset($cust_edit_data['customer_edit']['sections']['section_b']); unset($cust_edit_data['customer_edit']['sections']['section_b']);

View File

@@ -176,6 +176,11 @@ if ($page == 'overview' || $page == 'emails') {
$result = json_decode($json_result, true)['data']; $result = json_decode($json_result, true)['data'];
if (isset($result['email']) && $result['email'] != '') { if (isset($result['email']) && $result['email'] != '') {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
Response::redirectTo($filename, [
'page' => $page
]);
}
$result['email'] = $idna_convert->decode($result['email']); $result['email'] = $idna_convert->decode($result['email']);
$result['email_full'] = $idna_convert->decode($result['email_full']); $result['email_full'] = $idna_convert->decode($result['email_full']);
$result['destination'] = explode(' ', $result['destination']); $result['destination'] = explode(' ', $result['destination']);

View File

@@ -70,6 +70,9 @@ if (Froxlor::isFroxlor()) {
Update::lastStepStatus(0); Update::lastStepStatus(0);
} }
// reset cached version check
Settings::Set('system.updatecheck_data', '');
$filelog->logAction(FroxlorLogger::ADM_ACTION, LOG_WARNING, '--------------- END LOG ---------------'); $filelog->logAction(FroxlorLogger::ADM_ACTION, LOG_WARNING, '--------------- END LOG ---------------');
unset($filelog); unset($filelog);
} }

View File

@@ -40,7 +40,7 @@ return [
'new_loginname' => [ 'new_loginname' => [
'label' => lng('login.username'), 'label' => lng('login.username'),
'type' => 'text', 'type' => 'text',
'placeholder' => 'Leave empty for autogenerated value' 'placeholder' => lng('admin.username_default_msg')
], ],
'createstdsubdomain' => [ 'createstdsubdomain' => [
'label' => lng('admin.stdsubdomain_add') . '?', 'label' => lng('admin.stdsubdomain_add') . '?',
@@ -58,6 +58,7 @@ return [
'label' => lng('login.password'), 'label' => lng('login.password'),
'type' => 'password', 'type' => 'password',
'autocomplete' => 'off', 'autocomplete' => 'off',
'placeholder' => lng('admin.username_default_msg'),
'next_to' => [ 'next_to' => [
'new_customer_password_suggestion' => [ 'new_customer_password_suggestion' => [
'next_to_prefix' => lng('customer.generated_pwd') . ':', 'next_to_prefix' => lng('customer.generated_pwd') . ':',

View File

@@ -35,7 +35,7 @@ return [
'title' => lng('menue.main.changepassword'), 'title' => lng('menue.main.changepassword'),
'image' => 'icons/email_edit.png', 'image' => 'icons/email_edit.png',
'fields' => [ 'fields' => [
'email_full' => [ 'emailaddr' => [
'label' => lng('emails.emailaddress'), 'label' => lng('emails.emailaddress'),
'type' => 'label', 'type' => 'label',
'value' => $result['email_full'] 'value' => $result['email_full']

View File

@@ -32,7 +32,7 @@ return [
'title' => lng('emails.quota_edit'), 'title' => lng('emails.quota_edit'),
'image' => 'icons/email_edit.png', 'image' => 'icons/email_edit.png',
'fields' => [ 'fields' => [
'email_full' => [ 'emailaddr' => [
'label' => lng('emails.emailaddress'), 'label' => lng('emails.emailaddress'),
'type' => 'label', 'type' => 'label',
'value' => $result['email_full'] 'value' => $result['email_full']

View File

@@ -44,6 +44,7 @@ return [
'label' => lng('login.password'), 'label' => lng('login.password'),
'type' => 'password', 'type' => 'password',
'autocomplete' => 'off', 'autocomplete' => 'off',
'mandatory' => true,
'next_to' => [ 'next_to' => [
'admin_password_suggestion' => [ 'admin_password_suggestion' => [
'next_to_prefix' => lng('customer.generated_pwd') . ':', 'next_to_prefix' => lng('customer.generated_pwd') . ':',

View File

@@ -39,7 +39,8 @@ return [
], ],
'destination' => [ 'destination' => [
'label' => lng('emails.to'), 'label' => lng('emails.to'),
'type' => 'email' 'type' => 'email',
'mandatory' => true
] ]
] ]
] ]

View File

@@ -118,6 +118,11 @@ return [
] ]
] ]
] ]
],
'buttons' => [
[
'label' => lng('panel.backtooverview')
]
] ]
] ]
]; ];

View File

@@ -42,6 +42,7 @@ return [
'select_var' => $pathSelect['select_var'] ?? '', 'select_var' => $pathSelect['select_var'] ?? '',
'value' => $pathSelect['value'], 'value' => $pathSelect['value'],
'note' => $pathSelect['note'] ?? '', 'note' => $pathSelect['note'] ?? '',
'mandatory' => true
], ],
'options_indexes' => [ 'options_indexes' => [
'label' => lng('extras.directory_browsing'), 'label' => lng('extras.directory_browsing'),

View File

@@ -43,15 +43,18 @@ return [
'select_var' => $pathSelect['select_var'] ?? '', 'select_var' => $pathSelect['select_var'] ?? '',
'value' => $pathSelect['value'], 'value' => $pathSelect['value'],
'note' => $pathSelect['note'] ?? '', 'note' => $pathSelect['note'] ?? '',
'mandatory' => true
], ],
'username' => [ 'username' => [
'label' => lng('login.username'), 'label' => lng('login.username'),
'type' => 'text' 'type' => 'text',
'mandatory' => true
], ],
'directory_password' => [ 'directory_password' => [
'label' => lng('login.password'), 'label' => lng('login.password'),
'type' => 'password', 'type' => 'password',
'autocomplete' => 'off' 'autocomplete' => 'off',
'mandatory' => true
], ],
'directory_password_suggestion' => [ 'directory_password_suggestion' => [
'label' => lng('customer.generated_pwd'), 'label' => lng('customer.generated_pwd'),
@@ -61,7 +64,8 @@ return [
], ],
'directory_authname' => [ 'directory_authname' => [
'label' => lng('extras.htpasswdauthname'), 'label' => lng('extras.htpasswdauthname'),
'type' => 'text' 'type' => 'text',
'mandatory' => true
] ]
] ]
] ]

View File

@@ -60,7 +60,8 @@ return [
'directory_authname' => [ 'directory_authname' => [
'label' => lng('extras.htpasswdauthname'), 'label' => lng('extras.htpasswdauthname'),
'type' => 'text', 'type' => 'text',
'value' => $result['authname'] 'value' => $result['authname'],
'mandatory' => true
] ]
] ]
] ]

View File

@@ -52,11 +52,13 @@ return [
'select_var' => $pathSelect['select_var'] ?? '', 'select_var' => $pathSelect['select_var'] ?? '',
'value' => $pathSelect['value'], 'value' => $pathSelect['value'],
'note' => $pathSelect['note'] ?? '', 'note' => $pathSelect['note'] ?? '',
'mandatory' => true
], ],
'ftp_password' => [ 'ftp_password' => [
'label' => lng('login.password'), 'label' => lng('login.password'),
'type' => 'password', 'type' => 'password',
'autocomplete' => 'off' 'autocomplete' => 'off',
'mandatory' => true
], ],
'ftp_password_suggestion' => [ 'ftp_password_suggestion' => [
'label' => lng('customer.generated_pwd'), 'label' => lng('customer.generated_pwd'),

View File

@@ -45,7 +45,8 @@ return [
'mysql_password' => [ 'mysql_password' => [
'label' => lng('login.password'), 'label' => lng('login.password'),
'type' => 'password', 'type' => 'password',
'autocomplete' => 'off' 'autocomplete' => 'off',
'mandatory' => true
], ],
'mysql_password_suggestion' => [ 'mysql_password_suggestion' => [
'label' => lng('customer.generated_pwd'), 'label' => lng('customer.generated_pwd'),

View File

@@ -33,7 +33,7 @@ use Froxlor\UI\Listing;
return [ return [
'customer_list' => [ 'customer_list' => [
'title' => lng('admin.customers'), 'title' => lng('admin.customers'),
'description' => 'Manage your customers', 'description' => lng('admin.customers_list_desc'),
'icon' => 'fa-solid fa-user', 'icon' => 'fa-solid fa-user',
'self_overview' => ['section' => 'customers', 'page' => 'customers'], 'self_overview' => ['section' => 'customers', 'page' => 'customers'],
'columns' => [ 'columns' => [

View File

@@ -33,7 +33,7 @@ return [
'domain_list' => [ 'domain_list' => [
'title' => lng('admin.domains'), 'title' => lng('admin.domains'),
'icon' => 'fa-solid fa-globe', 'icon' => 'fa-solid fa-globe',
'empty_msg' => lng('admin.domain_nocustomeraddingavailable'), 'empty_msg' => $customerCollection->count() == 0 ? lng('admin.domain_nocustomeraddingavailable') : '',
'self_overview' => ['section' => 'domains', 'page' => 'domains'], 'self_overview' => ['section' => 'domains', 'page' => 'domains'],
'columns' => [ 'columns' => [
'd.id' => [ 'd.id' => [

View File

@@ -1240,7 +1240,7 @@ return [
'errordocument401path' => 'ErrorDocument 401', 'errordocument401path' => 'ErrorDocument 401',
'execute_perl' => 'Execute perl/CGI', 'execute_perl' => 'Execute perl/CGI',
'htpasswdauthname' => 'Authentication reason (AuthName)', 'htpasswdauthname' => 'Authentication reason (AuthName)',
'directoryprotection_edit' => 'edit directory protection', 'directoryprotection_edit' => 'Edit directory protection',
'backup' => 'Create backup', 'backup' => 'Create backup',
'backup_web' => 'Backup web-data', 'backup_web' => 'Backup web-data',
'backup_mail' => 'Backup mail-data', 'backup_mail' => 'Backup mail-data',

View File

@@ -3,7 +3,7 @@
{% if norow == false and field.type != 'hidden' %} {% if norow == false and field.type != 'hidden' %}
<div class="row g-0 formfield d-flex align-items-center"> <div class="row g-0 formfield d-flex align-items-center">
{% if field.label is iterable %} {% if field.label is iterable %}
<label for="{{ id }}" class="col-sm-4 col-form-label pe-3"> <label for="{{ id }}" class="col-sm-6 col-form-label pe-3">
{% if em %} {% if em %}
<mark> <mark>
{% endif %} {% endif %}
@@ -15,7 +15,7 @@
{% endif %} {% endif %}
</label> </label>
{% else %} {% else %}
<label for="{{ id }}" class="col-sm-4 col-form-label pe-3"> <label for="{{ id }}" class="col-sm-6 col-form-label pe-3">
{% if em %} {% if em %}
<mark> <mark>
{% endif %} {% endif %}
@@ -27,7 +27,7 @@
{% endif %} {% endif %}
</label> </label>
{% endif %} {% endif %}
<div class="col-sm-8"> <div class="col-sm-6">
{% endif %} {% endif %}
{% if field.type == 'text' or field.type == 'password' or field.type == 'number' or field.type == 'file' or field.type == 'email' or field.type == 'url' or field.type == 'hidden' or field.type == 'date' or field.type == 'datetime-local' %} {% if field.type == 'text' or field.type == 'password' or field.type == 'number' or field.type == 'file' or field.type == 'email' or field.type == 'url' or field.type == 'hidden' or field.type == 'date' or field.type == 'datetime-local' %}
{{ _self.input(id, field) }} {{ _self.input(id, field) }}