diff --git a/lib/Froxlor/Ajax/GlobalSearch.php b/lib/Froxlor/Ajax/GlobalSearch.php index 117ab74b..4bfafda8 100644 --- a/lib/Froxlor/Ajax/GlobalSearch.php +++ b/lib/Froxlor/Ajax/GlobalSearch.php @@ -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=' ] ] ]; diff --git a/lib/Froxlor/UI/Collection.php b/lib/Froxlor/UI/Collection.php index 8d5073ff..eeb18b7b 100644 --- a/lib/Froxlor/UI/Collection.php +++ b/lib/Froxlor/UI/Collection.php @@ -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; + } } diff --git a/lib/Froxlor/UI/Listing.php b/lib/Froxlor/UI/Listing.php index 65cd80a4..654ca5a8 100644 --- a/lib/Froxlor/UI/Listing.php +++ b/lib/Froxlor/UI/Listing.php @@ -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'] ?? [] ]; } diff --git a/lib/Froxlor/UI/Pagination.php b/lib/Froxlor/UI/Pagination.php index 3a146ffb..3ddf6fd5 100644 --- a/lib/Froxlor/UI/Pagination.php +++ b/lib/Froxlor/UI/Pagination.php @@ -200,4 +200,9 @@ class Pagination ] ]; } + + public function isSearchResult(): bool + { + return $this->is_search; + } } diff --git a/lib/tablelisting/admin/tablelisting.admins.php b/lib/tablelisting/admin/tablelisting.admins.php index a48a7bf4..f07a1d65 100644 --- a/lib/tablelisting/admin/tablelisting.admins.php +++ b/lib/tablelisting/admin/tablelisting.admins.php @@ -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' => '#', diff --git a/lib/tablelisting/admin/tablelisting.customers.php b/lib/tablelisting/admin/tablelisting.customers.php index bbebae58..6ae7ce0e 100644 --- a/lib/tablelisting/admin/tablelisting.customers.php +++ b/lib/tablelisting/admin/tablelisting.customers.php @@ -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'], diff --git a/lib/tablelisting/admin/tablelisting.domains.php b/lib/tablelisting/admin/tablelisting.domains.php index 81ff7e7e..f3bb8243 100644 --- a/lib/tablelisting/admin/tablelisting.domains.php +++ b/lib/tablelisting/admin/tablelisting.domains.php @@ -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'], diff --git a/lib/tablelisting/admin/tablelisting.fpmconfigs.php b/lib/tablelisting/admin/tablelisting.fpmconfigs.php index 6731bfdb..1aa6eee1 100644 --- a/lib/tablelisting/admin/tablelisting.fpmconfigs.php +++ b/lib/tablelisting/admin/tablelisting.fpmconfigs.php @@ -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', diff --git a/lib/tablelisting/admin/tablelisting.ipsandports.php b/lib/tablelisting/admin/tablelisting.ipsandports.php index 19fd037f..129be03d 100644 --- a/lib/tablelisting/admin/tablelisting.ipsandports.php +++ b/lib/tablelisting/admin/tablelisting.ipsandports.php @@ -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'], diff --git a/lib/tablelisting/admin/tablelisting.phpconfigs.php b/lib/tablelisting/admin/tablelisting.phpconfigs.php index 6e421922..7d6cb7c1 100644 --- a/lib/tablelisting/admin/tablelisting.phpconfigs.php +++ b/lib/tablelisting/admin/tablelisting.phpconfigs.php @@ -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'], diff --git a/lib/tablelisting/customer/tablelisting.domains.php b/lib/tablelisting/customer/tablelisting.domains.php index 049761eb..17ecfdda 100644 --- a/lib/tablelisting/customer/tablelisting.domains.php +++ b/lib/tablelisting/customer/tablelisting.domains.php @@ -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'] ], diff --git a/lib/tablelisting/customer/tablelisting.emails.php b/lib/tablelisting/customer/tablelisting.emails.php index b710d46c..5f813ecd 100644 --- a/lib/tablelisting/customer/tablelisting.emails.php +++ b/lib/tablelisting/customer/tablelisting.emails.php @@ -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'], diff --git a/lib/tablelisting/customer/tablelisting.ftps.php b/lib/tablelisting/customer/tablelisting.ftps.php index 69591ad2..a56e2316 100644 --- a/lib/tablelisting/customer/tablelisting.ftps.php +++ b/lib/tablelisting/customer/tablelisting.ftps.php @@ -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'], diff --git a/lib/tablelisting/customer/tablelisting.mysqls.php b/lib/tablelisting/customer/tablelisting.mysqls.php index 7c8ab14e..7b9776bc 100644 --- a/lib/tablelisting/customer/tablelisting.mysqls.php +++ b/lib/tablelisting/customer/tablelisting.mysqls.php @@ -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'], diff --git a/lng/english.lng.php b/lng/english.lng.php index ae3d6533..d488a541 100644 --- a/lng/english.lng.php +++ b/lng/english.lng.php @@ -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'; diff --git a/lng/german.lng.php b/lng/german.lng.php index ba5e84ba..c1af74d8 100644 --- a/lng/german.lng.php +++ b/lng/german.lng.php @@ -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'; diff --git a/templates/Froxlor/user/table.html.twig b/templates/Froxlor/user/table.html.twig index c41be685..26006898 100644 --- a/templates/Froxlor/user/table.html.twig +++ b/templates/Froxlor/user/table.html.twig @@ -8,6 +8,11 @@ {% endif %} {{ listing.title }} + {% if listing.total_entries > 0 %} + + {{ listing.total_entries }} + + {% endif %} {% if listing.description is not empty %} {{ listing.description }} @@ -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) %}
{% if actions_links is iterable %} {% for link in actions_links %} - {{ link.label }} + + {{ link.label }} {% endfor %} {% endif %}