diff options
author | Stephen Beaver <sbeaver@netgate.com> | 2016-02-02 15:15:46 -0500 |
---|---|---|
committer | Stephen Beaver <sbeaver@netgate.com> | 2016-02-02 15:16:26 -0500 |
commit | 4abd750d4dcd3ae2467d3010b22aa0b2172d4407 (patch) | |
tree | 6c210071eb40c5d4bbc372710528152e307b045f /src/usr/local/www/system_usermanager_addprivs.php | |
parent | 646f2e1827e27c6878b5d6f0f59eab1fb9c87959 (diff) | |
download | pfsense-4abd750d4dcd3ae2467d3010b22aa0b2172d4407.zip pfsense-4abd750d4dcd3ae2467d3010b22aa0b2172d4407.tar.gz |
Fixed #5049
Diffstat (limited to 'src/usr/local/www/system_usermanager_addprivs.php')
-rw-r--r-- | src/usr/local/www/system_usermanager_addprivs.php | 67 |
1 files changed, 66 insertions, 1 deletions
diff --git a/src/usr/local/www/system_usermanager_addprivs.php b/src/usr/local/www/system_usermanager_addprivs.php index 0aa8895..62c6636 100644 --- a/src/usr/local/www/system_usermanager_addprivs.php +++ b/src/usr/local/www/system_usermanager_addprivs.php @@ -188,6 +188,36 @@ $section->addInput(new Form_Select( ->setHelp('Hold down CTRL (PC)/COMMAND (Mac) key to select multiple items'); // ->setAttribute('style', 'height:400px;'); + +$section->addInput(new Form_Input( + 'filtertxt', + 'Filter', + 'text', + null +))->setHelp('Show only the choices containing this term'); + +$btnfilter = new Form_Button( + 'btnfilter', + 'Filter', + null, + 'fa-filter' +); + +$btnfilter->addClass('btn btn-info'); + +$form->addGlobal($btnfilter); + +$btnclear = new Form_Button( + 'btnclear', + 'Clear', + null, + 'fa-times' +); + +$btnclear->addClass('btn btn-warning'); + +$form->addGlobal($btnclear); + if (isset($userid)) { $section->addInput(new Form_Input( 'userid', @@ -232,9 +262,44 @@ events.push(function() { // When the 'sysprivs" selector is clicked, we display a description $('.multiselect').click(function() { - $('#pdesc').html('<span style="color: green;">' + descs[$(this).children('option:selected').index()] + '</span>'); + $('#pdesc').html('<span class="text-info">' + descs[$(this).children('option:selected').index()] + '</span>'); + }); + + $('#btnfilter').prop('type', 'button'); + + $('#btnfilter').click(function() { + searchterm = $('#filtertxt').val().toLowerCase(); + + $(".multiselect > option").each(function() { + if (this.text.toLowerCase().indexOf(searchterm) > -1 ) { + $(this).show(); + } else { + $(this).hide(); + } + }); }); + $('#btnclear').prop('type', 'button'); + + $('#btnclear').click(function() { + $(".multiselect > option").each(function() { + $(this).show(); + }); + }); + + $('#filtertxt').keypress(function(e) { + if(e.which == 13) { + e.preventDefault(); + $('#btnfilter').trigger('click'); + } + }); + + // On submit unhide all options (or else they will not submit) + $('form').submit(function() { + $(".multiselect > option").each(function() { + $(this).show(); + }); + }); }); //]]> </script> |