0 and local_graph_template_item_id=" . $_POST["any_selected_item"]); if (sizeof($graphs) > 0) { foreach ($graphs as $graph) { $graph_input_values{$graph["local_graph_id"]} = $graph{$save["column_name"]}; } } } if ($graph_template_input_id) { raise_message(1); db_execute("delete from graph_template_input_defs where graph_template_input_id=$graph_template_input_id"); if (sizeof($selected_graph_items) > 0) { foreach ($selected_graph_items as $graph_template_item_id) { db_execute("insert into graph_template_input_defs (graph_template_input_id,graph_template_item_id) values ($graph_template_input_id,$graph_template_item_id)"); } } /* loop through each graph attached to this graph template and re-apply the current value for this input */ if (sizeof($graph_input_values) > 0) { while (list($local_graph_id, $value) = each($graph_input_values)) { db_execute("update graph_templates_item set " . $save["column_name"] . "='$value' where local_graph_id=$local_graph_id and " . array_to_sql_or($selected_graph_items, "local_graph_template_item_id")); } } }else{ raise_message(2); } } if (is_error_message()) { header("Location: graph_templates_inputs.php?action=input_edit&graph_template_input_id=" . (empty($graph_template_input_id) ? $_POST["graph_template_input_id"] : $graph_template_input_id) . "&graph_template_id=" . $_POST["graph_template_id"]); exit; }else{ header("Location: graph_templates.php?action=template_edit&id=" . $_POST["graph_template_id"]); exit; } } } /* ------------------------------------ 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["id"]) . "'? NOTE: Deleting this item will NOT affect graphs that use this template.", $_SERVER["HTTP_REFERER"], "graph_templates_inputs.php?action=input_remove&id=" . $_GET["id"] . "&graph_template_id=" . $_GET["graph_template_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["id"]); db_execute("delete from graph_template_input_defs where graph_template_input_id=" . $_GET["id"]); } } function input_edit() { global $colors, $consolidation_functions, $graph_item_types, $struct_graph_item, $fields_graph_template_input_edit; $header_label = "[edit graph: " . db_fetch_cell("select name from graph_templates where id=" . $_GET["graph_template_id"]) . "]"; /* 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["method"] != "view") { $graph_template_items[$field_name] = $field_array["friendly_name"]; } } if (!empty($_GET["id"])) { $graph_template_input = db_fetch_row("select * from graph_template_input where id=" . $_GET["id"]); } start_box("Graph Item Inputs $header_label", "98%", $colors["header"], "3", "center", ""); draw_edit_form(array( "config" => array(), "fields" => inject_form_variables($fields_graph_template_input_edit, (isset($graph_template_input) ? $graph_template_input : array()), (isset($graph_template_items) ? $graph_template_items : array()), $_GET) )); if (!(isset($_GET["id"]))) { $_GET["id"] = 0; } $item_list = db_fetch_assoc("select CONCAT_WS(' - ',data_template_data.name,data_template_rrd.data_source_name) as data_source_name, graph_templates_item.text_format, graph_templates_item.id as graph_templates_item_id, graph_templates_item.graph_type_id, graph_templates_item.consolidation_function_id, graph_template_input_defs.graph_template_input_id from graph_templates_item left join graph_template_input_defs on (graph_template_input_defs.graph_template_item_id=graph_templates_item.id and graph_template_input_defs.graph_template_input_id=" . $_GET["id"] . ") left join data_template_rrd on graph_templates_item.task_item_id=data_template_rrd.id left join data_local on data_template_rrd.local_data_id=data_local.id left join data_template_data on data_local.id=data_template_data.local_data_id where graph_templates_item.local_graph_id=0 and graph_templates_item.graph_template_id=" . $_GET["graph_template_id"] . " order by graph_templates_item.sequence"); form_alternate_row_color($colors["form_alternate1"],$colors["form_alternate2"],1); ?>