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");
try {
$customerCollection = (new Collection(Customers::class, $userinfo));
$domain_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/admin/tablelisting.domains.php';
$collection = (new Collection(Domains::class, $userinfo))
->has('customer', Customers::class, 'customerid', 'customerid')
->withPagination($domain_list_data['domain_list']['columns']);
$customerCollection = (new Collection(Customers::class, $userinfo));
} catch (Exception $e) {
Response::dynamicError($e->getMessage());
}

View File

@@ -27,6 +27,7 @@ const AREA = 'admin';
require __DIR__ . '/lib/init.php';
use Froxlor\Api\Commands\HostingPlans;
use Froxlor\Api\Commands\MysqlServer;
use Froxlor\Database\Database;
use Froxlor\FroxlorLogger;
use Froxlor\PhpHelper;
@@ -105,6 +106,20 @@ if ($page == '' || $page == 'overview') {
'page' => $page
]);
} 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 = [];
$configs = Database::query("
SELECT c.*, fc.description as interpreter
@@ -128,8 +143,8 @@ if ($page == '' || $page == 'overview') {
// dummy to avoid unknown variables
$hosting_plans = null;
$plans_add_data = include_once dirname(__FILE__) . '/lib/formfields/admin/plans/formfield.plans_add.php';
$cust_add_data = include_once dirname(__FILE__) . '/lib/formfields/admin/customer/formfield.customer_add.php';
$plans_add_data = include_once __DIR__ . '/lib/formfields/admin/plans/formfield.plans_add.php';
$cust_add_data = include_once __DIR__ . '/lib/formfields/admin/customer/formfield.customer_add.php';
// unset unneeded stuff
unset($cust_add_data['customer_add']['sections']['section_a']);
unset($cust_add_data['customer_add']['sections']['section_b']);
@@ -171,6 +186,20 @@ if ($page == '' || $page == 'overview') {
'page' => $page
]);
} 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 = [];
$configs = Database::query("
SELECT c.*, fc.description as interpreter
@@ -216,8 +245,8 @@ if ($page == '' || $page == 'overview') {
$hosting_plans = null;
$admin_select = [];
$plans_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/plans/formfield.plans_edit.php';
$cust_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/customer/formfield.customer_edit.php';
$plans_edit_data = include_once __DIR__ . '/lib/formfields/admin/plans/formfield.plans_edit.php';
$cust_edit_data = include_once __DIR__ . '/lib/formfields/admin/customer/formfield.customer_edit.php';
// unset unneeded stuff
unset($cust_edit_data['customer_edit']['sections']['section_a']);
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'];
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_full'] = $idna_convert->decode($result['email_full']);
$result['destination'] = explode(' ', $result['destination']);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -39,7 +39,8 @@ return [
],
'destination' => [
'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'] ?? '',
'value' => $pathSelect['value'],
'note' => $pathSelect['note'] ?? '',
'mandatory' => true
],
'options_indexes' => [
'label' => lng('extras.directory_browsing'),

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -33,7 +33,7 @@ return [
'domain_list' => [
'title' => lng('admin.domains'),
'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'],
'columns' => [
'd.id' => [

View File

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

View File

@@ -3,7 +3,7 @@
{% if norow == false and field.type != 'hidden' %}
<div class="row g-0 formfield d-flex align-items-center">
{% 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 %}
<mark>
{% endif %}
@@ -15,7 +15,7 @@
{% endif %}
</label>
{% 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 %}
<mark>
{% endif %}
@@ -27,7 +27,7 @@
{% endif %}
</label>
{% endif %}
<div class="col-sm-8">
<div class="col-sm-6">
{% 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' %}
{{ _self.input(id, field) }}