本文整理汇总了PHP中form_radio_button函数的典型用法代码示例。如果您正苦于以下问题:PHP form_radio_button函数的具体用法?PHP form_radio_button怎么用?PHP form_radio_button使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了form_radio_button函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
}
开发者ID:songchin,项目名称:Cacti,代码行数:80,代码来源:package_form.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>";
开发者ID:songchin,项目名称:Cacti,代码行数:66,代码来源:device_form.php
示例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");
}
开发者ID:teddywen,项目名称:cacti,代码行数:91,代码来源:templates_export.php
示例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;
}
}
开发者ID:teddywen,项目名称:cacti,代码行数:84,代码来源:html_form.php
示例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");
}
开发者ID:BackupTheBerlios,项目名称:odp-svn,代码行数:94,代码来源:templates_import.php
示例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)) {
开发者ID:resmon,项目名称:resmon-cacti,代码行数:67,代码来源:graphs.php
示例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");
}
开发者ID:songchin,项目名称:Cacti,代码行数:101,代码来源:host.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";
}
开发者ID:songchin,项目名称:Cacti,代码行数:101,代码来源:devices.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"
|
请发表评论