diff --git a/data_input.php b/data_input.php index 2c7aa6c3d8..2e69069fee 100644 --- a/data_input.php +++ b/data_input.php @@ -39,12 +39,14 @@ form_actions(); break; - case 'field_remove': - get_filter_request_var('data_input_id'); + case 'field_remove_confirm': + field_remove_confirm(); + break; + case 'field_remove': field_remove(); - header('Location: data_input.php?header=false&action=edit&id=' . get_request_var('data_input_id')); + header('Location: data_input.php?header=false&action=edit&id=' . get_filter_request_var('data_input_id')); break; case 'field_edit': top_header(); @@ -233,38 +235,79 @@ function form_actions() { CDEF Item Functions -------------------------- */ -function field_remove() { - global $registered_cacti_names; - +function field_remove_confirm() { /* ================= input validation ================= */ get_filter_request_var('id'); get_filter_request_var('data_input_id'); /* ==================================================== */ - if ((read_config_option('deletion_verification') == 'on') && (!isset_request_var('confirm'))) { - top_header(); + form_start('data_intput.php?action=edit&id' . get_request_var('data_input_id')); - form_confirm('Are You Sure?', "Are you sure you want to delete the field '" . htmlspecialchars(db_fetch_cell_prepared('SELECT name FROM data_input_fields WHERE id = ?', array(get_request_var('id'))), ENT_QUOTES) . "'?", htmlspecialchars('data_input.php?action=edit&id=' . get_request_var('data_input_id')), htmlspecialchars('data_input.php?action=field_remove&id=' . get_request_var('id') . '&data_input_id=' . get_request_var('data_input_id'))); + html_start_box('', '100%', '', '3', 'center', ''); - bottom_footer(); - exit; - } + $field = db_fetch_row_prepared('SELECT * FROM data_input_fields WHERE id = ?', array(get_request_var('id'))); - if ((read_config_option('deletion_verification') == '') || (isset_request_var('confirm'))) { - /* get information about the field we're going to delete so we can re-order the seqs */ - $field = db_fetch_row_prepared('SELECT input_output,data_input_id FROM data_input_fields WHERE id = ?', array(get_request_var('id'))); + ?> + + +

Click 'Continue' to delete the following Data Input Field.

+

Field Name: ''
+

Friendly Name: ''
+ + + + + + + + + /', db_fetch_cell_prepared('SELECT input_string FROM data_input WHERE id = ?', array($field['data_input_id'])), $matches))) { - $j = 0; - for ($i=0; ($i < count($matches[1])); $i++) { - if (in_array($matches[1][$i], $registered_cacti_names) == false) { - $j++; - db_execute_prepared("UPDATE data_input_fields SET sequence = ? WHERE data_input_id = ? AND input_output = 'in' AND data_name = ?", array($j, $field['data_input_id'], $matches[1][$i])); - } + form_end(); + + ?> + + /', db_fetch_cell_prepared('SELECT input_string FROM data_input WHERE id = ?', array($field['data_input_id'])), $matches))) { + $j = 0; + for ($i=0; ($i < count($matches[1])); $i++) { + if (in_array($matches[1][$i], $registered_cacti_names) == false) { + $j++; + db_execute_prepared("UPDATE data_input_fields SET sequence = ? WHERE data_input_id = ? AND input_output = 'in' AND data_name = ?", array($j, $field['data_input_id'], $matches[1][$i])); } } } @@ -418,7 +461,7 @@ function data_edit() { - ' title='Delete'> + ' title='Delete'> - ' title='Delete'> + ' title='Delete'> + +