2013-02-22 Sergio Martin <sergio.martin@artica.es>
* include/functions_html.php include/styles/pandora.css include/functions_graph.php include/functions_events.php include/javascript/pandora.js operation/agentes/estado_generalagente.php: Improve agent view interface, work in hidden menus to improve more the graphs layout. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7706 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
3e46f8fa34
commit
637521475a
|
@ -1,3 +1,14 @@
|
||||||
|
2013-02-22 Sergio Martin <sergio.martin@artica.es>
|
||||||
|
|
||||||
|
* include/functions_html.php
|
||||||
|
include/styles/pandora.css
|
||||||
|
include/functions_graph.php
|
||||||
|
include/functions_events.php
|
||||||
|
include/javascript/pandora.js
|
||||||
|
operation/agentes/estado_generalagente.php: Improve agent view
|
||||||
|
interface, work in hidden menus to improve more the graphs
|
||||||
|
layout.
|
||||||
|
|
||||||
2013-02-22 Sancho Lerena <slerena@artica.es>
|
2013-02-22 Sancho Lerena <slerena@artica.es>
|
||||||
|
|
||||||
* include/api.php: Added a single protection on DoS attacks.
|
* include/api.php: Added a single protection on DoS attacks.
|
||||||
|
|
|
@ -693,6 +693,39 @@ function events_create_event ($event, $id_group, $id_agent, $status = 0, $id_use
|
||||||
return (int) db_process_sql ($sql, "insert_id");
|
return (int) db_process_sql ($sql, "insert_id");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Print tiny statistics of an agent
|
||||||
|
*
|
||||||
|
* @param integer number of total modules
|
||||||
|
* @param integer number of normal modules
|
||||||
|
* @param integer number of critical modules
|
||||||
|
* @param integer number of warning modules
|
||||||
|
* @param integer number of unknown modules
|
||||||
|
* @param bool return or echo flag
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
function events_tiny_stats ($total_modules, $normal_modules, $critical_modules, $warning_modules, $unknown_modules, $return = false) {
|
||||||
|
$out = '<b>' . $total_modules;
|
||||||
|
if ($critical_modules > 0)
|
||||||
|
$out .= ' : <span class="red">' . $critical_modules . '</span>';
|
||||||
|
if ($warning_modules > 0)
|
||||||
|
$out .= ' : <span class="yellow">' . $warning_modules . '</span>';
|
||||||
|
if ($unknown_modules > 0)
|
||||||
|
$out .= ' : <span class="grey">' . $unknown_modules . '</span>';
|
||||||
|
if ($normal_modules > 0)
|
||||||
|
$out .= ' : <span class="green">' . $normal_modules . '</span>';
|
||||||
|
|
||||||
|
$out .= '</b>';
|
||||||
|
|
||||||
|
if ($return) {
|
||||||
|
return $out;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
echo $out;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prints a small event table
|
* Prints a small event table
|
||||||
*
|
*
|
||||||
|
|
|
@ -1368,20 +1368,6 @@ function graph_agent_status ($id_agent, $width = 300, $height = 200, $return = f
|
||||||
$out = pie2d_graph($config['flash_charts'], $data, $width, $height, __("other"),
|
$out = pie2d_graph($config['flash_charts'], $data, $width, $height, __("other"),
|
||||||
'', $water_mark, $config['fontpath'], $config['font_size'], 1, "hidden", $colors);
|
'', $water_mark, $config['fontpath'], $config['font_size'], 1, "hidden", $colors);
|
||||||
|
|
||||||
$out .= '<div style="text-align: center; width: ' . $width . 'px;"><b>';
|
|
||||||
|
|
||||||
$out .= array_sum($data);
|
|
||||||
if ($data['Critical'] > 0)
|
|
||||||
$out .= ' : <span class="red">' . $data["Critical"] . '</span>';
|
|
||||||
if ($data["Warning"] > 0)
|
|
||||||
$out .= ' : <span class="yellow">' . $data["Warning"] . '</span>';
|
|
||||||
if ($data["Unknown"] > 0)
|
|
||||||
$out .= ' : <span class="grey">' . $data["Unknown"] . '</span>';
|
|
||||||
if ($data["Normal"] > 0)
|
|
||||||
$out .= ' : <span class="green">' . $data["Normal"] . '</span>';
|
|
||||||
|
|
||||||
$out .= '</b></div>';
|
|
||||||
|
|
||||||
if ($return) {
|
if ($return) {
|
||||||
return $out;
|
return $out;
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,6 +127,9 @@ function html_print_side_layer ($params) {
|
||||||
'bottom_text' => '',
|
'bottom_text' => '',
|
||||||
'top' => '0',
|
'top' => '0',
|
||||||
'autotop' => '',
|
'autotop' => '',
|
||||||
|
'right' => '0',
|
||||||
|
'autoright' => '',
|
||||||
|
'vertical_mode' => 'out',
|
||||||
'icon_width' => 50,
|
'icon_width' => 50,
|
||||||
'icon_height' => 50,
|
'icon_height' => 50,
|
||||||
'icon_open' => $params['icon_closed']
|
'icon_open' => $params['icon_closed']
|
||||||
|
@ -151,6 +154,11 @@ function html_print_side_layer ($params) {
|
||||||
$body_float = 'right';
|
$body_float = 'right';
|
||||||
$button_float = 'left';
|
$button_float = 'left';
|
||||||
break;
|
break;
|
||||||
|
case 'bottom':
|
||||||
|
$round_class = 'menu_sidebar_radius_left menu_sidebar_radius_right';
|
||||||
|
$body_float = 'right';
|
||||||
|
$button_float = 'left';
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$out_html = '<div id="side_layer" class="menu_sidebar ' . $round_class . '" style="display:none; z-index:1; overflow: hidden; height: ' . $params['height'] . ';">';
|
$out_html = '<div id="side_layer" class="menu_sidebar ' . $round_class . '" style="display:none; z-index:1; overflow: hidden; height: ' . $params['height'] . ';">';
|
||||||
|
@ -163,7 +171,7 @@ function html_print_side_layer ($params) {
|
||||||
|
|
||||||
$top = '<div id="side_top_text" style="width: 100%";">' . $params['top_text'] . '</div>';
|
$top = '<div id="side_top_text" style="width: 100%";">' . $params['top_text'] . '</div>';
|
||||||
|
|
||||||
$button = '<div id="show_menu" style="vertical-align: middle; position: relative; border:1px solid #FFF; width: ' . $params['icon_width'] . 'px; height: ' . $params['icon_height'] . 'px;">';
|
$button = '<div id="show_menu" style="vertical-align: middle; position: relative; border:1px solid #FFF; width: ' . $params['icon_width'] . 'px; margin: auto; height: ' . $params['icon_height'] . 'px;">';
|
||||||
$button .= html_print_image($params['position'] == 'left' ? $params['icon_open'] : $params['icon_closed'], true, array('id' => 'graph_menu_arrow'));
|
$button .= html_print_image($params['position'] == 'left' ? $params['icon_open'] : $params['icon_closed'], true, array('id' => 'graph_menu_arrow'));
|
||||||
$button .= '</div>';
|
$button .= '</div>';
|
||||||
|
|
||||||
|
@ -204,6 +212,21 @@ function html_print_side_layer ($params) {
|
||||||
$table->data[2][1] = $bottom;
|
$table->data[2][1] = $bottom;
|
||||||
$table->rowclass[2] = '';
|
$table->rowclass[2] = '';
|
||||||
break;
|
break;
|
||||||
|
case 'bottom':
|
||||||
|
$table->data[0][0] = $button;
|
||||||
|
$table->cellstyle[0][0] = 'text-align: center;';
|
||||||
|
$table->rowclass[0] = '';
|
||||||
|
|
||||||
|
$table->data[1][0] = $top;
|
||||||
|
$table->rowclass[1] = '';
|
||||||
|
|
||||||
|
|
||||||
|
$table->data[2][0] = $body;
|
||||||
|
$table->rowclass[2] = '';
|
||||||
|
|
||||||
|
$table->data[3][0] = $bottom;
|
||||||
|
$table->rowclass[3] = '';
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$out_html .= html_print_table($table, true);
|
$out_html .= html_print_table($table, true);
|
||||||
|
@ -212,88 +235,10 @@ function html_print_side_layer ($params) {
|
||||||
|
|
||||||
$out_js = "<script type='text/javascript'>
|
$out_js = "<script type='text/javascript'>
|
||||||
<!--
|
<!--
|
||||||
var defSlideTime = 220;
|
hidded_sidebar('" . $params['position'] . "', " . $params['width'] . ", '" . $params['height'] . "', " . $params['icon_width'] . ",
|
||||||
var visibleMargin = " . $params['icon_width'] . " + 10;
|
'" . $params['top'] . "', '" . $params['autotop'] . "', '" . $params['right'] . "',
|
||||||
var menuW = " . $params['width'] . ";
|
'" . $params['autoright'] . "', '" . $params['icon_closed'] . "', '" . $params['icon_open'] . "', '" . $config['homeurl'] . "'
|
||||||
var hiddenMargin = menuW - visibleMargin;
|
, '" . $params['vertical_mode'] . "');
|
||||||
var windowWidth = $(window).width();
|
|
||||||
var position = '" . $params['position'] . "';
|
|
||||||
var sideClosed = 1;
|
|
||||||
var top_dist = '" . $params['top'] ."';
|
|
||||||
var autotop = '" . $params['autotop'] ."';
|
|
||||||
|
|
||||||
if(top_dist == 'auto_over') {
|
|
||||||
top_dist = $('#' + autotop).offset().top;
|
|
||||||
}
|
|
||||||
else if(top_dist == 'auto_below') {
|
|
||||||
top_dist = $('#' + autotop).offset().top + $('#' + autotop).height();
|
|
||||||
}
|
|
||||||
|
|
||||||
$(document).ready( function() {
|
|
||||||
// SET INITIAL POSITION AND SHOW LAYER
|
|
||||||
$('#side_layer').css('top', top_dist);
|
|
||||||
switch (position) {
|
|
||||||
case 'left':
|
|
||||||
$('#side_layer').css('left', -hiddenMargin);
|
|
||||||
break;
|
|
||||||
case 'right':
|
|
||||||
$('#side_layer').css('left', windowWidth - visibleMargin - 1);
|
|
||||||
$('#side_layer').css('width', visibleMargin + 'px');
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
$('#side_layer').show();
|
|
||||||
|
|
||||||
$(\"#graph_menu_arrow\").click(function(){
|
|
||||||
switch(position) {
|
|
||||||
case 'right':
|
|
||||||
if (sideClosed == 0){
|
|
||||||
$('#side_layer').animate({\"width\": \"-=\" + (hiddenMargin) + \"px\", \"left\": \"+=\" + (hiddenMargin) + \"px\"}, defSlideTime);
|
|
||||||
$(\"#graph_menu_arrow\").attr(\"src\", \"" . $config['homeurl'] . $params['icon_closed'] . "\");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$('#side_layer').animate({\"width\": \"+=\" + (hiddenMargin) + \"px\", \"left\": \"-=\" + (hiddenMargin) + \"px\"}, defSlideTime);
|
|
||||||
$(\"#graph_menu_arrow\").attr(\"src\", \"" . $config['homeurl'] . $params['icon_open'] . "\");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'left':
|
|
||||||
if (sideClosed == 1){
|
|
||||||
$('#side_layer').animate({\"left\": \"+=\" + (hiddenMargin) + \"px\"}, defSlideTime);
|
|
||||||
|
|
||||||
$(\"#graph_menu_arrow\").attr(\"src\", \"" . $config['homeurl'] . $params['icon_closed'] . "\");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$('#side_layer').animate({\"left\": \"-=\" + (hiddenMargin) + \"px\"}, defSlideTime);
|
|
||||||
$(\"#graph_menu_arrow\").attr(\"src\", \"" . $config['homeurl'] . $params['icon_open'] . "\");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(sideClosed == 0) {
|
|
||||||
//$('#side_top_text').hide();
|
|
||||||
//$('#side_body_text').hide();
|
|
||||||
//$('#side_bottom_text').hide();
|
|
||||||
sideClosed = 1;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$('#side_top_text').show();
|
|
||||||
$('#side_body_text').show();
|
|
||||||
$('#side_bottom_text').show();
|
|
||||||
sideClosed = 0;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
if(position == 'right') {
|
|
||||||
// Move the right menu if window is resized
|
|
||||||
$(window).resize(function() {
|
|
||||||
var newWindowWidth = $(window).width();
|
|
||||||
var widthVariation = newWindowWidth - windowWidth;
|
|
||||||
$('#side_layer').animate({\"left\": \"+=\" + (widthVariation) + \"px\"}, 0);
|
|
||||||
|
|
||||||
windowWidth = newWindowWidth;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
//-->
|
//-->
|
||||||
</script>";
|
</script>";
|
||||||
|
|
||||||
|
@ -1178,6 +1123,7 @@ function html_print_textarea ($name, $rows, $columns, $value = '', $attributes =
|
||||||
* $table->tablealign - Align the whole table (float left or right)
|
* $table->tablealign - Align the whole table (float left or right)
|
||||||
* $table->cellpadding - Padding on each cell
|
* $table->cellpadding - Padding on each cell
|
||||||
* $table->cellspacing - Spacing between cells
|
* $table->cellspacing - Spacing between cells
|
||||||
|
* $table->cellstyle - Style of a cell
|
||||||
* $table->class - CSS table class
|
* $table->class - CSS table class
|
||||||
* $table->id - Table ID (useful in JavaScript)
|
* $table->id - Table ID (useful in JavaScript)
|
||||||
* $table->headclass[] - An array of classes for each heading
|
* $table->headclass[] - An array of classes for each heading
|
||||||
|
@ -1261,6 +1207,13 @@ function html_print_table (&$table, $return = false) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (isset ($table->cellstyle)) {
|
||||||
|
foreach ($table->cellstyle as $keyrow => $cstyle) {
|
||||||
|
foreach ($cstyle as $key => $style) {
|
||||||
|
$cellstyle[$keyrow][$key] = $style;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (isset ($table->rowspan)) {
|
if (isset ($table->rowspan)) {
|
||||||
foreach ($table->rowspan as $keyrow => $rspan) {
|
foreach ($table->rowspan as $keyrow => $rspan) {
|
||||||
|
@ -1381,6 +1334,9 @@ function html_print_table (&$table, $return = false) {
|
||||||
if (!isset ($size[$key])) {
|
if (!isset ($size[$key])) {
|
||||||
$size[$key] = '';
|
$size[$key] = '';
|
||||||
}
|
}
|
||||||
|
if (!isset ($cellstyle[$keyrow][$key])) {
|
||||||
|
$cellstyle[$keyrow][$key] = '';
|
||||||
|
}
|
||||||
if (!isset ($colspan[$keyrow][$key])) {
|
if (!isset ($colspan[$keyrow][$key])) {
|
||||||
$colspan[$keyrow][$key] = '';
|
$colspan[$keyrow][$key] = '';
|
||||||
}
|
}
|
||||||
|
@ -1400,7 +1356,7 @@ function html_print_table (&$table, $return = false) {
|
||||||
$style[$key] = '';
|
$style[$key] = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$output .= '<td id="'.$tableid.'-'.$keyrow.'-'.$key.'" style="'. $style[$key].$valign[$key].$align[$key].$size[$key].$wrap[$key] .'" '.$colspan[$keyrow][$key].' '.$rowspan[$keyrow][$key].' class="'.$class.'">'. $item .'</td>'."\n";
|
$output .= '<td id="'.$tableid.'-'.$keyrow.'-'.$key.'" style="'. $cellstyle[$keyrow][$key].$style[$key].$valign[$key].$align[$key].$size[$key].$wrap[$key] .'" '.$colspan[$keyrow][$key].' '.$rowspan[$keyrow][$key].' class="'.$class.'">'. $item .'</td>'."\n";
|
||||||
}
|
}
|
||||||
$output .= '</tr>'."\n";
|
$output .= '</tr>'."\n";
|
||||||
}
|
}
|
||||||
|
|
|
@ -641,3 +641,129 @@ function adjustTextUnits(name) {
|
||||||
selectFirst(name+'_units');
|
selectFirst(name+'_units');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sidebar function
|
||||||
|
* params:
|
||||||
|
* menuW: $params['width']
|
||||||
|
* icon_width: $params['icon_width']
|
||||||
|
* position: $params['position']
|
||||||
|
* top_dist: $params['top']
|
||||||
|
* autotop: $params['autotop']
|
||||||
|
* icon_closed: $params['icon_closed']
|
||||||
|
* icon_open: $params['icon_open']
|
||||||
|
* homeurl: $config['homeurl']
|
||||||
|
*
|
||||||
|
**/
|
||||||
|
function hidded_sidebar(position, menuW, menuH, icon_width, top_dist, autotop, right_dist, autoright, icon_closed, icon_open, homeurl, vertical_mode) {
|
||||||
|
var defSlideTime = 220;
|
||||||
|
var visibleMargin = icon_width + 10;
|
||||||
|
var hiddenMarginW = menuW - visibleMargin;
|
||||||
|
menuH = parseInt(menuH);
|
||||||
|
var hiddenMarginH = menuH - visibleMargin;
|
||||||
|
var windowWidth = $(window).width();
|
||||||
|
var sideClosed = 1;
|
||||||
|
|
||||||
|
if(top_dist == 'auto_over') {
|
||||||
|
top_dist = $('#' + autotop).offset().top;
|
||||||
|
}
|
||||||
|
else if(top_dist == 'auto_below') {
|
||||||
|
top_dist = $('#' + autotop).offset().top + $('#' + autotop).height();
|
||||||
|
switch(position) {
|
||||||
|
case 'bottom':
|
||||||
|
if(vertical_mode == 'in') {
|
||||||
|
top_dist -= visibleMargin + 10;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(right_dist == 'auto_right') {
|
||||||
|
right_dist = $('#' + autoright).offset().left + $('#' + autoright).width();
|
||||||
|
}
|
||||||
|
else if(right_dist == 'auto_left') {
|
||||||
|
right_dist = $('#' + autoright).offset().left;
|
||||||
|
}
|
||||||
|
|
||||||
|
$(document).ready( function() {
|
||||||
|
// SET INITIAL POSITION AND SHOW LAYER
|
||||||
|
$('#side_layer').css('top', top_dist);
|
||||||
|
switch (position) {
|
||||||
|
case 'left':
|
||||||
|
$('#side_layer').css('left', -hiddenMarginW);
|
||||||
|
break;
|
||||||
|
case 'right':
|
||||||
|
$('#side_layer').css('left', windowWidth - visibleMargin - 1);
|
||||||
|
$('#side_layer').css('width', visibleMargin + 'px');
|
||||||
|
break;
|
||||||
|
case 'bottom':
|
||||||
|
$('#side_layer').css('left', right_dist - menuW);
|
||||||
|
$('#side_layer').css('height', visibleMargin + 'px');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$('#side_layer').show();
|
||||||
|
|
||||||
|
$("#graph_menu_arrow").click(function(){
|
||||||
|
switch(position) {
|
||||||
|
case 'right':
|
||||||
|
if (sideClosed == 0){
|
||||||
|
$('#side_layer').animate({"width": "-=" + (hiddenMarginW) + "px", "left": "+=" + (hiddenMarginW) + "px"}, defSlideTime);
|
||||||
|
$("#graph_menu_arrow").attr("src", homeurl + icon_closed);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$('#side_layer').animate({"width": "+=" + (hiddenMarginW) + "px", "left": "-=" + (hiddenMarginW) + "px"}, defSlideTime);
|
||||||
|
$("#graph_menu_arrow").attr("src", homeurl + icon_open);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'left':
|
||||||
|
if (sideClosed == 1){
|
||||||
|
$('#side_layer').animate({"left": "+=" + (hiddenMarginW) + "px"}, defSlideTime);
|
||||||
|
|
||||||
|
$("#graph_menu_arrow").attr("src", homeurl + icon_closed);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$('#side_layer').animate({"left": "-=" + (hiddenMarginW) + "px"}, defSlideTime);
|
||||||
|
$("#graph_menu_arrow").attr("src", homeurl + icon_open);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'bottom':
|
||||||
|
if (sideClosed == 0){
|
||||||
|
$('#side_layer').animate({"height": "-=" + (hiddenMarginH+10) + "px", "top": "+=" + (hiddenMarginH) + "px"}, defSlideTime);
|
||||||
|
$("#graph_menu_arrow").attr("src", homeurl + icon_closed);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$('#side_layer').animate({"height": "+=" + (hiddenMarginH-10) + "px", "top": "-=" + (hiddenMarginH) + "px"}, defSlideTime);
|
||||||
|
$("#graph_menu_arrow").attr("src", homeurl + icon_open);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(sideClosed == 0) {
|
||||||
|
//$('#side_top_text').hide();
|
||||||
|
//$('#side_body_text').hide();
|
||||||
|
//$('#side_bottom_text').hide();
|
||||||
|
sideClosed = 1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$('#side_top_text').show();
|
||||||
|
$('#side_body_text').show();
|
||||||
|
$('#side_bottom_text').show();
|
||||||
|
sideClosed = 0;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
switch(position) {
|
||||||
|
case 'right':
|
||||||
|
case 'bottom':
|
||||||
|
// Move the right menu if window is resized
|
||||||
|
$(window).resize(function() {
|
||||||
|
var newWindowWidth = $(window).width();
|
||||||
|
var widthVariation = newWindowWidth - windowWidth;
|
||||||
|
$('#side_layer').animate({"left": "+=" + (widthVariation) + "px"}, 0);
|
||||||
|
|
||||||
|
windowWidth = newWindowWidth;
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1786,4 +1786,8 @@ span#plugin_description {
|
||||||
-moz-border-top-right-radius: 10px;
|
-moz-border-top-right-radius: 10px;
|
||||||
-webkit-border-top-right-radius: 10px;
|
-webkit-border-top-right-radius: 10px;
|
||||||
border-top-right-radius: 10px;
|
border-top-right-radius: 10px;
|
||||||
|
|
||||||
|
-moz-border-bottom-right-radius: 10px;
|
||||||
|
-webkit-border-bottom-right-radius: 10px;
|
||||||
|
border-bottom-right-radius: 10px;
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,40 +50,98 @@ if (! check_acl ($config["id_user"], $agent["id_grupo"], "AR") && !$is_extra) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$table->id = 'agent_datails';
|
// START: TABLE AGENT BUILD
|
||||||
|
$table_agent->id = 'agent_details_main';
|
||||||
|
$table_agent->width = '500px';
|
||||||
|
$table_agent->cellspacing = 4;
|
||||||
|
$table_agent->cellpadding = 4;
|
||||||
|
$table_agent->class = 'databox_frame';
|
||||||
|
$table_agent->style[1] = 'width: 100px;';
|
||||||
|
$table_agent->style[2] = 'width: 16px;';
|
||||||
|
$data = array();
|
||||||
|
|
||||||
|
$agent_name = ui_print_agent_name ($agent["id_agente"], true, 500, "text-transform: uppercase; font-size: medium;", true);
|
||||||
|
|
||||||
|
if ($agent['disabled']) {
|
||||||
|
$agent_name = "<em>" . $agent_name . "</em>" . ui_print_help_tip(__('Disabled'), true);
|
||||||
|
}
|
||||||
|
else if ($agent['quiet']) {
|
||||||
|
$agent_name = "<em>" . $agent_name . " " . html_print_image("images/dot_green.disabled.png", true, array("border" => '0', "title" => __('Quiet'), "alt" => "")) . "</em>";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$agent_name = $agent_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
$data[0] = ui_print_group_icon ($agent["id_grupo"], true) . ' ';
|
||||||
|
$data[0] .= $agent_name;
|
||||||
|
|
||||||
|
$status_img = agents_tree_view_status_img ($agent["critical_count"],
|
||||||
|
$agent["warning_count"], $agent["unknown_count"]);
|
||||||
|
$data[1] = events_tiny_stats ($agent['total_count'], $agent['normal_count'], $agent['critical_count'], $agent['warning_count'], $agent['unknown_count'], true);
|
||||||
|
$data[2] = str_replace('.png' ,'_ball.png', $status_img);
|
||||||
|
|
||||||
|
$table_agent->data[] = $data;
|
||||||
|
$table_agent->rowclass[] = '';
|
||||||
|
|
||||||
|
$data = array();
|
||||||
|
$addresses = agents_get_addresses($id_agente);
|
||||||
|
$address = agents_get_address($id_agente);
|
||||||
|
foreach($addresses as $k => $add) {
|
||||||
|
if($add == $address) {
|
||||||
|
unset($addresses[$k]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$data[0] = html_print_image('images/world.png', true, array('title' => __('IP address'))) . ' ';
|
||||||
|
$data[0] .= empty($address) ? '<em>' . __('N/A') . '</em>' : $address;
|
||||||
|
if (!empty($addresses)) {
|
||||||
|
$data[0] .= ui_print_help_tip(__('Other IP addresses').': <br>'.implode('<br>',$addresses), true);
|
||||||
|
}
|
||||||
|
$table_agent->cellstyle[1][0] = 'padding-left:50px;';
|
||||||
|
|
||||||
|
$data[1] = graph_agent_status ($id_agente, 120, 120, true);
|
||||||
|
$table_agent->rowspan[1][1] = 5;
|
||||||
|
$table_agent->colspan[1][1] = 2;
|
||||||
|
|
||||||
|
$table_agent->data[] = $data;
|
||||||
|
$table_agent->rowclass[] = '';
|
||||||
|
|
||||||
|
$data = array();
|
||||||
|
$data[0] = html_print_image('images/default_list.png', true, array('title' => __('Description'))) . ' ';
|
||||||
|
$data[0] .= empty($agent["comentarios"]) ? '<em>' . __('N/A') . '</em>' : $agent["comentarios"];
|
||||||
|
$table_agent->cellstyle[][0] = 'padding-left:50px;';
|
||||||
|
$table_agent->data[] = $data;
|
||||||
|
$table_agent->rowclass[] = '';
|
||||||
|
|
||||||
|
$data = array();
|
||||||
|
$data[0] = html_print_image('images/clock.png', true, array('title' => __('Interval'))) . ' ';
|
||||||
|
$data[0] .= human_time_description_raw ($agent["intervalo"]);
|
||||||
|
$table_agent->cellstyle[][0] = 'padding-left:50px;';
|
||||||
|
$table_agent->data[] = $data;
|
||||||
|
$table_agent->rowclass[] = '';
|
||||||
|
|
||||||
|
$data[0] = html_print_image('images/go_next.png', true, array('title' => __('Next contact'))) . ' ';
|
||||||
|
$progress = agents_get_next_contact($id_agente);
|
||||||
|
$data[0] .= progress_bar($progress, 200, 20);
|
||||||
|
$table_agent->cellstyle[][0] = 'padding-left:50px;';
|
||||||
|
$table_agent->data[] = $data;
|
||||||
|
$table_agent->rowclass[] = '';
|
||||||
|
|
||||||
|
// END: TABLE AGENT BUILD
|
||||||
|
|
||||||
|
$table->id = 'agent_details';
|
||||||
$table->width = '100%';
|
$table->width = '100%';
|
||||||
$table->cellspacing = 4;
|
$table->cellspacing = 4;
|
||||||
$table->cellpadding = 4;
|
$table->cellpadding = 4;
|
||||||
$table->class = 'databox';
|
$table->class = 'databox';
|
||||||
|
|
||||||
$data = array();
|
$data = array();
|
||||||
$data[0] = '<b>' . __('Agent name') . '</b>';
|
$data[0] = html_print_table($table_agent, true);
|
||||||
if ($agent['disabled']) {
|
|
||||||
$cellName = "<em>" . ui_print_agent_name ($agent["id_agente"], true, 500, "text-transform: uppercase;", true) . ui_print_help_tip(__('Disabled'), true) . "</em>";
|
|
||||||
}
|
|
||||||
else if ($agent['quiet']) {
|
|
||||||
$cellName = "<em>" . ui_print_agent_name ($agent["id_agente"], true, 500, "text-transform: uppercase;", true) .
|
|
||||||
" " . html_print_image("images/dot_green.disabled.png", true, array("border" => '0', "title" => __('Quiet'), "alt" => "")) . "</em>";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$cellName = ui_print_agent_name ($agent["id_agente"], true, 500, "text-transform: uppercase;", true);
|
|
||||||
}
|
|
||||||
$data[1] = $cellName;
|
|
||||||
$data[2] = '<b>' . __('IP Address') . '</b>';
|
|
||||||
$ips = array();
|
|
||||||
$addresses = agents_get_addresses ($id_agente);
|
|
||||||
$address = agents_get_address($id_agente);
|
|
||||||
|
|
||||||
foreach($addresses as $k => $add) {
|
$table->colspan[0][0] = 2;
|
||||||
if($add == $address) {
|
$table->rowspan[0][0] = 5;
|
||||||
unset($addresses[$k]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$data[3] = $address;
|
$data[2] = '<b>' . __('Parent') . '</b>';
|
||||||
if (!empty($addresses)) {
|
$data[3] = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$agent["id_parent"].'">'.agents_get_name ($agent["id_parent"]).'</a>';
|
||||||
$data[3] = ui_print_help_tip(__('Other IP addresses').': <br>'.implode('<br>',$addresses), true);
|
|
||||||
}
|
|
||||||
|
|
||||||
$data[4] = '<div style="width:100%; text-align:right">';
|
$data[4] = '<div style="width:100%; text-align:right">';
|
||||||
$data[4] .= '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agente.'&refr=60">' . html_print_image("images/refresh.png", true, array("border" => '0', "title" => __('Refresh data'), "alt" => "")) . '</a> ';
|
$data[4] .= '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$id_agente.'&refr=60">' . html_print_image("images/refresh.png", true, array("border" => '0', "title" => __('Refresh data'), "alt" => "")) . '</a> ';
|
||||||
|
@ -93,10 +151,8 @@ $data[4] .= '</div>';
|
||||||
$table->data[] = $data;
|
$table->data[] = $data;
|
||||||
$table->rowclass[] = '';
|
$table->rowclass[] = '';
|
||||||
|
|
||||||
|
|
||||||
$data = array();
|
$data = array();
|
||||||
$data[0] = '<b>' . __('Interval') . '</b>';
|
|
||||||
$data[1] = human_time_description_raw ($agent["intervalo"]);
|
|
||||||
$data[2] = '<b>' . __('OS') . '</b>';
|
$data[2] = '<b>' . __('OS') . '</b>';
|
||||||
$data[3] = ui_print_os_icon ($agent["id_os"], true, true);
|
$data[3] = ui_print_os_icon ($agent["id_os"], true, true);
|
||||||
|
|
||||||
|
@ -108,44 +164,34 @@ else
|
||||||
$osversion_offset = 0;
|
$osversion_offset = 0;
|
||||||
|
|
||||||
|
|
||||||
$data[3] .= ' <i><span title="'.$agent["os_version"].'">'.substr($agent["os_version"],$osversion_offset,15).' </span></i>';
|
$data[3] .= ' <i><span title="'.$agent["os_version"].'">'.$agent["os_version"].' </span></i>';
|
||||||
$table->data[] = $data;
|
$table->data[] = $data;
|
||||||
$table->rowclass[] = '';
|
$table->rowclass[] = '';
|
||||||
|
|
||||||
$data = array();
|
$data = array();
|
||||||
$data[0] = '<b>' . __('Parent') . '</b>';
|
|
||||||
$data[1] = '<a href="index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente='.$agent["id_parent"].'">'.agents_get_name ($agent["id_parent"]).'</a>';
|
|
||||||
$data[2] = '<b>' . __('Agent Version') . '</b>';
|
$data[2] = '<b>' . __('Agent Version') . '</b>';
|
||||||
$data[3] = $agent["agent_version"];
|
$data[3] = $agent["agent_version"];
|
||||||
$table->data[] = $data;
|
$table->data[] = $data;
|
||||||
$table->rowclass[] = '';
|
$table->rowclass[] = '';
|
||||||
|
|
||||||
$data = array();
|
$data = array();
|
||||||
$data[0] = '<b>' .__('Description'). '</b>';
|
$data[2] = '<b>' . __('Last contact') . ' / ' . __('Remote') . '</b>';
|
||||||
$data[1] = $agent["comentarios"];
|
$data[3] = ui_print_timestamp ($agent["ultimo_contacto"], true);
|
||||||
$data[2] = '<b>' . __('Group') . '</b>';
|
$data[3] .= " / ";
|
||||||
$data[3] = ui_print_group_icon ($agent["id_grupo"], true);
|
|
||||||
$data[3] .= ' (<b>';
|
if ($agent["ultimo_contacto_remoto"] == "01-01-1970 00:00:00") {
|
||||||
$data[3] .= ui_print_truncate_text(groups_get_name ($agent["id_grupo"]));
|
$data[3] .= __('Never');
|
||||||
$data[3] .= '</b>)';
|
}
|
||||||
|
else {
|
||||||
|
$data[3] .= $agent["ultimo_contacto_remoto"];
|
||||||
|
}
|
||||||
|
|
||||||
$table->data[] = $data;
|
$table->data[] = $data;
|
||||||
$table->rowclass[] = '';
|
$table->rowclass[] = '';
|
||||||
|
|
||||||
$data = array();
|
$data = array();
|
||||||
$data[0] = '<b>' . __('Last contact') . ' / ' . __('Remote') . '</b>';
|
$data[0] = '<b>' . __('Events (24h)') . '</b>';
|
||||||
$data[1] = ui_print_timestamp ($agent["ultimo_contacto"], true);
|
$data[1] = graph_graphic_agentevents ($id_agente, 290, 15, 86400, '', true);
|
||||||
$data[1] .= " / ";
|
|
||||||
|
|
||||||
if ($agent["ultimo_contacto_remoto"] == "01-01-1970 00:00:00") {
|
|
||||||
$data[1] .= __('Never');
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$data[1] .= $agent["ultimo_contacto_remoto"];
|
|
||||||
}
|
|
||||||
$data[2] = '<b>' . __('Next agent contact') . '</b>';
|
|
||||||
$progress = agents_get_next_contact($id_agente);
|
|
||||||
$data[3] = progress_bar($progress, 200, 20);
|
|
||||||
|
|
||||||
$table->data[] = $data;
|
$table->data[] = $data;
|
||||||
$table->rowclass[] = '';
|
$table->rowclass[] = '';
|
||||||
|
|
||||||
|
@ -184,6 +230,15 @@ if ($config['activate_gis'] || $agent['url_address'] != '') {
|
||||||
$table->rowclass[] = '';
|
$table->rowclass[] = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ACCESS RATE GRAPH
|
||||||
|
if($config["agentaccess"]) {
|
||||||
|
$data = array();
|
||||||
|
$data[0] = '<b>' . __('Agent access rate (24h)') . '</b>';
|
||||||
|
$data[1] = graphic_agentaccess($id_agente, 300, 110, 86400, true);
|
||||||
|
$table->data[] = $data;
|
||||||
|
$table->rowclass[] = '';
|
||||||
|
}
|
||||||
|
|
||||||
// Timezone Offset
|
// Timezone Offset
|
||||||
if ($agent['timezone_offset'] != 0) {
|
if ($agent['timezone_offset'] != 0) {
|
||||||
$data = array();
|
$data = array();
|
||||||
|
@ -193,55 +248,6 @@ if ($agent['timezone_offset'] != 0) {
|
||||||
$table->rowclass[] = '';
|
$table->rowclass[] = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if($config["agentaccess"]) {
|
|
||||||
$data = array();
|
|
||||||
$data[0] = '<b>' . __('Agent access rate (24h)') . '</b>';
|
|
||||||
$data[1] = graphic_agentaccess($id_agente, 350, 110, 8640000, true);
|
|
||||||
$table->rowspan[count($table->data)][0] = 4;
|
|
||||||
$table->rowspan[count($table->data)][1] = 4;
|
|
||||||
|
|
||||||
$data[2] = '<b>' . __('Agent status') . '</b>';
|
|
||||||
$status_img = agents_tree_view_status_img ($agent["critical_count"],
|
|
||||||
$agent["warning_count"], $agent["unknown_count"]);
|
|
||||||
$data[3] = $status_img;
|
|
||||||
$table->data[] = $data;
|
|
||||||
$table->rowclass[] = '';
|
|
||||||
|
|
||||||
$data = array();
|
|
||||||
$data[0] = '<b>' . __('Modules status') . '</b>';
|
|
||||||
$data[1] = graph_agent_status ($id_agente, 120, 120, true);
|
|
||||||
$table->rowspan[count($table->data)][2] = 2;
|
|
||||||
$table->rowspan[count($table->data)][3] = 2;
|
|
||||||
$table->data[] = $data;
|
|
||||||
$table->rowclass[] = '';
|
|
||||||
|
|
||||||
$data = array();
|
|
||||||
$data[0] = '<b>' . __('Events (24h)') . '</b>';
|
|
||||||
$data[1] = graph_graphic_agentevents ($id_agente, 290, 15, 86400, '', true);
|
|
||||||
$table->data[] = $data;
|
|
||||||
$table->rowclass[] = '';
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$data = array();
|
|
||||||
$data[0] = '<b>' . __('Modules status') . '</b>';
|
|
||||||
$data[1] = graph_agent_status ($id_agente, 120, 120, true);
|
|
||||||
$table->rowspan[count($table->data)][0] = 3;
|
|
||||||
$table->rowspan[count($table->data)][1] = 3;
|
|
||||||
|
|
||||||
$data[2] = '<b>' . __('Agent status') . '</b>';
|
|
||||||
$status_img = agents_tree_view_status_img ($agent["critical_count"],
|
|
||||||
$agent["warning_count"], $agent["unknown_count"]);
|
|
||||||
$data[3] = $status_img;
|
|
||||||
$table->data[] = $data;
|
|
||||||
$table->rowclass[] = '';
|
|
||||||
|
|
||||||
$data = array();
|
|
||||||
$data[0] = '<b>' . __('Events (24h)') . '</b>';
|
|
||||||
$data[3] = graph_graphic_agentevents ($id_agente, 290, 15, 86400, '', true);
|
|
||||||
$table->data[] = $data;
|
|
||||||
$table->rowclass[] = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Custom fields
|
// Custom fields
|
||||||
$fields = db_get_all_rows_filter('tagent_custom_fields', array('display_on_front' => 1));
|
$fields = db_get_all_rows_filter('tagent_custom_fields', array('display_on_front' => 1));
|
||||||
if ($fields === false) {
|
if ($fields === false) {
|
||||||
|
@ -262,4 +268,29 @@ foreach ($fields as $field) {
|
||||||
|
|
||||||
html_print_table($table);
|
html_print_table($table);
|
||||||
unset($table);
|
unset($table);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ACCESS RATE GRAPH IN HIDDEN BAR
|
||||||
|
if($config["agentaccess"]) {
|
||||||
|
$params = array();
|
||||||
|
$params['position'] = 'bottom';
|
||||||
|
$params['icon_closed'] = 'images/setup.png';
|
||||||
|
$params['body_text'] = '';
|
||||||
|
$params['body_text'] .= '<b>'.__('Agent access rate (24h)').'</b><br />';
|
||||||
|
$params['body_text'] .= '<div style="width:300px; margin: auto;">' . graphic_agentaccess($id_agente, 300, 110, 8640000, true) . '</div>';
|
||||||
|
|
||||||
|
$params['icon_closed'] = '/images/chart_curve';
|
||||||
|
$params['icon_open'] = '/images/chart_curve';
|
||||||
|
$params['height'] = '300px';
|
||||||
|
$params['top'] = 'auto_below';
|
||||||
|
$params['autotop'] = 'agent_details';
|
||||||
|
$params['right'] = 'auto_right';
|
||||||
|
$params['autoright'] = 'agent_details';
|
||||||
|
$params['icon_width'] = 16;
|
||||||
|
$params['icon_height'] = 16;
|
||||||
|
$params['vertical_mode'] = 'in';
|
||||||
|
|
||||||
|
html_print_side_layer($params);
|
||||||
|
}
|
||||||
|
*/
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in New Issue