2012-07-18 Miguel de Dios <miguel.dedios@artica.es>
* include/javascript/pandora.js, include/functions_agents.php, include/functions_db.php, include/functions_html.php, include/db/postgresql.php, include/db/mysql.php, include/db/oracle.php: cleaned source code style and killed some unicorns and magical numbers. * operation/agentes/stat_win.php: a lot fixes, cleaned source code style, added magical widget for times for refresh. And yes I fixed the bug with jquery that failed with new graphs. Fixes: #3520966 * operation/agentes/estado_ultimopaquete.php: fixed the links to window graph popup, now all the links have 10 minutes for the refresh. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6787 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
27ef89b4d4
commit
469abc72fe
|
@ -1,3 +1,21 @@
|
|||
2012-07-18 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* include/javascript/pandora.js, include/functions_agents.php,
|
||||
include/functions_db.php, include/functions_html.php,
|
||||
include/db/postgresql.php, include/db/mysql.php,
|
||||
include/db/oracle.php: cleaned source code style and killed some
|
||||
unicorns and magical numbers.
|
||||
|
||||
* operation/agentes/stat_win.php: a lot fixes, cleaned source code
|
||||
style, added magical widget for times for refresh. And yes I fixed
|
||||
the bug with jquery that failed with new graphs.
|
||||
|
||||
Fixes: #3520966
|
||||
|
||||
* operation/agentes/estado_ultimopaquete.php: fixed the links to
|
||||
window graph popup, now all the links have 10 minutes for the
|
||||
refresh.
|
||||
|
||||
2012-07-17 Sergio Martin <sergio.martin@artica.es>
|
||||
|
||||
* include/javascript/jquery.scrollTo.js: Added jquery
|
||||
|
|
|
@ -529,12 +529,12 @@ function mysql_db_format_array_where_clause_sql ($values, $join = 'AND', $prefix
|
|||
$query .= sprintf ('%s IN ("%s")', $field, implode ('", "', $value));
|
||||
}
|
||||
else {
|
||||
if ($value[0] == ">"){
|
||||
if ($value[0] == ">") {
|
||||
$value = substr($value,1,strlen($value)-1);
|
||||
$query .= sprintf ("%s > '%s'", $field, $value);
|
||||
}
|
||||
else if ($value[0] == "<"){
|
||||
if ($value[1] == ">"){
|
||||
else if ($value[0] == "<") {
|
||||
if ($value[1] == ">") {
|
||||
$value = substr($value,2,strlen($value)-2);
|
||||
$query .= sprintf ("%s <> '%s'", $field, $value);
|
||||
}
|
||||
|
@ -690,7 +690,8 @@ function mysql_db_get_all_rows_filter ($table, $filter = array(), $fields = fals
|
|||
$filter = '';
|
||||
}
|
||||
|
||||
$sql = sprintf ('SELECT %s FROM %s %s', $fields, $table, $filter);
|
||||
$sql = sprintf ('SELECT %s
|
||||
FROM %s %s', $fields, $table, $filter);
|
||||
|
||||
if ($returnSQL)
|
||||
return $sql;
|
||||
|
@ -1045,5 +1046,4 @@ function mysql_db_get_table_count($sql, $search_history_db = false) {
|
|||
|
||||
return $count;
|
||||
}
|
||||
|
||||
?>
|
|
@ -593,7 +593,6 @@ function oracle_db_format_array_where_clause_sql ($values, $join = 'AND', $prefi
|
|||
}
|
||||
$i++;
|
||||
continue;
|
||||
|
||||
}
|
||||
else if (is_numeric ($field)) {
|
||||
/* User provide the exact operation to do */
|
||||
|
|
|
@ -570,12 +570,12 @@ function postgresql_db_format_array_where_clause_sql ($values, $join = 'AND', $p
|
|||
$query .= sprintf ("%s IN ('%s')", $field, implode ("', '", $value));
|
||||
}
|
||||
else {
|
||||
if ($value[0] == ">"){
|
||||
if ($value[0] == ">") {
|
||||
$value = substr($value,1,strlen($value)-1);
|
||||
$query .= sprintf ("%s > '%s'", $field, $value);
|
||||
}
|
||||
else if ($value[0] == "<"){
|
||||
if ($value[1] == ">"){
|
||||
else if ($value[0] == "<") {
|
||||
if ($value[1] == ">") {
|
||||
$value = substr($value,2,strlen($value)-2);
|
||||
$query .= sprintf ("%s <> '%s'", $field, $value);
|
||||
}
|
||||
|
|
|
@ -1658,28 +1658,27 @@ function agents_get_status($id_agent = 0, $noACLs = false) {
|
|||
}
|
||||
|
||||
if (! $status)
|
||||
return -1;
|
||||
return AGENT_MODULE_STATUS_UNKNOW;
|
||||
}
|
||||
|
||||
// Status is 0 for normal, 1 for critical, 2 for warning and 3 for unknown. 4 for alert fired
|
||||
// Checking if any module has alert fired (4)
|
||||
if (is_int(array_search(4,$modules_status))) {
|
||||
return 4;
|
||||
// Checking if any module has alert fired
|
||||
if (is_int(array_search(AGENT_MODULE_STATUS_CRITICAL_ALERT, $modules_status))) {
|
||||
return AGENT_MODULE_STATUS_CRITICAL_ALERT;
|
||||
}
|
||||
// Checking if any module has critical status (1)
|
||||
elseif (is_int(array_search(1,$modules_status))) {
|
||||
return 1;
|
||||
// Checking if any module has critical status
|
||||
elseif (is_int(array_search(AGENT_MODULE_STATUS_CRITICAL_BAD, $modules_status))) {
|
||||
return AGENT_MODULE_STATUS_CRITICAL_BAD;
|
||||
}
|
||||
// Checking if any module has warning status (2)
|
||||
elseif (is_int(array_search(2,$modules_status))) {
|
||||
return 2;
|
||||
// Checking if any module has warning status
|
||||
elseif (is_int(array_search(AGENT_MODULE_STATUS_WARNING,$modules_status))) {
|
||||
return AGENT_MODULE_STATUS_WARNING;
|
||||
}
|
||||
// Checking if any module has unknown status (3)
|
||||
elseif (is_int(array_search(3,$modules_status))) {
|
||||
return 3;
|
||||
// Checking if any module has unknown status
|
||||
elseif (is_int(array_search(AGENT_MODULE_STATUS_UNKNOW, $modules_status))) {
|
||||
return AGENT_MODULE_STATUS_UNKNOW;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
return AGENT_MODULE_STATUS_NORMAL;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -843,7 +843,8 @@ function db_process_delete_temp ($table, $row, $value) {
|
|||
$result = db_process_sql_delete ($table, $row.' = '.$value);
|
||||
break;
|
||||
case "oracle":
|
||||
if (is_int ($value) || is_bool ($value) || is_float ($value) || is_double ($value)) {
|
||||
if (is_int ($value) || is_bool ($value) ||
|
||||
is_float ($value) || is_double ($value)) {
|
||||
$result = oracle_db_process_sql_delete_temp ($table, $row . ' = ' . $value);
|
||||
}
|
||||
else {
|
||||
|
@ -1152,6 +1153,4 @@ function db_get_table_count($table, $search_history_db = false) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
|
@ -220,7 +220,7 @@ function html_print_select_groups($id_user = false, $privilege = "AR", $returnAl
|
|||
unset($user_groups[$id_group]);
|
||||
}
|
||||
|
||||
if(empty($user_groups)) {
|
||||
if (empty($user_groups)) {
|
||||
$user_groups_tree = array();
|
||||
}
|
||||
else {
|
||||
|
@ -266,8 +266,10 @@ function html_print_select_groups($id_user = false, $privilege = "AR", $returnAl
|
|||
*
|
||||
* @return string HTML code if return parameter is true.
|
||||
*/
|
||||
function html_print_select ($fields, $name, $selected = '', $script = '', $nothing = '', $nothing_value = 0, $return = false,
|
||||
$multiple = false, $sort = true, $class = '', $disabled = false, $style = false, $option_style = false, $size = false) {
|
||||
function html_print_select ($fields, $name, $selected = '', $script = '',
|
||||
$nothing = '', $nothing_value = 0, $return = false, $multiple = false,
|
||||
$sort = true, $class = '', $disabled = false, $style = false,
|
||||
$option_style = false, $size = false) {
|
||||
|
||||
$output = "\n";
|
||||
|
||||
|
@ -331,8 +333,8 @@ function html_print_select ($fields, $name, $selected = '', $script = '', $nothi
|
|||
$optlabel = $label;
|
||||
if(is_array($label)) {
|
||||
if (isset($label['optgroup'])) {
|
||||
if($label['optgroup'] != $lastopttype) {
|
||||
if($lastopttype != '') {
|
||||
if ($label['optgroup'] != $lastopttype) {
|
||||
if ($lastopttype != '') {
|
||||
$output .= '</optgroup>';
|
||||
}
|
||||
$output .= '<optgroup label="'.$label['optgroup'].'">';
|
||||
|
@ -346,7 +348,8 @@ function html_print_select ($fields, $name, $selected = '', $script = '', $nothi
|
|||
if (is_array ($selected) && in_array ($value, $selected)) {
|
||||
$output .= ' selected="selected"';
|
||||
}
|
||||
elseif (is_numeric ($value) && is_numeric ($selected) && $value == $selected) {
|
||||
elseif (is_numeric ($value) && is_numeric ($selected) &&
|
||||
$value == $selected) {
|
||||
//This fixes string ($value) to int ($selected) comparisons
|
||||
$output .= ' selected="selected"';
|
||||
}
|
||||
|
@ -354,7 +357,8 @@ function html_print_select ($fields, $name, $selected = '', $script = '', $nothi
|
|||
//Needs type comparison otherwise if $selected = 0 and $value = "string" this would evaluate to true
|
||||
$output .= ' selected="selected"';
|
||||
}
|
||||
if (is_array ($option_style) && in_array ($value, array_keys($option_style))) {
|
||||
if (is_array ($option_style) &&
|
||||
in_array ($value, array_keys($option_style))) {
|
||||
$output .= ' style="'.$option_style[$value].'"';
|
||||
}
|
||||
if ($optlabel === '') {
|
||||
|
@ -364,7 +368,7 @@ function html_print_select ($fields, $name, $selected = '', $script = '', $nothi
|
|||
$output .= '>'.$optlabel."</option>";
|
||||
}
|
||||
}
|
||||
if(is_array($label)){
|
||||
if (is_array($label)) {
|
||||
$output .= '</optgroup>';
|
||||
}
|
||||
}
|
||||
|
@ -455,7 +459,7 @@ function html_print_extended_select_for_time ($name, $selected = '', $script = '
|
|||
SECONDS_1MONTH => __('months'),
|
||||
SECONDS_1YEAR => __('years'));
|
||||
|
||||
if($unique_name === true) {
|
||||
if ($unique_name === true) {
|
||||
$uniq_name = uniqid($name);
|
||||
}
|
||||
else {
|
||||
|
@ -527,10 +531,13 @@ function html_print_input_text_extended ($name, $value, $id, $alt, $size, $maxle
|
|||
|
||||
++$idcounter;
|
||||
|
||||
$valid_attrs = array ("accept", "disabled", "maxlength", "name", "readonly", "size", "value",
|
||||
"accesskey", "class", "dir", "id", "lang", "style", "tabindex", "title", "xml:lang",
|
||||
"onfocus", "onblur", "onselect", "onchange", "onclick", "ondblclick", "onmousedown",
|
||||
"onmouseup", "onmouseover", "onmousemove", "onmouseout", "onkeypress", "onkeydown", "onkeyup");
|
||||
$valid_attrs = array ("accept", "disabled", "maxlength",
|
||||
"name", "readonly", "size", "value", "accesskey",
|
||||
"class", "dir", "id", "lang", "style", "tabindex",
|
||||
"title", "xml:lang", "onfocus", "onblur", "onselect",
|
||||
"onchange", "onclick", "ondblclick", "onmousedown",
|
||||
"onmouseup", "onmouseover", "onmousemove", "onmouseout",
|
||||
"onkeypress", "onkeydown", "onkeyup");
|
||||
|
||||
$output = '<input '.($password ? 'type="password" ' : 'type="text" ');
|
||||
|
||||
|
@ -680,9 +687,10 @@ function html_print_input_image ($name, $src, $value, $style = '', $return = fal
|
|||
$output = '<input id="image-'.$name.$idcounter.'" src="'.$src.'" style="'.$style.'" name="'.$name.'" type="image"';
|
||||
|
||||
//Valid attributes (invalid attributes get skipped)
|
||||
$attrs = array ("alt", "accesskey", "lang", "tabindex", "title", "xml:lang",
|
||||
"onclick", "ondblclick", "onmousedown", "onmouseup", "onmouseover", "onmousemove",
|
||||
"onmouseout", "onkeypress", "onkeydown", "onkeyup");
|
||||
$attrs = array ("alt", "accesskey", "lang", "tabindex",
|
||||
"title", "xml:lang", "onclick", "ondblclick", "onmousedown",
|
||||
"onmouseup", "onmouseover", "onmousemove", "onmouseout",
|
||||
"onkeypress", "onkeydown", "onkeyup");
|
||||
|
||||
foreach ($attrs as $attribute) {
|
||||
if (isset ($options[$attribute])) {
|
||||
|
@ -816,6 +824,7 @@ function html_print_textarea ($name, $rows, $columns, $value = '', $attributes =
|
|||
|
||||
if ($return)
|
||||
return $output;
|
||||
|
||||
echo $output;
|
||||
}
|
||||
|
||||
|
@ -861,7 +870,8 @@ function html_print_table (&$table, $return = false) {
|
|||
foreach ($table->align as $key => $aa) {
|
||||
if ($aa) {
|
||||
$align[$key] = ' text-align:'. $aa.';';
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$align[$key] = '';
|
||||
}
|
||||
}
|
||||
|
@ -879,7 +889,8 @@ function html_print_table (&$table, $return = false) {
|
|||
foreach ($table->size as $key => $ss) {
|
||||
if ($ss) {
|
||||
$size[$key] = ' width:'. $ss .';';
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$size[$key] = '';
|
||||
}
|
||||
}
|
||||
|
@ -888,7 +899,8 @@ function html_print_table (&$table, $return = false) {
|
|||
foreach ($table->style as $key => $st) {
|
||||
if ($st) {
|
||||
$style[$key] = ' '. $st .';';
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$style[$key] = '';
|
||||
}
|
||||
}
|
||||
|
@ -934,7 +946,8 @@ function html_print_table (&$table, $return = false) {
|
|||
|
||||
if (empty ($table->tablealign) || $table->tablealign != 'left' || $table->tablealign != 'right') {
|
||||
$table->tablealign = '';
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$table->tablealign = 'style="float:'.$table->tablealign.';"'; //Align is deprecated. Use float instead
|
||||
}
|
||||
|
||||
|
@ -1150,7 +1163,8 @@ function html_print_checkbox_extended ($name, $value, $checked, $disabled, $scri
|
|||
//If duplicate names exist, it will start numbering. Otherwise it won't
|
||||
if (isset ($idcounter[$name])) {
|
||||
$idcounter[$name]++;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$idcounter[$name] = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -462,18 +462,18 @@ foreach ($modules as $module) {
|
|||
$graph_label = io_safe_output($module["nombre"]);
|
||||
|
||||
echo "<a href='javascript:" .
|
||||
"winopeng(\"operation/agentes/stat_win.php?type=$graph_type&period=" . (28 * SECONDS_1DAY) . "&id=".$module["id_agente_modulo"]."&label=".base64_encode($graph_label)."&refresh=180000\", \"month_".$win_handle."\")'>" . html_print_image('images/grafica_m.png' , true, array("border" => '0', "alt" => '')) . "</a> ";
|
||||
"winopeng(\"operation/agentes/stat_win.php?type=$graph_type&period=" . SECONDS_1MONTH . "&id=".$module["id_agente_modulo"]."&label=".base64_encode($graph_label)."&refresh=" . SECONDS_10MINUTES . "\", \"month_".$win_handle."\")'>" . html_print_image('images/grafica_m.png' , true, array("border" => '0', "alt" => '')) . "</a> ";
|
||||
|
||||
$link ="winopeng(" .
|
||||
"'operation/agentes/stat_win.php?type=$graph_type&period=" . SECONDS_1WEEK . "&id=".$module["id_agente_modulo"]."&label=".base64_encode($graph_label)."&refresh=6000','week_".$win_handle."')";
|
||||
"'operation/agentes/stat_win.php?type=$graph_type&period=" . SECONDS_1WEEK . "&id=".$module["id_agente_modulo"]."&label=".base64_encode($graph_label)."&refresh=" . SECONDS_10MINUTES . "','week_".$win_handle."')";
|
||||
echo '<a href="javascript:'.$link.'">' . html_print_image("images/grafica_w.png", true, array("border" => '0', "alt" => '')) . '</a> ';
|
||||
|
||||
$link ="winopeng(" .
|
||||
"'operation/agentes/stat_win.php?type=$graph_type&period=" . SECONDS_1DAY . "&id=".$module["id_agente_modulo"]."&label=".base64_encode($graph_label)."&refresh=600','day_".$win_handle."')";
|
||||
"'operation/agentes/stat_win.php?type=$graph_type&period=" . SECONDS_1DAY . "&id=".$module["id_agente_modulo"]."&label=".base64_encode($graph_label)."&refresh=" . SECONDS_10MINUTES . "','day_".$win_handle."')";
|
||||
echo '<a href="javascript:'.$link.'">' . html_print_image("images/grafica_d.png", true, array("border" => '0', "alt" => '')) . '</a> ';
|
||||
|
||||
$link ="winopeng(" .
|
||||
"'operation/agentes/stat_win.php?type=$graph_type&period=" . SECONDS_1HOUR . "&id=".$module["id_agente_modulo"]."&label=".base64_encode($graph_label)."&refresh=60','hour_".$win_handle."')";
|
||||
"'operation/agentes/stat_win.php?type=$graph_type&period=" . SECONDS_1HOUR . "&id=".$module["id_agente_modulo"]."&label=".base64_encode($graph_label)."&refresh=" . SECONDS_10MINUTES . "','hour_".$win_handle."')";
|
||||
echo '<a href="javascript:'.$link.'">' . html_print_image("images/grafica_h.png", true, array("border" => '0', "alt" => "")) . '</a>';
|
||||
}
|
||||
|
||||
|
|
|
@ -43,34 +43,35 @@ $label = base64_decode(get_parameter('label', ''));
|
|||
?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<?php
|
||||
// Parsing the refresh before sending any header
|
||||
$refresh = (int) get_parameter ("refresh", -1);
|
||||
if ($refresh > 0) {
|
||||
<head>
|
||||
<?php
|
||||
// Parsing the refresh before sending any header
|
||||
$refresh = (int) get_parameter ("refresh", -1);
|
||||
if ($refresh > 0) {
|
||||
$query = ui_get_url_refresh (false);
|
||||
|
||||
echo '<meta http-equiv="refresh" content="'.$refresh.'; URL='.$query.'" />';
|
||||
}
|
||||
?>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>Pandora FMS Graph (<?php echo modules_get_agentmodule_agent_name ($id) . ' - ' . $label; ?>)</title>
|
||||
<link rel="stylesheet" href="../../include/styles/pandora_minimal.css" type="text/css" />
|
||||
<script type='text/javaScript' src='../../include/javascript/calendar.js'></script>
|
||||
<script type='text/javascript' src='../../include/javascript/x_core.js'></script>
|
||||
<script type='text/javascript' src='../../include/javascript/x_event.js'></script>
|
||||
<script type='text/javascript' src='../../include/javascript/x_slide.js'></script>
|
||||
<script type='text/javascript' src='../../include/javascript/pandora.js'></script>
|
||||
<script type='text/javascript' src='../../include/javascript/jquery.js'></script>
|
||||
<script type='text/javascript'><!--
|
||||
var defOffset = 2;
|
||||
var defSlideTime = 220;
|
||||
var tnActive = 0;
|
||||
var visibleMargin = 45;
|
||||
var menuW = 400;
|
||||
var menuH = 310;
|
||||
var showed = 0;
|
||||
window.onload = function() {
|
||||
}
|
||||
?>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>Pandora FMS Graph (<?php echo modules_get_agentmodule_agent_name ($id) . ' - ' . $label; ?>)</title>
|
||||
<link rel="stylesheet" href="../../include/styles/pandora_minimal.css" type="text/css" />
|
||||
<script type='text/javaScript' src='../../include/javascript/calendar.js'></script>
|
||||
<script type='text/javascript' src='../../include/javascript/x_core.js'></script>
|
||||
<script type='text/javascript' src='../../include/javascript/x_event.js'></script>
|
||||
<script type='text/javascript' src='../../include/javascript/x_slide.js'></script>
|
||||
<script type='text/javascript' src='../../include/javascript/pandora.js'></script>
|
||||
<script type='text/javascript' src='../../include/javascript/jquery-1.7.1.js'></script>
|
||||
<script type='text/javascript'>
|
||||
<!--
|
||||
var defOffset = 2;
|
||||
var defSlideTime = 220;
|
||||
var tnActive = 0;
|
||||
var visibleMargin = 45;
|
||||
var menuW = 400;
|
||||
var menuH = 310;
|
||||
var showed = 0;
|
||||
window.onload = function() {
|
||||
var d;
|
||||
d = xGetElementById('divmenu');
|
||||
d.termNumber = 1;
|
||||
|
@ -98,16 +99,13 @@ window.onload = function() {
|
|||
$("#graph_menu_arrow").attr("src", <?php echo '"' . $config['homeurl'] . '"'; ?> + "/images/graphmenu_arrow.png");
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
function docOnMousemoveIn(evt) {
|
||||
|
||||
function docOnMousemoveIn(evt) {
|
||||
var e = new xEvent(evt);
|
||||
var d = getTermEle(e.target);
|
||||
|
||||
// if (!tnActive) { // no def is active
|
||||
// if (d) { // mouse is over a term, activate its def
|
||||
// mouse is over a term, activate its def
|
||||
if (showed == 0) {
|
||||
xSlideTo('divmenu', 0, xPageY(d), defSlideTime);
|
||||
showed = 1;
|
||||
|
@ -116,11 +114,9 @@ function docOnMousemoveIn(evt) {
|
|||
xSlideTo('divmenu', visibleMargin - menuW, xPageY(d), defSlideTime);
|
||||
showed = 0;
|
||||
}
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
function docOnMousemove(evt) {
|
||||
function docOnMousemove(evt) {
|
||||
var e = new xEvent(evt);
|
||||
var d = getTermEle(e.target);
|
||||
if (!tnActive) { // no def is active
|
||||
|
@ -135,85 +131,87 @@ function docOnMousemove(evt) {
|
|||
tnActive = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getTermEle(ele) {
|
||||
function getTermEle(ele) {
|
||||
//window.status = ele;
|
||||
while(ele && !ele.termNumber) {
|
||||
if (ele == document) return null;
|
||||
ele = xParent(ele);
|
||||
}
|
||||
return ele;
|
||||
}
|
||||
}
|
||||
|
||||
function show_others() {
|
||||
function show_others() {
|
||||
if (!$("#checkbox-avg_only").attr('checked')) {
|
||||
$("#hidden-show_other").val(1);
|
||||
}
|
||||
else {
|
||||
$("#hidden-show_other").val(0);
|
||||
}
|
||||
}
|
||||
//-->
|
||||
</script>
|
||||
</head>
|
||||
<body bgcolor="#ffffff" style='background:#ffffff;'>
|
||||
<?php
|
||||
}
|
||||
//-->
|
||||
</script>
|
||||
</head>
|
||||
<body bgcolor="#ffffff" style='background:#ffffff;'>
|
||||
<?php
|
||||
|
||||
// Get input parameters
|
||||
$label = get_parameter ("label","");
|
||||
if (!isset($_GET["period"]) OR (!isset($_GET["id"]))) {
|
||||
echo "<h3 class='error'>".__('There was a problem locating the source of the graph')."</h3>";
|
||||
// Get input parameters
|
||||
$label = get_parameter ("label","");
|
||||
if (!isset($_GET["period"]) OR (!isset($_GET["id"]))) {
|
||||
echo "<h3 class='error'>" .
|
||||
__('There was a problem locating the source of the graph') .
|
||||
"</h3>";
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
$period = get_parameter ( "period", SECONDS_1HOUR);
|
||||
$draw_alerts = get_parameter("draw_alerts", 0);
|
||||
$avg_only = get_parameter ("avg_only", 1);
|
||||
$show_other = (bool)get_parameter('show_other', false);
|
||||
if ($show_other) {
|
||||
$period = get_parameter ( "period", SECONDS_1HOUR);
|
||||
$draw_alerts = get_parameter("draw_alerts", 0);
|
||||
$avg_only = get_parameter ("avg_only", 1);
|
||||
$show_other = (bool)get_parameter('show_other', false);
|
||||
if ($show_other) {
|
||||
$avg_only = 0;
|
||||
}
|
||||
$period = get_parameter ("period", 86400);
|
||||
$id = get_parameter ("id", 0);
|
||||
$width = get_parameter ("width", 555);
|
||||
$height = get_parameter ("height", 245);
|
||||
$label = get_parameter ("label", "");
|
||||
$start_date = get_parameter ("start_date", date("Y-m-d"));
|
||||
$draw_events = get_parameter ("draw_events", 0);
|
||||
$graph_type = get_parameter ("type", "sparse");
|
||||
$zoom = get_parameter ("zoom", 1);
|
||||
$baseline = get_parameter ("baseline", 0);
|
||||
$show_events_graph = get_parameter ("show_events_graph", 0);
|
||||
}
|
||||
$period = get_parameter ("period", 86400);
|
||||
$id = get_parameter ("id", 0);
|
||||
$width = get_parameter ("width", 555);
|
||||
$height = get_parameter ("height", 245);
|
||||
$label = get_parameter ("label", "");
|
||||
$start_date = get_parameter ("start_date", date("Y-m-d"));
|
||||
$draw_events = get_parameter ("draw_events", 0);
|
||||
$graph_type = get_parameter ("type", "sparse");
|
||||
$zoom = get_parameter ("zoom", 1);
|
||||
$baseline = get_parameter ("baseline", 0);
|
||||
$show_events_graph = get_parameter ("show_events_graph", 0);
|
||||
|
||||
if ($zoom > 1) {
|
||||
if ($zoom > 1) {
|
||||
$height = $height * ($zoom / 2.1);
|
||||
$width = $width * ($zoom / 1.4);
|
||||
|
||||
echo "<script type='text/javascript'>window.resizeTo($width + 80, $height + 120);</script>";
|
||||
}
|
||||
}
|
||||
|
||||
$utime = get_system_time ();
|
||||
$current = date("Y-m-d", $utime);
|
||||
$utime = get_system_time ();
|
||||
$current = date("Y-m-d", $utime);
|
||||
|
||||
if ($start_date != $current)
|
||||
if ($start_date != $current)
|
||||
$date = strtotime($start_date);
|
||||
else
|
||||
else
|
||||
$date = $utime;
|
||||
|
||||
$urlImage = 'http://';
|
||||
if ($config['https']) {
|
||||
$urlImage = 'http://';
|
||||
if ($config['https']) {
|
||||
$urlImage = 'https://';
|
||||
}
|
||||
$urlImage .= $_SERVER['SERVER_NAME'] . $config['homeurl'] . '/';
|
||||
}
|
||||
$urlImage .= $_SERVER['SERVER_NAME'] . $config['homeurl'] . '/';
|
||||
|
||||
// log4x doesnt support flash yet
|
||||
//
|
||||
if ($config['flash_charts'] == 1)
|
||||
// log4x doesnt support flash yet
|
||||
//
|
||||
if ($config['flash_charts'] == 1)
|
||||
echo '<div style="margin-left: 70px">';
|
||||
else
|
||||
else
|
||||
echo '<div style="margin-left: 50px">';
|
||||
switch ($graph_type) {
|
||||
switch ($graph_type) {
|
||||
case 'boolean':
|
||||
echo grafico_modulo_boolean ($id, $period, $draw_events, $width, $height,
|
||||
$label, null, $draw_alerts, $avg_only, false, $date, false, $urlImage, 'adapter_'.$graph_type);
|
||||
|
@ -246,75 +244,131 @@ switch ($graph_type) {
|
|||
default:
|
||||
echo fs_error_image ('../images');
|
||||
break;
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
echo '</div>';
|
||||
|
||||
//z-index is 1 because 2 made the calendar show under the divmenu.
|
||||
echo '<div id="divmenu" class="menu" style="z-index:1; height: 98%;"><b>'.__('Pandora FMS Graph configuration menu').'</b><br /><br />'.__('Please, make your changes and apply with the <i>Reload</i> button');
|
||||
echo '<div style="float: left">';
|
||||
echo '<form method="get" action="stat_win.php">';
|
||||
html_print_input_hidden ("id", $id);
|
||||
html_print_input_hidden ("label", $label);
|
||||
//z-index is 1 because 2 made the calendar show under the divmenu.
|
||||
?>
|
||||
<div id="divmenu" class="menu" style="z-index:1; height: 98%;">
|
||||
<b> <?php echo __('Pandora FMS Graph configuration menu');?></b>
|
||||
<br />
|
||||
<br />
|
||||
<?php
|
||||
echo __('Please, make your changes and apply with the <i>Reload</i> button');
|
||||
?>
|
||||
<div style="float: left; width: 80%;">
|
||||
<form method="get" action="stat_win.php">
|
||||
<?php
|
||||
html_print_input_hidden ("id", $id);
|
||||
html_print_input_hidden ("label", $label);
|
||||
|
||||
if (isset($_GET["type"])) {
|
||||
if (isset($_GET["type"])) {
|
||||
$type = get_parameter_get ("type");
|
||||
html_print_input_hidden ("type", $type);
|
||||
}
|
||||
echo '<table class="databox_frame" cellspacing="5">';
|
||||
echo '<tr><td>'.__('Refresh time').'</td><td colspan="2">';
|
||||
|
||||
html_print_input_text ("refresh", $refresh, '', 5);
|
||||
|
||||
echo ' '.__('Avg. Only');
|
||||
|
||||
html_print_checkbox ("avg_only", 1, (bool) $avg_only, false, false, 'show_others()');
|
||||
html_print_input_hidden('show_other', 0);
|
||||
|
||||
echo '<tr><td>'.__('Begin date').'</td><td>';
|
||||
|
||||
html_print_input_text ("start_date", substr ($start_date, 0, 10),'', 10);
|
||||
html_print_image ("images/calendar_view_day.png", false, array ("onclick" => "scwShow(scwID('text-start_date'),this);"));
|
||||
|
||||
echo '</td></tr><tr><td>'.__('Zoom factor').'</td>';
|
||||
echo '<td>';
|
||||
|
||||
$options = array ();
|
||||
$options[$zoom] = 'x'.$zoom;
|
||||
$options[1] = 'x1';
|
||||
$options[2] = 'x2';
|
||||
$options[3] = 'x3';
|
||||
$options[4] = 'x4';
|
||||
|
||||
html_print_select ($options, "zoom", $zoom);
|
||||
|
||||
echo '</td></tr><tr><td>'.__('Time range').'</td><td>';
|
||||
|
||||
html_print_extended_select_for_time('period', $period, '', '', 0, 7);
|
||||
|
||||
echo '</td></tr><tr><td>'.__('Show events').'</td><td>';
|
||||
|
||||
html_print_checkbox ("draw_events", 1, (bool) $draw_events);
|
||||
|
||||
echo '</td></tr><tr><td>'.__('Show alerts').'</td><td>';
|
||||
|
||||
html_print_checkbox ("draw_alerts", 1, (bool) $draw_alerts);
|
||||
|
||||
if ($config['enterprise_installed'] && $graph_type == "sparse") {
|
||||
echo '</td></tr><tr><td>'.__('Draw baseline').'</td><td>';
|
||||
}
|
||||
?>
|
||||
<table class="databox_frame" cellspacing="5" width="100%">
|
||||
<tr>
|
||||
<td><?php echo __('Refresh time');?></td>
|
||||
<td>
|
||||
<?php
|
||||
html_print_extended_select_for_time(
|
||||
"refresh", $refresh, '', '', 0, 7);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo __('Avg. Only'); ?></td>
|
||||
<td>
|
||||
<?php
|
||||
html_print_checkbox ("avg_only", 1, (bool) $avg_only, false, false, 'show_others()');
|
||||
html_print_input_hidden('show_other', 0);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo __('Begin date'); ?></td>
|
||||
<td>
|
||||
<?php
|
||||
html_print_input_text ("start_date", substr ($start_date, 0, 10),'', 10);
|
||||
html_print_image ("images/calendar_view_day.png", false, array ("onclick" => "scwShow(scwID('text-start_date'),this);"));
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo __('Zoom factor');?></td>
|
||||
<td>
|
||||
<?php
|
||||
$options = array ();
|
||||
$options[$zoom] = 'x'.$zoom;
|
||||
$options[1] = 'x1';
|
||||
$options[2] = 'x2';
|
||||
$options[3] = 'x3';
|
||||
$options[4] = 'x4';
|
||||
html_print_select ($options, "zoom", $zoom);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo __('Time range'); ?></td>
|
||||
<td>
|
||||
<?php
|
||||
html_print_extended_select_for_time('period',
|
||||
$period, '', '', 0, 7);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo __('Show events');?></td>
|
||||
<td>
|
||||
<?php
|
||||
html_print_checkbox ("draw_events", 1, (bool) $draw_events);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php echo __('Show alerts');?></td>
|
||||
<td>
|
||||
<?php
|
||||
html_print_checkbox ("draw_alerts", 1, (bool) $draw_alerts);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
if ($config['enterprise_installed'] && $graph_type == "sparse") {
|
||||
echo '<tr>';
|
||||
echo '<td>' . __('Draw baseline') . '</td>';
|
||||
echo '<td>';
|
||||
html_print_checkbox ("baseline", 1, (bool) $baseline);
|
||||
}
|
||||
|
||||
echo '</td><td>';
|
||||
|
||||
echo '</td></tr><tr><td>'.__('Show event graph').'</td><td>';
|
||||
html_print_checkbox ("show_events_graph", 1, (bool) $show_events_graph);
|
||||
|
||||
echo '</td></tr>';
|
||||
echo '<tr><td></td><td style="text-align: right">';
|
||||
|
||||
html_print_submit_button (__('Reload'), "submit", false, 'class="sub next"');
|
||||
|
||||
echo '</td></tr></table></form></div><div id="show_menu" style="position: relative; border:1px solid #FFF; float: right; height: 50px; width: 50px;">' . html_print_image("images/graphmenu_arrow.png", true, array('id' => 'graph_menu_arrow')) . '<div></div></body></html>';
|
||||
?>
|
||||
</body>
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo __('Show event graph');?></td>
|
||||
<td>
|
||||
<?php
|
||||
html_print_checkbox ("show_events_graph",
|
||||
1, (bool) $show_events_graph);
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td style="text-align: right">
|
||||
<?php
|
||||
html_print_submit_button (__('Reload'), "submit", false, 'class="sub next"');
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
<div id="show_menu" style="position: relative; border:1px solid #FFF; float: right; height: 50px; width: 50px;">
|
||||
<?php
|
||||
html_print_image("images/graphmenu_arrow.png", false, array('id' => 'graph_menu_arrow'));
|
||||
?>
|
||||
<div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Reference in New Issue