本文整理汇总了PHP中html_start_box函数的典型用法代码示例。如果您正苦于以下问题:PHP html_start_box函数的具体用法?PHP html_start_box怎么用?PHP html_start_box使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了html_start_box函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wmGenerateFooterLinks
function wmGenerateFooterLinks()
{
global $colors;
global $WEATHERMAP_VERSION;
print '<br />';
html_start_box("<center><a target=\"_blank\" class=\"linkOverDark\" href=\"docs/\">Local Documentation</a> -- " . "<a target=\"_blank\" class=\"linkOverDark\" href=\"http://www.network-weathermap.com/\">Weathermap" . " Website</a> -- <a target=\"_target\" class=\"linkOverDark\" " . "href=\"weathermap-cacti-plugin-editor.php?plug=1\">Weathermap Editor</a> -- " . "This is version {$WEATHERMAP_VERSION}</center>", "78%", $colors["header"], "2", "center", "");
html_end_box();
}
示例2: thold_add_select_host
function thold_add_select_host()
{
global $config;
$host_id = get_filter_request_var('host_id');
$local_graph_id = get_filter_request_var('local_graph_id');
$data_template_rrd_id = get_filter_request_var('data_template_rrd_id');
$hosts = get_allowed_devices();
top_header();
form_start('thold.php?action=save', 'tholdform');
html_start_box(__('Threshold Creation Wizard'), '50%', '', '3', 'center', '');
if ($host_id == '') {
print '<tr><td class="center">' . __('Please select a Device') . '</td></tr>';
} else {
if ($local_graph_id == '') {
print '<tr><td class="center">' . __('Please select a Graph') . '</td></tr>';
} else {
if ($data_template_rrd_id == '') {
print '<tr><td class="center">' . __('Please select a Data Source') . '</td></tr>';
} else {
print '<tr><td class="center">' . __('Please press \'Create\' to activate your Threshold') . '</td></tr>';
}
}
}
html_end_box();
html_start_box('', '50%', '', '3', 'center', '');
/* display the host dropdown */
?>
<tr><td><table class='filterTable' align='center'>
<tr>
<?php
print html_host_filter(get_request_var('host_id'));
?>
</tr><?php
if ($host_id != '') {
$graphs = get_allowed_graphs('gl.host_id=' . $host_id);
?>
<tr>
<td>
<?php
print __('Graph');
?>
</td>
<td>
<select id='local_graph_id' name='local_graph_id' onChange='applyFilter("graph")'>
<option value=''></option><?php
foreach ($graphs as $row) {
echo "<option value='" . $row['local_graph_id'] . "'" . ($row['local_graph_id'] == $local_graph_id ? ' selected' : '') . '>' . htmlspecialchars($row['title_cache'], ENT_QUOTES) . '</option>';
}
?>
</select>
</td>
</tr><?php
} else {
?>
<tr>
<td>
<input type='hidden' id='local_graph_id' name='local_graph_id' value=''>
</td>
</tr><?php
}
if ($local_graph_id != '') {
$dt_sql = 'SELECT DISTINCT dtr.local_data_id
FROM data_template_rrd AS dtr
LEFT JOIN graph_templates_item AS gti
ON gti.task_item_id=dtr.id
LEFT JOIN graph_local AS gl
ON gl.id=gti.local_graph_id
WHERE gl.id = ' . $local_graph_id;
$local_data_id = db_fetch_cell($dt_sql);
$dss = db_fetch_assoc('SELECT DISTINCT id, data_source_name
FROM data_template_rrd
WHERE local_data_id IN (' . $dt_sql . ') ORDER BY data_source_name');
/* show the data source options */
?>
<tr>
<td>
<?php
print __('Data Source');
?>
</td>
<td>
<input type='hidden' id='local_data_id' name='local_data_id' value='<?php
print $local_data_id;
?>
'>
<select id='data_template_rrd_id' name='data_template_rrd_id' onChange='applyFilter("ds")'>
<option value=''></option><?php
foreach ($dss as $row) {
echo "<option value='" . $row['id'] . "'" . ($row['id'] == $data_template_rrd_id ? ' selected' : '') . '>' . htmlspecialchars($row['data_source_name'], ENT_QUOTES) . '</option>';
}
?>
</select>
</td>
</tr></table></td></tr><?php
} else {
?>
<tr>
<td>
<input type='hidden' id='data_template_rrd_id' name='data_template_rrd_id' value=''>
</td>
//.........这里部分代码省略.........
示例3: item_edit
function item_edit() {
global $colors, $struct_graph_item, $graph_item_types, $consolidation_functions;
if (!empty($_GET["id"])) {
$template_item = db_fetch_row("select * from graph_templates_item where id=" . $_GET["id"]);
$host_id = db_fetch_cell("select host_id from graph_local where id=" . $_GET["local_graph_id"]);
}
$header_label = "[edit graph: " . db_fetch_cell("select title_cache from graph_templates_graph where local_graph_id=" . $_GET["local_graph_id"]) . "]";
html_start_box("<strong>Graph Items</strong> $header_label", "98%", $colors["header"], "3", "center", "");
/* by default, select the LAST DS chosen to make everyone's lives easier */
if (!empty($_GET["local_graph_id"])) {
$default = db_fetch_row("select task_item_id from graph_templates_item where local_graph_id=" . $_GET["local_graph_id"] . " order by sequence DESC");
if (sizeof($default) > 0) {
$struct_graph_item["task_item_id"]["default"] = $default["task_item_id"];
}else{
$struct_graph_item["task_item_id"]["default"] = 0;
}
/* modifications to the default graph items array */
$struct_graph_item["task_item_id"]["sql"] = "select
CONCAT_WS('',case when host.description is null then 'No Host' when host.description is not null then host.description end,' - ',data_template_data.name_cache,' (',data_template_rrd.data_source_name,')') as name,
data_template_rrd.id
from data_template_data,data_template_rrd,data_local
left join host on data_local.host_id=host.id
where data_template_rrd.local_data_id=data_local.id
and data_template_data.local_data_id=data_local.id
" . (((!empty($host_id)) || (!empty($_GET["host_id"]))) ? (!empty($host_id) ? " and data_local.host_id=$host_id" : " and data_local.host_id=" . $_GET["host_id"]) : "") . "
order by name";
}
$form_array = array();
while (list($field_name, $field_array) = each($struct_graph_item)) {
$form_array += array($field_name => $struct_graph_item[$field_name]);
$form_array[$field_name]["value"] = (isset($template_item) ? $template_item[$field_name] : "");
$form_array[$field_name]["form_id"] = (isset($template_item) ? $template_item["id"] : "0");
}
draw_edit_form(
array(
"config" => array(
),
"fields" => $form_array
)
);
form_hidden_box("local_graph_id", $_GET["local_graph_id"], "0");
form_hidden_box("graph_template_item_id", (isset($template_item) ? $template_item["id"] : "0"), "");
form_hidden_box("local_graph_template_item_id", (isset($template_item) ? $template_item["local_graph_template_item_id"] : "0"), "");
form_hidden_box("graph_template_id", (isset($template_item) ? $template_item["graph_template_id"] : "0"), "");
form_hidden_box("sequence", (isset($template_item) ? $template_item["sequence"] : "0"), "");
form_hidden_box("_graph_type_id", (isset($template_item) ? $template_item["graph_type_id"] : "0"), "");
form_hidden_box("save_component_item", "1", "");
html_end_box();
form_save_button("graphs.php?action=graph_edit&id=" . $_GET["local_graph_id"]);
}
示例4: graphs
function graphs()
{
global $item_rows;
/* ================= input validation ================= */
input_validate_input_number(get_request_var_request('host_id'));
input_validate_input_number(get_request_var_request('graph_type'));
input_validate_input_number(get_request_var_request('rows'));
/* ==================================================== */
/* clean up search string */
if (isset($_REQUEST['filter'])) {
$_REQUEST['filter'] = sanitize_search_string(get_request_var_request('filter'));
}
/* if the user pushed the 'clear' button */
if (isset($_REQUEST['clear_x'])) {
kill_session_var('sess_graphs_new_filter');
kill_session_var('sess_default_rows');
unset($_REQUEST['filter']);
unset($_REQUEST['rows']);
$changed = true;
} else {
/* if any of the settings changed, reset the page number */
$changed = false;
$changed += check_changed('host_id', 'sess_graphs_new_host_id');
$changed += check_changed('graph_type', 'sess_graphs_new_graph_type');
$changed += check_changed('filter', 'sess_graphs_new_filter');
$changed += check_changed('rows', 'sess_default_rows');
}
load_current_session_value('host_id', 'sess_graphs_new_host_id', db_fetch_cell('SELECT id FROM host ORDER BY description, hostname LIMIT 1'));
load_current_session_value('graph_type', 'sess_graphs_new_graph_type', read_config_option('default_graphs_new_dropdown'));
load_current_session_value('filter', 'sess_graphs_new_filter', '');
load_current_session_value('rows', 'sess_default_rows', read_config_option('num_rows_table'));
if (!empty($_REQUEST['host_id'])) {
$host = db_fetch_row_prepared('SELECT id, description, hostname, host_template_id FROM host WHERE id = ?', array($_REQUEST['host_id']));
$header = ' [ ' . htmlspecialchars($host['description']) . ' (' . htmlspecialchars($host['hostname']) . ') ' . (!empty($host['host_template_id']) ? htmlspecialchars(db_fetch_cell_prepared('SELECT name FROM host_template WHERE id = ?', array($host['host_template_id']))) : '') . ' ]';
} else {
$host = array();
$header = 'None Host Type';
}
$row_limit = get_request_var_request('rows');
html_start_box("<strong>New Graphs for</strong> {$header}", '100%', '', '3', 'center', '');
form_alternate_row();
print '<td class="even">';
?>
<script type='text/javascript'>
<!--
function applyFilter() {
strURL = '?graph_type=' + $('#graph_type').val();
strURL = strURL + '&host_id=' + $('#host_id').val();
strURL = strURL + '&filter=' + $('#filter').val();;
strURL = strURL + '&rows=' + $('#rows').val();;
document.location = strURL;
}
-->
</script>
<form name='form_graphs_new' action='graphs_new.php'>
<table width='100%' cellpadding='2' cellspacing='0' border='0' align='left'>
<tr>
<?php
print html_host_filter($_REQUEST['host_id']);
?>
<td style='white-space:nowrap;' width='1'>
Graph Types
</td>
<td width='1'>
<select id='graph_type' name='graph_type' onChange='applyFilter()'>
<option value='-2'<?php
if ($_REQUEST['graph_type'] == '-2') {
?>
selected<?php
}
?>
>All</option>
<option value='-1'<?php
if ($_REQUEST['graph_type'] == '-1') {
?>
selected<?php
}
?>
>Graph Template Based</option>
<?php
$snmp_queries = db_fetch_assoc_prepared('SELECT
snmp_query.id,
snmp_query.name,
snmp_query.xml_path
FROM (snmp_query, host_snmp_query)
WHERE host_snmp_query.snmp_query_id = snmp_query.id
AND host_snmp_query.host_id = ?
ORDER BY snmp_query.name', array($host['id']));
if (sizeof($snmp_queries) > 0) {
foreach ($snmp_queries as $query) {
print "<option value='" . $query['id'] . "'";
if ($_REQUEST['graph_type'] == $query['id']) {
print ' selected';
}
print '>' . $query['name'] . "</option>\n";
}
}
?>
//.........这里部分代码省略.........
示例5: graph
function graph() {
global $colors, $graph_actions, $item_rows;
/* ================= input validation ================= */
input_validate_input_number(get_request_var_request("host_id"));
input_validate_input_number(get_request_var_request("graph_rows"));
input_validate_input_number(get_request_var_request("template_id"));
input_validate_input_number(get_request_var_request("page"));
/* ==================================================== */
/* clean up search string */
if (isset($_REQUEST["filter"])) {
$_REQUEST["filter"] = sanitize_search_string(get_request_var("filter"));
}
/* clean up sort_column string */
if (isset($_REQUEST["sort_column"])) {
$_REQUEST["sort_column"] = sanitize_search_string(get_request_var("sort_column"));
}
/* clean up sort_direction string */
if (isset($_REQUEST["sort_direction"])) {
$_REQUEST["sort_direction"] = sanitize_search_string(get_request_var("sort_direction"));
}
/* if the user pushed the 'clear' button */
if (isset($_REQUEST["clear_x"])) {
kill_session_var("sess_graph_current_page");
kill_session_var("sess_graph_filter");
kill_session_var("sess_graph_sort_column");
kill_session_var("sess_graph_sort_direction");
kill_session_var("sess_graph_host_id");
kill_session_var("sess_graph_rows");
kill_session_var("sess_graph_template_id");
unset($_REQUEST["page"]);
unset($_REQUEST["filter"]);
unset($_REQUEST["sort_column"]);
unset($_REQUEST["sort_direction"]);
unset($_REQUEST["host_id"]);
unset($_REQUEST["graph_rows"]);
unset($_REQUEST["template_id"]);
}
/* remember these search fields in session vars so we don't have to keep passing them around */
load_current_session_value("page", "sess_graph_current_page", "1");
load_current_session_value("filter", "sess_graph_filter", "");
load_current_session_value("sort_column", "sess_graph_sort_column", "title_cache");
load_current_session_value("sort_direction", "sess_graph_sort_direction", "ASC");
load_current_session_value("host_id", "sess_graph_host_id", "-1");
load_current_session_value("graph_rows", "sess_graph_rows", read_config_option("num_rows_graph"));
load_current_session_value("template_id", "sess_graph_template_id", "-1");
/* if the number of rows is -1, set it to the default */
if (get_request_var_request("graph_rows") == -1) {
$_REQUEST["graph_rows"] = read_config_option("num_rows_graph");
}
?>
<script type="text/javascript">
<!--
function applyGraphsFilterChange(objForm) {
strURL = '?host_id=' + objForm.host_id.value;
strURL = strURL + '&graph_rows=' + objForm.graph_rows.value;
strURL = strURL + '&filter=' + objForm.filter.value;
strURL = strURL + '&template_id=' + objForm.template_id.value;
document.location = strURL;
}
-->
</script>
<?php
html_start_box("<strong>Graph Management</strong>", "100%", $colors["header"], "3", "center", "graphs.php?action=graph_edit&host_id=" . get_request_var_request("host_id"));
?>
<tr bgcolor="<?php print $colors["panel"];?>">
<form name="form_graph_id">
<td>
<table cellpadding="1" cellspacing="0">
<tr>
<td width="50">
Host:
</td>
<td width="1">
<select name="host_id" onChange="applyGraphsFilterChange(document.form_graph_id)">
<option value="-1"<?php if (get_request_var_request("host_id") == "-1") {?> selected<?php }?>>Any</option>
<option value="0"<?php if (get_request_var_request("host_id") == "0") {?> selected<?php }?>>None</option>
<?php
if (read_config_option("auth_method") != 0) {
/* get policy information for the sql where clause */
$current_user = db_fetch_row("select * from user_auth where id=" . $_SESSION["sess_user_id"]);
$sql_where = get_graph_permissions_sql($current_user["policy_graphs"], $current_user["policy_hosts"], $current_user["policy_graph_templates"]);
$hosts = db_fetch_assoc("SELECT DISTINCT host.id, CONCAT_WS('',host.description,' (',host.hostname,')') as name
FROM (graph_templates_graph,host)
LEFT JOIN graph_local ON (graph_local.host_id=host.id)
LEFT JOIN graph_templates ON (graph_templates.id=graph_local.graph_template_id)
LEFT JOIN user_auth_perms ON ((graph_templates_graph.local_graph_id=user_auth_perms.item_id and user_auth_perms.type=1 and user_auth_perms.user_id=" . $_SESSION["sess_user_id"] . ") OR (host.id=user_auth_perms.item_id and user_auth_perms.type=3 and user_auth_perms.user_id=" . $_SESSION["sess_user_id"] . ") OR (graph_templates.id=user_auth_perms.item_id and user_auth_perms.type=4 and user_auth_perms.user_id=" . $_SESSION["sess_user_id"] . "))
//.........这里部分代码省略.........
示例6: 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");
}
示例7: template
function template()
{
global $ds_actions;
/* ================= input validation ================= */
input_validate_input_number(get_request_var_request("page"));
/* ==================================================== */
/* clean up search string */
if (isset($_REQUEST["filter"])) {
$_REQUEST["filter"] = sanitize_search_string(get_request_var("filter"));
}
/* clean up sort_column string */
if (isset($_REQUEST["sort_column"])) {
$_REQUEST["sort_column"] = sanitize_search_string(get_request_var("sort_column"));
}
/* clean up sort_direction string */
if (isset($_REQUEST["sort_direction"])) {
$_REQUEST["sort_direction"] = sanitize_search_string(get_request_var("sort_direction"));
}
/* if the user pushed the 'clear' button */
if (isset($_REQUEST["clear_x"])) {
kill_session_var("sess_data_template_current_page");
kill_session_var("sess_data_template_filter");
kill_session_var("sess_data_template_sort_column");
kill_session_var("sess_data_template_sort_direction");
unset($_REQUEST["page"]);
unset($_REQUEST["filter"]);
unset($_REQUEST["sort_column"]);
unset($_REQUEST["sort_direction"]);
}
/* remember these search fields in session vars so we don't have to keep passing them around */
load_current_session_value("page", "sess_data_template_current_page", "1");
load_current_session_value("filter", "sess_data_template_filter", "");
load_current_session_value("sort_column", "sess_data_template_sort_column", "name");
load_current_session_value("sort_direction", "sess_data_template_sort_direction", "ASC");
html_start_box("<strong>Data Templates</strong>", "100%", "", "3", "center", "data_templates.php?action=template_edit");
?>
<tr class='even noprint'>
<td>
<form name="form_data_template" action="data_templates.php">
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td nowrap style='white-space: nowrap;' width="50">
Search:
</td>
<td width="1">
<input type="text" name="filter" size="40" value="<?php
print htmlspecialchars(get_request_var_request("filter"));
?>
">
</td>
<td nowrap style='white-space: nowrap;'>
<input type="submit" value="Go" title="Set/Refresh Filters">
<input type="submit" name="clear_x" value="Clear" title="Clear Filters">
</td>
</tr>
</table>
<input type='hidden' name='page' value='1'>
</form>
</td>
</tr>
<?php
html_end_box();
/* form the 'where' clause for our main sql query */
$sql_where = "WHERE data_template.id=data_template_data.data_template_id AND data_template_data.local_data_id=0";
$rows_where = "";
if (strlen($_REQUEST['filter'])) {
$sql_where .= " AND (data_template.name like '%%" . get_request_var_request("filter") . "%%')";
$rows_where = "WHERE (data_template.name like '%%" . get_request_var_request("filter") . "%%')";
}
/* print checkbox form for validation */
print "<form name='chk' method='post' action='data_templates.php'>\n";
html_start_box("", "100%", "", "3", "center", "");
$total_rows = db_fetch_cell("SELECT\n\t\tCOUNT(data_template.id)\n\t\tFROM data_template\n\t\t{$rows_where}");
$template_list = db_fetch_assoc("SELECT\n\t\tdata_template.id,\n\t\tdata_template.name,\n\t\tdata_input.name AS data_input_method,\n\t\tdata_template_data.active AS active\n\t\tFROM (data_template,data_template_data)\n\t\tLEFT JOIN data_input\n\t\tON (data_template_data.data_input_id = data_input.id)\n\t\t{$sql_where}\n\t\tGROUP BY data_template.id\n\t\tORDER BY " . get_request_var_request("sort_column") . " " . get_request_var_request("sort_direction") . " LIMIT " . read_config_option("num_rows_device") * (get_request_var_request("page") - 1) . "," . read_config_option("num_rows_device"));
$nav = html_nav_bar("data_templates.php?filter=" . get_request_var_request("filter"), MAX_DISPLAY_PAGES, get_request_var_request("page"), read_config_option("num_rows_device"), $total_rows, 5);
print $nav;
$display_text = array("name" => array("Template Name", "ASC"), "id" => array("ID", "ASC"), "data_input_method" => array("Data Input Method", "ASC"), "active" => array("Status", "ASC"));
html_header_sort_checkbox($display_text, get_request_var_request("sort_column"), get_request_var_request("sort_direction"), false);
if (sizeof($template_list) > 0) {
foreach ($template_list as $template) {
form_alternate_row('line' . $template["id"], true);
form_selectable_cell("<a class='linkEditMain' href='" . htmlspecialchars("data_templates.php?action=template_edit&id=" . $template["id"]) . "'>" . (strlen(get_request_var_request("filter")) ? preg_replace("/(" . preg_quote(get_request_var_request("filter"), "/") . ")/i", "<span style='background-color: #F8D93D;'>\\1</span>", htmlspecialchars($template["name"])) : htmlspecialchars($template["name"])) . "</a>", $template["id"]);
form_selectable_cell($template['id'], $template["id"]);
form_selectable_cell(empty($template["data_input_method"]) ? "<em>None</em>" : htmlspecialchars($template["data_input_method"]), $template["id"]);
form_selectable_cell($template["active"] == "on" ? "Active" : "Disabled", $template["id"]);
form_checkbox_cell($template["name"], $template["id"]);
form_end_row();
}
/* put the nav bar on the bottom as well */
print $nav;
} else {
print "<tr><td><em>No Data Templates</em></td></tr>\n";
}
html_end_box(false);
/* draw the dropdown containing a list of available actions for this form */
draw_actions_dropdown($ds_actions);
print "</form>\n";
}
示例8: gprint_presets
function gprint_presets() {
global $colors;
html_start_box("<strong>GPRINT Presets</strong>", "100%", $colors["header"], "3", "center", "gprint_presets.php?action=edit");
print " <tr bgcolor='#" . $colors["header_panel"] . "'>
<td colspan='2' class='textSubHeaderDark'>GPRINT Preset Title</td>
</tr>";
$template_list = db_fetch_assoc("select
graph_templates_gprint.id,
graph_templates_gprint.name
from graph_templates_gprint");
$i = 0;
if (sizeof($template_list) > 0) {
foreach ($template_list as $template) {
form_alternate_row_color($colors["alternate"],$colors["light"],$i);
?>
<td>
<a class="linkEditMain" href="gprint_presets.php?action=edit&id=<?php print $template["id"];?>"><?php print $template["name"];?></a>
</td>
<td align="right">
<a href="gprint_presets.php?action=remove&id=<?php print $template["id"];?>"><img src="images/delete_icon.gif" width="10" height="10" border="0" alt="Delete"></a>
</td>
</tr>
<?php
$i++;
}
}else{
form_alternate_row_color($colors["form_alternate1"],$colors["form_alternate2"],0); ?>
<td colspan="2">
<em>No Items</em>
</td>
</tr><?php
}
html_end_box();
}
示例9: ds
function ds()
{
global $colors, $ds_actions;
/* ================= input validation ================= */
input_validate_input_number(get_request_var_request("host_id"));
input_validate_input_number(get_request_var_request("page"));
/* ==================================================== */
/* clean up search string */
if (isset($_REQUEST["filter"])) {
$_REQUEST["filter"] = sanitize_search_string(get_request_var("filter"));
}
/* clean up sort_column string */
if (isset($_REQUEST["sort_column"])) {
$_REQUEST["sort_column"] = sanitize_search_string(get_request_var("sort_column"));
}
/* clean up sort_direction string */
if (isset($_REQUEST["sort_direction"])) {
$_REQUEST["sort_direction"] = sanitize_search_string(get_request_var("sort_direction"));
}
/* if the user pushed the 'clear' button */
if (isset($_REQUEST["clear_x"])) {
kill_session_var("sess_ds_current_page");
kill_session_var("sess_ds_filter");
kill_session_var("sess_ds_sort_column");
kill_session_var("sess_ds_sort_direction");
kill_session_var("sess_ds_host_id");
unset($_REQUEST["page"]);
unset($_REQUEST["filter"]);
unset($_REQUEST["sort_column"]);
unset($_REQUEST["sort_direction"]);
unset($_REQUEST["host_id"]);
}
/* remember these search fields in session vars so we don't have to keep passing them around */
load_current_session_value("page", "sess_ds_current_page", "1");
load_current_session_value("filter", "sess_ds_filter", "");
load_current_session_value("sort_column", "sess_ds_sort_column", "name_cache");
load_current_session_value("sort_direction", "sess_ds_sort_direction", "ASC");
load_current_session_value("host_id", "sess_ds_host_id", "-1");
$host = db_fetch_row("select hostname from host where id=" . $_REQUEST["host_id"]);
html_start_box("<strong>Data Sources</strong> [host: " . (empty($host["hostname"]) ? "No Host" : $host["hostname"]) . "]", "100%", $colors["header"], "3", "center", "data_sources.php?action=ds_edit&host_id=" . $_REQUEST["host_id"]);
include "./include/html/inc_data_source_filter_table.php";
html_end_box();
/* form the 'where' clause for our main sql query */
if (strlen($_REQUEST["filter"])) {
$sql_where = "AND (data_template_data.name_cache like '%%" . $_REQUEST["filter"] . "%%'" . " OR data_template.name like '%%" . $_REQUEST["filter"] . "%%'" . " OR data_input.name like '%%" . $_REQUEST["filter"] . "%%')";
} else {
$sql_where = "";
}
if ($_REQUEST["host_id"] == "-1") {
/* Show all items */
} elseif ($_REQUEST["host_id"] == "0") {
$sql_where .= " AND data_local.host_id=0";
} elseif (!empty($_REQUEST["host_id"])) {
$sql_where .= " AND data_local.host_id=" . $_REQUEST["host_id"];
}
$total_rows = sizeof(db_fetch_assoc("SELECT\n\t\tdata_local.id\n\t\tFROM (data_local,data_template_data)\n\t\tLEFT JOIN data_input\n\t\tON (data_input.id=data_template_data.data_input_id)\n\t\tLEFT JOIN data_template\n\t\tON (data_local.data_template_id=data_template.id)\n\t\tWHERE data_local.id=data_template_data.local_data_id\n\t\t{$sql_where}"));
$poller_intervals = array_rekey(db_fetch_assoc("SELECT data_template_data.local_data_id AS id,\n\t\tMin(data_template_data.rrd_step*rra.steps) AS poller_interval\n\t\tFROM data_template\n\t\tINNER JOIN (data_local\n\t\tINNER JOIN ((data_template_data_rra\n\t\tINNER JOIN data_template_data ON data_template_data_rra.data_template_data_id=data_template_data.id)\n\t\tINNER JOIN rra ON data_template_data_rra.rra_id = rra.id) ON data_local.id = data_template_data.local_data_id) ON data_template.id = data_template_data.data_template_id\n\t\t{$sql_where}\n\t\tGROUP BY data_template_data.local_data_id"), "id", "poller_interval");
$data_sources = db_fetch_assoc("SELECT\n\t\tdata_template_data.local_data_id,\n\t\tdata_template_data.name_cache,\n\t\tdata_template_data.active,\n\t\tdata_input.name as data_input_name,\n\t\tdata_template.name as data_template_name,\n\t\tdata_local.host_id\n\t\tFROM (data_local,data_template_data)\n\t\tLEFT JOIN data_input\n\t\tON (data_input.id=data_template_data.data_input_id)\n\t\tLEFT JOIN data_template\n\t\tON (data_local.data_template_id=data_template.id)\n\t\tWHERE data_local.id=data_template_data.local_data_id\n\t\t{$sql_where}\n\t\tORDER BY " . $_REQUEST['sort_column'] . " " . $_REQUEST['sort_direction'] . " LIMIT " . read_config_option("num_rows_data_source") * ($_REQUEST["page"] - 1) . "," . read_config_option("num_rows_data_source"));
html_start_box("", "100%", $colors["header"], "3", "center", "");
/* generate page list */
$url_page_select = get_page_list($_REQUEST["page"], MAX_DISPLAY_PAGES, read_config_option("num_rows_data_source"), $total_rows, "data_sources.php?filter=" . $_REQUEST["filter"] . "&host_id=" . $_REQUEST["host_id"]);
$nav = "<tr bgcolor='#" . $colors["header"] . "'>\n\t\t\t<td colspan='6'>\n\t\t\t\t<table width='100%' cellspacing='0' cellpadding='0' border='0'>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td align='left' class='textHeaderDark'>\n\t\t\t\t\t\t\t<strong><< ";
if ($_REQUEST["page"] > 1) {
$nav .= "<a class='linkOverDark' href='data_sources.php?filter=" . $_REQUEST["filter"] . "&host_id=" . $_REQUEST["host_id"] . "&page=" . ($_REQUEST["page"] - 1) . "'>";
}
$nav .= "Previous";
if ($_REQUEST["page"] > 1) {
$nav .= "</a>";
}
$nav .= "</strong>\n\t\t\t\t\t\t</td>\n\n\t\t\t\t\t\t<td align='center' class='textHeaderDark'>\n\t\t\t\t\t\t\tShowing Rows " . (read_config_option("num_rows_data_source") * ($_REQUEST["page"] - 1) + 1) . " to " . ($total_rows < read_config_option("num_rows_data_source") || $total_rows < read_config_option("num_rows_data_source") * $_REQUEST["page"] ? $total_rows : read_config_option("num_rows_data_source") * $_REQUEST["page"]) . " of {$total_rows} [{$url_page_select}]\n\t\t\t\t\t\t</td>\n\n\t\t\t\t\t\t<td align='right' class='textHeaderDark'>\n\t\t\t\t\t\t\t<strong>";
if ($_REQUEST["page"] * read_config_option("num_rows_data_source") < $total_rows) {
$nav .= "<a class='linkOverDark' href='data_sources.php?filter=" . $_REQUEST["filter"] . "&host_id=" . $_REQUEST["host_id"] . "&page=" . ($_REQUEST["page"] + 1) . "'>";
}
$nav .= "Next";
if ($_REQUEST["page"] * read_config_option("num_rows_data_source") < $total_rows) {
$nav .= "</a>";
}
$nav .= " >></strong>\n\t\t\t\t\t\t</td>\n\n\t\t\t\t\t</tr>\n\t\t\t\t</table>\n\t\t\t</td>\n\t\t</tr>\n";
print $nav;
$display_text = array("name_cache" => array("Name", "ASC"), "data_input_name" => array("Data Input Method", "ASC"), "nosort" => array("Poller<br>Interval", "ASC"), "active" => array("Active", "ASC"), "data_template_name" => array("Template Name", "ASC"));
html_header_sort_checkbox($display_text, $_REQUEST["sort_column"], $_REQUEST["sort_direction"]);
$i = 0;
if (sizeof($data_sources) > 0) {
foreach ($data_sources as $data_source) {
$data_template_name = empty($data_source["data_template_name"]) ? "<em>None</em>" : $data_source["data_template_name"];
$data_input_name = empty($data_source["data_input_name"]) ? "<em>External</em>" : $data_source["data_input_name"];
$poller_interval = isset($poller_intervals[$data_source["local_data_id"]]) ? $poller_intervals[$data_source["local_data_id"]] : 0;
form_alternate_row_color($colors["alternate"], $colors["light"], $i, 'line' . $data_source["local_data_id"]);
$i++;
form_selectable_cell("<a class='linkEditMain' href='data_sources.php?action=ds_edit&id=" . $data_source["local_data_id"] . "'>" . ($_REQUEST["filter"] != "" ? eregi_replace("(" . preg_quote($_REQUEST["filter"]) . ")", "<span style='background-color: #F8D93D;'>\\1</span>", title_trim(htmlentities($data_source["name_cache"]), read_config_option("max_title_data_source"))) : title_trim(htmlentities($data_source["name_cache"]), read_config_option("max_title_data_source"))) . "</a>", $data_source["local_data_id"]);
form_selectable_cell(($_REQUEST["filter"] != "" ? eregi_replace("(" . preg_quote($_REQUEST["filter"]) . ")", "<span style='background-color: #F8D93D;'>\\1</span>", $data_input_name) : $data_input_name) . "</a>", $data_source["local_data_id"]);
form_selectable_cell(get_poller_interval($poller_interval), $data_source["local_data_id"]);
form_selectable_cell($data_source['active'], $data_source["local_data_id"]);
form_selectable_cell(($_REQUEST["filter"] != "" ? eregi_replace("(" . preg_quote($_REQUEST["filter"]) . ")", "<span style='background-color: #F8D93D;'>\\1</span>", $data_source['data_template_name']) : $data_source['data_template_name']) . "</a>", $data_source["local_data_id"]);
form_checkbox_cell($data_source["name_cache"], $data_source["local_data_id"]);
form_end_row();
}
/* put the nav bar on the bottom as well */
print $nav;
} else {
//.........这里部分代码省略.........
示例10: item_edit
function item_edit()
{
global $colors;
if (!empty($_GET["id"])) {
$graph_template_item = db_fetch_row("select * from graph_template_item where id=" . $_GET["id"]);
}
/* by default, select the LAST DS chosen to make everyone's lives easier */
$default = db_fetch_row("select data_template_item_id from graph_template_item where graph_template_id=" . $_GET["graph_template_id"] . " order by sequence DESC");
if (sizeof($default) > 0) {
$graph_template_item["data_template_item_id"] = $default["data_template_item_id"];
} else {
$graph_template_item["data_template_item_id"] = 0;
}
form_start("graph_templates_items.php", "form_graph_template");
/* ==================== Box: Graph Item ==================== */
html_start_box("<strong>" . _("Graph Item") . "</strong> [" . _("Graph Template: ") . db_fetch_cell("select template_name from graph_template where id=" . $_GET["graph_template_id"]) . "]", "98%", $colors["header_background"], "3", "center", "");
_graph_item_field__data_template_item_id("data_template_item_id", isset($graph_template_item["data_template_item_id"]) ? $graph_template_item["data_template_item_id"] : "", empty($_GET["id"]) ? 0 : $_GET["id"]);
_graph_item_field__color("color", isset($graph_template_item["color"]) ? $graph_template_item["color"] : "", empty($_GET["id"]) ? 0 : $_GET["id"]);
_graph_item_field__graph_item_type("graph_item_type", isset($graph_template_item["graph_item_type"]) ? $graph_template_item["graph_item_type"] : "", empty($_GET["id"]) ? 0 : $_GET["id"]);
_graph_item_field__consolidation_function("consolidation_function", isset($graph_template_item["consolidation_function"]) ? $graph_template_item["consolidation_function"] : "", empty($_GET["id"]) ? 0 : $_GET["id"]);
_graph_item_field__cdef("cdef", isset($graph_template_item["cdef"]) ? $graph_template_item["cdef"] : "", empty($_GET["id"]) ? 0 : $_GET["id"]);
_graph_item_field__gprint_format("gprint_format", isset($graph_template_item["gprint_format"]) ? $graph_template_item["gprint_format"] : "", empty($_GET["id"]) ? 0 : $_GET["id"]);
_graph_item_field__legend_value("legend_value", isset($graph_template_item["legend_value"]) ? $graph_template_item["legend_value"] : "", empty($_GET["id"]) ? 0 : $_GET["id"]);
_graph_item_field__legend_format("legend_format", isset($graph_template_item["legend_format"]) ? $graph_template_item["legend_format"] : "", empty($_GET["id"]) ? 0 : $_GET["id"]);
_graph_item_field__hard_return("hard_return", isset($graph_template_item["hard_return"]) ? $graph_template_item["hard_return"] : "", empty($_GET["id"]) ? 0 : $_GET["id"]);
html_end_box();
form_hidden_box("graph_template_item_id", !empty($graph_template_item["id"]) ? $graph_template_item["id"] : "0", "");
form_hidden_box("graph_template_id", $_GET["graph_template_id"], "0");
form_hidden_box("save_component_item", "1", "");
form_save_button("graph_templates.php?action=edit&id=" . $_GET["graph_template_id"]);
}
示例11: webseer_urls
function webseer_urls($header_label)
{
global $assoc_actions, $item_rows;
/* ================= input validation and session storage ================= */
$filters = array('rows' => array('filter' => FILTER_VALIDATE_INT, 'pageset' => true, 'default' => '-1'), 'page' => array('filter' => FILTER_VALIDATE_INT, 'default' => '1'), 'filter' => array('filter' => FILTER_CALLBACK, 'pageset' => true, 'default' => '', 'options' => array('options' => 'sanitize_search_string')), 'associated' => array('filter' => FILTER_CALLBACK, 'default' => 'true', 'options' => array('options' => 'sanitize_search_string')));
validate_store_request_vars($filters, 'sess_maint_ws');
/* ================= input validation ================= */
/* if the number of rows is -1, set it to the default */
if (get_request_var('rows') == '-1') {
$rows = read_config_option('num_rows_table');
} else {
$rows = get_request_var('rows');
}
?>
<script type='text/javascript'>
function applyFilter() {
strURL = 'maint.php?tab=webseer&action=edit&id=<?php
print get_request_var('id');
?>
';
strURL += '&rows=' + $('#rows').val();
strURL += '&associated=' + $('#associated').is(':checked');
strURL += '&filter=' + $('#filter').val();
strURL += '&header=false';
loadPageNoHeader(strURL);
}
function clearFilter() {
strURL = 'maint.php?tab=webseer&action=edit&id=<?php
print get_request_var('id');
?>
&clear=true&header=false';
loadPageNoHeader(strURL);
}
</script>
<?php
html_start_box(__('Associated Web URL\'s ') . htmlspecialchars($header_label), '100%', '', '3', 'center', '');
?>
<tr class='even'>
<td>
<form name='form_devices' method='post' action='maint.php?action=edit&tab=webseer'>
<table class='filterTable'>
<tr>
<td>
<?php
print __('Search');
?>
</td>
<td>
<input type='text' id='filter' size='25' value='<?php
print htmlspecialchars(get_request_var('filter'));
?>
' onChange='applyFilter()'>
</td>
<td>
<?php
print __('Rules');
?>
</td>
<td>
<select id='rows' onChange='applyFilter()'>
<option value='-1'<?php
if (get_request_var('rows') == '-1') {
?>
selected<?php
}
?>
><?php
print __('Default');
?>
</option>
<?php
if (sizeof($item_rows) > 0) {
foreach ($item_rows as $key => $value) {
print "<option value='" . $key . "'";
if (get_request_var('rows') == $key) {
print ' selected';
}
print '>' . htmlspecialchars($value) . "</option>\n";
}
}
?>
</select>
</td>
<td>
<input type='checkbox' id='associated' onChange='applyFilter()' <?php
print get_request_var('associated') == 'true' || get_request_var('associated') == 'on' ? 'checked' : '';
?>
>
</td>
<td>
<label for='associated'><?php
print __('Associated');
?>
</label>
</td>
<td>
<input type='button' value='<?php
print __('Go');
?>
//.........这里部分代码省略.........
示例12: host
function host() {
global $colors, $device_actions;
/* if the user pushed the 'clear' button */
if (isset($_REQUEST["clear_x"])) {
kill_session_var("sess_device_current_page");
kill_session_var("sess_device_filter");
kill_session_var("sess_device_host_template_id");
unset($_REQUEST["page"]);
unset($_REQUEST["filter"]);
unset($_REQUEST["host_template_id"]);
}
/* remember these search fields in session vars so we don't have to keep passing them around */
load_current_session_value("page", "sess_device_current_page", "1");
load_current_session_value("filter", "sess_device_filter", "");
load_current_session_value("host_template_id", "sess_device_host_template_id", "-1");
html_start_box("<strong>Devices</strong>", "98%", $colors["header"], "3", "center", "host.php?action=edit&host_template_id=" . $_REQUEST["host_template_id"]);
include("./include/html/inc_device_filter_table.php");
html_end_box();
/* form the 'where' clause for our main sql query */
$sql_where = "where host.description like '%%" . $_REQUEST["filter"] . "%%'";
if ($_REQUEST["host_template_id"] == "-1") {
/* Show all items */
}elseif ($_REQUEST["host_template_id"] == "0") {
$sql_where .= " and host.host_template_id=0";
}elseif (!empty($_REQUEST["host_template_id"])) {
$sql_where .= " and host.host_template_id=" . $_REQUEST["host_template_id"];
}
html_start_box("", "98%", $colors["header"], "3", "center", "");
$total_rows = db_fetch_cell("select
COUNT(host.id)
from host
$sql_where");
$hosts = db_fetch_assoc("select
host.id,
host.disabled,
host.status,
host.hostname,
host.description,
host.min_time,
host.max_time,
host.cur_time,
host.avg_time,
host.availability
from host
$sql_where
order by host.description
limit " . (read_config_option("num_rows_device")*($_REQUEST["page"]-1)) . "," . read_config_option("num_rows_device"));
/* generate page list */
$url_page_select = get_page_list($_REQUEST["page"], MAX_DISPLAY_PAGES, read_config_option("num_rows_device"), $total_rows, "host.php?filter=" . $_REQUEST["filter"] . "&host_template_id=" . $_REQUEST["host_template_id"]);
$nav = "<tr bgcolor='#" . $colors["header"] . "'>
<td colspan='7'>
<table width='100%' cellspacing='0' cellpadding='0' border='0'>
<tr>
<td align='left' class='textHeaderDark'>
<strong><< "; if ($_REQUEST["page"] > 1) { $nav .= "<a class='linkOverDark' href='host.php?filter=" . $_REQUEST["filter"] . "&host_template_id=" . $_REQUEST["host_template_id"] . "&page=" . ($_REQUEST["page"]-1) . "'>"; } $nav .= "Previous"; if ($_REQUEST["page"] > 1) { $nav .= "</a>"; } $nav .= "</strong>
</td>\n
<td align='center' class='textHeaderDark'>
Showing Rows " . ((read_config_option("num_rows_device")*($_REQUEST["page"]-1))+1) . " to " . ((($total_rows < read_config_option("num_rows_device")) || ($total_rows < (read_config_option("num_rows_device")*$_REQUEST["page"]))) ? $total_rows : (read_config_option("num_rows_device")*$_REQUEST["page"])) . " of $total_rows [$url_page_select]
</td>\n
<td align='right' class='textHeaderDark'>
<strong>"; if (($_REQUEST["page"] * read_config_option("num_rows_device")) < $total_rows) { $nav .= "<a class='linkOverDark' href='host.php?filter=" . $_REQUEST["filter"] . "&host_template_id=" . $_REQUEST["host_template_id"] . "&page=" . ($_REQUEST["page"]+1) . "'>"; } $nav .= "Next"; if (($_REQUEST["page"] * read_config_option("num_rows_device")) < $total_rows) { $nav .= "</a>"; } $nav .= " >></strong>
</td>\n
</tr>
</table>
</td>
</tr>\n";
print $nav;
html_header_checkbox(array("Description", "Status", "Hostname", "Current (ms)", "Average (ms)", "Availability"));
$i = 0;
if (sizeof($hosts) > 0) {
foreach ($hosts as $host) {
form_alternate_row_color($colors["alternate"],$colors["light"],$i); $i++;
?>
<td width=200>
<a class="linkEditMain" href="host.php?action=edit&id=<?php print $host["id"];?>"><?php print eregi_replace("(" . preg_quote($_REQUEST["filter"]) . ")", "<span style='background-color: #F8D93D;'>\\1</span>", $host["description"]);?></a>
</td>
<td>
<?php print get_colored_device_status(($host["disabled"] == "on" ? true : false), $host["status"]);?>
</td>
<td>
<?php print $host["hostname"];?>
</td>
<td>
<?php print round(($host["cur_time"]), 2);?>
//.........这里部分代码省略.........
示例13: syslog_alerts
function syslog_alerts()
{
global $colors, $syslog_actions, $config, $message_types, $severities;
include dirname(__FILE__) . "/config.php";
/* ================= input validation ================= */
input_validate_input_number(get_request_var_request("id"));
input_validate_input_number(get_request_var_request("page"));
input_validate_input_number(get_request_var_request("enabled"));
input_validate_input_number(get_request_var_request("rows"));
/* ==================================================== */
/* clean up filter */
if (isset($_REQUEST["filter"])) {
$_REQUEST["filter"] = sanitize_search_string(get_request_var("filter"));
}
/* clean up sort_column */
if (isset($_REQUEST["sort_column"])) {
$_REQUEST["sort_column"] = sanitize_search_string(get_request_var("sort_column"));
}
/* clean up sort direction */
if (isset($_REQUEST["sort_direction"])) {
$_REQUEST["sort_direction"] = sanitize_search_string(get_request_var("sort_direction"));
}
/* if the user pushed the 'clear' button */
if (isset($_REQUEST["clear"])) {
kill_session_var("sess_syslog_alerts_page");
kill_session_var("sess_syslog_alerts_rows");
kill_session_var("sess_syslog_alerts_filter");
kill_session_var("sess_syslog_alerts_enabled");
kill_session_var("sess_syslog_alerts_sort_column");
kill_session_var("sess_syslog_alerts_sort_direction");
$_REQUEST["page"] = 1;
unset($_REQUEST["filter"]);
unset($_REQUEST["enabled"]);
unset($_REQUEST["rows"]);
unset($_REQUEST["sort_column"]);
unset($_REQUEST["sort_direction"]);
} else {
/* if any of the settings changed, reset the page number */
$changed = 0;
$changed += syslog_check_changed("filter", "sess_syslog_alerts_filter");
$changed += syslog_check_changed("enabled", "sess_syslog_alerts_enabled");
$changed += syslog_check_changed("rows", "sess_syslog_alerts_rows");
$changed += syslog_check_changed("sort_column", "sess_syslog_alerts_sort_column");
$changed += syslog_check_changed("sort_direction", "sess_syslog_alerts_sort_direction");
if ($changed) {
$_REQUEST["page"] = "1";
}
}
/* remember these search fields in session vars so we don't have to keep passing them around */
load_current_session_value("page", "sess_syslog_alerts_paage", "1");
load_current_session_value("rows", "sess_syslog_alerts_rows", "-1");
load_current_session_value("enabled", "sess_syslog_alerts_enabled", "-1");
load_current_session_value("filter", "sess_syslog_alerts_filter", "");
load_current_session_value("sort_column", "sess_syslog_alerts_sort_column", "name");
load_current_session_value("sort_direction", "sess_syslog_alerts_sort_direction", "ASC");
html_start_box("<strong>Syslog Alert Filters</strong>", "100%", $colors["header"], "3", "center", "syslog_alerts.php?action=edit");
syslog_filter();
html_end_box();
html_start_box("", "100%", $colors["header"], "3", "center", "");
$sql_where = "";
if ($_REQUEST["rows"] == "-1") {
$row_limit = read_config_option("num_rows_syslog");
} elseif ($_REQUEST["rows"] == -2) {
$row_limit = 999999;
} else {
$row_limit = $_REQUEST["rows"];
}
$alerts = syslog_get_alert_records($sql_where, $row_limit);
$rows_query_string = "SELECT COUNT(*)\n\t\tFROM `" . $syslogdb_default . "`.`syslog_alert`\n\t\t{$sql_where}";
$total_rows = syslog_db_fetch_cell($rows_query_string);
?>
<script type="text/javascript">
<!--
function applyChange(objForm) {
strURL = '?enabled=' + objForm.enabled.value;
strURL = strURL + '&filter=' + objForm.filter.value;
strURL = strURL + '&rows=' + objForm.rows.value;
document.location = strURL;
}
-->
</script>
<?php
/* generate page list */
$url_page_select = get_page_list($_REQUEST["page"], MAX_DISPLAY_PAGES, $row_limit, $total_rows, "syslog_alerts.php?filter=" . $_REQUEST["filter"]);
if ($total_rows > 0) {
$nav = "<tr bgcolor='#" . $colors["header"] . "'>\n\t\t\t\t\t<td colspan='13'>\n\t\t\t\t\t\t<table width='100%' cellspacing='0' cellpadding='0' border='0'>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td align='left' class='textHeaderDark'>\n\t\t\t\t\t\t\t\t\t<strong><< ";
if ($_REQUEST["page"] > 1) {
$nav .= "<a class='linkOverDark' href='syslog_alerts.php?report=arp&page=" . ($_REQUEST["page"] - 1) . "'>";
}
$nav .= "Previous";
if ($_REQUEST["page"] > 1) {
$nav .= "</a>";
}
$nav .= "</strong>\n\t\t\t\t\t\t\t\t</td>\n\n\t\t\t\t\t\t\t\t<td align='center' class='textHeaderDark'>\n\t\t\t\t\t\t\t\t\tShowing Rows " . ($total_rows == 0 ? "None" : $row_limit * ($_REQUEST["page"] - 1) + 1 . " to " . ($total_rows < $row_limit || $total_rows < $row_limit * $_REQUEST["page"] ? $total_rows : $row_limit * $_REQUEST["page"]) . " of {$total_rows} [{$url_page_select}]") . "\n\t\t\t\t\t\t\t\t</td>\n\n\t\t\t\t\t\t\t\t<td align='right' class='textHeaderDark'>\n\t\t\t\t\t\t\t\t\t<strong>";
if ($_REQUEST["page"] * $row_limit < $total_rows) {
$nav .= "<a class='linkOverDark' href='syslog_alerts.php?report=arp&page=" . ($_REQUEST["page"] + 1) . "'>";
}
$nav .= "Next";
if ($_REQUEST["page"] * $row_limit < $total_rows) {
$nav .= "</a>";
//.........这里部分代码省略.........
示例14: input_edit
function input_edit() {
global $colors, $consolidation_functions, $graph_item_types, $struct_graph_item, $fields_graph_template_input_edit;
$header_label = "[edit graph: " . db_fetch_cell("select name from graph_templates where id=" . $_GET["graph_template_id"]) . "]";
/* get a list of all graph item field names and populate an array for user display */
while (list($field_name, $field_array) = each($struct_graph_item)) {
if ($field_array["method"] != "view") {
$graph_template_items[$field_name] = $field_array["friendly_name"];
}
}
if (!empty($_GET["id"])) {
$graph_template_input = db_fetch_row("select * from graph_template_input where id=" . $_GET["id"]);
}
html_start_box("<strong>Graph Item Inputs</strong> $header_label", "98%", $colors["header"], "3", "center", "");
draw_edit_form(array(
"config" => array(),
"fields" => inject_form_variables($fields_graph_template_input_edit, (isset($graph_template_input) ? $graph_template_input : array()), (isset($graph_template_items) ? $graph_template_items : array()), $_GET)
));
if (!(isset($_GET["id"]))) { $_GET["id"] = 0; }
$item_list = db_fetch_assoc("select
CONCAT_WS(' - ',data_template_data.name,data_template_rrd.data_source_name) as data_source_name,
graph_templates_item.text_format,
graph_templates_item.id as graph_templates_item_id,
graph_templates_item.graph_type_id,
graph_templates_item.consolidation_function_id,
graph_template_input_defs.graph_template_input_id
from graph_templates_item
left join graph_template_input_defs on (graph_template_input_defs.graph_template_item_id=graph_templates_item.id and graph_template_input_defs.graph_template_input_id=" . $_GET["id"] . ")
left join data_template_rrd on graph_templates_item.task_item_id=data_template_rrd.id
left join data_local on data_template_rrd.local_data_id=data_local.id
left join data_template_data on data_local.id=data_template_data.local_data_id
where graph_templates_item.local_graph_id=0
and graph_templates_item.graph_template_id=" . $_GET["graph_template_id"] . "
order by graph_templates_item.sequence");
form_alternate_row_color($colors["form_alternate1"],$colors["form_alternate2"],1); ?>
<td width="50%">
<font class="textEditTitle">Associated Graph Items</font><br>
Select the graph items that you want to accept user input for.
</td>
<td>
<?php
$i = 0; $any_selected_item = "";
if (sizeof($item_list) > 0) {
foreach ($item_list as $item) {
if ($item["graph_template_input_id"] == "") {
$old_value = "";
}else{
$old_value = "on";
$any_selected_item = $item["graph_templates_item_id"];
}
if ($graph_item_types{$item["graph_type_id"]} == "GPRINT") {
$start_bold = "";
$end_bold = "";
}else{
$start_bold = "<strong>";
$end_bold = "</strong>";
}
$name = "$start_bold Item #" . ($i+1) . ": " . $graph_item_types{$item["graph_type_id"]} . " (" . $consolidation_functions{$item["consolidation_function_id"]} . ")$end_bold";
form_checkbox("i_" . $item["graph_templates_item_id"], $old_value, $name,"",$_GET["graph_template_id"],true); print "<br>";
$i++;
}
}else{
print "<em>No Items</em>";
}
?>
</td>
</tr>
<?php
html_end_box();
form_hidden_box("any_selected_item", $any_selected_item, "");
form_save_button("graph_templates.php?action=template_edit&id=" . $_GET["graph_template_id"]);
}
示例15: data_query
function data_query() {
global $colors;
html_start_box("<strong>Data Queries</strong>", "98%", $colors["header"], "3", "center", "data_queries.php?action=edit");
print "<tr bgcolor='#" . $colors["header_panel"] . "'>";
DrawMatrixHeaderItem("Name",$colors["header_text"],1);
DrawMatrixHeaderItem("Data Input Method",$colors["header_text"],1);
DrawMatrixHeaderItem(" ",$colors["header_text"],1);
print "</tr>";
$snmp_queries = db_fetch_assoc("SELECT
snmp_query.id,
snmp_query.name,
data_input.name AS data_input_method
FROM snmp_query INNER JOIN data_input ON snmp_query.data_input_id = data_input.id
ORDER BY snmp_query.name");
$i = 0;
if (sizeof($snmp_queries) > 0) {
foreach ($snmp_queries as $snmp_query) {
form_alternate_row_color($colors["alternate"],$colors["light"],$i); $i++;
?>
<td>
<a class="linkEditMain" href="data_queries.php?action=edit&id=<?php print $snmp_query["id"];?>"><?php print $snmp_query["name"];?></a>
</td>
<td>
<?php print $snmp_query["data_input_method"]; ?>
</td>
<td align="right">
<a href="data_queries.php?action=remove&id=<?php print $snmp_query["id"];?>"><img src="images/delete_icon.gif" width="10" height="10" border="0" alt="Delete"></a>
</td>
</tr>
<?php
}
}
html_end_box();
}