summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjustdave%syndicomm.com <>2001-10-11 11:17:56 +0200
committerjustdave%syndicomm.com <>2001-10-11 11:17:56 +0200
commit7279d56bac905f63a3091caeeb40299897340c44 (patch)
tree4d60b178a294559a63a142b4e57ae85fccc4e324
parent5f1c5bfa51412d1a742bb72830b59aea25aca948 (diff)
downloadbugzilla-7279d56bac905f63a3091caeeb40299897340c44.tar.gz
bugzilla-7279d56bac905f63a3091caeeb40299897340c44.tar.xz
Fix for bug 97784: comments in attachment update form are now properly word-wrapped. This is a server-side implementation to
do the word-wrapping, which will probably eventually be used in the main comments area on the bug form as well. Patch by Myk Melez <myk@mozilla.org> r= gerv, justdave
-rwxr-xr-xattachment.cgi19
-rwxr-xr-xtemplate/default/attachment/edit.atml4
2 files changed, 20 insertions, 3 deletions
diff --git a/attachment.cgi b/attachment.cgi
index 9308b1d73..8fcac0b88 100755
--- a/attachment.cgi
+++ b/attachment.cgi
@@ -478,17 +478,34 @@ sub update
# add the comment to the bug.
if ( $::FORM{'comment'} )
{
+ use Text::Wrap;
+ $Text::Wrap::columns = 80;
+ $Text::Wrap::huge = 'wrap';
+
# Append a string to the comment to let users know that the comment came from
# the "edit attachment" screen.
my $comment = qq|(From update of attachment $::FORM{'id'})\n| . $::FORM{'comment'};
+ my $wrappedcomment = "";
+ foreach my $line (split(/\r\n|\r|\n/, $comment))
+ {
+ if ( $line =~ /^>/ )
+ {
+ $wrappedcomment .= $line . "\n";
+ }
+ else
+ {
+ $wrappedcomment .= wrap('', '', $line) . "\n";
+ }
+ }
+
# Get the user's login name since the AppendComment function needs it.
my $who = DBID_to_name($::userid);
# Mention $::userid again so Perl doesn't give me a warning about it.
my $neverused = $::userid;
# Append the comment to the list of comments in the database.
- AppendComment($bugid, $who, $comment);
+ AppendComment($bugid, $who, $wrappedcomment);
}
diff --git a/template/default/attachment/edit.atml b/template/default/attachment/edit.atml
index e1fc3e035..5981a692f 100755
--- a/template/default/attachment/edit.atml
+++ b/template/default/attachment/edit.atml
@@ -26,7 +26,7 @@
<td width="25%">
<small>
<b>Description:</b><br>
- <textarea rows="3" cols="25" name="description">[% description %]</textarea><br>
+ <textarea rows="3" cols="25" name="description" wrap="soft">[% description %]</textarea><br>
<b>MIME Type:</b><br>
<input type="text" size="20" name="mimetype" value="[% mimetype %]"><br>
@@ -44,7 +44,7 @@
<div id="smallCommentFrame">
<b>Comment (on the bug):</b><br>
- <textarea name="comment" rows="5" cols="25"></textarea><br>
+ <textarea name="comment" rows="5" cols="25" wrap="soft"></textarea><br>
</div>
<input type="submit" value="Submit">