make search-result links a filter/search for the overview instead of the direct edit-link; show number of total entries in overview; show 'back to overview' button when showing search-result
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
@@ -100,10 +100,10 @@ class GlobalSearch
|
||||
'c.customernumber',
|
||||
'c.custom_notes'
|
||||
],
|
||||
'result_key' => 'customerid',
|
||||
'result_key' => 'loginname',
|
||||
'result_format' => [
|
||||
'title' => ['\\Froxlor\\User', 'getCorrectFullUserDetails'],
|
||||
'href' => 'admin_customers.php?page=customers&action=edit&id='
|
||||
'href' => 'admin_customers.php?page=customers&searchfield=c.loginname&searchtext='
|
||||
]
|
||||
],
|
||||
// domains
|
||||
@@ -114,11 +114,11 @@ class GlobalSearch
|
||||
'd.domain_ace',
|
||||
'd.documentroot'
|
||||
],
|
||||
'result_key' => 'id',
|
||||
'result_key' => 'domain_ace',
|
||||
'result_format' => [
|
||||
'title' => ['self', 'getFieldFromResult'],
|
||||
'title_args' => 'domain_ace',
|
||||
'href' => 'admin_domains.php?page=domains&action=edit&id='
|
||||
'href' => 'admin_domains.php?page=domains&searchfield=d.domain_ace&searchtext='
|
||||
]
|
||||
],
|
||||
// ips and ports
|
||||
@@ -129,12 +129,12 @@ class GlobalSearch
|
||||
'vhostcontainer',
|
||||
'specialsettings'
|
||||
],
|
||||
'result_key' => 'id',
|
||||
'result_key' => 'ip',
|
||||
'result_groupkey' => 'ip',
|
||||
'result_format' => [
|
||||
'title' => ['self', 'getFieldFromResult'],
|
||||
'title_args' => 'ip',
|
||||
'href' => 'admin_ipsandports.php?page=ipsandports&action=edit&id='
|
||||
'href' => 'admin_ipsandports.php?page=ipsandports&searchfield=ip&searchtext='
|
||||
]
|
||||
],
|
||||
// hosting-plans
|
||||
@@ -163,7 +163,7 @@ class GlobalSearch
|
||||
'result_format' => [
|
||||
'title' => ['self', 'getFieldFromResult'],
|
||||
'title_args' => 'description',
|
||||
'href' => ((bool) $userinfo['change_serversettings'] ? 'admin_phpsettings.php?page=overview&action=edit&id=' : 'admin_phpsettings.php?page=overview&sid=')
|
||||
'href' => 'admin_phpsettings.php?page=overview&searchfield=id&searchtext='
|
||||
]
|
||||
],
|
||||
// FPM daemons
|
||||
@@ -177,7 +177,7 @@ class GlobalSearch
|
||||
'result_format' => [
|
||||
'title' => ['self', 'getFieldFromResult'],
|
||||
'title_args' => 'description',
|
||||
'href' => ((bool) $userinfo['change_serversettings'] ? 'admin_phpsettings.php?page=fpmdaemons&action=edit&id=' : 'admin_phpsettings.php?page=fpmdaemons&sid=')
|
||||
'href' => 'admin_phpsettings.php?page=fpmdaemons&searchfield=id&searchtext='
|
||||
]
|
||||
]
|
||||
];
|
||||
@@ -192,11 +192,11 @@ class GlobalSearch
|
||||
'email',
|
||||
'custom_notes'
|
||||
],
|
||||
'result_key' => 'adminid',
|
||||
'result_key' => 'loginname',
|
||||
'result_format' => [
|
||||
'title' => ['self', 'getFieldFromResult'],
|
||||
'title_args' => 'name',
|
||||
'href' => 'admin_admins.php?page=admins&action=edit&id='
|
||||
'href' => 'admin_admins.php?page=admins&searchfield=loginname&searchtext='
|
||||
]
|
||||
];
|
||||
}
|
||||
@@ -210,11 +210,11 @@ class GlobalSearch
|
||||
'd.domain_ace',
|
||||
'd.documentroot'
|
||||
],
|
||||
'result_key' => 'id',
|
||||
'result_key' => 'domain_ace',
|
||||
'result_format' => [
|
||||
'title' => ['self', 'getFieldFromResult'],
|
||||
'title_args' => 'domain_ace',
|
||||
'href' => 'customer_domains.php?page=domains&action=edit&id='
|
||||
'href' => 'customer_domains.php?page=domains&searchfield=d.domain_ace&searchtext='
|
||||
]
|
||||
],
|
||||
// email addresses
|
||||
@@ -224,11 +224,11 @@ class GlobalSearch
|
||||
'm.email',
|
||||
'm.email_full'
|
||||
],
|
||||
'result_key' => 'id',
|
||||
'result_key' => 'email',
|
||||
'result_format' => [
|
||||
'title' => ['self', 'getFieldFromResult'],
|
||||
'title_args' => 'email',
|
||||
'href' => 'customer_email.php?page=emails&action=edit&id='
|
||||
'href' => 'customer_email.php?page=emails&searchfield=m.email&searchtext='
|
||||
]
|
||||
],
|
||||
// databases
|
||||
@@ -238,11 +238,11 @@ class GlobalSearch
|
||||
'databasename',
|
||||
'description'
|
||||
],
|
||||
'result_key' => 'id',
|
||||
'result_key' => 'databasename',
|
||||
'result_format' => [
|
||||
'title' => ['self', 'getFieldFromResult'],
|
||||
'title_args' => 'databasename',
|
||||
'href' => 'customer_mysql.php?page=mysqls&action=edit&id='
|
||||
'href' => 'customer_mysql.php?page=mysqls&searchfield=databasename&searchtext='
|
||||
]
|
||||
],
|
||||
// ftp user
|
||||
@@ -252,11 +252,11 @@ class GlobalSearch
|
||||
'username',
|
||||
'description'
|
||||
],
|
||||
'result_key' => 'id',
|
||||
'result_key' => 'username',
|
||||
'result_format' => [
|
||||
'title' => ['self', 'getFieldFromResult'],
|
||||
'title_args' => 'username',
|
||||
'href' => 'customer_ftp.php?page=ftps&action=edit&id='
|
||||
'href' => 'customer_ftp.php?page=accounts&searchfield=username&searchtext='
|
||||
]
|
||||
]
|
||||
];
|
||||
|
||||
@@ -109,17 +109,24 @@ class Collection
|
||||
public function withPagination(array $columns): Collection
|
||||
{
|
||||
// Get only searchable columns
|
||||
/*
|
||||
$sortableColumns = [];
|
||||
foreach ($columns as $key => $column) {
|
||||
if (isset($column['sortable']) && $column['sortable']) {
|
||||
$sortableColumns[$key] = $column;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// Prepare pagination
|
||||
$this->pagination = new Pagination($sortableColumns, $this->count(), (int) Settings::Get('panel.paging'));
|
||||
$this->pagination = new Pagination($columns, $this->count(), (int) Settings::Get('panel.paging'));
|
||||
$this->params = array_merge($this->params, $this->pagination->getApiCommandParams());
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getPagination(): ?Pagination
|
||||
{
|
||||
return $this->pagination;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ class Listing
|
||||
{
|
||||
public static function format(Collection $collection, array $tabellisting): array
|
||||
{
|
||||
$collection = $collection->get();
|
||||
$collection_data = $collection->get();
|
||||
|
||||
return [
|
||||
'title' => $tabellisting['title'],
|
||||
@@ -32,10 +32,13 @@ class Listing
|
||||
'icon' => $tabellisting['icon'] ?? null,
|
||||
'table' => [
|
||||
'th' => self::generateTableHeadings($tabellisting),
|
||||
'tr' => self::generateTableRows($collection['data']['list'], $tabellisting),
|
||||
'tr' => self::generateTableRows($collection_data['data']['list'], $tabellisting),
|
||||
],
|
||||
'pagination' => $collection['pagination'],
|
||||
'empty_msg' => $tabellisting['empty_msg'] ?? null
|
||||
'pagination' => $collection_data['pagination'],
|
||||
'empty_msg' => $tabellisting['empty_msg'] ?? null,
|
||||
'total_entries' => ($collection->getPagination() instanceof Pagination) ? $collection->getPagination()->getEntries() : 0,
|
||||
'is_search' => ($collection->getPagination() instanceof Pagination) ? $collection->getPagination()->isSearchResult() : false,
|
||||
'self_overview' => $tabellisting['self_overview'] ?? []
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -200,4 +200,9 @@ class Pagination
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
public function isSearchResult(): bool
|
||||
{
|
||||
return $this->is_search;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ return [
|
||||
'admin_list' => [
|
||||
'title' => $lng['admin']['admin'],
|
||||
'icon' => 'fa-solid fa-user',
|
||||
'self_overview' => ['section' => 'admins', 'page' => 'admins'],
|
||||
'columns' => [
|
||||
'adminid' => [
|
||||
'label' => '#',
|
||||
|
||||
@@ -27,6 +27,7 @@ return [
|
||||
'title' => $lng['admin']['customers'],
|
||||
'description' => 'Manage your customers',
|
||||
'icon' => 'fa-solid fa-user',
|
||||
'self_overview' => ['section' => 'customers', 'page' => 'customers'],
|
||||
'columns' => [
|
||||
'c.name' => [
|
||||
'label' => $lng['customer']['name'],
|
||||
|
||||
@@ -26,6 +26,7 @@ return [
|
||||
'title' => $lng['admin']['domains'],
|
||||
'icon' => 'fa-solid fa-globe',
|
||||
'empty_msg' => $lng['admin']['domain_nocustomeraddingavailable'],
|
||||
'self_overview' => ['section' => 'domains', 'page' => 'domains'],
|
||||
'columns' => [
|
||||
'd.domain_ace' => [
|
||||
'label' => $lng['domains']['domainname'],
|
||||
|
||||
@@ -24,7 +24,11 @@ return [
|
||||
'fpmconf_list' => [
|
||||
'title' => $lng['menue']['phpsettings']['fpmdaemons'],
|
||||
'icon' => 'fa-brands fa-php',
|
||||
'self_overview' => ['section' => 'phpsettings', 'page' => 'fpmdaemons'],
|
||||
'columns' => [
|
||||
'id' => [
|
||||
'field' => 'id'
|
||||
],
|
||||
'description' => [
|
||||
'label' => $lng['admin']['phpsettings']['description'],
|
||||
'field' => 'description',
|
||||
|
||||
@@ -24,6 +24,7 @@ return [
|
||||
'ipsandports_list' => [
|
||||
'title' => $lng['admin']['ipsandports']['ipsandports'],
|
||||
'icon' => 'fa-solid fa-ethernet',
|
||||
'self_overview' => ['section' => 'ipsandports', 'page' => 'ipsandports'],
|
||||
'columns' => [
|
||||
'ip' => [
|
||||
'label' => $lng['admin']['ipsandports']['ip'],
|
||||
|
||||
@@ -25,6 +25,7 @@ return [
|
||||
'phpconf_list' => [
|
||||
'title' => $lng['menue']['phpsettings']['maintitle'],
|
||||
'icon' => 'fa-brands fa-php',
|
||||
'self_overview' => ['section' => 'phpsettings', 'page' => 'overview'],
|
||||
'columns' => [
|
||||
'c.description' => [
|
||||
'label' => $lng['admin']['phpsettings']['description'],
|
||||
|
||||
@@ -23,7 +23,11 @@ return [
|
||||
'domain_list' => [
|
||||
'title' => $lng['admin']['domains'],
|
||||
'icon' => 'fa-solid fa-globe',
|
||||
'self_overview' => ['section' => 'domains', 'page' => 'domains'],
|
||||
'columns' => [
|
||||
'ad.id' => [
|
||||
'field' => 'aliasdomainid'
|
||||
],
|
||||
'd.domain_ace' => [
|
||||
'label' => $lng['domains']['domainname'],
|
||||
'field' => 'domain_ace',
|
||||
@@ -92,8 +96,8 @@ return [
|
||||
'href' => [
|
||||
'section' => 'domains',
|
||||
'page' => 'domains',
|
||||
'searchfield' => 'd.aliasdomain',
|
||||
'searchtext' => ':domainaliasid'
|
||||
'searchfield' => 'ad.id',
|
||||
'searchtext' => ':id'
|
||||
],
|
||||
'visible' => [Domain::class, 'canEditAlias']
|
||||
],
|
||||
|
||||
@@ -25,6 +25,7 @@ return [
|
||||
'email_list' => [
|
||||
'title' => $lng['menue']['email']['emails'],
|
||||
'icon' => 'fa-solid fa-envelope',
|
||||
'self_overview' => ['section' => 'email', 'page' => 'emails'],
|
||||
'columns' => [
|
||||
'm.email_full' => [
|
||||
'label' => $lng['emails']['emailaddress'],
|
||||
|
||||
@@ -24,6 +24,7 @@ return [
|
||||
'ftp_list' => [
|
||||
'title' => $lng['menue']['ftp']['accounts'],
|
||||
'icon' => 'fa-solid fa-users',
|
||||
'self_overview' => ['section' => 'ftp', 'page' => 'accounts'],
|
||||
'columns' => [
|
||||
'username' => [
|
||||
'label' => $lng['login']['username'],
|
||||
|
||||
@@ -24,6 +24,7 @@ return [
|
||||
'mysql_list' => [
|
||||
'title' => $lng['menue']['mysql']['databases'],
|
||||
'icon' => 'fa-solid fa-database',
|
||||
'self_overview' => ['section' => 'mysql', 'page' => 'mysqls'],
|
||||
'columns' => [
|
||||
'databasename' => [
|
||||
'label' => $lng['mysql']['databasename'],
|
||||
|
||||
@@ -2160,3 +2160,4 @@ $lng['admin']['smtpsettings'] = 'SMTP settings';
|
||||
$lng['panel']['unspecified'] = 'unspecified';
|
||||
$lng['admin']['smtptestaddr'] = 'Send test-mail to';
|
||||
$lng['admin']['smtptestnote'] = 'Note that the values below reflect your current settings and can only be adjusted there (see link in top right corner)';
|
||||
$lng['panel']['backtooverview'] = 'Back to overview';
|
||||
|
||||
@@ -1798,3 +1798,4 @@ $lng['admin']['smtpsettings'] = 'SMTP Einstellungen';
|
||||
$lng['panel']['unspecified'] = 'keine Angabe';
|
||||
$lng['admin']['smtptestaddr'] = 'Test-Email senden an';
|
||||
$lng['admin']['smtptestnote'] = 'Bitte beachten: Die untenstehenden Werte reflektieren die aktuellen Einstellungen und können auch nur dort angepasst werden (siehe Link in der oberen rechten Ecke)';
|
||||
$lng['panel']['backtooverview'] = 'Zurück zur Übersicht';
|
||||
|
||||
@@ -8,6 +8,11 @@
|
||||
<i class="{{ listing.icon }} me-1"></i>
|
||||
{% endif %}
|
||||
{{ listing.title }}
|
||||
{% if listing.total_entries > 0 %}
|
||||
<small>
|
||||
<span class="badge rounded-pill bg-secondary">{{ listing.total_entries }}</span>
|
||||
</small>
|
||||
{% endif %}
|
||||
</h5>
|
||||
{% if listing.description is not empty %}
|
||||
<span class="text-muted mt-2">{{ listing.description }}</span>
|
||||
@@ -18,12 +23,19 @@
|
||||
|
||||
{% block actions %}
|
||||
|
||||
{% if listing.is_search and listing.self_overview is defined and listing.self_overview is iterable %}
|
||||
{% set actions_tmp = actions_links %}
|
||||
{% set actions_links = {'href': linker(listing.self_overview), 'icon': 'fa fa-reply','label': lng('panel.backtooverview')} %}
|
||||
{% set actions_links = {actions_links}|merge(actions_tmp) %}
|
||||
{% endif %}
|
||||
|
||||
{% if actions_links is iterable or (entity_info is defined and entity_info is not empty) %}
|
||||
<div>
|
||||
{% if actions_links is iterable %}
|
||||
{% for link in actions_links %}
|
||||
<a class="btn {{ link.class|default('btn-outline-primary') }}" href="{{ link.href|raw }}">
|
||||
<i class="{{ link.icon|default('fa-solid fa-plus-circle') }}"></i><span class="d-none d-lg-inline ms-lg-1">{{ link.label }}</span>
|
||||
<i class="{{ link.icon|default('fa-solid fa-plus-circle') }}"></i>
|
||||
<span class="d-none d-lg-inline ms-lg-1">{{ link.label }}</span>
|
||||
</a>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
Reference in New Issue
Block a user