diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 91b25f6247..e11eadb6e7 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,12 @@ +2013-08-02 Miguel de Dios + + * include/graphs/functions_gd.php, include/graphs/fgraph.php, + include/functions.php, include/functions_graph.php, + include/functions_visual_map.php, + include/ajax/visual_console_builder.ajax.php, + operation/visual_console/render_view.php: a lot of fixes in the + visualmap. + 2013-08-02 Sergio Martin * include/functions_modules.php: Fix modules and diff --git a/pandora_console/include/ajax/visual_console_builder.ajax.php b/pandora_console/include/ajax/visual_console_builder.ajax.php index 927c660d95..0f69028f9d 100644 --- a/pandora_console/include/ajax/visual_console_builder.ajax.php +++ b/pandora_console/include/ajax/visual_console_builder.ajax.php @@ -234,26 +234,26 @@ switch ($action) { } switch ($status) { - case 1: + case VISUAL_MAP_STATUS_CRITICAL_BAD: //Critical (BAD) - $colorStatus = "#ff0000"; + $colorStatus = COL_CRITICAL; break; - case 4: + case VISUAL_MAP_STATUS_CRITICAL_ALERT: //Critical (ALERT) - $colorStatus = "#ff8800"; + $colorStatus = COL_ALERTFIRED; break; - case 0: + case VISUAL_MAP_STATUS_NORMAL: //Normal (OK) - $colorStatus = "#00ff00"; + $colorStatus = COL_NORMAL; break; - case 2: + case VISUAL_MAP_STATUS_WARNING: //Warning - $colorStatus = "#ffff00"; + $colorStatus = COL_WARNING; break; - case 3: + case VISUAL_MAP_STATUS_UNKNOWN: //Unknown default: - $colorStatus = "#5A5AFF"; + $colorStatus = COL_UNKNOWN; // Default is Grey (Other) break; } diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index 75692ef9d1..44c558a218 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -1778,8 +1778,9 @@ function can_user_access_node () { $userinfo = get_user_info ($config['id_user']); - if (defined('METACONSOLE')) { - return $userinfo["is_admin"] == 1 ? 1 : $userinfo["metaconsole_access_node"]; + if (defined('METACONSOLE')) { + return $userinfo["is_admin"] == 1 ? 1 : + $userinfo["metaconsole_access_node"]; } else { return 1; diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index f159da7675..195fb7a9b4 100755 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -1501,7 +1501,8 @@ function graph_event_module ($width = 300, $height = 200, $id_agent) { function progress_bar($progress, $width, $height, $title = '', $mode = 1, $value_text = false, $color = false, $options = false) { global $config; - $out_of_lim_str = __("Out of limits"); + $out_of_lim_str = io_safe_output(__("Out of limits")); + $title = ""; if ($value_text === false) { @@ -1547,7 +1548,7 @@ function progress_bubble($progress, $width, $height, $title = '', $mode = 1, $va if (defined('METACONSOLE')) $hack_metaconsole = '../../'; - $out_of_lim_str = __("Out of limits"); + $out_of_lim_str = io_safe_output(__("Out of limits")); $title = ""; if ($value_text === false) { diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php index 3975b9fbea..c6ce998ccc 100644 --- a/pandora_console/include/functions_visual_map.php +++ b/pandora_console/include/functions_visual_map.php @@ -74,25 +74,25 @@ function visual_map_print_item($layoutData) { switch ($status) { case VISUAL_MAP_STATUS_CRITICAL_BAD: //Critical (BAD) - $colorStatus = "#ff0000"; + $colorStatus = COL_CRITICAL; break; case VISUAL_MAP_STATUS_CRITICAL_ALERT: //Critical (ALERT) - $colorStatus = "#ff8800"; + $colorStatus = COL_ALERTFIRED; break; case VISUAL_MAP_STATUS_NORMAL: //Normal (OK) - $colorStatus = "#00ff00"; + $colorStatus = COL_NORMAL; break; case VISUAL_MAP_STATUS_WARNING: //Warning - $colorStatus = "#ffff00"; + $colorStatus = COL_WARNING; break; case VISUAL_MAP_STATUS_UNKNOWN: default: //Unknown // Default is Blue (Other) - $colorStatus = "#5A5AFF"; + $colorStatus = COL_UNKNOWN; break; } @@ -823,12 +823,12 @@ function visual_map_get_status_element($layoutData) { //Status for a simple module if ($layoutData['id_agente_modulo'] != 0) { $status = modules_get_agentmodule_status ($layoutData['id_agente_modulo']); - + //We need to get the diference between warning and critical alerts!!! $real_status = db_get_row ("tagente_estado", "id_agente_modulo", $layoutData["id_agente_modulo"]); - - if ($real_status['estado'] == 2) { + if ($real_status['estado'] == 2) { + //This module has an alert fired and warning status $status = VISUAL_MAP_STATUS_WARNING_ALERT; } @@ -1039,9 +1039,11 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line echo '
'; if ($show_links) { - - if (!empty($layout_data['id_agent']) && empty($layout_data['id_layout_linked'])) { - if ($layout_data['enable_link']) { + if (!empty($layout_data['id_agent']) + && empty($layout_data['id_layout_linked'])) { + + if ($layout_data['enable_link'] + && can_user_access_node()) { $id_service = false; if (!defined('METACONSOLE')) { @@ -1055,25 +1057,46 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line if (!empty($id_service)) { //Link to an service page - echo ''; + if (empty($layout_data['id_metaconsole'])) { + $url = $config['homeurl'] . + 'index.php?sec=services&sec2=enterprise/operation/services/services&id_service=' . + $id_service . '&offset=0'; + } + else { + $server = db_get_row('tmetaconsole_setup', + 'id', $layout_data['id_metaconsole']); + + $url = $server["server_url"] . "/" . + 'index.php?sec=services&sec2=enterprise/operation/services/services&id_service=' . + $id_service . '&offset=0'; + } } else if ($layout_data['id_agente_modulo'] != 0) { // Link to an module - echo ''; - } - else { if (empty($layout_data['id_metaconsole'])) { - $url = $config['homeurl'] . 'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=' . $layout_data['id_agent']; + $url = $config['homeurl'] . + 'index.php?sec=estado&sec2=operation/agentes/status_monitor&id_module=' . $layout_data['id_agente_modulo']; } else { $url = ui_meta_get_url_console_child( $layout_data['id_metaconsole'], "estado", "operation/agentes/ver_agente&id_agente=" . $layout_data['id_agent']); } - // Link to an agent - echo ''; } + else { + // Link to an agent + if (empty($layout_data['id_metaconsole'])) { + $url = $config['homeurl'] . + 'index.php?sec=estado&sec2=operation/agentes/ver_agente&id_agente=' . $layout_data['id_agent']; + } + else { + $url = ui_meta_get_url_console_child( + $layout_data['id_metaconsole'], + "estado", "operation/agentes/ver_agente&id_agente=" . $layout_data['id_agent']); + } + } + + echo ''; } } elseif ($layout_data['id_layout_linked'] > 0) { @@ -1167,6 +1190,8 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line echo ""; break; + + case LABEL: $z_index = 4; if ($resizedMap) @@ -1189,6 +1214,9 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line if ($endTagA) echo ""; echo "
"; break; + + + case ICON: $z_index = 4; if ($resizedMap) @@ -1255,6 +1283,9 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line echo ""; break; + + + case SIMPLE_VALUE: case SIMPLE_VALUE_MAX: case SIMPLE_VALUE_MIN: @@ -1290,6 +1321,7 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line $endTagA = false; + if ($show_links) { //Extract id service if it is a prediction module. $id_service = db_get_value_filter('custom_integer_1', @@ -1297,16 +1329,25 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line array('id_agente_modulo' => $layout_data['id_agente_modulo'], 'prediction_module' => 1)); - if ($id_service === false) { - $id_service = 0; - } - - if ($id_service != 0) { + if (!empty($id_service) && can_user_access_node()) { - if ($layout_data['enable_link']) { + if ($layout_data['enable_link']) { //Link to an service page - echo ''; + if (!empty($layout_data['id_metaconsole'])) { + $server = db_get_row('tmetaconsole_setup', + 'id', $layout_data['id_metaconsole']); + + echo ''; + } + else { + echo ''; + } + + $endTagA = true; } @@ -1462,6 +1503,9 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line echo ''; break; + + + case PERCENTILE_BAR: case PERCENTILE_BUBBLE: @@ -1510,15 +1554,18 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line echo "
"; if ($show_links) { - if (!empty($layout_data['id_agent']) && empty($layout_data['id_layout_linked'])) { + if (!empty($layout_data['id_agent']) + && empty($layout_data['id_layout_linked'])) { - if ($layout_data['enable_link']) { - + if ($layout_data['enable_link'] + && can_user_access_node()) { + //Extract id service if it is a prediction module. $id_service = db_get_value_filter('custom_integer_1', 'tagente_modulo', - array('id_agente_modulo' => $layout_data['id_agente_modulo'], + array( + 'id_agente_modulo' => $layout_data['id_agente_modulo'], 'prediction_module' => 1)); if ($id_service === false) { @@ -1527,13 +1574,36 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line if ($id_service != 0) { //Link to an service page - echo '
'; + + if (!empty($layout_data['id_metaconsole'])) { + $server = db_get_row('tmetaconsole_setup', + 'id', $layout_data['id_metaconsole']); + + echo ''; + } + else { + echo ''; + } $endTagA = true; } else if ($layout_data['id_agente_modulo'] != 0) { // Link to an module - echo ''; + if (!empty($layout_data['id_metaconsole'])) { + $server = db_get_row('tmetaconsole_setup', + 'id', $layout_data['id_metaconsole']); + + echo ''; + } + else { + echo ''; + } + $endTagA = true; } else { // Link to an agent @@ -1602,6 +1672,9 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line echo ''; break; + + + case MODULE_GRAPH: if ($resizedMap) { $layout_data['width'] = @@ -1622,7 +1695,10 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line $endTagA = false; if ($show_links) { - if (($layout_data['id_layout_linked'] == "") || ($layout_data['id_layout_linked'] == 0)) { + if (( + ($layout_data['id_layout_linked'] == "") + || ($layout_data['id_layout_linked'] == 0)) + && can_user_access_node()) { if ($layout_data['enable_link']) { @@ -1638,8 +1714,19 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line if ($id_service != 0) { //Link to an service page - echo ''; + if (!empty($layout_data['id_metaconsole'])) { + $server = db_get_row('tmetaconsole_setup', + 'id', $layout_data['id_metaconsole']); + + echo ''; + } + else { + echo ''; + } } else { if (empty($layout_data['id_metaconsole'])) { diff --git a/pandora_console/include/graphs/fgraph.php b/pandora_console/include/graphs/fgraph.php index 525759dcd7..c2ab74d389 100755 --- a/pandora_console/include/graphs/fgraph.php +++ b/pandora_console/include/graphs/fgraph.php @@ -65,7 +65,7 @@ switch($graph_type) { $height = get_parameter('height'); $progress = get_parameter('progress'); - $out_of_lim_str = get_parameter('out_of_lim_str', false); + $out_of_lim_str = io_safe_output(get_parameter('out_of_lim_str', false)); $out_of_lim_image = get_parameter('out_of_lim_image', false); $font = get_parameter('font'); @@ -86,7 +86,7 @@ switch($graph_type) { $height = get_parameter('height'); $progress = get_parameter('progress'); - $out_of_lim_str = get_parameter('out_of_lim_str', false); + $out_of_lim_str = io_safe_output(get_parameter('out_of_lim_str', false)); $out_of_lim_image = get_parameter('out_of_lim_image', false); $font = get_parameter('font'); diff --git a/pandora_console/include/graphs/functions_gd.php b/pandora_console/include/graphs/functions_gd.php index c1334d28d7..8717b22331 100755 --- a/pandora_console/include/graphs/functions_gd.php +++ b/pandora_console/include/graphs/functions_gd.php @@ -162,7 +162,7 @@ function gd_histogram ($width, $height, $mode, $data, $max_value, $font, $title, // *************************************************************************** function gd_progress_bubble ($width, $height, $progress, $title, $font, $out_of_lim_str, $out_of_lim_image, $mode = 1, $fontsize=10, $value_text = '', $colorRGB = '') { if ($out_of_lim_str === false) { - $out_of_lim_str = __("Out of limits"); + $out_of_lim_str = io_safe_output(__("Out of limits")); } if ($out_of_lim_image === false) { @@ -254,7 +254,7 @@ function gd_progress_bubble ($width, $height, $progress, $title, $font, $out_of_ function gd_progress_bar ($width, $height, $progress, $title, $font, $out_of_lim_str, $out_of_lim_image, $mode = 1, $fontsize=10, $value_text = '', $colorRGB = '') { if ($out_of_lim_str === false) { - $out_of_lim_str = __("Out of limits"); + $out_of_lim_str = io_safe_output(__("Out of limits")); } if ($out_of_lim_image === false) { diff --git a/pandora_console/operation/visual_console/render_view.php b/pandora_console/operation/visual_console/render_view.php index 2bbe098f07..dc5fb4d818 100644 --- a/pandora_console/operation/visual_console/render_view.php +++ b/pandora_console/operation/visual_console/render_view.php @@ -31,7 +31,7 @@ if ($id_layout) { else { $default_action = 'new'; } - + if (!defined('METACONSOLE')) { $action = get_parameterBetweenListValues('action', array('new', 'save', 'edit', 'update', 'delete'), $default_action); }