From: gerv%gerv.net <>
Date: Wed, 20 Feb 2002 07:22:24 +0000 (+0000)
Subject: Bug 115369 - templatise long_list.cgi.
X-Git-Tag: bugzilla-2.16rc1~216
X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=05a0b649b38a3f81cebeb2b0851b3c43fe5f646e;p=thirdparty%2Fbugzilla.git
Bug 115369 - templatise long_list.cgi.
---
diff --git a/globals.pl b/globals.pl
index a1acb5a797..13b925e642 100644
--- a/globals.pl
+++ b/globals.pl
@@ -986,7 +986,7 @@ sub detaint_natural {
# expressions.
sub quoteUrls {
- my ($knownattachments, $text) = (@_);
+ my ($text) = (@_);
return $text unless $text;
my $base = Param('urlbase');
@@ -994,8 +994,6 @@ sub quoteUrls {
my $protocol = join '|',
qw(afs cid ftp gopher http https mid news nntp prospero telnet wais);
- my %options = ( metachars => 1, @_ );
-
my $count = 0;
# Now, quote any "#" characters so they won't confuse stuff later
@@ -1046,9 +1044,9 @@ sub quoteUrls {
$item = GetBugLink($num, $item);
$things[$count++] = $item;
}
- while ($text =~ s/\battachment(\s|%\#)*(\d+)/"##$count##"/ei) {
+ while ($text =~ s/\b(Created an )?attachment(\s|%\#)*(\(id=)?(\d+)\)?/"##$count##"/ei) {
my $item = $&;
- my $num = $2;
+ my $num = $4;
$item = value_quote($item); # Not really necessary, since we know
# there's no special chars in it.
$item = qq{$item};
@@ -1062,14 +1060,6 @@ sub quoteUrls {
$item =~ s@\d+@$bug_link@;
$things[$count++] = $item;
}
- while ($text =~ s/Created an attachment \(id=(\d+)\)/"##$count##"/e) {
- my $item = $&;
- my $num = $1;
- if ($knownattachments->{$num}) {
- $item = qq{$item};
- }
- $things[$count++] = $item;
- }
$text = value_quote($text);
$text =~ s/\
/\n/g;
@@ -1155,9 +1145,9 @@ sub GetLongDescriptionAsText {
my $count = 0;
my ($query) = ("SELECT profiles.login_name, longdescs.bug_when, " .
" longdescs.thetext " .
- "FROM longdescs, profiles " .
- "WHERE profiles.userid = longdescs.who " .
- " AND longdescs.bug_id = $id ");
+ "FROM longdescs, profiles " .
+ "WHERE profiles.userid = longdescs.who " .
+ "AND longdescs.bug_id = $id ");
if ($start && $start =~ /[1-9]/) {
# If the start is all zeros, then don't do this (because we want to
@@ -1189,11 +1179,6 @@ sub GetLongDescriptionAsHTML {
my ($id, $start, $end) = (@_);
my $result = "";
my $count = 0;
- my %knownattachments;
- SendSQL("SELECT attach_id FROM attachments WHERE bug_id = $id");
- while (MoreSQLData()) {
- $knownattachments{FetchOneColumn()} = 1;
- }
my ($query) = ("SELECT profiles.realname, profiles.login_name, longdescs.bug_when, " .
" longdescs.thetext " .
@@ -1226,13 +1211,40 @@ sub GetLongDescriptionAsHTML {
$result .= time2str("%Y-%m-%d %H:%M", str2time($when)) . " -------
\n";
}
- $result .= "
" . quoteUrls(\%knownattachments, $text) . "\n"; + $result .= "
" . quoteUrls($text) . "\n"; $count++; } return $result; } + +sub GetComments { + my ($id) = (@_); + my @comments; + + SendSQL("SELECT profiles.realname, profiles.login_name, + date_format(longdescs.bug_when,'%Y-%m-%d %H:%i'), + longdescs.thetext + FROM longdescs, profiles + WHERE profiles.userid = longdescs.who + AND longdescs.bug_id = $id + ORDER BY longdescs.bug_when"); + + while (MoreSQLData()) { + my %comment; + ($comment{'name'}, $comment{'email'}, $comment{'time'}, $comment{'body'}) = FetchSQLData(); + + $comment{'email'} .= Param('emailsuffix'); + $comment{'name'} = $comment{'name'} || $comment{'email'}; + + push (@comments, \%comment); + } + + return \@comments; +} + + # Fills in a hashtable with info about the columns for the given table in the # database. The hashtable has the following entries: # -list- the list of column names diff --git a/long_list.cgi b/long_list.cgi index 552457b062..b25c10ebf7 100755 --- a/long_list.cgi +++ b/long_list.cgi @@ -19,111 +19,99 @@ # Rights Reserved. # # Contributor(s): Terry Weissman
Bug#: $id\n"; - print " | Product: $product\n"; - print " | Version: $version\n"; - print " | Platform: $platform\n"; - print " | |||
OS/Version: $opsys\n"; - print " | Status: $status\n"; - print " | Severity: $severity\n"; - print " | Priority: $priority\n"; - print " | |||
Resolution: $resolution | \n"; - print "Assigned To: $assigned\n"; - print " | Reported By: $reporter\n"; - if (Param("useqacontact")) { - my $name = ""; - if ($qa_contact > 0) { - $name = DBID_to_name($qa_contact); - } - print " | QA Contact: $name\n"; - } - print " | |||
Component: $component\n"; - if (Param("usetargetmilestone")) { - print " | Target Milestone: $target_milestone\n"; - } - print " | |||||
URL: "; - print "" . html_quote($url) . "\n"; - print " | ||||||
Summary: " . html_quote($shortdesc) . "\n"; - if (@::legal_keywords) { - print " | ||||||
Keywords: $keywords | ||||||
Status Whiteboard:" .
- html_quote($status_whiteboard) . "\n";
- }
- print "Description:\n | |