aboutsummaryrefslogtreecommitdiffstats
path: root/report.cgi
diff options
context:
space:
mode:
authorFrédéric Buclin <LpSolit@gmail.com>2012-08-12 12:11:10 +0200
committerFrédéric Buclin <LpSolit@gmail.com>2012-08-12 12:11:10 +0200
commit8a17e45f7e56967069dc33440f90ffc4ab9a5131 (patch)
tree465a76f23e274ba317243dec4e7330d24e2d0e59 /report.cgi
parenta05220de2e69d4b6ef212d1f3556fa848b6e1508 (diff)
downloadbugs-8a17e45f7e56967069dc33440f90ffc4ab9a5131.tar
bugs-8a17e45f7e56967069dc33440f90ffc4ab9a5131.tar.gz
bugs-8a17e45f7e56967069dc33440f90ffc4ab9a5131.tar.bz2
bugs-8a17e45f7e56967069dc33440f90ffc4ab9a5131.tar.xz
bugs-8a17e45f7e56967069dc33440f90ffc4ab9a5131.zip
Bug 746947: Determine the size of the images dynamically for graphical reports
r=dkl a=LpSolit
Diffstat (limited to 'report.cgi')
-rwxr-xr-xreport.cgi29
1 files changed, 13 insertions, 16 deletions
diff --git a/report.cgi b/report.cgi
index 5778841b3..0241f42b5 100755
--- a/report.cgi
+++ b/report.cgi
@@ -103,20 +103,18 @@ if (!($col_field || $row_field || $tbl_field)) {
ThrowUserError("no_axes_defined");
}
-my $width = $cgi->param('width');
-my $height = $cgi->param('height');
+# There is no UI for these parameters anymore,
+# but they are still here just in case.
+my $width = $cgi->param('width') || 1024;
+my $height = $cgi->param('height') || 600;
-if (defined($width)) {
- (detaint_natural($width) && $width > 0)
- || ThrowCodeError("invalid_dimensions");
- $width <= 2000 || ThrowUserError("chart_too_large");
-}
+(detaint_natural($width) && $width > 0)
+ || ThrowCodeError("invalid_dimensions");
+$width <= 2000 || ThrowUserError("chart_too_large");
-if (defined($height)) {
- (detaint_natural($height) && $height > 0)
- || ThrowCodeError("invalid_dimensions");
- $height <= 2000 || ThrowUserError("chart_too_large");
-}
+(detaint_natural($height) && $height > 0)
+ || ThrowCodeError("invalid_dimensions");
+$height <= 2000 || ThrowUserError("chart_too_large");
# These shenanigans are necessary to make sure that both vertical and
# horizontal 1D tables convert to the correct dimension when you ask to
@@ -244,7 +242,7 @@ $vars->{'row_names'} = \@row_names;
$vars->{'tbl_names'} = \@tbl_names;
# Below a certain width, we don't see any bars, so there needs to be a minimum.
-if ($width && $cgi->param('format') eq "bar") {
+if ($cgi->param('format') eq "bar") {
my $min_width = (scalar(@col_names) || 1) * 20;
if (!$cgi->param('cumulate')) {
@@ -254,9 +252,8 @@ if ($width && $cgi->param('format') eq "bar") {
$vars->{'min_width'} = $min_width;
}
-$vars->{'width'} = $width if $width;
-$vars->{'height'} = $height if $height;
-
+$vars->{'width'} = $width;
+$vars->{'height'} = $height;
$vars->{'query'} = $query;
$vars->{'saved_report_id'} = $cgi->param('saved_report_id');
$vars->{'debug'} = $cgi->param('debug');