diff options
author | dwayne voelker <iamzam@gmail.com> | 2013-12-05 00:19:31 -0500 |
---|---|---|
committer | Renato Botelho <garga@FreeBSD.org> | 2013-12-07 18:50:41 -0200 |
commit | 0c8fb22238b833462e9861fd309e59a853a71160 (patch) | |
tree | 297d5912eaa7db3555592257af515dad21fa1e63 /usr/local/www/widgets/widgets | |
parent | 52d5ef8d14d4dbe8974b657457d3244469016154 (diff) | |
download | pfsense-0c8fb22238b833462e9861fd309e59a853a71160.zip pfsense-0c8fb22238b833462e9861fd309e59a853a71160.tar.gz |
Allow setting a default scale type preference for the traffic graphs widget
I originally submitted this at https://redmine.pfsense.org/issues/2994
but it seems that is not used for commits now so I am adding it here.
It works great on my box, and I can't see these changes causing any
issues on other types.
I like to have Autoscale (follow) set for the traffic graphs widget and
hate having to click on Autoscale (up) to change it to follow every
time I enter the dashboard page.
This preference is written to the traffic graph widget section in
config.xml
Diffstat (limited to 'usr/local/www/widgets/widgets')
-rw-r--r-- | usr/local/www/widgets/widgets/traffic_graphs.widget.php | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/usr/local/www/widgets/widgets/traffic_graphs.widget.php b/usr/local/www/widgets/widgets/traffic_graphs.widget.php index f949110..57c3576 100644 --- a/usr/local/www/widgets/widgets/traffic_graphs.widget.php +++ b/usr/local/www/widgets/widgets/traffic_graphs.widget.php @@ -59,6 +59,9 @@ if ($_POST) { if (isset($_POST["refreshinterval"])) { $a_config["refreshinterval"] = $_POST["refreshinterval"]; } + if (isset($_POST["scale_type"])) { + $a_config["scale_type"] = $_POST["scale_type"]; + } $a_config["shown"]["item"] = array(); foreach ($ifdescrs as $ifname => $ifdescr) { $state = $_POST["shown"][$ifname]; @@ -86,6 +89,12 @@ if (isset($a_config["refreshinterval"])) { $refreshinterval = 10; } +if (isset($a_config["scale_type"])) { + $scale_type = $a_config["scale_type"]; +} else { + $scale_type = up; +} + ?> <input type="hidden" id="traffic_graphs-config" name="traffic_graphs-config" value=""> @@ -100,6 +109,22 @@ if (isset($a_config["refreshinterval"])) { <?php foreach ($ifdescrs as $ifname => $ifdescr) { ?> <input type="hidden" name="shown[<?= $ifname ?>]" value="<?= $shown[$ifname] ? "show" : "hide" ?>" /> <?php } ?> + Default AutoScale: + <?php + $scale_type_up="checked"; + $scale_type_follow="unchecked"; + if (isset($config["widgets"]["trafficgraphs"]["scale_type"])) { + $selected_radio = $config["widgets"]["trafficgraphs"]["scale_type"]; + if ($selected_radio == "up") { + $scale_type_up = "checked"; + } + else if ($selected_radio == "follow") { + $scale_type_follow = "checked"; + } + } + ?> + <input name="scale_type" class="radio" type="radio" id="scale_type" value="up" <?php echo $scale_type_up; ?> onchange="updateGraphDisplays();" /> <span>up</span> + <input name="scale_type" class="radio" type="radio" id="scale_type" value="follow" <?php echo $scale_type_follow; ?> onchange="updateGraphDisplays();" /> <span>follow</span><br><br> Refresh Interval: <select name="refreshinterval" class="formfld" id="refreshinterval" onchange="updateGraphDisplays();"> <?php for ($i = 1; $i <= 10; $i += 1) { ?> |