-
-|;
-print $bug{'long_desc'};
-print "
-\n";
+ my $movers = Param("movers");
+ $user{'canmove'} = Param("move-enabled")
+ && (defined $::COOKIE{"Bugzilla_login"})
+ && ($::COOKIE{"Bugzilla_login"} =~ /\Q$movers\E/);
+
+ # User permissions
+
+ # In the below, if the person hasn't logged in ($::userid == 0), then
+ # we treat them as if they can do anything. That's because we don't
+ # know why they haven't logged in; it may just be because they don't
+ # use cookies. Display everything as if they have all the permissions
+ # in the world; their permissions will get checked when they log in
+ # and actually try to make the change.
+ $user{'canedit'} = $::userid == 0
+ || $::userid == $bug{'reporter'}
+ || $::userid == $bug{'qa_contact'}
+ || $::userid == $bug{'assigned_to'}
+ || UserInGroup("editbugs");
+ $user{'canconfirm'} = ($::userid == 0) || UserInGroup("canconfirm");
+
+ # Bug states
+ $bug{'isunconfirmed'} = ($bug{'bug_status'} eq $::unconfirmedstate);
+ $bug{'isopened'} = IsOpenedState($bug{'bug_status'});
+
+ # People involved with the bug
+ $bug{'assigned_to_email'} = DBID_to_name($bug{'assigned_to'});
+ $bug{'assigned_to'} = DBID_to_real_or_loginname($bug{'assigned_to'});
+ $bug{'reporter'} = DBID_to_real_or_loginname($bug{'reporter'});
+ $bug{'qa_contact'} = $bug{'qa_contact'} > 0 ?
+ DBID_to_name($bug{'qa_contact'}) : "";
+
+ my $ccset = new RelationSet;
+ $ccset->mergeFromDB("SELECT who FROM cc WHERE bug_id=$id");
+
+ my @cc = $ccset->toArrayOfStrings();
+ $bug{'cc'} = \@cc if $cc[0];
+
+ # Next bug in list (if there is one)
+ if ($::COOKIE{"BUGLIST"} && $id)
+ {
+ my @bug_list = split(/:/, $::COOKIE{"BUGLIST"});
+ $vars->{'bug_list'} = \@bug_list;
+ }
-# To add back option of editing the long description, insert after the above
-# long_list.cgi line:
-# Edit Long Description
+ $bug{'comments'} = GetComments($bug{'bug_id'});
-navigation_header();
+ # This is length in number of comments
+ $bug{'longdesclength'} = scalar(@{$bug{'comments'}});
-PutFooter();
+ # Add the bug and user hashes to the variables
+ $vars->{'bug'} = \%bug;
+ $vars->{'user'} = \%user;
+ # Generate and return the UI (HTML page) from the appropriate template.
+ $template->process("show/show_bug.html.tmpl", $vars)
+ || DisplayError("Template process failed: " . $template->error())
+ && exit;
+}
+
1;
diff --git a/process_bug.cgi b/process_bug.cgi
index fb3c0e482..6af364666 100755
--- a/process_bug.cgi
+++ b/process_bug.cgi
@@ -32,22 +32,25 @@ my $UserInCanConfirmGroupSet = -1;
use lib qw(.);
require "CGI.pl";
+require "bug_form.pl";
+
use RelationSet;
# Shut up misguided -w warnings about "used only once":
-use vars %::versions,
- %::components,
- %::COOKIE,
- %::MFORM,
- %::legal_keywords,
- %::legal_opsys,
- %::legal_platform,
- %::legal_priority,
- %::settable_resolution,
- %::target_milestone,
- %::legal_severity,
- %::superusergroupset;
+use vars qw(%versions
+ %components
+ %COOKIE
+ %MFORM
+ %legal_keywords
+ %legal_opsys
+ %legal_platform
+ %legal_priority
+ %settable_resolution
+ %target_milestone
+ %legal_severity
+ %superusergroupset
+ $next_bug);
my $whoid = confirm_login();
@@ -466,22 +469,8 @@ if ($action eq Param("move-button-text")) {
# the common updates to all bugs in @idlist start here
#
print "Update Bug " . join(" ", @idlist) . "\n";
-if (defined $::FORM{'id'}) {
- navigation_header();
- if (defined $::next_bug) {
- # If there is another bug, then we're going to display it,
- # so check that its a legal bug
- # We need to check that its a number first
- if (!(detaint_natural($::next_bug) && CanSeeBug($::next_bug))) {
- # This isn't OK
- # Rather than error out (which could validly happen if there
- # was a bug in the list whose group was changed in the meantime)
- # just remove references to it
- undef $::next_bug;
- }
- }
-}
print "\n";
+
$::query = "update bugs\nset";
$::comma = "";
umask(0);
@@ -973,13 +962,20 @@ The changes made were:
";
DumpBugActivity($id, $::FORM{'delta_ts'});
- my $longdesc = GetLongDescriptionAsHTML($id);
+ my $comments = GetComments($id);
my $longchanged = 0;
- if (length($longdesc) > $::FORM{'longdesclength'}) {
+ if (scalar(@$comments) > $::FORM{'longdesclength'}) {
$longchanged = 1;
print "
\n";
}
SendSQL("unlock tables");
@@ -1394,14 +1390,29 @@ The changes made were:
}
-if (defined $::next_bug) {
- print("
The next bug in your list is:\n");
- $::FORM{'id'} = $::next_bug;
- print "
\n";
+# Show next bug, if it exists.
+if ($::COOKIE{"BUGLIST"} && $::FORM{'id'}) {
+ my @bugs = split(/:/, $::COOKIE{"BUGLIST"});
+ my $cur = lsearch(\@bugs, $::FORM{"id"});
+ if ($cur >= 0 && $cur < $#bugs) {
+ my $next_bug = $bugs[$cur + 1];
+ if (detaint_natural($next_bug) && CanSeeBug($next_bug)) {
- navigation_header();
- do "bug_form.pl";
-} else {
- navigation_header();
- PutFooter();
+ print "\n";
+ print("
The next bug in your list is bug ");
+ print("$next_bug:
\n");
+ $::FORM{'id'} = $next_bug;
+
+ show_bug("header is already done");
+
+ exit;
+ }
+ else {
+ # Need this until the navigation_header() fn. goes away totally.
+ undef $::next_bug;
+ }
+ }
}
+
+navigation_header();
+PutFooter();
diff --git a/show_bug.cgi b/show_bug.cgi
index 28eb66763..f832a2930 100755
--- a/show_bug.cgi
+++ b/show_bug.cgi
@@ -26,6 +26,7 @@ use strict;
use lib qw(.);
require "CGI.pl";
+require "bug_form.pl";
ConnectToDatabase();
@@ -49,32 +50,8 @@ if (defined ($::FORM{'id'})) {
# End Data/Security Validation
######################################################################
-print "Content-type: text/html\n";
-print "\n";
-
-if (!defined $::FORM{'id'}) {
- PutHeader("Search by bug number");
- print "\n";
- PutFooter();
- exit;
-}
-
GetVersionTable();
-# Get the bug's summary (short description) and display it as
-# the page title.
-SendSQL("SELECT short_desc FROM bugs WHERE bug_id = $::FORM{'id'}");
-my ($summary) = FetchSQLData();
-$summary = html_quote($summary);
-PutHeader("Bug $::FORM{'id'} - $summary", "Bugzilla Bug $::FORM{'id'}", $summary, "", navigation_links() );
-
-navigation_header();
-
-print "\n";
+print "Content-type: text/html\n\n";
-$! = 0;
-do "bug_form.pl" || die "Error doing bug_form.pl: $!";
+show_bug();
diff --git a/template/default/show/choose_bug.html.tmpl b/template/default/show/choose_bug.html.tmpl
new file mode 100644
index 000000000..1df89ce8f
--- /dev/null
+++ b/template/default/show/choose_bug.html.tmpl
@@ -0,0 +1,35 @@
+[%# 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.
+ #
+ # The Original Code is the Bugzilla Bug Tracking System.
+ #
+ # The Initial Developer of the Original Code is Netscape Communications
+ # Corporation. Portions created by Netscape are
+ # Copyright (C) 1998 Netscape Communications Corporation. All
+ # Rights Reserved.
+ #
+ # Contributor(s): Gervase Markham
+ #%]
+
+[% UNLESS header_done %]
+ [% INCLUDE global/header
+ title = "Search by bug number"
+ %]
+[% END %]
+
+
+
+[% INCLUDE global/footer %]
diff --git a/template/default/show/navigate.html.tmpl b/template/default/show/navigate.html.tmpl
new file mode 100644
index 000000000..685539e01
--- /dev/null
+++ b/template/default/show/navigate.html.tmpl
@@ -0,0 +1,53 @@
+[%# 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.
+ #
+ # The Original Code is the Bugzilla Bug Tracking System.
+ #
+ # The Initial Developer of the Original Code is Netscape Communications
+ # Corporation. Portions created by Netscape are
+ # Copyright (C) 1998 Netscape Communications Corporation. All
+ # Rights Reserved.
+ #
+ # Contributor(s): Gervase Markham
+ #%]
+
+[% IF bug_list.size > 0 %]
+ [% this_bug_idx = lsearch(bug_list, bug.bug_id) %]
+ Bug List:
+ [% IF this_bug_idx != -1 %]
+ ([% this_bug_idx + 1 %] of [% bug_list.size %])
+ [% END %]
+
+ First
+ Last
+
+ [% IF this_bug_idx != -1 %]
+ [% IF this_bug_idx > 0 %]
+ [% prev_bug = this_bug_idx - 1 %]
+ Prev
+ [% ELSE %]
+ Prev
+ [% END %]
+
+ [% IF this_bug_idx + 1 < bug_list.size %]
+ [% next_bug = this_bug_idx + 1 %]
+ Next
+ [% ELSE %]
+ Next
+ [% END %]
+ [% ELSE %]
+ (This bug is not in your list)
+ [% END %]
+
+ Show list
+[% END %]
+
+ Query page
+ Enter new bug
diff --git a/template/default/show/show_bug.html.tmpl b/template/default/show/show_bug.html.tmpl
new file mode 100644
index 000000000..13eb80034
--- /dev/null
+++ b/template/default/show/show_bug.html.tmpl
@@ -0,0 +1,527 @@
+[%# 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.
+ #
+ # The Original Code is the Bugzilla Bug Tracking System.
+ #
+ # The Initial Developer of the Original Code is Netscape Communications
+ # Corporation. Portions created by Netscape are
+ # Copyright (C) 1998 Netscape Communications Corporation. All
+ # Rights Reserved.
+ #
+ # Contributor(s): Gervase Markham
+ #%]
+
+[% UNLESS header_done %]
+ [% INCLUDE global/header
+ title = "Bug $bug.bug_id - $bug.short_desc"
+ h1 = "Bugzilla Bug $bug.bug_id"
+ h2 = bug.short_desc
+ extra = navigation_links()
+ %]
+[% END %]
+
+[% PROCESS show/navigate.html.tmpl %]
+
+
+
+
+
+[%# *** Additional Comments *** %]
+
+