Commit c23950b0 authored by Jos Schellevis's avatar Jos Schellevis

Fix traffic graph widget

parent 727453c0
function trafficshowDiv(e,t){selectedDiv=e+"graphdiv",jQuery("#"+selectedDiv).show(),d=document,t&&(selectIntLink=selectedDiv+"-min",textlink=d.getElementById(selectIntLink),textlink.style.display="inline",selectIntLink=selectedDiv+"-open",textlink=d.getElementById(selectIntLink),textlink.style.display="none")}function trafficminimizeDiv(e,t){selectedDiv=e+"graphdiv",jQuery("#"+selectedDiv).hide(),d=document,t&&(selectIntLink=selectedDiv+"-open",textlink=d.getElementById(selectIntLink),textlink.style.display="inline",selectIntLink=selectedDiv+"-min",textlink=d.getElementById(selectIntLink),textlink.style.display="none")}
\ No newline at end of file
...@@ -12,6 +12,7 @@ function trafficshowDiv(incDiv,swapButtons){ ...@@ -12,6 +12,7 @@ function trafficshowDiv(incDiv,swapButtons){
textlink = d.getElementById(selectIntLink); textlink = d.getElementById(selectIntLink);
textlink.style.display = "none"; textlink.style.display = "none";
} }
document.iform["shown[" + incDiv + "]"].value = "show";
} }
function trafficminimizeDiv(incDiv,swapButtons){ function trafficminimizeDiv(incDiv,swapButtons){
...@@ -28,5 +29,6 @@ function trafficminimizeDiv(incDiv,swapButtons){ ...@@ -28,5 +29,6 @@ function trafficminimizeDiv(incDiv,swapButtons){
textlink = d.getElementById(selectIntLink); textlink = d.getElementById(selectIntLink);
textlink.style.display = "none"; textlink.style.display = "none";
} }
document.iform["shown[" + incDiv + "]"].value = "hide";
} }
...@@ -38,6 +38,12 @@ require_once("pfsense-utils.inc"); ...@@ -38,6 +38,12 @@ require_once("pfsense-utils.inc");
require_once("functions.inc"); require_once("functions.inc");
$first_time = false; $first_time = false;
//var_dump($config["widgets"]["trafficgraphs"]);
//$config["widgets"]["trafficgraphs"]["shown"]["item"][1]="lan";
//write_config(gettext("Widget configuration has been changed."));
if (!is_array($config["widgets"]["trafficgraphs"])) { if (!is_array($config["widgets"]["trafficgraphs"])) {
$first_time = true; $first_time = true;
$config["widgets"]["trafficgraphs"] = array(); $config["widgets"]["trafficgraphs"] = array();
...@@ -56,6 +62,7 @@ if (isset($config['ipsec']['enable'])) ...@@ -56,6 +62,7 @@ if (isset($config['ipsec']['enable']))
$ifdescrs['enc0'] = "IPsec"; $ifdescrs['enc0'] = "IPsec";
if ($_POST) { if ($_POST) {
if (isset($_POST["refreshinterval"])) { if (isset($_POST["refreshinterval"])) {
$a_config["refreshinterval"] = $_POST["refreshinterval"]; $a_config["refreshinterval"] = $_POST["refreshinterval"];
} }
...@@ -100,12 +107,13 @@ if (isset($a_config["scale_type"])) { ...@@ -100,12 +107,13 @@ if (isset($a_config["scale_type"])) {
<div id="traffic_graphs-settings" class="widgetconfigdiv" style="display:none;"> <div id="traffic_graphs-settings" class="widgetconfigdiv" style="display:none;">
<form action="/widgets/widgets/traffic_graphs.widget.php" method="post" name="iform" id="iform"> <form action="/widgets/widgets/traffic_graphs.widget.php" method="post" name="iform" id="iform">
<table class="table table-striped">
<tbody>
<?php foreach ($ifdescrs as $ifname => $ifdescr) { ?> <?php foreach ($ifdescrs as $ifname => $ifdescr) { ?>
<input type="hidden" name="shown[<?= $ifname ?>]" value="<?= $shown[$ifname] ? "show" : "hide" ?>" /> <input type="hidden" name="shown[<?= $ifname ?>]" value="<?= $shown[$ifname] ? "show" : "hide" ?>" />
<?php } ?> <?php } ?>
<table class="table table-striped">
<tbody>
<tr> <tr>
<td> <td>
Default AutoScale: Default AutoScale:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment