//.........这里部分代码省略.........
/* it's nice to default to the parent sorting style for new items */
if (empty($_GET["id"])) {
$default_sorting_type = db_fetch_cell("select sort_children_type from graph_tree_items where id=" . $_GET["parent_id"]);
}else{
$default_sorting_type = TREE_ORDERING_NONE;
}
form_alternate_row_color($colors["form_alternate1"],$colors["form_alternate2"],$i); $i++; ?>
<td width="50%">
<font class="textEditTitle">Title</font><br>
If this item is a header, enter a title here.
</td>
<td>
<?php form_text_box("title", (isset($tree_item["title"]) ? $tree_item["title"] : ""), "", "255", 30, "text", (isset($_GET["id"]) ? $_GET["id"] : "0"));?>
</td>
</tr>
<?php
/* don't allow the user to change the tree item ordering if a tree order has been specified */
if ($tree_sort_type == TREE_ORDERING_NONE) {
form_alternate_row_color($colors["form_alternate1"],$colors["form_alternate2"],$i); $i++; ?>
<td width="50%">
<font class="textEditTitle">Sorting Type</font><br>
Choose how children of this branch will be sorted.
</td>
<td>
<?php form_dropdown("sort_children_type", $tree_sort_types, "", "", (isset($tree_item["sort_children_type"]) ? $tree_item["sort_children_type"] : $default_sorting_type), "", "");?>
</td>
</tr>
<?php
}
if ((!empty($_GET["id"])) && ($tree_sort_type == TREE_ORDERING_NONE)) {
form_alternate_row_color($colors["form_alternate1"],$colors["form_alternate2"],$i); $i++; ?>
<td width="50%">
<font class="textEditTitle">Propagate Changes</font><br>
Propagate all options on this form (except for 'Title') to all child 'Header' items.
</td>
<td>
<?php form_checkbox("propagate_changes", "", "Propagate Changes", "", "", "", 0);?>
</td>
</tr>
<?php
}
break;
case TREE_ITEM_TYPE_GRAPH:
form_alternate_row_color($colors["form_alternate1"],$colors["form_alternate2"],0); ?>
<td width="50%">
<font class="textEditTitle">Graph</font><br>
Choose a graph from this list to add it to the tree.
</td>
<td>
<?php form_dropdown("local_graph_id", db_fetch_assoc("select graph_templates_graph.local_graph_id as id,graph_templates_graph.title_cache as name from (graph_templates_graph CROSS JOIN graph_local) where graph_local.id=graph_templates_graph.local_graph_id and local_graph_id != 0 order by title_cache"), "name", "id", (isset($tree_item["local_graph_id"]) ? $tree_item["local_graph_id"] : ""), "", "");?>
</td>
</tr>
<?php form_alternate_row_color($colors["form_alternate1"],$colors["form_alternate2"],1); ?>
<td width="50%">
<font class="textEditTitle">Round Robin Archive</font><br>
Choose a round robin archive to control how this graph is displayed.
</td>
<td>
<?php form_dropdown("rra_id", db_fetch_assoc("select id,name from rra order by timespan"), "name", "id", (isset($tree_item["rra_id"]) ? $tree_item["rra_id"] : ""), "", "");?>
</td>
</tr>
<?php
break;
case TREE_ITEM_TYPE_HOST:
form_alternate_row_color($colors["form_alternate1"],$colors["form_alternate2"],0); ?>
<td width="50%">
<font class="textEditTitle">Host</font><br>
Choose a host here to add it to the tree.
</td>
<td>
<?php form_dropdown("host_id", db_fetch_assoc("select id,".sql_function_concat("description","' ('","hostname","')'")." as name from host order by description,hostname"), "name", "id", (isset($tree_item["host_id"]) ? $tree_item["host_id"] : ""), "", "");?>
</td>
</tr>
<?php form_alternate_row_color($colors["form_alternate1"],$colors["form_alternate2"],1); ?>
<td width="50%">
<font class="textEditTitle">Graph Grouping Style</font><br>
Choose how graphs are grouped when drawn for this particular host on the tree.
</td>
<td>
<?php form_dropdown("host_grouping_type", $host_group_types, "", "", (isset($tree_item["host_grouping_type"]) ? $tree_item["host_grouping_type"] : "1"), "", "");?>
</td>
</tr>
<?php
break;
}
?>
</tr>
<?php
form_hidden_box("id", (isset($_GET["id"]) ? $_GET["id"] : "0"), "");
form_hidden_box("graph_tree_id", $_GET["tree_id"], "");
form_hidden_box("type", $current_type, "");
form_hidden_box("save_component_tree_item", "1", "");
html_end_box();
form_save_button("tree.php?action=edit&id=" . $_GET["tree_id"]);
}
开发者ID:songchin,项目名称:Cacti,代码行数:101,代码来源:tree.php
示例8: item_edit
function item_edit() {
global $colors, $cdef_item_types, $cdef_functions, $cdef_operators, $custom_data_source_types;
/* ================= input validation ================= */
input_validate_input_number(get_request_var("id"));
input_validate_input_number(get_request_var("cdef_id"));
/* ==================================================== */
if (!empty($_GET["id"])) {
$cdef = db_fetch_row("select * from cdef_items where id=" . $_GET["id"]);
$current_type = $cdef["type"];
$values[$current_type] = $cdef["value"];
}
html_start_box("", "98%", "aaaaaa", "3", "center", "");
draw_cdef_preview($_GET["cdef_id"]);
html_end_box();
html_start_box("<strong>CDEF Items</strong> [edit: " . db_fetch_cell("select name from cdef where id=" . $_GET["cdef_id"]) . "]", "98%", $colors["header"], "3", "center", "");
if (isset($_GET["type_select"])) {
$current_type = $_GET["type_select"];
}elseif (isset($cdef["type"])) {
$current_type = $cdef["type"];
}else{
$current_type = "1";
}
print "<form method='post' action='cdef.php' name='form_cdef'>\n";
form_alternate_row_color($colors["form_alternate1"],$colors["form_alternate2"],0); ?>
<td width="50%">
<font class="textEditTitle">CDEF Item Type</font><br>
Choose what type of CDEF item this is.
</td>
<td>
<select name="type_select" onChange="window.location=document.form_cdef.type_select.options[document.form_cdef.type_select.selectedIndex].value">
<?php
while (list($var, $val) = each($cdef_item_types)) {
print "<option value='cdef.php?action=item_edit" . (isset($_GET["id"]) ? "&id=" . $_GET["id"] : "") . "&cdef_id=" . $_GET["cdef_id"] . "&type_select=$var'"; if ($var == $current_type) { print " selected"; } print ">$val</option>\n";
}
?>
</select>
</td>
</tr>
<?php form_alternate_row_color($colors["form_alternate1"],$colors["form_alternate2"],1); ?>
<td width="50%">
<font class="textEditTitle">CDEF Item Value</font><br>
Enter a value for this CDEF item.
</td>
<td>
<?php
switch ($current_type) {
case '1':
form_dropdown("value", $cdef_functions, "", "", (isset($cdef["value"]) ? $cdef["value"] : ""), "", "");
break;
case '2':
form_dropdown("value", $cdef_operators, "", "", (isset($cdef["value"]) ? $cdef["value"] : ""), "", "");
break;
case '4':
form_dropdown("value", $custom_data_source_types, "", "", (isset($cdef["value"]) ? $cdef["value"] : ""), "", "");
break;
case '5':
form_dropdown("value", db_fetch_assoc("select name,id from cdef order by name"), "name", "id", (isset($cdef["value"]) ? $cdef["value"] : ""), "", "");
break;
case '6':
form_text_box("value", (isset($cdef["value"]) ? $cdef["value"] : ""), "", "255", 30, "text", (isset($_GET["id"]) ? $_GET["id"] : "0"));
break;
}
?>
</td>
</tr>
<?php
form_hidden_box("id", (isset($_GET["id"]) ? $_GET["id"] : "0"), "");
form_hidden_box("type", $current_type, "");
form_hidden_box("cdef_id", $_GET["cdef_id"], "");
form_hidden_box("save_component_item", "1", "");
html_end_box();
form_save_button("cdef.php?action=edit&id=" . $_GET["cdef_id"]);
}
开发者ID:songchin,项目名称:Cacti,代码行数:83,代码来源:cdef.php
示例9: graph
//.........这里部分代码省略.........
<input type='checkbox' name='box-<?php
echo $box_id;
?>
-chk-<?php
echo $graph["id"];
?>
' id='box-<?php
echo $box_id;
?>
-chk-<?php
echo $graph["id"];
?>
' title="<?php
echo $graph["title_cache"];
?>
">
</td>
</tr>
<?php
}
} else {
?>
<tr class="empty">
<td colspan="6">
No graphs found.
</td>
</tr>
<?php
}
html_box_toolbar_draw($box_id, "0", "3", sizeof($filter_array) == 0 ? HTML_BOX_SEARCH_INACTIVE : HTML_BOX_SEARCH_ACTIVE, $url_page_select);
html_end_box(false);
html_box_actions_menu_draw($box_id, "0", $menu_items);
html_box_actions_area_create($box_id);
form_hidden_box("action_post", "graph_list");
form_end();
/* pre-cache the device list since we need it in more than one place below */
$device_list = array_rekey(api_device_list(), "id", "description");
/* fill in the list of available devices for the search dropdown */
$search_devices = array();
$search_devices["-1"] = "Any";
$search_devices["0"] = "None";
$search_devices += $device_list;
/* fill in the list of available devices for the change host dropdown */
$change_host_list = array();
$change_host_list["0"] = "None";
$change_host_list += $device_list;
?>
<script language="JavaScript">
<!--
function action_area_handle_type(box_id, type, parent_div, parent_form) {
if (type == 'remove') {
parent_div.appendChild(document.createTextNode('Are you sure you want to remove these graphs?'));
parent_div.appendChild(action_area_generate_selected_rows(box_id));
action_area_update_header_caption(box_id, 'Remove Graph');
action_area_update_submit_caption(box_id, 'Remove');
action_area_update_selected_rows(box_id, parent_form);
}else if (type == 'duplicate') {
parent_div.appendChild(document.createTextNode('Are you sure you want to duplicate these graphs?'));
parent_div.appendChild(action_area_generate_selected_rows(box_id));
parent_div.appendChild(action_area_generate_input('text', 'box-' + box_id + '-action-area-txt1', ''));
action_area_update_header_caption(box_id, 'Duplicate Graph');
action_area_update_submit_caption(box_id, 'Duplicate');
action_area_update_selected_rows(box_id, parent_form);
请发表评论