0)) { while (list($item_id, $item_id) = each($new_members)) { push_out_graph_input($graph_template_input_id, $item_id, (isset($new_members) ? $new_members : array())); } } db_execute_prepared('DELETE FROM graph_template_input_defs WHERE graph_template_input_id = ?', array($graph_template_input_id)); if (sizeof($selected_graph_items) > 0) { foreach ($selected_graph_items as $graph_template_item_id) { db_execute_prepared('INSERT INTO graph_template_input_defs (graph_template_input_id, graph_template_item_id) VALUES (?, ?)', array($graph_template_input_id, $graph_template_item_id)); } } }else{ raise_message(2); } } if (is_error_message()) { header('Location: graph_templates_inputs.php?header=false&action=input_edit&graph_template_input_id=' . (empty($graph_template_input_id) ? get_nfilter_request_var('graph_template_input_id') : $graph_template_input_id) . '&graph_template_id=' . get_nfilter_request_var('graph_template_id')); exit; }else{ header('Location: graph_templates.php?header=false&action=template_edit&id=' . get_nfilter_request_var('graph_template_id')); exit; } } } /* ------------------------------------ input - Graph Template Item Inputs ------------------------------------ */ function input_remove() { /* ================= input validation ================= */ get_filter_request_var('id'); get_filter_request_var('graph_template_id'); /* ==================================================== */ if ((read_config_option('deletion_verification') == 'on') && (!isset_request_var('confirm'))) { top_header(); form_confirm(__('Are You Sure?'), __('Are you sure you want to delete the input item \'%s\'? NOTE: Deleting this item will NOT affect graphs that use this template.', htmlspecialchars(db_fetch_cell_prepared('SELECT name FROM graph_template_input WHERE id = ?', array(get_request_var('id'))), ENT_QUOTES)), htmlspecialchars('graph_templates.php?action=template_edit&id=' . get_request_var('graph_template_id')), htmlspecialchars('graph_templates_inputs.php?action=input_remove&id=' . get_request_var('id') . '&graph_template_id=' . get_request_var('graph_template_id'))); bottom_footer(); exit; } if ((read_config_option('deletion_verification') == '') || (isset_request_var('confirm'))) { db_execute_prepared('DELETE FROM graph_template_input WHERE id = ?', array(get_request_var('id'))); db_execute_prepared('DELETE FROM graph_template_input_defs WHERE graph_template_input_id = ?', array(get_request_var('id'))); } } function input_edit() { global $consolidation_functions, $graph_item_types, $struct_graph_item, $fields_graph_template_input_edit; /* ================= input validation ================= */ get_filter_request_var('id'); get_filter_request_var('graph_template_id'); /* ==================================================== */ $header_label = __('Graph Item Inputs [edit graph: %s]' . htmlspecialchars(db_fetch_cell_prepared('SELECT name FROM graph_templates WHERE id = ?', array(get_request_var('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 (!isempty_request_var('id')) { $graph_template_input = db_fetch_row_prepared('SELECT * FROM graph_template_input WHERE id = ?', array(get_request_var('id'))); } form_start('graph_templates_inputs.php'); html_start_box($header_label, '100%', '', '3', 'center', ''); draw_edit_form( array( 'config' => array('no_form_tag' => true), '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()), $_REQUEST) ) ); if (!isset_request_var('id')) { set_request_var('id', 0); } $item_list = db_fetch_assoc_prepared("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 = ?) 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 = ? ORDER BY graph_templates_item.sequence", array(get_request_var('id'), get_request_var('graph_template_id'))); form_alternate_row(); ?>