0) { $db_type = TREE_ITEM_TYPE_GRAPH; } if ($tree_item["title"] != "") { $db_type = TREE_ITEM_TYPE_HEADER; } if ($tree_item["host_id"] > 0) { $db_type = TREE_ITEM_TYPE_HOST; } } if (isset($_GET["type_select"])) { $current_type = $_GET["type_select"]; }elseif (isset($db_type)) { $current_type = $db_type; }else{ $current_type = TREE_ITEM_TYPE_HEADER; } $tree_sort_type = db_fetch_cell("select sort_type from graph_tree where id='" . $_GET["tree_id"] . "'"); print "
\n"; html_start_box("Tree Items", "100%", $colors["header"], "3", "center", ""); form_alternate_row_color($colors["form_alternate1"],$colors["form_alternate2"],0); ?> Parent Item
Choose the parent for this header/graph. Tree Item Type
Choose what type of tree item this is. Tree Item Value Title
If this item is a header, enter a title here. Sorting Type
Choose how children of this branch will be sorted. Propagate Changes
Propagate all options on this form (except for 'Title') to all child 'Header' items. Graph
Choose a graph from this list to add it to the tree. Round Robin Archive
Choose a round robin archive to control how the Graph Thumbnail is displayed when using Tree Export. Host
Choose a host here to add it to the tree. Graph Grouping Style
Choose how graphs are grouped when drawn for this particular host on the tree. Round Robin Archive
Choose a round robin archive to control how Graph Thumbnails are displayed when using Tree Export. 0) { branch_up($order_key, 'graph_tree_items', 'order_key', 'graph_tree_id=' . $_GET["tree_id"]); } /* clear graph tree cache on save - affects current user only, other users should see changes in <5 minutes */ if (isset($_SESSION['dhtml_tree'])) { unset($_SESSION['dhtml_tree']); } } function item_movedown() { /* ================= input validation ================= */ input_validate_input_number(get_request_var("id")); input_validate_input_number(get_request_var("tree_id")); /* ==================================================== */ $order_key = db_fetch_cell("SELECT order_key FROM graph_tree_items WHERE id=" . $_GET["id"]); if ($order_key > 0) { branch_down($order_key, 'graph_tree_items', 'order_key', 'graph_tree_id=' . $_GET["tree_id"]); } /* clear graph tree cache on save - affects current user only, other users should see changes in <5 minutes */ if (isset($_SESSION['dhtml_tree'])) { unset($_SESSION['dhtml_tree']); } } function item_remove() { /* ================= input validation ================= */ input_validate_input_number(get_request_var("id")); input_validate_input_number(get_request_var("tree_id")); /* ==================================================== */ if ((read_config_option("deletion_verification") == "on") && (!isset($_GET["confirm"]))) { $graph_tree_item = db_fetch_row("select title,local_graph_id,host_id from graph_tree_items where id=" . $_GET["id"]); if (!empty($graph_tree_item["local_graph_id"])) { $text = "Are you sure you want to delete the graph item '" . db_fetch_cell("select title_cache from graph_templates_graph where local_graph_id=" . $graph_tree_item["local_graph_id"]) . "'?"; }elseif ($graph_tree_item["title"] != "") { $text = "Are you sure you want to delete the header item '" . $graph_tree_item["title"] . "'?"; }elseif (!empty($graph_tree_item["host_id"])) { $text = "Are you sure you want to delete the host item '" . db_fetch_cell("select CONCAT_WS('',description,' (',hostname,')') as hostname from host where id=" . $graph_tree_item["host_id"]) . "'?"; } include("./include/top_header.php"); form_confirm("Are You Sure?", $text, htmlspecialchars("tree.php?action=edit&id=" . $_GET["tree_id"]), htmlspecialchars("tree.php?action=item_remove&id=" . $_GET["id"] . "&tree_id=" . $_GET["tree_id"])); include("./include/bottom_footer.php"); exit; } if ((read_config_option("deletion_verification") == "") || (isset($_GET["confirm"]))) { delete_branch($_GET["id"]); } /* clear graph tree cache on save - affects current user only, other users should see changes in <5 minutes */ if (isset($_SESSION['dhtml_tree'])) { unset($_SESSION['dhtml_tree']); } header("Location: tree.php?action=edit&id=" . $_GET["tree_id"]); exit; } /* --------------------- Tree Functions --------------------- */ function tree_remove() { /* ================= input validation ================= */ input_validate_input_number(get_request_var("id")); /* ==================================================== */ if ((read_config_option("deletion_verification") == "on") && (!isset($_GET["confirm"]))) { include("./include/top_header.php"); form_confirm("Are You Sure?", "Are you sure you want to delete the tree '" . db_fetch_cell("select name from graph_tree where id=" . $_GET["id"]) . "'?", htmlspecialchars("tree.php"), htmlspecialchars("tree.php?action=remove&id=" . $_GET["id"])); include("./include/bottom_footer.php"); exit; } if ((read_config_option("deletion_verification") == "") || (isset($_GET["confirm"]))) { db_execute("delete from graph_tree where id=" . $_GET["id"]); db_execute("delete from graph_tree_items where graph_tree_id=" . $_GET["id"]); } /* clear graph tree cache on save - affects current user only, other users should see changes in <5 minutes */ if (isset($_SESSION['dhtml_tree'])) { unset($_SESSION['dhtml_tree']); } } function tree_edit() { global $colors, $fields_tree_edit; /* ================= input validation ================= */ input_validate_input_number(get_request_var("id")); /* ==================================================== */ /* clean up subaction */ if (isset($_REQUEST["subaction"])) { $_REQUEST["subaction"] = sanitize_search_string(get_request_var("subaction")); } if (!empty($_GET["id"])) { $tree = db_fetch_row("select * from graph_tree where id=" . $_GET["id"]); $header_label = "[edit: " . $tree["name"] . "]"; }else{ $header_label = "[new]"; } html_start_box("Graph Trees $header_label", "100%", $colors["header"], "3", "center", ""); draw_edit_form(array( "config" => array(), "fields" => inject_form_variables($fields_tree_edit, (isset($tree) ? $tree : array())) )); html_end_box(); if (!empty($_GET["id"])) { html_start_box("Tree Items", "100%", $colors["header"], "3", "center", "tree.php?action=item_edit&tree_id=" . $tree["id"] . "&parent_id=0"); ?> "; DrawMatrixHeaderItem("Item",$colors["header_text"],1); DrawMatrixHeaderItem("Value",$colors["header_text"],1); DrawMatrixHeaderItem(" ",$colors["header_text"],2); print ""; grow_edit_graph_tree($_GET["id"], "", ""); html_end_box(); } form_save_button("tree.php", "return"); } function tree() { global $colors; html_start_box("Graph Trees", "100%", $colors["header"], "3", "center", "tree.php?action=edit"); print ""; DrawMatrixHeaderItem("Name",$colors["header_text"],1); DrawMatrixHeaderItem(" ",$colors["header_text"],1); print ""; $trees = db_fetch_assoc("SELECT * FROM graph_tree ORDER BY name"); $i = 0; if (sizeof($trees) > 0) { foreach ($trees as $tree) { form_alternate_row_color($colors["alternate"],$colors["light"],$i); $i++; ?> "> ">Delete No Graphs Trees\n"; } html_end_box(); } ?>