From 8256f31374ddf0db05be10839498e52b0735d84f Mon Sep 17 00:00:00 2001 From: Michael Kaufmann Date: Fri, 4 Mar 2022 16:12:25 +0100 Subject: [PATCH] minor fixes in pagination and alertbox stuff Signed-off-by: Michael Kaufmann --- admin_cronjobs.php | 5 +- lib/Froxlor/UI/Panel/UI.php | 25 ++++---- lng/dutch.lng.php | 2 +- lng/english.lng.php | 2 +- lng/german.lng.php | 2 +- lng/italian.lng.php | 2 +- templates/Froxlor/misc/alert.html.twig | 20 +----- .../Froxlor/misc/alert_nosession.html.twig | 20 +----- templates/Froxlor/misc/alertbox.html.twig | 27 ++++++++ templates/Froxlor/table/pagination.html.twig | 63 +++++++++++++++---- templates/Froxlor/user/table-note.html.twig | 8 +++ 11 files changed, 110 insertions(+), 66 deletions(-) create mode 100644 templates/Froxlor/misc/alertbox.html.twig create mode 100644 templates/Froxlor/user/table-note.html.twig diff --git a/admin_cronjobs.php b/admin_cronjobs.php index 884b7f9b..67965c68 100644 --- a/admin_cronjobs.php +++ b/admin_cronjobs.php @@ -36,8 +36,11 @@ if ($page == 'cronjobs' || $page == 'overview') { \Froxlor\UI\Response::dynamic_error($e->getMessage()); } - UI::twigBuffer('user/table.html.twig', [ + UI::twigBuffer('user/table-note.html.twig', [ 'listing' => \Froxlor\UI\Listing::format($collection, $cron_list_data['cron_list']), + // alert-box + 'type' => 'warning', + 'alert_msg' => $lng['cron']['changewarning'] ]); UI::twigOutputBuffer(); } elseif ($action == 'new') { diff --git a/lib/Froxlor/UI/Panel/UI.php b/lib/Froxlor/UI/Panel/UI.php index 696ca466..dfc3b300 100644 --- a/lib/Froxlor/UI/Panel/UI.php +++ b/lib/Froxlor/UI/Panel/UI.php @@ -138,7 +138,7 @@ class UI * @return \Twig\Environment */ public static function twig(): ?\Twig\Environment - { + { return self::$twig; } @@ -191,11 +191,9 @@ class UI } catch (\Exception $e) { // whoops, template error $errtpl = 'alert_nosession.html.twig'; - /* - if (\Froxlor\CurrentUser::hasSession()) { + if (self::activeUserSession()) { $errtpl = 'alert.html.twig'; } - */ $edata = array( 'type' => "danger", 'heading' => "Template error", @@ -241,6 +239,11 @@ class UI return self::$userinfo; } + public static function activeUserSession(): bool + { + return !empty(self::$userinfo); + } + public static function setLng($lng = array()) { self::$lng = $lng; @@ -269,14 +272,14 @@ class UI } } - /** - * returns an array of available themes - * - * @return array - * @throws \Exception - */ + /** + * returns an array of available themes + * + * @return array + * @throws \Exception + */ public static function getThemes(): array - { + { $themespath = \Froxlor\FileDir::makeCorrectDir(\Froxlor\Froxlor::getInstallDir() . '/templates/'); $themes_available = array(); diff --git a/lng/dutch.lng.php b/lng/dutch.lng.php index 715f1d85..5ada091e 100644 --- a/lng/dutch.lng.php +++ b/lng/dutch.lng.php @@ -929,7 +929,7 @@ $lng['cronjob']['cronjobsettings'] = 'Instellingen cron-taak'; $lng['cronjob']['cronjobinterval'] = 'Interval uitvoeren'; $lng['panel']['options'] = 'opties'; $lng['admin']['warning'] = 'WAARSCHUWING - Let op!'; -$lng['cron']['changewarning'] = 'Het aanpassen van de ze waarden kunnen van negatieve invloed zijn op het gedrag van Froxlor en haar geautomatiseerde taken.

Pas deze waarden alleen aan wanneer u *zeer zeker* bent van wat u doet.'; +$lng['cron']['changewarning'] = 'Het aanpassen van de ze waarden kunnen van negatieve invloed zijn op het gedrag van Froxlor en haar geautomatiseerde taken.
Pas deze waarden alleen aan wanneer u *zeer zeker* bent van wat u doet.'; $lng['serversettings']['stdsubdomainhost']['title'] = 'Standaarddomein voor klanten'; $lng['serversettings']['stdsubdomainhost']['description'] = 'Welke hostnaam dient gebruikt te worden voor standaard subdomeinen voor klanten. Indien leeg zal de naam van het systeem gebruikt worden.'; diff --git a/lng/english.lng.php b/lng/english.lng.php index e0ac329c..18f0a21b 100644 --- a/lng/english.lng.php +++ b/lng/english.lng.php @@ -1025,7 +1025,7 @@ $lng['cronjob']['cronjobintervalv'] = 'Runtime interval value'; $lng['cronjob']['cronjobinterval'] = 'Runtime interval'; $lng['panel']['options'] = 'Options'; $lng['admin']['warning'] = 'WARNING - Please note!'; -$lng['cron']['changewarning'] = 'Changing these values can have a negative cause to the behavior of Froxlor and its automated tasks.

Please only change values here, if you are sure you know what you are doing.'; +$lng['cron']['changewarning'] = 'Changing these values can have a negative cause to the behavior of Froxlor and its automated tasks.
Please only change values here, if you are sure you know what you are doing.'; $lng['serversettings']['stdsubdomainhost']['title'] = 'Customer standard subdomain'; $lng['serversettings']['stdsubdomainhost']['description'] = 'What hostname should be used to create standard subdomains for customer. If empty, the system-hostname is used.'; diff --git a/lng/german.lng.php b/lng/german.lng.php index 3f5b85d4..10dcc591 100644 --- a/lng/german.lng.php +++ b/lng/german.lng.php @@ -996,7 +996,7 @@ $lng['cronjob']['cronjobintervalv'] = 'Laufzeit-Intervall Wert'; $lng['cronjob']['cronjobinterval'] = 'Laufzeit-Intervall'; $lng['panel']['options'] = 'Optionen'; $lng['admin']['warning'] = 'ACHTUNG - Wichtiger Hinweis!'; -$lng['cron']['changewarning'] = 'Änderungen an diesen Werten können einen negativen Effekt auf das Verhalten von Froxlor und seinen automatisierten Aufgaben haben.

Ändern Sie hier bitte nur etwas, wenn Sie sich über die Folgen im Klaren sind.'; +$lng['cron']['changewarning'] = 'Änderungen an diesen Werten können einen negativen Effekt auf das Verhalten von Froxlor und seinen automatisierten Aufgaben haben.
Ändern Sie hier bitte nur etwas, wenn Sie sich über die Folgen im Klaren sind.'; $lng['serversettings']['stdsubdomainhost']['title'] = 'Kunden Standard-Subdomain'; $lng['serversettings']['stdsubdomainhost']['description'] = 'Welcher Hostname soll für das Erstellen der Kunden-Standard-Subdomain verwendet werden? Falls leer wird der System-Hostname verwendet.'; diff --git a/lng/italian.lng.php b/lng/italian.lng.php index 7a674372..7545829c 100644 --- a/lng/italian.lng.php +++ b/lng/italian.lng.php @@ -950,7 +950,7 @@ $lng['cronjob']['cronjobsettings'] = 'impostazioni Cronjob'; $lng['cronjob']['cronjobinterval'] = 'Durata intervallo'; $lng['panel']['options'] = 'opzioni'; $lng['admin']['warning'] = 'ATTENZIONE - Leggi attentamente!'; -$lng['cron']['changewarning'] = 'La modifica di questi valori può avere conseguenze negative nel comportamento di Froxlor e dei suoi processi automatizzati

Per favore modifica questi valori solo se sei sicuro di quello che stai facendo!'; +$lng['cron']['changewarning'] = 'La modifica di questi valori può avere conseguenze negative nel comportamento di Froxlor e dei suoi processi automatizzati
Per favore modifica questi valori solo se sei sicuro di quello che stai facendo!'; $lng['serversettings']['stdsubdomainhost']['title'] = 'Sottodominio standard cliente'; $lng['serversettings']['stdsubdomainhost']['description'] = 'Quale hostname dovrebbe essere usato per creare sottodomini standard per i clienti. Se vuoto, viene utilizzato l\'hostname del sistema.'; diff --git a/templates/Froxlor/misc/alert.html.twig b/templates/Froxlor/misc/alert.html.twig index b6d910eb..b3c58d2f 100644 --- a/templates/Froxlor/misc/alert.html.twig +++ b/templates/Froxlor/misc/alert.html.twig @@ -3,23 +3,5 @@ {% set body_class = "min-vh-100 d-flex align-items-center" %} {% block content %} - + {% include 'Froxlor/misc/alertbox.html.twig' %} {% endblock %} diff --git a/templates/Froxlor/misc/alert_nosession.html.twig b/templates/Froxlor/misc/alert_nosession.html.twig index 686ca837..0b29cf17 100644 --- a/templates/Froxlor/misc/alert_nosession.html.twig +++ b/templates/Froxlor/misc/alert_nosession.html.twig @@ -3,23 +3,5 @@ {% set body_class = "min-vh-100 d-flex align-items-center" %} {% block content %} - + {% include 'Froxlor/misc/alertbox.html.twig' %} {% endblock %} diff --git a/templates/Froxlor/misc/alertbox.html.twig b/templates/Froxlor/misc/alertbox.html.twig new file mode 100644 index 00000000..2be5d200 --- /dev/null +++ b/templates/Froxlor/misc/alertbox.html.twig @@ -0,0 +1,27 @@ + diff --git a/templates/Froxlor/table/pagination.html.twig b/templates/Froxlor/table/pagination.html.twig index 19d6917e..835ee138 100644 --- a/templates/Froxlor/table/pagination.html.twig +++ b/templates/Froxlor/table/pagination.html.twig @@ -1,18 +1,57 @@ {% macro paging(pagination) %} {% if pagination.last_page > 1 %} {% endif %} {% endmacro %} diff --git a/templates/Froxlor/user/table-note.html.twig b/templates/Froxlor/user/table-note.html.twig new file mode 100644 index 00000000..f5350658 --- /dev/null +++ b/templates/Froxlor/user/table-note.html.twig @@ -0,0 +1,8 @@ +{% extends "Froxlor/user/table.html.twig" %} + +{% block content %} +
+ {% include 'Froxlor/misc/alertbox.html.twig' %} +
+ {{ parent() }} +{% endblock %}