diff options
author | harrison%netscape.com <> | 1998-10-19 07:18:25 +0200 |
---|---|---|
committer | harrison%netscape.com <> | 1998-10-19 07:18:25 +0200 |
commit | 2b7812657fe6e4569586b189bf274b65071e5d90 (patch) | |
tree | 315152c4bfe93d60eba467a761c95e1207a8cae5 | |
parent | c37177906c1b5e0dea58092529feb26a25ad48c1 (diff) | |
download | bugzilla-2b7812657fe6e4569586b189bf274b65071e5d90.tar.gz bugzilla-2b7812657fe6e4569586b189bf274b65071e5d90.tar.xz |
created reports.cgi which provide an overview of active bugs
sorted by owner. updated README to reflect my experiences
installing mysql, bugzilla. put links into index.html, query.cgi
to point into reports.cgi. harrison 10/18/98
-rw-r--r-- | CHANGES | 3 | ||||
-rw-r--r-- | README | 17 | ||||
-rw-r--r-- | index.html | 3 | ||||
-rwxr-xr-x | query.cgi | 1 | ||||
-rwxr-xr-x | reports.cgi | 325 |
5 files changed, 339 insertions, 10 deletions
@@ -9,8 +9,7 @@ query the CVS tree. For example, will tell you what has been changed in the last week. - - +10/17/98 modified README installation instructions slightly. 10/7/98 Added a new table called "products". Right now, this is used only to have a description for each product, and that description is @@ -53,17 +53,20 @@ You have a freedom of choice here - Apache, Netscape or any other server on UNIX would do. The only thing - to make configuration easier you'd better run HTTP daemon on the same machine that you run MySQL server on. Make sure that you can access 'bugs' database with user -id you're running the daemon with. +id you're running the daemon with. +globals.pl: $::db = Mysql->Connect("localhost", "bugs", "nobody", "") + +In globals.pl, the database connect call uses a mysql account +name "bugs" (third argument to Mysql->Connect) to access the +bugs database. You may have to hack the code to use "nobody" +or whatever your HTTP server is running as. -2. TWEAKING THE TOOLS - Now you should have all necessary tools to be able to run Bugzilla -and see why the wouldn't work for you right now. +2. TWEAKING THE TOOLS - First of all you have to change "#!/usr/bonsaitools" to wherever -you've installed your binaries in all executable scripts in Bugzilla -directories. + All scripts look in /usr/bonsaitools/bin for perl. Make +the appropriate links or modify the paths in each script. Make sure the directory containing the binaries is writable by the web server. Bugzilla keeps some temporary files here. diff --git a/index.html b/index.html index d1537012a..a8e36662f 100644 --- a/index.html +++ b/index.html @@ -68,7 +68,8 @@ bugzilla. But it all boils down to a choice of: <br> <a href="query.cgi">Go to the query page to start.</a><br> -<a href="enter_bug.cgi">Enter a new bug</a> +<a href="enter_bug.cgi">Enter a new bug</a><br> +<a href="reports.cgi">Bug reports</a> <FORM METHOD=GET ACTION=show_bug.cgi><INPUT TYPE=SUBMIT VALUE="Find"> bug # <INPUT NAME=id SIZE=6></FORM></TD> @@ -264,6 +264,7 @@ if (defined $::COOKIE{"Bugzilla_login"}) { } print "<a href=changepassword.cgi>Change your password.</a><br>\n"; print "<a href=\"enter_bug.cgi\">Create a new bug.</a><br>\n"; +print "<a href=\"enter_bug.cgi\">Bug reports</a><br>\n"; diff --git a/reports.cgi b/reports.cgi new file mode 100755 index 000000000..2d9171dd7 --- /dev/null +++ b/reports.cgi @@ -0,0 +1,325 @@ +#!/usr/bonsaitools/bin/perl -w +# -*- Mode: perl; indent-tabs-mode: nil -*- +# +# The contents of this file are subject to the Mozilla Public License +# Version 1.0 (the "License"); you may not use this file except in +# compliance with the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +# License for the specific language governing rights and limitations +# under the License. +# +# The Original Code is the Bugzilla Bug Tracking System. +# +# The Initial Developer of the Original Code is Netscape Communications +# Corporation. Portions created by Netscape are Copyright (C) 1998 +# Netscape Communications Corporation. All Rights Reserved. +# +# Contributor(s): Harrison Page <harrison@netscape.com>, +# Terry Weissman <terry@mozilla.org> + +use diagnostics; +use strict; + +require "CGI.pl"; +require "globals.pl"; + +use vars @::legal_product; + +my $week = 60 * 60 * 24 * 7; +my @status = qw (NEW ASSIGNED REOPENED); + +ConnectToDatabase(); + +print <<FIN; +Content-type: text/html + +<html> +<head> +<title>Bugzilla Reports</title> +</head> +<body bgcolor="#FFFFFF"> +FIN + +&header unless (defined $::FORM{'nobanner'}); + +if (! defined $::FORM{'product'}) + { + &choose_product; + } +else + { + &most_doomed; + } + +print <<FIN; +<p> +</body> +</html> +FIN + +################################## +# user came in with no form data # +################################## + +sub choose_product + { + GetVersionTable(); + + my $product_popup = make_options (\@::legal_product); + + print <<FIN; +<center> +<h1>Welcome to the Bugzilla Query Kitchen</h1> +<form method=get action=reports.cgi> +<table border=1 cellpadding=5> +<tr> +<td align=center><b>Product:</b></td> +<td align=center> +<select name="product"> +$product_popup +</select> +</td> +</tr> +<tr> +<td align=center><b>Switches:</b></td> +<td align=left> +<input type=checkbox name=links value=1> Links to Bugs<br> +<input type=checkbox name=nobanner value=1> No Banner<br> +</td> +</tr> +<tr> +<td colspan=2 align=center> +<input type=submit value=Continue> +</td> +</tr> +</table> +</form> +<p> +FIN + } + +########################## +# they sent us a project # +########################## + +sub most_doomed + { + my $when = localtime (time); + + print <<FIN; +<center> +<h1> +Bug Report for $::FORM{'product'} +</h1> +$when<p> +FIN + + my $query = <<FIN; +select + bugs.bug_id, bugs.assigned_to, bugs.bug_severity, + bugs.bug_status, bugs.product, + assign.login_name, + report.login_name, + unix_timestamp(date_format(bugs.creation_ts, '%Y-%m-%d %h:%m:%s')) + +from bugs, + profiles assign, + profiles report, + versions projector +where bugs.assigned_to = assign.userid +and bugs.reporter = report.userid +and bugs.product='$::FORM{'product'}' +and + ( + bugs.bug_status = 'NEW' or + bugs.bug_status = 'ASSIGNED' or + bugs.bug_status = 'REOPENED' + ) +FIN + + print "<font color=purple><tt>$query</tt></font><p>\n" + unless (! exists $::FORM{'showsql'}); + + SendSQL ($query); + + my $c = 0; + + my $bugs_count = 0; + my $bugs_new_this_week = 0; + my $bugs_reopened = 0; + my %bugs_owners; + my %bugs_summary; + my %bugs_status; + my %bugs_totals; + my %bugs_lookup; + + ############################# + # suck contents of database # + ############################# + + while (my ($bid, $a, $sev, $st, $prod, $who, $rep, $ts) = FetchSQLData()) + { + next if (exists $bugs_lookup{$bid}); + + $bugs_lookup{$bid} ++; + $bugs_owners{$who} ++; + $bugs_new_this_week ++ if (time - $ts <= $week); + $bugs_status{$st} ++; + $bugs_count ++; + + push @{$bugs_summary{$who}{$st}}, $bid; + + $bugs_totals{$who}{$st} ++; + } + + ######################### + # start painting report # + ######################### + + print <<FIN; +<h1>Summary</h1> +<table border=1 cellpadding=5> +<tr> +<td align=right><b>New Bugs This Week</b></td> +<td align=center>$bugs_new_this_week</td> +</tr> + +<tr> +<td align=right><b>Bugs Marked New</b></td> +<td align=center>$bugs_status{'NEW'}</td> +</tr> + +<tr> +<td align=right><b>Bugs Marked Assigned</b></td> +<td align=center>$bugs_status{'ASSIGNED'}</td> +</tr> + +<tr> +<td align=right><b>Bugs Marked Reopened</b></td> +<td align=center>$bugs_status{'REOPENED'}</td> +</tr> + +<tr> +<td align=right><b>Total Bugs</b></td> +<td align=center>$bugs_count</td> +</tr> + +</table> +<p> +FIN + + if ($bugs_count == 0) + { + print "No bugs found!\n"; + exit; + } + + print <<FIN; +<h1>Bug Count by Engineer</h1> +<table border=3 cellpadding=5> +<tr> +<td align=center bgcolor="#DDDDDD"><b>Owner</b></td> +<td align=center bgcolor="#DDDDDD"><b>New</b></td> +<td align=center bgcolor="#DDDDDD"><b>Assigned</b></td> +<td align=center bgcolor="#DDDDDD"><b>Reopened</b></td> +<td align=center bgcolor="#DDDDDD"><b>Total</b></td> +</tr> +FIN + + foreach my $who (sort keys %bugs_summary) + { + my $bugz = 0; + print <<FIN; +<tr> +<td align=left><tt>$who</tt></td> +FIN + + foreach my $st (@status) + { + $bugs_totals{$who}{$st} += 0; + print <<FIN; +<td align=center>$bugs_totals{$who}{$st} +FIN + $bugz += $#{$bugs_summary{$who}{$st}} + 1; + } + + print <<FIN; +<td align=center>$bugz</td> +</tr> +FIN + } + + print <<FIN; +</table> +<p> +FIN + + ############################### + # individual bugs by engineer # + ############################### + + print <<FIN; +<h1>Individual Bugs by Engineer</h1> +<table border=1 cellpadding=5> +<tr> +<td align=center bgcolor="#DDDDDD"><b>Owner</b></td> +<td align=center bgcolor="#DDDDDD"><b>New</b></td> +<td align=center bgcolor="#DDDDDD"><b>Assigned</b></td> +<td align=center bgcolor="#DDDDDD"><b>Reopened</b></td> +</tr> +FIN + + foreach my $who (sort keys %bugs_summary) + { + print <<FIN; +<tr> +<td align=left><tt>$who</tt></td> +FIN + + foreach my $st (@status) + { + my @l; + + foreach (sort { $a <=> $b } @{$bugs_summary{$who}{$st}}) + { + if ($::FORM{'links'}) + { + push @l, "<a href=\"show_bug.cgi?id=$_\">$_</a>\n"; + } + else + { + push @l, $_; + } + } + + my $bugz = join ' ', @l; + $bugz = " " unless ($bugz); + + print <<FIN +<td align=left>$bugz</td> +FIN + } + + print <<FIN; +</tr> +FIN + } + + print <<FIN; +</table> +<p> +FIN + } + +sub header + { + print <<FIN; +<TABLE BGCOLOR="#000000" WIDTH="100%" BORDER=0 CELLPADDING=0 CELLSPACING=0> +<TR><TD><A HREF="http://www.mozilla.org/"><IMG + SRC="http://www.mozilla.org/images/mozilla-banner.gif" ALT="" + BORDER=0 WIDTH=600 HEIGHT=58></A></TD></TR></TABLE> +FIN + } |