Now the only average value of the simple graphs can be deactivated

This commit is contained in:
Alejandro Gallardo Escobar 2014-11-13 20:04:08 +01:00
parent dc74db1f4f
commit a12153dd6e
3 changed files with 37 additions and 3 deletions

View File

@ -85,6 +85,8 @@ $sla_sorted_by = 0;
$id_agents = '';
$inventory_modules = array();
$date = null;
// Only avg is selected by default for the simple graphs
$only_avg = true;
//Added for events items
$filter_event_validated = false;
@ -171,8 +173,10 @@ switch ($action) {
$idAgentModule = $item['id_agent_module'];
$idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $idAgentModule));
break;
case 'simple_baseline_graph':
case 'simple_graph':
$only_avg = isset($style['only_avg']) ? (bool) $style['only_avg'] : true;
// The break hasn't be forgotten.
case 'simple_baseline_graph':
case 'projection_graph':
$description = $item['description'];
$idAgentModule = $item['id_agent_module'];
@ -1001,6 +1005,10 @@ html_print_input_hidden('id_item', $idItem);
?>
</td>
</tr>
<tr id="row_only_avg" style="" class="datos">
<td><?php echo __('Only average');?></td>
<td><?php html_print_checkbox('only_avg', 1, $only_avg);?></td>
</tr>
<tr id="row_exception_condition_value" style="" class="datos">
<td style="vertical-align: top;"><?php echo __('Value'); ?></td>
<td style=""><?php html_print_input_text('exception_condition_value', $exception_condition_value, '', 5, 5); ?></td>
@ -1873,6 +1881,7 @@ function chooseType() {
$("#row_show_resume").hide();
$("#row_show_graph").hide();
$("#row_max_min_avg").hide();
$("#row_only_avg").hide();
$("#row_quantity").hide();
$("#row_exception_condition_value").hide();
$("#row_exception_condition").hide();
@ -1915,6 +1924,9 @@ function chooseType() {
$("#row_event_graphs").show();
break;
case 'simple_graph':
$("#row_only_avg").show();
// The break hasn't be forgotten, this element
// only should be shown on the simple graphs.
case 'simple_baseline_graph':
$("#row_description").show();
$("#row_agent").show();

View File

@ -971,6 +971,11 @@ switch ($action) {
$style['event_graph_by_criticity'] = $event_graph_by_criticity;
$style['event_graph_validated_vs_unvalidated'] = $event_graph_validated_vs_unvalidated;
break;
case 'simple_graph':
// Warning. We are using this column to hold this value to avoid
// the modification of the database for compatibility reasons.
$style['only_avg'] = (int) get_parameter('only_avg');
break;
}
$values['style'] = io_safe_input(json_encode($style));
@ -1180,6 +1185,11 @@ switch ($action) {
$style['event_graph_by_criticity'] = $event_graph_by_criticity;
$style['event_graph_validated_vs_unvalidated'] = $event_graph_validated_vs_unvalidated;
break;
case 'simple_graph':
// Warning. We are using this column to hold this value to avoid
// the modification of the database for compatibility reasons.
$style['only_avg'] = (int) get_parameter('only_avg');
break;
}
$values['style'] = io_safe_input(json_encode($style));

View File

@ -3471,13 +3471,25 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
$moduletype_name = modules_get_moduletype_name(
modules_get_agentmodule_type(
$content['id_agent_module']));
$only_avg = true;
// Due to database compatibility problems, the 'only_avg' value
// is stored into the json contained into the 'style' column.
if (isset($content['style'])) {
$style_json = io_safe_output($content['style']);
$style = json_decode($style_json, true);
if (isset($style['only_avg'])) {
$only_avg = (bool) $style['only_avg'];
}
}
if (preg_match ("/string/", $moduletype_name)) {
$urlImage = ui_get_full_url(false, false, false, false);
$data[0] = grafico_modulo_string ($content['id_agent_module'], $content['period'],
false, $sizgraph_w, $sizgraph_h, '', '', false, 1, false,
false, $sizgraph_w, $sizgraph_h, '', '', false, $only_avg, false,
$report["datetime"], $only_image, $urlImage);
}
@ -3492,7 +3504,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
'',
'',
false,
true,
$only_avg,
true,
$report["datetime"],
'',