Example #1
0
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("<strong>Graph Trees</strong> $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("<strong>Tree Items</strong>", "100%", $colors["header"], "3", "center", "tree.php?action=item_edit&tree_id=" . $tree["id"] . "&parent_id=0");

		?>
		<td>
		<a href='tree.php?action=edit&id=<?php print $_GET["id"];?>&subaction=expand_all'><img src='images/button_expand_all.gif' border='0' alt='Expand All'></a>
		<a href='tree.php?action=edit&id=<?php print $_GET["id"];?>&subaction=colapse_all'><img src='images/button_colapse_all.gif' border='0' alt='Colapse All'></a>
		</td>
		<?php

		print "<tr bgcolor='#" . $colors["header_panel"] . "'>";
			DrawMatrixHeaderItem("Item",$colors["header_text"],1);
			DrawMatrixHeaderItem("Value",$colors["header_text"],1);
			DrawMatrixHeaderItem("&nbsp;",$colors["header_text"],2);
		print "</tr>";

		grow_edit_graph_tree($_GET["id"], "", "");
		html_end_box();
	}

	form_save_button("tree.php");
}
Example #2
0
function tree_edit() {
	global $colors, $fields_tree_edit;

	/* ================= input validation ================= */
	input_validate_input_number(get_request_var("id"));
	/* ==================================================== */

	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("<strong>Graph Trees</strong> $header_label", "98%", $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("<strong>Tree Items</strong>", "98%", $colors["header"], "3", "center", "tree.php?action=item_edit&tree_id=" . $tree["id"] . "&parent_id=0");

		print "<tr bgcolor='#" . $colors["header_panel"] . "'>";
			DrawMatrixHeaderItem("Item",$colors["header_text"],1);
			DrawMatrixHeaderItem("Value",$colors["header_text"],1);
			DrawMatrixHeaderItem("&nbsp;",$colors["header_text"],2);
		print "</tr>";

		grow_edit_graph_tree($_GET["id"], "", "");
		html_end_box();
	}

	form_save_button("tree.php");
}
Example #3
0
function tree_edit()
{
    global $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: " . htmlspecialchars($tree["name"]) . "]";
    } else {
        $header_label = "[new]";
    }
    html_start_box("<strong>Graph Trees</strong> {$header_label}", "100%", "", "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("<strong>Tree Items</strong>", "100%", "", "3", "center", "tree.php?action=item_edit&tree_id=" . htmlspecialchars($tree["id"]) . "&parent_id=0");
        ?>
		<tr class='tableHeader'>
		<td colspan='4' class='tableSubHeaderColumn'>
		<input type='button' onClick='return document.location="tree.php?action=edit&id=<?php 
        print htmlspecialchars(get_request_var("id"));
        ?>
&subaction=expand_all"' value='Expand All' title='Expand All Trees'>
		<input type='button' onClick='return document.location="tree.php?action=edit&id=<?php 
        print htmlspecialchars(get_request_var("id"));
        ?>
&subaction=collapse_all"' value='Collapse All' title='Collapse All Trees'></a>
		</td>
		</tr>
		<?php 
        print "<tr class='tableHeader'>";
        DrawMatrixHeaderItem("Item", "", 1);
        DrawMatrixHeaderItem("Value", "", 1);
        DrawMatrixHeaderItem("&nbsp;", "", 2);
        print "</tr>";
        grow_edit_graph_tree($_GET["id"], "", "");
        html_end_box();
    }
    form_save_button("tree.php", "return");
}
Example #4
0
function tree_edit() {
	global $colors;
	require_once(CACTI_BASE_PATH . "/lib/graph_tree/graph_tree_info.php");

	/* ================= 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]");
	}

	print "<form method='post' action='" .  basename($_SERVER["PHP_SELF"]) . "' name='tree_edit'>\n";
	html_start_box("<strong>" . __("Graph Trees") . "</strong> $header_label", "100", $colors["header"], "3", "center", "", true);
	$header_items = array(__("Field"), __("Value"));
	print "<tr><td>";
	html_header($header_items, 1, true, 'template');

	draw_edit_form(array(
		"config" => array(),
		"fields" => inject_form_variables(graph_tree_form_list(), (isset($tree) ? $tree : array()))
		));

	print "</table></td></tr>";		/* end of html_header */
	html_end_box(FALSE);

	if (!empty($_GET["id"])) {
		/* setup the tree div's */
		echo "<div id='tree' style='float:left;width:50%;'>";
		html_start_box("<strong>" . __("Tree Items") . "</strong>", "100", $colors["header"], "3", "center", "");
		$header_items = array(__("Item"), __("Value"));
		print "<tr><td>";
		html_header($header_items, 3, true, 'tree');
		grow_edit_graph_tree(get_request_var("id"), "", "");
		print "</table></td></tr>";		/* end of html_header */
		html_end_box();
		echo "</div>";

		/* setup the graph items div */
		echo "<div id='items' style='float:right;width:50%';>";
		html_start_box("<strong>" . __("Item Filter") . "</strong>", "100", $colors["header"], "3", "center", "");
		$header_items = array(__("Item"), __("Value"));
		print "<tr><td>";
		html_header($header_items, 3, true, 'tree');
		print "</table></td></tr>";		/* end of html_header */
		html_end_box();
		echo "</div>";
	}

	form_save_button_alt("path!tree.php");
}
Example #5
0
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"));
    }
    /* modify for multi user start */
    $public_tree = FALSE;
    if ($_SESSION["permission"] < ACCESS_ADMINISTRATOR) {
        if ($_GET["id"] == $_SESSION["public_tree_id"]) {
            $public_tree = TRUE;
            $fields_tree_edit["sort_type"]["method"] = "hidden";
        } else {
            $_GET["id"] = $_SESSION["private_tree_id"];
        }
        $tree = db_fetch_row("select * from graph_tree where id=" . $_GET["id"]);
        $header_label = "[edit: " . htmlspecialchars($tree["name"]) . "]";
        $fields_tree_edit["name"]["method"] = "";
    } else {
        if (!empty($_GET["id"])) {
            $tree = db_fetch_row("select * from graph_tree where id=" . $_GET["id"]);
            $header_label = "[edit: " . htmlspecialchars($tree["name"]) . "]";
        } else {
            $header_label = "[new]";
        }
    }
    /* modify for multi user end */
    html_start_box("<strong>Graph Trees</strong> {$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"])) {
        /* modify for multi user start */
        if (check_resource_count(RESOURCE_GRAPH, TRUE) == TRUE && $_GET["id"] == $_SESSION["private_tree_id"] || $_SESSION["permission"] == ACCESS_ADMINISTRATOR) {
            html_start_box("<strong>Tree Items</strong>", "100%", $colors["header"], "3", "center", "tree.php?action=item_edit&tree_id=" . htmlspecialchars($tree["id"]) . "&parent_id=0");
        } else {
            html_start_box("<strong>Tree Items</strong>", "100%", $colors["header"], "3", "center", "");
        }
        /* modify for multi user end */
        ?>
		<td>
		<input type='button' onClick='return document.location="tree.php?action=edit&id=<?php 
        print htmlspecialchars(get_request_var("id"));
        ?>
&subaction=expand_all"' value='Expand All' title='Expand All Trees'>
		<input type='button' onClick='return document.location="tree.php?action=edit&id=<?php 
        print htmlspecialchars(get_request_var("id"));
        ?>
&subaction=collapse_all"' value='Collapse All' title='Collapse All Trees'></a>
		</td>
		<?php 
        print "<tr bgcolor='#" . $colors["header_panel"] . "'>";
        DrawMatrixHeaderItem("Item", $colors["header_text"], 1);
        DrawMatrixHeaderItem("Value", $colors["header_text"], 1);
        DrawMatrixHeaderItem("&nbsp;", $colors["header_text"], 2);
        print "</tr>";
        grow_edit_graph_tree($_GET["id"], "", "");
        html_end_box();
    }
    /* modify for multi user start */
    if ($_SESSION["permission"] == ACCESS_ADMINISTRATOR || $public_tree == FALSE) {
        form_save_button("tree.php", "return");
    }
    /* modify for multi user end */
}