add onpage mini-search for listings
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
@@ -41,7 +41,7 @@ use Froxlor\UI\Response;
|
||||
|
||||
$id = (int)Request::get('id');
|
||||
|
||||
if ($page == 'admins' && $userinfo['change_serversettings'] == '1') {
|
||||
if (($page == 'admins' || $page == 'overview') && $userinfo['change_serversettings'] == '1') {
|
||||
if ($action == '') {
|
||||
$log->logAction(FroxlorLogger::ADM_ACTION, LOG_NOTICE, "viewed admin_admins");
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ use Froxlor\UI\Response;
|
||||
|
||||
$id = (int)Request::get('id');
|
||||
|
||||
if ($page == 'customers' && $userinfo['customers'] != '0') {
|
||||
if (($page == 'customers' || $page == 'overview') && $userinfo['customers'] != '0') {
|
||||
if ($action == '') {
|
||||
$log->logAction(FroxlorLogger::ADM_ACTION, LOG_NOTICE, "viewed admin_customers");
|
||||
|
||||
|
||||
@@ -108,7 +108,7 @@ $zonefile = implode("\n", $result);
|
||||
$dns_add_data = include_once dirname(__FILE__) . '/lib/formfields/formfield.dns_add.php';
|
||||
|
||||
UI::view('user/dns-editor.html.twig', [
|
||||
'listing' => Listing::format($collection, $dns_list_data, 'dns_list'),
|
||||
'listing' => Listing::format($collection, $dns_list_data, 'dns_list', ['domain_id' => $domain_id]),
|
||||
'actions_links' => [
|
||||
[
|
||||
'class' => 'btn-secondary',
|
||||
@@ -133,5 +133,5 @@ UI::view('user/dns-editor.html.twig', [
|
||||
// alert-box
|
||||
'type' => (!empty($errors) ? 'danger' : (!empty($success_message) ? 'success' : 'warning')),
|
||||
'alert_msg' => (!empty($errors) ? $errors : (!empty($success_message) ? $success_message : lng('dns.howitworks'))),
|
||||
'zonefile' => $zonefile
|
||||
'zonefile' => $zonefile,
|
||||
]);
|
||||
|
||||
@@ -32,7 +32,7 @@ use InvalidArgumentException;
|
||||
|
||||
class Listing
|
||||
{
|
||||
public static function format(Collection $collection, array $tabellisting, string $id): array
|
||||
public static function format(Collection $collection, array $tabellisting, string $id, array $listing_search_additional_param = []): array
|
||||
{
|
||||
$tabellisting = $tabellisting[$id];
|
||||
$collection_data = $collection->get();
|
||||
@@ -51,7 +51,8 @@ class Listing
|
||||
'total_entries' => ($collection->getPagination() instanceof Pagination) ? $collection->getPagination()->getEntries() : 0,
|
||||
'is_search' => $collection->getPagination() instanceof Pagination && $collection->getPagination()->isSearchResult(),
|
||||
'self_overview' => $tabellisting['self_overview'] ?? [],
|
||||
'available_columns' => self::getAvailableColumnsForListing($tabellisting)
|
||||
'available_columns' => self::getAvailableColumnsForListing($tabellisting),
|
||||
'listing_search_additional_param' => $listing_search_additional_param ?? [],
|
||||
];
|
||||
}
|
||||
|
||||
@@ -225,6 +226,7 @@ class Listing
|
||||
$result[$column] = [
|
||||
'label' => $coldata['label'],
|
||||
'checked' => in_array($column, $tabellisting['visible_columns']),
|
||||
'searchable' => $coldata['searchable'] ?? true,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ return [
|
||||
'filetpl_list' => [
|
||||
'title' => lng('admin.templates.filetemplates'),
|
||||
'icon' => 'fa-solid fa-file-lines',
|
||||
'self_overview' => ['section' => 'templates', 'page' => 'email'],
|
||||
'columns' => [
|
||||
'template' => [
|
||||
'label' => lng('admin.templates.action'),
|
||||
|
||||
@@ -34,6 +34,7 @@ return [
|
||||
'self_overview' => ['section' => 'phpsettings', 'page' => 'fpmdaemons'],
|
||||
'columns' => [
|
||||
'id' => [
|
||||
'label' => 'ID',
|
||||
'field' => 'id'
|
||||
],
|
||||
'description' => [
|
||||
@@ -42,7 +43,8 @@ return [
|
||||
],
|
||||
'configs' => [
|
||||
'label' => lng('admin.phpsettings.activephpconfigs'),
|
||||
'callback' => [PHPConf::class, 'configsList']
|
||||
'callback' => [PHPConf::class, 'configsList'],
|
||||
'searchable' => false,
|
||||
],
|
||||
'reload_cmd' => [
|
||||
'label' => lng('serversettings.phpfpm_settings.reload'),
|
||||
|
||||
@@ -31,6 +31,7 @@ return [
|
||||
'integrity_list' => [
|
||||
'title' => lng('admin.integritycheck'),
|
||||
'icon' => 'fa-solid fa-circle-check',
|
||||
'self_overview' => ['section' => 'settings', 'page' => 'integritycheck'],
|
||||
'columns' => [
|
||||
'displayid' => [
|
||||
'label' => 'ID',
|
||||
@@ -43,7 +44,8 @@ return [
|
||||
'result' => [
|
||||
'label' => lng('admin.integrityresult'),
|
||||
'field' => 'result',
|
||||
'callback' => [Text::class, 'boolean']
|
||||
'callback' => [Text::class, 'boolean'],
|
||||
'searchable' => false,
|
||||
]
|
||||
],
|
||||
'visible_columns' => Listing::getVisibleColumnsForListing('integrity_list', [
|
||||
|
||||
@@ -29,6 +29,7 @@ return [
|
||||
'mailtpl_list' => [
|
||||
'title' => lng('admin.templates.templates'),
|
||||
'icon' => 'fa-solid fa-envelope',
|
||||
'self_overview' => ['section' => 'templates', 'page' => 'email'],
|
||||
'columns' => [
|
||||
'language' => [
|
||||
'label' => lng('login.language'),
|
||||
|
||||
@@ -45,7 +45,8 @@ return [
|
||||
'domains' => [
|
||||
'label' => lng('admin.phpsettings.activedomains'),
|
||||
'field' => 'domains',
|
||||
'callback' => [PHPConf::class, 'domainList']
|
||||
'callback' => [PHPConf::class, 'domainList'],
|
||||
'searchable' => false,
|
||||
],
|
||||
'fpmdesc' => [
|
||||
'label' => lng('admin.phpsettings.fpmdesc'),
|
||||
|
||||
@@ -30,6 +30,7 @@ return [
|
||||
'plan_list' => [
|
||||
'title' => lng('admin.plans.plans'),
|
||||
'icon' => 'fa-solid fa-clipboard-list',
|
||||
'self_overview' => ['section' => 'plans', 'page' => 'overview'],
|
||||
'columns' => [
|
||||
'p.id' => [
|
||||
'label' => 'ID',
|
||||
|
||||
@@ -31,6 +31,7 @@ return [
|
||||
'backup_list' => [
|
||||
'title' => lng('error.customerhasongoingbackupjob'),
|
||||
'icon' => 'fa-solid fa-server',
|
||||
'self_overview' => ['section' => 'extras', 'page' => 'backup'],
|
||||
'columns' => [
|
||||
'destdir' => [
|
||||
'label' => lng('panel.path'),
|
||||
|
||||
@@ -44,6 +44,7 @@ return [
|
||||
'field' => 'ipsandports',
|
||||
'sortable' => false,
|
||||
'callback' => [Domain::class, 'listIPs'],
|
||||
'searchable' => false,
|
||||
],
|
||||
'd.documentroot' => [
|
||||
'label' => lng('panel.path'),
|
||||
|
||||
@@ -44,7 +44,8 @@ return [
|
||||
'size' => [
|
||||
'label' => lng('mysql.size'),
|
||||
'field' => 'size',
|
||||
'callback' => [Text::class, 'size']
|
||||
'callback' => [Text::class, 'size'],
|
||||
'searchable' => false
|
||||
],
|
||||
'dbserver' => [
|
||||
'label' => lng('mysql.mysql_server'),
|
||||
|
||||
@@ -32,6 +32,7 @@ return [
|
||||
'apikeys_list' => [
|
||||
'title' => lng('menue.main.apikeys'),
|
||||
'icon' => 'fa-solid fa-key',
|
||||
'self_overview' => ['section' => 'index', 'page' => 'apikeys'],
|
||||
'columns' => [
|
||||
'a.loginname' => [
|
||||
'label' => lng('login.username'),
|
||||
|
||||
@@ -31,6 +31,7 @@ return [
|
||||
'dns_list' => [
|
||||
'title' => 'DNS Entries',
|
||||
'icon' => 'fa-solid fa-globe',
|
||||
'self_overview' => ['section' => 'domains', 'page' => 'domaindnseditor'],
|
||||
'columns' => [
|
||||
'record' => [
|
||||
'label' => 'Record',
|
||||
|
||||
@@ -23,16 +23,15 @@
|
||||
* @license https://files.froxlor.org/misc/COPYING.txt GPLv2
|
||||
*/
|
||||
|
||||
use Froxlor\Settings;
|
||||
use Froxlor\UI\Callbacks\Domain;
|
||||
use Froxlor\UI\Callbacks\SSLCertificate;
|
||||
use Froxlor\UI\Callbacks\Text;
|
||||
use Froxlor\UI\Listing;
|
||||
|
||||
return [
|
||||
'sslcertificates_list' => [
|
||||
'title' => lng('domains.ssl_certificates'),
|
||||
'icon' => 'fa-solid fa-shield',
|
||||
'self_overview' => ['section' => 'domains', 'page' => 'sslcertificates'],
|
||||
'columns' => [
|
||||
'd.domain' => [
|
||||
'label' => lng('domains.domainname'),
|
||||
|
||||
@@ -31,6 +31,7 @@ return [
|
||||
'syslog_list' => [
|
||||
'title' => lng('menue.logger.logger'),
|
||||
'icon' => 'fa-solid fa-file-lines',
|
||||
'self_overview' => ['section' => 'logger', 'page' => 'log'],
|
||||
'columns' => [
|
||||
'date' => [
|
||||
'label' => lng('logger.date'),
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
{% else %}
|
||||
<div class="d-flex flex-column align-items-end mt-n2">
|
||||
<div class="rounded-top bg-white small py-1 px-2 me-3 opacity-75">
|
||||
<span type="button" data-bs-toggle="modal" data-bs-target="#searchColumnsModal" class="me-2"><i class="fa fa-search"></i></span>
|
||||
<span type="button" data-bs-toggle="modal" data-bs-target="#manageColumnsModal"><i class="fa fa-cog"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -91,4 +92,41 @@
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Modal -->
|
||||
<div class="modal fade" id="searchColumnsModal" tabindex="-1" aria-labelledby="searchColumnsModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<form method="GET" class="modal-content" action="{{ linker(listing.self_overview) }}">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="searchColumnsModalLabel">{{ lng('panel.searchtablecolumnsmodal.title') }}</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>{{ lng('panel.searchtablecolumnsmodal.description') }}</p>
|
||||
<div class="mb-3">
|
||||
<select class="form-select" name="searchfield" id="searchfield">
|
||||
{% for key, column in listing.available_columns %}
|
||||
{% if column.searchable is not defined or (column.searchable is defined and column.searchable == true) %}
|
||||
<option value="{{ key }}">{{ column.label }}</option>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<input class="form-control" type="text" name="searchtext" id="searchtext" placeholder="{{ lng('panel.search') }}..." value="" />
|
||||
</div>
|
||||
<input type="hidden" name="page" value="{{ page }}" />
|
||||
{% if listing.listing_search_additional_param is defined and listing.listing_search_additional_param|length > 0 %}
|
||||
{% for fldname,fldval in listing.listing_search_additional_param %}
|
||||
<input type="hidden" name="{{ fldname }}" value="{{ fldval }}" />
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">{{ lng('panel.modalclose') }}</button>
|
||||
<button type="submit" class="btn btn-primary">{{ lng('panel.search') }}</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% endmacro %}
|
||||
|
||||
Reference in New Issue
Block a user