first refactor of config-files

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2022-03-18 09:37:50 +01:00
parent dc798c63c7
commit 974e02694e
7 changed files with 207 additions and 209 deletions

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,12 @@
{% extends "Froxlor/settings/configuration.html.twig" %}
{% block content %}
<div class="row mb-2">
{% include 'Froxlor/misc/alertbox.html.twig' %}
</div>
<div class="row mb-2">
<textarea cols="12" rows="4" readonly class="form-control w-100">`which php` {{ basedir }}install/scripts/config-services.php --froxlor-dir={{ basedir }} --apply={{ params_filename }}
rm {{ params_filename }}</textarea>
</div>
{% endblock %}

View File

@@ -0,0 +1,103 @@
{% extends "Froxlor/userarea.html.twig" %}
{% block heading %}
<h5>
<i class="fa-solid fa-wrench"></i>
{{ lng('admin.configfiles.serverconfiguration') }}
</h5>
<span class="text-muted">Configure the system services</span>
{% endblock %}
{% block actions %}
<a class="btn btn-outline-primary" href="{{ linker({'section':'configfiles'}) }}">
<i class="fa-solid fa-grip me-1"></i>
{{ lng('admin.configfiles.distribution') }}:
{{ distribution }}
</a>
{% endblock %}
{% block content %}
<form action="{{ action|default(filename) }}" method="post" enctype="application/x-www-form-urlencoded" class="form">
{% block settings %}
<div class="row row-cols-2 row-cols-md-2 row-cols-xl-4 g-3">
{% for stype,field in fields %}
<div class="col">
<div class="card h-100 position-relative">
<div class="card-body">
<h5 class="card-title">{{ stype|upper }}</h5>
{% if stype != 'system' %}
<div class="form-check">
<input class="form-check-input" type="radio" name="{{ stype }}" id="{{ stype }}none" value="x" checked>
<label class="form-check-label" for="{{ stype }}none">
Nicht (erneut) konfigurieren
</label>
</div>
{% endif %}
{% set daemons = field.getDaemons %}
{% for dtype,daemon in daemons %}
{% if stype == 'system' %}
<div class="form-check">
{% set recommended = false %}
{% if
(dtype == 'awstats' and get_setting('system.awstats_enabled') == '1') or
(dtype == 'libnssextrausers' and (get_setting('system.mod_fcgid') == '1' or get_setting('phpfpm.enabled') == '1' or get_setting('system.apacheitksupport') == '1')) or
(dtype == 'logrotate') or
(dtype == 'fcgid' and get_setting('system.mod_fcgid') == '1') or
(dtype == 'php-fpm' and get_setting('phpfpm.enabled') == '1') or
(dtype == 'cron')
%}
{% set recommended = true %}
{% endif %}
<input class="form-check-input" type="checkbox" name="system[{{ dtype }}]" id="{{ dtype }}" value="{{ dtype }}" data-recommended="{{ recommended }}">
<label class="form-check-label" for="{{ dtype }}">
{% if recommended %}
<strong>{{ daemon.title }}<span class="text-danger">*</span></strong>
{% else %}
{{ daemon.title }}
{% endif %}
</label>
</div>
{% else %}
<div class="form-check">
{% set recommended = false %}
{% if
(dtype == 'apache22' and get_setting('system.webserver') == 'apache2' and get_setting('system.apache24') == '0') or
(dtype == 'apache24' and get_setting('system.webserver') == 'apache2' and get_setting('system.apache24') == '1') or
(dtype == 'lighttpd' and get_setting('system.webserver') == 'lighttpd') or
(dtype == 'nginx' and get_setting('system.webserver') == 'nginx') or
(dtype == 'bind' and get_setting('system.bind_enable') == '1' and get_setting('system.dns_server') == 'Bind') or
(dtype == 'powerdns' and get_setting('system.bind_enable') == '1' and get_setting('system.dns_server') == 'PowerDNS') or
(dtype == 'proftpd' and get_setting('system.ftpserver') == 'proftpd') or
(dtype == 'pureftpd' and get_setting('system.ftpserver') == 'pureftpd')
%}
{% set recommended = true %}
{% endif %}
<input class="form-check-input" type="radio" name="{{ stype }}" id="{{ dtype }}" value="{{ dtype }}" data-recommended="{{ recommended }}">
<label class="form-check-label" for="{{ dtype }}">
{% if recommended %}
<strong>{{ daemon.title }}<span class="text-danger">*</span></strong>
{% else %}
{{ daemon.title }}
{% endif %}
</label>
</div>
{% endif %}
{% endfor %}
</div>
</div>
</div>
{% endfor %}
</div>
{% endblock %}
<div class="row mt-3">
<input type="hidden" name="finish" value="1"/>
<div class="col-12 col-md-6">
<span class="text-danger">*</span> Empfohlene/benötigte Dienste ahand der aktuellen Systemeinstellungen
</div>
<div class="col-12 col-md-6 text-end">
<button type="button" class="btn btn-outline-secondary" id="selectRecommendedConfig">Empfohlene auswählen</button>
<button type="submit" class="btn btn-primary">{{ lng('update.proceed') }}</button>
</div>
</div>
</form>
{% endblock %}

View File

@@ -0,0 +1,14 @@
$(document).ready(function () {
/*
* config files - select all recommended
*/
$('#selectRecommendedConfig').click(function () {
$('input[data-recommended]').each(function () {
if ($(this).data('recommended') == 1) {
$(this).prop('checked', true);
} else {
$(this).prop('checked', false);
}
})
});
});

View File

@@ -15,3 +15,4 @@ require('./components/updatecheck')
require('./components/customer')
require('./components/ipsandports')
require('./components/domains')
require('./components/configfiles')