move email settings to the top and hide then optional domain-settings when adding/editing domain as admin; fixes #1012
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
@@ -68,7 +68,12 @@ class Domain
|
||||
|
||||
public static function canViewLogs(array $attributes): bool
|
||||
{
|
||||
return (bool)UI::getCurrentUser()['logviewenabled'];
|
||||
if ((int) UI::getCurrentUser()['adminsession'] == 0 && (bool)UI::getCurrentUser()['logviewenabled']) {
|
||||
return true;
|
||||
} elseif ((int) UI::getCurrentUser()['adminsession'] == 1 && (int)$attributes['fields']['email_only'] == 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function canDelete(array $attributes): bool
|
||||
@@ -102,7 +107,7 @@ class Domain
|
||||
|
||||
public static function hasLetsEncryptActivated(array $attributes): bool
|
||||
{
|
||||
return (bool) $attributes['fields']['letsencrypt'];
|
||||
return ((bool) $attributes['fields']['letsencrypt'] && (int)$attributes['fields']['email_only'] == 0);
|
||||
}
|
||||
|
||||
public static function canEditSSL(array $attributes): bool
|
||||
@@ -110,8 +115,9 @@ class Domain
|
||||
if (
|
||||
Settings::Get('system.use_ssl') == '1'
|
||||
&& DDomain::domainHasSslIpPort($attributes['fields']['id'])
|
||||
&& $attributes['fields']['caneditdomain'] == '1'
|
||||
&& $attributes['fields']['letsencrypt'] == 0
|
||||
&& (int)$attributes['fields']['caneditdomain'] == 1
|
||||
&& (int)$attributes['fields']['letsencrypt'] == 0
|
||||
&& (int)$attributes['fields']['email_only'] == 0
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -80,6 +80,37 @@ return array(
|
||||
)
|
||||
)
|
||||
),
|
||||
'section_e' => array(
|
||||
'title' => $lng['admin']['mailserversettings'],
|
||||
'image' => 'icons/domain_add.png',
|
||||
'fields' => array(
|
||||
'isemaildomain' => array(
|
||||
'label' => $lng['admin']['emaildomain'],
|
||||
'type' => 'checkbox',
|
||||
'value' => '1',
|
||||
'checked' => true
|
||||
),
|
||||
'email_only' => array(
|
||||
'label' => $lng['admin']['email_only'],
|
||||
'type' => 'checkbox',
|
||||
'value' => '1',
|
||||
'checked' => false
|
||||
),
|
||||
'subcanemaildomain' => array(
|
||||
'label' => $lng['admin']['subdomainforemail'],
|
||||
'type' => 'select',
|
||||
'select_var' => $subcanemaildomain,
|
||||
'selected' => 0
|
||||
),
|
||||
'dkim' => array(
|
||||
'visible' => (\Froxlor\Settings::Get('dkim.use_dkim') == '1' ? true : false),
|
||||
'label' => 'DomainKeys',
|
||||
'type' => 'checkbox',
|
||||
'value' => '1',
|
||||
'checked' => true
|
||||
)
|
||||
)
|
||||
),
|
||||
'section_b' => array(
|
||||
'title' => $lng['admin']['webserversettings'],
|
||||
'image' => 'icons/domain_add.png',
|
||||
@@ -361,37 +392,6 @@ return array(
|
||||
'type' => 'text'
|
||||
)
|
||||
)
|
||||
),
|
||||
'section_e' => array(
|
||||
'title' => $lng['admin']['mailserversettings'],
|
||||
'image' => 'icons/domain_add.png',
|
||||
'fields' => array(
|
||||
'isemaildomain' => array(
|
||||
'label' => $lng['admin']['emaildomain'],
|
||||
'type' => 'checkbox',
|
||||
'value' => '1',
|
||||
'checked' => true
|
||||
),
|
||||
'email_only' => array(
|
||||
'label' => $lng['admin']['email_only'],
|
||||
'type' => 'checkbox',
|
||||
'value' => '1',
|
||||
'checked' => false
|
||||
),
|
||||
'subcanemaildomain' => array(
|
||||
'label' => $lng['admin']['subdomainforemail'],
|
||||
'type' => 'select',
|
||||
'select_var' => $subcanemaildomain,
|
||||
'selected' => 0
|
||||
),
|
||||
'dkim' => array(
|
||||
'visible' => (\Froxlor\Settings::Get('dkim.use_dkim') == '1' ? true : false),
|
||||
'label' => 'DomainKeys',
|
||||
'type' => 'checkbox',
|
||||
'value' => '1',
|
||||
'checked' => true
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -93,6 +93,37 @@ return array(
|
||||
)
|
||||
)
|
||||
),
|
||||
'section_e' => array(
|
||||
'title' => $lng['admin']['mailserversettings'],
|
||||
'image' => 'icons/domain_edit.png',
|
||||
'fields' => array(
|
||||
'isemaildomain' => array(
|
||||
'label' => $lng['admin']['emaildomain'],
|
||||
'type' => 'checkbox',
|
||||
'value' => '1',
|
||||
'checked' => $result['isemaildomain']
|
||||
),
|
||||
'email_only' => array(
|
||||
'label' => $lng['admin']['email_only'],
|
||||
'type' => 'checkbox',
|
||||
'value' => '1',
|
||||
'checked' => $result['email_only']
|
||||
),
|
||||
'subcanemaildomain' => array(
|
||||
'label' => $lng['admin']['subdomainforemail'],
|
||||
'type' => 'select',
|
||||
'select_var' => $subcanemaildomain,
|
||||
'selected' => $result['subcanemaildomain']
|
||||
),
|
||||
'dkim' => array(
|
||||
'visible' => (\Froxlor\Settings::Get('dkim.use_dkim') == '1' ? true : false),
|
||||
'label' => 'DomainKeys',
|
||||
'type' => 'checkbox',
|
||||
'value' => '1',
|
||||
'checked' => $result['dkim']
|
||||
)
|
||||
)
|
||||
),
|
||||
'section_b' => array(
|
||||
'title' => $lng['admin']['webserversettings'],
|
||||
'image' => 'icons/domain_edit.png',
|
||||
@@ -397,37 +428,6 @@ return array(
|
||||
'value' => $result['zonefile']
|
||||
)
|
||||
)
|
||||
),
|
||||
'section_e' => array(
|
||||
'title' => $lng['admin']['mailserversettings'],
|
||||
'image' => 'icons/domain_edit.png',
|
||||
'fields' => array(
|
||||
'isemaildomain' => array(
|
||||
'label' => $lng['admin']['emaildomain'],
|
||||
'type' => 'checkbox',
|
||||
'value' => '1',
|
||||
'checked' => $result['isemaildomain']
|
||||
),
|
||||
'email_only' => array(
|
||||
'label' => $lng['admin']['email_only'],
|
||||
'type' => 'checkbox',
|
||||
'value' => '1',
|
||||
'checked' => $result['email_only']
|
||||
),
|
||||
'subcanemaildomain' => array(
|
||||
'label' => $lng['admin']['subdomainforemail'],
|
||||
'type' => 'select',
|
||||
'select_var' => $subcanemaildomain,
|
||||
'selected' => $result['subcanemaildomain']
|
||||
),
|
||||
'dkim' => array(
|
||||
'visible' => (\Froxlor\Settings::Get('dkim.use_dkim') == '1' ? true : false),
|
||||
'label' => 'DomainKeys',
|
||||
'type' => 'checkbox',
|
||||
'value' => '1',
|
||||
'checked' => $result['dkim']
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -71,6 +71,7 @@ return [
|
||||
'page' => 'logfiles',
|
||||
'domain_id' => ':id'
|
||||
],
|
||||
'visible' => [Domain::class, 'canViewLogs']
|
||||
],
|
||||
'domaindnseditor' => [
|
||||
'icon' => 'fa fa-globe',
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -3,8 +3,8 @@
|
||||
{% import "Froxlor/form/formfields.html.twig" as formfields %}
|
||||
|
||||
<form action="{{ formaction|default("") }}" method="post" enctype="application/x-www-form-urlencoded" class="form">
|
||||
{% for section in form_data.sections %}
|
||||
<div class="card mb-3">
|
||||
{% for sid,section in form_data.sections %}
|
||||
<div class="card mb-3" id="{{ sid }}">
|
||||
{% if section.title is not empty %}
|
||||
<div class="card-header">
|
||||
{% if section.image is not empty %}
|
||||
|
||||
@@ -56,4 +56,27 @@ $(document).ready(function () {
|
||||
});
|
||||
}
|
||||
|
||||
if ($('#id') && $('#email_only').is(':checked')) {
|
||||
// hide unnecessary sections
|
||||
$('#section_b').hide();
|
||||
$('#section_bssl').hide();
|
||||
$('#section_c').hide();
|
||||
$('#section_d').hide();
|
||||
}
|
||||
|
||||
$('#email_only').click(function () {
|
||||
if ($(this).is(':checked')) {
|
||||
// hide unnecessary sections
|
||||
$('#section_b').hide();
|
||||
$('#section_bssl').hide();
|
||||
$('#section_c').hide();
|
||||
$('#section_d').hide();
|
||||
} else {
|
||||
// show sections
|
||||
$('#section_b').show();
|
||||
$('#section_bssl').show();
|
||||
$('#section_c').show();
|
||||
$('#section_d').show();
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user