2002-09-25 11:11:45 +04:00
|
|
|
#!/usr/bonsaitools/bin/perl -wT
|
|
|
|
# -*- Mode: perl; indent-tabs-mode: nil -*-
|
|
|
|
#
|
|
|
|
# The contents of this file are subject to the Mozilla Public
|
|
|
|
# License Version 1.1 (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): Gervase Markham <gerv@gerv.net>
|
|
|
|
# <rdean@cambianetworks.com>
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
use lib ".";
|
|
|
|
|
|
|
|
require "CGI.pl";
|
|
|
|
|
2002-10-26 05:57:09 +04:00
|
|
|
use vars qw($cgi $template $vars);
|
2002-09-25 11:11:45 +04:00
|
|
|
|
|
|
|
use Bugzilla::Search;
|
|
|
|
|
|
|
|
ConnectToDatabase();
|
|
|
|
|
|
|
|
GetVersionTable();
|
|
|
|
|
|
|
|
quietly_check_login();
|
|
|
|
|
2002-10-08 10:41:28 +04:00
|
|
|
if ($::FORM{'action'} ne "plot") {
|
|
|
|
print "Content-Type: text/html\n\n";
|
|
|
|
$template->process("reports/menu.html.tmpl", $vars)
|
|
|
|
|| ThrowTemplateError($template->error());
|
|
|
|
exit;
|
|
|
|
}
|
2002-09-25 11:11:45 +04:00
|
|
|
|
|
|
|
$::FORM{'y_axis_field'} || ThrowCodeError("no_y_axis_defined");
|
|
|
|
|
2002-10-08 10:41:28 +04:00
|
|
|
if ($::FORM{'z_axis_field'} && !$::FORM{'x_axis_field'}) {
|
|
|
|
ThrowUserError("z_axis_defined_with_no_x_axis");
|
|
|
|
}
|
|
|
|
|
2002-09-25 11:11:45 +04:00
|
|
|
my $col_field = $::FORM{'x_axis_field'};
|
|
|
|
my $row_field = $::FORM{'y_axis_field'};
|
2002-10-08 10:41:28 +04:00
|
|
|
my $tbl_field = $::FORM{'z_axis_field'};
|
2002-09-25 11:11:45 +04:00
|
|
|
|
|
|
|
my %columns;
|
|
|
|
$columns{'bug_severity'} = "bugs.bug_severity";
|
|
|
|
$columns{'priority'} = "bugs.priority";
|
|
|
|
$columns{'rep_platform'} = "bugs.rep_platform";
|
|
|
|
$columns{'assigned_to'} = "map_assigned_to.login_name";
|
|
|
|
$columns{'reporter'} = "map_reporter.login_name";
|
|
|
|
$columns{'qa_contact'} = "map_qa_contact.login_name";
|
|
|
|
$columns{'bug_status'} = "bugs.bug_status";
|
|
|
|
$columns{'resolution'} = "bugs.resolution";
|
|
|
|
$columns{'component'} = "map_components.name";
|
|
|
|
$columns{'product'} = "map_products.name";
|
|
|
|
$columns{'version'} = "bugs.version";
|
|
|
|
$columns{'op_sys'} = "bugs.op_sys";
|
|
|
|
$columns{'votes'} = "bugs.votes";
|
|
|
|
$columns{'keywords'} = "bugs.keywords";
|
|
|
|
$columns{'target_milestone'} = "bugs.target_milestone";
|
2002-10-08 10:41:28 +04:00
|
|
|
# One which means "nothing". Any number would do, really. It just gets SELECTed
|
|
|
|
# so that we always select 3 items in the query.
|
|
|
|
$columns{''} = "42217354";
|
2002-09-25 11:11:45 +04:00
|
|
|
|
2002-10-08 10:41:28 +04:00
|
|
|
my @axis_fields = ($row_field, $col_field, $tbl_field);
|
2002-09-25 11:11:45 +04:00
|
|
|
|
|
|
|
my @selectnames = map($columns{$_}, @axis_fields);
|
|
|
|
|
2002-10-26 05:57:09 +04:00
|
|
|
# Clone the params, so that Bugzilla::Search can modify them
|
|
|
|
my $params = new Bugzilla::CGI($cgi);
|
2002-09-25 11:11:45 +04:00
|
|
|
my $search = new Bugzilla::Search('fields' => \@selectnames,
|
2002-10-26 05:57:09 +04:00
|
|
|
'params' => $params);
|
2002-09-25 11:11:45 +04:00
|
|
|
my $query = $search->getSQL();
|
|
|
|
|
2002-10-26 05:57:09 +04:00
|
|
|
SendSQL($query);
|
2002-09-25 11:11:45 +04:00
|
|
|
|
2002-10-08 10:41:28 +04:00
|
|
|
# We have a hash of hashes for the data itself, and a hash to hold the
|
|
|
|
# row/col/table names.
|
2002-09-25 11:11:45 +04:00
|
|
|
my %data;
|
2002-10-08 10:41:28 +04:00
|
|
|
my %names;
|
2002-09-25 11:11:45 +04:00
|
|
|
|
|
|
|
# Read the bug data and increment the counts.
|
|
|
|
while (MoreSQLData()) {
|
2002-10-08 10:41:28 +04:00
|
|
|
my ($row, $col, $tbl) = FetchSQLData();
|
2002-10-11 10:27:37 +04:00
|
|
|
$col = "" if ($col eq $columns{''});
|
|
|
|
$tbl = "" if ($tbl eq $columns{''});
|
2002-09-25 11:11:45 +04:00
|
|
|
|
2002-10-08 10:41:28 +04:00
|
|
|
$data{$tbl}{$col}{$row}++;
|
|
|
|
$names{"col"}{$col}++;
|
|
|
|
$names{"row"}{$row}++;
|
|
|
|
$names{"tbl"}{$tbl}++;
|
2002-09-25 11:11:45 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
# Determine the labels for the rows and columns
|
|
|
|
$vars->{'col_field'} = $col_field;
|
2002-10-08 10:41:28 +04:00
|
|
|
$vars->{'row_field'} = $row_field;
|
|
|
|
$vars->{'tbl_field'} = $tbl_field;
|
|
|
|
$vars->{'names'} = \%names;
|
|
|
|
$vars->{'data'} = \%data;
|
|
|
|
$vars->{'time'} = time();
|
2002-09-25 11:11:45 +04:00
|
|
|
|
2002-10-26 05:57:09 +04:00
|
|
|
$cgi->delete('format');
|
2002-09-25 11:11:45 +04:00
|
|
|
|
|
|
|
# Calculate the base query URL for the hyperlinked numbers
|
2002-10-26 05:57:09 +04:00
|
|
|
$vars->{'querybase'} = $cgi->canonicalise_query("x_axis_field",
|
|
|
|
"y_axis_field",
|
|
|
|
"z_axis_field",
|
|
|
|
@axis_fields);
|
|
|
|
$vars->{'query'} = $cgi->query_string();
|
2002-09-25 11:11:45 +04:00
|
|
|
|
|
|
|
# Generate and return the result from the appropriate template.
|
2002-10-08 10:41:28 +04:00
|
|
|
my $format = GetFormat("reports/report", $::FORM{'format'}, $::FORM{'ctype'});
|
2002-10-11 10:27:37 +04:00
|
|
|
print "Content-Type: $format->{'ctype'}\n\n";
|
2002-09-25 11:11:45 +04:00
|
|
|
$template->process("$format->{'template'}", $vars)
|
|
|
|
|| ThrowTemplateError($template->error());
|