Skip to content

Commit

Permalink
Merge pull request #208 from PiBa-NL/openvpn-client-export
Browse files Browse the repository at this point in the history
  • Loading branch information
jim-p committed Oct 24, 2016
2 parents dbb9246 + 73f6380 commit c125e11
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 3 deletions.
2 changes: 1 addition & 1 deletion security/pfSense-pkg-openvpn-client-export/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# $FreeBSD$

PORTNAME= pfSense-pkg-openvpn-client-export
PORTVERSION= 1.3.11
PORTVERSION= 1.3.12
CATEGORIES= security
MASTER_SITES= # empty
DISTFILES= # empty
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,33 @@
print($form);
?>

<div class="panel panel-default" id="search-panel">
<div class="panel-heading">
<h2 class="panel-title">
<?=gettext('Search')?>
<span class="widget-heading-icon pull-right">
<a data-toggle="collapse" href="#search-panel_panel-body">
<i class="fa fa-plus-circle"></i>
</a>
</span>
</h2>
</div>
<div id="search-panel_panel-body" class="panel-body collapse in">
<div class="form-group">
<label class="col-sm-2 control-label">
<?=gettext("Search term")?>
</label>
<div class="col-sm-5"><input class="form-control" name="searchstr" id="searchstr" type="text"/></div>
<div class="col-sm-3">
<a id="btnsearch" title="<?=gettext("Search")?>" class="btn btn-primary btn-sm"><i class="fa fa-search icon-embed-btn"></i><?=gettext("Search")?></a>
<a id="btnclear" title="<?=gettext("Clear")?>" class="btn btn-info btn-sm"><i class="fa fa-undo icon-embed-btn"></i><?=gettext("Clear")?></a>
</div>
<div class="col-sm-10 col-sm-offset-2">
<span class="help-block"><?=gettext('Enter a search string or *nix regular expression to search.')?></span>
</div>
</div>
</div>
</div>

<div class="panel panel-default">
<div class="panel-heading"><h2 class="panel-title"><?=gettext("OpenVPN Clients")?></h2></div>
Expand Down Expand Up @@ -690,8 +717,10 @@ function download_begin(act, i, j) {
function server_changed() {

var table = document.getElementById("users");
while (table.rows.length > 1 ) {
table.deleteRow(1);
table = table.tBodies[0];

while (table.rows.length > 0 ) {
table.deleteRow(0);
}

var index = document.getElementById("server").selectedIndex;
Expand Down Expand Up @@ -888,6 +917,51 @@ function useproxy_changed() {
useproxy_changed();
});

// Make these controls plain buttons
$("#btnsearch").prop('type', 'button');
$("#btnclear").prop('type', 'button');

// Search for a term in the package name and/or description
$("#btnsearch").click(function() {
var searchstr = $('#searchstr').val().toLowerCase();
var table = $("table tbody");

table.find('tr').each(function (i) {
var $tds = $(this).find('td'),
username = $tds.eq(0).text().trim().toLowerCase(),
certname = $tds.eq(1).text().trim().toLowerCase();

regexp = new RegExp(searchstr);
if (searchstr.length > 0) {
if (!(regexp.test(username)) && !(regexp.test(certname))) {
$(this).hide();
} else {
$(this).show();
}
} else {
$(this).show(); // A blank search string shows all
}
});
});

// Clear the search term and unhide all rows (that were hidden during a previous search)
$("#btnclear").click(function() {
var table = $("table tbody");

$('#searchstr').val("");

table.find('tr').each(function (i) {
$(this).show();
});
});

// Hitting the enter key will do the same as clicking the search button
$("#searchstr").on("keyup", function (event) {
if (event.keyCode == 13) {
$("#btnsearch").get(0).click();
}
});

// ---------- On initial page load ------------------------------------------------------------

server_changed();
Expand Down

0 comments on commit c125e11

Please sign in to comment.