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