OpenPKG CVS Repository
http://cvs.openpkg.org/
____________________________________________________________________________
Server: cvs.openpkg.org Name: Michael van Elst
Root: /e/openpkg/cvs Email: [EMAIL PROTECTED]
Module: openpkg-src Date: 06-Aug-2003 13:49:43
Branch: HEAD Handle: 2003080612494300
Modified files:
openpkg-src/rt rt.patch
Log:
better line wrap, handle encoding errors gracefully
Summary:
Revision Changes Path
1.14 +38 -22 openpkg-src/rt/rt.patch
____________________________________________________________________________
patch -p0 <<'@@ .'
Index: openpkg-src/rt/rt.patch
============================================================================
$ cvs diff -u -r1.13 -r1.14 rt.patch
--- openpkg-src/rt/rt.patch 6 Aug 2003 10:02:04 -0000 1.13
+++ openpkg-src/rt/rt.patch 6 Aug 2003 11:49:43 -0000 1.14
@@ -18,8 +18,8 @@
return ( 0, $self->loc('Could not create user') );
}
--- html/Ticket/Elements/ShowMessageStanza.dist 2003-08-05 16:21:42.000000000
+0200
-+++ html/Ticket/Elements/ShowMessageStanza 2003-08-06 11:49:29.000000000 +0200
-@@ -22,23 +22,44 @@
++++ html/Ticket/Elements/ShowMessageStanza 2003-08-06 13:44:18.000000000 +0200
+@@ -22,23 +22,47 @@
%#
%# END LICENSE BLOCK
<%perl>
@@ -30,9 +30,26 @@
- Transaction => $Transaction,
- Message => $stanza );
+ { my $msg='';
++ my $wrapfunc = sub {
++ my $max = 0;
++ foreach ( split ( /\n/, $_[0] ) ) {
++ $max = length if length > $max;
++ }
++ if ( $max > 76 ) {
++ require Text::Wrapper;
++ my $wrapper = new Text::Wrapper(
++ columns => 70,
++ body_start => ( $max > 70 * 3 ? ' ' : '' ),
++ par_start => '');
++ $_[0] = $wrapper->wrap($_[0]);
++ }
++ RT::Interface::Web::EscapeUTF8(\$_[0]);
++ $m->comp('/Elements/Callback', content => \$_[0], %ARGS);
++ };
+ foreach my $stanza (@$Message) {
+ if ( ref $stanza eq "ARRAY" ) {
+ if ($msg ne '') {
++ $wrapfunc->($msg);
+</%perl>
+<font color="<%$colors[$Depth]%>"><pre><%$msg |n%></pre></font>
+<%perl>
@@ -44,22 +61,7 @@
+ Message => $stanza );
+ }
+ elsif ( ref $stanza eq "HASH" ) {
-+ my $content = $stanza->{raw};
-+ RT::Interface::Web::EscapeUTF8(\$content);
-+ $m->comp('/Elements/Callback', content => \$content, %ARGS);
-+ my $max = 0;
-+ foreach ( split ( /\n/, $content ) ) {
-+ $max = length if length > $max;
-+ }
-+ if ( $max > 76 ) {
-+ require Text::Wrapper;
-+ my $wrapper = new Text::Wrapper(
-+ columns => 70,
-+ body_start => ( $max > 70 * 3 ? ' ' : '' ),
-+ par_start => '');
-+ $content = $wrapper->wrap($content);
-+ }
-+ $msg .= "$content\n";
++ $mst .= "$stanza->{raw}\n";
+ }
}
- elsif ( ref $stanza eq "HASH" ) {
@@ -68,14 +70,15 @@
- $m->comp('/Elements/Callback', content => \$content, %ARGS);
- $content =~ s/\n/<br>/gi;
-
++ $wrapfunc->($msg);
++</%perl>
++<font color="<%$colors[$Depth]%>"><pre><%$msg |n%></pre></font>
++<%perl>
++ }
</%perl>
-<font color="<%$colors[$Depth]%>"><%$content |n%><br></font>
-% }
-% }
-+<font color="<%$colors[$Depth]%>"><pre><%$msg |n%></pre></font>
-+<%perl>
-+ }
-+</%perl>
<%INIT>
use URI::URL;
my $server = 'fsck.com';
@@ -118,3 +121,16 @@
<%ARGS>
$user => ""
$pass => undef
+--- lib/RT/Attachment_Overlay.pm.dist 2003-08-06 13:01:15.000000000 +0200
++++ lib/RT/Attachment_Overlay.pm 2003-08-06 13:01:32.000000000 +0200
+@@ -313,7 +313,9 @@
+ # If we somehow fail to do the decode, at least push out the raw bits
+ eval {return( Encode::decode_utf8($content))} || return ($content);
+ }
+- Encode::from_to($content, 'utf8' => $enc);
++ if (!$enc) {
++ eval {Encode::from_to($content, 'utf8' => $enc);}
++ }
+ return $content;
+ }
+
@@ .
______________________________________________________________________
The OpenPKG Project www.openpkg.org
CVS Repository Commit List [EMAIL PROTECTED]