'" . db_fetch_cell("select name from graph_templates_gprint where id=" . $_GET["gprint_preset_id"]) . "'? This could affect every graph that uses this preset, make sure you know what you are doing first!", getenv("HTTP_REFERER"), "graph_templates.php?action=gprint_presets_remove&gprint_preset_id=" . $_GET["gprint_preset_id"]); exit; } gprint_presets_remove(); header ("Location: graph_templates.php?action=gprint_presets"); break; case 'gprint_presets_edit': include_once ("include/top_header.php"); gprint_presets_edit(); include_once ("include/bottom_footer.php"); break; case 'gprint_presets': include_once ("include/top_header.php"); gprint_presets(); include_once ("include/bottom_footer.php"); break; case 'template_remove': template_remove(); header ("Location: graph_templates.php"); break; case 'input_remove': input_remove(); header ("Location: " . getenv("HTTP_REFERER")); break; case 'item_remove': item_remove(); header ("Location: " . getenv("HTTP_REFERER")); break; case 'input_edit': include_once ("include/top_header.php"); input_edit(); include_once ("include/bottom_footer.php"); break; case 'item_movedown': item_movedown(); header ("Location: " . getenv("HTTP_REFERER")); break; case 'item_moveup': item_moveup(); header ("Location: " . getenv("HTTP_REFERER")); break; case 'item_edit': include_once ("include/top_header.php"); item_edit(); include_once ("include/bottom_footer.php"); break; case 'item': include_once ("include/top_header.php"); item(); include_once ("include/bottom_footer.php"); break; case 'template_edit': include_once ("include/top_header.php"); template_edit(); include_once ("include/bottom_footer.php"); break; default: include_once ("include/top_header.php"); template(); include_once ("include/bottom_footer.php"); break; } /* -------------------------- Global Form Functions -------------------------- */ function draw_graph_form_select($main_action) { global $colors; ?> ">
 Go
.gif" alt="Data Sources" border="0" align="absmiddle"> .gif" alt="Data Source Tree" border="0" align="absmiddle">

