Commit 2ce88631 authored by harrison%netscape.com's avatar harrison%netscape.com

security check for legal products in place. bug charts are not

available as an option if collectstats.pl has never been run. added quip support.
parent 7ecfeb86
...@@ -64,10 +64,7 @@ else ...@@ -64,10 +64,7 @@ else
} }
ConnectToDatabase(); ConnectToDatabase();
GetVersionTable();
# $::FORM{'product'} = "Mozilla";
# &show_chart();
# exit;
if (! defined $::FORM{'product'}) if (! defined $::FORM{'product'})
{ {
...@@ -112,9 +109,8 @@ FIN ...@@ -112,9 +109,8 @@ FIN
sub choose_product sub choose_product
{ {
GetVersionTable();
my $product_popup = make_options (\@::legal_product, $::legal_product[0]); my $product_popup = make_options (\@::legal_product, $::legal_product[0]);
my $charts = (-d $dir) ? "<option value=\"show_chart\">Bug Charts" : "";
print <<FIN; print <<FIN;
<center> <center>
...@@ -134,13 +130,14 @@ $product_popup ...@@ -134,13 +130,14 @@ $product_popup
<td align=center> <td align=center>
<select name="output"> <select name="output">
<option value="most_doomed">Bug Counts <option value="most_doomed">Bug Counts
<option value="show_chart">Bug Charts $charts
</select> </select>
<tr> <tr>
<td align=center><b>Switches:</b></td> <td align=center><b>Switches:</b></td>
<td align=left> <td align=left>
<input type=checkbox name=links value=1>&nbsp;Links to Bugs<br> <input type=checkbox name=links value=1>&nbsp;Links to Bugs<br>
<input type=checkbox name=nobanner value=1>&nbsp;No Banner<br> <input type=checkbox name=nobanner value=1>&nbsp;No Banner<br>
<input type=checkbox name=quip value=1>&nbsp;Include Quip<br>
</td> </td>
</tr> </tr>
<tr> <tr>
...@@ -196,6 +193,7 @@ FIN ...@@ -196,6 +193,7 @@ FIN
my $c = 0; my $c = 0;
my $quip = "Summary";
my $bugs_count = 0; my $bugs_count = 0;
my $bugs_new_this_week = 0; my $bugs_new_this_week = 0;
my $bugs_reopened = 0; my $bugs_reopened = 0;
...@@ -224,12 +222,26 @@ FIN ...@@ -224,12 +222,26 @@ FIN
$bugs_totals{$who}{$st} ++; $bugs_totals{$who}{$st} ++;
} }
if ($::FORM{'quip'})
{
if (open (COMMENTS, "<data/comments"))
{
my @cdata;
while (<COMMENTS>)
{
push @cdata, $_;
}
close COMMENTS;
$quip = "<i>" . $cdata[int(rand($#cdata + 1))] . "</i>";
}
}
######################### #########################
# start painting report # # start painting report #
######################### #########################
print <<FIN; print <<FIN;
<h1>Summary</h1> <h1>$quip</h1>
<table border=1 cellpadding=5> <table border=1 cellpadding=5>
<tr> <tr>
<td align=right><b>New Bugs This Week</b></td> <td align=right><b>New Bugs This Week</b></td>
...@@ -363,6 +375,12 @@ FIN ...@@ -363,6 +375,12 @@ FIN
FIN FIN
} }
sub is_legal_product
{
my $product = shift;
return grep { $_ eq $product} @::legal_product;
}
sub header sub header
{ {
print <<FIN; print <<FIN;
...@@ -377,6 +395,11 @@ sub show_chart ...@@ -377,6 +395,11 @@ sub show_chart
{ {
my $when = localtime (time); my $when = localtime (time);
if (! is_legal_product ($::FORM{'product'}))
{
&die_politely ("Unknown product: $::FORM{'product'}");
}
print <<FIN; print <<FIN;
<center> <center>
FIN FIN
...@@ -428,7 +451,6 @@ FIN ...@@ -428,7 +451,6 @@ FIN
"title" => "Bug Charts for $::FORM{'product'}", "title" => "Bug Charts for $::FORM{'product'}",
"x_label" => "Dates", "x_label" => "Dates",
"y_label" => "Bug Count", "y_label" => "Bug Count",
"grey_background" => 1,
"legend_labels" => \@labels, "legend_labels" => \@labels,
); );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment