本文整理汇总了PHP中form_radio_button函数的典型用法代码示例。如果您正苦于以下问题:PHP form_radio_button函数的具体用法?PHP form_radio_button怎么用?PHP form_radio_button使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了form_radio_button函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _package_field__author_type
function _package_field__author_type($field_name, $field_value = "", $field_id = 0) {
require_once(CACTI_BASE_PATH . "/lib/sys/html_form.php");
require_once(CACTI_BASE_PATH . "/lib/package/package_info.php");
/* obtain a list of existing authors for the dropdown */
$author_list = api_package_author_list();
/* try to be smart about whether to select the "new" or "existing" radio box */
if (($field_value == "") || (in_array($field_value, $author_list))) {
$radio_value = "existing";
}else{
$radio_value = "new";
}
?>
<tr class="<?php echo field_get_row_style();?>">
<td width="50%" class="field-row">
<span class="textEditTitle"><?php echo _("Author Type");?></span><br>
<?php echo _("Whether to generate a new or use an existing author");?>
</td>
<td class="field-row" colspan="2">
<table width="100%" cellspacing="0" cellpadding="2">
<tr>
<td width="1%">
<?php form_radio_button($field_name, $radio_value, "existing", "", "new", "click_author_type_radio()");?>
</td>
<td>
Use existing author
</td>
</tr>
<tr id="<?php echo $field_name . "_tr_drp";?>">
<td>
</td>
<td>
<?php form_dropdown($field_name . "_drp", $author_list, "name", "id", "", "", "");?>
</td>
</tr>
<tr>
<td width="1%">
<?php form_radio_button($field_name, $radio_value, "new", "", "new", "click_author_type_radio()");?>
</td>
<td>
Specify new author
</td>
</tr>
</table>
</td>
</tr>
<script language="JavaScript">
<!--
function click_author_type_radio() {
if (get_radio_value(document.forms[0].<?php echo $field_name;?>) == 'new') {
select_radio_author_type_new();
}else{
select_radio_author_type_existing();
}
}
function select_radio_author_type_new() {
document.getElementById('row_field_package_author_name').style.display = 'table-row';
document.getElementById('row_field_package_author_email').style.display = 'table-row';
document.getElementById('row_field_package_author_user_forum').style.display = 'table-row';
document.getElementById('row_field_package_author_user_repository').style.display = 'table-row';
document.getElementById('<?php echo $field_name;?>_tr_drp').style.display = 'none';
}
function select_radio_author_type_existing() {
document.getElementById('row_field_package_author_name').style.display = 'none';
document.getElementById('row_field_package_author_email').style.display = 'none';
document.getElementById('row_field_package_author_user_forum').style.display = 'none';
document.getElementById('row_field_package_author_user_repository').style.display = 'none';
document.getElementById('<?php echo $field_name;?>_tr_drp').style.display = 'table-row';
}
-->
</script>
<?php
}
示例2: api_device_form_actions
//.........这里部分代码省略.........
$form_array = array();
while (list($field_name, $field_array) = each($fields_device_edit_availability)) {
if (!preg_match("/(^snmp_|max_oids)/", $field_name)) {
$form_array += array($field_name => $fields_device_edit_availability[$field_name]);
$form_array[$field_name]["value"] = "";
$form_array[$field_name]["form_id"] = 0;
$form_array[$field_name]["sub_checkbox"] = array(
"name" => "t_" . $field_name,
"friendly_name" => __("Update this Field"),
"value" => ""
);
}
}
draw_edit_form(
array(
"config" => array("no_form_tag" => true),
"fields" => $form_array
)
);
}elseif (get_request_var_post("drp_action") === DEVICE_ACTION_CLEAR_STATISTICS) { /* Clear Statisitics for Selected Devices */
print " <tr>
<td colspan='2' class='textArea'>
<p>" . __("To clear the counters for the following devices, press the \"yes\" button below.") . "</p>
<p>$device_list</p>
</td>
</tr>";
}elseif (get_request_var_post("drp_action") === DEVICE_ACTION_DELETE) { /* delete */
print " <tr>
<td class='textArea'>
<p>" . __("Are you sure you want to delete the following devices?") . "</p>
<p>$device_list</p>";
form_radio_button("delete_type", "2", "1", __("Leave all graphs and data sources untouched. Data sources will be disabled however."), "1"); print "<br>";
form_radio_button("delete_type", "2", "2", __("Delete all associated <strong>graphs</strong> and <strong>data sources</strong>."), "1"); print "<br>";
print "</td></tr>
</td>
</tr>\n
";
}elseif (get_request_var_post("drp_action") === DEVICE_ACTION_CHANGE_POLLER) { /* Change Poller */
print " <tr>
<td colspan='2' class='textArea'>
<p>" . __("Select the new poller below for the devices(s) below and select 'yes' to continue, or 'no' to return.") . "</p>
<p>$device_list</p>
</td>
</tr>";
$form_array = array();
$field_name = "poller_id";
$form_array += array($field_name => $fields_device_edit["poller_id"]);
$form_array[$field_name]["description"] = __("Please select the new poller for the selected device(s).");
draw_edit_form(
array(
"config" => array("no_form_tag" => true),
"fields" => $form_array
)
);
}elseif (get_request_var_post("drp_action") === DEVICE_ACTION_CHANGE_SITE) { /* Change Site */
print " <tr>
<td colspan='2' class='textArea'>
<p>" . __("Select the new site for the devices(s) below and select 'yes' to continue, or 'no' to return.") . "</p>
<p>$device_list</p>
</td>
</tr>";
示例3: 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");
}
示例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: form_actions
//.........这里部分代码省略.........
if ($_SESSION["permission"] < ACCESS_ADMINISTRATOR) {
if (!in_array($matches[1], $graphs)) {
access_denied();
}
}
/* modify for multi user end */
$graph_list .= "<li>" . get_graph_title($matches[1]) . "</li>";
$graph_array[$i] = $matches[1];
$i++;
}
}
include_once "./include/top_header.php";
/* add a list of tree names to the actions dropdown */
add_tree_names_to_actions_array();
html_start_box("<strong>" . $graph_actions[$_POST["drp_action"]] . "</strong>", "60%", $colors["header_panel"], "3", "center", "");
print "<form action='graphs.php' method='post'>\n";
if (isset($graph_array) && sizeof($graph_array)) {
if ($_POST["drp_action"] == "1") {
/* delete */
$graphs = array();
/* find out which (if any) data sources are being used by this graph, so we can tell the user */
if (isset($graph_array) && sizeof($graph_array)) {
$data_sources = db_fetch_assoc("select\r\n\t\t\t\t\tdata_template_data.local_data_id,\r\n\t\t\t\t\tdata_template_data.name_cache\r\n\t\t\t\t\tfrom (data_template_rrd,data_template_data,graph_templates_item)\r\n\t\t\t\t\twhere graph_templates_item.task_item_id=data_template_rrd.id\r\n\t\t\t\t\tand data_template_rrd.local_data_id=data_template_data.local_data_id\r\n\t\t\t\t\tand " . array_to_sql_or($graph_array, "graph_templates_item.local_graph_id") . "\r\n\t\t\t\t\tand data_template_data.local_data_id > 0\r\n\t\t\t\t\tgroup by data_template_data.local_data_id\r\n\t\t\t\t\torder by data_template_data.name_cache");
}
print "\t<tr>\r\n\t\t\t\t\t<td class='textArea' bgcolor='#" . $colors["form_alternate1"] . "'>\r\n\t\t\t\t\t\t<p>When you click \"Continue\", the following Graph(s) will be deleted. Please note, Data Source(s) should be deleted only if they are only used by these Graph(s)\r\n\t\t\t\t\t\tand not others.</p>\r\n\t\t\t\t\t\t<p><ul>{$graph_list}</ul></p>";
if (isset($data_sources) && sizeof($data_sources)) {
print "<tr bgcolor='#" . $colors["form_alternate1"] . "'><td class='textArea'><p class='textArea'>The following Data Source(s) are in use by these Graph(s):</p>\n";
print "<ul>";
foreach ($data_sources as $data_source) {
print "<li><strong>" . $data_source["name_cache"] . "</strong></li>\n";
}
print "</ul>";
print "<br>";
form_radio_button("delete_type", "1", "1", "Leave the Data Source(s) untouched.", "1");
print "<br>";
form_radio_button("delete_type", "1", "2", "Delete all <strong>Data Source(s)</strong> referenced by these Graph(s).", "1");
print "<br>";
print "</td></tr>";
}
print "\r\n\t\t\t\t\t</td>\r\n\t\t\t\t</tr>\n\r\n\t\t\t\t";
$save_html = "<input type='button' value='Cancel' onClick='window.history.back()'> <input type='submit' value='Continue' title='Delete Graph(s)'>";
} elseif ($_POST["drp_action"] == "2") {
/* change graph template */
/* modify for multi user start */
$sql_where = "";
if ($_SESSION["permission"] < ACCESS_ADMINISTRATOR) {
$sql_where = "WHERE graph_templates.name NOT LIKE '%@system'";
}
print "\t<tr>\r\n\t\t\t\t\t<td class='textArea' bgcolor='#" . $colors["form_alternate1"] . "'>\r\n\t\t\t\t\t\t<p>Choose a Graph Template and click \"Continue\" to change the Graph Template for\r\n\t\t\t\t\t\tthe following Graph(s). Be aware that all warnings will be suppressed during the\r\n\t\t\t\t\t\tconversion, so Graph data loss is possible.</p>\r\n\t\t\t\t\t\t<p><ul>{$graph_list}</ul></p>\r\n\t\t\t\t\t\t<p><strong>New Graph Template:</strong><br>";
form_dropdown("graph_template_id", db_fetch_assoc("select graph_templates.id,graph_templates.name from graph_templates {$sql_where} order by name"), "name", "id", "", "", "0");
print "</p>\r\n\t\t\t\t\t</td>\r\n\t\t\t\t</tr>\n\r\n\t\t\t\t";
/* modify for multi user end */
$save_html = "<input type='button' value='Cancel' onClick='window.history.back()'> <input type='submit' value='Continue' title='Change Graph Template'>";
} elseif ($_POST["drp_action"] == "3") {
/* duplicate */
print "\t<tr>\r\n\t\t\t\t\t<td class='textArea' bgcolor='#" . $colors["form_alternate1"] . "'>\r\n\t\t\t\t\t\t<p>When you click \"Continue\", the following Graph(s) will be duplicated. You can\r\n\t\t\t\t\t\toptionally change the title format for the new Graph(s).</p>\r\n\t\t\t\t\t\t<p><ul>{$graph_list}</ul></p>\r\n\t\t\t\t\t\t<p><strong>Title Format:</strong><br>";
form_text_box("title_format", "<graph_title> (1)", "", "255", "30", "text");
print "</p>\r\n\t\t\t\t\t</td>\r\n\t\t\t\t</tr>\n\r\n\t\t\t\t";
$save_html = "<input type='button' value='Cancel' onClick='window.history.back()'> <input type='submit' value='Continue' title='Duplicate Graph(s)'>";
} elseif ($_POST["drp_action"] == "4") {
/* graph -> graph template */
print "\t<tr>\r\n\t\t\t\t\t<td class='textArea' bgcolor='#" . $colors["form_alternate1"] . "'>\r\n\t\t\t\t\t\t<p>When you click \"Continue\", the following Graph(s) will be converted into Graph Template(s).\r\n\t\t\t\t\t\tYou can optionally change the title format for the new Graph Template(s).</p>\r\n\t\t\t\t\t\t<p><ul>{$graph_list}</ul></p>\r\n\t\t\t\t\t\t<p><strong>Title Format:</strong><br>";
form_text_box("title_format", "<graph_title> Template", "", "255", "30", "text");
print "</p>\r\n\t\t\t\t\t</td>\r\n\t\t\t\t</tr>\n\r\n\t\t\t\t";
$save_html = "<input type='button' value='Cancel' onClick='window.history.back()'> <input type='submit' value='Continue' title='Convert to Graph Template'>";
} elseif (preg_match("/^tr_([0-9]+)\$/", $_POST["drp_action"], $matches)) {
示例7: form_actions
//.........这里部分代码省略.........
if (ereg("^chk_([0-9]+)$", $var, $matches)) {
$host_list .= "<li>" . db_fetch_cell("select description from host where id=" . $matches[1]) . "<br>";
$host_array[$i] = $matches[1];
}
$i++;
}
include_once("./include/top_header.php");
html_start_box("<strong>" . $device_actions{$_POST["drp_action"]} . "</strong>", "60%", $colors["header_panel"], "3", "center", "");
print "<form action='host.php' method='post'>\n";
if ($_POST["drp_action"] == "2") { /* Enable Devices */
print " <tr>
<td colspan='2' class='textArea' bgcolor='#" . $colors["form_alternate1"]. "'>
<p>To enable the following devices, press the \"yes\" button below.</p>
<p>$host_list</p>
</td>
</tr>";
}elseif ($_POST["drp_action"] == "3") { /* Disable Devices */
print " <tr>
<td colspan='2' class='textArea' bgcolor='#" . $colors["form_alternate1"]. "'>
<p>To disable the following devices, press the \"yes\" button below.</p>
<p>$host_list</p>
</td>
</tr>";
}elseif ($_POST["drp_action"] == "4") { /* change snmp options */
print " <tr>
<td colspan='2' class='textArea' bgcolor='#" . $colors["form_alternate1"]. "'>
<p>To change SNMP parameters for the following devices, check the box next to the fields
you want to update, fill in the new value, and click Save.</p>
<p>$host_list</p>
</td>
</tr>";
$form_array = array();
while (list($field_name, $field_array) = each($fields_host_edit)) {
if (ereg("^snmp_", $field_name)) {
$form_array += array($field_name => $fields_host_edit[$field_name]);
$form_array[$field_name]["value"] = "";
$form_array[$field_name]["description"] = "";
$form_array[$field_name]["form_id"] = 0;
$form_array[$field_name]["sub_checkbox"] = array(
"name" => "t_" . $field_name,
"friendly_name" => "Update this Field",
"value" => ""
);
}
}
draw_edit_form(
array(
"config" => array("no_form_tag" => true),
"fields" => $form_array
)
);
}elseif ($_POST["drp_action"] == "5") { /* Clear Statisitics for Selected Devices */
print " <tr>
<td colspan='2' class='textArea' bgcolor='#" . $colors["form_alternate1"]. "'>
<p>To clear the counters for the following devices, press the \"yes\" button below.</p>
<p>$host_list</p>
</td>
</tr>";
}elseif ($_POST["drp_action"] == "1") { /* delete */
print " <tr>
<td class='textArea' bgcolor='#" . $colors["form_alternate1"]. "'>
<p>Are you sure you want to delete the following devices?</p>
<p>$host_list</p>";
form_radio_button("delete_type", "2", "1", "Leave all graphs and data sources untouched.", "1"); print "<br>";
form_radio_button("delete_type", "2", "2", "Delete all associated <strong>graphs</strong> and <strong>data sources</strong>.", "1"); print "<br>";
print "</td></tr>
</td>
</tr>\n
";
}
if (!isset($host_array)) {
print "<tr><td bgcolor='#" . $colors["form_alternate1"]. "'><span class='textError'>You must select at least one device.</span></td></tr>\n";
$save_html = "";
}else{
$save_html = "<input type='image' src='images/button_yes.gif' alt='Save' align='absmiddle'>";
}
print " <tr>
<td colspan='2' align='right' bgcolor='#eaeaea'>
<input type='hidden' name='action' value='actions'>
<input type='hidden' name='selected_items' value='" . (isset($host_array) ? serialize($host_array) : '') . "'>
<input type='hidden' name='drp_action' value='" . $_POST["drp_action"] . "'>
<a href='host.php'><img src='images/button_no.gif' alt='Cancel' align='absmiddle' border='0'></a>
$save_html
</td>
</tr>
";
html_end_box();
include_once("./include/bottom_footer.php");
}
示例8: form_actions
//.........这里部分代码省略.........
}
}
$graphs = db_fetch_assoc("select id from graph where " . array_to_sql_or($selected_items, "host_id"));
if (sizeof($graphs) > 0) {
foreach ($graphs as $graph) {
api_graph_remove($graph["id"]);
}
}
break;
}
api_device_remove($selected_items[$i]);
}
}
header("Location: devices.php");
exit;
}
/* setup some variables */
$host_list = "";
$i = 0;
/* loop through each of the host templates selected on the previous page and get more info about them */
while (list($var, $val) = each($_POST)) {
if (ereg("^chk_([0-9]+)\$", $var, $matches)) {
$host_list .= "<li>" . db_fetch_cell("select description from host where id=" . $matches[1]) . "<br>";
$host_array[$i] = $matches[1];
}
$i++;
}
require_once CACTI_BASE_PATH . "/include/top_header.php";
html_start_box("<strong>" . $device_actions[$_POST["drp_action"]] . "</strong>", "60%", $colors["header_panel_background"], "3", "center", "");
print "<form action='devices.php' method='post'>\n";
if ($_POST["drp_action"] == "2") {
/* Enable Devices */
print "\t<tr>\n\t\t\t\t<td colspan='2' class='textArea' bgcolor='#" . $colors["form_alternate1"] . "'>\n\t\t\t\t\t<p>" . _("To enable the following devices, press the \"yes\" button below.") . "</p>\n\t\t\t\t\t<p>{$host_list}</p>\n\t\t\t\t</td>\n\t\t\t\t</tr>";
} elseif ($_POST["drp_action"] == "3") {
/* Disable Devices */
print "\t<tr>\n\t\t\t\t<td colspan='2' class='textArea' bgcolor='#" . $colors["form_alternate1"] . "'>\n\t\t\t\t\t<p>" . _("To disable the following devices, press the \"yes\" button below.") . "</p>\n\t\t\t\t\t<p>{$host_list}</p>\n\t\t\t\t</td>\n\t\t\t\t</tr>";
} elseif ($_POST["drp_action"] == "4") {
/* change snmp options */
print "\t<tr>\n\t\t\t\t<td colspan='2' class='textArea' bgcolor='#" . $colors["form_alternate1"] . "'>\n\t\t\t\t\t<p>" . _("To change SNMP parameters for the following devices, check the box next to the fields\n\t\t\t\t\tyou want to update, fill in the new value, and click Save.") . "</p>\n\t\t\t\t\t<p>{$host_list}</p>\n\t\t\t\t</td>\n\t\t\t\t</tr>";
$form_array = array();
while (list($field_name, $field_array) = each($fields_host_edit)) {
if (ereg("^snmp_", $field_name) || ereg("^snmpv3_", $field_name)) {
$form_array += array($field_name => $fields_host_edit[$field_name]);
$form_array[$field_name]["value"] = "";
$form_array[$field_name]["description"] = "";
$form_array[$field_name]["form_id"] = 0;
$form_array[$field_name]["sub_checkbox"] = array("name" => "t_" . $field_name, "friendly_name" => _("Update this Field"), "value" => "");
}
}
draw_edit_form(array("config" => array("no_form_tag" => true), "fields" => $form_array));
} elseif ($_POST["drp_action"] == "6") {
/* change poller */
print "\t<tr>\n\t\t\t\t<td colspan='2' class='textArea' bgcolor='#" . $colors["form_alternate1"] . "'>\n\t\t\t\t\t<p>" . _("To change the poller that will, by default handle the processing for the selected host(s)\n\t\t\t\t\tsimply select the host from the list, toggle the checkbox and select yes.") . "</p>\n\t\t\t\t\t<p>{$host_list}</p>\n\t\t\t\t</td>\n\t\t\t\t</tr>";
$form_array = array();
while (list($field_name, $field_array) = each($fields_host_edit)) {
if (ereg("^poller_", $field_name)) {
$form_array += array($field_name => $fields_host_edit[$field_name]);
$form_array[$field_name]["value"] = "";
$form_array[$field_name]["description"] = "";
$form_array[$field_name]["form_id"] = 0;
$form_array[$field_name]["sub_checkbox"] = array("name" => "t_" . $field_name, "friendly_name" => _("Update this Field"), "value" => "");
}
}
draw_edit_form(array("config" => array("no_form_tag" => true), "fields" => $form_array));
} elseif ($_POST["drp_action"] == "7") {
/* change availability options */
print "\t<tr>\n\t\t\t\t<td colspan='2' class='textArea' bgcolor='#" . $colors["form_alternate1"] . "'>\n\t\t\t\t\t<p>" . _("To change the availability detection for your hosts will use by default\n\t\t\t\t\tsimply select the host from the list, make the changes you require and select yes.") . "</p>\n\t\t\t\t\t<p>{$host_list}</p>\n\t\t\t\t</td>\n\t\t\t\t</tr>";
$form_array = array();
while (list($field_name, $field_array) = each($fields_host_edit)) {
if (ereg("^availability_", $field_name) || ereg("^ping_", $field_name)) {
$form_array += array($field_name => $fields_host_edit[$field_name]);
$form_array[$field_name]["value"] = "";
$form_array[$field_name]["description"] = "";
$form_array[$field_name]["form_id"] = 0;
$form_array[$field_name]["sub_checkbox"] = array("name" => "t_" . $field_name, "friendly_name" => _("Update this Field"), "value" => "");
}
}
draw_edit_form(array("config" => array("no_form_tag" => true), "fields" => $form_array));
} elseif ($_POST["drp_action"] == "5") {
/* Clear Statisitics for Selected Devices */
print "\t<tr>\n\t\t\t\t<td colspan='2' class='textArea' bgcolor='#" . $colors["form_alternate1"] . "'>\n\t\t\t\t\t<p>" . _("To clear the counters for the following devices, press the \"yes\" button below.") . "</p>\n\t\t\t\t\t<p>{$host_list}</p>\n\t\t\t\t</td>\n\t\t\t\t</tr>";
} elseif ($_POST["drp_action"] == "1") {
/* delete */
print "\t<tr>\n\t\t\t\t<td class='textArea' bgcolor='#" . $colors["form_alternate1"] . "'>\n\t\t\t\t\t<p>" . _("Are you sure you want to delete the following devices?") . "</p>\n\t\t\t\t\t<p>{$host_list}</p>";
form_radio_button("delete_type", "2", "1", _("Leave all graphs and data sources untouched. Data sources will be disabled however."), "1");
print "<br>";
form_radio_button("delete_type", "2", "2", _("Delete all associated <strong>graphs</strong> and <strong>data sources</strong>."), "1");
print "<br>";
print "</td></tr>\n\t\t\t\t</td>\n\t\t\t</tr>\n\n\t\t\t";
}
if (!isset($host_array)) {
print "<tr><td bgcolor='#" . $colors["form_alternate1"] . "'><span class='textError'>" . _("You must select at least one device.") . "</span></td></tr>\n";
$save_html = "";
} else {
$save_html = "<input type='image' src='" . html_get_theme_images_path("button_yes.gif") . "' alt='" . _("Save") . "' align='absmiddle'>";
}
print "\t<tr>\n\t\t\t<td colspan='2' align='right' bgcolor='#" . $colors["buttonbar_background"] . "'>\n\t\t\t\t<input type='hidden' name='action' value='actions'>\n\t\t\t\t<input type='hidden' name='selected_items' value='" . (isset($host_array) ? serialize($host_array) : '') . "'>\n\t\t\t\t<input type='hidden' name='drp_action' value='" . $_POST["drp_action"] . "'>\n\t\t\t\t<a href='devices.php'><img src='" . html_get_theme_images_path("button_no.gif") . "' alt='" . _("Cancel") . "' align='absmiddle' border='0'></a>\n\t\t\t\t{$save_html}\n\t\t\t</td>\n\t\t</tr>\n\t\t";
html_end_box();
require_once CACTI_BASE_PATH . "/include/bottom_footer.php";
}
示例9: draw_edit_control
function draw_edit_control($field_name, &$field_array) {
require_once(CACTI_BASE_PATH . "/lib/sys/html_tree.php");
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 '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 'textbox_password_single':
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>";
break;
case 'textbox_sv':
form_text_box_sv($field_name, $field_array["value"], $field_array["url_moveup"], $field_array["url_movedown"], $field_array["url_delete"], $field_array["url_add"], ((isset($field_array["force_blank_field"])) ? $field_array["force_blank_field"] : false), ((isset($field_array["max_length"])) ? $field_array["max_length"] : "255"), ((isset($field_array["size"])) ? $field_array["size"] : "40"));
print "<input type='hidden' name='cacti_js_dropdown_redirect_x' value='' id='cacti_js_dropdown_redirect_x'>\n";
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"] : ""));
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["trim_length"])) ? $field_array["trim_length"] : "0"), ((isset($field_array["js_onchange"])) ? $field_array["js_onchange"] : ""));
break;
case 'drop_array_js':
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["trim_length"])) ? $field_array["trim_length"] : "0"), "submit_redirect(\"" . $field_array["form_index"] . "\", \"" . htmlspecialchars($field_array["redirect_url"]) . "\", document.forms[" . $field_array["form_index"] . "].$field_name.options[document.forms[" . $field_array["form_index"] . "].$field_name.selectedIndex].value)");
print "<input type='hidden' name='cacti_js_dropdown_redirect_x' value='' id='cacti_js_dropdown_redirect_x'>\n";
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["trim_length"])) ? $field_array["trim_length"] : "0"), ((isset($field_array["js_onchange"])) ? $field_array["js_onchange"] : ""));
break;
case 'drop_multi':
form_multi_dropdown($field_name, $field_array["array"], db_fetch_assoc($field_array["sql"]), "id");
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");
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["array"], $field_array["value"], ((isset($field_array["none_value"])) ? $field_array["none_value"] : ""), ((isset($field_array["default"])) ? $field_array["default"] : ""), ((isset($field_array["js_onchange"])) ? $field_array["js_onchange"] : ""));
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["js_onclick"])) ? $field_array["js_onclick"] : ""));
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"] : ""));
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"] : ""));
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 $item["name"] . "<br>";
}
}
break;
default:
print "<em>" . $field_array["value"] . "</em>";
form_hidden_box($field_name, $field_array["value"], "");
break;
}
}
示例10: form_actions
//.........这里部分代码省略.........
$i++;
}
}
top_header();
/* add a list of tree names to the actions dropdown */
add_tree_names_to_actions_array();
html_start_box('<strong>' . $graph_actions[$_POST['drp_action']] . '</strong>', '60%', '', '3', 'center', '');
print "<form action='graphs.php' method='post'>\n";
if (isset($graph_array) && sizeof($graph_array)) {
if ($_POST['drp_action'] == '1') {
/* delete */
$graphs = array();
/* find out which (if any) data sources are being used by this graph, so we can tell the user */
if (isset($graph_array) && sizeof($graph_array)) {
$data_sources = db_fetch_assoc('select
data_template_data.local_data_id,
data_template_data.name_cache
from (data_template_rrd,data_template_data,graph_templates_item)
where graph_templates_item.task_item_id=data_template_rrd.id
and data_template_rrd.local_data_id=data_template_data.local_data_id
and ' . array_to_sql_or($graph_array, 'graph_templates_item.local_graph_id') . '
and data_template_data.local_data_id > 0
group by data_template_data.local_data_id
order by data_template_data.name_cache');
}
print "\t<tr>\n\t\t\t\t\t<td class='textArea'>\n\t\t\t\t\t\t<p>When you click \"Continue\", the following Graph(s) will be deleted. Please note, Data Source(s) should be deleted only if they are only used by these Graph(s)\n\t\t\t\t\t\tand not others.</p>\n\t\t\t\t\t\t<p><ul>{$graph_list}</ul></p>";
if (isset($data_sources) && sizeof($data_sources)) {
print "<tr><td class='textArea'><p>The following Data Source(s) are in use by these Graph(s):</p>\n";
print '<ul>';
foreach ($data_sources as $data_source) {
print '<li><strong>' . $data_source['name_cache'] . "</strong></li>\n";
}
print '</ul>';
print '<br>';
form_radio_button('delete_type', '1', '2', "Leave the Data Source(s) untouched. Not applicable for Graphs created under 'New Graphs' or WHERE the Graphs were created automatically.", '2');
print '<br>';
form_radio_button('delete_type', '2', '2', 'Delete all <strong>Data Source(s)</strong> referenced by these Graph(s).', '2');
print '<br>';
print '</td></tr>';
}
print "\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\n\t\t\t\t";
$save_html = "<input type='button' value='Cancel' onClick='window.history.back()'> <input type='submit' value='Continue' title='Delete Graph(s)'>";
} elseif ($_POST['drp_action'] == '2') {
/* change graph template */
print "\t<tr>\n\t\t\t\t\t<td class='textArea'>\n\t\t\t\t\t\t<p>Choose a Graph Template and click \"Continue\" to change the Graph Template for\n\t\t\t\t\t\tthe following Graph(s). Be aware that all warnings will be suppressed during the\n\t\t\t\t\t\tconversion, so Graph data loss is possible.</p>\n\t\t\t\t\t\t<p><ul>{$graph_list}</ul></p>\n\t\t\t\t\t\t<p><strong>New Graph Template:</strong><br>";
form_dropdown('graph_template_id', db_fetch_assoc('SELECT graph_templates.id,graph_templates.name FROM graph_templates ORDER BY name'), 'name', 'id', '', '', '0');
print "</p>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\n\t\t\t\t";
$save_html = "<input type='button' value='Cancel' onClick='window.history.back()'> <input type='submit' value='Continue' title='Change Graph Template'>";
} elseif ($_POST['drp_action'] == '3') {
/* duplicate */
print "\t<tr>\n\t\t\t\t\t<td class='textArea'>\n\t\t\t\t\t\t<p>When you click \"Continue\", the following Graph(s) will be duplicated. You can\n\t\t\t\t\t\toptionally change the title format for the new Graph(s).</p>\n\t\t\t\t\t\t<p><ul>{$graph_list}</ul></p>\n\t\t\t\t\t\t<p><strong>Title Format:</strong><br>";
form_text_box('title_format', '<graph_title> (1)', '', '255', '30', 'text');
print "</p>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\n\t\t\t\t";
$save_html = "<input type='button' value='Cancel' onClick='window.history.back()'> <input type='submit' value='Continue' title='Duplicate Graph(s)'>";
} elseif ($_POST['drp_action'] == '4') {
/* graph -> graph template */
print "\t<tr>\n\t\t\t\t\t<td class='textArea'>\n\t\t\t\t\t\t<p>When you click \"Continue\", the following Graph(s) will be converted into Graph Template(s).\n\t\t\t\t\t\tYou can optionally change the title format for the new Graph Template(s).</p>\n\t\t\t\t\t\t<p><ul>{$graph_list}</ul></p>\n\t\t\t\t\t\t<p><strong>Title Format:</strong><br>";
form_text_box('title_format', '<graph_title> Template', '', '255', '30', 'text');
print "</p>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\n\t\t\t\t";
$save_html = "<input type='button' value='Cancel' onClick='window.history.back()'> <input type='submit' value='Continue' title='Convert to Graph Template'>";
} elseif (preg_match('/^tr_([0-9]+)$/', $_POST['drp_action'], $matches)) {
/* place on tree */
print "\t<tr>\n\t\t\t\t\t<td class='textArea'>\n\t\t\t\t\t\t<p>When you click \"Continue\", the following Graph(s) will be placed under the Tree Branch selected below.</p>\n\t\t\t\t\t\t<p><ul>{$graph_list}</ul></p>\n\t\t\t\t\t\t<p><strong>Destination Branch:</strong><br>";
grow_dropdown_tree($matches[1], '0', 'tree_item_id', '0');
print "</p>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\n\t\t\t\t<input type='hidden' name='tree_id' value='" . $matches[1] . "'>\n\n\t\t\t\t";
$save_html = "<input type='button' value='Cancel' onClick='window.history.back()'> <input type='submit' value='Continue' title='Place Graph(s) on Tree'>";
} elseif ($_POST['drp_action'] == '5') {
/* change host */
print "\t<tr>\n\t\t\t\t\t<td class='textArea'>\n\t\t\t\t\t\t<p>Choose a new Device for these Graph(s) and click \"Continue\"</p>\n\t\t\t\t\t\t<p><ul>{$graph_list}</ul></p>\n\t\t\t\t\t\t<p><strong>New Device:</strong><br>";
form_dropdown('host_id', db_fetch_assoc("SELECT id,CONCAT_WS('',description,' (',hostname,')') as name FROM host ORDER BY description,hostname"), 'name', 'id', '', '', '0');
print "</p>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\n\t\t\t\t";
$save_html = "<input type='button' value='Cancel' onClick='window.history.back()'> <input type='submit' value='Continue' title='Change Graph(s) Associated Device'>";
} elseif ($_POST['drp_action'] == '6') {
/* reapply suggested naming to host */
print "\t<tr>\n\t\t\t\t\t<td class='textArea'>\n\t\t\t\t\t\t<p>When you click \"Continue\", the following Graph(s) will have thier suggested naming convensions\n\t\t\t\t\t\trecalculated and applied to the Graph(s).</p>\n\t\t\t\t\t\t<p><ul>{$graph_list}</ul></p>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\n\t\t\t\t";
$save_html = "<input type='button' value='Cancel' onClick='window.history.back()'> <input type='submit' value='Continue' title='Reapply Suggested Naming to Graph(s)'>";
} elseif ($_POST['drp_action'] == '7') {
/* resize graphs */
print "\t<tr>\n\t\t\t\t\t<td class='textArea'>\n\t\t\t\t\t\t<p>When you click \"Continue\", the following Graph(s) will be resized per your specifications.</p>\n\t\t\t\t\t\t<p><ul>{$graph_list}</ul></p>\n\t\t\t\t\t\t<p><strong>Graph Height:</strong><br>";
form_text_box('graph_height', '', '', '255', '30', 'text');
print '</p>
<p><strong>Graph Width:</strong><br>';
form_text_box('graph_width', '', '', '255', '30', 'text');
print "</p>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\n\t\t\t\t";
$save_html = "<input type='button' value='Cancel' onClick='window.history.back()'> <input type='submit' value='Continue' title='Resize Selected Graph(s)'>";
} else {
$save['drp_action'] = $_POST['drp_action'];
$save['graph_list'] = $graph_list;
$save['graph_array'] = isset($graph_array) ? $graph_array : array();
api_plugin_hook_function('graphs_action_prepare', $save);
$save_html = "<input type='button' value='Cancel' onClick='window.history.back()'> <input type='submit' value='Continue'>";
}
} else {
print "<tr><td class='even'><span class='textError'>You must select at least one graph.</span></td></tr>\n";
$save_html = "<input type='button' value='Return' onClick='window.history.back()'>";
}
print "\t<tr>\n\t\t\t<td align='right' class='saveRow'>\n\t\t\t\t<input type='hidden' name='action' value='actions'>\n\t\t\t\t<input type='hidden' name='selected_items' value='" . (isset($graph_array) ? serialize($graph_array) : '') . "'>\n\t\t\t\t<input type='hidden' name='drp_action' value='" . $_POST['drp_action'] . "'>\n\t\t\t\t{$save_html}\n\t\t\t</td>\n\t\t</tr>\n\t\t";
html_end_box();
bottom_footer();
}
示例11: form_actions
//.........这里部分代码省略.........
while (list($var, $val) = each($_POST)) {
if (preg_match('/^chk_([0-9]+)$/', $var, $matches)) {
/* ================= input validation ================= */
input_validate_input_number($matches[1]);
/* ==================================================== */
$ds_list .= '<li>' . htmlspecialchars(get_data_source_title($matches[1])) . '<br>';
$ds_array[$i] = $matches[1];
$i++;
}
}
top_header();
html_start_box('<strong>' . $ds_actions[$_POST['drp_action']] . '</strong>', '60%', '', '3', 'center', '');
print "<form action='data_sources.php' method='post'>\n";
if (isset($ds_array) && sizeof($ds_array)) {
if ($_POST['drp_action'] == '1') {
/* delete */
$graphs = array();
/* find out which (if any) graphs are using this data source, so we can tell the user */
if (isset($ds_array)) {
$graphs = db_fetch_assoc('SELECT
graph_templates_graph.local_graph_id,
graph_templates_graph.title_cache
FROM (data_template_rrd,graph_templates_item,graph_templates_graph)
WHERE graph_templates_item.task_item_id=data_template_rrd.id
AND graph_templates_item.local_graph_id=graph_templates_graph.local_graph_id
AND ' . array_to_sql_or($ds_array, 'data_template_rrd.local_data_id') . '
AND graph_templates_graph.local_graph_id > 0
GROUP BY graph_templates_graph.local_graph_id
ORDER BY graph_templates_graph.title_cache');
}
print "\t<tr>\n\t\t\t\t\t<td class='textArea'>\n\t\t\t\t\t\t<p>When you click \"Continue\", the following Data Source(s) will be deleted.</p>\n\t\t\t\t\t\t<p><ul>{$ds_list}</ul></p>";
if (sizeof($graphs) > 0) {
print "<tr><td class='textArea'><p class='textArea'>The following graphs are using these data sources:</p>\n";
print '<ul>';
foreach ($graphs as $graph) {
print '<li><strong>' . $graph['title_cache'] . "</strong></li>\n";
}
print '</ul>';
print '<br>';
form_radio_button('delete_type', '3', '1', 'Leave the Graph(s) untouched.', '1');
print '<br>';
form_radio_button('delete_type', '3', '2', 'Delete all <strong>Graph Item(s)</strong> that reference these Data Source(s).', '1');
print '<br>';
form_radio_button('delete_type', '3', '3', 'Delete all <strong>Graph(s)</strong> that reference these Data Source(s).', '1');
print '<br>';
print '</td></tr>';
}
print "\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\n\t\t\t\t";
$save_html = "<input type='button' value='Cancel' onClick='window.history.back()'> <input type='submit' value='Continue' title='Delete Data Source(s)'>";
} elseif ($_POST['drp_action'] == '2') {
/* change graph template */
print "\t<tr>\n\t\t\t\t\t<td class='textArea'>\n\t\t\t\t\t\t<p>Choose a Data Template and click \"Continue\" to change the Data Template for\n\t\t\t\t\t\tthe following Data Source(s). Be aware that all warnings will be suppressed during the\n\t\t\t\t\t\tconversion, so graph data loss is possible.</p>\n\t\t\t\t\t\t<p><ul>{$ds_list}</ul></p>\n\t\t\t\t\t\t<p><strong>New Data Template:</strong><br>";
form_dropdown('data_template_id', db_fetch_assoc('SELECT data_template.id,data_template.name FROM data_template ORDER BY data_template.name'), 'name', 'id', '', '', '0');
print "</p>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\n\t\t\t\t";
$save_html = "<input type='button' value='Cancel' onClick='window.history.back()'> <input type='submit' value='Continue' title='Change Graph Template for Data Source(s)'>";
} elseif ($_POST['drp_action'] == '3') {
/* change host */
print "\t<tr>\n\t\t\t\t\t<td class='textArea'>\n\t\t\t\t\t\t<p>Choose a new Device for these Data Source(s) and click \"Continue\"</p>\n\t\t\t\t\t\t<p><ul>{$ds_list}</ul></p>\n\t\t\t\t\t\t<p><strong>New Device:</strong><br>";
form_dropdown('host_id', db_fetch_assoc("SELECT id, CONCAT_WS('',description,' (',hostname,')') AS name FROM host ORDER BY description, hostname"), 'name', 'id', '', '', '0');
print "</p>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\n\t\t\t\t";
$save_html = "<input type='button' value='Cancel' onClick='window.history.back()'> <input type='submit' value='Continue' title='Change Device'>";
} elseif ($_POST['drp_action'] == '4') {
/* duplicate */
print "\t<tr>\n\t\t\t\t\t<td class='textArea'>\n\t\t\t\t\t\t<p>When you click \"Continue\", the following Data Source(s) will be duplicated. You can\n\t\t\t\t\t\toptionally change the title format for the new Data Source(s).</p>\n\t\t\t\t\t\t<p><ul>{$ds_list}</ul></p>\n\t\t\t\t\t\t<p><strong>Title Format:</strong><br>";
form_text_box('title_format', '<ds_title> (1)', '', '255', '30', 'text');
print "</p>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\n\t\t\t\t";
$save_html = "<input type='button' value='Cancel' onClick='window.history.back()'> <input type='submit' value='Continue' title='Duplicate Data Source(s)'>";
} elseif ($_POST['drp_action'] == '5') {
/* data source -> data template */
print "\t<tr>\n\t\t\t\t\t<td class='textArea'>\n\t\t\t\t\t\t<p>When you click \"Continue\", the following Data Source(s) will be converted into Data Template(s).\n\t\t\t\t\t\tYou can optionally change the title format for the new Data Template(s).</p>\n\t\t\t\t\t\t<p><ul>{$ds_list}</ul></p>\n\t\t\t\t\t\t<p><strong>Title Format:</strong><br>";
form_text_box('title_format', '<ds_title> Template', '', '255', '30', 'text');
print "</p>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\n\t\t\t\t";
$save_html = "<input type='button' value='Cancel' onClick='window.history.back()'> <input type='submit' value='Continue' title='Convert Data Source(s) to Data Template(s)'>";
} elseif ($_POST['drp_action'] == '6') {
/* data source enable */
print "\t<tr>\n\t\t\t\t\t<td class='textArea'>\n\t\t\t\t\t\t<p>When you click \"Continue\", the following Data Source(s) will be enabled.</p>\n\t\t\t\t\t\t<p><ul>{$ds_list}</ul></p>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\n\t\t\t\t";
$save_html = "<input type='button' value='Cancel' onClick='window.history.back()'> <input type='submit' value='Continue' title='Enable Data Source(s)'>";
} elseif ($_POST['drp_action'] == '7') {
/* data source disable */
print "\t<tr>\n\t\t\t\t\t<td class='textArea'>\n\t\t\t\t\t\t<p>When you click \"Continue\", the following Data Source(s) will be disabled.</p>\n\t\t\t\t\t\t<p><ul>{$ds_list}</ul></p>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\n\t\t\t\t";
$save_html = "<input type='button' value='Cancel' onClick='window.history.back()'> <input type='submit' value='Continue' title='Disable Data Source(s)'>";
} elseif ($_POST['drp_action'] == '8') {
/* reapply suggested data source naming */
print "\t<tr>\n\t\t\t\t\t<td class='textArea'>\n\t\t\t\t\t\t<p>When you click \"Continue\", the following Data Source(s) will will have there suggested naming convention\n\t\t\t\t\t\trecalculated.</p>\n\t\t\t\t\t\t<p><ul>{$ds_list}</ul></p>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\n\t\t\t\t";
$save_html = "<input type='button' value='Cancel' onClick='window.history.back()'> <input type='submit' value='Continue' title='Reapply Suggested Naming to Data Source(s)'>";
} else {
$save['drp_action'] = $_POST['drp_action'];
$save['ds_list'] = $ds_list;
$save['ds_array'] = isset($ds_array) ? $ds_array : array();
api_plugin_hook_function('data_source_action_prepare', $save);
$save_html = "<input type='button' value='Cancel' onClick='window.history.back()'> <input type='submit' value='Continue'>";
}
} else {
print "<tr><td class='even'><span class='textError'>You must select at least one data source.</span></td></tr>\n";
$save_html = "<input type='button' value='Return' onClick='window.history.back()'>";
}
print "\t<tr>\n\t\t\t<td align='right' class='saveRow'>\n\t\t\t\t<input type='hidden' name='action' value='actions'>\n\t\t\t\t<input type='hidden' name='selected_items' value='" . (isset($ds_array) ? serialize($ds_array) : '') . "'>\n\t\t\t\t<input type='hidden' name='drp_action' value='" . $_POST['drp_action'] . "'>\n\t\t\t\t{$save_html}\n\t\t\t</td>\n\t\t</tr>\n\t\t";
html_end_box();
bottom_footer();
}
示例12: 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 class='tableRow'>
<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) . "'";
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');
}
示例13: _data_query_field_field__method
function _data_query_field_field__method($field_value_method_type = "", $field_value_method_value = "", $field_id = 0) {
require_once(CACTI_BASE_PATH . "/include/data_query/data_query_constants.php");
require_once(CACTI_BASE_PATH . "/lib/sys/html_form.php");
$row_class = field_get_row_style();
if ($field_value_method_type == "") {
$field_value_method_group = DATA_QUERY_FIELD_METHOD_GROUP_VALUE;
}else if (($field_value_method_type == DATA_QUERY_FIELD_METHOD_VALUE) || ($field_value_method_type == DATA_QUERY_FIELD_METHOD_VALUE_PARSE)) {
$field_value_method_group = DATA_QUERY_FIELD_METHOD_GROUP_VALUE;
}else{
$field_value_method_group = DATA_QUERY_FIELD_METHOD_GROUP_OID;
}
?>
<script language="JavaScript">
<!--
function init_method_field() {
if (get_radio_value(document.forms[0].method_group) == <?php echo DATA_QUERY_FIELD_METHOD_GROUP_VALUE;?>) {
enable_radio_value();
}else if (get_radio_value(document.forms[0].method_group) == <?php echo DATA_QUERY_FIELD_METHOD_GROUP_OID;?>) {
enable_radio_oid();
}
}
function enable_radio_value() {
document.getElementById("method_type_s_3").disabled = true;
document.getElementById("method_type_s_4").disabled = true;
document.getElementById("method_value_s_octet").disabled = true;
document.getElementById("method_value_s_parse").disabled = true;
document.getElementById("tx_s_octet").className = "disabled";
document.getElementById("tx_s_parse").className = "disabled";
document.getElementById("method_type_v_1").disabled = false;
document.getElementById("method_type_v_2").disabled = false;
if (get_radio_value(document.forms[0].method_type_v) == <?php echo DATA_QUERY_FIELD_METHOD_VALUE;?>) {
enable_radio_v_value()
}else if (get_radio_value(document.forms[0].method_type_v) == <?php echo DATA_QUERY_FIELD_METHOD_VALUE_PARSE;?>) {
enable_radio_v_parse();
}
document.getElementById("tx_v_value").className = "enabled";
document.getElementById("tx_v_parse").className = "enabled";
}
function enable_radio_oid() {
document.getElementById("method_type_s_3").disabled = false;
document.getElementById("method_type_s_4").disabled = false;
if (get_radio_value(document.forms[0].method_type_s) == <?php echo DATA_QUERY_FIELD_METHOD_OID_OCTET;?>) {
enable_radio_s_octet();
}else if (get_radio_value(document.forms[0].method_type_s) == <?php echo DATA_QUERY_FIELD_METHOD_OID_PARSE;?>) {
enable_radio_s_parse();
}
document.getElementById("tx_s_octet").className = "enabled";
document.getElementById("tx_s_parse").className = "enabled";
document.getElementById("method_type_v_1").disabled = true;
document.getElementById("method_type_v_2").disabled = true;
document.getElementById("method_value_v_parse").disabled = true;
document.getElementById("tx_v_value").className = "disabled";
document.getElementById("tx_v_parse").className = "disabled";
}
function enable_radio_v_value() {
document.getElementById("method_value_v_parse").disabled = true;
}
function enable_radio_v_parse() {
document.getElementById("method_value_v_parse").disabled = false;
}
function enable_radio_s_octet() {
document.getElementById("method_value_s_octet").disabled = false;
document.getElementById("method_value_s_parse").disabled = true;
}
function enable_radio_s_parse() {
document.getElementById("method_value_s_octet").disabled = true;
document.getElementById("method_value_s_parse").disabled = false;
}
-->
</script>
<tr class="<?php echo $row_class;?>">
<td width="50%" class="field-row">
<span class="textEditTitle"><?php echo _("Retrieval Method");?></span><br>
<?php echo _("Determines how data from this field is derived from walking the base SNMP OID.");?>
</td>
<td class="field-row" colspan="2">
<table width="100%" cellpadding="1" cellspacing="0">
<tr>
<td width="1">
<?php form_radio_button("method_group", $field_value_method_group, DATA_QUERY_FIELD_METHOD_GROUP_VALUE, "", DATA_QUERY_FIELD_METHOD_GROUP_VALUE, "enable_radio_value()");?>
</td>
<td colspan="2">
<span id="tx_v">Value</span>
//.........这里部分代码省略.........
示例14: graph_form_actions
//.........这里部分代码省略.........
<p>" . __("You did not select a valid action. Please select 'Return' to return to the previous menu.") . "</p>
</td>
</tr>\n";
}elseif (get_request_var_post("drp_action") === GRAPH_ACTION_DELETE) { /* delete */
$graphs = array();
/* find out which (if any) data sources are being used by this graph, so we can tell the user */
if (isset($graph_array)) {
$data_sources = db_fetch_assoc("select
data_template_data.local_data_id,
data_template_data.name_cache
from (data_template_rrd,data_template_data,graph_templates_item)
where graph_templates_item.task_item_id=data_template_rrd.id
and data_template_rrd.local_data_id=data_template_data.local_data_id
and " . array_to_sql_or($graph_array, "graph_templates_item.local_graph_id") . "
and data_template_data.local_data_id > 0
group by data_template_data.local_data_id
order by data_template_data.name_cache");
}
print " <tr>
<td class='textArea'>
<p>" . __("Are you sure you want to delete the following graphs?") . "</p>
<p>$graph_list</p>
";
if (sizeof($data_sources) > 0) {
print "<tr class='rowAlternate1'><td class='textArea'><p class='textArea'>" . __("The following data sources are in use by these graphs:") . "</p>\n";
foreach ($data_sources as $data_source) {
print "<strong>" . $data_source["name_cache"] . "</strong><br>\n";
}
print "<br>";
form_radio_button("delete_type", "1", "1", __("Leave the data sources untouched."), "1"); print "<br>";
form_radio_button("delete_type", "1", "2", __("Delete all <strong>data sources</strong> referenced by these graphs."), "1"); print "<br>";
print "</td></tr>";
}
print "
</td>
</tr>\n
";
}elseif (get_request_var_post("drp_action") === GRAPH_ACTION_CHANGE_TEMPLATE) { /* change graph template */
print " <tr>
<td class='textArea'>
<p>" . __("Choose a graph template and click save to change the graph template for the following graphs. Be aware that all warnings will be suppressed during the conversion, so graph data loss is possible.") . "</p>
<p>$graph_list</p>
<p><strong>" . __("New Graph Template:") . "</strong><br>"; form_dropdown("graph_template_id",db_fetch_assoc("select graph_templates.id,graph_templates.name from graph_templates order by name"),"name","id","","","0"); print "</p>
</td>
</tr>\n
";
}elseif (get_request_var_post("drp_action") === GRAPH_ACTION_DUPLICATE) { /* duplicate */
print " <tr>
<td class='textArea'>
<p>" . __("When you click save, the following graphs will be duplicated. You can optionally change the title format for the new graphs.") . "</p>
<p>$graph_list</p>
<p><strong>" . __("Title Format:") . "</strong><br>"; form_text_box("title_format", __("<graph_title> (1)"), "", "255", "30", "text"); print "</p>
</td>
</tr>\n
";
}elseif (get_request_var_post("drp_action") === GRAPH_ACTION_CONVERT_TO_TEMPLATE) { /* graph -> graph template */
print " <tr>
<td class='textArea'>
<p>" . __("When you click save, the following graphs will be converted into graph templates. You can optionally change the title format for the new graph templates.") . "</p>
<p>$graph_list</p>
<p><strong>" . __("Title Format:") . "</strong><br>"; form_text_box("title_format", __("<graph_title> Template"), "", "255", "30", "text"); print "</p>
</td>
示例15: form_actions
//.........这里部分代码省略.........
api_plugin_hook_function('data_source_action_bottom', array($_POST['drp_action'], $selected_items));
}
header("Location: data_sources.php");
exit;
}
/* setup some variables */
$ds_list = "";
$i = 0;
/* loop through each of the graphs selected on the previous page and get more info about them */
while (list($var, $val) = each($_POST)) {
if (preg_match("/^chk_([0-9]+)\$/", $var, $matches)) {
/* ================= input validation ================= */
input_validate_input_number($matches[1]);
/* ==================================================== */
$ds_list .= "<li>" . htmlspecialchars(get_data_source_title($matches[1])) . "</li>";
$ds_array[$i] = $matches[1];
$i++;
}
}
include_once "./include/top_header.php";
html_start_box("<strong>" . $ds_actions[$_POST["drp_action"]] . "</strong>", "60%", "", "3", "center", "");
print "<form action='data_sources.php' method='post'>\n";
if (isset($ds_array) && sizeof($ds_array)) {
if ($_POST["drp_action"] == "1") {
/* delete */
$graphs = array();
/* find out which (if any) graphs are using this data source, so we can tell the user */
if (isset($ds_array)) {
$graphs = db_fetch_assoc("select\n\t\t\t\t\tgraph_templates_graph.local_graph_id,\n\t\t\t\t\tgraph_templates_graph.title_cache\n\t\t\t\t\tfrom (data_template_rrd,graph_templates_item,graph_templates_graph)\n\t\t\t\t\twhere graph_templates_item.task_item_id=data_template_rrd.id\n\t\t\t\t\tand graph_templates_item.local_graph_id=graph_templates_graph.local_graph_id\n\t\t\t\t\tand " . array_to_sql_or($ds_array, "data_template_rrd.local_data_id") . "\n\t\t\t\t\tand graph_templates_graph.local_graph_id > 0\n\t\t\t\t\tgroup by graph_templates_graph.local_graph_id\n\t\t\t\t\torder by graph_templates_graph.title_cache");
}
print "\t<tr>\n\t\t\t\t\t<td class='textArea'>\n\t\t\t\t\t\t<p>When you click \"Continue\", the following Data Source(s) will be deleted.</p>\n\t\t\t\t\t\t<p><ul>{$ds_list}</ul></p>";
if (sizeof($graphs) > 0) {
print "<tr><td class='textArea'><p class='textArea'>The following graphs are using these data sources:</p>\n";
print "<ul>";
foreach ($graphs as $graph) {
print "<li><strong>" . $graph["title_cache"] . "</strong></li>\n";
}
print "</ul>";
print "<br>";
form_radio_button("delete_type", "3", "1", "Leave the Graph(s) untouched.", "1");
print "<br>";
form_radio_button("delete_type", "3", "2", "Delete all <strong>Graph Item(s)</strong> that reference these Data Source(s).", "1");
print "<br>";
form_radio_button("delete_type", "3", "3", "Delete all <strong>Graph(s)</strong> that reference these Data Source(s).", "1");
print "<br>";
print "</td></tr>";
}
print "\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\n\t\t\t\t";
$save_html = "<input type='button' value='Cancel' onClick='window.history.back()'> <input type='submit' value='Continue' title='Delete Data Source(s)'>";
} elseif ($_POST["drp_action"] == "2") {
/* change graph template */
print "\t<tr>\n\t\t\t\t\t<td class='textArea'>\n\t\t\t\t\t\t<p>Choose a Data Template and click \"Continue\" to change the Data Template for\n\t\t\t\t\t\tthe following Data Source(s). Be aware that all warnings will be suppressed during the\n\t\t\t\t\t\tconversion, so graph data loss is possible.</p>\n\t\t\t\t\t\t<p><ul>{$ds_list}</ul></p>\n\t\t\t\t\t\t<p><strong>New Data Template:</strong><br>";
form_dropdown("data_template_id", db_fetch_assoc("select data_template.id,data_template.name from data_template order by data_template.name"), "name", "id", "", "", "0");
print "</p>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\n\t\t\t\t";
$save_html = "<input type='button' value='Cancel' onClick='window.history.back()'> <input type='submit' value='Continue' title='Change Graph Template for Data Source(s)'>";
} elseif ($_POST["drp_action"] == "3") {
/* change host */
print "\t<tr>\n\t\t\t\t\t<td class='textArea'>\n\t\t\t\t\t\t<p>Choose a new Device for these Data Source(s) and click \"Continue\"</p>\n\t\t\t\t\t\t<p><ul>{$ds_list}</ul></p>\n\t\t\t\t\t\t<p><strong>New Host:</strong><br>";
form_dropdown("host_id", db_fetch_assoc("select id,CONCAT_WS('',description,' (',hostname,')') as name from host order by description,hostname"), "name", "id", "", "", "0");
print "</p>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\n\t\t\t\t";
$save_html = "<input type='button' value='Cancel' onClick='window.history.back()'> <input type='submit' value='Continue' title='Change Device'>";
} elseif ($_POST["drp_action"] == "4") {
/* duplicate */
print "\t<tr>\n\t\t\t\t\t<td class='textArea'>\n\t\t\t\t\t\t<p>When you click \"Continue\", the following Data Source(s) will be duplicated. You can\n\t\t\t\t\t\toptionally change the title format for the new Data Source(s).</p>\n\t\t\t\t\t\t<p><ul>{$ds_list}</ul></p>\n\t\t\t\t\t\t<p><strong>Title Format:</strong><br>";
form_text_box("title_format", "<ds_title> (1)", "", "255", "30", "text");
print "</p>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\n\t\t\t\t";
$save_html = "<input type='button' value='Cancel' onClick='window.history.back()'> <input type='submit' value='Continue' title='Duplicate Data Source(s)'>";
} elseif ($_POST["drp_action"] == "5") {
/* data source -> data template */
print "\t<tr>\n\t\t\t\t\t<td class='textArea'>\n\t\t\t\t\t\t<p>When you click \"Continue\", the following Data Source(s) will be converted into Data Template(s).\n\t\t\t\t\t\tYou can optionally change the title format for the new Data Template(s).</p>\n\t\t\t\t\t\t<p><ul>{$ds_list}</ul></p>\n\t\t\t\t\t\t<p><strong>Title Format:</strong><br>";
form_text_box("title_format", "<ds_title> Template", "", "255", "30", "text");
print "</p>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\n\t\t\t\t";
$save_html = "<input type='button' value='Cancel' onClick='window.history.back()'> <input type='submit' value='Continue' title='Convert Data Source(s) to Data Template(s)'>";
} elseif ($_POST["drp_action"] == "6") {
/* data source enable */
print "\t<tr>\n\t\t\t\t\t<td class='textArea'>\n\t\t\t\t\t\t<p>When you click \"Continue\", the following Data Source(s) will be enabled.</p>\n\t\t\t\t\t\t<p><ul>{$ds_list}</ul></p>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\n\t\t\t\t";
$save_html = "<input type='button' value='Cancel' onClick='window.history.back()'> <input type='submit' value='Continue' title='Enable Data Source(s)'>";
} elseif ($_POST["drp_action"] == "7") {
/* data source disable */
print "\t<tr>\n\t\t\t\t\t<td class='textArea'>\n\t\t\t\t\t\t<p>When you click \"Continue\", the following Data Source(s) will be disabled.</p>\n\t\t\t\t\t\t<p><ul>{$ds_list}</ul></p>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\n\t\t\t\t";
$save_html = "<input type='button' value='Cancel' onClick='window.history.back()'> <input type='submit' value='Continue' title='Disable Data Source(s)'>";
} elseif ($_POST["drp_action"] == "8") {
/* reapply suggested data source naming */
print "\t<tr>\n\t\t\t\t\t<td class='textArea'>\n\t\t\t\t\t\t<p>When you click \"Continue\", the following Data Source(s) will will have there suggested naming convention\n\t\t\t\t\t\trecalculated.</p>\n\t\t\t\t\t\t<p><ul>{$ds_list}</ul></p>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\n\t\t\t\t";
$save_html = "<input type='button' value='Cancel' onClick='window.history.back()'> <input type='submit' value='Continue' title='Reapply Suggested Naming to Data Source(s)'>";
} else {
$save['drp_action'] = $_POST['drp_action'];
$save['ds_list'] = $ds_list;
$save['ds_array'] = isset($ds_array) ? $ds_array : array();
api_plugin_hook_function('data_source_action_prepare', $save);
$save_html = "<input type='button' value='Cancel' onClick='window.history.back()'> <input type='submit' value='Continue'>";
}
} else {
print "<tr><td class='even'><span class='textError'>You must select at least one data source.</span></td></tr>\n";
$save_html = "<input type='button' value='Return' onClick='window.history.back()'>";
}
print "\t<tr>\n\t\t\t<td align='right' class='saveRow'>\n\t\t\t\t<input type='hidden' name='action' value='actions'>\n\t\t\t\t<input type='hidden' name='selected_items' value='" . (isset($ds_array) ? serialize($ds_array) : '') . "'>\n\t\t\t\t<input type='hidden' name='drp_action' value='" . $_POST["drp_action"] . "'>\n\t\t\t\t{$save_html}\n\t\t\t</td>\n\t\t</tr>\n\t\t";
html_end_box();
include_once "./include/bottom_footer.php";
}