2014-05-27 Miguel de Dios <miguel.dedios@artica.es>
* godmode/reporting/graph_builder.main.php, include/functions_graph.php, include/functions_visual_map.php, include/functions_custom_graphs.php, include/constants.php, operation/reporting/graph_viewer.php: killing unicorns and magic numbers for the kind of custom graphs. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10021 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
3c1a2b7846
commit
c5ec3ebb55
|
@ -1,3 +1,11 @@
|
|||
2014-05-27 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* godmode/reporting/graph_builder.main.php,
|
||||
include/functions_graph.php, include/functions_visual_map.php,
|
||||
include/functions_custom_graphs.php, include/constants.php,
|
||||
operation/reporting/graph_viewer.php: killing unicorns and magic
|
||||
numbers for the kind of custom graphs.
|
||||
|
||||
2014-05-27 Sergio Martin <sergio.martin@artica.es>
|
||||
|
||||
* godmode/agentes/agent_wizard.snmp_explorer.php: Fix wrong
|
||||
|
|
|
@ -140,10 +140,10 @@ echo "<td class='datos2'>";
|
|||
include_once($config["homedir"] . "/include/functions_graph.php");
|
||||
|
||||
$stackeds = array(
|
||||
GRAPH_AREA => __('Area'),
|
||||
GRAPH_STACKED_AREA => __('Stacked area'),
|
||||
GRAPH_LINE => __('Line'),
|
||||
GRAPH_STACKED_LINE => __('Stacked line'));
|
||||
CUSTOM_GRAPH_AREA => __('Area'),
|
||||
CUSTOM_GRAPH_STACKED_AREA => __('Stacked area'),
|
||||
CUSTOM_GRAPH_LINE => __('Line'),
|
||||
CUSTOM_GRAPH_STACKED_LINE => __('Stacked line'));
|
||||
html_print_select ($stackeds, 'stacked', $stacked);
|
||||
echo "</td>";
|
||||
|
||||
|
|
|
@ -366,4 +366,10 @@ define("EVENTS_GOING_DOWN_NORMAL", 'going_down_normal');
|
|||
define("EVENTS_GOING_DOWN_CRITICAL", 'going_down_critical');
|
||||
define("EVENTS_GOING_UP_NORMAL", 'going_up_normal');
|
||||
define("EVENTS_CONFIGURATION_CHANGE", 'configuration_change');
|
||||
|
||||
/* CUSTOM GRAPHS */
|
||||
define("CUSTOM_GRAPH_AREA", 0);
|
||||
define("CUSTOM_GRAPH_STACKED_AREA", 1);
|
||||
define("CUSTOM_GRAPH_LINE", 2);
|
||||
define("CUSTOM_GRAPH_STACKED_LINE", 3);
|
||||
?>
|
||||
|
|
|
@ -93,9 +93,15 @@ function custom_graphs_get_user ($id_user = 0, $only_names = false, $returnAllGr
|
|||
*/
|
||||
|
||||
function custom_graphs_print($id_graph, $height, $width, $period,
|
||||
$stacked, $return = false, $date = 0, $only_image = false) {
|
||||
$stacked = null, $return = false, $date = 0, $only_image = false) {
|
||||
global $config;
|
||||
|
||||
$graph_conf = db_get_row('tgraph', 'id_graph', $id_graph);
|
||||
|
||||
if ($stacked === null) {
|
||||
$stacked = $graph_conf['stacked'];
|
||||
}
|
||||
|
||||
$sources = db_get_all_rows_field_filter('tgraph_source', 'id_graph',
|
||||
$id_graph);
|
||||
$modules = array ();
|
||||
|
|
|
@ -20,11 +20,6 @@ include_once($config['homedir'] . "/include/functions_agents.php");
|
|||
include_once($config['homedir'] . "/include/functions_modules.php");
|
||||
include_once($config['homedir'] . "/include/functions_users.php");
|
||||
|
||||
define("GRAPH_AREA", 0);
|
||||
define("GRAPH_STACKED_AREA", 1);
|
||||
define("GRAPH_LINE", 2);
|
||||
define("GRAPH_STACKED_LINE", 3);
|
||||
|
||||
function get_graph_statistics ($chart_array) {
|
||||
|
||||
/// IMPORTANT!
|
||||
|
@ -1292,7 +1287,7 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||
'color' => COL_GRAPH13, 'alpha' => 50);
|
||||
|
||||
switch ($stacked) {
|
||||
case GRAPH_AREA:
|
||||
case CUSTOM_GRAPH_AREA:
|
||||
return area_graph($flash_charts, $graph_values, $width,
|
||||
$height, $color, $module_name_list, $long_index,
|
||||
ui_get_full_url("images/image_problem.opaque.png"), "",
|
||||
|
@ -1300,21 +1295,21 @@ function graphic_combined_module ($module_list, $weight_list, $period,
|
|||
$fixed_font_size, "", $ttl);
|
||||
break;
|
||||
default:
|
||||
case GRAPH_STACKED_AREA:
|
||||
case CUSTOM_GRAPH_STACKED_AREA:
|
||||
return stacked_area_graph($flash_charts, $graph_values,
|
||||
$width, $height, $color, $module_name_list, $long_index,
|
||||
ui_get_full_url("images/image_problem.opaque.png"), "",
|
||||
"", $water_mark, $config['fontpath'], $fixed_font_size,
|
||||
"", $ttl, $homeurl);
|
||||
break;
|
||||
case GRAPH_LINE:
|
||||
case CUSTOM_GRAPH_LINE:
|
||||
return line_graph($flash_charts, $graph_values, $width,
|
||||
$height, $color, $module_name_list, $long_index,
|
||||
ui_get_full_url("images/image_problem.opaque.png"), "",
|
||||
"", $water_mark, $config['fontpath'], $fixed_font_size,
|
||||
"", $ttl, $homeurl);
|
||||
break;
|
||||
case GRAPH_STACKED_LINE:
|
||||
case CUSTOM_GRAPH_STACKED_LINE:
|
||||
return stacked_line_graph($flash_charts, $graph_values,
|
||||
$width, $height, $color, $module_name_list, $long_index,
|
||||
ui_get_full_url("images/image_problem.opaque.png"), "",
|
||||
|
|
|
@ -219,7 +219,7 @@ function visual_map_print_item($layoutData) {
|
|||
if ($layoutData['id_custom_graph'] != 0) {
|
||||
$img = custom_graphs_print(
|
||||
$layoutData['id_custom_graph'], $height, $width,
|
||||
$period, true, true, 0, true);
|
||||
$period, null, true, 0, true);
|
||||
}
|
||||
else {
|
||||
$img = grafico_modulo_sparse($id_module, $period, 0, $width,
|
||||
|
@ -1985,7 +1985,7 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
|
|||
$layout_data['id_custom_graph'],
|
||||
$layout_data['height'],
|
||||
$layout_data['width'],
|
||||
$layout_data['period'], true, false, 0, true);
|
||||
$layout_data['period'], null, false, 0, true);
|
||||
}
|
||||
else {
|
||||
|
||||
|
|
|
@ -151,33 +151,37 @@ if ($view_graph) {
|
|||
echo "<form method='POST' action='index.php?sec=reporting&sec2=operation/reporting/graph_viewer&view_graph=1&id=$id_graph'>";
|
||||
echo "<table class='databox_frame' cellpadding='4' cellspacing='4' style='width: 98%'>";
|
||||
echo "<tr>";
|
||||
|
||||
echo "<td>";
|
||||
echo "<b>" . __('Date') . "</b>" . " ";
|
||||
echo "</td>";
|
||||
|
||||
echo "<td>";
|
||||
echo html_print_input_text ('date', $date, '', 12, 10, true). ' ';
|
||||
echo "</td>";
|
||||
|
||||
echo "<td>";
|
||||
echo html_print_input_text ('time', $time, '', 7, 7, true). ' ';
|
||||
echo "</td>";
|
||||
|
||||
echo "<td class='datos'>";
|
||||
echo "<b>" . __('Time range') . "</b>";
|
||||
echo "</td>";
|
||||
|
||||
echo "<td class='datos'>";
|
||||
|
||||
echo html_print_extended_select_for_time ('period', $period, '', '', '0', 10, true);
|
||||
|
||||
echo "</td>";
|
||||
|
||||
echo "<td class='datos'>";
|
||||
$stackeds = array ();
|
||||
$stackeds[0] = __('Graph defined');
|
||||
$stackeds[0] = __('Area');
|
||||
$stackeds[1] = __('Stacked area');
|
||||
$stackeds[2] = __('Line');
|
||||
$stackeds[3] = __('Stacked line');
|
||||
$stackeds[CUSTOM_GRAPH_AREA] = __('Area');
|
||||
$stackeds[CUSTOM_GRAPH_STACKED_AREA] = __('Stacked area');
|
||||
$stackeds[CUSTOM_GRAPH_LINE] = __('Line');
|
||||
$stackeds[CUSTOM_GRAPH_STACKED_LINE] = __('Stacked line');
|
||||
html_print_select ($stackeds, 'stacked', $stacked , '', '', -1, false, false);
|
||||
|
||||
echo "</td>";
|
||||
|
||||
echo "<td class='datos'>";
|
||||
$zooms = array();
|
||||
$zooms[0] = __('Graph defined');
|
||||
|
@ -185,11 +189,12 @@ if ($view_graph) {
|
|||
$zooms[2] = __('Zoom x2');
|
||||
$zooms[3] = __('Zoom x3');
|
||||
html_print_select ($zooms, 'zoom', $zoom , '', '', 0);
|
||||
echo "</td>";
|
||||
|
||||
echo "</td>";
|
||||
echo "<td class='datos'>";
|
||||
echo "<input type=submit value='" . __('Update') . "' class='sub upd'>";
|
||||
echo "<input type=submit value='" . __('Refresh') . "' class='sub upd'>";
|
||||
echo "</td>";
|
||||
|
||||
echo "</tr>";
|
||||
echo "</table>";
|
||||
echo "</form>";
|
||||
|
|
Loading…
Reference in New Issue