From 1c331a5a64ea374921ea7d1c0d496ed3db84ae6a Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Thu, 28 Feb 2013 11:57:57 +0000 Subject: [PATCH] 2013-02-28 Miguel de Dios * godmode/modules/manage_network_components_form.php, include/functions_html.php, operation/menu.php, operation/events/events_list.php: improved source code. * include/functions_events.php: fixed into the function "events_get_agent" the query to get criticities. Fixes: #3606285 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7744 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 11 +++++ .../manage_network_components_form.php | 4 +- pandora_console/include/functions_events.php | 40 ++++++++++++------- pandora_console/include/functions_html.php | 5 ++- .../operation/events/events_list.php | 4 +- pandora_console/operation/menu.php | 2 +- 6 files changed, 45 insertions(+), 21 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 4d18d50748..5caf88148a 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,14 @@ +2013-02-28 Miguel de Dios + + * godmode/modules/manage_network_components_form.php, + include/functions_html.php, operation/menu.php, + operation/events/events_list.php: improved source code. + + * include/functions_events.php: fixed into the function + "events_get_agent" the query to get criticities. + + Fixes: #3606285 + 2013-02-28 Sergio Martin * include/functions_io.php diff --git a/pandora_console/godmode/modules/manage_network_components_form.php b/pandora_console/godmode/modules/manage_network_components_form.php index 90ce1d82d0..69ff72e370 100644 --- a/pandora_console/godmode/modules/manage_network_components_form.php +++ b/pandora_console/godmode/modules/manage_network_components_form.php @@ -66,8 +66,8 @@ if ($create_network_from_module) { $warning_instructions = $data_module["warning_instructions"]; $unknown_instructions = $data_module["unknown_instructions"]; $critical_inverse = $data_module["critical_inverse"]; - $warning_inverse = $data_module["warning_inverse"]; - $id_category = $data_module["id_category"]; + $warning_inverse = $data_module["warning_inverse"]; + $id_category = $data_module["id_category"]; } $id_component_type = (int) get_parameter ('id_component_type'); diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index 6b0b2701db..05e1bea631 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -1235,12 +1235,17 @@ function events_get_agent ($id_agent, $period, $date = 0, $datelimit = $date - $period; $sql_where = ' AND 1 = 1 '; + $criticities = array(); if ($filter_event_critical) { - $sql_where .= ' AND criticity = 4 '; + $criticities[] = 4; } if ($filter_event_warning) { - $sql_where .= ' AND criticity = 3 '; + $criticities[] = 3; } + if (!empty($criticities)) { + $sql_where .= ' AND criticity IN (' . implode(', ', $criticities) . ')'; + } + if ($filter_event_validated) { $sql_where .= ' AND estado = 1 '; } @@ -1314,9 +1319,9 @@ function events_get_event_types ($type_id){ case 'normal': $type_desc = __('Monitor Normal'); break; case 'alert_fired': $type_desc = __('Alert fired'); - break; + break; case 'alert_recovered': $type_desc = __('Alert recovered'); - break; + break; case 'alert_ceased': $type_desc = __('Alert ceased'); break; case 'alert_manual_validation': $type_desc = __('Alert manual validation'); @@ -1356,19 +1361,24 @@ function events_get_event_types ($type_id){ function events_get_severity_types ($severity_id){ $diferent_types = get_priorities (); - + $severity_desc = ''; switch ($severity_id) { - case 0: $severity_desc = __('Maintenance'); - break; - case 1: $severity_desc = __('Informational'); - break; - case 2: $severity_desc = __('Normal'); - break; - case 3: $severity_desc = __('Warning'); - break; - case 4: $severity_desc = __('Critical'); - break; + case 0: + $severity_desc = __('Maintenance'); + break; + case 1: + $severity_desc = __('Informational'); + break; + case 2: + $severity_desc = __('Normal'); + break; + case 3: + $severity_desc = __('Warning'); + break; + case 4: + $severity_desc = __('Critical'); + break; default: if (isset($config['text_char_long'])) { foreach ($diferent_types as $key => $type) { diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index bd015c20f4..f96f5cee69 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -1343,10 +1343,13 @@ function html_print_table (&$table, $return = false) { } $output .= ' cellpadding="'.$table->cellpadding.'" cellspacing="'.$table->cellspacing.'"'; $output .= ' border="'.$table->border.'" class="'.$table->class.'" id="'.$tableid.'">'; + $countcols = 0; + if (!empty($table->caption)) { - $output .= '

' . $table->caption . '

'; + $output .= '

' . $table->caption . '

'; } + if (!empty ($table->head)) { $countcols = count ($table->head); $output .= ''; diff --git a/pandora_console/operation/events/events_list.php b/pandora_console/operation/events/events_list.php index f97c5706a6..043fb3fc09 100644 --- a/pandora_console/operation/events/events_list.php +++ b/pandora_console/operation/events/events_list.php @@ -494,8 +494,8 @@ $(document).ready( function() { $("#row_name").css('visibility', 'hidden'); $("#submit-update_filter").css('visibility', 'hidden'); $("#id_group").val(0); - - clear_tags_inputs(); + + clear_tags_inputs(); } // If filter selected then load filter else { diff --git a/pandora_console/operation/menu.php b/pandora_console/operation/menu.php index 3baa5a67c1..f91eaea7dc 100644 --- a/pandora_console/operation/menu.php +++ b/pandora_console/operation/menu.php @@ -199,7 +199,7 @@ if (check_acl ($config['id_user'], 0, "AR")) { if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM")) $own_groups = array_keys(users_get_groups($config['id_user'], "IR")); else - $own_groups = array_keys(users_get_groups($config['id_user'], "IR", false)); + $own_groups = array_keys(users_get_groups($config['id_user'], "IR", false)); foreach ($gisMaps as $gisMap) { $is_in_group = in_array($gisMap['group_id'], $own_groups);