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
|
|
|
|
$userid
|
|
|
|
);
|
1999-02-04 20:13:52 +03:00
|
|
|
|
|
|
|
use diagnostics;
|
|
|
|
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;
|
|
|
|
|
|
|
|
if (Param("usebuggroups")) {
|
|
|
|
# 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) {
|
|
|
|
if (!GroupExists($p) || UserInGroup($p)) {
|
|
|
|
$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) {
|
|
|
|
DisplayError("Either no products have been defined ".
|
|
|
|
"or you have not been given access to any.\n");
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
elsif ($prodsize > 1) {
|
|
|
|
$::vars->{'proddesc'} = \%products;
|
|
|
|
$::vars->{'target'} = "describecomponents.cgi";
|
|
|
|
$::vars->{'title'} = "Bugzilla component description";
|
|
|
|
$::vars->{'h2'} =
|
|
|
|
"Please specify the product whose components you want described.";
|
|
|
|
|
|
|
|
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.
|
|
|
|
grep($product eq $_ , @::legal_product)
|
|
|
|
|| DisplayError("The product name is invalid.")
|
|
|
|
&& exit;
|
|
|
|
|
|
|
|
# Make sure the user is authorized to access this product.
|
2002-05-22 03:36:25 +04:00
|
|
|
if (Param("usebuggroups") && GroupExists($product)) {
|
|
|
|
confirm_login() unless $::userid;
|
2002-02-14 04:25:25 +03:00
|
|
|
UserInGroup($product)
|
2001-06-06 08:32:45 +04:00
|
|
|
|| DisplayError("You are not authorized to access that product.")
|
2002-02-14 04:25:25 +03:00
|
|
|
&& exit;
|
2001-06-06 08:32:45 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
######################################################################
|
|
|
|
# End Data/Security Validation
|
|
|
|
######################################################################
|
|
|
|
|
2002-02-14 04:25:25 +03:00
|
|
|
my @components;
|
|
|
|
SendSQL("SELECT value, initialowner, initialqacontact, description FROM " .
|
|
|
|
"components WHERE program = " . SqlQuote($product) . " ORDER BY " .
|
|
|
|
"value");
|
|
|
|
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
|
|
|
|