'" . db_fetch_cell("select name from host_template where id=" . $_GET["id"]) . "'?", "host_templates.php", "host_templates.php?action=remove&id=" . $_GET["id"]);
include("./include/bottom_footer.php");
exit;
}
if ((read_config_option("remove_verification") == "") || (isset($_GET["confirm"]))) {
db_execute("delete from host_template where id=" . $_GET["id"]);
db_execute("delete from host_template_snmp_query where host_template_id=" . $_GET["id"]);
db_execute("delete from host_template_graph where host_template_id=" . $_GET["id"]);
}
}
function template_edit() {
global $colors, $fields_host_template_edit;
display_output_messages();
if (!empty($_GET["id"])) {
$host_template = db_fetch_row("select * from host_template where id=" . $_GET["id"]);
$header_label = "[edit: " . $host_template["name"] . "]";
}else{
$header_label = "[new]";
$_GET["id"] = 0;
}
start_box("Host Templates $header_label", "98%", $colors["header"], "3", "center", "");
draw_edit_form(array(
"config" => array(),
"fields" => inject_form_variables($fields_host_template_edit, (isset($host_template) ? $host_template : array()))
));
end_box();
if (!empty($_GET["id"])) {
start_box("Associated Graph Templates", "98%", $colors["header"], "3", "center", "");
$selected_graph_templates = db_fetch_assoc("select
graph_templates.id,
graph_templates.name
from graph_templates,host_template_graph
where graph_templates.id=host_template_graph.graph_template_id
and host_template_graph.host_template_id=" . $_GET["id"] . "
order by graph_templates.name");
$i = 0;
if (sizeof($selected_graph_templates) > 0) {
foreach ($selected_graph_templates as $item) {
$i++;
?>
|
)
|
|
No associated graph templates. | "; }
?>
">
|
|
Associated Data Queries", "98%", $colors["header"], "3", "center", "");
$selected_data_queries = db_fetch_assoc("select
snmp_query.id,
snmp_query.name
from snmp_query,host_template_snmp_query
where snmp_query.id=host_template_snmp_query.snmp_query_id
and host_template_snmp_query.host_template_id=" . $_GET["id"] . "
order by snmp_query.name");
$i = 0;
if (sizeof($selected_data_queries) > 0) {
foreach ($selected_data_queries as $item) {
$i++;
?>
|
)
|
|
No associated data queries. | "; }
?>
">
|
|
Host Templates", "98%", $colors["header"], "3", "center", "host_templates.php?action=edit");
print "";
DrawMatrixHeaderItem("Template Title",$colors["header_text"],1);
DrawMatrixHeaderItem(" ",$colors["header_text"],1);
print "
";
$host_templates = db_fetch_assoc("select * from host_template order by name");
$i = 0;
if (sizeof($host_templates) > 0) {
foreach ($host_templates as $host_template) {
form_alternate_row_color($colors["alternate"],$colors["light"],$i); $i++;
?>
">
|
">
|
No Host Templates | \n";
}
end_box();
}
?>