diff options
author | Renato Botelho <garga@pfSense.org> | 2013-12-07 12:49:21 -0800 |
---|---|---|
committer | Renato Botelho <garga@pfSense.org> | 2013-12-07 12:49:21 -0800 |
commit | 3c263d4541cb1aadb629cca3c0cce8523335a4bf (patch) | |
tree | 67235a0c25cc47b80b95ba1cc1f4e783c1301c7c /usr | |
parent | e08ba4bba6f45621a2a83a369fd726657408dc5c (diff) | |
parent | 8ff832559954b6fdc63372f2d908a31a1a7d4173 (diff) | |
download | pfsense-3c263d4541cb1aadb629cca3c0cce8523335a4bf.zip pfsense-3c263d4541cb1aadb629cca3c0cce8523335a4bf.tar.gz |
Merge pull request #860 from iamzam/RELENG_2_1
Allow setting a default scale type preference for the traffic graphs wid...
Diffstat (limited to 'usr')
-rwxr-xr-x | usr/local/www/graph.php | 6 | ||||
-rw-r--r-- | usr/local/www/widgets/widgets/traffic_graphs.widget.php | 25 |
2 files changed, 30 insertions, 1 deletions
diff --git a/usr/local/www/graph.php b/usr/local/www/graph.php index 6a227fa..c7c8c39 100755 --- a/usr/local/www/graph.php +++ b/usr/local/www/graph.php @@ -55,7 +55,11 @@ $ifnum = get_real_interface($ifnum); $ifname=@$_GET["ifname"]?$_GET["ifname"]:"Interface $ifnum"; //Interface name that will be showed on top right of graph /********* Other conf *******/ -$scale_type="up"; //Autoscale default setup : "up" = only increase scale; "follow" = increase and decrease scale according to current graphed datas +if (isset($config["widgets"]["trafficgraphs"]["scale_type"])) + $scale_type = $config["widgets"]["trafficgraphs"]["scale_type"]; +else + $scale_type = "up"; + $nb_plot=120; //NB plot in graph if ($_GET["timeint"]) $time_interval = $_GET["timeint"]; //Refresh time Interval diff --git a/usr/local/www/widgets/widgets/traffic_graphs.widget.php b/usr/local/www/widgets/widgets/traffic_graphs.widget.php index c313575..b859d0b 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) { ?> |