/*
+-------------------------------------------------------------------------+
| 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 = "Add/Edit Graphs"; include ('include/auth.php');
header("Cache-control: no-cache");
include_once ('include/form.php');
if (isset($form[action])) { $action = $form[action]; } else { $action = $args[action]; }
if (isset($form[ID])) { $id = $form[ID]; } else { $id = $args[id]; }
function draw_graph_form_select($main_action) {
global $colors, $args; ?>
}
function item() {
global $args, $colors;
$graph_template_id = db_fetch_cell("select graph_template_id from graph_local where id=$args[local_graph_id]");
$graph_template_name = db_fetch_cell("select name from graph_templates where id=$graph_template_id");
if ($graph_template_name == "") {
$header_text = "Graph Item Configuration";
}else{
$header_text = "Graph Item Configuration [Template: $graph_template_name]";
}
start_box($header_text, "", "graphs.php?action=item_edit&local_graph_id=$args[local_graph_id]");
print "";
DrawMatrixHeaderItem("Graph Item",$colors[header_text],1);
DrawMatrixHeaderItem("Task Name",$colors[header_text],1);
DrawMatrixHeaderItem("Graph Item Type",$colors[header_text],1);
DrawMatrixHeaderItem("CF Type",$colors[header_text],1);
DrawMatrixHeaderItem("Item Color",$colors[header_text],3);
print "
";
$template_item_list = db_fetch_assoc("select
graph_templates_item.id,
graph_templates_item.text_format,
graph_templates_item.value,
graph_templates_item.hard_return,
polling_items.descrip,
cdef.name as cdef_name,
def_cf.name as consolidation_function_name,
def_colors.hex,
def_graph_type.name as graph_type_name
from graph_templates_item left join polling_items on graph_templates_item.task_item_id=polling_items.item_id
left join cdef on cdef_id=cdef.id
left join def_cf on consolidation_function_id=def_cf.id
left join def_colors on color_id=def_colors.id
left join def_graph_type on graph_type_id=def_graph_type.id
where graph_templates_item.local_graph_id=$args[local_graph_id]
order by graph_templates_item.sequence_parent,graph_templates_item.sequence");
$group_counter = 0;
if (sizeof($template_item_list) > 0) {
foreach ($template_item_list as $item) {
/* graph grouping display logic */
$bold_this_row = false; $use_custom_row_color = false;
if (($item[graph_type_name] != "GPRINT") && ($item[graph_type_name] != $_graph_type_name)) {
$bold_this_row = true; $use_custom_row_color = true;
if ($group_counter % 2 == 0) {
$alternate_color_1 = "EEEEEE";
$alternate_color_2 = "EEEEEE";
$custom_row_color = "D5D5D5";
}else{
$alternate_color_1 = $colors[alternate];
$alternate_color_2 = $colors[alternate];
$custom_row_color = "D2D6E7";
}
$group_counter++;
}
$_graph_type_name = $item[graph_type_name];
if ($use_custom_row_color == false) { DrawMatrixRowAlternateColorBegin($alternate_color_1,$alternate_color_2,$i); }else{ print ""; } ?>
|
}?>Item # }?>
|
if ($item[descrip] == "") { $item[descrip] = "(No Task)"; }
switch ($item[graph_type_name]) {
case 'AREA':
$matrix_title = $item[descrip] . ": " . $item[text_format];
break;
case 'STACK':
$matrix_title = $item[descrip] . ": " . $item[text_format];
break;
case 'COMMENT':
$matrix_title = "COMMENT: $item[text_format]";
break;
case 'GPRINT':
$matrix_title = $item[descrip] . ": " . $item[text_format];
break;
case 'HRULE':
$matrix_title = "HRULE: $item[value]";
break;
case 'VRULE':
$matrix_title = "VRULE: $item[value]";
break;
default:
$matrix_title = $item[descrip];
break;
}
/* use the cdef name (if in use) if all else fails */
if ($matrix_title == "") {
if ($item[cdef_name] != "") {
$matrix_title .= "CDEF: $item[cdef_name]";
}
}
$hard_return = "";
if ($item[hard_return] == "on") {
$hard_return = "<HR>";
}
?>
"; }?>"; }?>
|
"; }?>"; }?>
|
"; }?>"; }?>
|
width="1%">
|
"; }?>"; }?>
|
}?>
|
$i++;
}
}else{
DrawMatrixRowAlternateColorBegin($colors[form_alternate1],$colors[form_alternate2],0); ?>
No Items
|
}
/* only display the "inputs" area if we are using a graph template for this graph */
if ($graph_template_id != "0") {
end_box();
start_box("Graph Item Inputs", "", "");
?>