From 5a8b19b129a441f517b8ac921dce2092e454b5d4 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Thu, 3 May 2012 09:35:30 +0000 Subject: [PATCH] 2012-05-03 Miguel de Dios * godmode/reporting/visual_console_builder.php: refixed the add the items with modules with entities. * include/functions_reporting.php, include/functions_networkmap.php, include/functions_visual_map.php: cleaned source code style. MERGED FROM 4.0.2 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6238 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 10 +++++++ .../reporting/visual_console_builder.php | 7 ++++- .../include/functions_networkmap.php | 7 ++--- .../include/functions_visual_map.php | 26 +++++++++++-------- 4 files changed, 35 insertions(+), 15 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index be60b6d575..6f19eb99b8 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,13 @@ +2012-05-03 Miguel de Dios + + * godmode/reporting/visual_console_builder.php: refixed the add the + items with modules with entities. + + * include/functions_reporting.php, include/functions_networkmap.php, + include/functions_visual_map.php: cleaned source code style. + + MERGED FROM 4.0.2 + 2012-04-30 Sancho Lerena All changes (except a small patch on function_groups) are diff --git a/pandora_console/godmode/reporting/visual_console_builder.php b/pandora_console/godmode/reporting/visual_console_builder.php index 10de390517..335d68e947 100755 --- a/pandora_console/godmode/reporting/visual_console_builder.php +++ b/pandora_console/godmode/reporting/visual_console_builder.php @@ -212,13 +212,18 @@ switch ($activeTab) { foreach ($id_agents as $ag) { $id_module = agents_get_modules($ag, array('id_agente_modulo'), - array('nombre' => io_safe_input($mod))); + array('nombre' => $mod)); if (empty($id_module)) continue; + else { + $id_module = reset($id_module); + $id_module = $id_module['id_agente_modulo']; + } $id_modules[] = $id_module; } } + $message .= visual_map_process_wizard_add_modules($id_modules, $image, $idVisualConsole, $range, $width, $height, $period, $process_value, $percentileitem_width, diff --git a/pandora_console/include/functions_networkmap.php b/pandora_console/include/functions_networkmap.php index 21a517bbb2..82e89dee3b 100644 --- a/pandora_console/include/functions_networkmap.php +++ b/pandora_console/include/functions_networkmap.php @@ -33,7 +33,7 @@ function networkmap_is_descendant ($node, $ascendant, $parents) { if (! isset ($parents[$node])) { return false; } - + if ($node == $ascendant) { return true; } @@ -153,7 +153,8 @@ function networkmap_generate_dot ($pandora_name, $group = 0, $simple = 0, $font_ // Verify that the parent is in the graph if (isset ($nodes[$parent_id])) { $graph .= networkmap_create_edge ($node, $parent_id, $layout, $nooverlap, $pure, $zoom, $ranksep, $simple, $regen, $font_size, $group, 'operation/agentes/networkmap', 'topology', $id_networkmap); - } else { + } + else { $orphans[$node] = 1; } } @@ -513,7 +514,7 @@ function networkmap_create_pandora_node ($name, $font_size = 10, $simple = 0, $s if ($simple == 1){ $label = ''; } - + $stats_json = base64_encode(json_encode($stats)); $node = '0 [ color="#364D1F", fontsize='.$font_size.', style="filled", fixedsize=true, width=0.8, height=0.6, label=<'.$label.'>, diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php index 851f709683..90f16c3b89 100644 --- a/pandora_console/include/functions_visual_map.php +++ b/pandora_console/include/functions_visual_map.php @@ -968,7 +968,7 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line elseif (preg_match('/^(http:\/\/)((.)+)$/i', $layout_data['label'])){ // Link to an URL echo ''; - $endTagA = true; + $endTagA = true; } } @@ -1268,7 +1268,8 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line else { echo ''; } - } else { + } + else { echo ''; } } @@ -1359,12 +1360,12 @@ function visual_map_get_user_layouts ($id_user = 0, $only_names = false, $filter $filter = array (); $where = db_format_array_where_clause_sql ($filter); - + if ($returnAllGroup) $groups = users_get_groups ($id_user); else $groups = users_get_groups ($id_user, 'IR', false); - + if(!empty($groups)) { if ($where != '') { $where .= ' AND '; @@ -1375,7 +1376,7 @@ function visual_map_get_user_layouts ($id_user = 0, $only_names = false, $filter if($where == '') { $where = array(); } - + $layouts = db_get_all_rows_filter ('tlayout', $where); if ($layouts == false) @@ -1409,12 +1410,12 @@ function visual_map_get_layout_status ($id_layout = 0, $depth = 0) { $temp_status = 0; $temp_total = 0; $depth++; // For recursion depth checking - + // TODO: Implement this limit as a configurable item in setup - if ($depth > 10){ + if ($depth > 10) { return 3; // No status data if we need to exit by a excesive recursion } - + $id_layout = (int) $id_layout; $result = db_get_all_rows_filter ('tlayout_data', array ('id_layout' => $id_layout), @@ -1428,11 +1429,14 @@ function visual_map_get_layout_status ($id_layout = 0, $depth = 0) { // Other Layout (Recursive!) if (($data["id_layout_linked"] != 0) && ($data["id_agente_modulo"] == 0)) { $status = visual_map_get_layout_status ($data["id_layout_linked"], $depth); + } // Module - } elseif ($data["id_agente_modulo"] != 0) { + elseif ($data["id_agente_modulo"] != 0) { $status = modules_get_agentmodule_status ($data["id_agente_modulo"]); + + } // Agent - } else { + else { $status = agents_get_status ($data["id_agent"]); } if ($status == 1) @@ -1499,7 +1503,7 @@ function visual_map_create_internal_name_item($label = null, $type, $image, $age if (!empty($moduleName)) { $text .= " - " . ui_print_truncate_text($moduleName, 10, false); } - + $text .= ")"; } $text .= ' (' . $idData . ')';