X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=rt%2Fhtml%2FTicket%2FElements%2FShowMessageHeaders;h=40b5c84554585bfaafcbb48b2f812aa1ba13b8d4;hp=8dc76bae3dcafdeeb3b2c0e81499f31707dc064c;hb=75162bb14b3e38d66617077843f4dfdcaf09d5c4;hpb=d4d0590bef31071e8809ec046717444b95b3f30a diff --git a/rt/html/Ticket/Elements/ShowMessageHeaders b/rt/html/Ticket/Elements/ShowMessageHeaders index 8dc76bae3..40b5c8455 100644 --- a/rt/html/Ticket/Elements/ShowMessageHeaders +++ b/rt/html/Ticket/Elements/ShowMessageHeaders @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC %# %# %# (Except where explicitly superseded by other copyright notices) @@ -22,7 +22,9 @@ %# %# You should have received a copy of the GNU General Public License %# along with this program; if not, write to the Free Software -%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +%# 02110-1301 or visit their web page on the internet at +%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html. %# %# %# CONTRIBUTION SUBMISSION POLICY: @@ -43,14 +45,15 @@ %# those contributions and any derivatives thereof. %# %# END BPS TAGGED BLOCK }}} -% use Data::Dumper; % foreach my $header (@headers) { -% next unless ($display_headers{'_all'} || $display_headers{lc($header->{'Tag'})}); - - - - +% next unless $display_headers{_all} +% or ($display_headers{ lc $header->{Tag} } +% and length $header->{Value}); + + + + % }
<%$header->{'Tag'}%>:<%$header->{'Value'} | n%>
<%$header->{'Tag'}%>:<%$header->{'Value'} | n%>
<%INIT> @@ -61,23 +64,24 @@ $m->comp('/Elements/Callback', content => \$content, %ARGS); # we'll display the value without escaping later (for MakeClicky et al.) $content = $m->interp->apply_escapes($content, 'h'); -my @lines = split (/\n/,$content); +my @lines = split /\n/, $content; my $in_header = 0; -my @headers =(); -foreach (@lines) { +my @headers; + +for (@lines) { if (/^(\S+):\s+(.*)$/) { - push (@headers, { Tag => $1, Value => $2} ); - } elsif ($headers[-1]) { + push @headers, { Tag => $1, Value => $2 }; + } + elsif (/^\s+/) { $headers[-1]->{'Value'} .= $_; - } else { - - push (@headers, { Tag => $_, Value => ''} ); + } + else { + s/:$//; + push @headers, { Tag => $_, Value => '' }; } } -my %display_headers; - -map { $display_headers{lc($_)} = 1 } @$DisplayHeaders; +my %display_headers = map { lc($_) => 1 } @$DisplayHeaders; $m->comp('/Elements/Callback', _CallbackName => 'Headers', content => \$content, headers => \@headers, display_headers => \%display_headers, %ARGS);