2013-02-06 Miguel de Dios <miguel.dedios@artica.es>

* include/functions_graph.php, include/functions_ui.php,
	operation/reporting/reporting_viewer.php,
	operation/agentes/snapshot_view.php: improved the code style.
	
	* include/functions_html.php: added other parameter in print
	checkbox for to avoid to put a hidden input.
	
	Fixes: #3602766




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7596 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2013-02-06 14:03:32 +00:00
parent 4006fbe500
commit 5767594f30
6 changed files with 118 additions and 102 deletions

View File

@ -1,3 +1,14 @@
2013-02-06 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_graph.php, include/functions_ui.php,
operation/reporting/reporting_viewer.php,
operation/agentes/snapshot_view.php: improved the code style.
* include/functions_html.php: added other parameter in print
checkbox for to avoid to put a hidden input.
Fixes: #3602766
2013-02-06 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_config.php: uploaded the lost character key.

View File

@ -103,7 +103,7 @@ function get_statwin_graph_statistics ($chart_array, $series_suffix = '') {
//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) {
if($series_suffix != '') {
@ -127,10 +127,10 @@ function get_statwin_graph_statistics ($chart_array, $series_suffix = '') {
//Get maximum
if ($stats['sum']['max'] == null) {
$stats['sum']['max'] = $item['sum'];
$stats['sum']['max'] = $item['sum'];
}
else if ($item['sum'] > $stats['sum']['max']) {
$stats['sum']['max'] = $item['sum'];
$stats['sum']['max'] = $item['sum'];
}
}
@ -142,18 +142,18 @@ function get_statwin_graph_statistics ($chart_array, $series_suffix = '') {
//Get minimum
if ($stats['min']['min'] == null) {
$stats['min']['min'] = $item['min'];
$stats['min']['min'] = $item['min'];
}
else if ($item['min'] < $stats['min']['min']) {
$stats['min']['min'] = $item['min'];
$stats['min']['min'] = $item['min'];
}
//Get maximum
if ($stats['min']['max'] == null) {
$stats['min']['max'] = $item['min'];
$stats['min']['max'] = $item['min'];
}
else if ($item['min'] > $stats['min']['max']) {
$stats['min']['max'] = $item['min'];
$stats['min']['max'] = $item['min'];
}
}
@ -165,18 +165,18 @@ function get_statwin_graph_statistics ($chart_array, $series_suffix = '') {
//Get minimum
if ($stats['max']['min'] == null) {
$stats['max']['min'] = $item['max'];
$stats['max']['min'] = $item['max'];
}
else if ($item['max'] < $stats['max']['min']) {
$stats['max']['min'] = $item['max'];
$stats['max']['min'] = $item['max'];
}
//Get maximum
if ($stats['max']['max'] == null) {
$stats['max']['max'] = $item['max'];
$stats['max']['max'] = $item['max'];
}
else if ($item['max'] > $stats['max']['max']) {
$stats['max']['max'] = $item['max'];
$stats['max']['max'] = $item['max'];
}
}
@ -211,18 +211,18 @@ function get_statwin_graph_statistics ($chart_array, $series_suffix = '') {
//Format stat data to display properly
$stats['sum']['last'] = round($stats['sum']['last'], 2);
$stats['sum']['avg'] = round($stats['sum']['avg'], 2);
$stats['sum']['min'] = round($stats['sum']['min'], 2);
$stats['sum']['max'] = round($stats['sum']['max'], 2);
$stats['sum']['min'] = round($stats['sum']['min'], 2);
$stats['sum']['max'] = round($stats['sum']['max'], 2);
$stats['min']['last'] = round($stats['min']['last'], 2);
$stats['min']['avg'] = round($stats['min']['avg'], 2);
$stats['min']['min'] = round($stats['min']['min'], 2);
$stats['min']['max'] = round($stats['min']['max'], 2);
$stats['min']['avg'] = round($stats['min']['avg'], 2);
$stats['min']['min'] = round($stats['min']['min'], 2);
$stats['min']['max'] = round($stats['min']['max'], 2);
$stats['max']['last'] = round($stats['max']['last'], 2);
$stats['max']['avg'] = round($stats['max']['avg'], 2);
$stats['max']['min'] = round($stats['max']['min'], 2);
$stats['max']['max'] = round($stats['max']['max'], 2);
$stats['max']['avg'] = round($stats['max']['avg'], 2);
$stats['max']['min'] = round($stats['max']['min'], 2);
$stats['max']['max'] = round($stats['max']['max'], 2);
return $stats;
}
@ -268,7 +268,8 @@ function grafico_modulo_sparse_data_chart (&$chart, &$chart_data_extra, &$long_i
if ($data[$data_i]['datos'] > $interval_max) {
$interval_max = $data[$data_i]['datos'];
} else if ($data[$data_i]['datos'] < $interval_min) {
}
else if ($data[$data_i]['datos'] < $interval_min) {
$interval_min = $data[$data_i]['datos'];
}
$total += $data[$data_i]['datos'];
@ -1160,7 +1161,7 @@ function graphic_combined_module ($module_list, $weight_list, $period, $width, $
//Add the max, min and avg in the legend
$avg = round($avg / $countAvg, 1);
$graph_stats = get_graph_statistics($graph_values[$i]);
$graph_stats = get_graph_statistics($graph_values[$i]);
$min = $graph_stats['min'];
$max = $graph_stats['max'];
@ -2494,34 +2495,34 @@ function grafico_modulo_boolean_data ($agent_module_id, $period, $show_events,
$timestamp = $timestamp_short;
/////////////////////////////////////////////////////////////////
if($is_unknown) {
if ($is_unknown) {
$total = 0;
}
if($show_events) {
if(!isset($chart[$timestamp]['event'.$series_suffix])) {
$chart[$timestamp]['event'.$series_suffix] = 0;
}
if ($show_events) {
if (!isset($chart[$timestamp]['event'.$series_suffix])) {
$chart[$timestamp]['event'.$series_suffix] = 0;
}
$chart[$timestamp]['event'.$series_suffix] += $event_value;
$series_type['event'.$series_suffix] = 'points';
}
if($show_alerts) {
if(!isset($chart[$timestamp]['alert'.$series_suffix])) {
$chart[$timestamp]['alert'.$series_suffix] = 0;
}
$chart[$timestamp]['event'.$series_suffix] += $event_value;
$series_type['event'.$series_suffix] = 'points';
}
if ($show_alerts) {
if (!isset($chart[$timestamp]['alert'.$series_suffix])) {
$chart[$timestamp]['alert'.$series_suffix] = 0;
}
$chart[$timestamp]['alert'.$series_suffix] += $alert_value;
$series_type['alert'.$series_suffix] = 'points';
}
if($show_unknown) {
if(!isset($chart[$timestamp]['unknown'.$series_suffix])) {
$chart[$timestamp]['unknown'.$series_suffix] = 0;
}
$chart[$timestamp]['alert'.$series_suffix] += $alert_value;
$series_type['alert'.$series_suffix] = 'points';
}
if ($show_unknown) {
if (!isset($chart[$timestamp]['unknown'.$series_suffix])) {
$chart[$timestamp]['unknown'.$series_suffix] = 0;
}
$chart[$timestamp]['unknown'.$series_suffix] = $unknown_value;
$series_type['unknown'.$series_suffix] = 'area';
}
$chart[$timestamp]['unknown'.$series_suffix] = $unknown_value;
$series_type['unknown'.$series_suffix] = 'area';
}
//The order filling the array is very important to get the same colors
//in legends and graphs!!!
@ -3147,12 +3148,12 @@ function grafico_modulo_string ($agent_module_id, $period, $show_events,
/////////////////////////////////////////////////////////////////////////////////////////
$color = array();
if($show_events) {
$color['event'.$series_suffix] = array('border' => '#ff0000', 'color' => '#ff0000', 'alpha' => 50);
}
if($show_alerts) {
$color['alert'.$series_suffix] = array('border' => '#ff7f00', 'color' => '#ff7f00', 'alpha' => 50);
}
if ($show_events) {
$color['event'.$series_suffix] = array('border' => '#ff0000', 'color' => '#ff0000', 'alpha' => 50);
}
if ($show_alerts) {
$color['alert'.$series_suffix] = array('border' => '#ff7f00', 'color' => '#ff7f00', 'alpha' => 50);
}
$color['max'] = array('border' => '#000000', 'color' => $config['graph_color3'], 'alpha' => 50);
$color['sum'] = array('border' => '#000000', 'color' => $config['graph_color2'], 'alpha' => 50);
@ -3167,17 +3168,17 @@ function grafico_modulo_string ($agent_module_id, $period, $show_events,
$legend = array();
if($show_events) {
if ($show_events) {
$legend['event'] = __('Events');
}
if($show_alerts) {
if ($show_alerts) {
$legend['alert'] = __('Alerts');
}
$legend['max'] = __('Max').': '.__('Last').': '.$graph_stats['max']['last'].' '.$unit.' ; '.__('Avg').': '.$graph_stats['max']['avg'].' '.$unit.' ; '.__('Max').': '.$graph_stats['max']['max'].' '.$unit.' ; '.__('Min').': '.$graph_stats['max']['min'].' '.$unit;
$legend['max'] = __('Max').': '.__('Last').': '.$graph_stats['max']['last'].' '.$unit.' ; '.__('Avg').': '.$graph_stats['max']['avg'].' '.$unit.' ; '.__('Max').': '.$graph_stats['max']['max'].' '.$unit.' ; '.__('Min').': '.$graph_stats['max']['min'].' '.$unit;
$legend['sum'] = __('Data').': '.__('Last').': '.$graph_stats['sum']['last'].' '.$unit.' ; '.__('Avg').': '.$graph_stats['sum']['avg'].' '.$unit.' ; '.__('Max').': '.$graph_stats['sum']['max'].' '.$unit.' ; '.__('Min').': '.$graph_stats['sum']['min'].' '.$unit;
$legend['min'] = __('Min').': '.__('Last').': '.$graph_stats['min']['last'].' '.$unit.' ; '.__('Avg').': '.$graph_stats['min']['avg'].' '.$unit.' ; '.__('Max').': '.$graph_stats['min']['max'].' '.$unit.' ; '.__('Min').': '.$graph_stats['min']['min'].' '.$unit;
$legend['min'] = __('Min').': '.__('Last').': '.$graph_stats['min']['last'].' '.$unit.' ; '.__('Avg').': '.$graph_stats['min']['avg'].' '.$unit.' ; '.__('Max').': '.$graph_stats['min']['max'].' '.$unit.' ; '.__('Min').': '.$graph_stats['min']['min'].' '.$unit;
$water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png",

View File

@ -1318,9 +1318,11 @@ function html_print_checkbox_extended ($name, $value, $checked, $disabled, $scri
*
* @return string HTML code if return parameter is true.
*/
function html_print_checkbox ($name, $value, $checked = false, $return = false, $disabled = false, $script = '') {
function html_print_checkbox ($name, $value, $checked = false, $return = false, $disabled = false, $script = '', $disabled_hidden = false) {
$output = html_print_checkbox_extended ($name, $value, (bool) $checked, $disabled, $script, '', true);
$output .= html_print_input_hidden($name.'_sent',1,true);
if (!$disabled_hidden) {
$output .= html_print_input_hidden($name . '_sent', 1, true);
}
if ($return === false)
echo $output;

View File

@ -20,8 +20,8 @@ require_once ('../../include/config.php');
require_once ('../../include/auth/mysql.php');
if (! isset($_SESSION['id_usuario'])) {
session_start();
session_write_close();
session_start();
session_write_close();
}
require_once ($config['homedir'] . '/include/functions.php');
@ -32,8 +32,8 @@ check_login ();
$user_language = get_user_language ($config['id_user']);
if (file_exists ('../../include/languages/'.$user_language.'.mo')) {
$l10n = new gettext_reader (new CachedFileReader ('../../include/languages/'.$user_language.'.mo'));
$l10n->load_tables();
$l10n = new gettext_reader (new CachedFileReader ('../../include/languages/'.$user_language.'.mo'));
$l10n->load_tables();
}
$id = get_parameter('id');
@ -44,8 +44,8 @@ $label = get_parameter ("label");
// Parsing the refresh before sending any header
$refresh = (int) get_parameter ("refr", -1);
if ($refresh > 0) {
$query = ui_get_url_refresh (false);
echo '<meta http-equiv="refresh" content="'.$refresh.'; URL='.$query.'" />';
$query = ui_get_url_refresh (false);
echo '<meta http-equiv="refresh" content="'.$refresh.'; URL='.$query.'" />';
}
?>

View File

@ -158,8 +158,10 @@ echo html_print_image("images/wait.gif", true, array("border" => '0'));
echo '<strong>'.__('Loading').'...</strong>';
echo '</div>';
/* We must add javascript here. Otherwise, the date picker won't
work if the date is not correct because php is returning. */
/*
* We must add javascript here. Otherwise, the date picker won't
* work if the date is not correct because php is returning.
*/
ui_require_jquery_file ("ui-timepicker-addon");
?>