GPRINT Presets $header_label", "98%", $colors["header"], "3", "center", ""); ?>
Name
Enter a name for this GPRINT preset, make sure it is something you recognize. GPRINT Text
Enter the custom GPRINT string here. GPRINT Presets", "98%", $colors["header"], "3", "center", "graph_templates.php?action=gprint_presets_edit"); print ""; DrawMatrixHeaderItem("GPRINT Preset Title",$colors["panel_text"],2); print ""; $template_list = db_fetch_assoc("select graph_templates_gprint.id, graph_templates_gprint.name from graph_templates_gprint"); $i = 0; if (sizeof($template_list) > 0) { foreach ($template_list as $template) { form_alternate_row_color($colors["alternate"],$colors["light"],$i); ?> "> ">Delete  No Items Graph Template Management $header_label", "98%", $colors["header"], "3", "center", ""); draw_graph_form_select("?action=item&id=" . $_GET["id"]); end_box(); } start_box("Graph Template Items $header_label", "98%", $colors["header"], "3", "center", "graph_templates.php?action=item_edit&id=" . $_GET["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"],4); print ""; $group_counter = 0; $_graph_type_name = ""; $i = 0; if (sizeof($template_item_list) > 0) { foreach ($template_item_list as $item) { $this_row_style = ""; $use_custom_row_color = false; $hard_return = ""; if (($graph_item_types{$item["graph_type_id"]} != "GPRINT") && ($graph_item_types{$item["graph_type_id"]} != $_graph_type_name)) { $this_row_style = "font-weight: bold;"; $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 = $graph_item_types{$item["graph_type_id"]}; if ($use_custom_row_color == false) { form_alternate_row_color($alternate_color_1,$alternate_color_2,$i); }else{ print ""; } print "Item # " . ($i+1) . "\n"; if (empty($item["data_source_name"])) { $item["data_source_name"] = "No Task"; } switch (true) { case ereg("(AREA|STACK|GPRINT|LINE[123])", $_graph_type_name): $matrix_title = "(" . $item["data_source_name"] . "): " . $item["text_format"]; break; case ereg("(HRULE|VRULE)", $_graph_type_name): $matrix_title = "HRULE: " . $item["value"]; break; case ereg("(COMMENT)", $_graph_type_name): $matrix_title = "COMMENT: " . $item["text_format"]; break; } if ($item["hard_return"] == "on") { $hard_return = "<HR>"; } print "" . htmlspecialchars($matrix_title) . $hard_return . "\n"; print "" . $graph_item_types{$item["graph_type_id"]} . "\n"; print "" . $consolidation_functions{$item["consolidation_function_id"]} . "\n"; print " \n"; print "" . $item["hex"] . "\n"; print "Move Down Move Up\n"; print "Delete \n"; print ""; $i++; } }else{ print "No Items"; } end_box(); start_box("Graph Item Inputs", "98%", $colors["header"], "3", "center", "graph_templates.php?action=input_edit&id=" . $_GET["id"]); print ""; DrawMatrixHeaderItem("Name",$colors["header_text"],2); print ""; $template_item_list = db_fetch_assoc("select id,name from graph_template_input where graph_template_id=" . $_GET["id"] . " order by name"); if (sizeof($template_item_list) > 0) { foreach ($template_item_list as $item) { form_alternate_row_color($colors["alternate"],$colors["light"],$i); ?> &id="> &id=">Delete  No Inputs"; } end_box(); } function item_remove() { db_execute("delete from graph_templates_item where id=" . $_GET["graph_template_item_id"]); } function item_edit() { global $colors, $struct_graph_item, $graph_item_types, $consolidation_functions; draw_tabs(); $header_label = "[edit graph: " . db_fetch_cell("select name from graph_templates where id=" . $_GET["id"]) . "]"; if (read_config_option("full_view_graph_template") == "") { start_box("Graph Template Management $header_label", "98%", $colors["header"], "3", "center", ""); draw_graph_form_select("?action=item&id=" . $_GET["id"]); end_box(); } start_box("Template Item $header_label", "98%", $colors["header"], "3", "center", ""); if (!empty($_GET["graph_template_item_id"])) { $template_item = db_fetch_row("select * from graph_templates_item where id=" . $_GET["graph_template_item_id"]); } print "\n"; /* by default, select the LAST DS chosen to make everyone's lives easier */ $default = db_fetch_row("select task_item_id from graph_templates_item where graph_template_id=" . $_GET["id"] . " order by sequence DESC"); if (sizeof($default) > 0) { $struct_graph_item["task_item_id"]["default"] = $default["task_item_id"]; }else{ $struct_graph_item["task_item_id"]["default"] = 0; } /* modifications to the default graph items array */ $struct_graph_item["task_item_id"]["sql"] = "select CONCAT_WS('',data_template.name,' - ',data_template_data.name,' (',data_template_rrd.data_source_name,')') as name, data_template_rrd.id from data_template_data,data_template_rrd,data_template where data_template_rrd.data_template_id=data_template.id and data_template_data.data_template_id=data_template.id and data_template_data.local_data_id=0 and data_template_rrd.local_data_id=0 order by data_template.name,data_template_data.name,data_template_rrd.data_source_name"; $i = 0; while (list($field_name, $field_array) = each($struct_graph_item)) { form_alternate_row_color($colors["form_alternate1"],$colors["form_alternate2"],$i); $i++; print "" . $field_array["title"] . "
\n"; if (isset($field_array["description"])) { print $field_array["description"]; } print "\n"; draw_nontemplated_item($field_array, $field_name, (isset($template_item) ? $template_item[$field_name] : "")); print "\n"; } end_box(); form_hidden_id("graph_template_item_id",(isset($template_item) ? $template_item["id"] : "0")); form_hidden_id("graph_template_id",$_GET["id"]); form_hidden_id("sequence",(isset($template_item) ? $template_item["sequence"] : "0")); form_hidden_id("_graph_type_id",(isset($template_item) ? $template_item["graph_type_id"] : "0")); form_hidden_box("save_component_item","1",""); form_save_button("graph_templates.php?action=template_edit&id=" . $_GET["id"]); } /* ------------------------------------ input - Graph Template Item Inputs ------------------------------------ */ function input_remove() { if ((read_config_option("remove_verification") == "on") && (!isset($_GET["confirm"]))) { include ('include/top_header.php'); form_confirm("Are You Sure?", "Are you sure you want to delete the input item '" . db_fetch_cell("select name from graph_template_input where id=" . $_GET["graph_template_input_id"]) . "'? NOTE: Deleting this item will NOT affect graphs that use this template.", getenv("HTTP_REFERER"), "graph_templates.php?action=input_remove&graph_template_input_id=" . $_GET["graph_template_input_id"] . "&id=" . $_GET["id"]); include ('include/bottom_footer.php'); exit; } if ((read_config_option("remove_verification") == "") || (isset($_GET["confirm"]))) { db_execute("delete from graph_template_input where id=" . $_GET["graph_template_input_id"]); db_execute("delete from graph_template_input_defs where graph_template_input_id=" . $_GET["graph_template_input_id"]); } } function input_edit() { global $colors, $consolidation_functions, $graph_item_types, $struct_graph_item; draw_tabs(); $header_label = "[edit graph: " . db_fetch_cell("select name from graph_templates where id=" . $_GET["id"]) . "]"; if (read_config_option("full_view_graph_template") == "") { start_box("Graph Template Management $header_label", "98%", $colors["header"], "3", "center", ""); draw_graph_form_select("?action=item&id=" . $_GET["id"]); end_box(); } /* get a list of all graph item field names and populate an array for user display */ while (list($field_name, $field_array) = each($struct_graph_item)) { if ($field_array["type"] != "view") { $graph_template_items[$field_name] = $field_array["title"]; } } if (!empty($_GET["graph_template_input_id"])) { $graph_template_input = db_fetch_row("select * from graph_template_input where id=" . $_GET["graph_template_input_id"]); } start_box("Graph Item Input $header_label", "98%", $colors["header"], "3", "center", ""); ?> Name
Enter a name for this graph item input, make sure it is something you recognize. Description
Enter a description for this graph item input to describe what this input is used for. Field Type
How data is to be represented on the graph. Associated Graph Items
Select the graph items that you want to accept user input for. 0) { foreach ($item_list as $item) { if ($item["graph_template_input_id"] == "") { $old_value = ""; }else{ $old_value = "on"; } if ($graph_item_types{$item["graph_type_id"]} == "GPRINT") { $start_bold = ""; $end_bold = ""; }else{ $start_bold = ""; $end_bold = ""; } $name = "$start_bold Item #" . ($i+1) . ": " . $graph_item_types{$item["graph_type_id"]} . " (" . $consolidation_functions{$item["consolidation_function_id"]} . ")$end_bold"; form_base_checkbox("i_" . $item["graph_templates_item_id"], $old_value, $name,"",$_GET["id"],true); $i++; } }else{ print "No Items"; } ?> '" . db_fetch_cell("select name from graph_templates where id=" . $_GET["id"]) . "'? This is generally not a good idea if you have graphs attached to this template even though it should not affect any graphs.", getenv("HTTP_REFERER"), "graph_templates.php?action=template_remove&id=" . $_GET["id"]); include ('include/bottom_footer.php'); exit; } if ((read_config_option("remove_verification") == "") || (isset($_GET["confirm"]))) { db_execute("delete from graph_templates where id=" . $_GET["id"]); $graph_template_input = db_fetch_assoc("select id from graph_template_input where graph_template_id=" . $_GET["id"]); if (sizeof($graph_template_input) > 0) { foreach ($graph_template_input as $item) { db_execute("delete from graph_template_input_defs where graph_template_input_id=" . $item["id"]); } } db_execute("delete from graph_template_input where graph_template_id=" . $_GET["id"]); db_execute("delete from graph_templates_graph where graph_template_id=" . $_GET["id"] . " and local_graph_id=0"); db_execute("delete from graph_templates_item where graph_template_id=" . $_GET["id"] . " and local_graph_id=0"); /* "undo" any graph that is currently using this template */ db_execute("update graph_templates_graph set local_graph_template_graph_id=0,graph_template_id=0 where graph_template_id=" . $_GET["id"]); db_execute("update graph_templates_item set local_graph_template_item_id=0,graph_template_id=0 where graph_template_id=" . $_GET["id"]); } } function template_edit() { global $colors, $struct_graph, $image_types; draw_tabs(); if (read_config_option("full_view_graph_template") == "") { start_box("Graph Template Management [edit]", "98%", $colors["header"], "3", "center", ""); draw_graph_form_select("?action=template_edit&id=" . $_GET["id"]); end_box(); } if (!empty($_GET["id"])) { $template = db_fetch_row("select * from graph_templates where id=" . $_GET["id"]); $template_graph = db_fetch_row("select * from graph_templates_graph where graph_template_id=" . $_GET["id"] . " and local_graph_id=0"); $header_label = "[edit: " . $template["name"] . "]"; }else{ $header_label = "[new]"; } if ((read_config_option("full_view_graph_template") == "on") && (!empty($_GET["id"]))) { item(); } start_box("Template $header_label", "98%", $colors["header"], "3", "center", ""); ?> Name
The name given to this graph template. Graph Template", "98%", $colors["header"], "3", "center", ""); $i = 0; while (list($field_name, $field_array) = each($struct_graph)) { form_alternate_row_color($colors["form_alternate1"],$colors["form_alternate2"],$i); $i++; print "" . $field_array["title"] . "
\n"; form_base_checkbox("t_" . $field_name,(isset($template_graph) ? $template_graph{"t_" . $field_name} : ""),"Use Per-Graph Value (Ignore this Value)","",(isset($template_graph) ? $template_graph["graph_template_id"] : "0"),false); print "\n"; draw_nontemplated_item($field_array, $field_name, (isset($template_graph) ? $template_graph[$field_name] : "")); print "\n"; } end_box(); form_hidden_id("graph_template_id",(isset($template_graph) ? $template_graph["graph_template_id"] : "0")); form_hidden_id("graph_template_graph_id",(isset($template_graph) ? $template_graph["id"] : "0")); form_hidden_box("save_component_template","1",""); form_save_button("graph_templates.php"); } function template() { global $colors; draw_tabs(); start_box("Graph Template Management", "98%", $colors["header"], "3", "center", "graph_templates.php?action=template_edit"); print ""; DrawMatrixHeaderItem("Template Title",$colors["panel_text"],2); print ""; $template_list = db_fetch_assoc("select graph_templates.id,graph_templates.name from graph_templates"); $i = 0; if (sizeof($template_list) > 0) { foreach ($template_list as $template) { form_alternate_row_color($colors["alternate"],$colors["light"],$i); ?> "> ">Delete