From 181fa9643140300d7dc6cca6d9bcf1ccfade3948 Mon Sep 17 00:00:00 2001 From: Michael Kaufmann Date: Thu, 17 Feb 2022 12:01:54 +0100 Subject: [PATCH] first work on dashboard template (admin and customer) Signed-off-by: Michael Kaufmann --- admin_index.php | 3 +- customer_index.php | 25 +--- lib/init.php | 23 ++-- templates/Froxlor/admin/index.html.twig | 20 --- templates/Froxlor/config.json | 2 +- templates/Froxlor/footer.html.twig | 2 +- templates/Froxlor/sidebarmenu.html.twig | 12 +- templates/Froxlor/user/index.html.twig | 168 ++++++++++++++++++++++++ 8 files changed, 197 insertions(+), 58 deletions(-) delete mode 100644 templates/Froxlor/admin/index.html.twig create mode 100644 templates/Froxlor/user/index.html.twig diff --git a/admin_index.php b/admin_index.php index cb9aa922..8bcdadea 100644 --- a/admin_index.php +++ b/admin_index.php @@ -185,7 +185,8 @@ if ($page == 'overview') { } // @fixme add all the overview/dashboard data from above - UI::TwigBuffer('admin/index.html.twig'); + UI::Twig()->addGlobal('userinfo', $userinfo); + UI::TwigBuffer('user/index.html.twig'); UI::TwigOutputBuffer(); } elseif ($page == 'change_password') { diff --git a/customer_index.php b/customer_index.php index 56a9afc7..a636f373 100644 --- a/customer_index.php +++ b/customer_index.php @@ -22,6 +22,7 @@ require './lib/init.php'; use Froxlor\Database\Database; use Froxlor\Settings; use Froxlor\Api\Commands\Customers as Customers; +use Froxlor\UI\Panel\UI; if ($action == 'logout') { $log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, 'logged out'); @@ -58,15 +59,11 @@ if ($page == 'overview') { "standardsubdomain" => $userinfo['standardsubdomain'] )); - $domains = ''; $domainArray = array(); - while ($row = $domain_stmt->fetch(PDO::FETCH_ASSOC)) { $domainArray[] = $idna_convert->decode($row['domain']); } - natsort($domainArray); - $domains = implode(',
', $domainArray); // standard-subdomain $stdsubdomain = ''; @@ -120,21 +117,13 @@ if ($page == 'overview') { $userinfo['custom_notes'] = ($userinfo['custom_notes'] != '') ? nl2br($userinfo['custom_notes']) : ''; - $services_enabled = ""; - $se = array(); - if ($userinfo['imap'] == '1') - $se[] = "IMAP"; - if ($userinfo['pop3'] == '1') - $se[] = "POP3"; - if ($userinfo['phpenabled'] == '1') - $se[] = "PHP"; - if ($userinfo['perlenabled'] == '1') - $se[] = "Perl/CGI"; - if ($userinfo['api_allowed'] == '1') - $se[] = 'API'; - $services_enabled = implode(", ", $se); + UI::Twig()->addGlobal('userinfo', $userinfo); + UI::TwigBuffer('user/index.html.twig', [ + 'domains' => $domainArray, + 'stdsubdomain' => $stdsubdomain + ]); + UI::TwigOutputBuffer(); - eval("echo \"" . \Froxlor\UI\Template::getTemplate('index/index') . "\";"); } elseif ($page == 'change_password') { if (isset($_POST['send']) && $_POST['send'] == 'send') { diff --git a/lib/init.php b/lib/init.php index 135c0e98..86eb6f60 100644 --- a/lib/init.php +++ b/lib/init.php @@ -436,19 +436,20 @@ if (AREA == 'admin' || AREA == 'customer') { UI::Twig()->addGlobal('nav_entries', $navigation); $js = ""; -if (is_array($_themeoptions) && array_key_exists('js', $_themeoptions['variants'][$themevariant]) && is_array($_themeoptions['variants'][$themevariant]['js'])) { - foreach ($_themeoptions['variants'][$themevariant]['js'] as $jsfile) { - if (file_exists('templates/' . $theme . '/assets/js/' . $jsfile)) { - $js .= '' . "\n"; +$css = ""; +if (is_array($_themeoptions) && array_key_exists('js', $_themeoptions['variants'][$themevariant])) { + if (is_array($_themeoptions['variants'][$themevariant]['js'])) { + foreach ($_themeoptions['variants'][$themevariant]['js'] as $jsfile) { + if (file_exists('templates/' . $theme . '/assets/js/' . $jsfile)) { + $js .= '' . "\n"; + } } } -} - -$css = ""; -if (is_array($_themeoptions) && array_key_exists('css', $_themeoptions['variants'][$themevariant]) && is_array($_themeoptions['variants'][$themevariant]['css'])) { - foreach ($_themeoptions['variants'][$themevariant]['css'] as $cssfile) { - if (file_exists('templates/' . $theme . '/assets/css/' . $cssfile)) { - $css .= '' . "\n"; + if (is_array($_themeoptions['variants'][$themevariant]['css'])) { + foreach ($_themeoptions['variants'][$themevariant]['css'] as $cssfile) { + if (file_exists('templates/' . $theme . '/assets/css/' . $cssfile)) { + $css .= '' . "\n"; + } } } } diff --git a/templates/Froxlor/admin/index.html.twig b/templates/Froxlor/admin/index.html.twig deleted file mode 100644 index b28d30b2..00000000 --- a/templates/Froxlor/admin/index.html.twig +++ /dev/null @@ -1,20 +0,0 @@ -{% extends "Froxlor/userarea.html.twig" %} - -{% block content %} - {% if get_setting('panel.is_configured') == 0 and userinfo.adminsession == 1 and userinfo.change_serversettings == 1 %} -
-

Willkommen bei Froxlor!

-

Damit Froxlor mit dem Backend vernünftig kommunizieren kann, musst du dieses noch Konfigurieren.

- Jetzt konfigurieren - -
- {% endif %} - -
-
-

Test

-
-
-{% endblock %} \ No newline at end of file diff --git a/templates/Froxlor/config.json b/templates/Froxlor/config.json index ddd80c12..ef63a918 100644 --- a/templates/Froxlor/config.json +++ b/templates/Froxlor/config.json @@ -15,7 +15,7 @@ "css": [ "main.css", "dark.css", - "custom.css" + "custom.css" ], "js": [ "main.js", diff --git a/templates/Froxlor/footer.html.twig b/templates/Froxlor/footer.html.twig index c0468248..8e213128 100644 --- a/templates/Froxlor/footer.html.twig +++ b/templates/Froxlor/footer.html.twig @@ -8,7 +8,7 @@ {{ call_static('\\Froxlor\\Froxlor', 'getFullVersion') }} {% endif %} {% endif %} - © 2009-{{ "now"|date("Y") }} by the Froxlor Team + © 2009-{{ "now"|date("Y") }} by the Froxlor Team
{% if install_mode is not defined %} {% if (get_setting('panel.imprint_url') != '') %} {{ lng('imprint') }} diff --git a/templates/Froxlor/sidebarmenu.html.twig b/templates/Froxlor/sidebarmenu.html.twig index dcb748ed..73e03ab0 100644 --- a/templates/Froxlor/sidebarmenu.html.twig +++ b/templates/Froxlor/sidebarmenu.html.twig @@ -11,7 +11,7 @@ @@ -19,7 +19,7 @@ {% else %}