,
# If using the usebuggroups parameter, users shouldn't be able to see
# reports for products they don't have access to.
@@ -42,33 +39,20 @@ use strict;
use lib qw(.);
-eval "use GD";
-my $use_gd = $@ ? 0 : 1;
-eval "use Chart::Lines";
-$use_gd = 0 if $@;
-
require "CGI.pl";
use vars qw(%FORM); # globals from CGI.pl
require "globals.pl";
use vars qw(@legal_product); # globals from er, globals.pl
+eval "use GD";
+$@ && ThrowCodeError("gd_not_installed");
+eval "use Chart::Lines";
+$@ && ThrowCodeError("chart_lines_not_installed");
+
my $dir = "data/mining";
my $graph_dir = "graphs";
-my @status = qw (NEW ASSIGNED REOPENED);
-my %bugsperperson;
-
-# while this looks odd/redundant, it allows us to name
-# functions differently than the value passed in
-my %reports =
- (
- "most_doomed" => \&most_doomed,
- "most_doomed_for_milestone" => \&most_doomed_for_milestone,
- "most_recently_doomed" => \&most_recently_doomed,
- "show_chart" => \&show_chart,
- );
-
# If we're using bug groups for products, we should apply those restrictions
# to viewing reports, as well. Time to check the login in that case.
ConnectToDatabase(1);
@@ -95,8 +79,8 @@ if(Param("usebuggroups")) {
if (! defined $FORM{'product'}) {
print "Content-type: text/html\n\n";
- PutHeader("Bug Reports");
- &choose_product;
+ PutHeader("Bug Charts");
+ choose_product(@myproducts);
PutFooter();
} else {
@@ -114,13 +98,6 @@ if (! defined $FORM{'product'}) {
&& !UserInGroup($FORM{'product'})
&& ThrowUserError("report_access_denied");
- # For security and correctness, validate the value of the "output" form variable.
- # Valid values are the keys from the %reports hash defined above which appear in
- # the "output" drop-down menu on the report generation form.
- $FORM{'output'} ||= "most_doomed"; # a reasonable default
- grep($_ eq $FORM{'output'}, keys %reports)
- || ThrowCodeError("invalid_output_type", {type => $FORM{'output'}});
-
# We've checked that the product exists, and that the user can see it
# This means that is OK to detaint
trick_taint($FORM{'product'});
@@ -130,22 +107,11 @@ if (! defined $FORM{'product'}) {
# Changing attachment to inline to resolve 46897 - zach@zachlipton.com
print "Content-disposition: inline; filename=bugzilla_report.html\n\n";
- if ($FORM{'banner'}) {
- PutHeader("Bug Reports");
- }
- else {
- print("Bug Reports");
- }
-
- # Execute the appropriate report generation function
- # (the one whose name is the same as the value of the "output" form variable).
- &{$reports{$FORM{'output'}}};
+ PutHeader("Bug Charts");
- # ??? why is this necessary? formatting looks fine without it
- print "";
-
- PutFooter() if $FORM{banner};
+ show_chart();
+ PutFooter();
}
@@ -154,51 +120,40 @@ if (! defined $FORM{'product'}) {
##################################
sub choose_product {
- my $product_popup = make_options (\@myproducts, $myproducts[0]);
-
+ my @myproducts = (@_);
+
my $datafile = daily_stats_filename('-All-');
# Can we do bug charts?
- my $do_charts = ($use_gd && -d $dir && -d $graph_dir &&
- open(DATA, "$dir/$datafile"));
-
- my $charts = $do_charts ? "