X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=rt%2Fshare%2Fhtml%2FElements%2FCollectionAsTable%2FHeader;h=4a2576858ce41cdedf4c9dbd37ae90b59d6a903f;hb=01721976fa3324f41a3093cda68bc38a7eec5ff5;hp=878a77e703adbc89ab608f27e0d9cc94356935fe;hpb=fc6209f398899f0211cfcedeb81a3cd65e04a941;p=freeside.git diff --git a/rt/share/html/Elements/CollectionAsTable/Header b/rt/share/html/Elements/CollectionAsTable/Header index 878a77e70..4a2576858 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-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2017 Best Practical Solutions, LLC %# %# %# (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('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'} @@ -126,19 +139,19 @@ foreach my $col ( @Format ) { my $new_order = 'ASC'; $new_order = $Order[0] eq 'ASC'? 'DESC': 'ASC' - if $OrderBy[0] && $OrderBy[0] eq $attr; + if $OrderBy[0] && ($OrderBy[0] eq $attr or "$attr|$OrderBy[0]" =~ /^(Created|id)\|(Created|id)$/); $m->out( - 'interp->apply_escapes($BaseURL . $m->comp( '/Elements/QueryString', %$generic_query_args, OrderBy => $attr, Order => $new_order - ) - . '">'. loc($title) .'' + ), 'h') + . '">'. $loc_title .'' ); } else { - $m->out( loc($title) ); + $m->out( $loc_title ); } $m->out(''); }