1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
|
<?/*
+-------------------------------------------------------------------------+
| Copyright (C) 2002 Ian Berry |
| |
| This program is free software; you can redistribute it and/or |
| modify it under the terms of the GNU General Public License |
| as published by the Free Software Foundation; either version 2 |
| of the License, or (at your option) any later version. |
| |
| This program is distributed in the hope that it will be useful, |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| GNU General Public License for more details. |
+-------------------------------------------------------------------------+
| cacti: the rrdtool frontend [php-auth, php-tree, php-form] |
+-------------------------------------------------------------------------+
| This code is currently maintained and debugged by Ian Berry, any |
| questions or comments regarding this code should be directed to: |
| - iberry@raxnet.net |
+-------------------------------------------------------------------------+
| - raXnet - http://www.raxnet.net/ |
+-------------------------------------------------------------------------+
*/?>
<? $section = "View Graphs"; $guest_account = true; include ('auth/include/auth.php');
header("Cache-control: no-cache");
include ('include/database.php');
include ('include/config.php');
include_once ("include/functions.php");
include_once ('include/form.php');
/* get current user */
$user_id = GetCurrentUserID($HTTP_COOKIE_VARS["cactilogin"], $config["guest_user"]["value"]);
switch ($action) {
case 'save':
$sql_id = mysql_query("replace into settings_graphs (id,userid,rraid,treeid,
height,width,timespan,columnnumber,viewtype,listviewtype,pagerefresh) values ($id,$user_id
,$rraid,$treeid,$height,$width,$timespan,$columnnumber,$viewtype,$listviewtype,$pagerefresh)",$cnn_id);
header ("Location: $referer");
break;
default:
include_once ('include/top_graph_header.php');
/* find out if the current user has right s here */
$sql_id = mysql_query("select graphsettings from auth_users where id=$user_id", $cnn_id);
if (mysql_num_rows($sql_id) == 0) {
print "<strong><font size=\"+1\" color=\"FF0000\">CANNOT FIND USER!</font></strong>"; exit;
}else{
if (mysql_result($sql_id, 0, "graphsettings") == "") {
print "<strong><font size=\"+1\" color=\"FF0000\">YOU DO NOT HAVE RIGHTS TO CHANGE GRAPH SETTINGS</font></strong>"; exit;
}
}
$sql_id = mysql_query("select * from settings_graphs where userid=$user_id", $cnn_id);
if (mysql_num_rows($sql_id) == 0) {
$sql_id = "";
}
if (getenv("HTTP_REFERER") == "") {
$referer = $HTTP_REFERER;
}else{
$referer = getenv("HTTP_REFERER");
}
DrawFormHeader("Graph Preview Settings","",false);
DrawFormItem("Height","The height of graphs created in preview mode.");
DrawFormItemTextBox("height",$sql_id,"100","");
DrawFormItem("Width","The width of graphs created in preview mode.");
DrawFormItemTextBox("width",$sql_id,"300","");
DrawFormItem("Timespan","The amount of time to represent on a graph created in preview mode (0 uses auto).");
DrawFormItemTextBox("timespan",$sql_id,"60000","");
DrawFormItem("Default RRA","The default RRA to use when displaying graphs in preview mode.");
DrawFormItemDropdownFromSQL("rraid",$cnn_id,"select * from rrd_rra order by name",
"name","id",$sql_id,"","");
DrawFormItem("Columns","The number of columns to display graphs in using preview mode.");
DrawFormItemTextBox("columnnumber",$sql_id,"2","");
DrawFormItem("Page Refresh","The number of seconds between automatic page refreshes.");
DrawFormItemTextBox("pagerefresh",$sql_id,"300","");
DrawPlainFormHeader("List Settings");
DrawFormItem("View Settings","Options that govern how the graphs are displayed.");
DrawFormItemRadioButton("listviewtype", $sql_id, "1", "Show a 4 column list of each graph and its RRA.", "1");
DrawFormItemRadioButton("listviewtype", $sql_id, "2", "Show a 1 column list of each graph.", "1");
DrawPlainFormHeader("Hierarchical Settings");
DrawFormItem("Default Graph Hierarchy ","The default graph hierarchy to use when displaying graphs in tree mode.");
DrawFormItemDropdownFromSQL("treeid",$cnn_id,"select * from graph_hierarchy order by name",
"name","id",$sql_id,"","");
DrawFormItem("View Settings","Options that govern how the graphs are displayed.");
DrawFormItemRadioButton("viewtype", $sql_id, "1", "Show a preview of the graph.", "1");
DrawFormItemRadioButton("viewtype", $sql_id, "2", "Show a text-based listing of the graph.", "1");
DrawFormSaveButton();
DrawFormItemHiddenIDField("id",$sql_id);
DrawFormItemHiddenIDField("referer", $referer);
DrawFormFooter();
include_once ("include/bottom_footer.php");
break;
} ?>
|