]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Italicize the "Additional Comments From" stuff, so that you can tell
authorterry%mozilla.org <>
Sat, 11 Mar 2000 02:01:18 +0000 (02:01 +0000)
committerterry%mozilla.org <>
Sat, 11 Mar 2000 02:01:18 +0000 (02:01 +0000)
the difference between new comments and people copying stuff in from
old comments.

bug_form.pl
globals.pl
long_list.cgi
process_bug.cgi
processmail

index bac65d14c2e96e15af0bab4e4900734a4067abc3..e74f4f4d878914045df1d677744a7dfd0bfeec0c 100644 (file)
@@ -40,89 +40,6 @@ sub bug_form_pl_sillyness {
     $zz = @::legal_severity;
 }
 
-my %knownattachments;
-
-# This routine quoteUrls contains inspirations from the HTML::FromText CPAN
-# module by Gareth Rees <garethr@cre.canon.co.uk>.  It has been heavily hacked,
-# all that is really recognizable from the original is bits of the regular
-# expressions.
-
-sub quoteUrls {
-    my $text = shift;          # Take a copy; don't modify in-place.
-    return $text unless $text;
-
-    my $base = Param('urlbase');
-
-    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
-    $text =~ s/#/%#/g;
-
-    # Next, find anything that looks like a URL or an email address and
-    # pull them out the the text, replacing them with a "##<digits>##
-    # marker, and writing them into an array.  All this confusion is
-    # necessary so that we don't match on something we've already replaced,
-    # which can happen if you do multiple s///g operations.
-
-    my @things;
-    while ($text =~ s%((mailto:)?([\w\.\-\+\=]+\@[\w\-]+(?:\.[\w\-]+)+)\b|
-                    (\b((?:$protocol):[^ \t\n<>"]+[\w/])))%"##$count##"%exo) {
-        my $item = $&;
-
-        $item = value_quote($item);
-
-        if ($item !~ m/^$protocol:/o && $item !~ /^mailto:/) {
-            # We must have grabbed this one because it looks like an email
-            # address.
-            $item = qq{<A HREF="mailto:$item">$item</A>};
-        } else {
-            $item = qq{<A HREF="$item">$item</A>};
-        }
-
-        $things[$count++] = $item;
-    }
-    while ($text =~ s/\bbug(\s|%\#)*(\d+)/"##$count##"/ei) {
-        my $item = $&;
-        my $num = $2;
-        $item = value_quote($item); # Not really necessary, since we know
-                                # there's no special chars in it.
-        $item = qq{<A HREF="show_bug.cgi?id=$num">$item</A>};
-        $things[$count++] = $item;
-    }
-    while ($text =~ s/\*\*\* This bug has been marked as a duplicate of (\d+) \*\*\*/"##$count##"/ei) {
-        my $item = $&;
-        my $num = $1;
-        $item =~ s@\d+@<A HREF="show_bug.cgi?id=$num">$num</A>@;
-        $things[$count++] = $item;
-    }
-    while ($text =~ s/Created an attachment \(id=(\d+)\)/"##$count##"/e) {
-        my $item = $&;
-        my $num = $1;
-        if (exists $knownattachments{$num}) {
-            $item = qq{<A HREF="showattachment.cgi?attach_id=$num">$item</A>};
-        }
-        $things[$count++] = $item;
-    }
-
-    $text = value_quote($text);
-    $text =~ s/\&#010;/\n/g;
-
-    # Stuff everything back from the array.
-    for (my $i=0 ; $i<$count ; $i++) {
-        $text =~ s/##$i##/$things[$i]/e;
-    }
-
-    # And undo the quoting of "#" characters.
-    $text =~ s/%#/#/g;
-
-    return $text;
-}
-
 my $loginok = quietly_check_login();
 
 my $id = $::FORM{'id'};
@@ -208,7 +125,7 @@ print qq{<FORM NAME="changeform" METHOD="POST" ACTION="process_bug.cgi">\n};
 #      print qq{<INPUT TYPE="HIDDEN" NAME="orig-$i" VALUE="$q">\n};
 #  }
 
-$bug{'long_desc'} = GetLongDescription($id);
+$bug{'long_desc'} = GetLongDescriptionAsHTML($id);
 my $longdesclength = length($bug{'long_desc'});
 
 GetVersionTable();
@@ -370,7 +287,6 @@ while (MoreSQLData()) {
     my $link = "showattachment.cgi?attach_id=$attachid";
     $desc = value_quote($desc);
     print qq{<td><a href="$link">$date</a></td><td colspan=4>$desc</td></tr><tr><td></td>};
-    $knownattachments{$attachid} = 1;
 }
 print "<td colspan=6><a href=\"createattachment.cgi?id=$id\">Create a new attachment</a> (proposed patch, testcase, etc.)</td></tr></table>\n";
 
@@ -550,11 +466,9 @@ print "
 <table><tr><td align=left><B>Description:</B></td>
 <td align=right width=100%>Opened: $bug{'creation_ts'}</td></tr></table>
 <HR>
-<PRE>
 ";
-print quoteUrls($bug{'long_desc'}, email=>1, urls=>1);
+print $bug{'long_desc'};
 print "
-</PRE>
 <HR>\n";
 
 # To add back option of editing the long description, insert after the above
index 8e05fc0d27cfc1d1b523e48c1fe6c82cd9bf25e2..954c559719579b94561720fca06c7bb0dcb83cc8 100644 (file)
@@ -562,7 +562,88 @@ sub DBNameToIdAndCheck {
     exit(0);
 }
 
-sub GetLongDescription {
+# This routine quoteUrls contains inspirations from the HTML::FromText CPAN
+# module by Gareth Rees <garethr@cre.canon.co.uk>.  It has been heavily hacked,
+# all that is really recognizable from the original is bits of the regular
+# expressions.
+
+sub quoteUrls {
+    my ($knownattachments, $text) = (@_);
+    return $text unless $text;
+
+    my $base = Param('urlbase');
+
+    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
+    $text =~ s/#/%#/g;
+
+    # Next, find anything that looks like a URL or an email address and
+    # pull them out the the text, replacing them with a "##<digits>##
+    # marker, and writing them into an array.  All this confusion is
+    # necessary so that we don't match on something we've already replaced,
+    # which can happen if you do multiple s///g operations.
+
+    my @things;
+    while ($text =~ s%((mailto:)?([\w\.\-\+\=]+\@[\w\-]+(?:\.[\w\-]+)+)\b|
+                    (\b((?:$protocol):[^ \t\n<>"]+[\w/])))%"##$count##"%exo) {
+        my $item = $&;
+
+        $item = value_quote($item);
+
+        if ($item !~ m/^$protocol:/o && $item !~ /^mailto:/) {
+            # We must have grabbed this one because it looks like an email
+            # address.
+            $item = qq{<A HREF="mailto:$item">$item</A>};
+        } else {
+            $item = qq{<A HREF="$item">$item</A>};
+        }
+
+        $things[$count++] = $item;
+    }
+    while ($text =~ s/\bbug(\s|%\#)*(\d+)/"##$count##"/ei) {
+        my $item = $&;
+        my $num = $2;
+        $item = value_quote($item); # Not really necessary, since we know
+                                    # there's no special chars in it.
+        $item = qq{<A HREF="show_bug.cgi?id=$num">$item</A>};
+        $things[$count++] = $item;
+    }
+    while ($text =~ s/\*\*\* This bug has been marked as a duplicate of (\d+) \*\*\*/"##$count##"/ei) {
+        my $item = $&;
+        my $num = $1;
+        $item =~ s@\d+@<A HREF="show_bug.cgi?id=$num">$num</A>@;
+        $things[$count++] = $item;
+    }
+    while ($text =~ s/Created an attachment \(id=(\d+)\)/"##$count##"/e) {
+        my $item = $&;
+        my $num = $1;
+        if ($knownattachments->{$num}) {
+            $item = qq{<A HREF="showattachment.cgi?attach_id=$num">$item</A>};
+        }
+        $things[$count++] = $item;
+    }
+
+    $text = value_quote($text);
+    $text =~ s/\&#010;/\n/g;
+
+    # Stuff everything back from the array.
+    for (my $i=0 ; $i<$count ; $i++) {
+        $text =~ s/##$i##/$things[$i]/e;
+    }
+
+    # And undo the quoting of "#" characters.
+    $text =~ s/%#/#/g;
+
+    return $text;
+}
+
+sub GetLongDescriptionAsText {
     my ($id, $start, $end) = (@_);
     my $result = "";
     my $count = 0;
@@ -598,6 +679,49 @@ sub GetLongDescription {
 }
 
 
+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.login_name, longdescs.bug_when, " .
+                   "       longdescs.thetext " .
+                   "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
+        # not emit a leading "Addition Comments" line in that case.)
+        $query .= "AND longdescs.bug_when > '$start'";
+        $count = 1;
+    }
+    if ($end) {
+        $query .= "AND longdescs.bug_when <= '$end'";
+    }
+
+    $query .= "ORDER BY longdescs.bug_when";
+    SendSQL($query);
+    while (MoreSQLData()) {
+        my ($who, $when, $text) = (FetchSQLData());
+        if ($count) {
+            $result .= "<BR><BR><I>------- Additional Comments From " .
+                qq{<A HREF="$who">$who</A> } .
+                    time2str("%Y-%m-%d %H:%M", str2time($when)) .
+                        " -------</I><BR>\n";
+        }
+        $result .= "<PRE>" . quoteUrls(\%knownattachments, $text) . "</PRE>\n";
+        $count++;
+    }
+
+    return $result;
+}
+
 sub ShowCcList {
     my ($num) = (@_);
     my @ccids;
index 9b9f47d878c2efd3e0571c27473af849e32c6a15..e095c59ec8790f8f659b20eea27c0333cdc1c7d7 100755 (executable)
@@ -116,7 +116,7 @@ foreach my $bug (split(/:/, $::FORM{'buglist'})) {
                 html_quote($status_whiteboard) . "\n";
         }
         print "<TR><TD><B>Description:</B>\n</TABLE>\n";
-        print "<PRE>" . html_quote(GetLongDescription($bug)) . "</PRE>\n";
+        print GetLongDescriptionAsHTML($bug);
         print "<HR>\n";
     }
 }
index 0e11f16cc59a098ce0709c9c84719785a4ec6b16..ac8f1a3957084ae13ff625926ee0694fa74e6b8f 100755 (executable)
@@ -609,14 +609,14 @@ The changes made were:
 <p>
 ";
         DumpBugActivity($id, $delta_ts);
-        my $longdesc = GetLongDescription($id);
+        my $longdesc = GetLongDescriptionAsHTML($id);
         my $longchanged = 0;
 
         if (length($longdesc) > $::FORM{'longdesclength'}) {
             $longchanged = 1;
-            print "<P>Added text to the long description:<blockquote><pre>";
-            print html_quote(substr($longdesc, $::FORM{'longdesclength'}));
-            print "</pre></blockquote>\n";
+            print "<P>Added text to the long description:<blockquote>";
+            print substr($longdesc, $::FORM{'longdesclength'});
+            print "</blockquote>\n";
         }
         SendSQL("unlock tables");
         print "You have the following choices: <ul>\n";
index 618c6dbc151b555cef53cb79645681aadc37bfa5..9b9baa4ddf7332c026896c3cd6a55d4aa9d6e5f8 100755 (executable)
@@ -199,7 +199,7 @@ sub GetBugText {
         $status_whiteboard = "StatusWhiteboard: $::bug{'status_whiteboard'}\n";
     }
 
-    $::bug{'long_desc'} = GetLongDescription($id);
+    $::bug{'long_desc'} = GetLongDescriptionAsText($id);
 
     my @cclist;
     @cclist = split(/,/, ShowCcList($id));
@@ -455,7 +455,7 @@ sub NewProcessOneBug {
     }
 
 
-    my $newcomments = GetLongDescription($id, $start, $end);
+    my $newcomments = GetLongDescriptionAsText($id, $start, $end);
 
     my $count = 0;
     for my $person ($values{'assigned_to'}, $values{'reporter'},