Fixed the menu buttons in charts. TICKET: #1818

This commit is contained in:
mdtrooper 2015-02-19 12:52:03 +01:00
parent 16461cf8ad
commit dac81d2640
4 changed files with 57 additions and 66 deletions

View File

@ -773,7 +773,8 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
}
// Build the data of the current period
$data_returned = grafico_modulo_sparse_data ($agent_module_id, $period, $show_events,
$data_returned = grafico_modulo_sparse_data ($agent_module_id,
$period, $show_events,
$width, $height , $title, $unit_name,
$show_alerts, $avg_only,
$date, $unit, $baseline, $return_data, $show_title,
@ -801,8 +802,9 @@ function grafico_modulo_sparse ($agent_module_id, $period, $show_events,
$flash_chart = false;
}
$water_mark = array('file' => $config['homedir'] . "/images/logo_vertical_water.png",
'url' => ui_get_full_url("/images/logo_vertical_water.png"));
$water_mark = array('file' =>
$config['homedir'] . "/images/logo_vertical_water.png",
'url' => ui_get_full_url(false, false, false, false) . "/images/logo_vertical_water.png");
if ($compare === 'separated') {
return area_graph($flash_chart, $chart, $width, $height/2, $color, $legend,

View File

@ -2499,7 +2499,9 @@ function reporting_alert_reporting ($id_group, $period = 0, $date = 0, $return =
$data[__('Alerts not fired')] = $not_fired_percentage;
$output .= pie3d_graph(false, $data, 280, 150,
__("other"), ui_get_full_url(false) . '/', $config['homedir'] . "/images/logo_vertical_water.png",
__("other"),
ui_get_full_url(false, false, false, false) . '/',
ui_get_full_url(false, false, false, false) . "/images/logo_vertical_water.png",
$config['fontpath'], $config['font_size']);
$output .= '<strong>'.__('Alerts fired').': '.sizeof ($alerts_fired).'</strong><br />';
@ -2575,7 +2577,9 @@ function reporting_monitor_health ($id_group, $period = 0, $date = 0, $return =
$data[__('Monitors BAD')] = $not_down_percentage;
$output .= pie3d_graph(false, $data, 280, 150,
__("other"), ui_get_full_url(false) . '/', $config['homedir'] . "/images/logo_vertical_water.png",
__("other"),
ui_get_full_url(false, false, false, false) . '/',
ui_get_full_url(false, false, false, false) . "/images/logo_vertical_water.png",
$config['fontpath'], $config['font_size']);
if (!$return)
@ -3472,20 +3476,20 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
$table->colspan[$next_row][0] = 3;
$table->cellstyle[$next_row][0] = 'text-align: center;';
$data = array ();
$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'];
}
@ -3519,7 +3523,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
0,
true,
$only_image,
ui_get_full_url(false) . '/',
ui_get_full_url(false, false, false, false),
1,
false,
'',
@ -3578,7 +3582,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
0,
$report["datetime"],
true,
ui_get_full_url(false) . '/',
ui_get_full_url(false, false, false, false) . '/',
1,
// Important parameter, this tell to graphic_combined_module function that is a projection graph
$output_projection,
@ -3645,7 +3649,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
$data = array ();
$data[0] = grafico_modulo_sparse($content['id_agent_module'], $content['period'],
false, $sizgraph_w, $sizgraph_h, '', '', false, true, true,
$report["datetime"], '', true, 0, true, $only_image, ui_get_full_url(false) . '/');
$report["datetime"], '', true, 0, true, $only_image,
ui_get_full_url(false, false, false, false));
/*$data[0] = graphic_combined_module(
$modules,
@ -3717,7 +3722,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
$graph["stacked"],
$report["datetime"],
$only_image,
ui_get_full_url(false) . '/');
ui_get_full_url(false, false, false, false));
array_push ($table->data, $data);
break;
@ -4240,47 +4245,13 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
// $data = array();
// $data_pie_graph = json_encode ($data_graph);
if ($show_graphs && !empty($slas)) {
// $data[0] = pie3d_graph(false, $data_graph,
// 500, 150, __("other"),
// ui_get_full_url(false, false, false, false),
// $config['homedir'] . "/images/logo_vertical_water.png",
// $config['fontpath'], $config['font_size']);
// //Print resume
// $table_resume = null;
// $table_resume->head[0] = __('Average Value');
// $table_resume->data[0][0] = '<span style="font: bold '.$sizem.'em Arial, Sans-serif; color: #000000;">';
// $table_resume->data[0][0] .= format_numeric($total_SLA / count($sla_showed), 2);
// $table_resume->data[0][0] .= "%</span>";
// $data[1] = html_print_table($table_resume, true);
// $table_resume = null;
// $table_resume->head[0] = __('SLA Compliance');
// if ($total_result_SLA == 'ok') {
// $table_resume->data[0][0] = '<span style="font: bold '.$sizem.'em Arial, Sans-serif; color: #000000;">'.__('OK').'</span>';
// }
// if ($total_result_SLA == 'fail') {
// $table_resume->data[0][0] = '<span style="font: bold '.$sizem.'em Arial, Sans-serif; color: #ff0000;">'.__('Fail').'</span>';
// }
// if ($total_result_SLA == 'unknown') {
// $table_resume->data[0][0] = '<span style="font: bold '.$sizem.'em Arial, Sans-serif; color: #736F6E;">'.__('Unknown').'</span>';
// }
// $data[2] = html_print_table($table_resume, true);
// $next_row++;
// array_push ($table->data, $data);
$table->colspan[$next_row][0] = 3;
$next_row++;
$data = array();
$data[0] = html_print_table($tableslice, true);
array_push ($table->data, $data);
}
if (!empty($table_planned_downtimes)) {
$data = array();
$data[0] = html_print_table($table_planned_downtimes, true);
@ -4532,7 +4503,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
$table_event_graph->data[0][0] = pie3d_graph(
false, $data_graph, 500, 150, __("other"), "",
$config['homedir'] . "/images/logo_vertical_water.png",
ui_get_full_url(false, false, false, false) . "/images/logo_vertical_water.png",
$config['fontpath'], $config['font_size']);
$data[0] = html_print_table($table_event_graph, true);
@ -4560,7 +4531,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
$table_event_graph->data[0][0] = pie3d_graph(
false, $data_graph, 500, 150, __("other"), "",
$config['homedir'] . "/images/logo_vertical_water.png",
ui_get_full_url(false, false, false, false) . "/images/logo_vertical_water.png",
$config['fontpath'], $config['font_size'], 1, false, $colors);
$data[0] = html_print_table($table_event_graph, true);
@ -4586,7 +4557,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
$table_event_graph->data[0][0] = pie3d_graph(
false, $data_graph, 500, 150, __("other"), "",
$config['homedir'] . "/images/logo_vertical_water.png",
ui_get_full_url(false, false, false, false) . "/images/logo_vertical_water.png",
$config['fontpath'], $config['font_size']);
$data[0] = html_print_table($table_event_graph, true);
@ -4735,7 +4706,13 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
$data = array ();
$data[0] = graph_custom_sql_graph($content["id_rc"], $sizgraph_w, $sizgraph_h, $content["type"], true, ui_get_full_url(false) . '/');
$data[0] = graph_custom_sql_graph(
$content["id_rc"],
$sizgraph_w,
$sizgraph_h,
$content["type"],
true,
ui_get_full_url(false, false, false, false));
array_push($table->data, $data);
break;
@ -4801,7 +4778,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
$table_event_graph->data[0][0] = pie3d_graph(
false, $data_graph, 500, 150, __("other"), "",
$config['homedir'] . "/images/logo_vertical_water.png",
ui_get_full_url(false, false, false, false) . "/images/logo_vertical_water.png",
$config['fontpath'], $config['font_size']);
$data[0] = html_print_table($table_event_graph, true);
@ -4827,7 +4804,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
$table_event_graph->data[0][0] = pie3d_graph(
false, $data_graph, 500, 150, __("other"), "",
$config['homedir'] . "/images/logo_vertical_water.png",
ui_get_full_url(false, false, false, false) . "/images/logo_vertical_water.png",
$config['fontpath'], $config['font_size']);
$data[0] = html_print_table($table_event_graph, true);
@ -4845,9 +4822,9 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
$filter_event_critical,
$filter_event_warning,
$filter_event_no_validated);
$colors = get_criticity_pie_colors($data_graph);
$table_event_graph = null;
$table_event_graph->head[0] = __('Events by criticity');
$table_event_graph->width = '100%';
@ -4855,7 +4832,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
$table_event_graph->data[0][0] = pie3d_graph(
false, $data_graph, 500, 150, __("other"), "",
$config['homedir'] . "/images/logo_vertical_water.png",
ui_get_full_url(false, false, false, false) . "/images/logo_vertical_water.png",
$config['fontpath'], $config['font_size'], 1, false, $colors);
$data[0] = html_print_table($table_event_graph, true);
@ -4881,7 +4858,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
$table_event_graph->data[0][0] = pie3d_graph(
false, $data_graph, 500, 150, __("other"), "",
$config['homedir'] . "/images/logo_vertical_water.png",
ui_get_full_url(false, false, false, false) . "/images/logo_vertical_water.png",
$config['fontpath'], $config['font_size']);
$data[0] = html_print_table($table_event_graph, true);
@ -6107,7 +6084,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
$data[0] = pie3d_graph(false, $data_pie_graph,
$sizgraph_w, $sizgraph_h, __("other"),
ui_get_full_url(false, true, false, false) . '/', $config['homedir'] . "/images/logo_vertical_water.png",
ui_get_full_url(false, true, false, false) . '/',
ui_get_full_url(false, false, false, false) . "/images/logo_vertical_water.png",
$config['fontpath'], $config['font_size']);
@ -6502,7 +6480,9 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
$data = array();
if ($show_graph == 1 || $show_graph == 2) {
$data[0] = pie3d_graph(false, $data_pie_graph,
600, 150, __("other"), ui_get_full_url(false) . '/', $config['homedir'] . "/images/logo_vertical_water.png",
600, 150, __("other"),
ui_get_full_url(false, false, false, false),
ui_get_full_url(false, false, false, false) . "/images/logo_vertical_water.png",
$config['fontpath'], $config['font_size']);
array_push ($table->data, $data);
//Display bars graph
@ -6511,7 +6491,10 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
$height = count($data_pie_graph) * 20 + 85;
$data = array();
$data[0] = hbar_graph(false, $data_hbar, 600, $height, array(), array(), "", "", true, ui_get_full_url(false) . '/', $config['homedir'] . "/images/logo_vertical_water.png", '', '', true, 1, true);
$data[0] = hbar_graph(false, $data_hbar, 600, $height,
array(), array(), "", "", true,
ui_get_full_url(false, false, false, false),
ui_get_full_url(false, false, false, false) . "/images/logo_vertical_water.png", '', '', true, 1, true);
array_push ($table->data, $data);
}

View File

@ -736,7 +736,7 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
var stack = 0, bars = true, lines = false, steps = false;
var plot = $.plot($('#'+graph_id), datas, options);
var plot = $.plot($('#' + graph_id), datas, options);
// Adjust the overview plot to the width and position of the main plot
adjust_left_width_canvas(graph_id, 'overview_'+graph_id);
@ -789,7 +789,7 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
}));
$('#menu_cancelzoom_' + graph_id)
.attr('src',homeurl + '/images/zoom_cross.png');
.attr('src', homeurl + '/images/zoom_cross.png');
currentRanges = ranges;
// don't fire event on the overview to prevent eternal loop
@ -896,7 +896,7 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
}
// Events
$('#'+graph_id).bind('plothover', function (event, pos, item) {
$('#' + graph_id).bind('plothover', function (event, pos, item) {
overview.setCrosshair({ x: pos.x, y: 0 });
currentPlot = plot;
latestPosition = pos;
@ -906,7 +906,7 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend,
});
$('#'+graph_id).bind("plotclick", function (event, pos, item) {
$('#' + graph_id).bind("plotclick", function (event, pos, item) {
plot.unhighlight();
if (item && item.series.label != '' && (item.series.label == legend_events || item.series.label == legend_events+series_suffix_str || item.series.label == legend_alerts || item.series.label == legend_alerts+series_suffix_str)) {
plot.unhighlight();

View File

@ -292,7 +292,13 @@ function flot_area_graph($chart_data, $width, $height, $color, $legend,
}
$menu_width = 25 * $nbuttons + 15;
$return .= "<div id='menu_$graph_id' class='menu_graph' style='display:none; text-align:center; width:".$menu_width."px; border: solid 1px #666; border-bottom: 0px; padding: 4px 4px 4px 4px'>
$return .= "<div id='menu_$graph_id' class='menu_graph' " .
"style='display: none; " .
"text-align: center; " .
"width: " . $menu_width . "px; ".
"border: solid 1px #666; ".
"border-bottom: 0px; " .
"padding: 4px 4px 4px 4px'>
<a href='javascript:'><img id='menu_cancelzoom_$graph_id' src='".$homeurl."images/zoom_cross.disabled.png' alt='".__('Cancel zoom')."' title='".__('Cancel zoom')."'></a>";
if ($threshold) {
$return .= "<a href='javascript:'><img id='menu_threshold_$graph_id' src='".$homeurl."images/chart_curve_threshold.png' alt='".__('Warning and Critical thresholds')."' title='".__('Warning and Critical thresholds')."'></a>";
@ -382,7 +388,7 @@ function flot_area_graph($chart_data, $width, $height, $color, $legend,
"$watermark, " .
"$width, " .
"$max_x, " .
"'" . $config['homeurl'] . "', " .
"'" . $homeurl . "', " .
"'$unit', " .
"$font_size, " .
"$menu, " .