diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 57ea4dcdce..94720c1ead 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,16 @@ +2013-07-03 Miguel de Dios + + * mobile/operation/events.php, mobile/operation/module_graph.php, + mobile/operation/modules.php, mobile/operation/networkmaps.php, + mobile/operation/groups.php, mobile/operation/agents.php, + mobile/operation/tactical.php, mobile/operation/networkmap.php, + mobile/operation/alerts.php, mobile/operation/agent.php, + mobile/include/ui.class.php: added the back button in the head and + impoved the source code style to make more easy the merges with + the last branch. + + * include/functions_graph.php: fixed PHP notices. + 2013-07-03 Sergio Martin * godmode/snmpconsole/snmp_alert.php: Fixed malfunction of the diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index 746c30637f..589e10233f 100755 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -452,7 +452,7 @@ function grafico_modulo_sparse_data_chart (&$chart, &$chart_data_extra, &$long_i function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events, $width, $height , $title = '', $unit_name = null, - $show_alerts = false, $avg_only = 0, $date = 0, $unit = '', + $show_alerts = false, $avg_only = 0, $date = 0, $unit = '', $baseline = 0, $return_data = 0, $show_title = true, $projection = false, $adapt_key = '', $compare = false, $series_suffix = '', $series_suffix_str = '', $show_unknown = false) { @@ -469,6 +469,7 @@ function grafico_modulo_sparse_data ($agent_module_id, $period, $show_events, global $graphic_type; global $max_value; + $chart = array(); $color = array(); $legend = array(); @@ -1213,6 +1214,7 @@ function graphic_combined_module ($module_list, $weight_list, $period, $width, $ $flash_charts = false; } + $water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png", 'url' => ui_get_full_url("/images/logo_vertical_water.png")); @@ -1274,6 +1276,7 @@ function graphic_agentaccess ($id_agent, $width, $height, $period = 0, $return = global $config; global $graphic_type; + $data = array (); $resolution = $config["graph_res"] * ($period * 2 / $width); // Number of "slices" we want in graph @@ -1670,6 +1673,7 @@ function grafico_db_agentes_paquetes($width = 380, $height = 300) { global $config; global $graphic_type; + $data = array (); $legend = array (); @@ -1702,6 +1706,7 @@ function graph_db_agentes_modulos($width, $height) { global $config; global $graphic_type; + $data = array (); switch ($config['dbtype']){ @@ -2332,6 +2337,7 @@ function graph_custom_sql_graph ($id, $width, $height, $type = 'sql_graph_vbar', $flash_charts = $config['flash_charts']; + if ($only_image) { $flash_charts = false; } @@ -2373,6 +2379,7 @@ function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $ho global $config; global $graphic_type; + $data = array (); $resolution = $config['graph_res'] * ($period * 2 / $width); // Number of "slices" we want in graph @@ -2463,6 +2470,7 @@ function graph_graphic_agentevents ($id_agent, $width, $height, $period = 0, $ho // Prints an error image function fs_error_image ($width = 300, $height = 110) { global $config; + return graph_nodata_image($width, $height, 'area'); } @@ -2868,13 +2876,14 @@ function grafico_modulo_boolean ($agent_module_id, $period, $show_events, global $long_index; global $series_type; global $chart_extra_data; - + if (empty($unit_name)) { $unit = modules_get_unit($agent_module_id); } else $unit = $unit_name; + $series_suffix_str = ''; if ($compare !== false) { $series_suffix = '2'; @@ -2963,6 +2972,7 @@ function graph_netflow_aggregate_area ($data, $period, $width, $height, $unit = return; } + if ($period <= SECONDS_6HOURS) { $chart_time_format = 'H:i:s'; } @@ -3001,6 +3011,7 @@ function graph_netflow_aggregate_area ($data, $period, $width, $height, $unit = } } + $flash_chart = $config['flash_charts']; if ($only_image) { $flash_chart = false; @@ -3016,6 +3027,7 @@ function graph_netflow_aggregate_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")); + return area_graph($flash_chart, $chart, $width, $height, array (), $sources, array (), "images/image_problem.opaque.png", "", $unit, $homeurl, $config['homedir'] . "/images/logo_vertical_water.png", @@ -3157,6 +3169,7 @@ function grafico_modulo_string ($agent_module_id, $period, $show_events, global $graphic_type; global $max_value; + // Set variables if ($date == 0) $date = get_system_time(); @@ -3574,6 +3587,7 @@ function grafico_modulo_log4x ($id_agente_modulo, $periodo, $show_event, $adjust_time = SECONDS_1MINUTE; + if ($periodo == SECONDS_1DAY) $adjust_time = SECONDS_1HOUR; elseif ($periodo == SECONDS_1WEEK) @@ -3879,6 +3893,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) { case 6: return "FATAL"; @@ -3902,6 +3917,7 @@ function grafico_modulo_log4x_format_y_axis ( $number , $decimals=2, $dec_point= return ""; break; } + } function graph_nodata_image($width = 300, $height = 110, $type = 'area', $text = '') { diff --git a/pandora_console/mobile/include/ui.class.php b/pandora_console/mobile/include/ui.class.php index 4197947434..43aaf394e6 100755 --- a/pandora_console/mobile/include/ui.class.php +++ b/pandora_console/mobile/include/ui.class.php @@ -163,18 +163,22 @@ class Ui { return $this->createButton($options); } - public function createDefaultHeader($title = false) { + public function createDefaultHeader($title = false, $left_button = false) { if ($title === false) { $title = __('Pandora FMS mobile'); } - $this->createHeader( - $title, - $this->createHeaderButton( + if ($left_button === false) { + $left_button = $this->createHeaderButton( array('icon' => 'back', 'pos' => 'left', 'text' => __('Logout'), - 'href' => 'index.php?action=logout')), + 'href' => 'index.php?action=logout')); + } + + $this->createHeader( + $title, + $left_button, $this->createHeaderButton( array('icon' => 'home', 'pos' => 'right', diff --git a/pandora_console/mobile/operation/agent.php b/pandora_console/mobile/operation/agent.php index a3a3b47e01..8e69d6214e 100644 --- a/pandora_console/mobile/operation/agent.php +++ b/pandora_console/mobile/operation/agent.php @@ -30,7 +30,7 @@ class Agent { if (!empty($this->agent)) { $this->agent = $this->agent[0]; - + if ($system->checkACL('AR', $this->agent['id_grupo'])) { $this->correct_acl = true; } @@ -68,7 +68,13 @@ class Agent { if ($this->id != 0) { $agent_name = (string) agents_get_name ($this->id); - $ui->createDefaultHeader(sprintf(__("PandoraFMS: %s"), $agent_name)); + $ui->createDefaultHeader( + sprintf(__("PandoraFMS: %s"), $agent_name), + $ui->createHeaderButton( + array('icon' => 'back', + 'pos' => 'left', + 'text' => __('Back'), + 'href' => 'index.php?page=agents'))); } else { $ui->createDefaultHeader(__("PandoraFMS: Agents")); @@ -124,7 +130,8 @@ class Agent { $graph_js = ob_get_clean(); $html = $graph_js . $html; $html .= "" . __('Events (24h)') . "
"; - $html .= graph_graphic_agentevents ($this->id, 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/agents.php b/pandora_console/mobile/operation/agents.php index 57f6f4efd0..cff26dc20f 100644 --- a/pandora_console/mobile/operation/agents.php +++ b/pandora_console/mobile/operation/agents.php @@ -143,7 +143,12 @@ class Agents { $ui = Ui::getInstance(); $ui->createPage(); - $ui->createDefaultHeader(__("PandoraFMS: Agents")); + $ui->createDefaultHeader(__("PandoraFMS: Agents"), + $ui->createHeaderButton( + array('icon' => 'back', + 'pos' => 'left', + 'text' => __('Back'), + 'href' => 'index.php'))); $ui->showFooter(false); $ui->beginContent(); $filter_title = sprintf(__('Filter Agents by %s'), @@ -255,6 +260,7 @@ class Agents { $row[3] = $row[__('Group')] = ui_print_group_icon ($agent["id_grupo"], true); $row[4] = $row[__('Interval')] = '' . '' . human_time_description_raw($agent["intervalo"]) . ''; + $row[5] = $row[__('Status')] = '' . agents_tree_view_status_img ($agent["critical_count"], $agent["warning_count"], $agent["unknown_count"]); $row[6] = $row[__('Alerts')] = '' . agents_tree_view_alert_img ($agent["fired_count"]); diff --git a/pandora_console/mobile/operation/alerts.php b/pandora_console/mobile/operation/alerts.php index 0379d5e453..af0dbe46f2 100644 --- a/pandora_console/mobile/operation/alerts.php +++ b/pandora_console/mobile/operation/alerts.php @@ -33,7 +33,7 @@ class Alerts { function __construct() { $this->alert_status_items = array( 'all_enabled' => __('All (Enabled)'), - 'all' => __('All'), + 'all' => __('All'), 'fired' => __('Fired'), 'notfired' => __('Not fired'), 'disabled' => __('Disabled')); @@ -136,7 +136,12 @@ class Alerts { $ui = Ui::getInstance(); $ui->createPage(); - $ui->createDefaultHeader(__("PandoraFMS: Alerts")); + $ui->createDefaultHeader(__("PandoraFMS: Alerts"), + $ui->createHeaderButton( + array('icon' => 'back', + 'pos' => 'left', + 'text' => __('Back'), + 'href' => 'index.php'))); $ui->showFooter(false); $ui->beginContent(); $filter_title = sprintf(__('Filter Alerts by %s'), diff --git a/pandora_console/mobile/operation/events.php b/pandora_console/mobile/operation/events.php index 7c837b5fce..e42d40647a 100644 --- a/pandora_console/mobile/operation/events.php +++ b/pandora_console/mobile/operation/events.php @@ -483,7 +483,12 @@ class Events { $ui->addDialog($options); - $ui->createDefaultHeader(__("PandoraFMS: Events")); + $ui->createDefaultHeader(__("PandoraFMS: Events"), + $ui->createHeaderButton( + array('icon' => 'back', + 'pos' => 'left', + 'text' => __('Back'), + 'href' => 'index.php'))); $ui->showFooter(false); $ui->beginContent(); $ui->contentAddHtml(""); @@ -661,7 +666,7 @@ class Events { } if ($this->id_agent > 0) { - $sql_post = " AND id_agente = " . $this->id_agent; + $sql_post .= " AND id_agente = " . $this->id_agent; } // Skip system messages if user is not PM diff --git a/pandora_console/mobile/operation/groups.php b/pandora_console/mobile/operation/groups.php index 3df21da6b2..2aaedac613 100644 --- a/pandora_console/mobile/operation/groups.php +++ b/pandora_console/mobile/operation/groups.php @@ -57,7 +57,11 @@ class Groups { $ui = Ui::getInstance(); $ui->createPage(); - $ui->createDefaultHeader(__("PandoraFMS: Groups")); + $ui->createDefaultHeader(__("PandoraFMS: Groups"), $ui->createHeaderButton( + array('icon' => 'back', + 'pos' => 'left', + 'text' => __('Back'), + 'href' => 'index.php'))); $ui->showFooter(false); $ui->beginContent(); diff --git a/pandora_console/mobile/operation/module_graph.php b/pandora_console/mobile/operation/module_graph.php index ad9c14d4d7..7b37fe627c 100644 --- a/pandora_console/mobile/operation/module_graph.php +++ b/pandora_console/mobile/operation/module_graph.php @@ -17,6 +17,7 @@ class ModuleGraph { private $acl = "AR"; private $id = 0; + private $id_agent = 0; private $graph_type = "sparse"; private $period = SECONDS_1DAY; private $draw_events = 0; @@ -50,6 +51,7 @@ class ModuleGraph { $system = System::getInstance(); $this->id = (int)$system->getRequest('id', 0); + $this->id_agent = (int)$system->getRequest('id_agent', 0); $this->module = modules_get_agentmodule($this->id); $this->graph_type = return_graphtype($this->module["id_tipo_modulo"]); @@ -81,7 +83,7 @@ class ModuleGraph { $this->height = (int)$system->getRequest('height', 0); //Sancho says "put the height to 1/2 for to make more beautyful" - $this->height = $this->height / 2; + //$this->height = $this->height / 2; $this->height -= 80; //Correct the height @@ -128,16 +130,27 @@ class ModuleGraph { ob_start(); switch ($this->graph_type) { case 'boolean': - $graph = grafico_modulo_boolean ($this->id, - $this->period, $this->draw_events, - $this->width, $this->height, - $label, $unit, $this->draw_alerts, - $this->avg_only, false, $date, false, - $urlImage, 'adapter_' . $this->graph_type, - $time_compare, $this->unknown_graph); + $graph = grafico_modulo_boolean ( + $this->id, + $this->period, + $this->draw_events, + $this->width, + $this->height, + $label, + $unit, + $this->draw_alerts, + $this->avg_only, + false, + $date, + false, + $urlImage, + 'adapter_' . $this->graph_type, + $time_compare, + $this->unknown_graph); if ($this->draw_events) { $graph .= '
'; - $graph .= graphic_module_events($this->id, + $graph .= graphic_module_events( + $this->id, $this->width, $this->height, $this->period, $config['homeurl'], $this->zoom, @@ -145,13 +158,26 @@ class ModuleGraph { } break; case 'sparse': - $graph = grafico_modulo_sparse ($this->id, - $this->period, $this->draw_events, - $this->width, $this->height, - $label, null, $this->draw_alerts, - $this->avg_only, false, $date, $unit, - $this->baseline, 0, true, false, - $urlImage, 1, false, + $graph = grafico_modulo_sparse( + $this->id, + $this->period, + $this->draw_events, + $this->width, + $this->height, + $label, + null, + $this->draw_alerts, + $this->avg_only, + false, + $date, + $unit, + $this->baseline, + 0, + true, + false, + $urlImage, + 1, + false, 'adapter_' . $this->graph_type, $time_compare, $this->unknown_graph); if ($this->draw_events) { @@ -163,11 +189,20 @@ class ModuleGraph { } break; case 'string': - $graph = grafico_modulo_string ($this->id, - $this->period, $this->draw_events, - $this->width, $this->height, - $label, null, $this->draw_alerts, 1, - false, $date, false, $urlImage, + $graph = grafico_modulo_string( + $this->id, + $this->period, + $this->draw_events, + $this->width, + $this->height, + $label, + null, + $this->draw_alerts, + 1, + false, + $date, + false, + $urlImage, 'adapter_' . $this->graph_type); if ($this->draw_events) { $graph .= '
'; @@ -178,11 +213,18 @@ class ModuleGraph { } break; case 'log4x': - $graph = grafico_modulo_log4x ($this->id, - $this->period, $this->draw_events, - $this->width, $this->height, - $label, $unit_name, $this->draw_alerts, - 1, $pure, $date); + $graph = grafico_modulo_log4x( + $this->id, + $this->period, + $this->draw_events, + $this->width, + $this->height, + $label, + $unit_name, + $this->draw_alerts, + 1, + $pure, + $date); if ($this->draw_events) { $graph .= '
'; $graph .= graphic_module_events($this->id, @@ -291,7 +333,24 @@ class ModuleGraph { $ui->createPage(); - $ui->createDefaultHeader(sprintf(__("PandoraFMS: %s"), $this->module["nombre"])); + if ($this->id_agent) { + $ui->createDefaultHeader( + sprintf(__("PandoraFMS: %s"), $this->module["nombre"]), + $ui->createHeaderButton( + array('icon' => 'back', + 'pos' => 'left', + 'text' => __('Back'), + 'href' => 'index.php?page=agent&id=' . $this->id_agent))); + } + else { + $ui->createDefaultHeader( + sprintf(__("PandoraFMS: %s"), $this->module["nombre"]), + $ui->createHeaderButton( + array('icon' => 'back', + 'pos' => 'left', + 'text' => __('Back'), + 'href' => 'index.php?page=modules'))); + } $ui->showFooter(false); $ui->beginContent(); $ui->contentAddHtml($ui->getInput(array( @@ -360,6 +419,7 @@ class ModuleGraph { ); $ui->formAddSlider($options); + $options = array( 'name' => 'start_date', 'value' => $this->start_date, diff --git a/pandora_console/mobile/operation/modules.php b/pandora_console/mobile/operation/modules.php index 6e0a3cd293..9915352437 100644 --- a/pandora_console/mobile/operation/modules.php +++ b/pandora_console/mobile/operation/modules.php @@ -165,7 +165,12 @@ class Modules { $ui = Ui::getInstance(); $ui->createPage(); - $ui->createDefaultHeader(__("PandoraFMS: Modules")); + $ui->createDefaultHeader(__("PandoraFMS: Modules"), + $ui->createHeaderButton( + array('icon' => 'back', + 'pos' => 'left', + 'text' => __('Back'), + 'href' => 'index.php'))); $ui->showFooter(false); $ui->beginContent(); $filter_title = sprintf(__('Filter Modules by %s'), diff --git a/pandora_console/mobile/operation/networkmap.php b/pandora_console/mobile/operation/networkmap.php index 9c975b09e6..3b94421e46 100755 --- a/pandora_console/mobile/operation/networkmap.php +++ b/pandora_console/mobile/operation/networkmap.php @@ -80,8 +80,14 @@ class Networkmap { $system = System::getInstance(); $ui->createPage(); - $ui->createDefaultHeader(sprintf(__("PandoraFMS: Networkmap %s"), - $this->network_map['name'])); + $ui->createDefaultHeader( + sprintf(__("PandoraFMS: Networkmap %s"), + $this->network_map['name']), + $ui->createHeaderButton( + array('icon' => 'back', + 'pos' => 'left', + 'text' => __('Back'), + 'href' => 'index.php?page=networkmaps'))); $ui->showFooter(false); $ui->beginContent(); diff --git a/pandora_console/mobile/operation/networkmaps.php b/pandora_console/mobile/operation/networkmaps.php index 5b11b814e4..d5d9a6c188 100755 --- a/pandora_console/mobile/operation/networkmaps.php +++ b/pandora_console/mobile/operation/networkmaps.php @@ -98,7 +98,12 @@ class Networkmaps { $ui = Ui::getInstance(); $ui->createPage(); - $ui->createDefaultHeader(__("PandoraFMS: Networkmaps")); + $ui->createDefaultHeader(__("PandoraFMS: Networkmaps"), + $ui->createHeaderButton( + array('icon' => 'back', + 'pos' => 'left', + 'text' => __('Back'), + 'href' => 'index.php'))); $ui->showFooter(false); $ui->beginContent(); $filter_title = sprintf(__('Filter Networkmaps by %s'), diff --git a/pandora_console/mobile/operation/tactical.php b/pandora_console/mobile/operation/tactical.php index 7332149144..3f31aa5212 100755 --- a/pandora_console/mobile/operation/tactical.php +++ b/pandora_console/mobile/operation/tactical.php @@ -49,7 +49,12 @@ class Tactical { $ui = Ui::getInstance(); $ui->createPage(); - $ui->createDefaultHeader(__("PandoraFMS: Tactical")); + $ui->createDefaultHeader(__("PandoraFMS: Tactical"), + $ui->createHeaderButton( + array('icon' => 'back', + 'pos' => 'left', + 'text' => __('Back'), + 'href' => 'index.php'))); $ui->showFooter(false); $ui->beginContent(); $ui->contentBeginGrid('responsive'); @@ -57,36 +62,7 @@ class Tactical { $data['mobile'] = true; $formatted_data = reporting_get_stats_indicators($data, 200, 10, false); - /* - $overview = '
- ' . - $formatted_data['server_health']['title'] . - '' . - $formatted_data['server_health']['graph'] . - '
' . - - '
- ' . - $formatted_data['monitor_health']['title'] . - '' . - $formatted_data['monitor_health']['graph'] . - '
' . - - '' . - '
- ' . - $formatted_data['module_sanity']['title'] . - '' . - $formatted_data['module_sanity']['graph'] . - '
' . - '' . - '
- ' . - $formatted_data['alert_level']['title'] . - '' . - $formatted_data['alert_level']['graph'] . - '
'; - */ + $overview = '
' . $formatted_data['server_health']['title'] . '