From bd42816b35257986bfaddef51ff9950e4b65a740 Mon Sep 17 00:00:00 2001 From: Ian Berry Date: Mon, 19 Jan 2004 05:49:52 +0000 Subject: [PATCH] fixed undefined variable errors when dealing with broken data queries renamed the 'host template' box to 'graph templates' display the host template name in the upper-right hand corner of the screen git-svn-id: svn+ssh://repo.cacti.net/var/data/svnroot/cacti/trunk/cacti@1463 860744bd-22fc-0310-8c96-e9fe5004b5ca --- graphs_new.php | 167 +++++++++++++++++++++++++------------------------ 1 file changed, 84 insertions(+), 83 deletions(-) diff --git a/graphs_new.php b/graphs_new.php index d1ae1736e0..76a83dea1b 100644 --- a/graphs_new.php +++ b/graphs_new.php @@ -388,6 +388,13 @@ function graphs() { () + + + @@ -425,81 +432,79 @@ function graphs() { 0) { - /* we give users the option to turn off the javascript features for data queries with lots of rows */ - if (read_config_option("max_data_query_javascript_rows") >= $total_rows) { - $use_javascript = true; - }else{ - $use_javascript = false; - } - - start_box("Host Template [" . (empty($host["host_template_id"]) ? "None" : db_fetch_cell("select name from host_template where id=" . $host["host_template_id"])) . "]", "98%", $colors["header"], "3", "center", ""); - - print " - Graph Template Name - \n - \n"; - - $graph_templates = db_fetch_assoc("select - graph_templates.id as graph_template_id, - graph_templates.name as graph_template_name - from host_graph,graph_templates - where host_graph.graph_template_id=graph_templates.id - and host_graph.host_id=" . $_REQUEST["host_id"] . " - order by graph_templates.name"); - - $template_graphs = db_fetch_assoc("select graph_local.graph_template_id from graph_local,host_graph where graph_local.graph_template_id=host_graph.graph_template_id and graph_local.host_id=" . $host["id"] . " group by graph_local.graph_template_id"); - - print "\n"; - - if ((sizeof($template_graphs) > 0) && ($use_javascript == true)) { - print "\n"; - } - - /* create a row for each graph template associated with the host template */ - $i = 0; - if (sizeof($graph_templates) > 0) { - foreach ($graph_templates as $graph_template) { - $query_row = $graph_template["graph_template_id"]; - - print ""; $i++; - - print " - Create: " . $graph_template["graph_template_name"] . " - - - - - "; - } - } - - if ($use_javascript == true) { - print "\n"; - } - - /* create a row at the bottom that lets the user create any graph they choose */ - print " - - Create: "; - form_dropdown("cg_g", db_fetch_assoc("select id,name from graph_templates order by name"), "name", "id", "", "(Select a graph type to create)", "", "font-size: 10px;"); - print " - "; - - end_box(); + /* we give users the option to turn off the javascript features for data queries with lots of rows */ + if (read_config_option("max_data_query_javascript_rows") >= $total_rows) { + $use_javascript = true; + }else{ + $use_javascript = false; } + start_box("Graph Templates", "98%", $colors["header"], "3", "center", ""); + + print " + Graph Template Name + \n + \n"; + + $graph_templates = db_fetch_assoc("select + graph_templates.id as graph_template_id, + graph_templates.name as graph_template_name + from host_graph,graph_templates + where host_graph.graph_template_id=graph_templates.id + and host_graph.host_id=" . $_REQUEST["host_id"] . " + order by graph_templates.name"); + + $template_graphs = db_fetch_assoc("select graph_local.graph_template_id from graph_local,host_graph where graph_local.graph_template_id=host_graph.graph_template_id and graph_local.host_id=" . $host["id"] . " group by graph_local.graph_template_id"); + + print "\n"; + + if ((sizeof($template_graphs) > 0) && ($use_javascript == true)) { + print "\n"; + } + + /* create a row for each graph template associated with the host template */ + $i = 0; + if (sizeof($graph_templates) > 0) { + foreach ($graph_templates as $graph_template) { + $query_row = $graph_template["graph_template_id"]; + + print ""; $i++; + + print " + Create: " . $graph_template["graph_template_name"] . " + + + + + "; + } + } + + if ($use_javascript == true) { + print "\n"; + } + + /* create a row at the bottom that lets the user create any graph they choose */ + print " + + Create: "; + form_dropdown("cg_g", db_fetch_assoc("select id,name from graph_templates order by name"), "name", "id", "", "(Select a graph type to create)", "", "font-size: 10px;"); + print " + "; + + end_box(); + $snmp_queries = db_fetch_assoc("select snmp_query.id, snmp_query.name, @@ -518,7 +523,9 @@ function graphs() { $xml_array = get_data_query_array($snmp_query["id"]); $xml_outputs = array(); + $total_rows = 0; $num_input_fields = 0; + $num_visible_fields = 0; if ($xml_array != false) { /* loop through once so we can find out how many input fields there are */ @@ -531,11 +538,6 @@ function graphs() { } } } - - reset($xml_array["fields"]); - $snmp_query_indexes = array(); - $num_visible_fields = 0; - $i = 0; } /* we give users the option to turn off the javascript features for data queries with lots of rows */ @@ -597,11 +599,11 @@ function graphs() { if ($xml_array != false) { $html_dq_header = ""; + $snmp_query_indexes = array(); + reset($xml_array["fields"]); while (list($field_name, $field_array) = each($xml_array["fields"])) { if ($field_array["direction"] == "input") { - $i++; - $raw_data = db_fetch_assoc("select field_value,snmp_index from host_snmp_cache where host_id=" . $host["id"] . " and field_name='$field_name' and snmp_query_id=" . $snmp_query["id"]); /* don't even both to display the column if it has no data */ @@ -632,15 +634,14 @@ function graphs() { $html_dq_header \n \n"; - } - $row_counter = 0; + $row_counter = 0; if (sizeof($snmp_query_indexes) > 0) { while (list($snmp_index, $snmp_index) = each($snmp_query_indexes)) { $query_row = $snmp_query["id"] . "_" . $snmp_index; - print ""; $i++; + print ""; $i++; $column_counter = 0; reset($xml_array["fields"]);