本文整理汇总了PHP中form_save_button函数的典型用法代码示例。如果您正苦于以下问题:PHP form_save_button函数的具体用法?PHP form_save_button怎么用?PHP form_save_button使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了form_save_button函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: graph_edit
//.........这里部分代码省略.........
</table>
<br>
<?php
}
/* ==================== Box: Device/Template Selection ==================== */
$form_array = array("graph_template_id" => array("method" => "drop_sql", "friendly_name" => _("Selected Graph Template"), "description" => _("Choose a graph template to apply to this graph. Please note that graph data may be lost if you change the graph template after one is already applied."), "value" => isset($graph) ? $graph["graph_template_id"] : "0", "none_value" => _("None"), "sql" => "select graph_template.id,graph_template.template_name as name from graph_template order by template_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"] : $graph["host_id"], "none_value" => _("None"), "sql" => "select id,CONCAT_WS('',description,' (',hostname,')') as name from host order by description,hostname"), "id" => array("method" => "hidden", "value" => isset($graph) ? $graph["id"] : "0"));
html_start_box("<strong>" . _("Device/Template Selection") . "</strong> {$header_label}", "98%", $colors["header_background"], "3", "center", "");
draw_edit_form(array("config" => array(), "fields" => $form_array));
html_end_box();
/* ==================== Box: Supplemental Template Data ==================== */
/* only display the "inputs" area if we are using a graph template for this graph */
if (!empty($graph["graph_template_id"])) {
ob_start();
html_start_box("<strong>" . _("Supplemental Template Data") . "</strong>", "98%", $colors["header_background"], "3", "center", "");
$num_output_fields = draw_nontemplated_fields_graph($graph["graph_template_id"], $graph, "g||field|", "<strong>" . _("Graph Fields") . "</strong>", true);
$num_output_fields += draw_nontemplated_fields_graph_item($graph["graph_template_id"], array_rekey(db_fetch_assoc("select * from graph_item where graph_id = " . $graph["id"]), "graph_template_item_id", array("id", "data_source_item_id", "color", "graph_item_type", "cdef", "consolidation_function", "gprint_format", "legend_format", "legend_value", "hard_return")), "gip||field|||id|", "<strong>" . _("Graph Item Fields") . "</strong>", true);
html_end_box();
if ($num_output_fields == 0) {
ob_end_clean();
} else {
ob_end_flush();
}
}
/* graph item list goes here */
if (!empty($_GET["id"]) && empty($graph["graph_template_id"])) {
$graph_items = db_fetch_assoc("select\n\t\t\tgraph_item.id\n\t\t\tfrom graph_item\n\t\t\twhere graph_item.graph_id = " . $_GET["id"] . "\n\t\t\torder by graph_item.sequence");
/* ==================== Box: Graph Items ==================== */
html_start_box("<strong>" . _("Graph Items") . "</strong>", "98%", $colors["header_background"], "3", "center", "graphs_items.php?action=edit&graph_id=" . $_GET["id"]);
draw_graph_item_editor($_GET["id"], "graph", false);
html_end_box();
}
/* display sample graph, or graph source in debug mode */
if (!empty($_GET["id"])) {
?>
<table width="98%" align="center">
<tr>
<td align="center" class="textInfo" colspan="2">
<img src="graph_image.php?graph_id=<?php
print $_GET["id"];
?>
&rra_id=1" alt="">
</td>
<?php
if (isset($_SESSION["graph_debug_mode"]) && isset($_GET["id"])) {
$graph_data_array["output_flag"] = RRDTOOL_OUTPUT_STDERR;
?>
<td>
<span class="textInfo"><?php
echo _("RRDTool Says:");
?>
</span><br>
<pre><?php
print rrdtool_function_graph($_GET["id"], 1, $graph_data_array);
?>
</pre>
</td>
<?php
}
?>
</tr>
</table>
<br>
<?php
}
if (empty($graph["graph_template_id"]) && (isset($_GET["id"]) && is_numeric($_GET["id"]) || isset($_GET["host_id"]) && isset($_GET["graph_template_id"]))) {
/* ==================== Box: Graph ==================== */
html_start_box("<strong>" . _("Graph") . "</strong>", "98%", $colors["header_background"], "3", "center", "");
field_row_header("General Options");
_graph_field__title("g|title", false, empty($_GET["id"]) ? 0 : $_GET["id"]);
_graph_field__vertical_label("g|vertical_label", false, isset($graph["vertical_label"]) ? $graph["vertical_label"] : "", empty($_GET["id"]) ? 0 : $_GET["id"]);
_graph_field__image_format("g|image_format", false, isset($graph["image_format"]) ? $graph["image_format"] : "", empty($_GET["id"]) ? 0 : $_GET["id"]);
_graph_field__export("g|export", false, isset($graph["export"]) ? $graph["export"] : "", empty($_GET["id"]) ? 0 : $_GET["id"]);
_graph_field__force_rules_legend("g|force_rules_legend", false, isset($graph["force_rules_legend"]) ? $graph["force_rules_legend"] : "");
field_row_header("Image Size Options");
_graph_field__height("g|height", false, isset($graph["height"]) ? $graph["height"] : "", empty($_GET["id"]) ? 0 : $_GET["id"]);
_graph_field__width("g|width", false, isset($graph["width"]) ? $graph["width"] : "", empty($_GET["id"]) ? 0 : $_GET["id"]);
field_row_header("Grid Options");
_graph_field__x_grid("g|x_grid", false, isset($graph["x_grid"]) ? $graph["x_grid"] : "", empty($_GET["id"]) ? 0 : $_GET["id"]);
_graph_field__y_grid("g|y_grid", false, isset($graph["y_grid"]) ? $graph["y_grid"] : "", empty($_GET["id"]) ? 0 : $_GET["id"]);
_graph_field__y_grid_alt("g|y_grid_alt", false, isset($graph["y_grid_alt"]) ? $graph["y_grid_alt"] : "", empty($_GET["id"]) ? 0 : $_GET["id"]);
_graph_field__no_minor("g|no_minor", false, isset($graph["no_minor"]) ? $graph["no_minor"] : "", empty($_GET["id"]) ? 0 : $_GET["id"]);
field_row_header("Auto Scaling Options");
_graph_field__auto_scale("g|auto_scale", false, isset($graph["auto_scale"]) ? $graph["auto_scale"] : "", empty($_GET["id"]) ? 0 : $_GET["id"]);
_graph_field__auto_scale_opts("g|auto_scale_opts", false, isset($graph["auto_scale_opts"]) ? $graph["auto_scale_opts"] : "", empty($_GET["id"]) ? 0 : $_GET["id"]);
_graph_field__auto_scale_log("g|auto_scale_log", false, isset($graph["auto_scale_log"]) ? $graph["auto_scale_log"] : "", empty($_GET["id"]) ? 0 : $_GET["id"]);
_graph_field__auto_scale_rigid("g|auto_scale_rigid", false, isset($graph["auto_scale_rigid"]) ? $graph["auto_scale_rigid"] : "", empty($_GET["id"]) ? 0 : $_GET["id"]);
_graph_field__auto_padding("g|auto_padding", false, isset($graph["auto_padding"]) ? $graph["auto_padding"] : "", empty($_GET["id"]) ? 0 : $_GET["id"], "t_auto_padding");
field_row_header("Fixed Scaling Options");
_graph_field__upper_limit("g|upper_limit", false, isset($graph["upper_limit"]) ? $graph["upper_limit"] : "", empty($_GET["id"]) ? 0 : $_GET["id"], "t_upper_limit");
_graph_field__lower_limit("g|lower_limit", false, isset($graph["lower_limit"]) ? $graph["lower_limit"] : "", empty($_GET["id"]) ? 0 : $_GET["id"], "t_lower_limit");
_graph_field__base_value("g|base_value", false, isset($graph["base_value"]) ? $graph["base_value"] : "", empty($_GET["id"]) ? 0 : $_GET["id"], "t_base_value");
field_row_header("Units Display Options");
_graph_field__unit_value("g|unit_value", false, isset($graph["unit_value"]) ? $graph["unit_value"] : "", empty($_GET["id"]) ? 0 : $_GET["id"], "t_unit_value");
_graph_field__unit_length("g|unit_length", false, isset($graph["unit_length"]) ? $graph["unit_length"] : "", empty($_GET["id"]) ? 0 : $_GET["id"], "t_unit_length");
_graph_field__unit_exponent_value("g|unit_exponent_value", false, isset($graph["unit_exponent_value"]) ? $graph["unit_exponent_value"] : "", empty($_GET["id"]) ? 0 : $_GET["id"]);
html_end_box();
}
form_hidden_box("action_post", "graph_edit");
form_save_button("graphs.php");
}
示例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: template_edit
//.........这里部分代码省略.........
if ($field_array["flags"] == "ALWAYSTEMPLATE") {
$form_array[$field_name]["description"] = "<em>This field is always templated.</em>";
} else {
$form_array[$field_name]["description"] = "";
$form_array[$field_name]["sub_checkbox"] = array("name" => "t_" . $field_name, "friendly_name" => "Use Per-Data Source Value (Ignore this Value)", "value" => isset($template_data["t_" . $field_name]) ? $template_data["t_" . $field_name] : "");
}
$form_array[$field_name]["value"] = isset($template_data[$field_name]) ? $template_data[$field_name] : "";
$form_array[$field_name]["form_id"] = isset($template_data) ? $template_data["data_template_id"] : "0";
}
draw_edit_form(array("config" => array("no_form_tag" => true), "fields" => inject_form_variables($form_array, isset($template_data) ? $template_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 data_template_id=" . $_GET["id"] . " and local_data_id=0 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";
}
/* get more information about the rrd we chose */
if (!empty($_GET["view_rrd"])) {
$template_rrd = db_fetch_row("select * from data_template_rrd where id=" . $_GET["view_rrd"]);
}
$i = 0;
if (isset($template_data_rrds)) {
if (sizeof($template_data_rrds) > 1) {
/* draw the data source tabs on the top of the page */
print "\t<table class='tabs' width='100%' cellspacing='0' cellpadding='3' align='center'>\n\t\t\t\t<tr>\n";
foreach ($template_data_rrds as $template_data_rrd) {
$i++;
print "\t<td " . ($template_data_rrd["id"] == $_GET["view_rrd"] ? "class='tabSelected tab'" : "class='tabNotSelected tab'") . " width='" . (strlen($template_data_rrd["data_source_name"]) * 9 + 50) . "' align='center'>\n\t\t\t\t\t\t\t<span class='textHeader'><a href='" . htmlspecialchars("data_templates.php?action=template_edit&id=" . $_GET["id"] . "&view_rrd=" . $template_data_rrd["id"]) . "'>{$i}: " . htmlspecialchars($template_data_rrd["data_source_name"]) . "</a> <a href='" . htmlspecialchars("data_templates.php?action=rrd_remove&id=" . $template_data_rrd["id"] . "&data_template_id=" . $_GET["id"]) . "'><img src='images/delete_icon.gif' border='0' alt='Delete'></a></span>\n\t\t\t\t\t\t</td>\n\n\t\t\t\t\t\t<td width='1'></td>\n";
}
print "\n\t\t\t\t<td></td>\n\n\t\t\t\t</tr>\n\t\t\t</table>\n";
} elseif (sizeof($template_data_rrds) == 1) {
$_GET["view_rrd"] = $template_data_rrds[0]["id"];
}
}
html_start_box("", "100%", "", "3", "center", "");
print "\t<tr class='cactiTableTitle'>\n\t\t\t<td class='textHeaderDark'>\n\t\t\t\t<strong>Data Source Item</strong> [" . (isset($template_rrd) ? htmlspecialchars($template_rrd["data_source_name"]) : "") . "]\n\t\t\t</td>\n\t\t\t<td class='textHeaderDark' align='right'>\n\t\t\t\t" . (!empty($_GET["id"]) ? "<strong><a class='linkOverDark' href='" . htmlspecialchars("data_templates.php?action=rrd_add&id=" . $_GET["id"]) . "'>New</a> </strong>" : "") . "\n\t\t\t</td>\n\t\t</tr>\n";
/* data input fields list */
if (empty($template_data["data_input_id"]) || db_fetch_cell("select type_id from data_input where id=" . $template_data["data_input_id"]) != "1" && db_fetch_cell("select type_id from data_input where id=" . $template_data["data_input_id"]) != "5") {
unset($struct_data_source_item["data_input_field_id"]);
} else {
$struct_data_source_item["data_input_field_id"]["sql"] = "select id,CONCAT(data_name,' - ',name) as name from data_input_fields where data_input_id=" . $template_data["data_input_id"] . " and input_output='out' and update_rra='on' order by data_name,name";
}
$form_array = array();
while (list($field_name, $field_array) = each($struct_data_source_item)) {
$form_array += array($field_name => $struct_data_source_item[$field_name]);
$form_array[$field_name]["description"] = "";
$form_array[$field_name]["value"] = isset($template_rrd) ? $template_rrd[$field_name] : "";
$form_array[$field_name]["sub_checkbox"] = array("name" => "t_" . $field_name, "friendly_name" => "Use Per-Data Source Value (Ignore this Value)", "value" => isset($template_rrd) ? $template_rrd["t_" . $field_name] : "");
}
draw_edit_form(array("config" => array("no_form_tag" => true), "fields" => $form_array + array("data_template_rrd_id" => array("method" => "hidden", "value" => isset($template_rrd) ? $template_rrd["id"] : "0"))));
html_end_box();
$i = 0;
if (!empty($_GET["id"])) {
/* get each INPUT field for this data input source */
$fields = db_fetch_assoc("select * from data_input_fields where data_input_id=" . $template_data["data_input_id"] . " and input_output='in' order by name");
html_start_box("<strong>Custom Data</strong> [data input: " . htmlspecialchars(db_fetch_cell("select name from data_input where id=" . $template_data["data_input_id"])) . "]", "100%", "", "3", "center", "");
/* loop through each field found */
if (sizeof($fields) > 0) {
foreach ($fields as $field) {
$data_input_data = db_fetch_row("select t_value,value from data_input_data where data_template_data_id=" . $template_data["id"] . " and data_input_field_id=" . $field["id"]);
if (sizeof($data_input_data) > 0) {
$old_value = $data_input_data["value"];
} else {
$old_value = "";
}
form_alternate_row();
?>
<td width="50%">
<strong><?php
print $field["name"];
?>
</strong><br>
<?php
form_checkbox("t_value_" . $field["data_name"], $data_input_data["t_value"], "Use Per-Data Source Value (Ignore this Value)", "", "", $_GET["id"]);
?>
</td>
<td>
<?php
form_text_box("value_" . $field["data_name"], $old_value, "", "");
?>
<?php
if (preg_match('/^' . VALID_HOST_FIELDS . '$/i', $field["type_code"]) && $data_input_data["t_value"] == "") {
print "<br><em>Value will be derived from the host if this field is left empty.</em>\n";
}
?>
</td>
</tr>
<?php
$i++;
}
} else {
print "<tr><td><em>No Input Fields for the Selected Data Input Source</em></td></tr>";
}
html_end_box();
}
form_save_button("data_templates.php", "return");
}
示例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: mactrack_site_edit
function mactrack_site_edit()
{
global $fields_mactrack_site_edit;
/* ================= input validation ================= */
get_filter_request_var('site_id');
/* ==================================================== */
display_output_messages();
if (!isempty_request_var('site_id')) {
$site = db_fetch_row('SELECT * FROM mac_track_sites WHERE site_id=' . get_request_var('site_id'));
$header_label = __('MacTrack Site [edit: %s]', $site['site_name']);
} else {
$header_label = __('MacTrack Site [new]');
}
form_start('mactrack_sites.php');
html_start_box($header_label, '100%', '', '3', 'center', '');
draw_edit_form(array('config' => array('no_form_tag' => true), 'fields' => inject_form_variables($fields_mactrack_site_edit, isset($site) ? $site : array())));
html_end_box();
form_save_button('mactrack_sites.php', 'return', 'site_id');
}
示例7: host_edit
//.........这里部分代码省略.........
$keeper = array();
foreach ($available_data_queries as $item) {
if (sizeof(db_fetch_assoc_prepared('SELECT snmp_query_id FROM host_snmp_query WHERE host_id = ? AND snmp_query_id = ?', array($_REQUEST['id'], $item['id']))) > 0) {
/* do nothing */
} else {
array_push($keeper, $item);
}
}
$available_data_queries = $keeper;
$i = 0;
if (sizeof($selected_data_queries) > 0) {
foreach ($selected_data_queries as $item) {
form_alternate_row('', true);
/* get status information for this data query */
$num_dq_items = sizeof(db_fetch_assoc_prepared('SELECT snmp_index FROM host_snmp_cache WHERE host_id = ? AND snmp_query_id = ?', array($_REQUEST['id'], $item['id'])));
$num_dq_rows = sizeof(db_fetch_assoc_prepared('SELECT snmp_index FROM host_snmp_cache WHERE host_id = ? AND snmp_query_id = ? GROUP BY snmp_index', array($_REQUEST['id'], $item['id'])));
$status = 'success';
?>
<td style="padding: 4px;">
<strong><?php
print $i;
?>
)</strong> <?php
print htmlspecialchars($item['name']);
?>
</td>
<td>
(<a href="<?php
print htmlspecialchars('host.php?action=query_verbose&id=' . $item['id'] . '&host_id=' . $_REQUEST['id']);
?>
">Verbose Query</a>)
</td>
<td>
<?php
print $reindex_types[$item['reindex_method']];
?>
</td>
<td>
<?php
print $status == 'success' ? "<span style='color: green;'>Success</span>" : "<span style='color: green;'>Fail</span>";
?>
[<?php
print $num_dq_items;
?>
Item<?php
print $num_dq_items == 1 ? '' : 's';
?>
, <?php
print $num_dq_rows;
?>
Row<?php
print $num_dq_rows == 1 ? '' : 's';
?>
]
</td>
<td align='right' nowrap>
<a href='<?php
print htmlspecialchars('host.php?action=query_reload&id=' . $item['id'] . '&host_id=' . $_REQUEST['id']);
?>
'><img src='images/reload_icon_small.gif' title='Reload Data Query' alt='Reload Data Query' border='0' align='middle'></a>
<a href='<?php
print htmlspecialchars('host.php?action=query_remove&id=' . $item['id'] . '&host_id=' . $_REQUEST['id']);
?>
'><img src='images/delete_icon_large.gif' title='Delete Data Query Association' alt='Delete Data Query Association' border='0' align='middle'></a>
</td>
<?php
form_end_row();
$i++;
}
} else {
print "<tr class='tableRow'><td colspan='4'><em>No associated data queries.</em></td></tr>";
}
?>
<tr class='odd'>
<td class='saveRow' colspan="5">
<table cellspacing="0" cellpadding="1" width="100%">
<td nowrap>Add Data Query:
<?php
form_dropdown('snmp_query_id', $available_data_queries, 'name', 'id', '', '', '');
?>
</td>
<td nowrap>Re-Index Method:
<?php
form_dropdown('reindex_method', $reindex_types, '', '', read_config_option('reindex_method'), '', '');
?>
</td>
<td align="right">
<input type="submit" value="Add" name="add_dq_x" title="Add Data Query to Device">
</td>
</table>
<a name='dqtop'></a>
</td>
</tr>
<?php
html_end_box();
}
form_save_button('host.php', 'return');
api_plugin_hook('host_edit_bottom');
}
示例8: data_query_edit
function data_query_edit() {
global $colors, $fields_data_query_edit, $config;
if (!empty($_GET["id"])) {
$snmp_query = db_fetch_row("select * from snmp_query where id=" . $_GET["id"]);
$header_label = "[edit: " . $snmp_query["name"] . "]";
}else{
$header_label = "[new]";
}
html_start_box("<strong>Data Queries</strong> $header_label", "98%", $colors["header"], "3", "center", "");
draw_edit_form(array(
"config" => array(),
"fields" => inject_form_variables($fields_data_query_edit, (isset($snmp_query) ? $snmp_query : array()))
));
html_end_box();
if (!empty($snmp_query["id"])) {
$xml_filename = str_replace("<path_cacti>", $config["base_path"], $snmp_query["xml_path"]);
if ((file_exists($xml_filename)) && (is_file($xml_filename))) {
$text = "<font color='#0d7c09'><strong>Successfully located XML file</strong></font>";
$xml_file_exists = true;
}else{
$text = "<font color='#ff0000'><strong>Could not locate XML file.</strong></font>";
$xml_file_exists = false;
}
html_start_box("", "98%", "aaaaaa", "3", "center", "");
print "<tr bgcolor='#f5f5f5'><td>$text</td></tr>";
html_end_box();
if ($xml_file_exists == true) {
html_start_box("<strong>Associated Graph Templates</strong>", "98%", $colors["header"], "3", "center", "data_queries.php?action=item_edit&snmp_query_id=" . $snmp_query["id"]);
print " <tr bgcolor='#" . $colors["header_panel"] . "'>
<td><span style='color: white; font-weight: bold;'>Name</span></td>
<td><span style='color: white; font-weight: bold;'>Graph Template Name</span></td>
<td></td>
</tr>";
$snmp_query_graphs = db_fetch_assoc("select
snmp_query_graph.id,
graph_templates.name as graph_template_name,
snmp_query_graph.name
from snmp_query_graph
left join graph_templates on snmp_query_graph.graph_template_id=graph_templates.id
where snmp_query_graph.snmp_query_id=" . $snmp_query["id"] . "
order by snmp_query_graph.name");
$i = 0;
if (sizeof($snmp_query_graphs) > 0) {
foreach ($snmp_query_graphs as $snmp_query_graph) {
form_alternate_row_color($colors["form_alternate1"],$colors["form_alternate2"],$i); $i++;
?>
<td>
<strong><a href="data_queries.php?action=item_edit&id=<?php print $snmp_query_graph["id"];?>&snmp_query_id=<?php print $snmp_query["id"];?>"><?php print $snmp_query_graph["name"];?></a></strong>
</td>
<td>
<?php print $snmp_query_graph["graph_template_name"];?>
</td>
<td align="right">
<a href="data_queries.php?action=item_remove&id=<?php print $snmp_query_graph["id"];?>&snmp_query_id=<?php print $snmp_query["id"];?>"><img src="images/delete_icon.gif" width="10" height="10" border="0" alt="Delete"></a>
</td>
</tr>
<?php
}
}else{
print "<tr><td><em>No Graph Templates Defined.</em></td></tr>";
}
html_end_box();
}
}
form_save_button("data_queries.php");
}
示例9: input_edit
function input_edit() {
global $colors, $consolidation_functions, $graph_item_types, $struct_graph_item, $fields_graph_template_input_edit;
$header_label = "[edit graph: " . db_fetch_cell("select name from graph_templates where id=" . $_GET["graph_template_id"]) . "]";
/* get a list of all graph item field names and populate an array for user display */
while (list($field_name, $field_array) = each($struct_graph_item)) {
if ($field_array["method"] != "view") {
$graph_template_items[$field_name] = $field_array["friendly_name"];
}
}
if (!empty($_GET["id"])) {
$graph_template_input = db_fetch_row("select * from graph_template_input where id=" . $_GET["id"]);
}
html_start_box("<strong>Graph Item Inputs</strong> $header_label", "98%", $colors["header"], "3", "center", "");
draw_edit_form(array(
"config" => array(),
"fields" => inject_form_variables($fields_graph_template_input_edit, (isset($graph_template_input) ? $graph_template_input : array()), (isset($graph_template_items) ? $graph_template_items : array()), $_GET)
));
if (!(isset($_GET["id"]))) { $_GET["id"] = 0; }
$item_list = db_fetch_assoc("select
CONCAT_WS(' - ',data_template_data.name,data_template_rrd.data_source_name) as data_source_name,
graph_templates_item.text_format,
graph_templates_item.id as graph_templates_item_id,
graph_templates_item.graph_type_id,
graph_templates_item.consolidation_function_id,
graph_template_input_defs.graph_template_input_id
from graph_templates_item
left join graph_template_input_defs on (graph_template_input_defs.graph_template_item_id=graph_templates_item.id and graph_template_input_defs.graph_template_input_id=" . $_GET["id"] . ")
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
where graph_templates_item.local_graph_id=0
and graph_templates_item.graph_template_id=" . $_GET["graph_template_id"] . "
order by graph_templates_item.sequence");
form_alternate_row_color($colors["form_alternate1"],$colors["form_alternate2"],1); ?>
<td width="50%">
<font class="textEditTitle">Associated Graph Items</font><br>
Select the graph items that you want to accept user input for.
</td>
<td>
<?php
$i = 0; $any_selected_item = "";
if (sizeof($item_list) > 0) {
foreach ($item_list as $item) {
if ($item["graph_template_input_id"] == "") {
$old_value = "";
}else{
$old_value = "on";
$any_selected_item = $item["graph_templates_item_id"];
}
if ($graph_item_types{$item["graph_type_id"]} == "GPRINT") {
$start_bold = "";
$end_bold = "";
}else{
$start_bold = "<strong>";
$end_bold = "</strong>";
}
$name = "$start_bold Item #" . ($i+1) . ": " . $graph_item_types{$item["graph_type_id"]} . " (" . $consolidation_functions{$item["consolidation_function_id"]} . ")$end_bold";
form_checkbox("i_" . $item["graph_templates_item_id"], $old_value, $name,"",$_GET["graph_template_id"],true); print "<br>";
$i++;
}
}else{
print "<em>No Items</em>";
}
?>
</td>
</tr>
<?php
html_end_box();
form_hidden_box("any_selected_item", $any_selected_item, "");
form_save_button("graph_templates.php?action=template_edit&id=" . $_GET["graph_template_id"]);
}
示例10: gprint_edit
function gprint_edit() {
$_gprint_preset_id = get_get_var_number("id");
if (empty($_gprint_preset_id)) {
$header_label = "[new]";
}else{
$gprint = api_data_preset_gprint_get($_gprint_preset_id);
$header_label = "[edit: " . $gprint["name"] . "]";
}
form_start("presets_gprint.php", "form_gprint");
/* ==================== Box: Colors ==================== */
html_start_box("<strong>" . _("GPRINT Presets") . "</strong> $header_label");
_data_preset_gprint__name("name", (isset($gprint["name"]) ? $gprint["name"] : ""), (isset($gprint["id"]) ? $gprint["id"] : "0"));
_data_preset_gprint__gprint_text("gprint_text", (isset($gprint["gprint_text"]) ? $gprint["gprint_text"] : ""), (isset($gprint["id"]) ? $gprint["id"] : "0"));
html_end_box();
form_hidden_box("preset_gprint_id", $_gprint_preset_id);
form_hidden_box("action_post", "gprint_preset_edit");
form_save_button("presets.php?action=view_gprint", "save_gprint");
}
示例11: host_edit
//.........这里部分代码省略.........
if (sizeof($selected_data_queries) > 0) {
foreach ($selected_data_queries as $item) {
$i++;
/* get status information for this data query */
$num_dq_items = sizeof(db_fetch_assoc("select snmp_index from host_snmp_cache where host_id=" . $_GET["id"] . " and snmp_query_id=" . $item["id"]));
$num_dq_rows = sizeof(db_fetch_assoc("select snmp_index from host_snmp_cache where host_id=" . $_GET["id"] . " and snmp_query_id=" . $item["id"] . " group by snmp_index"));
$status = "success";
?>
<tr>
<td style="padding: 4px;">
<strong><?php
print $i;
?>
)</strong> <?php
print $item["name"];
?>
</td>
<td>
(<a href="host.php?action=query_verbose&id=<?php
print $item["id"];
?>
&host_id=<?php
print $_GET["id"];
?>
">Verbose Query</a>)
</td>
<td>
<?php
print $reindex_types[$item["reindex_method"]];
?>
</td>
<td>
<?php
print $status == "success" ? "<span style='color: green;'>Success</span>" : "<span style='color: green;'>Fail</span>";
?>
[<?php
print $num_dq_items;
?>
Item<?php
print $num_dq_items == 1 ? "" : "s";
?>
, <?php
print $num_dq_rows;
?>
Row<?php
print $num_dq_rows == 1 ? "" : "s";
?>
]
</td>
<td align='right' nowrap>
<a href='host.php?action=query_reload&id=<?php
print $item["id"];
?>
&host_id=<?php
print $_GET["id"];
?>
'><img src='images/reload_icon_small.gif' title='Reload Data Query' alt='Reload Data Query' border='0' align='absmiddle'></a>
<a href='host.php?action=query_remove&id=<?php
print $item["id"];
?>
&host_id=<?php
print $_GET["id"];
?>
'><img src='images/delete_icon_large.gif' title='Delete Data Query Association' alt='Delete Data Query Association' border='0' align='absmiddle'></a>
</td>
</tr>
<?php
}
} else {
print "<tr><td><em>No associated data queries.</em></td></tr>";
}
?>
<tr bgcolor="#<?php
print $colors["form_alternate1"];
?>
">
<td colspan="5">
<table cellspacing="0" cellpadding="1" width="100%">
<td nowrap>Add Data Query:
<?php
form_dropdown("snmp_query_id", $available_data_queries, "name", "id", "", "", "");
?>
</td>
<td nowrap>Re-Index Method:
<?php
form_dropdown("reindex_method", $reindex_types, "", "", read_config_option("reindex_method"), "", "");
?>
</td>
<td align="right">
<input type="image" src="images/button_add.gif" alt="Add" name="add_dq" align="absmiddle">
</td>
</table>
</td>
</tr>
<?php
html_end_box();
}
form_save_button("host.php");
}
示例12: template_edit
function template_edit()
{
global $colors, $struct_graph, $image_types, $fields_graph_template_template_edit;
/* ================= input validation ================= */
input_validate_input_number(get_request_var("id"));
/* ==================================================== */
/* graph item list goes here */
if (!empty($_GET["id"])) {
item();
}
if (!empty($_GET["id"])) {
$template = db_fetch_row("select * from graph_templates where id=" . $_GET["id"]);
$template_graph = db_fetch_row("select * from graph_templates_graph where graph_template_id=" . $_GET["id"] . " and local_graph_id=0");
$header_label = "[edit: " . $template["name"] . "]";
} else {
$header_label = "[new]";
}
html_start_box("<strong>Template</strong> {$header_label}", "100%", $colors["header"], "3", "center", "");
draw_edit_form(array("config" => array(), "fields" => inject_form_variables($fields_graph_template_template_edit, isset($template) ? $template : array(), isset($template_graph) ? $template_graph : array())));
html_end_box();
html_start_box("<strong>Graph Template</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($template_graph) ? $template_graph[$field_name] : "";
$form_array[$field_name]["form_id"] = isset($template_graph) ? $template_graph["id"] : "0";
$form_array[$field_name]["description"] = "";
$form_array[$field_name]["sub_checkbox"] = array("name" => "t_" . $field_name, "friendly_name" => "Use Per-Graph Value (Ignore this Value)", "value" => isset($template_graph) ? $template_graph["t_" . $field_name] : "");
}
draw_edit_form(array("config" => array(), "fields" => $form_array));
form_hidden_box("rrdtool_version", read_config_option("rrdtool_version"), "");
html_end_box();
form_save_button("graph_templates.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 + "'");
document.getElementById('t_scale_log_units').disabled=true;
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('t_scale_log_units').disabled=false;
document.getElementById('scale_log_units').disabled=false;
}
}
function changeScaleLog() {
//alert("Log changed to '" + document.getElementById('auto_scale_log').checked + "'");
document.getElementById('t_scale_log_units').disabled=true;
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('t_scale_log_units').disabled=false;
document.getElementById('scale_log_units').disabled=false;
}
}
</script>
<?php
}
示例13: graph_edit
//.........这里部分代码省略.........
draw_nontemplated_fields_graph($graphs["graph_template_id"], $graphs, "|field|", "<strong>Graph Fields</strong>", true, true, 0);
draw_nontemplated_fields_graph_item($graphs["graph_template_id"], $_GET["id"], "|field|_|id|", "<strong>Graph Item Fields</strong>", true);
html_end_box();
}
/* graph item list goes here */
if (!empty($_GET["id"]) && empty($graphs["graph_template_id"])) {
item();
}
if (!empty($_GET["id"])) {
?>
<table width="100%" align="center">
<tr>
<td align="center" class="textInfo" colspan="2">
<img src="<?php
print htmlspecialchars("graph_image.php?action=edit&local_graph_id=" . $_GET["id"] . "&rra_id=" . 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
}
示例14: user_edit
function user_edit() {
global $colors, $fields_user_user_edit_host;
if (!empty($_GET["id"])) {
$user = db_fetch_row("select * from user_auth where id=" . $_GET["id"]);
$header_label = "[edit: " . $user["username"] . "]";
}else{
$header_label = "[new]";
}
html_start_box("<strong>User Management</strong> $header_label", "98%", $colors["header"], "3", "center", "");
draw_edit_form(array(
"config" => array("form_name" => "chk"),
"fields" => inject_form_variables($fields_user_user_edit_host, (isset($user) ? $user : array()))
));
html_end_box();
if (!empty($_GET["id"])) {
/* draw user admin nav tabs */
?>
<table class='tabs' width='98%' cellspacing='0' cellpadding='3' align='center'>
<tr>
<td width='1'></td>
<td <?php print ((($_GET["action"] == "user_realms_edit") || ($_GET["action"] == "user_edit")) ? "bgcolor='silver'" : "bgcolor='#DFDFDF'");?> nowrap='nowrap' width='150' align='center' class='tab'>
<span class='textHeader'><a href='user_admin.php?action=user_realms_edit&id=<?php print $_GET["id"];?>'>Realm Permissions</a></span>
</td>
<td width='1'></td>
<td <?php print (($_GET["action"] == "graph_perms_edit") ? "bgcolor='silver'" : "bgcolor='#DFDFDF'");?> nowrap='nowrap' width='150' align='center' class='tab'>
<span class='textHeader'><a href='user_admin.php?action=graph_perms_edit&id=<?php print $_GET["id"];?>'>Graph Permissions</a></span>
</td>
<td width='1'></td>
<td <?php print (($_GET["action"] == "graph_settings_edit") ? "bgcolor='silver'" : "bgcolor='#DFDFDF'");?> nowrap='nowrap' width='130' align='center' class='tab'>
<span class='textHeader'><a href='user_admin.php?action=graph_settings_edit&id=<?php print $_GET["id"];?>'>Graph Settings</a></span>
</td>
<td></td>
</tr>
</table>
<?php
}
if ($_GET["action"] == "graph_settings_edit") {
graph_settings_edit();
}elseif ($_GET["action"] == "user_realms_edit") {
user_realms_edit();
}elseif ($_GET["action"] == "graph_perms_edit") {
graph_perms_edit();
}else{
user_realms_edit();
}
form_save_button("user_admin.php");
}
示例15: item_edit
function item_edit() {
global $colors, $struct_graph_item, $graph_item_types, $consolidation_functions;
/* ================= input validation ================= */
input_validate_input_number(get_request_var("id"));
input_validate_input_number(get_request_var("graph_template_id"));
/* ==================================================== */
$header_label = "[edit graph: " . db_fetch_cell("select name from graph_templates where id=" . $_GET["graph_template_id"]) . "]";
html_start_box("<strong>Graph Template Items</strong> $header_label", "100%", $colors["header"], "3", "center", "");
if (!empty($_GET["id"])) {
$template_item = db_fetch_row("select * from graph_templates_item where id=" . $_GET["id"]);
}
/* by default, select the LAST DS chosen to make everyone's lives easier */
if (!empty($_GET["graph_template_id"])) {
$default = db_fetch_row("select task_item_id from graph_templates_item where graph_template_id=" . $_GET["graph_template_id"] . " and local_graph_id=0 order by sequence DESC");
if (sizeof($default) > 0) {
$struct_graph_item["task_item_id"]["default"] = $default["task_item_id"];
}else{
$struct_graph_item["task_item_id"]["default"] = 0;
}
}
/* modifications to the default graph items array */
$struct_graph_item["task_item_id"]["sql"] = "select
CONCAT_WS('',data_template.name,' - ',' (',data_template_rrd.data_source_name,')') as name,
data_template_rrd.id
from (data_template_data,data_template_rrd,data_template)
where data_template_rrd.data_template_id=data_template.id
and data_template_data.data_template_id=data_template.id
and data_template_data.local_data_id=0
and data_template_rrd.local_data_id=0
order by data_template.name,data_template_rrd.data_source_name";
$form_array = array();
while (list($field_name, $field_array) = each($struct_graph_item)) {
$form_array += array($field_name => $struct_graph_item[$field_name]);
$form_array[$field_name]["value"] = (isset($template_item) ? $template_item[$field_name] : "");
$form_array[$field_name]["form_id"] = (isset($template_item) ? $template_item["id"] : "0");
}
if (!empty($_GET["id"])) {
/* we want to mark the fields that are associated with a graph item input */
$graph_item_input_fields = db_fetch_assoc("select
graph_template_input.id,
graph_template_input.column_name
from (graph_template_input,graph_template_input_defs)
where graph_template_input.id=graph_template_input_defs.graph_template_input_id
and graph_template_input.graph_template_id=" . $_GET["graph_template_id"] . "
and graph_template_input_defs.graph_template_item_id=" . $_GET["id"] . "
group by graph_template_input.column_name");
if (sizeof($graph_item_input_fields) > 0) {
foreach ($graph_item_input_fields as $field) {
$form_array{$field["column_name"]}["friendly_name"] .= " [<a href='graph_templates_inputs.php?action=input_edit&id=" . $field["id"] . "&graph_template_id=" . $_GET["graph_template_id"] . "'>Field Not Templated</a>]";
}
}
}
draw_edit_form(
array(
"config" => array(
),
"fields" => $form_array
)
);
html_end_box();
form_hidden_box("graph_template_item_id", (isset($template_item) ? $template_item["id"] : "0"), "");
form_hidden_box("graph_template_id", $_GET["graph_template_id"], "0");
form_hidden_box("sequence", (isset($template_item) ? $template_item["sequence"] : "0"), "");
form_hidden_box("_graph_type_id", (isset($template_item) ? $template_item["graph_type_id"] : "0"), "");
form_hidden_box("_task_item_id", (isset($template_item) ? $template_item["task_item_id"] : "0"), "");
form_hidden_box("save_component_item", "1", "");
form_hidden_box("invisible_alpha", $form_array["alpha"]["value"], "FF");
form_hidden_box("rrdtool_version", read_config_option("rrdtool_version"), "");
form_save_button("graph_templates.php?action=template_edit&id=" . $_GET["graph_template_id"]);
//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("Color is '" + document.getElementById('color_id').value + "'");
document.getElementById('alpha').disabled=true;
if ((document.getElementById('rrdtool_version').value != 'rrd-1.0.x') &&
(document.getElementById('color_id').value != 0)) {
document.getElementById('alpha').disabled=false;
//.........这里部分代码省略.........