diff options
author | Stephen Beaver <sbeaver@netgate.com> | 2015-11-30 22:41:47 -0500 |
---|---|---|
committer | Stephen Beaver <sbeaver@netgate.com> | 2015-11-30 22:41:47 -0500 |
commit | 32be19a97de221e215b6b4018319861c12fd52be (patch) | |
tree | 82d000f2d5a981c6cd7cd33311065d88739cc763 /src/usr/local/www/widgets | |
parent | 6543ffa4c5ef4782da43501948f1d054452c6a9a (diff) | |
download | pfsense-32be19a97de221e215b6b4018319861c12fd52be.zip pfsense-32be19a97de221e215b6b4018319861c12fd52be.tar.gz |
Potential fox for #5554
Diffstat (limited to 'src/usr/local/www/widgets')
-rw-r--r-- | src/usr/local/www/widgets/widgets/services_status.widget.php | 40 |
1 files changed, 35 insertions, 5 deletions
diff --git a/src/usr/local/www/widgets/widgets/services_status.widget.php b/src/usr/local/www/widgets/widgets/services_status.widget.php index 2f2d9d9..e6bb352 100644 --- a/src/usr/local/www/widgets/widgets/services_status.widget.php +++ b/src/usr/local/www/widgets/widgets/services_status.widget.php @@ -65,15 +65,23 @@ require_once("/usr/local/www/widgets/include/services_status.inc"); $services = get_services(); -if (isset($_POST['servicestatusfilter'])) { +if($_POST) { $validNames = array(); + foreach ($services as $service) { array_push($validNames, $service['name']); } - $config['widgets']['servicestatusfilter'] = implode(',', array_intersect($validNames, $_POST['servicestatusfilter'])); + + if (isset($_POST['servicestatusfilter'])) { + $config['widgets']['servicestatusfilter'] = implode(',', array_intersect($validNames, $_POST['servicestatusfilter'])); + } else { + $config['widgets']['servicestatusfilter'] = ""; + } + write_config("Saved Service Status Filter via Dashboard"); - header("Location: /"); + header("Location: /index.php"); } + ?> <table class="table table-striped table-hover"> <thead> @@ -121,7 +129,7 @@ if (count($services) > 0) { <div class="form-group"> <label for="inputPassword3" class="col-sm-3 control-label">Hidden services</label> <div class="col-sm-6"> - <select multiple name="servicestatusfilter[]" class="form-control" height="5"> + <select multiple id="servicestatusfilter" name="servicestatusfilter[]" class="form-control" height="5"> <?php foreach ($services as $service): ?> <option <?=(in_array($service['name'], $skipservices)?'selected':'')?>><?=$service['name']?></option> <?php endforeach; ?> @@ -131,7 +139,29 @@ if (count($services) > 0) { <div class="form-group"> <div class="col-sm-offset-3 col-sm-6"> - <button type="submit" class="btn btn-default">Save</button> + <button type="submit" class="btn btn-primary">Save</button> + <button id="clearall" type="button" class="btn btn-default">Clear</button> </div> </div> </form> + +<script> +//<![CDATA[ +events.push(function(){ + $("select[multiple] option").mousedown(function(){ + var $self = $(this); + + if ($self.prop("selected")) + $self.prop("selected", false); + else + $self.prop("selected", true); + + return false; + }); + + $("#clearall").click(function() { + $('select#servicestatusfilter option').removeAttr("selected"); + }); +}); +//]]> +</script>
\ No newline at end of file |