diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 56a93a2865..0b0728b666 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,14 @@ +2014-03-10 Miguel de Dios + + * include/graphs/flot/pandora.flot.js: fixed the position of buttons + in the flot area graphs when the graphs are in other pages than + stat win. + + Incident: #560 + + * operation/agentes/graphs.php, include/graphs/fgraph.php, + include/graphs/functions_flot.php: cleaned source code style. + 2014-03-10 Miguel de Dios * include/javascript/pandora_snmp_browser.js, diff --git a/pandora_console/include/graphs/fgraph.php b/pandora_console/include/graphs/fgraph.php index c2ab74d389..fc39244389 100755 --- a/pandora_console/include/graphs/fgraph.php +++ b/pandora_console/include/graphs/fgraph.php @@ -219,7 +219,24 @@ function area_graph($flash_chart, $chart_data, $width, $height, $color, $legend, } if ($flash_chart) { - return flot_area_simple_graph($chart_data, $width, $height, $color, $legend, $long_index, $homeurl, $unit, $water_mark_url, $series_type, $chart_extra_data, $yellow_threshold, $red_threshold, $adapt_key, $force_integer, $series_suffix_str, $menu); + return flot_area_simple_graph( + $chart_data, + $width, + $height, + $color, + $legend, + $long_index, + $homeurl, + $unit, + $water_mark_url, + $series_type, + $chart_extra_data, + $yellow_threshold, + $red_threshold, + $adapt_key, + $force_integer, + $series_suffix_str, + $menu); } else { $graph = array(); diff --git a/pandora_console/include/graphs/flot/pandora.flot.js b/pandora_console/include/graphs/flot/pandora.flot.js index aa498d6813..119e92974d 100644 --- a/pandora_console/include/graphs/flot/pandora.flot.js +++ b/pandora_console/include/graphs/flot/pandora.flot.js @@ -1012,8 +1012,10 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend, colors, // Adjust the menu image on top of the plot // If there is no legend we increase top-padding to make space to the menu if (legends.length == 0) { - $('#menu_'+graph_id).parent().css('padding-top',$('#menu_'+graph_id).css('height')); + $('#menu_' + graph_id).parent().css('padding-top', + $('#menu_' + graph_id).css('height')); } + // Add bottom margin in the legend // Estimated height of 24 (works fine with this data in all browsers) menu_height = 24; @@ -1049,15 +1051,22 @@ function adjust_menu(graph_id, plot, parent_height) { } var menu_height = '25'; - - if($('#menu_'+graph_id).height() != undefined && $('#menu_'+graph_id).height() > 20) { + + if ($('#menu_'+graph_id).height() != undefined && $('#menu_'+graph_id).height() > 20) { menu_height = $('#menu_'+graph_id).height(); } - $('#menu_'+graph_id).css('top', (($('#'+graph_id).offset().top-menu_height-15)+'px')); - $('#legend_'+graph_id).css('width',plot.width()); - $('#menu_'+graph_id).css('left',plot.width()-$('#menu_'+graph_id).width() + 10); - $('#menu_'+graph_id).show(); + offset_between_graph_and_div_graph_container = $('#' + graph_id).offset().top - + $('#' + graph_id).parent().offset().top; + $('#menu_' + graph_id) + .css('top', + ((offset_between_graph_and_div_graph_container - menu_height - 5) + 'px')); + + $('#legend_' + graph_id).css('width',plot.width()); + + $('#menu_' + graph_id) + .css('left',plot.width() - $('#menu_'+graph_id).width() + 10); + $('#menu_' + graph_id).show(); } function set_watermark(graph_id, plot, watermark_src) { diff --git a/pandora_console/include/graphs/functions_flot.php b/pandora_console/include/graphs/functions_flot.php index 545700813f..9b71e1a827 100644 --- a/pandora_console/include/graphs/functions_flot.php +++ b/pandora_console/include/graphs/functions_flot.php @@ -126,12 +126,12 @@ function flot_area_graph($chart_data, $width, $height, $color, $legend, $long_in $graph_id = uniqid('graph_'); // Parent layer - $return = "
"; + $return = "
"; // Set some containers to legend, graph, timestamp tooltip, etc. $return .= "

"; $return .= ""; $return .= "
"; - if($menu) { + if ($menu) { $height = 100; } else { diff --git a/pandora_console/operation/agentes/graphs.php b/pandora_console/operation/agentes/graphs.php index 611ed7418f..478581c650 100644 --- a/pandora_console/operation/agentes/graphs.php +++ b/pandora_console/operation/agentes/graphs.php @@ -60,13 +60,17 @@ $table->size[1] = '80%'; $table->style[0] = 'font-weight: bolder; text-align: right;'; $table->style[1] = ''; +$table->valign[0] = 'top'; + $table->data[0][0] = __('Modules'); $listModules = array(); foreach ($modules as $id => $module) { $checked = false; if (isset($modulesChecked[$id])) $checked = (bool) $modulesChecked[$id]; - $listModules[] = '' . html_print_checkbox('modules[' . $id . ']', 1, $checked, true) . ' ' . $module . ''; + $listModules[] = '' . + html_print_checkbox('modules[' . $id . ']', 1, $checked, true, false, '', true) . + ' ' . $module . ''; } $table->data[0][1] = implode(' ', $listModules); @@ -112,7 +116,9 @@ else foreach ($modulesChecked as $idModuleShowGraph => $value) { echo "

" . $modules[$idModuleShowGraph] . '

'; + $unit = modules_get_unit ($idModuleShowGraph); + echo grafico_modulo_sparse($idModuleShowGraph, $period, $draw_events, $width, $height, $modules[$idModuleShowGraph], null, $draw_alerts, $avg_only, false, $date, $unit); }