コード例 #1
0
ファイル: graphs.php プロジェクト: songchin/Cacti
function item() {
	global $colors, $consolidation_functions, $graph_item_types, $struct_graph_item;

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

	if (empty($_GET["id"])) {
		$template_item_list = array();

		$header_label = "[new]";
	}else{
		$template_item_list = db_fetch_assoc("select
			graph_templates_item.id,
			graph_templates_item.text_format,
			graph_templates_item.value,
			graph_templates_item.hard_return,
			graph_templates_item.graph_type_id,
			graph_templates_item.consolidation_function_id,
			data_template_rrd.data_source_name,
			cdef.name as cdef_name,
			colors.hex
			from graph_templates_item
			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)
			left join cdef on (cdef_id=cdef.id)
			left join colors on (color_id=colors.id)
			where graph_templates_item.local_graph_id=" . $_GET["id"] . "
			order by graph_templates_item.sequence");

		$host_id = db_fetch_cell("select host_id from graph_local where id=" . $_GET["id"]);
		$header_label = "[edit: " . get_graph_title($_GET["id"]) . "]";
	}

	$graph_template_id = db_fetch_cell("select graph_template_id from graph_local where id=" . $_GET["id"]);

	if (empty($graph_template_id)) {
		$add_text = "graphs_items.php?action=item_edit&local_graph_id=" . $_GET["id"] . "&host_id=$host_id";
	}else{
		$add_text = "";
	}

	html_start_box("<strong>Graph Items</strong> $header_label", "100%", $colors["header"], "3", "center", $add_text);
	draw_graph_items_list($template_item_list, "graphs_items.php", "local_graph_id=" . $_GET["id"], (empty($graph_template_id) ? false : true));
	html_end_box();
}
コード例 #2
0
ファイル: graph_templates.php プロジェクト: songchin/Cacti
function item()
{
    global $colors, $consolidation_functions, $graph_item_types;
    /* ================= input validation ================= */
    input_validate_input_number(get_request_var("id"));
    /* ==================================================== */
    if (empty($_GET["id"])) {
        $template_item_list = array();
        $header_label = "[new]";
    } else {
        $template_item_list = db_fetch_assoc("select\n\t\t\tgraph_templates_item.id,\n\t\t\tgraph_templates_item.text_format,\n\t\t\tgraph_templates_item.value,\n\t\t\tgraph_templates_item.hard_return,\n\t\t\tgraph_templates_item.graph_type_id,\n\t\t\tgraph_templates_item.consolidation_function_id,\n\t\t\tCONCAT_WS(' - ',data_template_data.name,data_template_rrd.data_source_name) as data_source_name,\n\t\t\tcdef.name as cdef_name,\n\t\t\tcolors.hex\n\t\t\tfrom graph_templates_item\n\t\t\tleft join data_template_rrd on (graph_templates_item.task_item_id=data_template_rrd.id)\n\t\t\tleft join data_local on (data_template_rrd.local_data_id=data_local.id)\n\t\t\tleft join data_template_data on (data_local.id=data_template_data.local_data_id)\n\t\t\tleft join cdef on (cdef_id=cdef.id)\n\t\t\tleft join colors on (color_id=colors.id)\n\t\t\twhere graph_templates_item.graph_template_id=" . $_GET["id"] . "\n\t\t\tand graph_templates_item.local_graph_id=0\n\t\t\torder by graph_templates_item.sequence");
        $header_label = "[edit: " . db_fetch_cell("select name from graph_templates where id=" . $_GET["id"]) . "]";
    }
    html_start_box("<strong>Graph Template Items</strong> {$header_label}", "100%", $colors["header"], "3", "center", "graph_templates_items.php?action=item_edit&graph_template_id=" . $_GET["id"]);
    draw_graph_items_list($template_item_list, "graph_templates_items.php", "graph_template_id=" . $_GET["id"], false);
    html_end_box();
    html_start_box("<strong>Graph Item Inputs</strong>", "100%", $colors["header"], "3", "center", "graph_templates_inputs.php?action=input_edit&graph_template_id=" . $_GET["id"]);
    print "<tr bgcolor='#" . $colors["header_panel"] . "'>";
    DrawMatrixHeaderItem("Name", $colors["header_text"], 2);
    print "</tr>";
    $template_item_list = db_fetch_assoc("select id,name from graph_template_input where graph_template_id=" . $_GET["id"] . " order by name");
    $i = 0;
    if (sizeof($template_item_list) > 0) {
        foreach ($template_item_list as $item) {
            form_alternate_row_color($colors["alternate"], $colors["light"], $i);
            ?>
			<td>
				<a class="linkEditMain" href="graph_templates_inputs.php?action=input_edit&id=<?php 
            print $item["id"];
            ?>
&graph_template_id=<?php 
            print $_GET["id"];
            ?>
"><?php 
            print $item["name"];
            ?>
</a>
			</td>
			<td align="right">
				<a href="graph_templates_inputs.php?action=input_remove&id=<?php 
            print $item["id"];
            ?>
&graph_template_id=<?php 
            print $_GET["id"];
            ?>
"><img src="images/delete_icon.gif" width="10" height="10" border="0" alt="Delete"></a>
			</td>
		</tr>
	<?php 
            $i++;
        }
    } else {
        print "<tr bgcolor='#" . $colors["form_alternate2"] . "'><td colspan='2'><em>No Inputs</em></td></tr>";
    }
    html_end_box();
}
コード例 #3
0
ファイル: graphs.php プロジェクト: MrWnn/cacti
function item()
{
    global $consolidation_functions, $graph_item_types, $struct_graph_item;
    /* ================= input validation ================= */
    input_validate_input_number(get_request_var_request('id'));
    /* ==================================================== */
    if (empty($_REQUEST['id'])) {
        $template_item_list = array();
        $header_label = '[new]';
    } else {
        $template_item_list = db_fetch_assoc_prepared('SELECT
			graph_templates_item.id,
			graph_templates_item.text_format,
			graph_templates_item.value,
			graph_templates_item.hard_return,
			graph_templates_item.graph_type_id,
			graph_templates_item.consolidation_function_id,
			data_template_rrd.data_source_name,
			cdef.name AS cdef_name,
			colors.hex
			FROM graph_templates_item
			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)
			LEFT JOIN cdef ON (cdef_id = cdef.id)
			LEFT JOIN colors ON (color_id = colors.id)
			WHERE graph_templates_item.local_graph_id = ?
			ORDER BY graph_templates_item.sequence', array($_REQUEST['id']));
        $host_id = db_fetch_cell_prepared('SELECT host_id FROM graph_local WHERE id = ?', array($_REQUEST['id']));
        $header_label = '[edit: ' . htmlspecialchars(get_graph_title($_REQUEST['id'])) . ']';
    }
    $graph_template_id = db_fetch_cell_prepared('SELECT graph_template_id FROM graph_local WHERE id = ?', array($_REQUEST['id']));
    if (empty($graph_template_id)) {
        $add_text = 'graphs_items.php?action=item_edit&local_graph_id=' . $_REQUEST['id'] . "&host_id={$host_id}";
    } else {
        $add_text = '';
    }
    html_start_box("<strong>Graph Items</strong> {$header_label}", '100%', '', '3', 'center', $add_text);
    draw_graph_items_list($template_item_list, 'graphs_items.php', 'local_graph_id=' . $_REQUEST['id'], empty($graph_template_id) ? false : true);
    html_end_box();
}
コード例 #4
0
ファイル: graph_templates.php プロジェクト: songchin/Cacti
function graph_template_display_items() {
	global $colors;
	require(CACTI_BASE_PATH . "/include/graph/graph_arrays.php");

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

	if (empty($_REQUEST["id"])) {
		$template_item_list = array();

		$header_label = __("[new]");
	}else{
		$template_item_list = db_fetch_assoc("select
			graph_templates_item.id,
			graph_templates_item.text_format,
			graph_templates_item.value,
			graph_templates_item.hard_return,
			graph_templates_item.graph_type_id,
			graph_templates_item.line_width,
			graph_templates_item.dashes,
			graph_templates_item.dash_offset,
			graph_templates_item.textalign,
			graph_templates_item.shift,
			graph_templates_item.consolidation_function_id,
			CONCAT_WS(' - ',data_template_data.name,data_template_rrd.data_source_name) as data_source_name,
			cdef.name as cdef_name,
			colors.hex,
			graph_templates_gprint.name as gprint_name
			from graph_templates_item
			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)
			left join cdef on (cdef_id=cdef.id)
			left join vdef on (vdef_id=vdef.id)
			left join colors on (color_id=colors.id)
			left join graph_templates_gprint on (gprint_id=graph_templates_gprint.id)
			where graph_templates_item.graph_template_id=" . $_REQUEST["id"] . "
			and graph_templates_item.local_graph_id=0
			order by graph_templates_item.sequence");

		$header_label = __("[edit: ") . db_fetch_cell("select name from graph_templates where id=" . $_REQUEST["id"]) . "]";
	}

	/* graph template item */
	html_start_box("<strong>" . __("Graph Template Items") . "</strong> $header_label", "100", $colors["header"], "0", "center", "graph_templates_items.php?action=item_edit&graph_template_id=" . $_REQUEST["id"], true);
	draw_graph_items_list($template_item_list, "graph_templates_items.php", "graph_template_id=" . $_REQUEST["id"], false);
	html_end_box(true);

	/* graph template inputs */
	html_start_box("<strong>" . __("Graph Item Inputs") . "</strong>", "100", $colors["header"], "3", "center", "graph_templates_inputs.php?action=input_edit&graph_template_id=" . $_REQUEST["id"], true);
	print "<tr><td>\n";
	html_header(array(__("Name")), 2,'','','left wp100');

	$template_item_list = db_fetch_assoc("select id,name from graph_template_input where graph_template_id=" . $_REQUEST["id"] . " order by name");

	if (sizeof($template_item_list) > 0) {
		foreach ($template_item_list as $item) {
			form_alternate_row_color("item" . $item["id"]);
			?>
<td><a class="linkEditMain"
	href='<?php print htmlspecialchars("graph_templates_inputs.php?action=input_edit&id=" . $item["id"] . "&graph_template_id=" . $_REQUEST["id"]);?>'><?php print $item["name"];?></a>
</td>
<td align="right"><a
	href='<?php print htmlspecialchars("graph_templates_inputs.php?action=input_remove&id=" . $item["id"] . "&graph_template_id=" . $_GET["id"]);?>'><img
	class="buttonSmall" src="images/delete_icon.gif"
	alt="<?php print __("Delete");?>" align='right'></a></td>
			<?php
			form_end_row();
		}
	}else{
		print "<tr class='rowAlternate1'><td colspan='2'><em>" . __("No Inputs") . "</em></td></tr>";
	}

	print "</table></td></tr>";
	html_end_box(true);

	form_save_button_alt("url!graph_templates.php");

	?>
<script type="text/javascript">
	<!--
	$(document).ready(function(){

		//drag and drop for graph items
		$('#graph_item').tableDnD({
			onDrop: function(table, row) {
//				alert($.tableDnD.serialize());
				$('#AjaxResult').load("lib/ajax/jquery.tablednd/graph_templates_item.ajax.php?id=<?php isset($_GET["id"]) ? print $_GET["id"] : print "";?>&"+$.tableDnD.serialize());
			}
		});

	});
	//-->

</script>
	<?php
}
コード例 #5
0
ファイル: graph_templates.php プロジェクト: MrWnn/cacti
function item()
{
    global $consolidation_functions, $graph_item_types;
    /* ================= input validation ================= */
    input_validate_input_number(get_request_var_request("id"));
    /* ==================================================== */
    if (empty($_REQUEST["id"])) {
        $template_item_list = array();
        $header_label = "[new]";
    } else {
        $template_item_list = db_fetch_assoc("SELECT\n\t\t\tgraph_templates_item.id,\n\t\t\tgraph_templates_item.text_format,\n\t\t\tgraph_templates_item.value,\n\t\t\tgraph_templates_item.hard_return,\n\t\t\tgraph_templates_item.graph_type_id,\n\t\t\tgraph_templates_item.consolidation_function_id,\n\t\t\tCONCAT_WS(' - ',data_template_data.name,data_template_rrd.data_source_name) AS data_source_name,\n\t\t\tcdef.name AS cdef_name,\n\t\t\tcolors.hex\n\t\t\tFROM graph_templates_item\n\t\t\tLEFT JOIN data_template_rrd ON (graph_templates_item.task_item_id=data_template_rrd.id)\n\t\t\tLEFT JOIN data_local ON (data_template_rrd.local_data_id=data_local.id)\n\t\t\tLEFT JOIN data_template_data ON (data_local.id=data_template_data.local_data_id)\n\t\t\tLEFT JOIN cdef ON (cdef_id=cdef.id)\n\t\t\tLEFT JOIN colors ON (color_id=colors.id)\n\t\t\tWHERE graph_templates_item.graph_template_id=" . $_REQUEST["id"] . "\n\t\t\tAND graph_templates_item.local_graph_id=0\n\t\t\tORDER BY graph_templates_item.sequence");
        $header_label = "[edit: " . db_fetch_cell("SELECT name FROM graph_templates WHERE id=" . $_REQUEST["id"]) . "]";
    }
    html_start_box("<strong>Graph Template Items</strong> " . htmlspecialchars($header_label), "100%", "", "3", "center", "graph_templates_items.php?action=item_edit&graph_template_id=" . htmlspecialchars(get_request_var_request("id")));
    draw_graph_items_list($template_item_list, "graph_templates_items.php", "graph_template_id=" . $_REQUEST["id"], false);
    html_end_box();
    html_start_box("<strong>Graph Item Inputs</strong>", "100%", "", "3", "center", "graph_templates_inputs.php?action=input_edit&graph_template_id=" . htmlspecialchars(get_request_var_request("id")));
    print "<tr class='tableHeader'>";
    DrawMatrixHeaderItem("Name", "", 2);
    print "</tr>";
    $template_item_list = db_fetch_assoc("SELECT id,name FROM graph_template_input WHERE graph_template_id=" . $_REQUEST["id"] . " ORDER BY name");
    $i = 0;
    if (sizeof($template_item_list) > 0) {
        foreach ($template_item_list as $item) {
            form_alternate_row('', true);
            ?>
			<td>
				<a class="linkEditMain" href="<?php 
            print htmlspecialchars("graph_templates_inputs.php?action=input_edit&id=" . $item["id"] . "&graph_template_id=" . $_REQUEST["id"]);
            ?>
"><?php 
            print htmlspecialchars($item["name"]);
            ?>
</a>
			</td>
			<td align="right">
				<a href="<?php 
            print htmlspecialchars("graph_templates_inputs.php?action=input_remove&id=" . $item["id"] . "&graph_template_id=" . $_REQUEST["id"]);
            ?>
"><img src="images/delete_icon.gif" style="height:10px;width:10px;" border="0" alt="Delete"></a>
			</td>
		</tr>
		<?php 
        }
    } else {
        print "<tr><td colspan='2'><em>No Inputs</em></td></tr>";
    }
    html_end_box();
}