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');
|
$id = (int)Request::get('id');
|
||||||
|
|
||||||
if ($page == 'admins' && $userinfo['change_serversettings'] == '1') {
|
if (($page == 'admins' || $page == 'overview') && $userinfo['change_serversettings'] == '1') {
|
||||||
if ($action == '') {
|
if ($action == '') {
|
||||||
$log->logAction(FroxlorLogger::ADM_ACTION, LOG_NOTICE, "viewed admin_admins");
|
$log->logAction(FroxlorLogger::ADM_ACTION, LOG_NOTICE, "viewed admin_admins");
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ use Froxlor\UI\Response;
|
|||||||
|
|
||||||
$id = (int)Request::get('id');
|
$id = (int)Request::get('id');
|
||||||
|
|
||||||
if ($page == 'customers' && $userinfo['customers'] != '0') {
|
if (($page == 'customers' || $page == 'overview') && $userinfo['customers'] != '0') {
|
||||||
if ($action == '') {
|
if ($action == '') {
|
||||||
$log->logAction(FroxlorLogger::ADM_ACTION, LOG_NOTICE, "viewed admin_customers");
|
$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';
|
$dns_add_data = include_once dirname(__FILE__) . '/lib/formfields/formfield.dns_add.php';
|
||||||
|
|
||||||
UI::view('user/dns-editor.html.twig', [
|
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' => [
|
'actions_links' => [
|
||||||
[
|
[
|
||||||
'class' => 'btn-secondary',
|
'class' => 'btn-secondary',
|
||||||
@@ -133,5 +133,5 @@ UI::view('user/dns-editor.html.twig', [
|
|||||||
// alert-box
|
// alert-box
|
||||||
'type' => (!empty($errors) ? 'danger' : (!empty($success_message) ? 'success' : 'warning')),
|
'type' => (!empty($errors) ? 'danger' : (!empty($success_message) ? 'success' : 'warning')),
|
||||||
'alert_msg' => (!empty($errors) ? $errors : (!empty($success_message) ? $success_message : lng('dns.howitworks'))),
|
'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
|
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];
|
$tabellisting = $tabellisting[$id];
|
||||||
$collection_data = $collection->get();
|
$collection_data = $collection->get();
|
||||||
@@ -51,7 +51,8 @@ class Listing
|
|||||||
'total_entries' => ($collection->getPagination() instanceof Pagination) ? $collection->getPagination()->getEntries() : 0,
|
'total_entries' => ($collection->getPagination() instanceof Pagination) ? $collection->getPagination()->getEntries() : 0,
|
||||||
'is_search' => $collection->getPagination() instanceof Pagination && $collection->getPagination()->isSearchResult(),
|
'is_search' => $collection->getPagination() instanceof Pagination && $collection->getPagination()->isSearchResult(),
|
||||||
'self_overview' => $tabellisting['self_overview'] ?? [],
|
'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] = [
|
$result[$column] = [
|
||||||
'label' => $coldata['label'],
|
'label' => $coldata['label'],
|
||||||
'checked' => in_array($column, $tabellisting['visible_columns']),
|
'checked' => in_array($column, $tabellisting['visible_columns']),
|
||||||
|
'searchable' => $coldata['searchable'] ?? true,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ return [
|
|||||||
'filetpl_list' => [
|
'filetpl_list' => [
|
||||||
'title' => lng('admin.templates.filetemplates'),
|
'title' => lng('admin.templates.filetemplates'),
|
||||||
'icon' => 'fa-solid fa-file-lines',
|
'icon' => 'fa-solid fa-file-lines',
|
||||||
|
'self_overview' => ['section' => 'templates', 'page' => 'email'],
|
||||||
'columns' => [
|
'columns' => [
|
||||||
'template' => [
|
'template' => [
|
||||||
'label' => lng('admin.templates.action'),
|
'label' => lng('admin.templates.action'),
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ return [
|
|||||||
'self_overview' => ['section' => 'phpsettings', 'page' => 'fpmdaemons'],
|
'self_overview' => ['section' => 'phpsettings', 'page' => 'fpmdaemons'],
|
||||||
'columns' => [
|
'columns' => [
|
||||||
'id' => [
|
'id' => [
|
||||||
|
'label' => 'ID',
|
||||||
'field' => 'id'
|
'field' => 'id'
|
||||||
],
|
],
|
||||||
'description' => [
|
'description' => [
|
||||||
@@ -42,7 +43,8 @@ return [
|
|||||||
],
|
],
|
||||||
'configs' => [
|
'configs' => [
|
||||||
'label' => lng('admin.phpsettings.activephpconfigs'),
|
'label' => lng('admin.phpsettings.activephpconfigs'),
|
||||||
'callback' => [PHPConf::class, 'configsList']
|
'callback' => [PHPConf::class, 'configsList'],
|
||||||
|
'searchable' => false,
|
||||||
],
|
],
|
||||||
'reload_cmd' => [
|
'reload_cmd' => [
|
||||||
'label' => lng('serversettings.phpfpm_settings.reload'),
|
'label' => lng('serversettings.phpfpm_settings.reload'),
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ return [
|
|||||||
'integrity_list' => [
|
'integrity_list' => [
|
||||||
'title' => lng('admin.integritycheck'),
|
'title' => lng('admin.integritycheck'),
|
||||||
'icon' => 'fa-solid fa-circle-check',
|
'icon' => 'fa-solid fa-circle-check',
|
||||||
|
'self_overview' => ['section' => 'settings', 'page' => 'integritycheck'],
|
||||||
'columns' => [
|
'columns' => [
|
||||||
'displayid' => [
|
'displayid' => [
|
||||||
'label' => 'ID',
|
'label' => 'ID',
|
||||||
@@ -43,7 +44,8 @@ return [
|
|||||||
'result' => [
|
'result' => [
|
||||||
'label' => lng('admin.integrityresult'),
|
'label' => lng('admin.integrityresult'),
|
||||||
'field' => 'result',
|
'field' => 'result',
|
||||||
'callback' => [Text::class, 'boolean']
|
'callback' => [Text::class, 'boolean'],
|
||||||
|
'searchable' => false,
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
'visible_columns' => Listing::getVisibleColumnsForListing('integrity_list', [
|
'visible_columns' => Listing::getVisibleColumnsForListing('integrity_list', [
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ return [
|
|||||||
'mailtpl_list' => [
|
'mailtpl_list' => [
|
||||||
'title' => lng('admin.templates.templates'),
|
'title' => lng('admin.templates.templates'),
|
||||||
'icon' => 'fa-solid fa-envelope',
|
'icon' => 'fa-solid fa-envelope',
|
||||||
|
'self_overview' => ['section' => 'templates', 'page' => 'email'],
|
||||||
'columns' => [
|
'columns' => [
|
||||||
'language' => [
|
'language' => [
|
||||||
'label' => lng('login.language'),
|
'label' => lng('login.language'),
|
||||||
|
|||||||
@@ -45,7 +45,8 @@ return [
|
|||||||
'domains' => [
|
'domains' => [
|
||||||
'label' => lng('admin.phpsettings.activedomains'),
|
'label' => lng('admin.phpsettings.activedomains'),
|
||||||
'field' => 'domains',
|
'field' => 'domains',
|
||||||
'callback' => [PHPConf::class, 'domainList']
|
'callback' => [PHPConf::class, 'domainList'],
|
||||||
|
'searchable' => false,
|
||||||
],
|
],
|
||||||
'fpmdesc' => [
|
'fpmdesc' => [
|
||||||
'label' => lng('admin.phpsettings.fpmdesc'),
|
'label' => lng('admin.phpsettings.fpmdesc'),
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ return [
|
|||||||
'plan_list' => [
|
'plan_list' => [
|
||||||
'title' => lng('admin.plans.plans'),
|
'title' => lng('admin.plans.plans'),
|
||||||
'icon' => 'fa-solid fa-clipboard-list',
|
'icon' => 'fa-solid fa-clipboard-list',
|
||||||
|
'self_overview' => ['section' => 'plans', 'page' => 'overview'],
|
||||||
'columns' => [
|
'columns' => [
|
||||||
'p.id' => [
|
'p.id' => [
|
||||||
'label' => 'ID',
|
'label' => 'ID',
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ return [
|
|||||||
'backup_list' => [
|
'backup_list' => [
|
||||||
'title' => lng('error.customerhasongoingbackupjob'),
|
'title' => lng('error.customerhasongoingbackupjob'),
|
||||||
'icon' => 'fa-solid fa-server',
|
'icon' => 'fa-solid fa-server',
|
||||||
|
'self_overview' => ['section' => 'extras', 'page' => 'backup'],
|
||||||
'columns' => [
|
'columns' => [
|
||||||
'destdir' => [
|
'destdir' => [
|
||||||
'label' => lng('panel.path'),
|
'label' => lng('panel.path'),
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ return [
|
|||||||
'field' => 'ipsandports',
|
'field' => 'ipsandports',
|
||||||
'sortable' => false,
|
'sortable' => false,
|
||||||
'callback' => [Domain::class, 'listIPs'],
|
'callback' => [Domain::class, 'listIPs'],
|
||||||
|
'searchable' => false,
|
||||||
],
|
],
|
||||||
'd.documentroot' => [
|
'd.documentroot' => [
|
||||||
'label' => lng('panel.path'),
|
'label' => lng('panel.path'),
|
||||||
|
|||||||
@@ -44,7 +44,8 @@ return [
|
|||||||
'size' => [
|
'size' => [
|
||||||
'label' => lng('mysql.size'),
|
'label' => lng('mysql.size'),
|
||||||
'field' => 'size',
|
'field' => 'size',
|
||||||
'callback' => [Text::class, 'size']
|
'callback' => [Text::class, 'size'],
|
||||||
|
'searchable' => false
|
||||||
],
|
],
|
||||||
'dbserver' => [
|
'dbserver' => [
|
||||||
'label' => lng('mysql.mysql_server'),
|
'label' => lng('mysql.mysql_server'),
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ return [
|
|||||||
'apikeys_list' => [
|
'apikeys_list' => [
|
||||||
'title' => lng('menue.main.apikeys'),
|
'title' => lng('menue.main.apikeys'),
|
||||||
'icon' => 'fa-solid fa-key',
|
'icon' => 'fa-solid fa-key',
|
||||||
|
'self_overview' => ['section' => 'index', 'page' => 'apikeys'],
|
||||||
'columns' => [
|
'columns' => [
|
||||||
'a.loginname' => [
|
'a.loginname' => [
|
||||||
'label' => lng('login.username'),
|
'label' => lng('login.username'),
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ return [
|
|||||||
'dns_list' => [
|
'dns_list' => [
|
||||||
'title' => 'DNS Entries',
|
'title' => 'DNS Entries',
|
||||||
'icon' => 'fa-solid fa-globe',
|
'icon' => 'fa-solid fa-globe',
|
||||||
|
'self_overview' => ['section' => 'domains', 'page' => 'domaindnseditor'],
|
||||||
'columns' => [
|
'columns' => [
|
||||||
'record' => [
|
'record' => [
|
||||||
'label' => 'Record',
|
'label' => 'Record',
|
||||||
|
|||||||
@@ -23,16 +23,15 @@
|
|||||||
* @license https://files.froxlor.org/misc/COPYING.txt GPLv2
|
* @license https://files.froxlor.org/misc/COPYING.txt GPLv2
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use Froxlor\Settings;
|
|
||||||
use Froxlor\UI\Callbacks\Domain;
|
use Froxlor\UI\Callbacks\Domain;
|
||||||
use Froxlor\UI\Callbacks\SSLCertificate;
|
use Froxlor\UI\Callbacks\SSLCertificate;
|
||||||
use Froxlor\UI\Callbacks\Text;
|
|
||||||
use Froxlor\UI\Listing;
|
use Froxlor\UI\Listing;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'sslcertificates_list' => [
|
'sslcertificates_list' => [
|
||||||
'title' => lng('domains.ssl_certificates'),
|
'title' => lng('domains.ssl_certificates'),
|
||||||
'icon' => 'fa-solid fa-shield',
|
'icon' => 'fa-solid fa-shield',
|
||||||
|
'self_overview' => ['section' => 'domains', 'page' => 'sslcertificates'],
|
||||||
'columns' => [
|
'columns' => [
|
||||||
'd.domain' => [
|
'd.domain' => [
|
||||||
'label' => lng('domains.domainname'),
|
'label' => lng('domains.domainname'),
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ return [
|
|||||||
'syslog_list' => [
|
'syslog_list' => [
|
||||||
'title' => lng('menue.logger.logger'),
|
'title' => lng('menue.logger.logger'),
|
||||||
'icon' => 'fa-solid fa-file-lines',
|
'icon' => 'fa-solid fa-file-lines',
|
||||||
|
'self_overview' => ['section' => 'logger', 'page' => 'log'],
|
||||||
'columns' => [
|
'columns' => [
|
||||||
'date' => [
|
'date' => [
|
||||||
'label' => lng('logger.date'),
|
'label' => lng('logger.date'),
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
{% else %}
|
{% else %}
|
||||||
<div class="d-flex flex-column align-items-end mt-n2">
|
<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">
|
<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>
|
<span type="button" data-bs-toggle="modal" data-bs-target="#manageColumnsModal"><i class="fa fa-cog"></i></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -91,4 +92,41 @@
|
|||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</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 %}
|
{% endmacro %}
|
||||||
|
|||||||
Reference in New Issue
Block a user