[Rt-commit] r13013 - in rt/branches/3.8-TESTING: .
jesse at bestpractical.com
jesse at bestpractical.com
Sat Jun 7 01:11:15 EDT 2008
Author: jesse
Date: Sat Jun 7 01:11:13 2008
New Revision: 13013
Modified:
rt/branches/3.8-TESTING/ (props changed)
rt/branches/3.8-TESTING/share/html/Elements/CollectionAsTable/Row
Log:
r32435 at 31b: jesse | 2008-06-07 01:01:25 -0400
* Actually use styles from subelements when rendering lists
Modified: rt/branches/3.8-TESTING/share/html/Elements/CollectionAsTable/Row
==============================================================================
--- rt/branches/3.8-TESTING/share/html/Elements/CollectionAsTable/Row (original)
+++ rt/branches/3.8-TESTING/share/html/Elements/CollectionAsTable/Row Sat Jun 7 01:11:13 2008
@@ -56,41 +56,55 @@
$Class => 'RT__Ticket'
</%ARGS>
<%init>
-$m->out('<tr class="' . ( $Warning ? 'warnline' : $i % 2 ? 'oddline' : 'evenline' ) . '" >' . "\n" );
+$m->out( '<tr class="'
+ . ( $Warning ? 'warnline' : $i % 2 ? 'oddline' : 'evenline' ) . '" >'
+ . "\n" );
use HTML::Entities;
my $item;
-foreach my $column ( @Format ) {
+foreach my $column (@Format) {
if ( defined $column->{title} && $column->{title} eq 'NEWLINE' ) {
while ( $item < $maxitems ) {
$m->out(qq{<td class="collection-as-table"> </td>\n});
$item++;
}
$item = 0;
- $m->out('</tr>' . "\n");
- $m->out('<tr class="'
- . ( $Warning ? 'warnline' : $i % 2 ? 'oddline' : 'evenline' )
- . '" >' . "\n" );
+ $m->out( '</tr>' . "\n" );
+ $m->out( '<tr class="'
+ . ( $Warning ? 'warnline' : $i % 2 ? 'oddline' : 'evenline' )
+ . '" >'
+ . "\n" );
next;
}
$item++;
- my $class = $column->{class}
- ? encode_entities($column->{class}, q{'"&<>})
- : 'collection-as-table';
+ my $class = $column->{class} ? encode_entities( $column->{class}, q{'"&<>} ) : 'collection-as-table';
$m->out(qq{<td class="$class" });
- $m->out( 'align="' . $column->{align} . '"' ) if $column->{align};
- $m->out( 'style="' . $column->{style} . '"' ) if $column->{style};
- $m->out('>');
+ my $align = $column->{align};
+ my $style = $column->{style};
+
+ my @out;
foreach my $subcol ( @{ $column->{output} } ) {
unless ( $subcol =~ /^__(.*?)__$/ ) {
- $m->out( $subcol );
+ push @out, $subcol;
next;
}
my $col = $1;
- unless ( exists $ColumnMap->{ $col } ) {
- $ColumnMap->{ $col } = $m->comp(
+ $style = $m->comp(
+ "/Elements/ColumnMap",
+ Class => $Class,
+ Name => $col,
+ Attr => 'style'
+ );
+ $align = $m->comp(
+ "/Elements/ColumnMap",
+ Class => $Class,
+ Name => $col,
+ Attr => 'align'
+ );
+ unless ( exists $ColumnMap->{$col} ) {
+ $ColumnMap->{$col} = $m->comp(
"/Elements/ColumnMap",
Class => $Class,
Name => $col,
@@ -98,27 +112,28 @@
);
}
- my $value = $ColumnMap->{ $col };
- my @out;
+ my $value = $ColumnMap->{$col};
if ( ref $value ) {
# All HTML snippets are returned by the callback function
# as scalar references. Data fetched from the objects are
# plain scalars, and needs to be escaped properly.
- @out = grep defined && length, map {
- ref($_) ? $$_ : $m->interp->apply_escapes( $_ => 'h' )
- } $value->( $record, $i );
- }
- elsif ( defined $value && length $value ) {
+ push @out, grep defined && length,
+ map { ref($_) ? $$_ : $m->interp->apply_escapes( $_ => 'h' ) }
+ $value->( $record, $i );
+ } elsif ( defined $value && length $value ) {
# Simple value; just escape it.
- @out = $m->interp->apply_escapes( $value => 'h' );
+ push @out, $m->interp->apply_escapes( $value => 'h' );
}
s/\n/<br \/>/gs for @out;
- $m->out( @out ) if @out;
}
- $m->out('</td>' . "\n");
+ $m->out( 'align="' . $align . '"' ) if $align;
+ $m->out( 'style="' . $style . '"' ) if $style;
+ $m->out('>');
+ $m->out(@out) if @out;
+ $m->out( '</td>' . "\n" );
}
$m->out('</tr>');
</%init>
More information about the Rt-commit
mailing list