diff options
| author | Mark Wells <mark@freeside.biz> | 2015-07-10 18:15:08 -0700 |
|---|---|---|
| committer | Mark Wells <mark@freeside.biz> | 2015-07-10 18:15:08 -0700 |
| commit | 88bf5db0cca989c51237c661a13078eef08b3674 (patch) | |
| tree | 0a84e1b5e7fd239f57fab678bf40c5311b0064a0 /rt/share/html/Elements/CollectionAsTable/Header | |
| parent | 9c15ffe3a5ee987e30e10c6a0ad1b5bf0b2a12e3 (diff) | |
| parent | e7eb845db1afab1cbdbc34ff9c387c5ac554659e (diff) | |
Merge branch 'FREESIDE_4_BRANCH' of git.freeside.biz:/home/git/freeside into 4.x
Diffstat (limited to 'rt/share/html/Elements/CollectionAsTable/Header')
| -rw-r--r-- | rt/share/html/Elements/CollectionAsTable/Header | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/rt/share/html/Elements/CollectionAsTable/Header b/rt/share/html/Elements/CollectionAsTable/Header index c9116ade6..a1c5c482e 100644 --- a/rt/share/html/Elements/CollectionAsTable/Header +++ b/rt/share/html/Elements/CollectionAsTable/Header @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2014 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2015 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -71,6 +71,8 @@ $generic_query_args->{'Format'} = $FormatString if grep $_ eq 'Format', @PassArg my $item = 0; foreach my $col ( @Format ) { + my $attr = $col->{'attribute'} || $col->{'last_attribute'}; + my $title = $col->{'title'} || ''; if ( $title eq 'NEWLINE' ) { while ( $item < $maxitems ) { @@ -93,12 +95,22 @@ foreach my $col ( @Format ) { $m->out('<th class="collection-as-table"'); $m->out(' colspan="' . $m->interp->apply_escapes($span => 'h') . '"') if $span; + + my $align = $col->{'align'} || do { + my $tmp_columnmap = $m->comp( '/Elements/ColumnMap', + Class => $Class, + Name => $attr, + Attr => 'align', + ); + ProcessColumnMapValue( $tmp_columnmap, Arguments => [ $attr ] ); + }; + $m->out(qq{ style="text-align: $align"}) if $align; $m->out('>'); + my $loc_title; # if title is not defined then use defined attribute or last # one we saw in the format unless ( defined $col->{'title'} ) { - my $attr = $col->{'attribute'} || $col->{'last_attribute'}; my $tmp = $m->comp( '/Elements/ColumnMap', Class => $Class, Name => $attr, @@ -109,8 +121,9 @@ foreach my $col ( @Format ) { # in case title is not defined in ColumnMap # the following regex changes $attr like from "ReferredToBy" to "Referred To By" $title = join ' ', split /(?<=[a-z])(?=[A-Z])/, $attr unless defined $title; + $loc_title = $attr =~ /^(?:CustomField|CF)\./ ? $title : loc($title); } else { - $title = $m->comp('/Elements/ScrubHTML', Content => $title); + $loc_title = loc($m->comp('/Elements/ScrubHTML', Content => $title)); } if ( $AllowSorting and $col->{'attribute'} @@ -134,11 +147,11 @@ foreach my $col ( @Format ) { %$generic_query_args, OrderBy => $attr, Order => $new_order ), 'h') - . '">'. loc($title) .'</a>' + . '">'. $loc_title .'</a>' ); } else { - $m->out( loc($title) ); + $m->out( $loc_title ); } $m->out('</th>'); } |
