2003-03-27 03:07:02 +03:00
|
|
|
#!/usr/bin/perl -wT
|
1998-09-16 01:49:26 +04:00
|
|
|
# -*- Mode: perl; indent-tabs-mode: nil -*-
|
1998-08-26 10:14:20 +04:00
|
|
|
#
|
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.
|
|
|
|
#
|
1998-08-26 10:14:20 +04:00
|
|
|
# The Original Code is the Bugzilla Bug Tracking System.
|
1999-11-02 02:33:56 +03:00
|
|
|
#
|
1998-08-26 10:14:20 +04: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.
|
|
|
|
#
|
1998-08-26 10:14:20 +04:00
|
|
|
# Contributor(s): Terry Weissman <terry@mozilla.org>
|
|
|
|
|
1998-09-16 01:49:26 +04:00
|
|
|
use strict;
|
1998-08-26 10:14:20 +04:00
|
|
|
|
2002-01-20 04:44:52 +03:00
|
|
|
use lib qw(.);
|
|
|
|
|
2003-05-05 05:15:38 +04:00
|
|
|
use Bugzilla;
|
2004-03-27 06:51:44 +03:00
|
|
|
use Bugzilla::Constants;
|
2005-03-16 01:10:14 +03:00
|
|
|
use Bugzilla::User;
|
2006-03-09 03:09:00 +03:00
|
|
|
use Bugzilla::Keyword;
|
2003-05-05 05:15:38 +04:00
|
|
|
|
2005-08-10 05:30:41 +04:00
|
|
|
require "globals.pl";
|
1999-05-11 02:08:58 +04:00
|
|
|
|
2004-03-18 06:57:05 +03:00
|
|
|
use Bugzilla::Bug;
|
2002-11-28 13:49:58 +03:00
|
|
|
|
2003-05-05 05:15:38 +04:00
|
|
|
my $cgi = Bugzilla->cgi;
|
2005-10-25 03:11:56 +04:00
|
|
|
my $template = Bugzilla->template;
|
|
|
|
my $vars = {};
|
2003-05-05 05:15:38 +04:00
|
|
|
|
2006-05-12 06:41:22 +04:00
|
|
|
Bugzilla->login();
|
1999-05-11 02:08:58 +04:00
|
|
|
|
2002-12-15 12:24:08 +03:00
|
|
|
# Editable, 'single' HTML bugs are treated slightly specially in a few places
|
|
|
|
my $single = !$cgi->param('format')
|
|
|
|
&& (!$cgi->param('ctype') || $cgi->param('ctype') eq 'html');
|
2001-06-03 02:02:02 +04:00
|
|
|
|
2002-12-15 12:24:08 +03:00
|
|
|
# If we don't have an ID, _AND_ we're only doing a single bug, then prompt
|
2004-04-10 19:08:21 +04:00
|
|
|
if (!$cgi->param('id') && $single) {
|
2003-05-05 05:15:38 +04:00
|
|
|
print Bugzilla->cgi->header();
|
2002-12-15 12:24:08 +03:00
|
|
|
$template->process("bug/choose.html.tmpl", $vars) ||
|
2002-11-28 13:49:58 +03:00
|
|
|
ThrowTemplateError($template->error());
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2005-08-25 18:02:41 +04:00
|
|
|
my $format = $template->get_format("bug/show", scalar $cgi->param('format'),
|
|
|
|
scalar $cgi->param('ctype'));
|
2002-11-28 13:49:58 +03:00
|
|
|
|
2002-12-15 12:24:08 +03:00
|
|
|
my @bugs = ();
|
2004-09-21 23:56:19 +04:00
|
|
|
my %marks;
|
2002-11-28 13:49:58 +03:00
|
|
|
|
2002-12-15 12:24:08 +03:00
|
|
|
if ($single) {
|
|
|
|
my $id = $cgi->param('id');
|
|
|
|
# Its a bit silly to do the validation twice - that functionality should
|
|
|
|
# probably move into Bug.pm at some point
|
|
|
|
ValidateBugID($id);
|
2005-10-31 00:31:29 +03:00
|
|
|
push @bugs, new Bugzilla::Bug($id, Bugzilla->user->id);
|
2004-09-21 23:56:19 +04:00
|
|
|
if (defined $cgi->param('mark')) {
|
|
|
|
foreach my $range (split ',', $cgi->param('mark')) {
|
|
|
|
if ($range =~ /^(\d+)-(\d+)$/) {
|
|
|
|
foreach my $i ($1..$2) {
|
|
|
|
$marks{$i} = 1;
|
|
|
|
}
|
|
|
|
} elsif ($range =~ /^(\d+)$/) {
|
|
|
|
$marks{$1} = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2002-12-15 12:24:08 +03:00
|
|
|
} else {
|
|
|
|
foreach my $id ($cgi->param('id')) {
|
2006-06-19 03:11:59 +04:00
|
|
|
# Be kind enough and accept URLs of the form: id=1,2,3.
|
|
|
|
my @ids = split(/,/, $id);
|
|
|
|
foreach (@ids) {
|
|
|
|
my $bug = new Bugzilla::Bug($_, Bugzilla->user->id);
|
|
|
|
push(@bugs, $bug);
|
|
|
|
}
|
2002-12-15 12:24:08 +03:00
|
|
|
}
|
|
|
|
}
|
2002-11-28 13:49:58 +03:00
|
|
|
|
2003-08-20 04:45:43 +04:00
|
|
|
# Determine if Patch Viewer is installed, for Diff link
|
|
|
|
eval {
|
|
|
|
require PatchReader;
|
|
|
|
$vars->{'patchviewerinstalled'} = 1;
|
|
|
|
};
|
|
|
|
|
2002-12-15 12:24:08 +03:00
|
|
|
$vars->{'bugs'} = \@bugs;
|
2004-09-21 23:56:19 +04:00
|
|
|
$vars->{'marks'} = \%marks;
|
2006-03-09 03:09:00 +03:00
|
|
|
$vars->{'use_keywords'} = 1 if Bugzilla::Keyword::keyword_count();
|
2002-11-28 13:49:58 +03:00
|
|
|
|
|
|
|
# Next bug in list (if there is one)
|
|
|
|
my @bug_list;
|
2004-04-02 03:46:11 +04:00
|
|
|
if ($cgi->cookie("BUGLIST")) {
|
|
|
|
@bug_list = split(/:/, $cgi->cookie("BUGLIST"));
|
2002-11-28 13:49:58 +03:00
|
|
|
}
|
2003-01-15 10:59:53 +03:00
|
|
|
|
2002-11-28 13:49:58 +03:00
|
|
|
$vars->{'bug_list'} = \@bug_list;
|
|
|
|
|
2003-01-15 10:59:53 +03:00
|
|
|
# Work out which fields we are displaying (currently XML only.)
|
|
|
|
# If no explicit list is defined, we show all fields. We then exclude any
|
|
|
|
# on the exclusion list. This is so you can say e.g. "Everything except
|
|
|
|
# attachments" without listing almost all the fields.
|
2006-02-21 16:08:24 +03:00
|
|
|
my @fieldlist = (Bugzilla::Bug->fields, 'group', 'long_desc',
|
2005-09-07 16:05:13 +04:00
|
|
|
'attachment', 'attachmentdata');
|
2003-01-15 10:59:53 +03:00
|
|
|
my %displayfields;
|
|
|
|
|
|
|
|
if ($cgi->param("field")) {
|
|
|
|
@fieldlist = $cgi->param("field");
|
|
|
|
}
|
|
|
|
|
2004-10-25 11:25:58 +04:00
|
|
|
unless (UserInGroup(Param("timetrackinggroup"))) {
|
|
|
|
@fieldlist = grep($_ !~ /_time$/, @fieldlist);
|
|
|
|
}
|
|
|
|
|
2003-01-15 10:59:53 +03:00
|
|
|
foreach (@fieldlist) {
|
|
|
|
$displayfields{$_} = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach ($cgi->param("excludefield")) {
|
|
|
|
$displayfields{$_} = undef;
|
|
|
|
}
|
|
|
|
|
|
|
|
$vars->{'displayfields'} = \%displayfields;
|
|
|
|
|
2003-05-05 05:15:38 +04:00
|
|
|
print $cgi->header($format->{'ctype'});
|
|
|
|
|
2002-11-28 13:49:58 +03:00
|
|
|
$template->process("$format->{'template'}", $vars)
|
|
|
|
|| ThrowTemplateError($template->error());
|