diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index ae03149381..cf30f49b18 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,13 @@ +2012-11-28 Sergio Martin + + * include/functions_ui.php + include/functions_graph.php + include/functions_reporting.php + include/functions_networkmap.php + operation/reporting/reporting_viewer.php + godmode/reporting/reporting_builder.php: Fix a lot of bugs of reports and + networkmap like foreach problems and filter issues + 2012-11-28 Juan Manuel Ramon * include/functions_groups.php diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php index 9e1392cc52..676ac74012 100644 --- a/pandora_console/godmode/reporting/reporting_builder.php +++ b/pandora_console/godmode/reporting/reporting_builder.php @@ -46,6 +46,7 @@ $action = get_parameter('action', 'list'); $idReport = get_parameter('id_report', 0); $offset = get_parameter('offset', 0); $idItem = get_parameter('id_item', 0); +$pure = get_parameter('pure',0); //Other Checks for the edit the reports if ($idReport != 0) { @@ -231,7 +232,7 @@ switch ($action) { case 'list': $buttons = array( 'list_reports' => array('active' => false, - 'text' => '' . + 'text' => '' . html_print_image("images/god6.png", true, array ("title" => __('Main'))) .'') ); @@ -255,7 +256,7 @@ switch ($action) { // Bread crumbs ui_meta_add_breadcrumb( array( - 'link' => 'index.php?sec=reporting&sec2=godmode/reporting/reporting_builder', + 'link' => 'index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&pure='.$pure, 'text' => __('Reporting'))); ui_meta_print_page_header($nav_bar); @@ -298,7 +299,7 @@ switch ($action) { $table_aux->data[0][6] = html_print_submit_button(__('Search'), 'search_submit', false, 'class="sub upd"', true); - echo "
"; html_print_table($table_aux); echo "
"; @@ -393,7 +394,7 @@ switch ($action) { if (check_acl ($config["id_user"], $report["id_group"], "AW")) { $data[0] = ''.$report['name'].''; + $report['id_report'].'&pure='.$pure.'">'.$report['name'].''; } else { $data[0] = $report['name']; @@ -402,7 +403,7 @@ switch ($action) { $data[1] = $report['description']; - $data[2] = '' . + $data[2] = '' . html_print_image("images/reporting.png", true) . ''; $data[3] = '' . html_print_image("images/database_lightning.png", true) . ''; //I chose ajax.php because it's supposed to give XML anyway @@ -423,7 +424,7 @@ switch ($action) { $next++; - $data[$next] = ui_print_group_icon($report['id_group'], true); + $data[$next] = ui_print_group_icon($report['id_group'], true, "groups_small", '', !defined('METACONSOLE')); $next++; $type_access_selected = reports_get_type_access($report); @@ -443,7 +444,7 @@ switch ($action) { } if ($edit) { - $data[$next] = '
'; + $data[$next] = ''; $data[$next] .= html_print_input_hidden ('id_report', $report['id_report'], true); $data[$next] .= html_print_input_image ('edit', 'images/config.png', 1, '', true, array ('title' => __('Edit'))); $data[$next] .= '
'; @@ -468,7 +469,7 @@ switch ($action) { if (check_acl ($config['id_user'], 0, "IW")) { - echo '
'; + echo ''; echo '
'; html_print_submit_button (__('Create report'), 'create', false, 'class="sub next"'); echo "
"; @@ -1264,7 +1265,7 @@ switch ($action) { if ($enterpriseEnable) { $buttons = array( 'list_reports' => array('active' => false, - 'text' => '' . + 'text' => '' . html_print_image("images/god6.png", true, array ("title" => __('Main'))) .'') ); @@ -1299,13 +1300,13 @@ if ($enterpriseEnable) { $buttons = array( 'main' => array('active' => false, - 'text' => '' . + 'text' => '' . html_print_image("images/reporting_edit.png", true, array ("title" => __('Main'))) .''), 'list_items' => array('active' => false, - 'text' => '' . + 'text' => '' . html_print_image("images/god6.png", true, array ("title" => __('List items'))) .''), 'item_editor' => array('active' => false, - 'text' => '' . + 'text' => '' . html_print_image("images/config.png", true, array ("title" => __('Item editor'))) .'') ); @@ -1314,7 +1315,7 @@ if ($enterpriseEnable) { } $buttons['view'] = array('active' => false, - 'text' => '' . + 'text' => '' . html_print_image("images/reporting.png", true, array ("title" => __('View report'))) .''); $buttons[$activeTab]['active'] = true; @@ -1333,7 +1334,7 @@ else { // Page header for metaconsole if ($enterpriseEnable and defined('METACONSOLE')) { // Bread crumbs - ui_meta_add_breadcrumb(array('link' => 'index.php?sec=reporting&sec2=godmode/reporting/reporting_builder', 'text' => __('Reporting'))); + ui_meta_add_breadcrumb(array('link' => 'index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&pure='.$pure, 'text' => __('Reporting'))); ui_meta_print_page_header($nav_bar); diff --git a/pandora_console/include/functions_graph.php b/pandora_console/include/functions_graph.php index ce911ee9f1..85ed6e0a1b 100755 --- a/pandora_console/include/functions_graph.php +++ b/pandora_console/include/functions_graph.php @@ -101,11 +101,11 @@ function get_statwin_graph_statistics ($chart_array) { //Initialize stats array $stats['sum'] = array ("avg" => 0, "min" => null, "max" => null, "last" => 0); $stats['min'] = array ("avg" => 0, "min" => null, "max" => null, "last" => 0); - $stats['max'] = array ("avg" => 0, "min" => null, "max" => null, "last" => 0); + $stats['max'] = array ("avg" => 0, "min" => null, "max" => null, "last" => 0); foreach ($chart_array as $item) { //Get stats for normal grap - if ($item['sum']) { + if (isset($item['sum']) && $item['sum']) { //Sum all values later divide by the number of elements $stats['sum']['avg'] = $stats['sum']['avg'] + $item['sum']; @@ -126,46 +126,44 @@ function get_statwin_graph_statistics ($chart_array) { } //Get stats for min graph - if ($item['min']) { - //Sum all values later divide by the number of elements - $stats['min']['avg'] = $stats['min']['avg'] + $item['min']; + if (isset($item['min']) && $item['min']) { + //Sum all values later divide by the number of elements + $stats['min']['avg'] = $stats['min']['avg'] + $item['min']; - //Get minimum - if ($stats['min']['min'] == null) { - $stats['min']['min'] = $item['min']; - } else if ($item['min'] < $stats['min']['min']) { - $stats['min']['min'] = $item['min']; - } + //Get minimum + if ($stats['min']['min'] == null) { + $stats['min']['min'] = $item['min']; + } else if ($item['min'] < $stats['min']['min']) { + $stats['min']['min'] = $item['min']; + } - //Get maximum - if ($stats['min']['max'] == null) { - $stats['min']['max'] = $item['min']; - } else if ($item['min'] > $stats['min']['max']) { - $stats['min']['max'] = $item['min']; - } - - } + //Get maximum + if ($stats['min']['max'] == null) { + $stats['min']['max'] = $item['min']; + } else if ($item['min'] > $stats['min']['max']) { + $stats['min']['max'] = $item['min']; + } + } //Get stats for max graph - if ($item['max']) { - //Sum all values later divide by the number of elements - $stats['max']['avg'] = $stats['max']['avg'] + $item['max']; + if (isset($item['max']) && $item['max']) { + //Sum all values later divide by the number of elements + $stats['max']['avg'] = $stats['max']['avg'] + $item['max']; - //Get minimum - if ($stats['max']['min'] == null) { - $stats['max']['min'] = $item['max']; - } else if ($item['max'] < $stats['max']['min']) { - $stats['max']['min'] = $item['max']; - } - - //Get maximum - if ($stats['max']['max'] == null) { - $stats['max']['max'] = $item['max']; - } else if ($item['max'] > $stats['max']['max']) { - $stats['max']['max'] = $item['max']; - } - - } + //Get minimum + if ($stats['max']['min'] == null) { + $stats['max']['min'] = $item['max']; + } else if ($item['max'] < $stats['max']['min']) { + $stats['max']['min'] = $item['max']; + } + + //Get maximum + if ($stats['max']['max'] == null) { + $stats['max']['max'] = $item['max']; + } else if ($item['max'] > $stats['max']['max']) { + $stats['max']['max'] = $item['max']; + } + } //Count elements @@ -173,15 +171,15 @@ function get_statwin_graph_statistics ($chart_array) { //Get last data if ($count == $size) { - if ($item['sum']) { + if (isset($item['sum']) && $item['sum']) { $stats['sum']['last'] = $item['sum']; } - if($item['min']) { + if(isset($item['min']) && $item['min']) { $stats['min']['last'] = $item['min']; } - if ($item['max']) { + if (isset($item['max']) && $item['max']) { $stats['max']['last'] = $item['max']; } } diff --git a/pandora_console/include/functions_networkmap.php b/pandora_console/include/functions_networkmap.php index 8cb943ae3f..4ee87ab509 100644 --- a/pandora_console/include/functions_networkmap.php +++ b/pandora_console/include/functions_networkmap.php @@ -624,8 +624,13 @@ function networkmap_create_module_group_node ($module_group, $simple = 0, $font_ // Returns a module node definition function networkmap_create_module_node ($module, $simple = 0, $font_size = 10, $metaconsole = false, $id_server = null) { - $status = modules_get_agentmodule_status($module['id_agente_modulo'], - false, $metaconsole, $id_server); + if(isset($module['status'])) { + $status = $module['status']; + } + else { + $status = modules_get_agentmodule_status($module['id_agente_modulo'], + false, $metaconsole, $id_server); + } // Set node status switch ($status) { diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index f70fea10c4..761e94420f 100644 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -713,9 +713,9 @@ function reporting_get_agentmodule_sla_array ($id_agent_module, $period = 0, $mi else { // Get previous data (This adds the first data if the begin of module data is after the begin time interval) $previous_data = modules_get_previous_data ($id_agent_module, $datelimit); - - if ($previous_data !== false) { - $interval_data_indexed[$datelimit]['data'] = $previous_data['data']; + + if ($previous_data !== false ) { + $interval_data_indexed[$datelimit]['data'] = $previous_data['datos']; } else { // If there are not data befor interval set unknown $interval_data_indexed[$datelimit]['data'] = 0; @@ -726,7 +726,7 @@ function reporting_get_agentmodule_sla_array ($id_agent_module, $period = 0, $mi // Get next data (This adds data before the interval of the report) $next_data = modules_get_next_data ($id_agent_module, $date); if ($next_data !== false) { - $interval_data_indexed[$date]['data'] = $previous_data['data']; + $interval_data_indexed[$date]['data'] = $previous_data['datos']; } else if (count ($interval_data_indexed) > 0) { // Propagate the last known data to the end of the interval (if there is no module data at the end point) diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index 0d3d3f81ee..66dab92bbb 100644 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -2765,6 +2765,11 @@ function ui_print_agent_autocomplete_input($parameters) { $javascript_on_blur_function_name = $parameters['javascript_on_blur_function_name']; } + $check_only_empty_javascript_on_blur_function = false;//Default value + if (isset($parameters['check_only_empty_javascript_on_blur_function'])) { + $check_only_empty_javascript_on_blur_function = $parameters['check_only_empty_javascript_on_blur_function']; + } + //Default value $javascript_on_blur = ' /* @@ -2772,12 +2777,33 @@ function ui_print_agent_autocomplete_input($parameters) { input lost the focus. */ function ' . $javascript_on_blur_function_name . '() { + input_value = $("#' . $input_id . '").val(); + + if (input_value.length == 0) { + if ((' . ((int)$print_hidden_input_idagent) . ') + || (' . ((int)$use_hidden_input_idagent) . ')) { + $("#' . $hidden_input_idagent_id . '").val(0); + } + + //Put the server id into the hidden input + if ((' . ((int)$use_input_server) . ') + || (' . ((int)$print_input_server) . ')) { + $("#' . $input_server_id . '").val(""); + } + + return; + } + + if (' . ((int)$check_only_empty_javascript_on_blur_function) . ') { + return + } + //Set loading $("#' . $input_id . '") .css("background", "url(\"' . $spinner_image . '\") right center no-repeat"); - input_value = $("#' . $input_id . '").val(); + var term = input_value; //Word to search diff --git a/pandora_console/operation/reporting/reporting_viewer.php b/pandora_console/operation/reporting/reporting_viewer.php index c2ed5859f1..374db3fde8 100644 --- a/pandora_console/operation/reporting/reporting_viewer.php +++ b/pandora_console/operation/reporting/reporting_viewer.php @@ -49,6 +49,8 @@ if ($report['id_group'] != 0 && return; } +$pure = get_parameter('pure',0); + // Get different date to search the report. $date = (string) get_parameter ('date', date ('Y-m-j')); $time = (string) get_parameter ('time', date ('h:iA')); @@ -65,21 +67,23 @@ $enable_init_date = get_parameter('enable_init_date', 0); // Standard header -$url = "index.php?sec=reporting&sec2=operation/reporting/reporting_viewer&id=$id_report&date=$date&time=$time"; +$url = "index.php?sec=reporting&sec2=operation/reporting/reporting_viewer&id=$id_report&date=$date&time=$time&pure=$pure"; -$options['setup'] = "" +$options['setup'] = "" . html_print_image ("images/setup.png", true, array ("title" => __('Setup'))) . ""; -if ($config["pure"] == 0) { - $options['screen'] = "" - . html_print_image ("images/fullscreen.png", true, array ("title" => __('Full screen mode'))) - . ""; -} -else { - $options['screen'] = "" - . html_print_image ("images/normalscreen.png", true, array ("title" => __('Back to normal mode'))) - . ""; +if(!defined('METACONSOLE')) { + if ($config["pure"] == 0) { + $options['screen'] = "" + . html_print_image ("images/fullscreen.png", true, array ("title" => __('Full screen mode'))) + . ""; + } + else { + $options['screen'] = "" + . html_print_image ("images/normalscreen.png", true, array ("title" => __('Back to normal mode'))) + . ""; + } } // Page header for metaconsole