function item_movedown() { /* ================= input validation ================= */ input_validate_input_number(get_request_var("id")); input_validate_input_number(get_request_var("graph_template_id")); /* ==================================================== */ global $graph_item_types; $arr = get_graph_group($_GET["id"]); $next_id = get_graph_parent($_GET["id"], "next"); if ((!empty($next_id)) && (isset($arr{$_GET["id"]}))) { move_graph_group($_GET["id"], $arr, $next_id, "next"); }elseif (ereg("(GPRINT|VRULE|HRULE|COMMENT)", $graph_item_types{db_fetch_cell("select graph_type_id from graph_templates_item where id=" . $_GET["id"])})) { /* this is so we know the "other" graph item to propagate the changes to */ $next_item = get_item("graph_templates_item", "sequence", $_GET["id"], "graph_template_id=" . $_GET["graph_template_id"] . " and local_graph_id=0", "next"); move_item_down("graph_templates_item", $_GET["id"], "graph_template_id=" . $_GET["graph_template_id"] . " and local_graph_id=0"); db_execute("update graph_templates_item set sequence=" . db_fetch_cell("select sequence from graph_templates_item where id=" . $_GET["id"]) . " where local_graph_template_item_id=" . $_GET["id"]); db_execute("update graph_templates_item set sequence=" . db_fetch_cell("select sequence from graph_templates_item where id=" . $next_item). " where local_graph_template_item_id=" . $next_item); } }
function data_query_item_movedown_dssv() { /* ================= input validation ================= */ input_validate_input_number(get_request_var("id")); input_validate_input_number(get_request_var("data_template_id")); input_validate_input_number(get_request_var("snmp_query_graph_id")); /* ==================================================== */ move_item_down("snmp_query_graph_rrd_sv", $_GET["id"], "data_template_id=" . $_GET["data_template_id"] . " and snmp_query_graph_id=" . $_GET["snmp_query_graph_id"] . " and field_name='" . $_GET["field_name"] . "'"); }
function data_query_item_movedown_dssv() { move_item_down("snmp_query_graph_rrd_sv", $_GET["id"], "data_template_id=" . $_GET["data_template_id"] . " and snmp_query_graph_id=" . $_GET["snmp_query_graph_id"] . " and field_name='" . $_GET["field_name"] . "'"); }
function mactrack_snmp_item_movedown() { /* ================= input validation ================= */ get_filter_request_var('item_id'); get_filter_request_var('id'); /* ==================================================== */ move_item_down('mac_track_snmp_items', get_request_var('item_id'), 'snmp_id=' . get_request_var('id')); }
function item_movedown() { /* ================= input validation ================= */ input_validate_input_number(get_request_var("id")); input_validate_input_number(get_request_var("cdef_id")); /* ==================================================== */ move_item_down("cdef_items", $_GET["id"], "cdef_id=" . $_GET["cdef_id"]); }
function reports_item_movedown() { /* ================= input validation ================= */ input_validate_input_number(get_request_var_request('item_id')); input_validate_input_number(get_request_var_request('id')); /* ==================================================== */ move_item_down('reports_items', get_request_var_request('item_id'), 'report_id=' . get_request_var_request('id')); }
function item_movedown() { global $graph_item_types; /* ================= input validation ================= */ input_validate_input_number(get_request_var_request('id')); input_validate_input_number(get_request_var_request('local_graph_id')); /* ==================================================== */ $arr = get_graph_group($_REQUEST['id']); $next_id = get_graph_parent($_REQUEST['id'], 'next'); if (!empty($next_id) && isset($arr[$_REQUEST['id']])) { move_graph_group($_REQUEST['id'], $arr, $next_id, 'next'); } elseif (preg_match('/(GPRINT|VRULE|HRULE|COMMENT)/', $graph_item_types[db_fetch_cell_prepared('SELECT graph_type_id FROM graph_templates_item WHERE id = ?', array(get_request_var_request('id')))])) { move_item_down('graph_templates_item', $_REQUEST['id'], 'local_graph_id=' . $_REQUEST['local_graph_id']); } }
function move_graph_group($graph_template_item_id, $graph_group_array, $target_id, $direction) { $graph_item = db_fetch_row_prepared('SELECT local_graph_id, graph_template_id FROM graph_templates_item WHERE id = ?', array($graph_template_item_id)); if (empty($graph_item['local_graph_id'])) { $sql_where = 'graph_template_id = ' . $graph_item['graph_template_id'] . ' AND local_graph_id = 0'; } else { $sql_where = 'local_graph_id = ' . $graph_item['local_graph_id']; } $graph_items = db_fetch_assoc_prepared("SELECT id, sequence FROM graph_templates_item WHERE {$sql_where} ORDER BY sequence"); /* get a list of parent+children of our target group */ $target_graph_group_array = get_graph_group($target_id); /* if this "parent" item has no children, then treat it like a regular gprint */ if (sizeof($target_graph_group_array) == 0) { if ($direction == 'next') { move_item_down('graph_templates_item', $graph_template_item_id, $sql_where); } elseif ($direction == 'previous') { move_item_up('graph_templates_item', $graph_template_item_id, $sql_where); } return; } /* start the sequence at '1' */ $sequence_counter = 1; if (sizeof($graph_items) > 0) { foreach ($graph_items as $item) { /* check to see if we are at the "target" spot in the loop; if we are, update the sequences and move on */ if ($target_id == $item['id']) { if ($direction == 'next') { $group_array1 = $target_graph_group_array; $group_array2 = $graph_group_array; } elseif ($direction == 'previous') { $group_array1 = $graph_group_array; $group_array2 = $target_graph_group_array; } while (list($sequence, $graph_template_item_id) = each($group_array1)) { db_execute_prepared('UPDATE graph_templates_item SET sequence = ? WHERE id = ?', array($sequence_counter, $graph_template_item_id)); /* propagate to ALL graphs using this template */ if (empty($graph_item['local_graph_id'])) { db_execute_prepared('UPDATE graph_templates_item SET sequence = ? WHERE local_graph_template_item_id = ?', array($sequence_counter, $graph_template_item_id)); } $sequence_counter++; } while (list($sequence, $graph_template_item_id) = each($group_array2)) { db_execute_prepared('UPDATE graph_templates_item SET sequence = ? WHERE id = ?', array($sequence_counter, $graph_template_item_id)); /* propagate to ALL graphs using this template */ if (empty($graph_item['local_graph_id'])) { db_execute_prepared('UPDATE graph_templates_item SET sequence = ? WHERE local_graph_template_item_id = ?', array($sequence_counter, $graph_template_item_id)); } $sequence_counter++; } } /* make sure to "ignore" the items that we handled above */ if (!isset($graph_group_array[$item['id']]) && !isset($target_graph_group_array[$item['id']])) { db_execute_prepared('UPDATE graph_templates_item SET sequence = ? WHERE id = ?', array($sequence_counter, $item['id'])); $sequence_counter++; } } } }
function data_query_item_movedown_dssv() { /* ================= input validation ================= */ input_validate_input_number(get_request_var_request('id')); input_validate_input_number(get_request_var_request('data_template_id')); input_validate_input_number(get_request_var_request('snmp_query_graph_id')); /* ==================================================== */ move_item_down('snmp_query_graph_rrd_sv', $_REQUEST['id'], 'data_template_id=' . $_REQUEST['data_template_id'] . ' AND snmp_query_graph_id=' . $_REQUEST['snmp_query_graph_id'] . " AND field_name='" . $_REQUEST['field_name'] . "'"); }
function item_movedown() { require(CACTI_BASE_PATH . "/include/graph/graph_arrays.php"); /* ================= input validation ================= */ input_validate_input_number(get_request_var("id")); input_validate_input_number(get_request_var("local_graph_id")); /* ==================================================== */ $arr = get_graph_group($_GET["id"]); $next_id = get_graph_parent($_GET["id"], "next"); $graph_type_id = db_fetch_cell("select graph_type_id from graph_templates_item where id=" . $_GET["id"]); if ((!empty($next_id)) && (isset($arr{$_GET["id"]}))) { move_graph_group(get_request_var("id"), $arr, $next_id, "next"); }elseif ($graph_type_id == GRAPH_ITEM_TYPE_GPRINT_AVERAGE || $graph_type_id == GRAPH_ITEM_TYPE_GPRINT_LAST || $graph_type_id == GRAPH_ITEM_TYPE_GPRINT_MAX || $graph_type_id == GRAPH_ITEM_TYPE_GPRINT_MIN || $graph_type_id == GRAPH_ITEM_TYPE_HRULE || $graph_type_id == GRAPH_ITEM_TYPE_VRULE || $graph_type_id == GRAPH_ITEM_TYPE_COMMENT) { move_item_down("graph_templates_item", $_GET["id"], "local_graph_id=" . $_GET["local_graph_id"]); } }
function item_movedown() { move_item_down("cdef_items", $_GET["id"], "cdef_id=" . $_GET["cdef_id"]); }
function mactrack_snmp_item_movedown() { /* ================= input validation ================= */ input_validate_input_number(get_request_var("item_id")); input_validate_input_number(get_request_var("id")); /* ==================================================== */ move_item_down("mac_track_snmp_items", get_request_var("item_id"), "snmp_id=" . get_request_var("id")); }
function item_movedown() { require(CACTI_BASE_PATH . "/include/graph/graph_arrays.php"); /* ================= input validation ================= */ input_validate_input_number(get_request_var("id")); input_validate_input_number(get_request_var("graph_template_id")); /* ==================================================== */ $arr = get_graph_group(get_request_var("id")); $next_id = get_graph_parent(get_request_var("id"), "next"); $graph_type_id = db_fetch_cell("select graph_type_id from graph_templates_item where id=" . get_request_var("id")); if ((!empty($next_id)) && (isset($arr{$_GET["id"]}))) { move_graph_group(get_request_var("id"), $arr, $next_id, "next"); }elseif ($graph_type_id == GRAPH_ITEM_TYPE_GPRINT_AVERAGE || $graph_type_id == GRAPH_ITEM_TYPE_GPRINT_LAST || $graph_type_id == GRAPH_ITEM_TYPE_GPRINT_MAX || $graph_type_id == GRAPH_ITEM_TYPE_GPRINT_MIN || $graph_type_id == GRAPH_ITEM_TYPE_HRULE || $graph_type_id == GRAPH_ITEM_TYPE_VRULE || $graph_type_id == GRAPH_ITEM_TYPE_COMMENT) { /* this is so we know the "other" graph item to propagate the changes to */ $next_item = get_item("graph_templates_item", "sequence", get_request_var("id"), "graph_template_id=" . get_request_var("graph_template_id") . " and local_graph_id=0", "next"); move_item_down("graph_templates_item", get_request_var("id"), "graph_template_id=" . get_request_var("graph_template_id") . " and local_graph_id=0"); db_execute("update graph_templates_item set sequence=" . db_fetch_cell("select sequence from graph_templates_item where id=" . get_request_var("id")) . " where local_graph_template_item_id=" . get_request_var("id")); db_execute("update graph_templates_item set sequence=" . db_fetch_cell("select sequence from graph_templates_item where id=" . $next_item). " where local_graph_template_item_id=" . $next_item); } }
function item_movedown() { /* ================= input validation ================= */ input_validate_input_number(get_request_var_request('id')); input_validate_input_number(get_request_var_request('cdef_id')); /* ==================================================== */ move_item_down('cdef_items', $_REQUEST['id'], 'cdef_id=' . $_REQUEST['cdef_id']); }
function item_movedown() { global $graph_item_types; $arr = get_graph_group($_GET["id"]); $next_id = get_graph_parent($_GET["id"], "next"); if ((!empty($next_id)) && (isset($arr{$_GET["id"]}))) { move_graph_group($_GET["id"], $arr, $next_id, "next"); }elseif (ereg("(GPRINT|VRULE|HRULE|COMMENT)", $graph_item_types{db_fetch_cell("select graph_type_id from graph_templates_item where id=" . $_GET["id"])})) { move_item_down("graph_templates_item", $_GET["id"], "local_graph_id=" . $_GET["local_graph_id"]); } }
function item_movedown() { global $graph_item_types; /* ================= input validation ================= */ input_validate_input_number(get_request_var("id")); input_validate_input_number(get_request_var("local_graph_id")); /* ==================================================== */ $arr = get_graph_group($_GET["id"]); $next_id = get_graph_parent($_GET["id"], "next"); if (!empty($next_id) && isset($arr[$_GET["id"]])) { move_graph_group($_GET["id"], $arr, $next_id, "next"); } elseif (preg_match("/(GPRINT|VRULE|HRULE|COMMENT)/", $graph_item_types[db_fetch_cell("select graph_type_id from graph_templates_item where id=" . $_GET["id"])])) { move_item_down("graph_templates_item", $_GET["id"], "local_graph_id=" . $_GET["local_graph_id"]); } }
function move_graph_group($graph_template_item_id, $graph_group_array, $target_id, $direction) { $graph_item = db_fetch_row("select local_graph_id,graph_template_id from graph_templates_item where id=$graph_template_item_id"); if (empty($graph_item["local_graph_id"])) { $sql_where = "graph_template_id = " . $graph_item["graph_template_id"] . " and local_graph_id=0"; }else{ $sql_where = "local_graph_id = " . $graph_item["local_graph_id"]; } $graph_items = db_fetch_assoc("select id,sequence from graph_templates_item where $sql_where order by sequence"); /* get a list of parent+children of our target group */ $target_graph_group_array = get_graph_group($target_id); /* if this "parent" item has no children, then treat it like a regular gprint */ if (sizeof($target_graph_group_array) == 0) { if ($direction == "next") { move_item_down("graph_templates_item", $graph_template_item_id, $sql_where); }elseif ($direction == "previous") { move_item_up("graph_templates_item", $graph_template_item_id, $sql_where); } return; } /* start the sequence at '1' */ $sequence_counter = 1; if (sizeof($graph_items) > 0) { foreach ($graph_items as $item) { /* check to see if we are at the "target" spot in the loop; if we are, update the sequences and move on */ if ($target_id == $item["id"]) { if ($direction == "next") { $group_array1 = $target_graph_group_array; $group_array2 = $graph_group_array; }elseif ($direction == "previous") { $group_array1 = $graph_group_array; $group_array2 = $target_graph_group_array; } while (list($sequence,$graph_template_item_id) = each($group_array1)) { db_execute("update graph_templates_item set sequence=$sequence_counter where id=$graph_template_item_id"); /* propagate to ALL graphs using this template */ if (empty($graph_item["local_graph_id"])) { db_execute("update graph_templates_item set sequence=$sequence_counter where local_graph_template_item_id=$graph_template_item_id"); } $sequence_counter++; } while (list($sequence,$graph_template_item_id) = each($group_array2)) { db_execute("update graph_templates_item set sequence=$sequence_counter where id=$graph_template_item_id"); /* propagate to ALL graphs using this template */ if (empty($graph_item["local_graph_id"])) { db_execute("update graph_templates_item set sequence=$sequence_counter where local_graph_template_item_id=$graph_template_item_id"); } $sequence_counter++; } } /* make sure to "ignore" the items that we handled above */ if ((!isset($graph_group_array{$item["id"]})) && (!isset($target_graph_group_array{$item["id"]}))) { db_execute("update graph_templates_item set sequence=$sequence_counter where id=" . $item["id"]); $sequence_counter++; } } } }
function item_movedown() { /* ================= input validation ================= */ input_validate_input_number(get_request_var_request('id')); input_validate_input_number(get_request_var_request('graph_template_id')); /* ==================================================== */ global $graph_item_types; $arr = get_graph_group($_REQUEST['id']); $next_id = get_graph_parent($_REQUEST['id'], 'next'); if (!empty($next_id) && isset($arr[$_REQUEST['id']])) { move_graph_group($_REQUEST['id'], $arr, $next_id, 'next'); } elseif (preg_match('/(GPRINT|VRULE|HRULE|COMMENT)/', $graph_item_types[db_fetch_cell_prepared('SELECT graph_type_id FROM graph_templates_item WHERE id = ?', array($_REQUEST['id']))])) { /* this is so we know the "other" graph item to propagate the changes to */ $next_item = get_item('graph_templates_item', 'sequence', $_REQUEST['id'], 'graph_template_id=' . $_REQUEST['graph_template_id'] . ' and local_graph_id=0', 'next'); move_item_down('graph_templates_item', $_REQUEST['id'], 'graph_template_id=' . $_REQUEST['graph_template_id'] . ' AND local_graph_id=0'); db_execute_prepared('UPDATE graph_templates_item SET sequence = ' . db_fetch_cell_prepared('SELECT sequence FROM graph_templates_item WHERE id = ?', array($_REQUEST['id'])) . ' WHERE local_graph_template_item_id = ?', array($_REQUEST['id'])); db_execute_prepared('UPDATE graph_templates_item SET sequence = ' . db_fetch_cell_prepared('SELECT sequence FROM graph_templates_item WHERE id = ?', array($next_item)) . ' WHERE local_graph_template_item_id = ?', array($next_item)); } }