diff options
author | Seth Mos <seth.mos@xs4all.nl> | 2007-07-21 21:47:37 +0000 |
---|---|---|
committer | Seth Mos <seth.mos@xs4all.nl> | 2007-07-21 21:47:37 +0000 |
commit | 694870530ce003cc7ed5dd102cf7c0e2f4681dd2 (patch) | |
tree | bfbde1b1474a251245fd8b880486c8bae12317fb /usr/local | |
parent | e1cb5d69a9ed7bde5f673708b210f95acc05ea0c (diff) | |
download | pfsense-694870530ce003cc7ed5dd102cf7c0e2f4681dd2.zip pfsense-694870530ce003cc7ed5dd102cf7c0e2f4681dd2.tar.gz |
Add rrd graph settings page.
Bump config out of line with 1.2
Add rrd config upgrade code.
Diffstat (limited to 'usr/local')
-rwxr-xr-x | usr/local/www/status_rrd_graph.php | 16 | ||||
-rw-r--r-- | usr/local/www/status_rrd_graph_img.php | 2 | ||||
-rwxr-xr-x | usr/local/www/status_rrd_graph_settings.php | 165 |
3 files changed, 179 insertions, 4 deletions
diff --git a/usr/local/www/status_rrd_graph.php b/usr/local/www/status_rrd_graph.php index 96efa1e..9d5428a 100755 --- a/usr/local/www/status_rrd_graph.php +++ b/usr/local/www/status_rrd_graph.php @@ -3,7 +3,7 @@ /* status_rrd_graph.php Part of pfSense - Copyright (C) 2006 Seth Mos <seth.mos@xs4all.nl> + Copyright (C) 2007 Seth Mos <seth.mos@xs4all.nl> All rights reserved. Redistribution and use in source and binary forms, with or without @@ -33,7 +33,11 @@ require("guiconfig.inc"); if ($_GET['cat']) { $curcat = $_GET['cat']; } else { - $curcat = "system"; + if(! empty($config['rrd']['category'])) { + $curcat = $config['rrd']['category']; + } else { + $curcat = "system"; + } } if ($_GET['option']) { @@ -51,7 +55,11 @@ if ($_GET['option']) { if ($_GET['style']) { $curstyle = $_GET['style']; } else { - $curstyle = "inverse"; + if(! empty($config['rrd']['style'])) { + $curstyle = $config['rrd']['style']; + } else { + $curstyle = "inverse"; + } } $rrddbpath = "/var/db/rrd/"; @@ -103,6 +111,8 @@ include("head.inc"); $tab_array[] = array("Quality", $tabactive, "status_rrd_graph.php?cat=quality"); if($curcat == "queues") { $tabactive = True; } else { $tabactive = False; } $tab_array[] = array("Queues", $tabactive, "status_rrd_graph.php?cat=queues"); + if($curcat == "settings") { $tabactive = True; } else { $tabactive = False; } + $tab_array[] = array("Settings", $tabactive, "status_rrd_graph_settings.php"); display_top_tabs($tab_array); ?> </td> diff --git a/usr/local/www/status_rrd_graph_img.php b/usr/local/www/status_rrd_graph_img.php index fdf07a9..12638e4 100644 --- a/usr/local/www/status_rrd_graph_img.php +++ b/usr/local/www/status_rrd_graph_img.php @@ -3,7 +3,7 @@ /* status_rrd_graph_img.php Part of pfSense - Copyright (C) 2006 Seth Mos <seth.mos@xs4all.nl> + Copyright (C) 2007 Seth Mos <seth.mos@xs4all.nl> All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/usr/local/www/status_rrd_graph_settings.php b/usr/local/www/status_rrd_graph_settings.php new file mode 100755 index 0000000..6a386ad --- /dev/null +++ b/usr/local/www/status_rrd_graph_settings.php @@ -0,0 +1,165 @@ +<?php +/* $Id$ */ +/* + status_rrd_graph.php + Part of pfSense + Copyright (C) 2007 Seth Mos <seth.mos@xs4all.nl> + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +*/ + +require("guiconfig.inc"); + +$pconfig['enable'] = isset($config['rrd']['enable']); +$pconfig['category'] = isset($config['rrd']['category']); +$pconfig['style'] = isset($config['rrd']['style']); + +$curcat = "settings"; +$categories = array('system' => 'System', + 'traffic' => 'Traffic', + 'packets' => 'Packets', + 'quality' => 'Quality', + 'queues' => 'Queues'); +$styles = array('inverse' => 'Inverse', + 'absolute' => 'Absolute'); + +if ($_POST) { + + unset($input_errors); + $pconfig = $_POST; + + /* input validation */ + /* none */ + + if (!$input_errors) { + $config['rrd']['enable'] = $_POST['enable'] ? true : false; + $config['rrd']['category'] = $_POST['category']; + $config['rrd']['style'] = $_POST['style']; + write_config(); + + $retval = 0; + config_lock(); + $retval = enable_rrd_graphing(); + config_unlock(); + + $savemsg = get_std_save_message($retval); + } +} + +$pgtitle = gettext("Status: RRD Graphs"); +include("head.inc"); + +?> +<script src="/javascript/scriptaculous/prototype.js" type="text/javascript"></script> +<script src="/javascript/scriptaculous/scriptaculous.js" type="text/javascript"></script> +<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> +<?php include("fbegin.inc"); ?> +<p class="pgtitle"><?=$pgtitle?></p> +<?php if ($input_errors) print_input_errors($input_errors); ?> +<?php if ($savemsg) print_info_box($savemsg); ?> +<form action="status_rrd_graph_settings.php" method="post" name="iform" id="iform"> +<table width="100%" border="0" cellpadding="0" cellspacing="0"> + <tr> + <td> + <?php + $tab_array = array(); + if($curcat == "system") { $tabactive = True; } else { $tabactive = False; } + $tab_array[] = array("System", $tabactive, "status_rrd_graph.php?cat=system"); + if($curcat == "traffic") { $tabactive = True; } else { $tabactive = False; } + $tab_array[] = array("Traffic", $tabactive, "status_rrd_graph.php?cat=traffic"); + if($curcat == "packets") { $tabactive = True; } else { $tabactive = False; } + $tab_array[] = array("Packets", $tabactive, "status_rrd_graph.php?cat=packets"); + if($curcat == "quality") { $tabactive = True; } else { $tabactive = False; } + $tab_array[] = array("Quality", $tabactive, "status_rrd_graph.php?cat=quality"); + if($curcat == "queues") { $tabactive = True; } else { $tabactive = False; } + $tab_array[] = array("Queues", $tabactive, "status_rrd_graph.php?cat=queues"); + if($curcat == "settings") { $tabactive = True; } else { $tabactive = False; } + $tab_array[] = array("Settings", $tabactive, "status_rrd_graph_settings.php?cat=settings"); + display_top_tabs($tab_array); + ?> + </td> + </tr> + <tr> + <td> + <div id="mainarea"> + <table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="6"> + <tr> + <td width="22%" valign="top" class="vtable">RRD Graphs</td> + <td width="78%" class="vtable"> + <input name="enable" type="checkbox" id="enable" value="yes" <?php if ($pconfig['enable']) echo "checked"; ?> onClick="enable_change(false)"> + <b><?=gettext("Enables the RRD graphing backend.");?></b> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vtable">Default category</td> + <td width="78%" class="vtable"> + <select name="category" id="category" class="formselect" style="z-index: -10;" > + <?php + foreach ($categories as $category => $categoryd) { + echo "<option value=\"$category\""; + if ($category == $pconfig['category']) echo " selected"; + echo ">" . htmlspecialchars($categoryd) . "</option>\n"; + } + ?> + </select> + <b><?=gettext("This selects default category.");?></b> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vtable">Default style</td> + <td width="78%" class="vtable"> + <select name="style" class="formselect" style="z-index: -10;" > + <?php + foreach ($styles as $style => $styled) { + echo "<option value=\"$style\""; + if ($style == $pconfig['style']) echo " selected"; + echo ">" . htmlspecialchars($styled) . "</option>\n"; + } + ?> + </select> + <b><?=gettext("This selects the default style.");?></b> + </td> + </tr> + <tr> + <td width="22%" valign="top"> </td> + <td width="78%"> + <input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)"> + </td> + </tr> + <tr> + <td width="22%" height="53" valign="top"> </td> + <td width="78%"><strong><span class="red">Note:</span></strong><br> + <?=gettext("Graphs will not be allowed to be recreated within a 1 minute interval, please + take this into account after changing the style.");?> + </td> + </tr> + </table> + </div> + </td> + </tr> +</table> + +</form> +<?php include("fend.inc"); ?> +</body> +</html> |