minor fixes in pagination and alertbox stuff

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2022-03-04 16:12:25 +01:00
parent 30d64973c3
commit 8256f31374
11 changed files with 110 additions and 66 deletions

View File

@@ -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') {

View File

@@ -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();

View File

@@ -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.<br /><br />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.<br />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.';

View File

@@ -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.<br /><br />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.<br />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.';

View File

@@ -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.<br /><br />Ä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.<br />Ä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.';

View File

@@ -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<br /><br />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<br />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.';

View File

@@ -3,23 +3,5 @@
{% set body_class = "min-vh-100 d-flex align-items-center" %}
{% block content %}
<div class="alert alert-{{ type }} fade show" role="alert">
<h4 class="alert-heading">
{{ heading }}
</h4>
<p>
{{ alert_msg|raw }}
</p>
{% if alert_info %}
<hr>
<p class="mb-0">
<pre>{{ alert_info|raw }}</pre>
</p>
{% endif %}
{% if redirect_link %}
<p class="mt-1">
<a href="{{ redirect_link|raw }}" class="btn btn-{{ btntype }}">{% if type == 'danger' %}{{ lng('panel.back') }}{% else %}{{ lng('success.clickheretocontinue') }}{% endif %}</a>
</p>
{% endif %}
</div>
{% include 'Froxlor/misc/alertbox.html.twig' %}
{% endblock %}

View File

@@ -3,23 +3,5 @@
{% set body_class = "min-vh-100 d-flex align-items-center" %}
{% block content %}
<div class="alert alert-{{ type }} fade show" role="alert">
<h4 class="alert-heading">
{{ heading }}
</h4>
<p>
{{ alert_msg|raw }}
</p>
{% if alert_info %}
<hr>
<p class="mb-0">
<pre>{{ alert_info|raw }}</pre>
</p>
{% endif %}
{% if redirect_link %}
<p class="mt-1 text-center">
<a href="{{ redirect_link }}" class="btn btn-{{ type }}">{% if type == 'danger' %}{{ lng('panel.back') }}{% else %}{{ lng('success.clickheretocontinue') }}{% endif %}</a>
</p>
{% endif %}
</div>
{% include 'Froxlor/misc/alertbox.html.twig' %}
{% endblock %}

View File

@@ -0,0 +1,27 @@
<div class="alert alert-{{ type }} fade show pb-0" role="alert">
{% if heading is defined and heading is not empty %}
<h4 class="alert-heading">
{{ heading }}
</h4>
{% endif %}
<p>
{{ alert_msg|raw }}
</p>
{% if alert_info %}
<hr>
<p class="mb-0">
<pre>{{ alert_info|raw }}</pre>
</p>
{% endif %}
{% if redirect_link %}
<p class="mt-1">
<a href="{{ redirect_link|raw }}" class="btn btn-{{ btntype }}">
{% if type == 'danger' %}
{{ lng('panel.back') }}
{% else %}
{{ lng('success.clickheretocontinue') }}
{% endif %}
</a>
</p>
{% endif %}
</div>

View File

@@ -1,18 +1,57 @@
{% macro paging(pagination) %}
{% if pagination.last_page > 1 %}
<div class="card-footer border-top">
{% if pagination.current_page > 2 %}
<a href="?s={{ s }}&page={{ page }}&action={{ action }}&pageno=1">&laquo;</a>
{% endif %}
{% if pagination.current_page > 1 %}
<a href="?s={{ s }}&page={{ page }}&action={{ action }}&pageno={{ pagination.current_page - 1 }}">&lsaquo;</a>
{% endif %}
{% if pagination.current_page < pagination.last_page %}
<a href="?s={{ s }}&page={{ page }}&action={{ action }}&pageno={{ pagination.current_page + 1 }}">&rsaquo;</a>
{% endif %}
{% if pagination.current_page < pagination.last_page %}
<a href="?s={{ s }}&page={{ page }}&action={{ action }}&pageno={{ pagination.last_page }}">&raquo;</a>
{% endif %}
<nav aria-label="Pagination">
<ul class="pagination justify-content-center">
{% if pagination.current_page == 1 %}
<li class="page-item disabled">
<a class="page-link" href="#" tabindex="-1" aria-disabled="true">
<i class="fa-solid fa-backward-fast"></i>
</a>
</li>
<li class="page-item disabled">
<a class="page-link" href="#" tabindex="-1" aria-disabled="true">
<i class="fa-solid fa-backward"></i>
</a>
</li>
{% elseif pagination.current_page > 1 %}
<li class="page-item">
<a class="page-link" href="?s={{ s }}&page={{ page }}&action={{ action }}&pageno=1" tabindex="-1">
<i class="fa-solid fa-backward-fast"></i>
</a>
</li>
<li class="page-item">
<a class="page-link" href="?s={{ s }}&page={{ page }}&action={{ action }}&pageno={{ pagination.current_page - 1 }}" tabindex="-1">
<i class="fa-solid fa-backward"></i>
</a>
</li>
{% endif %}
{% if pagination.current_page < pagination.last_page %}
<li class="page-item">
<a class="page-link" href="?s={{ s }}&page={{ page }}&action={{ action }}&pageno={{ pagination.current_page + 1 }}" tabindex="-1">
<i class="fa-solid fa-forward"></i>
</a>
</li>
<li class="page-item">
<a class="page-link" href="?s={{ s }}&page={{ page }}&action={{ action }}&pageno={{ pagination.last_page }}" tabindex="-1">
<i class="fa-solid fa-forward-fast"></i>
</a>
</li>
{% else %}
<li class="page-item disabled">
<a class="page-link" href="#" tabindex="-1" aria-disabled="true">
<i class="fa-solid fa-forward"></i>
</a>
</li>
<li class="page-item disabled">
<a class="page-link" href="#" tabindex="-1" aria-disabled="true">
<i class="fa-solid fa-forward-fast"></i>
</a>
</li>
{% endif %}
</ul>
</nav>
</div>
{% endif %}
{% endmacro %}

View File

@@ -0,0 +1,8 @@
{% extends "Froxlor/user/table.html.twig" %}
{% block content %}
<div class="row mb-2">
{% include 'Froxlor/misc/alertbox.html.twig' %}
</div>
{{ parent() }}
{% endblock %}