diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 4765f09d86..b9c8ba507d 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,12 @@ +2013-04-22 Miguel de Dios + + * mobile/operation/events.php, mobile/operation/module_graph.php, + mobile/operation/modules.php, mobile/operation/agent.php, + mobile/include/ui.class.php: some fixes. + + * include/functions_reporting.php, include/functions_groups.php, + include/functions_graph.php: some fixes. + 2013-04-22 Sergio Martin * include/styles/pandora.css diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index 02546a51f2..a387b679c9 100755 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -2372,7 +2372,7 @@ function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $ho for ($i = 0; $i < $interval; $i++) { $bottom = $datelimit + ($periodtime * $i); if (! $graphic_type) { - if($config['flash_charts']) { + if ($config['flash_charts']) { $name = date('H:i', $bottom); } else { @@ -2409,7 +2409,7 @@ function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $ho break; } } - else{ + else { $data[$cont]['utimestamp'] = $periodtime; $data[$cont]['data'] = 1; } @@ -2417,7 +2417,7 @@ function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $ho } $colors = array(1 => COL_NORMAL, 2 => COL_WARNING, 3 => COL_CRITICAL, 4 => COL_UNKNOWN); - + // Draw slicebar graph if ($config['flash_charts']) { $out = flot_slicesbar_graph($data, $period, $width, $height, $full_legend, $colors, $config['fontpath'], $config['round_corner'], $homeurl); @@ -2434,7 +2434,7 @@ function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $ho } } - if($return) { + if ($return) { return $out; } else { @@ -2607,7 +2607,7 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events, $event_value = 0; $alert_value = 0; $unknown_value = 0; - + $event_ids = array(); $alert_ids = array(); while (isset ($events[$k]) && @@ -2631,7 +2631,7 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events, } $k++; } - + if($is_unknown) { $unknown_value++; } @@ -2730,12 +2730,12 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events, } } - + //Boolean graph doesn't have min!!! /*if (!$avg_only) { $chart[$timestamp]['min'.$series_suffix] = 0; }*/ - + if(!empty($event_ids)) { $chart_extra_data[count($chart)-1]['events'] = implode(',',$event_ids); } @@ -2747,7 +2747,7 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events, // Get min, max and avg (less efficient but centralized for all modules and reports) $graph_stats = get_statwin_graph_statistics($chart, $series_suffix); - + // Fix event and alert scale foreach ($chart as $timestamp => $chart_data) { if ($show_events) { @@ -2766,7 +2766,7 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events, } } } - + /////////////////////////////////////////////////// // Set the title and time format if ($period <= SECONDS_6HOURS) { @@ -2812,7 +2812,7 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events, } else { $legend['sum'.$series_suffix] = __('Data').$series_suffix_str.': '.__('Last').': '.$graph_stats['sum']['last'].' '.$unit.' ; '.__('Avg').': '.$graph_stats['sum']['avg'].' '.$unit.' ; '.__('Max').': '.$graph_stats['sum']['max'].' '.$unit.' ; '.__('Min').': '.$graph_stats['sum']['min'].' '.$unit; - + } //$legend['baseline'.$series_suffix] = __('Baseline').$series_suffix_str; ///////////////////////////////////////////////////////////////////////////////////////// @@ -2848,7 +2848,7 @@ function grafico_modulo_boolean ($agent_module_id, $period, $show_events, global $long_index; global $series_type; global $chart_extra_data; - + $series_suffix_str = ''; if ($compare !== false) { $series_suffix = '2'; @@ -3066,7 +3066,7 @@ function graph_netflow_total_area ($data, $period, $width, $height, $unit = '', $water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png", 'url' => ui_get_full_url("/images/logo_vertical_water.png")); - + $legend = array (__('Max.') . ' ' . format_numeric($max) . ' ' . __('Min.') . ' ' . format_numeric($min) . ' ' . __('Avg.') . ' ' . format_numeric ($avg)); return area_graph($flash_chart, $chart, $width, $height, array (), $legend, array (), ui_get_full_url("images/image_problem.opaque.png"), "", "", $homeurl, @@ -3098,12 +3098,12 @@ function graph_netflow_aggregate_pie ($data, $aggregate, $ttl = 1, $only_image = } $i++; } - + $flash_chart = $config['flash_charts']; if ($only_image) { $flash_chart = false; } - + return pie3d_graph($flash_chart, $values, 320, 200, __('Other'), $config['homeurl'], $config['homedir'] . "/images/logo_vertical_water.png", $config['fontpath'], $config['font_size'], $ttl); @@ -3829,7 +3829,7 @@ function grafico_modulo_log4x_format_x_axis ( $number , $decimals=2, $dec_point= function grafico_modulo_log4x_format_y_axis ( $number , $decimals=2, $dec_point=".", $thousands_sep=",") { - switch($number) { + switch ($number) { case 6: return "FATAL"; break; @@ -3855,13 +3855,18 @@ function grafico_modulo_log4x_format_y_axis ( $number , $decimals=2, $dec_point= } function graph_nodata_image($width = 300, $height = 110, $type = 'area') { - $image = ui_get_full_url('images/image_problem_' . $type . '.png', false, false, false); - - $text_div = '
' . __('No data to show') . '
'; - - $image_div = '
' . $text_div . '
'; - - $div = '
' . $image_div . '
'; + $image = ui_get_full_url('images/image_problem_' . $type . '.png', + false, false, false); + + $text_div = '
' . + __('No data to show') . '
'; + + $image_div = '
' . + $text_div . '
'; + + $div = '
' . + $image_div . '
'; + return $div; } ?> diff --git a/pandora_console/include/functions_groups.php b/pandora_console/include/functions_groups.php index b111b4caa2..43f601e90b 100644 --- a/pandora_console/include/functions_groups.php +++ b/pandora_console/include/functions_groups.php @@ -703,6 +703,10 @@ function groups_get_group_row_data($id_group, $group_all, $group, &$printed_grou $row['group_icon'] = html_print_image("images/groups_small/" . $icon . ".png", true, false, true); + if (!isset($html)) { + $html = false; + } + //Update network group if ($html) { echo ""; @@ -730,7 +734,7 @@ function groups_get_group_row_data($id_group, $group_all, $group, &$printed_grou $row[__('Agents')] = ""; $row[__('Agents')] .= $data["total_agents"]; $row[__('Agents')] .= ""; - + // Agents unknown $row[__('Agents unknown')] = ""; $row[__('Agents unknown')] .= $data["agents_unknown"]; diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index bba0929e40..392cf2c98e 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -1037,8 +1037,8 @@ function reporting_get_stats_modules_status($data, $graph_width = 250, $graph_he $tdata[2] = $tdata[3] = ''; $table_mbs->rowclass[] = ''; $table_mbs->data[] = $tdata; - - if($data["monitor_checks"] > 0) { + + if ($data["monitor_checks"] > 0) { $tdata = array(); $table_mbs->colspan[count($table_mbs->data)][0] = 4; $table_mbs->cellstyle[count($table_mbs->data)][0] = 'text-align: center;'; @@ -1061,7 +1061,7 @@ function reporting_get_stats_summary($data, $graph_width, $graph_height) { // Alerts table $table_sum = html_get_predefined_table(); - + $tdata = array(); $table_sum->colspan[count($table_sum->data)][0] = 2; $table_sum->colspan[count($table_sum->data)][2] = 2; @@ -1071,20 +1071,20 @@ function reporting_get_stats_summary($data, $graph_width, $graph_height) { $tdata[2] = '' . __('Alert level') . ''; $table_sum->rowclass[] = ''; $table_sum->data[] = $tdata; - + $tdata = array(); $table_sum->colspan[count($table_sum->data)][0] = 2; $table_sum->colspan[count($table_sum->data)][2] = 2; $table_sum->cellstyle[count($table_sum->data)][0] = 'text-align: center;'; $table_sum->cellstyle[count($table_sum->data)][2] = 'text-align: center;'; - if($data["monitor_checks"] > 0) { + if ($data["monitor_checks"] > 0) { $tdata[0] = '
' . graph_agent_status (false, $graph_width, $graph_height, true, true) . '
'; } else { $tdata[2] = html_print_image('images/image_problem.png', true, array('width' => $graph_width)); } - if($data["monitor_alerts"] > 0) { + if ($data["monitor_alerts"] > 0) { $tdata[2] = '
' . graph_alert_status ($data["monitor_alerts"], $data["monitor_alerts_fired"], $graph_width, $graph_height, true, true) . '
'; } else { @@ -1155,7 +1155,7 @@ function reporting_get_stats_users($data) { if (check_acl ($config['id_user'], 0, "UM")) { $urls['defined_users'] = "index.php?sec=gusuarios&sec2=godmode/users/user_list"; } - else{ + else { $urls['defined_users'] = 'javascript:'; } diff --git a/pandora_console/mobile/include/ui.class.php b/pandora_console/mobile/include/ui.class.php index 25d9fd02be..4e8e58c102 100755 --- a/pandora_console/mobile/include/ui.class.php +++ b/pandora_console/mobile/include/ui.class.php @@ -827,8 +827,8 @@ class Table { $html .= "\n"; } - $html .= "\n"; $html .= "\n"; + $html .= "\n"; return $html; } diff --git a/pandora_console/mobile/operation/agent.php b/pandora_console/mobile/operation/agent.php index 2cdcc752d5..b77bd1b536 100644 --- a/pandora_console/mobile/operation/agent.php +++ b/pandora_console/mobile/operation/agent.php @@ -89,7 +89,7 @@ class Agent { if ($this->agent['disabled']) { $agent_name = "" . $agent_name . "" . ui_print_help_tip(__('Disabled'), true); } - else if ($agent['quiet']) { + else if ($this->agent['quiet']) { $agent_name = "" . $agent_name . " " . html_print_image("images/dot_green.disabled.png", true, array("border" => '0', "title" => __('Quiet'), "alt" => "")) . ""; } else { @@ -98,7 +98,7 @@ class Agent { $addresses = agents_get_addresses($this->id); - $address = agents_get_address($id_agente); + $address = agents_get_address($this->id); foreach ($addresses as $k => $add) { if($add == $address) { unset($addresses[$k]); @@ -111,7 +111,7 @@ class Agent { } $last_contant = '' . __('Last contact') . ' / ' . __('Remote') . ' ' - .ui_print_timestamp ($agent["ultimo_contacto"], true); + .ui_print_timestamp ($this->agent["ultimo_contacto"], true); $description = empty($agent["comentarios"]) ? '' . __('N/A') . '' : $this->agent["comentarios"]; @@ -130,7 +130,7 @@ class Agent { $graph_js = ob_get_clean(); $html = $graph_js . $html; $html .= "" . __('Events (24h)') . "
"; - $html .= graph_graphic_agentevents ($id_agente, 250, 15, 86400, '', true); + $html .= graph_graphic_agentevents ($this->id, 250, 15, 86400, '', true); $ui->contentGridAddCell($html); $ui->contentEndGrid(); diff --git a/pandora_console/mobile/operation/events.php b/pandora_console/mobile/operation/events.php index 33dadcd646..eb9565a2e2 100644 --- a/pandora_console/mobile/operation/events.php +++ b/pandora_console/mobile/operation/events.php @@ -212,16 +212,17 @@ class Events { "width" => 12, "height" => 12, "title" => $event_criticity)); - $event["criticity"] .= ' '.$event_criticity; + $event["criticity"] .= ' ' . $event_criticity; if ($event['estado'] == 1) { $user_ack = db_get_value('fullname', 'tusuario', 'id_user', $event['id_usuario']); - if(empty($user_ack)) { + if (empty($user_ack)) { $user_ack = $event['id_usuario']; } $date_ack = date ($system->getConfig("date_format"), $event['ack_utimestamp']); - $event["acknowledged_by"] = $user_ack.' ('.$date_ack.')'; + $event["acknowledged_by"] = $user_ack . + ' (' . $date_ack . ')'; } else { $event["acknowledged_by"] = ''.__('N/A').''; @@ -277,7 +278,7 @@ class Events { public function disabledColumns($columns = null) { if (!empty($columns)) { foreach ($columns as $column) { - unset($this->columns[$column]); + $this->columns[$column] = 1; } } } @@ -650,8 +651,8 @@ class Events { $sql_post = " AND id_grupo = " . $this->group; } - if ($this->id_agente > 0) { - $sql_post = " AND id_agente = " . $this->id_agente; + if ($this->id_agent > 0) { + $sql_post = " AND id_agente = " . $this->id_agent; } //-------------------------------------------------------------- @@ -1006,7 +1007,7 @@ class Events { if (!empty($this->status)) $status = events_get_status($this->status); $type = ""; - if (!empty($this->empty)) + if (!empty($this->type)) $type = get_event_types($this->type); $severity = ""; if ($this->severity != -1) diff --git a/pandora_console/mobile/operation/module_graph.php b/pandora_console/mobile/operation/module_graph.php index 399607a73a..ca60ebc1c9 100644 --- a/pandora_console/mobile/operation/module_graph.php +++ b/pandora_console/mobile/operation/module_graph.php @@ -116,6 +116,7 @@ class ModuleGraph { $urlImage = ui_get_full_url(false); + $time_compare = false; if ($this->time_compare_separated) { $time_compare = 'separated'; } @@ -177,7 +178,7 @@ class ModuleGraph { } break; case 'log4x': - $graph .= grafico_modulo_log4x ($this->id, + $graph = grafico_modulo_log4x ($this->id, $this->period, $this->draw_events, $this->width, $this->height, $label, $unit_name, $this->draw_alerts, diff --git a/pandora_console/mobile/operation/modules.php b/pandora_console/mobile/operation/modules.php index 52cc71f244..b600ff40a0 100644 --- a/pandora_console/mobile/operation/modules.php +++ b/pandora_console/mobile/operation/modules.php @@ -90,7 +90,7 @@ class Modules { public function disabledColumns($columns = null) { if (!empty($columns)) { foreach ($columns as $column) { - unset($this->columns[$column]); + $this->columns[$column] = 0; } } } @@ -532,7 +532,7 @@ class Modules { $ui->contentAddHtml($table->getHTML()); } else { - $html .= $table->getHTML(); + $html = $table->getHTML(); return $html; }