2012-11-28 Sergio Martin <sergio.martin@artica.es>

* 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




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7199 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
zarzuelo 2012-11-28 18:29:24 +00:00
parent 5bcc3d459e
commit 66e01a50a0
7 changed files with 116 additions and 72 deletions

View File

@ -1,3 +1,13 @@
2012-11-28 Sergio Martin <sergio.martin@artica.es>
* 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 <juanmanuel.ramon@artica.es> 2012-11-28 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* include/functions_groups.php * include/functions_groups.php

View File

@ -46,6 +46,7 @@ $action = get_parameter('action', 'list');
$idReport = get_parameter('id_report', 0); $idReport = get_parameter('id_report', 0);
$offset = get_parameter('offset', 0); $offset = get_parameter('offset', 0);
$idItem = get_parameter('id_item', 0); $idItem = get_parameter('id_item', 0);
$pure = get_parameter('pure',0);
//Other Checks for the edit the reports //Other Checks for the edit the reports
if ($idReport != 0) { if ($idReport != 0) {
@ -231,7 +232,7 @@ switch ($action) {
case 'list': case 'list':
$buttons = array( $buttons = array(
'list_reports' => array('active' => false, 'list_reports' => array('active' => false,
'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder">' . 'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&pure='.$pure.'">' .
html_print_image("images/god6.png", true, array ("title" => __('Main'))) .'</a>') html_print_image("images/god6.png", true, array ("title" => __('Main'))) .'</a>')
); );
@ -255,7 +256,7 @@ switch ($action) {
// Bread crumbs // Bread crumbs
ui_meta_add_breadcrumb( ui_meta_add_breadcrumb(
array( 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'))); 'text' => __('Reporting')));
ui_meta_print_page_header($nav_bar); 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); $table_aux->data[0][6] = html_print_submit_button(__('Search'), 'search_submit', false, 'class="sub upd"', true);
echo "<form action='index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&id_group='.$id_group' echo "<form action='index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&id_group=$id_group&pure=$pure'
method='post'>"; method='post'>";
html_print_table($table_aux); html_print_table($table_aux);
echo "</form>"; echo "</form>";
@ -393,7 +394,7 @@ switch ($action) {
if (check_acl ($config["id_user"], $report["id_group"], "AW")) { if (check_acl ($config["id_user"], $report["id_group"], "AW")) {
$data[0] = '<a href="' . $config['homeurl'] . 'index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&action=edit&id_report='. $data[0] = '<a href="' . $config['homeurl'] . 'index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&action=edit&id_report='.
$report['id_report'].'">'.$report['name'].'</a>'; $report['id_report'].'&pure='.$pure.'">'.$report['name'].'</a>';
} }
else { else {
$data[0] = $report['name']; $data[0] = $report['name'];
@ -402,7 +403,7 @@ switch ($action) {
$data[1] = $report['description']; $data[1] = $report['description'];
$data[2] = '<a href="' . $config['homeurl'] . 'index.php?sec=reporting&sec2=operation/reporting/reporting_viewer&id='.$report['id_report'].'">' . $data[2] = '<a href="' . $config['homeurl'] . 'index.php?sec=reporting&sec2=operation/reporting/reporting_viewer&id='.$report['id_report'].'&pure='.$pure.'">' .
html_print_image("images/reporting.png", true) . '</a>'; html_print_image("images/reporting.png", true) . '</a>';
$data[3] = '<a href="'. ui_get_full_url(false, false, false, false) . 'ajax.php?page=' . $config['homedir'] . '/operation/reporting/reporting_xml&id='.$report['id_report'].'">' . html_print_image("images/database_lightning.png", true) . '</a>'; //I chose ajax.php because it's supposed to give XML anyway $data[3] = '<a href="'. ui_get_full_url(false, false, false, false) . 'ajax.php?page=' . $config['homedir'] . '/operation/reporting/reporting_xml&id='.$report['id_report'].'">' . html_print_image("images/database_lightning.png", true) . '</a>'; //I chose ajax.php because it's supposed to give XML anyway
@ -423,7 +424,7 @@ switch ($action) {
$next++; $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++; $next++;
$type_access_selected = reports_get_type_access($report); $type_access_selected = reports_get_type_access($report);
@ -443,7 +444,7 @@ switch ($action) {
} }
if ($edit) { if ($edit) {
$data[$next] = '<form method="post" action="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&action=edit" style="display:inline">'; $data[$next] = '<form method="post" action="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&action=edit&pure='.$pure.'" style="display:inline">';
$data[$next] .= html_print_input_hidden ('id_report', $report['id_report'], true); $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] .= html_print_input_image ('edit', 'images/config.png', 1, '', true, array ('title' => __('Edit')));
$data[$next] .= '</form>'; $data[$next] .= '</form>';
@ -468,7 +469,7 @@ switch ($action) {
if (check_acl ($config['id_user'], 0, "IW")) { if (check_acl ($config['id_user'], 0, "IW")) {
echo '<form method="post" action="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=main&action=new">'; echo '<form method="post" action="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=main&action=new&pure=$pure">';
echo '<div class="action-buttons" style="width: 98%;">'; echo '<div class="action-buttons" style="width: 98%;">';
html_print_submit_button (__('Create report'), 'create', false, 'class="sub next"'); html_print_submit_button (__('Create report'), 'create', false, 'class="sub next"');
echo "</div>"; echo "</div>";
@ -1264,7 +1265,7 @@ switch ($action) {
if ($enterpriseEnable) { if ($enterpriseEnable) {
$buttons = array( $buttons = array(
'list_reports' => array('active' => false, 'list_reports' => array('active' => false,
'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder">' . 'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&pure='.$pure.'">' .
html_print_image("images/god6.png", true, array ("title" => __('Main'))) .'</a>') html_print_image("images/god6.png", true, array ("title" => __('Main'))) .'</a>')
); );
@ -1299,13 +1300,13 @@ if ($enterpriseEnable) {
$buttons = array( $buttons = array(
'main' => array('active' => false, 'main' => array('active' => false,
'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=main&action=edit&id_report=' . $idReport . '">' . 'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=main&action=edit&id_report=' . $idReport . '&pure='.$pure.'">' .
html_print_image("images/reporting_edit.png", true, array ("title" => __('Main'))) .'</a>'), html_print_image("images/reporting_edit.png", true, array ("title" => __('Main'))) .'</a>'),
'list_items' => array('active' => false, 'list_items' => array('active' => false,
'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=edit&id_report=' . $idReport . '">' . 'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=edit&id_report=' . $idReport . '&pure='.$pure.'">' .
html_print_image("images/god6.png", true, array ("title" => __('List items'))) .'</a>'), html_print_image("images/god6.png", true, array ("title" => __('List items'))) .'</a>'),
'item_editor' => array('active' => false, 'item_editor' => array('active' => false,
'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=item_editor&action=new&id_report=' . $idReport . '">' . 'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=item_editor&action=new&id_report=' . $idReport . '&pure='.$pure.'">' .
html_print_image("images/config.png", true, array ("title" => __('Item editor'))) .'</a>') html_print_image("images/config.png", true, array ("title" => __('Item editor'))) .'</a>')
); );
@ -1314,7 +1315,7 @@ if ($enterpriseEnable) {
} }
$buttons['view'] = array('active' => false, $buttons['view'] = array('active' => false,
'text' => '<a href="index.php?sec=reporting&sec2=operation/reporting/reporting_viewer&id=' . $idReport . '">' . 'text' => '<a href="index.php?sec=reporting&sec2=operation/reporting/reporting_viewer&id=' . $idReport . '&pure='.$pure.'">' .
html_print_image("images/reporting.png", true, array ("title" => __('View report'))) .'</a>'); html_print_image("images/reporting.png", true, array ("title" => __('View report'))) .'</a>');
$buttons[$activeTab]['active'] = true; $buttons[$activeTab]['active'] = true;
@ -1333,7 +1334,7 @@ else {
// Page header for metaconsole // Page header for metaconsole
if ($enterpriseEnable and defined('METACONSOLE')) { if ($enterpriseEnable and defined('METACONSOLE')) {
// Bread crumbs // 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); ui_meta_print_page_header($nav_bar);

View File

@ -105,7 +105,7 @@ function get_statwin_graph_statistics ($chart_array) {
foreach ($chart_array as $item) { foreach ($chart_array as $item) {
//Get stats for normal grap //Get stats for normal grap
if ($item['sum']) { if (isset($item['sum']) && $item['sum']) {
//Sum all values later divide by the number of elements //Sum all values later divide by the number of elements
$stats['sum']['avg'] = $stats['sum']['avg'] + $item['sum']; $stats['sum']['avg'] = $stats['sum']['avg'] + $item['sum'];
@ -126,7 +126,7 @@ function get_statwin_graph_statistics ($chart_array) {
} }
//Get stats for min graph //Get stats for min graph
if ($item['min']) { if (isset($item['min']) && $item['min']) {
//Sum all values later divide by the number of elements //Sum all values later divide by the number of elements
$stats['min']['avg'] = $stats['min']['avg'] + $item['min']; $stats['min']['avg'] = $stats['min']['avg'] + $item['min'];
@ -143,11 +143,10 @@ function get_statwin_graph_statistics ($chart_array) {
} else if ($item['min'] > $stats['min']['max']) { } else if ($item['min'] > $stats['min']['max']) {
$stats['min']['max'] = $item['min']; $stats['min']['max'] = $item['min'];
} }
} }
//Get stats for max graph //Get stats for max graph
if ($item['max']) { if (isset($item['max']) && $item['max']) {
//Sum all values later divide by the number of elements //Sum all values later divide by the number of elements
$stats['max']['avg'] = $stats['max']['avg'] + $item['max']; $stats['max']['avg'] = $stats['max']['avg'] + $item['max'];
@ -164,7 +163,6 @@ function get_statwin_graph_statistics ($chart_array) {
} else if ($item['max'] > $stats['max']['max']) { } else if ($item['max'] > $stats['max']['max']) {
$stats['max']['max'] = $item['max']; $stats['max']['max'] = $item['max'];
} }
} }
@ -173,15 +171,15 @@ function get_statwin_graph_statistics ($chart_array) {
//Get last data //Get last data
if ($count == $size) { if ($count == $size) {
if ($item['sum']) { if (isset($item['sum']) && $item['sum']) {
$stats['sum']['last'] = $item['sum']; $stats['sum']['last'] = $item['sum'];
} }
if($item['min']) { if(isset($item['min']) && $item['min']) {
$stats['min']['last'] = $item['min']; $stats['min']['last'] = $item['min'];
} }
if ($item['max']) { if (isset($item['max']) && $item['max']) {
$stats['max']['last'] = $item['max']; $stats['max']['last'] = $item['max'];
} }
} }

View File

@ -624,8 +624,13 @@ function networkmap_create_module_group_node ($module_group, $simple = 0, $font_
// Returns a module node definition // Returns a module node definition
function networkmap_create_module_node ($module, $simple = 0, $font_size = 10, $metaconsole = false, $id_server = null) { function networkmap_create_module_node ($module, $simple = 0, $font_size = 10, $metaconsole = false, $id_server = null) {
if(isset($module['status'])) {
$status = $module['status'];
}
else {
$status = modules_get_agentmodule_status($module['id_agente_modulo'], $status = modules_get_agentmodule_status($module['id_agente_modulo'],
false, $metaconsole, $id_server); false, $metaconsole, $id_server);
}
// Set node status // Set node status
switch ($status) { switch ($status) {

View File

@ -714,8 +714,8 @@ function reporting_get_agentmodule_sla_array ($id_agent_module, $period = 0, $mi
// Get previous data (This adds the first data if the begin of module data is after the begin time interval) // 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); $previous_data = modules_get_previous_data ($id_agent_module, $datelimit);
if ($previous_data !== false) { if ($previous_data !== false ) {
$interval_data_indexed[$datelimit]['data'] = $previous_data['data']; $interval_data_indexed[$datelimit]['data'] = $previous_data['datos'];
} }
else { // If there are not data befor interval set unknown else { // If there are not data befor interval set unknown
$interval_data_indexed[$datelimit]['data'] = 0; $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) // Get next data (This adds data before the interval of the report)
$next_data = modules_get_next_data ($id_agent_module, $date); $next_data = modules_get_next_data ($id_agent_module, $date);
if ($next_data !== false) { 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) { 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) // Propagate the last known data to the end of the interval (if there is no module data at the end point)

View File

@ -2765,6 +2765,11 @@ function ui_print_agent_autocomplete_input($parameters) {
$javascript_on_blur_function_name = $parameters['javascript_on_blur_function_name']; $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 //Default value
$javascript_on_blur = ' $javascript_on_blur = '
/* /*
@ -2772,12 +2777,33 @@ function ui_print_agent_autocomplete_input($parameters) {
input lost the focus. input lost the focus.
*/ */
function ' . $javascript_on_blur_function_name . '() { 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 //Set loading
$("#' . $input_id . '") $("#' . $input_id . '")
.css("background", .css("background",
"url(\"' . $spinner_image . '\") right center no-repeat"); "url(\"' . $spinner_image . '\") right center no-repeat");
input_value = $("#' . $input_id . '").val();
var term = input_value; //Word to search var term = input_value; //Word to search

View File

@ -49,6 +49,8 @@ if ($report['id_group'] != 0 &&
return; return;
} }
$pure = get_parameter('pure',0);
// Get different date to search the report. // Get different date to search the report.
$date = (string) get_parameter ('date', date ('Y-m-j')); $date = (string) get_parameter ('date', date ('Y-m-j'));
$time = (string) get_parameter ('time', date ('h:iA')); $time = (string) get_parameter ('time', date ('h:iA'));
@ -65,21 +67,23 @@ $enable_init_date = get_parameter('enable_init_date', 0);
// Standard header // 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'] = "<a href='index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&action=new&tab=item_editor&id_report=$id_report'>" $options['setup'] = "<a href='index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&action=new&tab=item_editor&id_report=$id_report&pure=$pure'>"
. html_print_image ("images/setup.png", true, array ("title" => __('Setup'))) . html_print_image ("images/setup.png", true, array ("title" => __('Setup')))
. "</a>"; . "</a>";
if ($config["pure"] == 0) { if(!defined('METACONSOLE')) {
if ($config["pure"] == 0) {
$options['screen'] = "<a href='$url&pure=1&enable_init_date=$enable_init_date&date_init=$date_init&time_init=$time_init'>" $options['screen'] = "<a href='$url&pure=1&enable_init_date=$enable_init_date&date_init=$date_init&time_init=$time_init'>"
. html_print_image ("images/fullscreen.png", true, array ("title" => __('Full screen mode'))) . html_print_image ("images/fullscreen.png", true, array ("title" => __('Full screen mode')))
. "</a>"; . "</a>";
} }
else { else {
$options['screen'] = "<a href='$url&pure=0&enable_init_date=$enable_init_date&date_init=$date_init&time_init=$time_init'>" $options['screen'] = "<a href='$url&pure=0&enable_init_date=$enable_init_date&date_init=$date_init&time_init=$time_init'>"
. html_print_image ("images/normalscreen.png", true, array ("title" => __('Back to normal mode'))) . html_print_image ("images/normalscreen.png", true, array ("title" => __('Back to normal mode')))
. "</a>"; . "</a>";
}
} }
// Page header for metaconsole // Page header for metaconsole