diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index bf023526d9..1559b04a47 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,21 @@ +2014-02-10 Sergio Martin + + * include/functions_groups.php: Fixed total agents + count for group All + + * include/functions_graph.php + mobile/operation/module_graph.php + mobile/operation/modules.php + mobile/operation/networkmaps.php + mobile/operation/agent.php + mobile/operation/agents.php + mobile/operation/events.php + mobile/operation/tactical.php + mobile/operation/visualmaps.php + mobile/include/ui.class.php + mobile/include/style/main.css: A lot of fixes + and improvements in mobile console + 2014-02-07 Sergio Martin * include/functions_visual_map.php diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index 1d085eac9d..83519f7d5c 100755 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -690,7 +690,8 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events, $show_alerts = false, $avg_only = 0, $pure = false, $date = 0, $unit = '', $baseline = 0, $return_data = 0, $show_title = true, $only_image = false, $homeurl = '', $ttl = 1, - $projection = false, $adapt_key = '', $compare = false, $show_unknown = false) { + $projection = false, $adapt_key = '', $compare = false, $show_unknown = false, + $menu = true) { global $config; global $graphic_type; @@ -781,19 +782,19 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events, return area_graph($flash_chart, $chart, $width, $height/2, $color, $legend, $long_index, ui_get_full_url("images/image_problem.opaque.png"), "", $unit, $homeurl, $water_mark, $config['fontpath'], $config['font_size'], $unit, $ttl, - $series_type, $chart_extra_data, $warning_min, $critical_min, $adapt_key, false, $series_suffix_str). + $series_type, $chart_extra_data, $warning_min, $critical_min, $adapt_key, false, $series_suffix_str, $menu). '
'. area_graph($flash_chart, $chart_prev, $width, $height/2, $color_prev, $legend_prev, $long_index_prev, ui_get_full_url("images/image_problem.opaque.png"), "", $unit, $homeurl, $water_mark, $config['fontpath'], $config['font_size'], $unit, $ttl, - $series_type_prev, $chart_extra_data, $warning_min, $critical_min, $adapt_key, false, $series_suffix_str); + $series_type_prev, $chart_extra_data, $warning_min, $critical_min, $adapt_key, false, $series_suffix_str, $menu); } else { // Color commented not to restrict serie colors return area_graph($flash_chart, $chart, $width, $height, $color, $legend, $long_index, ui_get_full_url("images/image_problem.opaque.png"), "", $unit, $homeurl, $water_mark, $config['fontpath'], $config['font_size'], $unit, $ttl, - $series_type, $chart_extra_data, $warning_min, $critical_min, $adapt_key, false, $series_suffix_str); + $series_type, $chart_extra_data, $warning_min, $critical_min, $adapt_key, false, $series_suffix_str, $menu); } } @@ -2879,7 +2880,8 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events, function grafico_modulo_boolean ($agent_module_id, $period, $show_events, $width, $height , $title, $unit_name, $show_alerts, $avg_only = 0, $pure=0, - $date = 0, $only_image = false, $homeurl = '', $adapt_key = '', $compare = false, $show_unknown = false) { + $date = 0, $only_image = false, $homeurl = '', $adapt_key = '', $compare = false, + $show_unknown = false, $menu = true) { global $config; global $graphic_type; @@ -2958,20 +2960,20 @@ function grafico_modulo_boolean ($agent_module_id, $period, $show_events, $long_index, ui_get_full_url("images/image_problem.opaque.png"), "", $unit, $homeurl, $water_mark, $config['fontpath'], $config['font_size'], $unit, 1, $series_type, - $chart_extra_data, 0, 0, $adapt_key, false, $series_suffix_str). + $chart_extra_data, 0, 0, $adapt_key, false, $series_suffix_str, $menu). '
'. area_graph($flash_chart, $chart_prev, $width, $height/2, $color_prev, $legend_prev, $long_index_prev, ui_get_full_url("images/image_problem.opaque.png"), "", $unit, $homeurl, $water_mark, $config['fontpath'], $config['font_size'], $unit, 1, $series_type_prev, - $chart_extra_data_prev, 0, 0, $adapt_key, false, $series_suffix_str); + $chart_extra_data_prev, 0, 0, $adapt_key, false, $series_suffix_str, $menu); } else { return area_graph($flash_chart, $chart, $width, $height, $color, $legend, $long_index, ui_get_full_url("images/image_problem.opaque.png"), "", $unit, $homeurl, $water_mark, $config['fontpath'], $config['font_size'], $unit, 1, $series_type, - $chart_extra_data, 0, 0, $adapt_key, false, $series_suffix_str); + $chart_extra_data, 0, 0, $adapt_key, false, $series_suffix_str, $menu); } } @@ -3181,7 +3183,7 @@ function graph_netflow_aggregate_pie ($data, $aggregate, $ttl = 1, $only_image = */ function grafico_modulo_string ($agent_module_id, $period, $show_events, $width, $height , $title, $unit_name, $show_alerts, $avg_only = 0, $pure=0, - $date = 0, $only_image = false, $homeurl = '', $adapt_key = '', $ttl = 1) { + $date = 0, $only_image = false, $homeurl = '', $adapt_key = '', $ttl = 1, $menu = true) { global $config; global $graphic_type; global $max_value; @@ -3433,8 +3435,8 @@ function grafico_modulo_string ($agent_module_id, $period, $show_events, return area_graph($flash_chart, $chart, $width, $height, $color, $legend, array(), '', "", $unit, $homeurl, - $water_mark, - $config['fontpath'], $config['font_size'], $unit, 1, array(), array(), 0, 0, $adapt_key, true); + $water_mark, $config['fontpath'], $config['font_size'], $unit, + 1, array(), array(), 0, 0, $adapt_key, true, '', $menu); } /** diff --git a/pandora_console/include/functions_groups.php b/pandora_console/include/functions_groups.php index ee744bc4b6..ce06c89014 100644 --- a/pandora_console/include/functions_groups.php +++ b/pandora_console/include/functions_groups.php @@ -734,19 +734,12 @@ function groups_get_group_row_data($id_group, $group_all, $group, &$printed_grou echo ""; } - - // Total agents if ($id_group != 0) { $data["total_agents"] = db_get_sql ("SELECT COUNT(id_agente) FROM tagente WHERE id_grupo = $id_group AND disabled = 0"); } - else { - $data["total_agents"] = db_get_sql ("SELECT COUNT(id_agente) - FROM tagente - WHERE disabled = 0"); - } // Total agents $row['links'][__('Agents')] = "index.php?" . @@ -938,19 +931,12 @@ function groups_get_group_row($id_group, $group_all, $group, &$printed_groups) { //of this groups and its children. It was done to print empty fathers of children groups. //We need to recalculate the total agents for this group here to get only the total agents //for this group. Of course the group All (0) is a special case. - - $data["total_agents"]; - + if ($id_group != 0) { $data["total_agents"] = db_get_sql ("SELECT COUNT(id_agente) FROM tagente WHERE id_grupo = $id_group AND disabled = 0"); } - else { - $data["total_agents"] = db_get_sql ("SELECT COUNT(id_agente) - FROM tagente - WHERE disabled = 0"); - } echo $data["total_agents"]; echo ""; diff --git a/pandora_console/mobile/include/style/main.css b/pandora_console/mobile/include/style/main.css index bd51f2e0e0..744fb565e5 100644 --- a/pandora_console/mobile/include/style/main.css +++ b/pandora_console/mobile/include/style/main.css @@ -177,7 +177,10 @@ tr.group_view_unk, .group_view_unk { text-shadow: none; } - +.ui-btn-active:visited, .ui-btn-active:hover, .ui-btn-active a.ui-link-inherit { + color: #888 !important; + text-shadow: none !important; +} tr.group_view_data, .group_view_data { color: #000000 !important; @@ -525,7 +528,7 @@ table.event_details td.cell_event_name { #list_agents td:hover, #list_networkmaps td:hover, #list_events td:hover, #list_Modules td:hover, -#list_visualmaps td:hover { +#list_visualmaps td:hover, #last_agent_events td:hover { cursor: pointer; } @@ -889,6 +892,10 @@ ul.ui-listview li.ui-btn div.ui-btn-inner div.ui-btn-text a { padding-left: 5px; } +.ui-btn-inner { + border: 0px solid #000!important; +} + li.ui-btn { margin-bottom: 4px !important; margin-top: 4px !important; @@ -963,11 +970,6 @@ li.ui-btn { min-width: 50%; } - .untiny { - display: none; - } - - .agents_tiny_stats, .agents_last_contact { float: right; } @@ -987,10 +989,6 @@ li.ui-btn { float: left; margin-right: 15px; } - - .tiny { - display: none; - } } /* Common */ @@ -1025,6 +1023,10 @@ li.ui-btn { width: 185px; margin-bottom: 10px; } + + .untiny { + display: none; + } } /* For tablets */ @media screen and (min-width: 750px) @@ -1063,6 +1065,10 @@ li.ui-btn { width: 300px; margin-bottom: 20px; } + + .tiny { + display: none; + } } #login_container { @@ -1195,6 +1201,10 @@ table.tactical_bars { margin-top: 20px; } +.ui-btn-active * { + color: #FFF !important; +} + .ui-btn-active { background: #6db431 !important; } diff --git a/pandora_console/mobile/include/ui.class.php b/pandora_console/mobile/include/ui.class.php index e9791d7865..05e969cccd 100755 --- a/pandora_console/mobile/include/ui.class.php +++ b/pandora_console/mobile/include/ui.class.php @@ -711,6 +711,26 @@ class Ui { echo ""; ob_end_flush(); } + + // Add a listener to set a link when a row of a table is clicked. + // The target link will be the first tag found into the row + public function contentAddLinkListener ($table_name) { + $this->contentAddHtml(""); + } + // // } diff --git a/pandora_console/mobile/operation/agent.php b/pandora_console/mobile/operation/agent.php index 39df36f7b3..9339f4a843 100644 --- a/pandora_console/mobile/operation/agent.php +++ b/pandora_console/mobile/operation/agent.php @@ -167,13 +167,28 @@ class Agent { $ui->contentEndCollapsible(); $events = new Events(); + $events->addJavascriptDialog(); + + $options = $events->get_event_dialog_options(); + $ui->addDialog($options); + + $options = $events->get_event_dialog_error_options($options); + $ui->addDialog($options); + + $ui->contentAddHtml(""); + $ui->contentAddHtml(""); + $ui->contentBeginCollapsible(sprintf(__('Last %s Events'), $system->getPageSize())); $tabledata = $events->listEventsHtml(0, true, 'last_agent_events'); $ui->contentCollapsibleAddItem($tabledata['table']); $ui->contentCollapsibleAddItem($events->putEventsTableJS($this->id)); $ui->contentEndCollapsible(); } - + + $ui->contentAddLinkListener('last_agent_events'); + $ui->contentAddLinkListener('list_events'); + $ui->contentAddLinkListener('list_Modules'); + $ui->contentAddHtml(""); $ui->endContent(); diff --git a/pandora_console/mobile/operation/agents.php b/pandora_console/mobile/operation/agents.php index d3793725ad..f006281afe 100644 --- a/pandora_console/mobile/operation/agents.php +++ b/pandora_console/mobile/operation/agents.php @@ -343,6 +343,7 @@ class Agents { $this->addJavascriptAddBottom(); } } + $ui->contentAddLinkListener('list_agents'); } private function addJavascriptAddBottom() { @@ -394,7 +395,7 @@ class Agents { }); load_more_rows = 1; - refresh_link_listener(); + refresh_link_listener_list_agents(); } @@ -413,18 +414,6 @@ class Agents { custom_scroll(); }); }); - - //Set link on entire row - function refresh_link_listener() { - $('#list_agents tr').click( function() { - var link = $(this).find('a').attr('href'); - if (link != undefined) { - window.location = $(this).find('a').attr('href'); - } - }); - } - - refresh_link_listener(); "); } diff --git a/pandora_console/mobile/operation/events.php b/pandora_console/mobile/operation/events.php index 38932d27ab..5167cd85e3 100644 --- a/pandora_console/mobile/operation/events.php +++ b/pandora_console/mobile/operation/events.php @@ -406,107 +406,124 @@ class Events { $home->show($error); } + public function get_event_dialog_error_options($options) { + $options['type'] = 'hidden'; + + $options['dialog_id'] = 'detail_event_dialog_error'; + $options['title_text'] = __('ERROR: Event detail'); + $options['content_text'] = '' . + __('Error connecting to DB pandora.') . ''; + + return $options; + } + + public function get_event_dialog_options() { + $ui = Ui::getInstance(); + + $options['type'] = 'hidden'; + + $options['dialog_id'] = 'detail_event_dialog'; + + $options['title_close_button'] = true; + $options['title_text'] = __('Event detail'); + + //Content + ob_start(); + ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ __('Validate'), + 'id' => 'validate_button', + 'href' => 'javascript: validateEvent();'); + $options['content_text'] .= $ui->createButton($options_button); + $options_hidden = array( + 'id' => 'event_id', + 'value' => 0, + 'type' => 'hidden' + ); + $options['content_text'] .= $ui->getInput($options_hidden); + $options['content_text'] .= ''; + $options['content_text'] .= ''; + $options['content_text'] .= ''; + + $options['button_close'] = false; + + return $options; + } + private function show_events() { $ui = Ui::getInstance(); $ui->createPage(); - $options['type'] = 'hidden'; - - $options['dialog_id'] = 'detail_event_dialog'; - - $options['title_close_button'] = true; - $options['title_text'] = __('Event detail'); - - //Content - ob_start(); - ?> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- __('Validate'), - 'id' => 'validate_button', - 'href' => 'javascript: validateEvent();'); - $options['content_text'] .= $ui->createButton($options_button); - $options_hidden = array( - 'id' => 'event_id', - 'value' => 0, - 'type' => 'hidden' - ); - $options['content_text'] .= $ui->getInput($options_hidden); - $options['content_text'] .= ''; - $options['content_text'] .= ''; - $options['content_text'] .= ''; - - $options['button_close'] = false; - + $options = $this->get_event_dialog_options(); + $ui->addDialog($options); - $options['type'] = 'hidden'; + + $options = $this->get_event_dialog_error_options($options); - $options['dialog_id'] = 'detail_event_dialog_error'; - $options['title_text'] = __('ERROR: Event detail'); - $options['content_text'] = '' . - __('Error connecting to DB pandora.') . ''; $ui->addDialog($options); @@ -762,6 +779,8 @@ class Events { return array('table' => $table->getHTML(), 'data' => $events_db); } } + + $ui->contentAddLinkListener('list_events'); } public function putEventsTableJS($id_agent) { @@ -770,7 +789,7 @@ class Events { "; } - private function addJavascriptDialog() { + public function addJavascriptDialog() { $ui = Ui::getInstance(); $ui->contentAddHtml(" @@ -900,18 +919,6 @@ class Events { } }); } - - //Set link on entire row - function refresh_link_listener() { - $('#list_events tr').click( function() { - var link = $(this).find('a').attr('href'); - if (link != undefined) { - window.location = $(this).find('a').attr('href'); - } - }); - } - - refresh_link_listener(); "); } @@ -941,7 +948,7 @@ class Events { //$(\"table#list_events\").table().table('refresh'); load_more_rows = 1; - refresh_link_listener(); + refresh_link_listener_list_events(); } } diff --git a/pandora_console/mobile/operation/module_graph.php b/pandora_console/mobile/operation/module_graph.php index 4cff98e77c..1453e674a9 100644 --- a/pandora_console/mobile/operation/module_graph.php +++ b/pandora_console/mobile/operation/module_graph.php @@ -135,8 +135,6 @@ class ModuleGraph { $time_compare = 'overlapped'; } - - ob_start(); switch ($this->graph_type) { case 'boolean': @@ -156,7 +154,7 @@ class ModuleGraph { $urlImage, 'adapter_' . $this->graph_type, $time_compare, - $this->unknown_graph); + $this->unknown_graph, false); if ($this->draw_events) { $graph .= '
'; $graph .= graphic_module_events( @@ -189,7 +187,7 @@ class ModuleGraph { 1, false, 'adapter_' . $this->graph_type, - $time_compare, $this->unknown_graph); + $time_compare, $this->unknown_graph, false); if ($this->draw_events) { $graph .= '
'; $graph .= graphic_module_events($this->id, @@ -213,7 +211,9 @@ class ModuleGraph { $date, false, $urlImage, - 'adapter_' . $this->graph_type); + 'adapter_' . $this->graph_type, + 1, + false); if ($this->draw_events) { $graph .= '
'; $graph .= graphic_module_events($this->id, @@ -276,13 +276,21 @@ class ModuleGraph { ?> "); } diff --git a/pandora_console/mobile/operation/networkmaps.php b/pandora_console/mobile/operation/networkmaps.php index 1e6ab2dd4a..397e19060c 100755 --- a/pandora_console/mobile/operation/networkmaps.php +++ b/pandora_console/mobile/operation/networkmaps.php @@ -199,16 +199,8 @@ class Networkmaps { $table->importFromHash($list); $ui->contentAddHtml($table->getHTML()); } - - $ui->contentAddHtml(""); + + $ui->contentAddLinkListener('list_networkmaps'); } private function filterNetworkmapsGetString() { diff --git a/pandora_console/mobile/operation/tactical.php b/pandora_console/mobile/operation/tactical.php index 5cd9cfbf0d..6ac2b22ef7 100755 --- a/pandora_console/mobile/operation/tactical.php +++ b/pandora_console/mobile/operation/tactical.php @@ -68,30 +68,22 @@ class Tactical { ' . $formatted_data['server_health']['title'] . ' ' . $formatted_data['server_health']['graph'] . ' - - - ' . $formatted_data_untiny['server_health']['graph'] . ' + ' . $formatted_data_untiny['server_health']['graph'] . ' ' . $formatted_data['monitor_health']['title'] . ' ' . $formatted_data['monitor_health']['graph'] . ' - - - ' . $formatted_data_untiny['monitor_health']['graph'] . ' + ' . $formatted_data_untiny['monitor_health']['graph'] . ' ' . $formatted_data['module_sanity']['title'] . ' ' . $formatted_data['module_sanity']['graph'] . ' - - - ' . $formatted_data_untiny['module_sanity']['graph'] . ' + ' . $formatted_data_untiny['module_sanity']['graph'] . ' ' . $formatted_data['alert_level']['title'] . ' ' . $formatted_data['alert_level']['graph'] . ' - - - ' . $formatted_data_untiny['alert_level']['graph'] . ' + ' . $formatted_data_untiny['alert_level']['graph'] . ' '; diff --git a/pandora_console/mobile/operation/visualmaps.php b/pandora_console/mobile/operation/visualmaps.php index e18cd1c115..e4578cc937 100644 --- a/pandora_console/mobile/operation/visualmaps.php +++ b/pandora_console/mobile/operation/visualmaps.php @@ -148,15 +148,7 @@ class Visualmaps { $ui->contentAddHtml($table->getHTML()); } - $ui->contentAddHtml(""); + $ui->contentAddLinkListener('list_visualmaps'); } } ?>