2003-03-27 00:07:02 +00:00
|
|
|
#!/usr/bin/perl -wT
|
1999-02-04 17:13:52 +00:00
|
|
|
# -*- Mode: perl; indent-tabs-mode: nil -*-
|
|
|
|
#
|
1999-11-01 23:33:56 +00:00
|
|
|
# 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.
|
|
|
|
#
|
1999-02-04 17:13:52 +00:00
|
|
|
# The Original Code is the Bugzilla Bug Tracking System.
|
1999-11-01 23:33:56 +00:00
|
|
|
#
|
1999-02-04 17:13:52 +00:00
|
|
|
# The Initial Developer of the Original Code is Netscape Communications
|
1999-11-01 23:33:56 +00:00
|
|
|
# Corporation. Portions created by Netscape are
|
|
|
|
# Copyright (C) 1998 Netscape Communications Corporation. All
|
|
|
|
# Rights Reserved.
|
|
|
|
#
|
1999-02-04 17:13:52 +00:00
|
|
|
# Contributor(s): Terry Weissman <terry@mozilla.org>
|
2002-02-14 01:25:25 +00:00
|
|
|
# Bradley Baetz <bbaetz@student.usyd.edu.au>
|
1999-02-04 17:13:52 +00:00
|
|
|
|
2002-02-14 01:25:25 +00:00
|
|
|
use vars qw(
|
2002-08-12 05:43:05 +00:00
|
|
|
%legal_product
|
2002-02-14 01:25:25 +00:00
|
|
|
$userid
|
|
|
|
);
|
1999-02-04 17:13:52 +00:00
|
|
|
|
|
|
|
use strict;
|
|
|
|
|
2002-01-20 01:44:52 +00:00
|
|
|
use lib qw(.);
|
|
|
|
|
2003-05-05 01:15:38 +00:00
|
|
|
use Bugzilla;
|
|
|
|
|
1999-02-04 17:13:52 +00:00
|
|
|
require "CGI.pl";
|
|
|
|
|
|
|
|
ConnectToDatabase();
|
2002-05-21 23:36:25 +00:00
|
|
|
quietly_check_login();
|
|
|
|
|
2002-06-17 09:39:00 +00:00
|
|
|
GetVersionTable();
|
|
|
|
|
2003-05-05 01:15:38 +00:00
|
|
|
my $cgi = Bugzilla->cgi;
|
2004-03-26 21:00:11 +00:00
|
|
|
my $product = $cgi->param('product');
|
2003-05-05 01:15:38 +00:00
|
|
|
|
2004-03-26 21:02:43 +00:00
|
|
|
if (!defined $product) {
|
2002-02-14 01:25:25 +00:00
|
|
|
# Reference to a subset of %::proddesc, which the user is allowed to see
|
|
|
|
my %products;
|
|
|
|
|
2003-11-03 03:25:51 +00:00
|
|
|
if (AnyEntryGroups()) {
|
2002-02-14 01:25:25 +00:00
|
|
|
# OK, now only add products the user can see
|
2002-05-21 23:36:25 +00:00
|
|
|
confirm_login() unless $::userid;
|
2002-02-14 01:25:25 +00:00
|
|
|
foreach my $p (@::legal_product) {
|
2002-11-24 19:56:34 +00:00
|
|
|
if (CanEnterProduct($p)) {
|
2002-02-14 01:25:25 +00:00
|
|
|
$products{$p} = $::proddesc{$p};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
%products = %::proddesc;
|
|
|
|
}
|
2001-06-06 04:32:45 +00:00
|
|
|
|
2002-02-14 01:25:25 +00:00
|
|
|
my $prodsize = scalar(keys %products);
|
|
|
|
if ($prodsize == 0) {
|
2002-10-06 11:52:37 +00:00
|
|
|
ThrowUserError("no_products");
|
2002-02-14 01:25:25 +00:00
|
|
|
}
|
|
|
|
elsif ($prodsize > 1) {
|
|
|
|
$::vars->{'proddesc'} = \%products;
|
|
|
|
$::vars->{'target'} = "describecomponents.cgi";
|
|
|
|
|
2003-05-05 01:15:38 +00:00
|
|
|
print $cgi->header();
|
2002-04-24 07:24:50 +00:00
|
|
|
$::template->process("global/choose-product.html.tmpl", $::vars)
|
|
|
|
|| ThrowTemplateError($::template->error());
|
2002-02-14 01:25:25 +00:00
|
|
|
exit;
|
|
|
|
}
|
2001-06-06 04:32:45 +00:00
|
|
|
|
2004-03-26 21:00:11 +00:00
|
|
|
$product = (keys %products)[0];
|
2001-06-06 04:32:45 +00:00
|
|
|
}
|
|
|
|
|
2002-02-14 01:25:25 +00:00
|
|
|
# Make sure the user specified a valid product name. Note that
|
|
|
|
# if the user specifies a valid product name but is not authorized
|
|
|
|
# to access that product, they will receive a different error message
|
|
|
|
# which could enable people guessing product names to determine
|
|
|
|
# whether or not certain products exist in Bugzilla, even if they
|
|
|
|
# cannot get any other information about that product.
|
2002-08-12 05:43:05 +00:00
|
|
|
my $product_id = get_product_id($product);
|
|
|
|
|
2002-09-12 22:51:50 +00:00
|
|
|
if (!$product_id) {
|
2003-04-02 12:35:07 +00:00
|
|
|
ThrowUserError("invalid_product_name",
|
|
|
|
{ product => $product });
|
2002-09-12 22:51:50 +00:00
|
|
|
}
|
2002-02-14 01:25:25 +00:00
|
|
|
|
|
|
|
# Make sure the user is authorized to access this product.
|
2002-11-24 19:56:34 +00:00
|
|
|
CanEnterProduct($product)
|
2002-10-06 11:52:37 +00:00
|
|
|
|| ThrowUserError("product_access_denied");
|
2001-06-06 04:32:45 +00:00
|
|
|
|
|
|
|
######################################################################
|
|
|
|
# End Data/Security Validation
|
|
|
|
######################################################################
|
|
|
|
|
2002-02-14 01:25:25 +00:00
|
|
|
my @components;
|
2002-08-12 05:43:05 +00:00
|
|
|
SendSQL("SELECT name, initialowner, initialqacontact, description FROM " .
|
|
|
|
"components WHERE product_id = $product_id ORDER BY " .
|
|
|
|
"name");
|
2002-02-14 01:25:25 +00:00
|
|
|
while (MoreSQLData()) {
|
|
|
|
my ($name, $initialowner, $initialqacontact, $description) =
|
|
|
|
FetchSQLData();
|
1999-02-04 17:13:52 +00:00
|
|
|
|
2002-02-14 01:25:25 +00:00
|
|
|
my %component;
|
1999-02-04 17:13:52 +00:00
|
|
|
|
2002-02-14 01:25:25 +00:00
|
|
|
$component{'name'} = $name;
|
|
|
|
$component{'initialowner'} = $initialowner ?
|
|
|
|
DBID_to_name($initialowner) : '';
|
|
|
|
$component{'initialqacontact'} = $initialqacontact ?
|
|
|
|
DBID_to_name($initialqacontact) : '';
|
|
|
|
$component{'description'} = $description;
|
1999-02-04 17:13:52 +00:00
|
|
|
|
2002-02-14 01:25:25 +00:00
|
|
|
push @components, \%component;
|
1999-02-04 17:13:52 +00:00
|
|
|
}
|
|
|
|
|
2002-02-14 01:25:25 +00:00
|
|
|
$::vars->{'product'} = $product;
|
|
|
|
$::vars->{'components'} = \@components;
|
1999-02-04 17:13:52 +00:00
|
|
|
|
2003-05-05 01:15:38 +00:00
|
|
|
print $cgi->header();
|
2002-04-24 07:24:50 +00:00
|
|
|
$::template->process("reports/components.html.tmpl", $::vars)
|
|
|
|
|| ThrowTemplateError($::template->error());
|
2000-01-14 22:35:49 +00:00
|
|
|
|