21
21
# Contributor(s): Terry Weissman <terry@mozilla.org>
26
use lib '/usr/share/bugzilla/lib';
28
use Bugzilla::Constants;
29
require "bug_form.pl";
33
if ($::FORM{'GoAheadAndLogIn'}) {
32
use vars qw($template $vars $userid);
36
my $cgi = Bugzilla->cgi;
38
if ($cgi->param('GoAheadAndLogIn')) {
39
Bugzilla->login(LOGIN_REQUIRED);
36
quietly_check_login();
39
######################################################################
40
# Begin Data/Security Validation
41
######################################################################
43
# Make sure the bug ID is a positive integer representing an existing
44
# bug that the user is authorized to access.
45
if (defined ($::FORM{'id'})) {
46
ValidateBugID($::FORM{'id'});
49
######################################################################
50
# End Data/Security Validation
51
######################################################################
44
# Editable, 'single' HTML bugs are treated slightly specially in a few places
45
my $single = !$cgi->param('format')
46
&& (!$cgi->param('ctype') || $cgi->param('ctype') eq 'html');
48
# If we don't have an ID, _AND_ we're only doing a single bug, then prompt
49
if (!$cgi->param('id') && $single) {
50
print Bugzilla->cgi->header();
51
$template->process("bug/choose.html.tmpl", $vars) ||
52
ThrowTemplateError($template->error());
56
my $format = GetFormat("bug/show", scalar $cgi->param('format'),
57
scalar $cgi->param('ctype'));
55
print "Content-type: text/html\n\n";
64
my $id = $cgi->param('id');
65
# Its a bit silly to do the validation twice - that functionality should
66
# probably move into Bug.pm at some point
68
push @bugs, new Bugzilla::Bug($id, $userid);
70
foreach my $id ($cgi->param('id')) {
71
my $bug = new Bugzilla::Bug($id, $userid);
76
# Determine if Patch Viewer is installed, for Diff link
79
$vars->{'patchviewerinstalled'} = 1;
82
$vars->{'bugs'} = \@bugs;
84
# Next bug in list (if there is one)
86
if ($cgi->cookie("BUGLIST")) {
87
@bug_list = split(/:/, $cgi->cookie("BUGLIST"));
90
$vars->{'bug_list'} = \@bug_list;
92
# Work out which fields we are displaying (currently XML only.)
93
# If no explicit list is defined, we show all fields. We then exclude any
94
# on the exclusion list. This is so you can say e.g. "Everything except
95
# attachments" without listing almost all the fields.
96
my @fieldlist = (Bugzilla::Bug::fields(), 'group', 'long_desc', 'attachment');
99
if ($cgi->param("field")) {
100
@fieldlist = $cgi->param("field");
103
unless (UserInGroup(Param("timetrackinggroup"))) {
104
@fieldlist = grep($_ !~ /_time$/, @fieldlist);
107
foreach (@fieldlist) {
108
$displayfields{$_} = 1;
111
foreach ($cgi->param("excludefield")) {
112
$displayfields{$_} = undef;
115
$vars->{'displayfields'} = \%displayfields;
117
print $cgi->header($format->{'ctype'});
119
$template->process("$format->{'template'}", $vars)
120
|| ThrowTemplateError($template->error());