add field to filter user list

This commit is contained in:
Uwe Steinmann 2022-03-30 11:36:35 +02:00
parent ef0f9cfc46
commit e483796c85

View File

@ -31,6 +31,20 @@
*/ */
class SeedDMS_View_UserList extends SeedDMS_Theme_Style { class SeedDMS_View_UserList extends SeedDMS_Theme_Style {
function js() { /* {{{ */
header('Content-Type: application/javascript; charset=UTF-8');
?>
$(document).ready(function(){
$("#myInput").on("keyup", function() {
var value = $(this).val().toLowerCase();
$("#myTable tbody tr").filter(function() {
$(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
});
});
});
<?php
} /* }}} */
function show() { /* {{{ */ function show() { /* {{{ */
$dms = $this->params['dms']; $dms = $this->params['dms'];
$user = $this->params['user']; $user = $this->params['user'];
@ -48,8 +62,9 @@ class SeedDMS_View_UserList extends SeedDMS_Theme_Style {
$sessionmgr = new SeedDMS_SessionMgr($dms->getDB()); $sessionmgr = new SeedDMS_SessionMgr($dms->getDB());
?> ?>
<table class="table table-condensed"> <input type="text" id="myInput" class="form-control" placeholder="<?= getMLText('type_to_filter'); ?>">
<thead><tr><th></th><th><?php printMLText('name'); ?></th><th><?php printMLText('groups'); ?></th><th><?php printMLText('role'); ?></th><th><?php printMLText('discspace'); ?></th><th><?php printMLText('authentication'); ?></th><th></th></tr></thead><tbody> <table id="myTable" class="table table-condensed table-sm">
<thead><tr><th></th><th><?php printMLText('name'); ?></th><th><?php printMLText('groups'); ?></th><th><?php printMLText('role'); ?></th><th><?php printMLText('discspace'); ?></th><th><?php printMLText('authentication'); ?></th><th></th></tr></thead><tbody>
<?php <?php
foreach ($allUsers as $currUser) { foreach ($allUsers as $currUser) {
echo "<tr".($currUser->isDisabled() ? " class=\"error\"" : "").">"; echo "<tr".($currUser->isDisabled() ? " class=\"error\"" : "").">";