more action-menu and info-box testing for overviews

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2022-02-25 20:13:13 +01:00
parent cdc4eccdd9
commit fc4725cd61
7 changed files with 58 additions and 25 deletions

View File

@@ -33,10 +33,7 @@ if (Settings::IsInList('panel.customer_hide_options', 'domains')) {
$id = (int) Request::get('id'); $id = (int) Request::get('id');
if ($page == 'overview') { if ($page == 'overview' || $page == 'domains') {
$log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_domains");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("domains/domains") . "\";");
} elseif ($page == 'domains') {
if ($action == '') { if ($action == '') {
$log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_domains::domains"); $log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_domains::domains");
@@ -52,11 +49,11 @@ if ($page == 'overview') {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); \Froxlor\UI\Response::dynamic_error($e->getMessage());
} }
$add_link = false;
$json_result = SubDomains::getLocal($userinfo, ['sql_search' => ['d.parentdomainid' => 0]])->listing(); $json_result = SubDomains::getLocal($userinfo, ['sql_search' => ['d.parentdomainid' => 0]])->listing();
$result = json_decode($json_result, true)['data']; $result = json_decode($json_result, true)['data'];
$parentdomains_count = $result['count']; $parentdomains_count = $result['count'];
$add_link = false;
if (($userinfo['subdomains_used'] < $userinfo['subdomains'] || $userinfo['subdomains'] == '-1') && $parentdomains_count != 0) { if (($userinfo['subdomains_used'] < $userinfo['subdomains'] || $userinfo['subdomains'] == '-1') && $parentdomains_count != 0) {
$add_link = [ $add_link = [
'href' => $linker->getLink(['section' => 'domains', 'page' => 'domains', 'action' => 'add']), 'href' => $linker->getLink(['section' => 'domains', 'page' => 'domains', 'action' => 'add']),

View File

@@ -34,10 +34,7 @@ if (Settings::IsInList('panel.customer_hide_options', 'email')) {
$id = (int) Request::get('id'); $id = (int) Request::get('id');
if ($page == 'overview') { if ($page == 'overview' || $page == 'emails') {
$log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_email");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("email/email") . "\";");
} elseif ($page == 'emails') {
if ($action == '') { if ($action == '') {
$log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_email::emails"); $log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_email::emails");
@@ -60,8 +57,18 @@ if ($page == 'overview') {
)); ));
$emaildomains_count = $result2['emaildomains']; $emaildomains_count = $result2['emaildomains'];
$add_link = false;
if (($userinfo['emails_used'] < $userinfo['emails'] || $userinfo['emails'] == '-1') && $emaildomains_count !=0) {
$add_link = [
'href' => $linker->getLink(['section' => 'email', 'page' => $page, 'action' => 'add']),
'label' => $lng['emails']['emails_add']
];
}
UI::twigBuffer('user/table.html.twig', [ UI::twigBuffer('user/table.html.twig', [
'listing' => \Froxlor\UI\Listing::format($list, $email_list_data['email_list']), 'listing' => \Froxlor\UI\Listing::format($list, $email_list_data['email_list']),
'add_link' => $add_link,
'entity_info' => $lng['emails']['description']
]); ]);
UI::twigOutputBuffer(); UI::twigOutputBuffer();
} elseif ($action == 'delete' && $id != 0) { } elseif ($action == 'delete' && $id != 0) {

View File

@@ -33,10 +33,7 @@ if (Settings::IsInList('panel.customer_hide_options', 'extras')) {
$id = (int) Request::get('id'); $id = (int) Request::get('id');
if ($page == 'overview') { if ($page == 'overview' || $page == 'htpasswds') {
$log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_extras");
eval("echo \"" . \Froxlor\UI\Template::getTemplate("extras/extras") . "\";");
} elseif ($page == 'htpasswds') {
// redirect if this customer sub-page is hidden via settings // redirect if this customer sub-page is hidden via settings
if (Settings::IsInList('panel.customer_hide_options', 'extras.directoryprotection')) { if (Settings::IsInList('panel.customer_hide_options', 'extras.directoryprotection')) {
@@ -60,6 +57,11 @@ if ($page == 'overview') {
UI::twigBuffer('user/table.html.twig', [ UI::twigBuffer('user/table.html.twig', [
'listing' => \Froxlor\UI\Listing::format($list, $htpasswd_list_data['htpasswd_list']), 'listing' => \Froxlor\UI\Listing::format($list, $htpasswd_list_data['htpasswd_list']),
'add_link' => [
'href' => $linker->getLink(['section' => 'extras', 'page' => 'htpasswds', 'action' => 'add']),
'label' => $lng['extras']['directoryprotection_add']
],
'entity_info' => $lng['extras']['description']
]); ]);
UI::twigOutputBuffer(); UI::twigOutputBuffer();
} elseif ($action == 'delete' && $id != 0) { } elseif ($action == 'delete' && $id != 0) {
@@ -177,6 +179,11 @@ if ($page == 'overview') {
UI::twigBuffer('user/table.html.twig', [ UI::twigBuffer('user/table.html.twig', [
'listing' => \Froxlor\UI\Listing::format($list, $htaccess_list_data['htaccess_list']), 'listing' => \Froxlor\UI\Listing::format($list, $htaccess_list_data['htaccess_list']),
'add_link' => [
'href' => $linker->getLink(['section' => 'extras', 'page' => 'htaccess', 'action' => 'add']),
'label' => $lng['extras']['pathoptions_add']
],
'entity_info' => $lng['extras']['description']
]); ]);
UI::twigOutputBuffer(); UI::twigOutputBuffer();
} elseif ($action == 'delete' && $id != 0) { } elseif ($action == 'delete' && $id != 0) {

View File

@@ -32,10 +32,7 @@ if (Settings::IsInList('panel.customer_hide_options', 'ftp')) {
$id = (int) Request::get('id', 0); $id = (int) Request::get('id', 0);
if ($page == 'overview') { if ($page == 'overview' || $page == 'accounts') {
$log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_ftp");
eval("echo \"" . \Froxlor\UI\Template::getTemplate('ftp/ftp') . "\";");
} elseif ($page == 'accounts') {
if ($action == '') { if ($action == '') {
$log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_ftp::accounts"); $log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_ftp::accounts");
try { try {
@@ -47,8 +44,18 @@ if ($page == 'overview') {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); \Froxlor\UI\Response::dynamic_error($e->getMessage());
} }
$add_link = false;
if ($userinfo['ftps_used'] < $userinfo['ftps'] || $userinfo['ftps'] == '-1') {
$add_link = [
'href' => $linker->getLink(['section' => 'ftp', 'page' => 'accounts', 'action' => 'add']),
'label' => $lng['ftp']['account_add']
];
}
UI::twigBuffer('user/table.html.twig', [ UI::twigBuffer('user/table.html.twig', [
'listing' => \Froxlor\UI\Listing::format($list, $ftp_list_data['ftp_list']), 'listing' => \Froxlor\UI\Listing::format($list, $ftp_list_data['ftp_list']),
'add_link' => $add_link,
'entity_info' => $lng['ftp']['description']
]); ]);
UI::twigOutputBuffer(); UI::twigOutputBuffer();
} elseif ($action == 'delete' && $id != 0) { } elseif ($action == 'delete' && $id != 0) {

View File

@@ -38,13 +38,7 @@ Database::needRoot(false);
$id = (int) Request::get('id'); $id = (int) Request::get('id');
if ($page == 'overview') { if ($page == 'overview' || $page == 'mysqls') {
$log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_mysql");
Database::needSqlData();
$sql = Database::getSqlData();
$lng['mysql']['description'] = str_replace('<SQL_HOST>', $sql['host'], $lng['mysql']['description']);
eval("echo \"" . \Froxlor\UI\Template::getTemplate('mysql/mysql') . "\";");
} elseif ($page == 'mysqls') {
if ($action == '') { if ($action == '') {
$log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_mysql::mysqls"); $log->logAction(\Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed customer_mysql::mysqls");
@@ -61,8 +55,22 @@ if ($page == 'overview') {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); \Froxlor\UI\Response::dynamic_error($e->getMessage());
} }
Database::needSqlData();
$sql = Database::getSqlData();
$lng['mysql']['description'] = str_replace('<SQL_HOST>', $sql['host'], $lng['mysql']['description']);
$add_link = false;
if ($userinfo['mysqls_used'] < $userinfo['mysqls'] || $userinfo['mysqls'] == '-1') {
$add_link = [
'href' => $linker->getLink(['section' => 'mysql', 'page' => 'mysqls', 'action' => 'add']),
'label' => $lng['mysql']['database_create']
];
}
UI::twigBuffer('user/table.html.twig', [ UI::twigBuffer('user/table.html.twig', [
'listing' => \Froxlor\UI\Listing::format($list, $mysql_list_data['mysql_list']), 'listing' => \Froxlor\UI\Listing::format($list, $mysql_list_data['mysql_list']),
'add_link' => $add_link,
'entity_info' => $lng['mysql']['description']
]); ]);
UI::twigOutputBuffer(); UI::twigOutputBuffer();
} elseif ($action == 'delete' && $id != 0) { } elseif ($action == 'delete' && $id != 0) {

View File

@@ -2,6 +2,8 @@
namespace Froxlor\UI\Callbacks; namespace Froxlor\UI\Callbacks;
use Froxlor\PhpHelper;
/** /**
* This file is part of the Froxlor project. * This file is part of the Froxlor project.
* Copyright (c) 2010 the Froxlor Team (see authors). * Copyright (c) 2010 the Froxlor Team (see authors).
@@ -42,4 +44,9 @@ class Text
{ {
return \Froxlor\User::getCorrectFullUserDetails($attributes); return \Froxlor\User::getCorrectFullUserDetails($attributes);
} }
public static function size(string $data, array $attributes): string
{
return PhpHelper::sizeReadable($data, null, 'bi');
}
} }

View File

@@ -2,7 +2,7 @@
{% block content %} {% block content %}
<div class="row"> <div class="row">
<div class="col-12 col-md-10 order-2 order-md-1"> <div class="col-12 {% if add_link is iterable or (entity_info is defined and entity_info is not empty) %}col-md-10 order-2 order-md-1{% endif %}">
{% import "Froxlor/table/table.html.twig" as table %} {% import "Froxlor/table/table.html.twig" as table %}
{{ table.table(listing) }} {{ table.table(listing) }}
</div> </div>