more overview/actions-links

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2022-02-25 20:41:06 +01:00
parent fc4725cd61
commit 6b5cabb125
12 changed files with 130 additions and 86 deletions

View File

@@ -45,6 +45,10 @@ if ($page == 'admins' && $userinfo['change_serversettings'] == '1') {
UI::twigBuffer('user/table.html.twig', [
'listing' => \Froxlor\UI\Listing::format($list, $admin_list_data['admin_list']),
'actions_links' => [[
'href' => $linker->getLink(['section' => 'admins', 'page' => $page, 'action' => 'add']),
'label' => $lng['admin']['admin_add']
]]
]);
UI::twigOutputBuffer();
} elseif ($action == 'su') {

View File

@@ -42,8 +42,17 @@ if ($page == 'customers' && $userinfo['customers'] != '0') {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$actions_links = false;
if ($userinfo['customers_used'] < $userinfo['customers'] || $userinfo['customers'] == '-1') {
$actions_links = [[
'href' => $linker->getLink(['section' => 'customers', 'page' => $page, 'action' => 'add']),
'label' => $lng['admin']['customer_add']
]];
}
UI::twigBuffer('user/table.html.twig', [
'listing' => \Froxlor\UI\Listing::format($list, $customer_list_data['customer_list']),
'actions_links' => $actions_links
]);
UI::twigOutputBuffer();
} elseif ($action == 'su' && $id != 0) {

View File

@@ -43,8 +43,27 @@ if ($page == 'domains' || $page == 'overview') {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$json_result = Customers::getLocal($userinfo)->listingCount();
$countcustomers = json_decode($json_result, true)['data'];
$actions_links = false;
if (($userinfo['domains_used'] < $userinfo['domains'] || $userinfo['domains'] == '-1') && $countcustomers != 0) {
$actions_links = [];
$actions_links[] = [
'href' => $linker->getLink(['section' => 'domains', 'page' => $page, 'action' => 'add']),
'label' => $lng['admin']['domain_add']
];
$actions_links[] = [
'href' => $linker->getLink(['section' => 'domains', 'page' => $page, 'action' => 'import']),
'label' => $lng['domains']['domain_import'],
'icon' => 'fa-solid fa-file-import',
'class' => 'btn-secondary'
];
}
UI::twigBuffer('user/table.html.twig', [
'listing' => \Froxlor\UI\Listing::format($list, $domain_list_data['domain_list']),
'actions_links' => $actions_links
]);
UI::twigOutputBuffer();
} elseif ($action == 'delete' && $id != 0) {
@@ -558,8 +577,10 @@ if ($page == 'domains' || $page == 'overview') {
$result = \Froxlor\PhpHelper::htmlentitiesArray($result);
if (Settings::Get('panel.allow_domain_change_customer') != '1') {
$result['customername'] .= ' (<a href="' . $linker->getLink(array('section' => 'customers', 'page' => 'customers',
'action' => 'su', 'id' => $customer['customerid'])) . '" rel="external">' . $customer['loginname'] . '</a>)';
$result['customername'] .= ' (<a href="' . $linker->getLink(array(
'section' => 'customers', 'page' => 'customers',
'action' => 'su', 'id' => $customer['customerid']
)) . '" rel="external">' . $customer['loginname'] . '</a>)';
}
$domain_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/domains/formfield.domains_edit.php';

View File

@@ -42,6 +42,10 @@ if ($page == 'ipsandports' || $page == 'overview') {
UI::twigBuffer('user/table.html.twig', [
'listing' => \Froxlor\UI\Listing::format($list, $ipsandports_list_data['ipsandports_list']),
'actions_links' => [[
'href' => $linker->getLink(['section' => 'ipsandports', 'page' => $page, 'action' => 'add']),
'label' => $lng['admin']['ipsandports']['add']
]]
]);
UI::twigOutputBuffer();
} elseif ($action == 'delete' && $id != 0) {

View File

@@ -43,6 +43,10 @@ if ($page == '' || $page == 'overview') {
UI::twigBuffer('user/table.html.twig', [
'listing' => \Froxlor\UI\Listing::format($list, $plan_list_data['plan_list']),
'actions_links' => [[
'href' => $linker->getLink(['section' => 'plans', 'page' => $page, 'action' => 'add']),
'label' => $lng['admin']['plans']['add']
]]
]);
UI::twigOutputBuffer();
} elseif ($action == 'delete' && $id != 0) {

View File

@@ -53,17 +53,17 @@ if ($page == 'overview' || $page == 'domains') {
$result = json_decode($json_result, true)['data'];
$parentdomains_count = $result['count'];
$add_link = false;
$actions_links = false;
if (($userinfo['subdomains_used'] < $userinfo['subdomains'] || $userinfo['subdomains'] == '-1') && $parentdomains_count != 0) {
$add_link = [
$actions_links = [[
'href' => $linker->getLink(['section' => 'domains', 'page' => 'domains', 'action' => 'add']),
'label' => $lng['domains']['subdomain_add']
];
]];
}
UI::twigBuffer('user/table.html.twig', [
'listing' => \Froxlor\UI\Listing::format($list, $domain_list_data['domain_list']),
'add_link' => $add_link,
'actions_links' => $actions_links,
'entity_info' => $lng['domains']['description']
]);
UI::twigOutputBuffer();

View File

@@ -57,17 +57,17 @@ if ($page == 'overview' || $page == 'emails') {
));
$emaildomains_count = $result2['emaildomains'];
$add_link = false;
$actions_links = false;
if (($userinfo['emails_used'] < $userinfo['emails'] || $userinfo['emails'] == '-1') && $emaildomains_count !=0) {
$add_link = [
$actions_links = [[
'href' => $linker->getLink(['section' => 'email', 'page' => $page, 'action' => 'add']),
'label' => $lng['emails']['emails_add']
];
]];
}
UI::twigBuffer('user/table.html.twig', [
'listing' => \Froxlor\UI\Listing::format($list, $email_list_data['email_list']),
'add_link' => $add_link,
'actions_links' => $actions_links,
'entity_info' => $lng['emails']['description']
]);
UI::twigOutputBuffer();

View File

@@ -57,10 +57,10 @@ if ($page == 'overview' || $page == 'htpasswds') {
UI::twigBuffer('user/table.html.twig', [
'listing' => \Froxlor\UI\Listing::format($list, $htpasswd_list_data['htpasswd_list']),
'add_link' => [
'actions_links' => [[
'href' => $linker->getLink(['section' => 'extras', 'page' => 'htpasswds', 'action' => 'add']),
'label' => $lng['extras']['directoryprotection_add']
],
]],
'entity_info' => $lng['extras']['description']
]);
UI::twigOutputBuffer();

View File

@@ -44,17 +44,17 @@ if ($page == 'overview' || $page == 'accounts') {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
$add_link = false;
$actions_links = false;
if ($userinfo['ftps_used'] < $userinfo['ftps'] || $userinfo['ftps'] == '-1') {
$add_link = [
$actions_links = [[
'href' => $linker->getLink(['section' => 'ftp', 'page' => 'accounts', 'action' => 'add']),
'label' => $lng['ftp']['account_add']
];
]];
}
UI::twigBuffer('user/table.html.twig', [
'listing' => \Froxlor\UI\Listing::format($list, $ftp_list_data['ftp_list']),
'add_link' => $add_link,
'actions_links' => $actions_links,
'entity_info' => $lng['ftp']['description']
]);
UI::twigOutputBuffer();

View File

@@ -59,17 +59,17 @@ if ($page == 'overview' || $page == 'mysqls') {
$sql = Database::getSqlData();
$lng['mysql']['description'] = str_replace('<SQL_HOST>', $sql['host'], $lng['mysql']['description']);
$add_link = false;
$actions_links = false;
if ($userinfo['mysqls_used'] < $userinfo['mysqls'] || $userinfo['mysqls'] == '-1') {
$add_link = [
$actions_links = [[
'href' => $linker->getLink(['section' => 'mysql', 'page' => 'mysqls', 'action' => 'add']),
'label' => $lng['mysql']['database_create']
];
]];
}
UI::twigBuffer('user/table.html.twig', [
'listing' => \Froxlor\UI\Listing::format($list, $mysql_list_data['mysql_list']),
'add_link' => $add_link,
'actions_links' => $actions_links,
'entity_info' => $lng['mysql']['description']
]);
UI::twigOutputBuffer();

View File

@@ -21,7 +21,7 @@ use Froxlor\UI\Listing;
return [
'plan_list' => [
'title' => $lng['domains']['ssl_certificates'],
'title' => $lng['admin']['plans']['plans'],
'icon' => 'fa-solid fa-user',
'columns' => [
'p.name' => [

View File

@@ -2,19 +2,21 @@
{% block content %}
<div class="row">
<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 %}">
<div class="col-12 {% if actions_links 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 %}
{{ table.table(listing) }}
</div>
{% if add_link is iterable or (entity_info is defined and entity_info is not empty) %}
{% if actions_links is iterable or (entity_info is defined and entity_info is not empty) %}
<div class="col-12 col-md-2 order-1 order-md-2">
{% if add_link is iterable %}
<a class="btn btn-success d-block" href="{{ add_link.href|raw }}">
<i class="fa-solid fa-plus-circle"></i>
{{ add_link.label }}</a>
{% if actions_links is iterable %}
{% for link in actions_links %}
<a class="btn {{ link.class|default('btn-success') }} d-block mb-2" href="{{ link.href|raw }}">
<i class="{{ link.icon|default('fa-solid fa-plus-circle') }} me-1"></i>
{{ link.label }}</a>
{% endfor %}
{% endif %}
{% if entity_info is defined and entity_info is not empty %}
<div class="alert alert-info mt-2" role="alert">
<div class="alert alert-info" role="alert">
{{ entity_info|raw }}
</div>
{% endif %}