diff options
author | Stephen Beaver <sbeaver@netgate.com> | 2016-02-02 15:47:54 -0500 |
---|---|---|
committer | Stephen Beaver <sbeaver@netgate.com> | 2016-02-02 15:47:54 -0500 |
commit | d72aaef520f381fce2f247d752c01821c8596622 (patch) | |
tree | c30dadeff99d82e4f57950c8cb3528c8a26c2775 /src/usr/local | |
parent | 4abd750d4dcd3ae2467d3010b22aa0b2172d4407 (diff) | |
download | pfsense-d72aaef520f381fce2f247d752c01821c8596622.zip pfsense-d72aaef520f381fce2f247d752c01821c8596622.tar.gz |
Added priv filter capability
Diffstat (limited to 'src/usr/local')
-rw-r--r-- | src/usr/local/www/system_groupmanager_addprivs.php | 66 |
1 files changed, 65 insertions, 1 deletions
diff --git a/src/usr/local/www/system_groupmanager_addprivs.php b/src/usr/local/www/system_groupmanager_addprivs.php index 6819e39..222501e 100644 --- a/src/usr/local/www/system_groupmanager_addprivs.php +++ b/src/usr/local/www/system_groupmanager_addprivs.php @@ -209,6 +209,34 @@ $section->addInput(new Form_Select( true ))->addClass('multiselect')->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); $form->add($section); print $form; @@ -245,7 +273,43 @@ 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(); + }); }); }); //]]> |