summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbuglist.cgi2
-rwxr-xr-xlong_list.cgi105
-rw-r--r--template/en/default/bug/knob.html.tmpl2
-rw-r--r--template/en/default/bug/show-multiple.html.tmpl20
-rw-r--r--template/en/default/global/site-navigation.html.tmpl2
-rw-r--r--template/en/default/list/list.html.tmpl7
6 files changed, 110 insertions, 28 deletions
diff --git a/buglist.cgi b/buglist.cgi
index 9c2632359..2e14c6427 100755
--- a/buglist.cgi
+++ b/buglist.cgi
@@ -863,7 +863,7 @@ if (@bugidlist) {
# Define the variables and functions that will be passed to the UI template.
$vars->{'bugs'} = \@bugs;
-$vars->{'buglist'} = \@bugidlist;
+$vars->{'buglist'} = join(',', @bugidlist);
$vars->{'columns'} = $columns;
$vars->{'displaycolumns'} = \@displaycolumns;
diff --git a/long_list.cgi b/long_list.cgi
index 04758729d..c3abbafcf 100755
--- a/long_list.cgi
+++ b/long_list.cgi
@@ -24,17 +24,108 @@
use strict;
use lib qw(.);
+use Bugzilla;
+
require "CGI.pl";
-our $cgi;
+use vars qw($userid @legal_keywords);
+
+# Use global template variables.
+use vars qw($template $vars);
+
+Bugzilla->login();
+
+GetVersionTable();
+
+my $cgi = Bugzilla->cgi;
+
+my $generic_query = "
+ SELECT
+ bugs.bug_id,
+ COALESCE(bugs.alias, ''),
+ classifications.name,
+ products.name,
+ bugs.version,
+ bugs.rep_platform,
+ bugs.op_sys,
+ bugs.bug_status,
+ bugs.resolution,
+ bugs.priority,
+ bugs.bug_severity,
+ components.name,
+ assign.login_name,
+ report.login_name,
+ bugs.bug_file_loc,
+ bugs.short_desc,
+ bugs.target_milestone,
+ bugs.qa_contact,
+ bugs.status_whiteboard,
+ bugs.keywords,
+ bugs.estimated_time,
+ bugs.remaining_time,
+ date_format(creation_ts,'%Y.%m.%d %H:%i'),
+ date_format(bugs.deadline, '%Y-%m-%d')
+ FROM bugs,profiles assign,profiles report, classifications, products, components
+ WHERE assign.userid = bugs.assigned_to AND report.userid = bugs.reporter
+ AND bugs.product_id=products.id AND bugs.component_id=components.id
+ AND products.classification_id = classifications.id";
+
+my $buglist = $cgi->param('buglist') ||
+ $cgi->param('bug_id') ||
+ $cgi->param('id') || "";
+
+my @bugs;
-# Convert comma/space separated elements into separate params
-my @ids = ();
+foreach my $bug_id (split(/[:,]/, $buglist)) {
+ detaint_natural($bug_id) || next;
+ Bugzilla->user->can_see_bug($bug_id) || next;
+ SendSQL("$generic_query AND bugs.bug_id = $bug_id");
-if (defined $cgi->param('buglist')) {
- @ids = split (/[, ]+/, $cgi->param('buglist'));
+ my %bug;
+ my @row = FetchSQLData();
+
+ foreach my $field ("bug_id", "alias", "classification", "product",
+ "version", "rep_platform",
+ "op_sys", "bug_status", "resolution", "priority",
+ "bug_severity", "component", "assigned_to", "reporter",
+ "bug_file_loc", "short_desc", "target_milestone",
+ "qa_contact", "status_whiteboard", "keywords",
+ "estimated_time", "remaining_time", "creation_ts",
+ "deadline")
+ {
+ $bug{$field} = shift @row;
+ }
+
+ if ($bug{'bug_id'}) {
+ $bug{'comments'} = GetComments($bug{'bug_id'});
+ $bug{'qa_contact'} = $bug{'qa_contact'} > 0 ?
+ DBID_to_name($bug{'qa_contact'}) : "";
+
+ push (@bugs, \%bug);
+ }
+
+ if (UserInGroup(Param("timetrackinggroup"))) {
+ SendSQL("SELECT SUM(work_time) FROM longdescs WHERE bug_id=$bug_id");
+
+ $bug{'actual_time'} = FetchSQLData();
+ }
}
-my $ids = join('', map { $_ = "&id=" . $_ } @ids);
+# Add the list of bug hashes to the variables
+$vars->{'bugs'} = \@bugs;
+
+$vars->{'use_keywords'} = 1 if (@::legal_keywords);
+
+$vars->{'str2time'} = \&str2time;
+
+# Work out a sensible filename for Content-Disposition.
+# Sadly, I don't think we can tell if this was a named query.
+my @time = localtime(time());
+my $date = sprintf "%04d-%02d-%02d", 1900+$time[5],$time[4]+1,$time[3];
+my $filename = "bugs-$date.html";
+
+print $cgi->header(-content_disposition => "inline; filename=$filename");
-print $cgi->redirect("show_bug.cgi?format=multiple$ids");
+# Generate and return the UI (HTML page) from the appropriate template.
+$template->process("bug/show-multiple.html.tmpl", $vars)
+ || ThrowTemplateError($template->error());
diff --git a/template/en/default/bug/knob.html.tmpl b/template/en/default/bug/knob.html.tmpl
index 463132f9f..035db1ae5 100644
--- a/template/en/default/bug/knob.html.tmpl
+++ b/template/en/default/bug/knob.html.tmpl
@@ -168,7 +168,7 @@
<b>
<a href="show_activity.cgi?id=[% bug.bug_id %]">View [% terms.Bug %] Activity</a>
&nbsp; | &nbsp;
- <a href="show_bug.cgi?format=multiple&amp;id=[% bug.bug_id %]">Format For Printing</a>
+ <a href="long_list.cgi?buglist=[% bug.bug_id %]">Format For Printing</a>
</b>
</font>
diff --git a/template/en/default/bug/show-multiple.html.tmpl b/template/en/default/bug/show-multiple.html.tmpl
index 8b42217c1..a57445084 100644
--- a/template/en/default/bug/show-multiple.html.tmpl
+++ b/template/en/default/bug/show-multiple.html.tmpl
@@ -89,19 +89,13 @@
<tr>
[% PROCESS cell attr = { description => "Resolution",
name => "resolution" } %]
- <td>
- <b>Assigned To:</b>&nbsp;
- [% bug.assigned_to.login FILTER html %]
- </td>
- <td>
- <b>Reported By:</b>&nbsp;
- [% bug.reporter.login FILTER html %]
- </td>
+ [% PROCESS cell attr = { description => "Assigned To",
+ name => "assigned_to" } %]
+ [% PROCESS cell attr = { description => "Reported By",
+ name => "reporter" } %]
[% IF Param('useqacontact') %]
- <td>
- <b>QA Contact:</b>&nbsp;
- [% bug.qa_contact.login FILTER html %]
- </td>
+ [% PROCESS cell attr = { description => "QA Contact",
+ name => "qa_contact" } %]
[% END %]
</tr>
@@ -196,7 +190,7 @@
</table>
[% PROCESS bug/comments.html.tmpl
- comments = bug.longdescs %]
+ comments = bug.comments %]
<hr>
[% END %]
diff --git a/template/en/default/global/site-navigation.html.tmpl b/template/en/default/global/site-navigation.html.tmpl
index 66c96a137..95a7ef423 100644
--- a/template/en/default/global/site-navigation.html.tmpl
+++ b/template/en/default/global/site-navigation.html.tmpl
@@ -73,7 +73,7 @@
<link rel="Show" title="[% terms.Bug %] Activity"
href="show_activity.cgi?id=[% bug.bug_id %]">
<link rel="Show" title="Printer-Friendly Version"
- href="show_bug.cgi?format=multiple&amp;id=[% bug.bug_id %]">
+ href="long_list.cgi?buglist=[% bug.bug_id %]">
[% END %]
diff --git a/template/en/default/list/list.html.tmpl b/template/en/default/list/list.html.tmpl
index 24d00feb6..48759ceb7 100644
--- a/template/en/default/list/list.html.tmpl
+++ b/template/en/default/list/list.html.tmpl
@@ -129,11 +129,8 @@
<tr>
[% IF bugs.size > 0 %]
<td valign="middle">
- <form method="post" action="show_bug.cgi">
- [% FOREACH id = buglist %]
- <input type="hidden" name="id" value="[% id FILTER html %]">
- [% END %]
- <input type="hidden" name="format" value="multiple">
+ <form method="post" action="long_list.cgi">
+ <input type="hidden" name="buglist" value="[% buglist %]">
<input type="submit" value="Long Format">
</form>
</td>