本文整理汇总了PHP中form_hidden_box函数的典型用法代码示例。如果您正苦于以下问题:PHP form_hidden_box函数的具体用法?PHP form_hidden_box怎么用?PHP form_hidden_box使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了form_hidden_box函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tree_item_edit
function tree_item_edit()
{
$_graph_tree_item_id = get_get_var_number("id");
$_graph_tree_id = get_get_var_number("tree_id");
if (isset_get_var("parent_id")) {
$_graph_tree_item_parent_id = get_get_var_number("parent_id");
}
if (empty($_graph_tree_item_id)) {
$header_label = "[new]";
} else {
$graph_tree_item = api_graph_tree_item_get($_graph_tree_item_id);
$header_label = "[edit]";
}
$tree_sort_type = db_fetch_cell("select sort_type from graph_tree where id='" . $_GET["tree_id"] . "'");
form_start("graph_trees_items.php", "form_graph_tree_item");
html_start_box("<strong>Tree Items</strong> {$header_label}");
_graph_tree_item_field__parent_item_id($_graph_tree_id, "parent_item_id", isset($_graph_tree_item_parent_id) ? $_graph_tree_item_parent_id : api_graph_tree_item_parent_get($_graph_tree_item_id), empty($_graph_tree_item_id) ? 0 : $_graph_tree_item_id);
_graph_tree_item_field__item_type("item_type", isset($graph_tree_item) ? $graph_tree_item["item_type"] : "", empty($_graph_tree_item_id) ? 0 : $_graph_tree_item_id);
_graph_tree_item_field__title("item_value_title", isset($graph_tree_item) ? $graph_tree_item["item_value"] : "", empty($_graph_tree_item_id) ? 0 : $_graph_tree_item_id);
_graph_tree_item_field__sort_children_type("sort_children_type", isset($graph_tree_item) ? $graph_tree_item["sort_children_type"] : "", empty($_graph_tree_item_id) ? 0 : $_graph_tree_item_id);
_graph_tree_item_field__propagate_changes("propagate_changes", "", empty($_graph_tree_item_id) ? 0 : $_graph_tree_item_id);
_graph_tree_item_field__graph("item_value_graph", isset($graph_tree_item) ? $graph_tree_item["item_value"] : "", empty($_graph_tree_item_id) ? 0 : $_graph_tree_item_id);
_graph_tree_item_field__device("item_value_device", isset($graph_tree_item) ? $graph_tree_item["item_value"] : "", empty($_graph_tree_item_id) ? 0 : $_graph_tree_item_id);
_graph_tree_item_field__device_grouping_type("device_grouping_type", isset($graph_tree_item) ? $graph_tree_item["device_grouping_type"] : "", empty($_graph_tree_item_id) ? 0 : $_graph_tree_item_id);
_graph_tree_item_field__item_type_js_update(isset($graph_tree_item) ? $graph_tree_item["item_type"] : TREE_ITEM_TYPE_HEADER, empty($_graph_tree_item_id) ? 0 : $_graph_tree_item_id);
form_hidden_box("id", $_graph_tree_item_id, "");
form_hidden_box("graph_tree_id", $_graph_tree_id, "");
form_hidden_box("action_post", "graph_tree_item_edit");
html_end_box();
form_save_button("graph_trees.php?action=edit&id=" . $_graph_tree_id);
}
示例2: graph_edit
//.........这里部分代码省略.........
if (!empty($_GET["id"])) {
?>
<table width="100%" align="center">
<tr>
<td align="center" class="textInfo" colspan="2">
<img src="graph_image.php?action=edit&local_graph_id=<?php print $_GET["id"];?>&rra_id=<?php print read_graph_config_option("default_rra_id");?>" alt="">
</td>
<?php
if ((isset($_SESSION["graph_debug_mode"])) && (isset($_GET["id"]))) {
$graph_data_array["output_flag"] = RRDTOOL_OUTPUT_STDERR;
$graph_data_array["print_source"] = 1;
?>
<td>
<span class="textInfo">RRDTool Command:</span><br>
<pre><?php print rrdtool_function_graph($_GET["id"], 1, $graph_data_array);?></pre>
<span class="textInfo">RRDTool Says:</span><br>
<?php unset($graph_data_array["print_source"]);?>
<pre><?php print rrdtool_function_graph($_GET["id"], 1, $graph_data_array);?></pre>
</td>
<?php
}
?>
</tr>
</table>
<br>
<?php
}
if (((isset($_GET["id"])) || (isset($_GET["new"]))) && (empty($graphs["graph_template_id"]))) {
html_start_box("<strong>Graph Configuration</strong>", "100%", $colors["header"], "3", "center", "");
$form_array = array();
while (list($field_name, $field_array) = each($struct_graph)) {
$form_array += array($field_name => $struct_graph[$field_name]);
$form_array[$field_name]["value"] = (isset($graphs) ? $graphs[$field_name] : "");
$form_array[$field_name]["form_id"] = (isset($graphs) ? $graphs["id"] : "0");
if (!(($use_graph_template == false) || ($graphs_template{"t_" . $field_name} == "on"))) {
$form_array[$field_name]["method"] = "template_" . $form_array[$field_name]["method"];
$form_array[$field_name]["description"] = "";
}
}
draw_edit_form(
array(
"config" => array(
"no_form_tag" => true
),
"fields" => $form_array
)
);
html_end_box();
}
if ((isset($_GET["id"])) || (isset($_GET["new"]))) {
form_hidden_box("save_component_graph","1","");
form_hidden_box("save_component_input","1","");
}else{
form_hidden_box("save_component_graph_new","1","");
}
form_hidden_box("rrdtool_version", read_config_option("rrdtool_version"), "");
form_save_button("graphs.php");
//Now we need some javascript to make it dynamic
?>
<script language="JavaScript">
dynamic();
function dynamic() {
//alert("RRDTool Version is '" + document.getElementById('rrdtool_version').value + "'");
//alert("Log is '" + document.getElementById('auto_scale_log').checked + "'");
if (document.getElementById('scale_log_units')) {
document.getElementById('scale_log_units').disabled=true;
if ((document.getElementById('rrdtool_version').value != 'rrd-1.0.x') &&
(document.getElementById('auto_scale_log').checked)) {
document.getElementById('scale_log_units').disabled=false;
}
}
}
function changeScaleLog() {
//alert("Log changed to '" + document.getElementById('auto_scale_log').checked + "'");
if (document.getElementById('scale_log_units')) {
document.getElementById('scale_log_units').disabled=true;
if ((document.getElementById('rrdtool_version').value != 'rrd-1.0.x') &&
(document.getElementById('auto_scale_log').checked)) {
document.getElementById('scale_log_units').disabled=false;
}
}
}
</script>
<?php
}
示例3: graphs
//.........这里部分代码省略.........
}
$sql_query .= ' FROM host_snmp_cache
WHERE host_id=' . $host['id'] . '
AND snmp_query_id=' . $snmp_query['id'] . "\n\t\t\t\t\t\t{$sql_where}\n\t\t\t\t\t\tGROUP BY host_id, snmp_query_id, snmp_index\n\t\t\t\t\t\t{$sql_order}\n\t\t\t\t\t\tLIMIT " . $row_limit * ($page - 1) . ',' . $row_limit;
$rows_query = 'SELECT host_id, snmp_query_id, snmp_index
FROM host_snmp_cache
WHERE host_id=' . $host['id'] . '
AND snmp_query_id=' . $snmp_query['id'] . "\n\t\t\t\t\t\t{$sql_where}\n\t\t\t\t\t\tGROUP BY host_id, snmp_query_id, snmp_index";
$snmp_query_indexes = db_fetch_assoc($sql_query);
$total_rows = sizeof(db_fetch_assoc($rows_query));
if (($page - 1) * $row_limit > $total_rows) {
$page = 1;
$_REQUEST['page' . $query['id']] = $page;
load_current_session_value('page' . $query['id'], 'sess_graphs_new_page' . $query['id'], '1');
}
$nav = html_nav_bar('graphs_new.php', MAX_DISPLAY_PAGES, $page, $row_limit, $total_rows, 15, 'Items', 'page' . $snmp_query['id']);
print $nav;
while (list($field_name, $field_array) = each($xml_array['fields'])) {
if ($field_array['direction'] == 'input' && sizeof($field_names)) {
foreach ($field_names as $row) {
if ($row['field_name'] == $field_name) {
$html_dq_header .= "<td class='tableSubHeaderColumn'>" . $field_array['name'] . "</td>\n";
break;
}
}
}
}
if (!sizeof($snmp_query_indexes)) {
print "<tr class='odd'><td>This Data Query returned 0 rows, perhaps there was a problem executing this\n\t\t\t\t\t\t\tData Query. You can <a href='" . htmlspecialchars('host.php?action=query_verbose&id=' . $snmp_query['id'] . '&host_id=' . $host['id']) . "'>run this Data Query in debug mode</a> to get more information.</td></tr>\n";
} else {
print "<tr class='tableHeader'>\n\t\t\t\t\t\t\t\t{$html_dq_header}\n\t\t\t\t\t\t\t\t<td width='1%' align='center' class='tableSubHeaderCheckbox' style='" . get_checkbox_style() . "'><input type='checkbox' style='margin: 0px;' name='all_" . $snmp_query['id'] . "' title='Select All' onClick='SelectAll(\"sg_" . $snmp_query['id'] . "\",this.checked)'></td>\n\n\t\t\t\t\t\t\t</tr>\n";
}
$row_counter = 0;
$column_counter = 0;
$fields = array_rekey($field_names, 'field_name', 'field_name');
if (sizeof($snmp_query_indexes) > 0) {
foreach ($snmp_query_indexes as $row) {
$query_row = $snmp_query['id'] . '_' . encode_data_query_index($row['snmp_index']);
print "<tr id='line{$query_row}' class='selectable " . ($row_counter % 2 == 0 ? 'odd' : 'even') . "'>";
$i++;
$column_counter = 0;
reset($xml_array['fields']);
while (list($field_name, $field_array) = each($xml_array['fields'])) {
if ($field_array['direction'] == 'input') {
if (in_array($field_name, $fields)) {
if (isset($row[$field_name])) {
print "<td><span id='text{$query_row}" . '_' . $column_counter . "'>" . (strlen($_REQUEST['filter']) ? preg_replace('/(' . preg_quote($_REQUEST['filter']) . ')/i', "<span class='filteredValue'>\\1</span>", $row[$field_name]) : $row[$field_name]) . '</span></td>';
} else {
print "<td><span id='text{$query_row}" . '_' . $column_counter . "'></span></td>";
}
$column_counter++;
}
}
}
print "<td class='checkbox' align='right'>";
print "<input type='checkbox' name='sg_{$query_row}' id='sg_{$query_row}'>";
print '</td>';
print "</tr>\n";
$row_counter++;
}
}
if ($total_rows > $row_limit) {
print $nav;
}
} else {
print "<tr class='odd'><td class='textError'>Search Returned no Rows.</td></tr>\n";
}
} else {
print "<tr class='odd'><td class='textError'>Error in data query.</td></tr>\n";
}
print '</table>';
/* draw the graph template drop down here */
$data_query_graphs = db_fetch_assoc_prepared('SELECT snmp_query_graph.id, snmp_query_graph.name FROM snmp_query_graph WHERE snmp_query_graph.snmp_query_id = ? ORDER BY snmp_query_graph.name', array($snmp_query['id']));
if (sizeof($data_query_graphs) == 1) {
echo "<input type='hidden' id='sgg_" . $snmp_query['id'] . "' name='sgg_" . $snmp_query['id'] . "' value='" . $data_query_graphs[0]['id'] . "'>\n";
} elseif (sizeof($data_query_graphs) > 1) {
print "\t<table align='center' width='100%'>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td width='100%' valign='middle'>\n\t\t\t\t\t\t\t\t<img src='images/arrow.gif' align='absmiddle' alt=''>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td style='white-space:nowrap;font-style: italic;'' align='right'>\n\t\t\t\t\t\t\t\tSelect a Graph Type to Create\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td align='right'>\n\t\t\t\t\t\t\t\t<select name='sgg_" . $snmp_query['id'] . "' id='sgg_" . $snmp_query['id'] . "' onChange='dqUpdateDeps(" . $snmp_query['id'] . ',' . (isset($column_counter) ? $column_counter : '') . ");'>\n\t\t\t\t\t\t\t\t\t";
html_create_list($data_query_graphs, 'name', 'id', '0');
print "\n\t\t\t\t\t\t\t\t</select>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</table>\n";
}
print '<br>';
$script .= 'dqUpdateDeps(' . $snmp_query['id'] . ',' . $num_visible_fields . ");\n";
}
}
}
if (strlen($script)) {
$script .= "</script>\n";
print $script;
}
form_hidden_box('save_component_graph', '1', '');
if (!empty($_REQUEST['host_id'])) {
form_hidden_box('host_id', $host['id'], '0');
form_hidden_box('host_template_id', $host['host_template_id'], '0');
}
if (isset($_SERVER['HTTP_REFERER']) && !substr_count($_SERVER['HTTP_REFERER'], 'graphs_new')) {
$_REQUEST['returnto'] = basename($_SERVER['HTTP_REFERER']);
}
load_current_session_value('returnto', 'sess_graphs_new_returnto', '');
form_save_button($_REQUEST['returnto']);
}
示例4: draw_edit_control
function draw_edit_control($field_name, &$field_array)
{
switch ($field_array["method"]) {
case 'textbox':
form_text_box($field_name, $field_array["value"], isset($field_array["default"]) ? $field_array["default"] : "", $field_array["max_length"], isset($field_array["size"]) ? $field_array["size"] : "40", "text", isset($field_array["form_id"]) ? $field_array["form_id"] : "");
break;
case 'filepath':
form_filepath_box($field_name, $field_array["value"], isset($field_array["default"]) ? $field_array["default"] : "", $field_array["max_length"], isset($field_array["size"]) ? $field_array["size"] : "40", "text", isset($field_array["form_id"]) ? $field_array["form_id"] : "");
break;
case 'dirpath':
form_dirpath_box($field_name, $field_array["value"], isset($field_array["default"]) ? $field_array["default"] : "", $field_array["max_length"], isset($field_array["size"]) ? $field_array["size"] : "40", "text", isset($field_array["form_id"]) ? $field_array["form_id"] : "");
break;
case 'textbox_password':
form_text_box($field_name, $field_array["value"], isset($field_array["default"]) ? $field_array["default"] : "", $field_array["max_length"], isset($field_array["size"]) ? $field_array["size"] : "40", "password");
print "<br>";
form_text_box($field_name . "_confirm", $field_array["value"], isset($field_array["default"]) ? $field_array["default"] : "", $field_array["max_length"], isset($field_array["size"]) ? $field_array["size"] : "40", "password");
break;
case 'textarea':
form_text_area($field_name, $field_array["value"], $field_array["textarea_rows"], $field_array["textarea_cols"], isset($field_array["default"]) ? $field_array["default"] : "", isset($field_array["class"]) ? $field_array["class"] : "", isset($field_array["on_change"]) ? $field_array["on_change"] : "");
break;
case 'drop_array':
form_dropdown($field_name, $field_array["array"], "", "", $field_array["value"], isset($field_array["none_value"]) ? $field_array["none_value"] : "", isset($field_array["default"]) ? $field_array["default"] : "", isset($field_array["class"]) ? $field_array["class"] : "", isset($field_array["on_change"]) ? $field_array["on_change"] : "");
break;
case 'drop_sql':
form_dropdown($field_name, db_fetch_assoc($field_array["sql"]), "name", "id", $field_array["value"], isset($field_array["none_value"]) ? $field_array["none_value"] : "", isset($field_array["default"]) ? $field_array["default"] : "", isset($field_array["class"]) ? $field_array["class"] : "", isset($field_array["on_change"]) ? $field_array["on_change"] : "");
break;
case 'drop_multi':
form_multi_dropdown($field_name, $field_array["array"], db_fetch_assoc($field_array["sql"]), "id", isset($field_array["class"]) ? $field_array["class"] : "", isset($field_array["on_change"]) ? $field_array["on_change"] : "");
break;
case 'drop_multi_rra':
form_multi_dropdown($field_name, array_rekey(db_fetch_assoc("select id,name from rra order by timespan"), "id", "name"), empty($field_array["form_id"]) ? db_fetch_assoc($field_array["sql_all"]) : db_fetch_assoc($field_array["sql"]), "id", isset($field_array["class"]) ? $field_array["class"] : "", isset($field_array["on_change"]) ? $field_array["on_change"] : "");
break;
case 'drop_tree':
grow_dropdown_tree($field_array["tree_id"], $field_name, $field_array["value"]);
break;
case 'drop_color':
form_color_dropdown($field_name, $field_array["value"], "None", isset($field_array["default"]) ? $field_array["default"] : "", isset($field_array["class"]) ? $field_array["class"] : "", isset($field_array["on_change"]) ? $field_array["on_change"] : "");
break;
case 'checkbox':
form_checkbox($field_name, $field_array["value"], $field_array["friendly_name"], isset($field_array["default"]) ? $field_array["default"] : "", isset($field_array["form_id"]) ? $field_array["form_id"] : "", isset($field_array["class"]) ? $field_array["class"] : "", isset($field_array["on_change"]) ? $field_array["on_change"] : "");
break;
case 'checkbox_group':
while (list($check_name, $check_array) = each($field_array["items"])) {
form_checkbox($check_name, $check_array["value"], $check_array["friendly_name"], isset($check_array["default"]) ? $check_array["default"] : "", isset($check_array["form_id"]) ? $check_array["form_id"] : "", isset($field_array["class"]) ? $field_array["class"] : "", isset($check_array["on_change"]) ? $check_array["on_change"] : (isset($field_array["on_change"]) ? $field_array["on_change"] : ""));
print "<br>";
}
break;
case 'radio':
while (list($radio_index, $radio_array) = each($field_array["items"])) {
form_radio_button($field_name, $field_array["value"], $radio_array["radio_value"], $radio_array["radio_caption"], isset($field_array["default"]) ? $field_array["default"] : "", isset($field_array["class"]) ? $field_array["class"] : "", isset($field_array["on_change"]) ? $field_array["on_change"] : "");
print "<br>";
}
break;
case 'custom':
print $field_array["value"];
break;
case 'template_checkbox':
print "<em>" . html_boolean_friendly($field_array["value"]) . "</em>";
form_hidden_box($field_name, $field_array["value"], "");
break;
case 'template_drop_array':
print "<em>" . $field_array["array"][$field_array["value"]] . "</em>";
form_hidden_box($field_name, $field_array["value"], "");
break;
case 'template_drop_multi_rra':
$items = db_fetch_assoc($field_array["sql_print"]);
if (sizeof($items) > 0) {
foreach ($items as $item) {
print htmlspecialchars($item["name"], ENT_QUOTES) . "<br>";
}
}
break;
case 'font':
form_font_box($field_name, $field_array["value"], isset($field_array["default"]) ? $field_array["default"] : "", $field_array["max_length"], isset($field_array["size"]) ? $field_array["size"] : "40", "text", isset($field_array["form_id"]) ? $field_array["form_id"] : "");
break;
case 'file':
form_file($field_name, isset($field_array["size"]) ? $field_array["size"] : "40");
break;
default:
print "<em>" . htmlspecialchars($field_array["value"], ENT_QUOTES) . "</em>";
form_hidden_box($field_name, $field_array["value"], "");
break;
}
}
示例5: import
function import()
{
global $colors, $hash_type_names;
?>
<form method="post" action="templates_import.php" enctype="multipart/form-data">
<?php
if (isset($_SESSION["import_debug_info"]) && is_array($_SESSION["import_debug_info"])) {
html_start_box("<strong>Import Results</strong>", "100%", "aaaaaa", "3", "center", "");
print "<tr bgcolor='#" . $colors["form_alternate1"] . "'><td><p class='textArea'>Cacti has imported the following items:</p>";
while (list($type, $type_array) = each($_SESSION["import_debug_info"])) {
print "<p><strong>" . $hash_type_names[$type] . "</strong></p>";
while (list($index, $vals) = each($type_array)) {
if ($vals["result"] == "success") {
$result_text = "<span style='color: green;'>[success]</span>";
} else {
$result_text = "<span style='color: red;'>[fail]</span>";
}
if ($vals["type"] == "update") {
$type_text = "<span style='color: gray;'>[update]</span>";
} else {
$type_text = "<span style='color: blue;'>[new]</span>";
}
print "<span style='font-family: monospace;'>{$result_text} " . $vals["title"] . " {$type_text}</span><br>\n";
$dep_text = "";
$there_are_dep_errors = false;
if (isset($vals["dep"]) && sizeof($vals["dep"]) > 0) {
while (list($dep_hash, $dep_status) = each($vals["dep"])) {
if ($dep_status == "met") {
$dep_status_text = "<span style='color: navy;'>Found Dependency:</span>";
} else {
$dep_status_text = "<span style='color: red;'>Unmet Dependency:</span>";
$there_are_dep_errors = true;
}
$dep_text .= "<span style='font-family: monospace;'> + {$dep_status_text} " . hash_to_friendly_name($dep_hash, true) . "</span><br>\n";
}
}
/* only print out dependency details if they contain errors; otherwise it would get too long */
if ($there_are_dep_errors == true) {
print $dep_text;
}
}
}
print "</td></tr>";
html_end_box();
kill_session_var("import_debug_info");
}
html_start_box("<strong>Import Templates</strong>", "100%", $colors["header"], "3", "center", "");
form_alternate_row_color($colors["form_alternate1"], $colors["form_alternate2"], 0);
?>
<td width="50%">
<font class="textEditTitle">Import Template from Local File</font><br>
If the XML file containing template data is located on your local machine, select it here.
</td>
<td>
<input type="file" name="import_file">
</td>
</tr>
<?php
form_alternate_row_color($colors["form_alternate1"], $colors["form_alternate2"], 1);
?>
<td width="50%">
<font class="textEditTitle">Import Template from Text</font><br>
If you have the XML file containing template data as text, you can paste it into this box to
import it.
</td>
<td>
<?php
form_text_area("import_text", "", "10\t", "50", "");
?>
</td>
</tr>
<?php
form_alternate_row_color($colors["form_alternate1"], $colors["form_alternate2"], 0);
?>
<td width="50%">
<font class="textEditTitle">Import RRA Settings</font><br>
Choose whether to allow Cacti to import custom RRA settings from imported templates or whether to use the defaults for this installation.
</td>
<td>
<?php
form_radio_button("import_rra", 1, 1, "Use defaults for this installation (Recommended)", 1);
echo "<br />";
form_radio_button("import_rra", 1, 2, "Use custom RRA settings from the template", 1);
?>
</td>
</tr>
<?php
form_hidden_box("save_component_import", "1", "");
html_end_box();
form_save_button("templates_import.php", "save");
}
示例6: graphs
//.........这里部分代码省略.........
usort($data_query_indexes, "usort_numeric");
}
}
}
?>
<table width='98%' style='background-color: #<?php
echo $colors["form_alternate2"];
?>
; border: 1px solid #<?php
echo $colors["header_background"];
?>
;' align='center' cellpadding='3' cellspacing='0'>
<tr>
<td bgcolor='#<?php
echo $colors["header_background"];
?>
' colspan='<?php
echo sizeof($data_query_field_names) + 1;
?>
'>
<table cellspacing='0' cellpadding='0' width='100%' >
<tr>
<td class='textHeaderDark'>
<strong><?php
echo _("Data Query");
?>
</strong> [<?php
echo $data_query["name"];
?>
]
</td>
<td align='right' nowrap>
<a href='graphs_new.php?action=query_reload&id=<?php
echo $data_query["id"];
?>
&host_id=<?php
echo $host["id"];
?>
'><img src='<?php
echo html_get_theme_images_path("reload_icon_small.gif");
?>
' alt='<?php
echo _("Reload Associated Query");
?>
' border='0' align='absmiddle'></a>
</td>
</tr>
</table>
</td>
</tr>
<?php
if (sizeof($attached_graph_templates) == 0) {
echo "<tr bgcolor='#" . $colors["form_alternate1"] . "'><td>" . _("This data query is not being used by any graph templates. You must create at least one graph template that references to a data template using this data query.") . "</td></tr>\n";
} else {
if (sizeof($data_query_field_names) == 0) {
echo "<tr bgcolor='#" . $colors["form_alternate1"] . "'><td>" . _("This data query returned 0 rows, perhaps there was a problem executing this data query. You can") . " <a href='devices.php?action=query_verbose&id=" . $data_query["id"] . "&host_id=" . $host["id"] . "'>" . _("run this data query in debug mode</a> to get more information.") . "</td></tr>\n";
} else {
echo "<tr bgcolor='#" . $colors["header_panel_background"] . "'>\n";
foreach ($data_query_field_names as $field_name) {
echo "<td height='1'><strong><font color='#" . $colors["header_text"] . "'>" . $data_query_field_desc[$field_name] . "</font></strong></td>\n";
}
echo "<td width='1%' align='center' bgcolor='#" . $colors["header_panel_background"] . "' style='" . get_checkbox_style() . "'><input type='checkbox' style='margin: 0px;' name='all_" . $data_query["id"] . "' title='Select All' onClick='" . _("SelectAll") . "(\"sg_" . $data_query["id"] . "\",this.checked);" . ($use_javascript == true ? "dq_update_selection_indicators();" : "") . "'></td>\n</tr>\n";
}
}
$row_counter = 0;
foreach ($data_query_indexes as $index_value) {
$query_row = $data_query["id"] . "_" . encode_data_query_index($index_value);
echo "<tr id='line{$query_row}' bgcolor='#" . ($row_counter % 2 == 0 ? $colors["form_alternate1"] : $colors["form_alternate2"]) . "'>";
$i++;
$column_counter = 0;
foreach ($data_query_field_names as $field_name) {
echo "<td " . ($use_javascript == true ? "onClick='dq_select_line(" . $data_query["id"] . ",\"" . encode_data_query_index($index_value) . "\");'" : "") . "><span id='text{$query_row}" . "_" . $column_counter . "'>" . (isset($data_query_data[$index_value][$field_name]) ? $data_query_data[$index_value][$field_name] : "") . "</span></td>";
$column_counter++;
}
echo "<td align='right'>";
echo "<input type='checkbox' name='sg_{$query_row}' id='sg_{$query_row}' " . ($use_javascript == true ? "onClick='dq_update_selection_indicators();'" : "") . ">";
echo "</td>";
echo "</tr>\n";
$row_counter++;
}
echo "</table>";
if (sizeof($attached_graph_templates) == 1) {
form_hidden_box("sgg_" . $data_query["id"] . "' id='sgg_" . $data_query["id"], $attached_graph_templates[0]["id"], "");
} elseif (sizeof($attached_graph_templates) > 1) {
print "\t<table align='center' width='98%'>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td width='1' valign='top'>\n\t\t\t\t\t\t\t\t<img src='" . html_get_theme_images_path("arrow.gif") . "' alt='' align='absmiddle'> \n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td align='right'>\n\t\t\t\t\t\t\t\t<span style='font-size: 12px; font-style: italic;'>" . _("Select a graph type:") . "</span> \n\t\t\t\t\t\t\t\t<select name='sgg_" . $data_query["id"] . "' id='sgg_" . $data_query["id"] . "' " . ($use_javascript == true ? "onChange='dq_update_deps(" . $data_query["id"] . "," . $num_visible_columns . ");'" : "") . ">\n\t\t\t\t\t\t\t\t\t";
html_create_list($attached_graph_templates, "template_name", "id", "0");
print "\n\t\t\t\t\t\t\t\t</select>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t</table>";
}
print "<br>";
if ($use_javascript == true) {
print "<script type='text/javascript'>dq_update_deps(" . $data_query["id"] . "," . $num_visible_columns . ");</script>\n";
}
}
}
form_hidden_box("save_component_graph", "1", "");
form_hidden_box("host_id", $host["id"], "0");
form_save_button("graphs_new.php");
print "<script type='text/javascript'>dq_update_selection_indicators();</script>\n";
print "<script type='text/javascript'>gt_update_selection_indicators();</script>\n";
}
示例7: item_edit
//.........这里部分代码省略.........
/* 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"]);
}
示例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"]);
}
示例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);
示例10: settings
//.........这里部分代码省略.........
$('#row_custom_fonts').hide();
$('#row_title_size').hide();
$('#row_title_font').hide();
$('#row_legend_size').hide();
$('#row_legend_font').hide();
$('#row_axis_size').hide();
$('#row_axis_font').hide();
$('#row_unit_size').hide();
$('#row_unit_font').hide();
}else{
var custom_fonts = $('#custom_fonts').is(':checked');
switch(custom_fonts) {
case true:
$('#row_fonts').show();
$('#row_title_size').show();
$('#row_title_font').show();
$('#row_legend_size').show();
$('#row_legend_font').show();
$('#row_axis_size').show();
$('#row_axis_font').show();
$('#row_unit_size').show();
$('#row_unit_font').show();
break;
case false:
$('#row_fonts').show();
$('#row_title_size').hide();
$('#row_title_font').hide();
$('#row_legend_size').hide();
$('#row_legend_font').hide();
$('#row_axis_size').hide();
$('#row_axis_font').hide();
$('#row_unit_size').hide();
$('#row_unit_font').hide();
break;
}
}
if ($('#timespan_sel').is(':checked')) {
$('#row_default_rra_id').hide();
$('#row_default_timespan').show();
$('#row_default_timeshift').show();
$('#row_allow_graph_dates_in_future').show();
$('#row_first_weekdayid').show();
$('#row_day_shift_start').show();
$('#row_day_shift_end').show();
} else {
$('#row_default_rra_id').show();
$('#row_default_timespan').hide();
$('#row_default_timeshift').hide();
$('#row_allow_graph_dates_in_future').hide();
$('#row_first_weekdayid').hide();
$('#row_day_shift_start').hide();
$('#row_day_shift_end').hide();
}
}
$(function() {
graphSettings();
$('#navigation').show();
$('#navigation_right').show();
$('input[value="Save"]').unbind().click(function(event) {
event.preventDefault();
href='<?php
print $_SERVER['HTTP_REFERER'];
?>
';
href=href+(href.indexOf('?') > 0 ? '&':'?')+'header=false';
$.post('auth_profile.php?header=false', $('input, select, textarea').serialize()).done(function(data) {
$.get('auth_profile.php?action=noreturn&header=false', function(data) {
$('#main').html(data);
applySkin();
});
});
});
$('input[value="Return"]').unbind().click(function(event) {
console.log('The refer is:<?php
print $_SESSION['profile_referer'];
?>
');
document.location = '<?php
print $_SESSION['profile_referer'];
?>
';
});
$('#timespan_sel').change(function() {
graphSettings();
});
});
-->
</script>
<?php
form_hidden_box('save_component_graph_config', '1', '');
form_save_buttons(array(array('id' => 'return', 'value' => 'Return'), array('id' => 'save', 'value' => 'Save')));
}
示例11: export
function export()
{
global $export_types;
/* 'graph_template' should be the default */
if (!isset($_REQUEST["export_type"])) {
$_REQUEST["export_type"] = "graph_template";
}
html_start_box("<strong>Export Templates</strong>", "100%", "", "3", "center", "");
?>
<tr>
<td>
<form name="form_graph_id" action="templates_export.php">
<table align='left' cellpadding='3' cellspacing='0'>
<tr>
<td style='font-size:1.2em;'>What would you like to export?</td>
<td>
<select name="cbo_graph_id" onChange="window.location=document.form_graph_id.cbo_graph_id.options[document.form_graph_id.cbo_graph_id.selectedIndex].value">
<?php
while (list($key, $array) = each($export_types)) {
print "<option value='templates_export.php?export_type=" . htmlspecialchars($key, ENT_QUOTES) . "'";
if ($_REQUEST["export_type"] == $key) {
print " selected";
}
print ">" . $array["name"] . "</option>\n";
}
?>
</select>
</td>
</tr>
</table>
</form>
</td>
</tr>
<?php
html_end_box();
print "<form method='post' action='templates_export.php'>\n";
html_start_box("<strong>Available Templates</strong> [" . $export_types[$_REQUEST["export_type"]]["name"] . "]", "100%", "", "3", "center", "");
form_alternate_row();
?>
<td width="50%">
<font class="textEditTitle"><?php
print $export_types[$_REQUEST["export_type"]]["name"];
?>
to Export</font><br>
Choose the exact item to export to XML.
</td>
<td>
<?php
form_dropdown("export_item_id", db_fetch_assoc($export_types[$_REQUEST["export_type"]]["dropdown_sql"]), "name", "id", "", "", "0");
?>
</td>
</tr>
<?php
form_alternate_row();
?>
<td width="50%">
<font class="textEditTitle">Include Dependencies</font><br>
Some templates rely on other items in Cacti to function properly. It is highly recommended that you select
this box or the resulting import may fail.
</td>
<td>
<?php
form_checkbox("include_deps", "on", "Include Dependencies", "on", "", true);
?>
</td>
</tr>
<?php
form_alternate_row();
?>
<td width="50%">
<font class="textEditTitle">Output Format</font><br>
Choose the format to output the resulting XML file in.
</td>
<td>
<?php
form_radio_button("output_format", "3", "1", "Output to the Browser (within Cacti)", "1", true);
print "<br>";
form_radio_button("output_format", "3", "2", "Output to the Browser (raw XML)", "1", true);
print "<br>";
form_radio_button("output_format", "3", "3", "Save File Locally", "1", true);
form_hidden_box("export_type", $_REQUEST["export_type"], "");
form_hidden_box("save_component_export", "1", "");
?>
</td>
</tr>
<?php
html_end_box();
form_save_button("", "export");
}
示例12: import
function import()
{
global $colors;
$form_data = array("import_file" => array("friendly_name" => "Import Template from Local File", "description" => "If the XML file containing Threshold Template data is located on your local \r\n\t\t\tmachine, select it here.", "method" => "file"), "import_text" => array("method" => "textarea", "friendly_name" => "Import Template from Text", "description" => "If you have the XML file containing Threshold Template data as text, you can paste \r\n\t\t\tit into this box to import it.", "value" => "", "default" => "", "textarea_rows" => "10", "textarea_cols" => "80", "class" => "textAreaNotes"));
?>
<form method="post" action="thold_templates.php" enctype="multipart/form-data">
<?php
if (isset($_SESSION["import_debug_info"]) && is_array($_SESSION["import_debug_info"])) {
html_start_box("<strong>Import Results</strong>", "100%", $colors["header"], "3", "center", "");
print "<tr><td>Cacti has imported the following items:</td></tr>";
foreach ($_SESSION["import_debug_info"] as $line) {
print "<tr><td>" . $line . "</td></tr>";
}
html_end_box();
kill_session_var("import_debug_info");
}
html_start_box("<strong>Import Threshold Templates</strong>", "100%", $colors["header"], "3", "center", "");
draw_edit_form(array("config" => array("no_form_tag" => true), "fields" => $form_data));
html_end_box();
form_hidden_box("save_component_import", "1", "");
form_save_button("", "import");
}
示例13: graphs
//.........这里部分代码省略.........
<span class="linkMarker">*</span><a href="<?php
print htmlspecialchars("host.php?action=edit&id=" . $_REQUEST["host_id"]);
?>
">Edit this Host</a><br>
<span class="linkMarker">*</span><a href="<?php
print htmlspecialchars("host.php?action=edit");
?>
">Create New Host</a><br>
<?php
api_plugin_hook('graphs_new_top_links');
?>
</td>
</tr>
<?php
if ($_REQUEST["graph_type"] > 0) {
?>
<tr>
<td width="55" valign='top'>
Search:
</td>
<td valign='top'>
<input type="text" name="filter" size="30" value="<?php
print htmlspecialchars(get_request_var_request("filter"));
?>
">
</td>
<td colspan='2' valign='top'>
<input type="submit" value="Go" title="Set/Refresh Filters">
<input type="submit" name="clear_x" value="Clear" title="Clear Filters">
</td>
</tr>
<?php
} else {
form_hidden_box("filter", $_REQUEST["filter"], "");
}
?>
</table>
</form>
</td>
</tr>
<?php
html_end_box();
?>
<form name="chk" method="post" action="graphs_new.php">
<?php
$total_rows = sizeof(db_fetch_assoc("select graph_template_id from host_graph where host_id=" . $_REQUEST["host_id"]));
$i = 0;
if ($changed) {
foreach ($snmp_queries as $query) {
kill_session_var("sess_graphs_new_page" . $query["id"]);
unset($_REQUEST["page" . $query["id"]]);
load_current_session_value("page" . $query["id"], "sess_graphs_new_page" . $query["id"], "1");
}
}
if ($_REQUEST["graph_type"] > 0) {
load_current_session_value("page" . $_REQUEST["graph_type"], "sess_graphs_new_page" . $_REQUEST["graph_type"], "1");
} else {
if ($_REQUEST["graph_type"] == -2) {
foreach ($snmp_queries as $query) {
load_current_session_value("page" . $query["id"], "sess_graphs_new_page" . $query["id"], "1");
}
}
}
$script = "<script type='text/javascript'>\nvar gt_created_graphs = new Array();\nvar created_graphs = new Array()\n";
示例14: export
function export() {
global $colors, $export_types;
/* 'graph_template' should be the default */
if (!isset($_REQUEST["export_type"])) {
$_REQUEST["export_type"] = "graph_template";
}
?>
<form name="form_graph_id">
<table width='98%' style='background-color: #f5f5f5; border: 1px solid #bbbbbb;' align='center'>
<tr bgcolor="<?php print $colors["light"];?>">
<td class="textArea" style="padding: 3px;">
What would you like to export?
<select name="cbo_graph_id" onChange="window.location=document.form_graph_id.cbo_graph_id.options[document.form_graph_id.cbo_graph_id.selectedIndex].value">
<?php
while (list($key, $array) = each($export_types)) {
print "<option value='templates_export.php?export_type=$key'"; if ($_REQUEST["export_type"] == $key) { print " selected"; } print ">" . $array["name"] . "</option>\n";
}
?>
</select>
</td>
</tr>
</table>
</form>
<form method="post" action="templates_export.php">
<?php
html_start_box("<strong>Export Template</strong> [" . $export_types{$_REQUEST["export_type"]}["name"] . "]", "98%", $colors["header"], "3", "center", "");
form_alternate_row_color($colors["form_alternate1"],$colors["form_alternate2"],0); ?>
<td width="50%">
<font class="textEditTitle"><?php print $export_types{$_REQUEST["export_type"]}["name"];?> to Export</font><br>
Choose the exact item to export to XML.
</td>
<td>
<?php form_dropdown("export_item_id",db_fetch_assoc($export_types{$_REQUEST["export_type"]}["dropdown_sql"]),"name","id","","","0");?>
</td>
</tr>
<?php form_alternate_row_color($colors["form_alternate1"],$colors["form_alternate2"],1); ?>
<td width="50%">
<font class="textEditTitle">Include Dependencies</font><br>
Some templates rely on other items in Cacti to function properly. It is highly recommended that you select
this box or the resulting import may fail.
</td>
<td>
<?php form_checkbox("include_deps", "on", "Include Dependencies", "on", "", true);?>
</td>
</tr>
<?php form_alternate_row_color($colors["form_alternate1"],$colors["form_alternate2"],0); ?>
<td width="50%">
<font class="textEditTitle">Output Format</font><br>
Choose the format to output the resulting XML file in.
</td>
<td>
<?php
form_radio_button("output_format", "3", "1", "Output to the Browser (within Cacti)","1",true); print "<br>";
form_radio_button("output_format", "3", "2", "Output to the Browser (raw XML)","1",true); print "<br>";
form_radio_button("output_format", "3", "3", "Save File Locally","1",true);
?>
</td>
</tr>
<?php
form_hidden_box("export_type", $_REQUEST["export_type"], "");
form_hidden_box("save_component_export","1","");
html_end_box();
form_save_button("templates_export.php");
}
示例15: ds_edit
function ds_edit()
{
global $colors, $struct_data_source, $struct_data_source_item, $data_source_types;
/* ================= input validation ================= */
input_validate_input_number(get_request_var("id"));
/* ==================================================== */
$use_data_template = true;
$host_id = 0;
if (!empty($_GET["id"])) {
$data_local = db_fetch_row("select host_id,data_template_id from data_local where id='" . $_GET["id"] . "'");
$data = db_fetch_row("select * from data_template_data where local_data_id='" . $_GET["id"] . "'");
if (isset($data_local["data_template_id"]) && $data_local["data_template_id"] >= 0) {
$data_template = db_fetch_row("select id,name from data_template where id='" . $data_local["data_template_id"] . "'");
$data_template_data = db_fetch_row("select * from data_template_data where data_template_id='" . $data_local["data_template_id"] . "' and local_data_id=0");
} else {
$_SESSION["sess_messages"] = 'Data Source "' . $_GET["id"] . '" does not exist.';
header("Location: data_sources.php");
exit;
}
$header_label = "[edit: " . get_data_source_title($_GET["id"]) . "]";
if (empty($data_local["data_template_id"])) {
$use_data_template = false;
}
} else {
$header_label = "[new]";
$use_data_template = false;
}
/* handle debug mode */
if (isset($_GET["debug"])) {
if ($_GET["debug"] == "0") {
kill_session_var("ds_debug_mode");
} elseif ($_GET["debug"] == "1") {
$_SESSION["ds_debug_mode"] = true;
}
}
include_once "./include/top_header.php";
if (!empty($_GET["id"])) {
?>
<table width="100%" align="center">
<tr>
<td class="textInfo" colspan="2" valign="top">
<?php
print get_data_source_title($_GET["id"]);
?>
</td>
<td class="textInfo" align="right" valign="top">
<span style="color: #c16921;">*<a href='data_sources.php?action=ds_edit&id=<?php
print isset($_GET["id"]) ? $_GET["id"] : 0;
?>
&debug=<?php
print isset($_SESSION["ds_debug_mode"]) ? "0" : "1";
?>
'>Turn <strong><?php
print isset($_SESSION["ds_debug_mode"]) ? "Off" : "On";
?>
</strong> Data Source Debug Mode.</a>
</td>
</tr>
</table>
<br>
<?php
}
html_start_box("<strong>Data Template Selection</strong> {$header_label}", "100%", $colors["header"], "3", "center", "");
$form_array = array("data_template_id" => array("method" => "drop_sql", "friendly_name" => "Selected Data Template", "description" => "The name given to this data template.", "value" => isset($data_template) ? $data_template["id"] : "0", "none_value" => "None", "sql" => "select id,name from data_template order by name"), "host_id" => array("method" => "drop_sql", "friendly_name" => "Host", "description" => "Choose the host that this graph belongs to.", "value" => isset($_GET["host_id"]) ? $_GET["host_id"] : $data_local["host_id"], "none_value" => "None", "sql" => "select id,CONCAT_WS('',description,' (',hostname,')') as name from host order by description,hostname"), "_data_template_id" => array("method" => "hidden", "value" => isset($data_template) ? $data_template["id"] : "0"), "_host_id" => array("method" => "hidden", "value" => empty($data_local["host_id"]) ? isset($_GET["host_id"]) ? $_GET["host_id"] : "0" : $data_local["host_id"]), "_data_input_id" => array("method" => "hidden", "value" => isset($data["data_input_id"]) ? $data["data_input_id"] : "0"), "data_template_data_id" => array("method" => "hidden", "value" => isset($data) ? $data["id"] : "0"), "local_data_template_data_id" => array("method" => "hidden", "value" => isset($data) ? $data["local_data_template_data_id"] : "0"), "local_data_id" => array("method" => "hidden", "value" => isset($data) ? $data["local_data_id"] : "0"));
draw_edit_form(array("config" => array(), "fields" => $form_array));
html_end_box();
/* only display the "inputs" area if we are using a data template for this data source */
if (!empty($data["data_template_id"])) {
$template_data_rrds = db_fetch_assoc("select * from data_template_rrd where local_data_id=" . $_GET["id"] . " order by data_source_name");
html_start_box("<strong>Supplemental Data Template Data</strong>", "100%", $colors["header"], "3", "center", "");
draw_nontemplated_fields_data_source($data["data_template_id"], $data["local_data_id"], $data, "|field|", "<strong>Data Source Fields</strong>", true, true, 0);
draw_nontemplated_fields_data_source_item($data["data_template_id"], $template_data_rrds, "|field|_|id|", "<strong>Data Source Item Fields</strong>", true, true, true, 0);
draw_nontemplated_fields_custom_data($data["id"], "value_|id|", "<strong>Custom Data</strong>", true, true, 0);
form_hidden_box("save_component_data", "1", "");
html_end_box();
}
if ((isset($_GET["id"]) || isset($_GET["new"])) && empty($data["data_template_id"])) {
html_start_box("<strong>Data Source</strong>", "100%", $colors["header"], "3", "center", "");
$form_array = array();
while (list($field_name, $field_array) = each($struct_data_source)) {
$form_array += array($field_name => $struct_data_source[$field_name]);
if (!($use_data_template == false || !empty($data_template_data["t_" . $field_name]) || $field_array["flags"] == "NOTEMPLATE")) {
$form_array[$field_name]["description"] = "";
}
$form_array[$field_name]["value"] = isset($data[$field_name]) ? $data[$field_name] : "";
$form_array[$field_name]["form_id"] = empty($data["id"]) ? "0" : $data["id"];
if (!($use_data_template == false || !empty($data_template_data["t_" . $field_name]) || $field_array["flags"] == "NOTEMPLATE")) {
$form_array[$field_name]["method"] = "template_" . $form_array[$field_name]["method"];
}
}
draw_edit_form(array("config" => array("no_form_tag" => true), "fields" => inject_form_variables($form_array, isset($data) ? $data : array())));
html_end_box();
/* fetch ALL rrd's for this data source */
if (!empty($_GET["id"])) {
$template_data_rrds = db_fetch_assoc("select id,data_source_name from data_template_rrd where local_data_id=" . $_GET["id"] . " order by data_source_name");
}
/* select the first "rrd" of this data source by default */
if (empty($_GET["view_rrd"])) {
$_GET["view_rrd"] = isset($template_data_rrds[0]["id"]) ? $template_data_rrds[0]["id"] : "0";
}
//.........这里部分代码省略.........