From f8a4628d3a68803631a4fee2bac77a228c7f9623 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Tue, 24 Jun 2014 13:17:14 +0000 Subject: [PATCH] 2014-06-24 Miguel de Dios * godmode/setup/setup_visuals.php, include/functions_networkmap.php, include/functions_config.php: added the visual config value for to set the width of networkmap, and fixed the overlap of networkmap L2. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@10277 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 7 ++++ .../godmode/setup/setup_visuals.php | 36 +++++++++++-------- pandora_console/include/functions_config.php | 36 +++++++++++-------- .../include/functions_networkmap.php | 19 ++++++++-- 4 files changed, 65 insertions(+), 33 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 56fa81d2cb..5434476c89 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,10 @@ +2014-06-24 Miguel de Dios + + * godmode/setup/setup_visuals.php, include/functions_networkmap.php, + include/functions_config.php: added the visual config value for + to set the width of networkmap, and fixed the overlap of networkmap + L2. + 2014-06-24 Ramon Novoa * operation/snmpconsole/snmp_mib_uploader.php: Added additional information. diff --git a/pandora_console/godmode/setup/setup_visuals.php b/pandora_console/godmode/setup/setup_visuals.php index 5df5192ddf..ad0675645e 100644 --- a/pandora_console/godmode/setup/setup_visuals.php +++ b/pandora_console/godmode/setup/setup_visuals.php @@ -185,21 +185,22 @@ $row++; $table->data[$row][0] = __('Font size'); -$font_size_array = array( 1 => 1, - 2 => 2, - 3 => 3, - 4 => 4, - 5 => 5, - 6 => 6, - 7 => 7, - 8 => 8, - 9 => 9, - 10 => 10, - 11 => 11, - 12 => 12, - 13 => 13, - 14 => 14, - 15 => 15); +$font_size_array = array( + 1 => 1, + 2 => 2, + 3 => 3, + 4 => 4, + 5 => 5, + 6 => 6, + 7 => 7, + 8 => 8, + 9 => 9, + 10 => 10, + 11 => 11, + 12 => 12, + 13 => 13, + 14 => 14, + 15 => 15); $table->data[$row][1] = html_print_select($font_size_array, 'font_size', $config["font_size"], '', '', 0, true); @@ -393,6 +394,11 @@ $table->data[$row][1] = html_print_input_text ('graphviz_bin_dir', $config["grap $row++; +$table->data[$row][0] = __('Networkmap max width'); +$table->data[$row][1] = html_print_input_text ('networkmap_max_width', $config["networkmap_max_width"], '', 10, 20, true); + +$row++; + echo '
'; html_print_input_hidden ('update_config', 1); html_print_table ($table); diff --git a/pandora_console/include/functions_config.php b/pandora_console/include/functions_config.php index e206993ab8..c0edee35ab 100644 --- a/pandora_console/include/functions_config.php +++ b/pandora_console/include/functions_config.php @@ -437,7 +437,9 @@ function config_update_config () { $error_update[] = __('Paginate module'); if (!config_update_value ('graphviz_bin_dir', get_parameter('graphviz_bin_dir'))) $error_update[] = __('Custom graphviz directory'); - + if (!config_update_value ('networkmap_max_width', get_parameter('networkmap_max_width'))) + $error_update[] = __('Networkmap max width'); + $interval_values = get_parameter ('interval_values'); // Add new interval value if is provided @@ -473,26 +475,26 @@ function config_update_config () { if (!config_update_value ('interval_values', $interval_values)) $error_update[] = __('Delete interval'); - + // Juanma (06/05/2014) New feature: Custom front page for reports if (!config_update_value ('custom_report_front', get_parameter('custom_report_front'))) $error_update[] = __('Custom report front'); - + if (!config_update_value ('custom_report_front_font', get_parameter('custom_report_front_font'))) $error_update[] = __('Custom report front') . ' - ' . __('Font family'); - + if (!config_update_value ('custom_report_front_logo', get_parameter('custom_report_front_logo'))) $error_update[] = __('Custom report front') . ' - ' . __('Custom logo'); - + if (!config_update_value ('custom_report_front_header', get_parameter('custom_report_front_header'))) $error_update[] = __('Custom report front') . ' - ' . __('Header'); - + if (!config_update_value ('custom_report_front_firstpage', get_parameter('custom_report_front_firstpage'))) $error_update[] = __('Custom report front') . ' - ' . __('First page'); - + if (!config_update_value ('custom_report_front_footer', get_parameter('custom_report_front_footer'))) $error_update[] = __('Custom report front') . ' - ' . __('Footer'); - + break; case 'net': if (!config_update_value ('netflow_path', get_parameter ('netflow_path'))) @@ -1148,28 +1150,32 @@ function config_process_config () { if (!isset($config['custom_report_front_font'])) { config_update_value ('custom_report_front_font', 'FreeSans.ttf'); - } + } if (!isset($config['custom_report_front_logo'])) { config_update_value ('custom_report_front_logo', 'images/pandora_logo_white.jpg'); } - + if (!isset($config['custom_report_front_header'])) { config_update_value ('custom_report_front_header', ''); } - + if (!isset($config['custom_report_front_firstpage'])) { config_update_value ('custom_report_front_firstpage', "<p style="text-align: center;">&nbsp;</p> <p style="text-align: center;">&nbsp;</p> <p style="text-align: center;">&nbsp;</p> <p style="text-align: center;">&nbsp;</p> <p style="text-align: center;">&nbsp;</p> <p style="text-align: center;">&nbsp;</p> <p style="text-align: center;">&nbsp;</p> <p style="text-align: center;"><img src="" . ui_get_full_url(false, false, false, false) . "/images/pandora_report_logo.png" alt="" width="800" /></p> <p style="text-align: center;">&nbsp;</p> <p style="text-align: center;"><span style="font-size: xx-large;">(_REPORT_NAME_)</span></p> <p style="text-align: center;"><span style="font-size: large;">(_DATETIME_)</span></p>"); - } - + } + if (!isset($config['custom_report_front_footer'])) { config_update_value ('custom_report_front_footer', ''); } - + if (!isset($config['autohidden_menu'])) { config_update_value ('autohidden_menu', 0); } - + + if (!isset($config['networkmap_max_width'])) { + config_update_value ('networkmap_max_width', 800); + } + /* Finally, check if any value was overwritten in a form */ config_update_config(); } diff --git a/pandora_console/include/functions_networkmap.php b/pandora_console/include/functions_networkmap.php index b51b2c7baa..62b987ee62 100644 --- a/pandora_console/include/functions_networkmap.php +++ b/pandora_console/include/functions_networkmap.php @@ -237,6 +237,10 @@ function networkmap_generate_dot ($pandora_name, $group = 0, global $config; + if ($l2_network) { + $nooverlap = 1; + } + $parents = array(); $orphans = array(); @@ -1263,10 +1267,19 @@ function networkmap_close_group () { // Opens a graph definition function networkmap_open_graph ($layout, $nooverlap, $pure, $zoom, $ranksep, $font_size) { + global $config; + $overlap = 'compress'; - $size_x = 8; - $size_y = 5.4; - $size = ''; + + if (isset($config['networkmap_max_width'])) { + $size_x = $config['networkmap_max_width'] / 100; + $size_y = $size_x * 0.8; + } + else { + $size_x = 8; + $size_y = 5.4; + $size = ''; + } if ($layout == 'radial') {