summaryrefslogtreecommitdiffstats
path: root/usr/local/www/status_rrd_graph.php
diff options
context:
space:
mode:
authorSeth Mos <seth.mos@xs4all.nl>2007-03-06 10:23:02 +0000
committerSeth Mos <seth.mos@xs4all.nl>2007-03-06 10:23:02 +0000
commit9850b6256a4f272e063ed315f9db5fdc870194a8 (patch)
treea0da6d2047a7fecf8ffc39dcee7da61bb006ec12 /usr/local/www/status_rrd_graph.php
parent9ba08fba64fc6e9e9e3dfd911eb1164c6ea21a2e (diff)
downloadpfsense-9850b6256a4f272e063ed315f9db5fdc870194a8.zip
pfsense-9850b6256a4f272e063ed315f9db5fdc870194a8.tar.gz
Cleanup code, fix dropdown selection.
Diffstat (limited to 'usr/local/www/status_rrd_graph.php')
-rwxr-xr-xusr/local/www/status_rrd_graph.php71
1 files changed, 46 insertions, 25 deletions
diff --git a/usr/local/www/status_rrd_graph.php b/usr/local/www/status_rrd_graph.php
index 5bcaa9e..99251f9 100755
--- a/usr/local/www/status_rrd_graph.php
+++ b/usr/local/www/status_rrd_graph.php
@@ -60,6 +60,18 @@ $rrddbpath = "/var/db/rrd/";
exec("cd $rrddbpath;/usr/bin/find -name *.rrd", $databases);
rsort($databases);
+/* these boilerplate databases are required for the other menu choices */
+$dbheader = array("allgraphs-traffic.rrd",
+ "allgraphs-quality.rrd",
+ "allgraphs-packets.rrd",
+ "system-allgraphs.rrd",
+ "outbound-quality.rrd",
+ "outbound-packets.rrd",
+ "outbound-traffic.rrd");
+
+/* append the existing array to the header */
+$databases = array_merge($dbheader, $databases);
+
$styles = array('inverse' => 'Inverse',
'absolute' => 'Absolute');
@@ -106,10 +118,6 @@ include("head.inc");
<select name="option" class="formselect" style="z-index: -10;" onchange="document.form1.submit()">
<?php
- echo "<option value=\"allgraphs\">All graphs</option>\n";
- if (($curcat == "traffic") || ($curcat == "packets")) {
- echo "<option value=\"outbound\">Outbound</option>\n";
- }
foreach ($databases as $db => $database) {
if(! stristr($database, $curcat)) {
continue;
@@ -117,24 +125,29 @@ include("head.inc");
$optionc = split("-", $database);
$search = array("-", ".rrd", $optionc);
$replace = array(" :: ", "", $friendly);
- if($curcat == "system") {
- $optionc = str_replace($search, $replace, $optionc[1]);
- echo "<option value=\"$optionc\"";
- $prettyprint = ucwords(str_replace($search, $replace, $optionc));
- } else if($curcat == "queues") {
- $optionc = str_replace($search, $replace, $optionc[1]);
- echo "<option value=\"$optionc.\"";
- $prettyprint = ucwords(str_replace($search, $replace, $optionc));
- } else {
- /* Deduce a interface if possible and use the description */
- $optionc = "$optionc[0]";
- $friendly = convert_friendly_interface_to_friendly_descr(strtolower($optionc));
- $search = array("-", ".rrd", $optionc);
- $replace = array(" :: ", "", $friendly);
- echo "<option value=\"$optionc\"";
- $prettyprint = ucwords(str_replace($search, $replace, $friendly));
+ switch($curcat) {
+ case "system":
+ $optionc = str_replace($search, $replace, $optionc[1]);
+ echo "<option value=\"$optionc\"";
+ $prettyprint = ucwords(str_replace($search, $replace, $optionc));
+ break;
+ case "queues":
+ $optionc = str_replace($search, $replace, $optionc[1]);
+ echo "<option value=\"$optionc.\"";
+ $prettyprint = ucwords(str_replace($search, $replace, $optionc));
+ break;
+ default:
+ /* Deduce a interface if possible and use the description */
+ $optionc = "$optionc[0]";
+ $friendly = convert_friendly_interface_to_friendly_descr(strtolower($optionc));
+ $search = array("-", ".rrd", $optionc);
+ $replace = array(" :: ", "", $friendly);
+ echo "<option value=\"$optionc\"";
+ $prettyprint = ucwords(str_replace($search, $replace, $friendly));
+ }
+ if($curoption == $optionc) {
+ echo " selected ";
}
- if($optionc == $curoption) echo " selected ";
echo ">" . htmlspecialchars($prettyprint) . "</option>\n";
}
@@ -179,9 +192,13 @@ include("head.inc");
if(! stristr($curdatabase, $optionc)) {
continue 2;
}
- break;;
+ break;
case "allgraphs":
- break;;
+ /* make sure we do not show the placeholder databases in the all view */
+ if((stristr($curdatabase, "outbound")) || (stristr($curdatabase, "allgraphs"))) {
+ continue 2;
+ }
+ break;
default:
/* just use the name here */
if(! stristr($curdatabase, $curoption)) {
@@ -232,9 +249,13 @@ include("head.inc");
if(! stristr($curdatabase, $optionc)) {
continue 2;
}
- break;;
+ break;
case "allgraphs":
- break;;
+ /* make sure we do not show the placeholder databases in the all view */
+ if((stristr($curdatabase, "outbound")) || (stristr($curdatabase, "allgraphs"))) {
+ continue 2;
+ }
+ break;
default:
/* just use the name here */
if(! stristr($curdatabase, $curoption)) {
OpenPOWER on IntegriCloud