From 292fe5901b79d3dee84085074a8478cd62291dbf Mon Sep 17 00:00:00 2001 From: pblasquez Date: Thu, 21 Apr 2016 22:20:53 -0700 Subject: [PATCH 1/4] Make minimum height configurable --- html/pages/graphs.inc.php | 4 ++-- includes/defaults.inc.php | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/html/pages/graphs.inc.php b/html/pages/graphs.inc.php index dcef1cb0cb..c802bc011a 100644 --- a/html/pages/graphs.inc.php +++ b/html/pages/graphs.inc.php @@ -108,7 +108,7 @@ else { echo(''); $graph_array = $vars; - $graph_array['height'] = "300"; + $graph_array['height'] = $config['min_graph_height']; $graph_array['width'] = $graph_width; if($_SESSION['screen_width']) { @@ -125,7 +125,7 @@ else { $graph_array['height'] = ($_SESSION['screen_height'] - ($_SESSION['screen_height']/2)); } else { - $graph_array['height'] = ($_SESSION['screen_height'] - ($_SESSION['screen_height']/1.5)); + $graph_array['height'] = max($graph_array['height'],($_SESSION['screen_height'] - ($_SESSION['screen_height']/1.5))); } } diff --git a/includes/defaults.inc.php b/includes/defaults.inc.php index c99bfd6f63..5908ae9a23 100644 --- a/includes/defaults.inc.php +++ b/includes/defaults.inc.php @@ -124,6 +124,7 @@ $config['top_ports'] = 1; // This enables the top X ports box $config['top_devices'] = 1; // This enables the top X devices box +$config['min_graph_height'] = 300; $config['page_title_prefix'] = ''; $config['page_title_suffix'] = $config['project_name']; $config['timestamp_format'] = 'd-m-Y H:i:s'; From 8d4c65b8e82ed1b40647ead797fe9ccc4929ee3e Mon Sep 17 00:00:00 2001 From: pblasquez Date: Tue, 26 Apr 2016 12:43:49 -0700 Subject: [PATCH 2/4] Revert "Make minimum height configurable" This reverts commit 292fe5901b79d3dee84085074a8478cd62291dbf. --- html/pages/graphs.inc.php | 4 ++-- includes/defaults.inc.php | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/html/pages/graphs.inc.php b/html/pages/graphs.inc.php index c802bc011a..dcef1cb0cb 100644 --- a/html/pages/graphs.inc.php +++ b/html/pages/graphs.inc.php @@ -108,7 +108,7 @@ else { echo(''); $graph_array = $vars; - $graph_array['height'] = $config['min_graph_height']; + $graph_array['height'] = "300"; $graph_array['width'] = $graph_width; if($_SESSION['screen_width']) { @@ -125,7 +125,7 @@ else { $graph_array['height'] = ($_SESSION['screen_height'] - ($_SESSION['screen_height']/2)); } else { - $graph_array['height'] = max($graph_array['height'],($_SESSION['screen_height'] - ($_SESSION['screen_height']/1.5))); + $graph_array['height'] = ($_SESSION['screen_height'] - ($_SESSION['screen_height']/1.5)); } } diff --git a/includes/defaults.inc.php b/includes/defaults.inc.php index 5908ae9a23..c99bfd6f63 100644 --- a/includes/defaults.inc.php +++ b/includes/defaults.inc.php @@ -124,7 +124,6 @@ $config['top_ports'] = 1; // This enables the top X ports box $config['top_devices'] = 1; // This enables the top X devices box -$config['min_graph_height'] = 300; $config['page_title_prefix'] = ''; $config['page_title_suffix'] = $config['project_name']; $config['timestamp_format'] = 'd-m-Y H:i:s'; From 8e8315dbcddde1aaaf7e41c3076f34421db9ed47 Mon Sep 17 00:00:00 2001 From: pblasquez Date: Tue, 26 Apr 2016 12:56:58 -0700 Subject: [PATCH 3/4] Move config to WebUI --- html/pages/graphs.inc.php | 2 +- html/pages/settings/webui.inc.php | 8 ++++++++ sql-schema/114.sql | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 sql-schema/114.sql diff --git a/html/pages/graphs.inc.php b/html/pages/graphs.inc.php index dcef1cb0cb..48cf6a31e9 100644 --- a/html/pages/graphs.inc.php +++ b/html/pages/graphs.inc.php @@ -108,7 +108,7 @@ else { echo(''); $graph_array = $vars; - $graph_array['height'] = "300"; + $graph_array['height'] = $config['webui']['min_graph_height']; $graph_array['width'] = $graph_width; if($_SESSION['screen_width']) { diff --git a/html/pages/settings/webui.inc.php b/html/pages/settings/webui.inc.php index a5b6bf7f24..2878df2540 100644 --- a/html/pages/settings/webui.inc.php +++ b/html/pages/settings/webui.inc.php @@ -11,11 +11,19 @@ $search_conf = array( ), ); +$graph_conf = array( + array('name' => 'webui.min_graph_height', + 'descr' => 'Set the minimum graph height', + 'type' => 'text', + ), +); + echo '
'; +echo generate_dynamic_config_panel('Graph settings',true,$config_groups,$graph_conf); echo generate_dynamic_config_panel('Search settings',true,$config_groups,$search_conf); echo ' diff --git a/sql-schema/114.sql b/sql-schema/114.sql new file mode 100644 index 0000000000..7b245ccc6e --- /dev/null +++ b/sql-schema/114.sql @@ -0,0 +1 @@ +INSERT INTO `config` (`config_name`,`config_value`,`config_default`,`config_descr`,`config_group`,`config_group_order`,`config_sub_group`,`config_sub_group_order`,`config_hidden`,`config_disabled`) VALUES ('webui.min_graph_height','300','300','Minimum Graph Height','webui',0,'graph',0,'1','0'); \ No newline at end of file From 2c57979011e0d800430e119edb3ae6bb39c4fe11 Mon Sep 17 00:00:00 2001 From: pblasquez Date: Tue, 26 Apr 2016 16:07:20 -0700 Subject: [PATCH 4/4] forgot to add back max() --- html/pages/graphs.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/html/pages/graphs.inc.php b/html/pages/graphs.inc.php index 48cf6a31e9..2e6e33b29f 100644 --- a/html/pages/graphs.inc.php +++ b/html/pages/graphs.inc.php @@ -125,7 +125,7 @@ else { $graph_array['height'] = ($_SESSION['screen_height'] - ($_SESSION['screen_height']/2)); } else { - $graph_array['height'] = ($_SESSION['screen_height'] - ($_SESSION['screen_height']/1.5)); + $graph_array['height'] = max($graph_array['height'],($_SESSION['screen_height'] - ($_SESSION['screen_height']/1.5))); } }