1
#!/usr/bonsaitools/bin/perl -wT
2
# -*- Mode: perl; indent-tabs-mode: nil -*-
4
# The contents of this file are subject to the Mozilla Public
5
# License Version 1.1 (the "License"); you may not use this file
6
# except in compliance with the License. You may obtain a copy of
7
# the License at http://www.mozilla.org/MPL/
9
# Software distributed under the License is distributed on an "AS
10
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
11
# implied. See the License for the specific language governing
12
# rights and limitations under the License.
14
# The Original Code is the Bugzilla Bug Tracking System.
16
# The Initial Developer of the Original Code is Netscape Communications
17
# Corporation. Portions created by Netscape are
18
# Copyright (C) 1998 Netscape Communications Corporation. All
21
# Contributor(s): Terry Weissman <terry@mozilla.org>
22
# Bradley Baetz <bbaetz@student.usyd.edu.au>
37
quietly_check_login();
41
if (!defined $::FORM{'product'}) {
42
# Reference to a subset of %::proddesc, which the user is allowed to see
45
if (Param("usebuggroups")) {
46
# OK, now only add products the user can see
47
confirm_login() unless $::userid;
48
foreach my $p (@::legal_product) {
49
if (!GroupExists($p) || UserInGroup($p)) {
50
$products{$p} = $::proddesc{$p};
55
%products = %::proddesc;
58
my $prodsize = scalar(keys %products);
60
DisplayError("Either no products have been defined ".
61
"or you have not been given access to any.\n");
64
elsif ($prodsize > 1) {
65
$::vars->{'proddesc'} = \%products;
66
$::vars->{'target'} = "describecomponents.cgi";
67
$::vars->{'title'} = "Bugzilla component description";
69
"Please specify the product whose components you want described.";
71
print "Content-type: text/html\n\n";
72
$::template->process("global/choose-product.html.tmpl", $::vars)
73
|| ThrowTemplateError($::template->error());
77
$::FORM{'product'} = (keys %products)[0];
80
my $product = $::FORM{'product'};
82
# Make sure the user specified a valid product name. Note that
83
# if the user specifies a valid product name but is not authorized
84
# to access that product, they will receive a different error message
85
# which could enable people guessing product names to determine
86
# whether or not certain products exist in Bugzilla, even if they
87
# cannot get any other information about that product.
88
grep($product eq $_ , @::legal_product)
89
|| DisplayError("The product name is invalid.")
92
# Make sure the user is authorized to access this product.
93
if (Param("usebuggroups") && GroupExists($product)) {
94
confirm_login() unless $::userid;
96
|| DisplayError("You are not authorized to access that product.")
100
######################################################################
101
# End Data/Security Validation
102
######################################################################
105
SendSQL("SELECT value, initialowner, initialqacontact, description FROM " .
106
"components WHERE program = " . SqlQuote($product) . " ORDER BY " .
108
while (MoreSQLData()) {
109
my ($name, $initialowner, $initialqacontact, $description) =
114
$component{'name'} = $name;
115
$component{'initialowner'} = $initialowner ?
116
DBID_to_name($initialowner) : '';
117
$component{'initialqacontact'} = $initialqacontact ?
118
DBID_to_name($initialqacontact) : '';
119
$component{'description'} = $description;
121
push @components, \%component;
124
$::vars->{'product'} = $product;
125
$::vars->{'components'} = \@components;
127
print "Content-type: text/html\n\n";
128
$::template->process("reports/components.html.tmpl", $::vars)
129
|| ThrowTemplateError($::template->error());