Small patch to support multi-column fields in tables

Hi,

Below is a small patch against 3.8.1 to the /Elements/CollectionAsTable
components that adds support for a /SPAN:X directive in the formatting
which translates into a colspan=“X” element in the table definition.

Works a treat; allows me to have ‘Subject’ span multiple columns in a
multi-row table definition.
Can’t see any immediate reason it would cause problems. Anyone?

Thanks,

Olly

Index: share/html/Elements/CollectionAsTable/ParseFormat
— share/html/Elements/CollectionAsTable/ParseFormat (revision 6284)
+++ share/html/Elements/CollectionAsTable/ParseFormat (working copy)
@@ -77,6 +77,9 @@
if ( $col =~ s!/ALIGN:([^/]+)!!io ) {
$colref->{‘align’} = $1;
}

  • if ( $col =~ s!/SPAN:([^/]+)!!io ) {
  •    $colref->{'span'} = $1;
    
  • }
    if ( $col =~ /(.*?)/io ) {
    my @subcols;
    while ( $col =~ s/^(.?)__(.?)__//o ) {
    Index: share/html/Elements/CollectionAsTable/Row
    — share/html/Elements/CollectionAsTable/Row (revision 6284)
    +++ share/html/Elements/CollectionAsTable/Row (working copy)
    @@ -76,13 +76,15 @@
    next;
    }
  • $item++;
    my $class = $column->{class} ? encode_entities( $column->{class},
    q{’"&<>} ) : ‘collection-as-table’;
    $m->out(qq{<td class="$class" });

    my $align = $column->{align};
    my $style = $column->{style};

  • my $span = $column->{span};

  • $item += ($span || 1);
    my @out;
    foreach my $subcol ( @{ $column->{output} } ) {
    unless ( $subcol =~ /^(.*?)$/ ) {
    @@ -131,6 +133,7 @@
    }
    $m->out( ‘align="’ . $align . ‘"’ ) if $align;
    $m->out( ‘style="’ . $style . ‘"’ ) if $style;

  • $m->out( ‘colspan="’ . $span . ‘"’ ) if $span;
    $m->out(’>’);
    $m->out(@out) if @out;
    $m->out( ‘’ . “\n” );
    Index: share/html/Elements/CollectionAsTable/Header
    — share/html/Elements/CollectionAsTable/Header (revision 6284)
    +++ share/html/Elements/CollectionAsTable/Header (working copy)
    @@ -87,9 +87,12 @@
    next;
    }

  • $item++;
  • my $span = $col->{‘span’};
  • $item += ($span || 1);
  • $m->out(’’);
    • $m->out(’<th class=“collection-as-table”’);

    • $m->out(’ colspan="’ . $span . ‘"’) if $span;

    • $m->out(’>’);

      $title =~ s/^(.*)$/$1/o;
      my $tmp = $m->comp( ‘/Elements/ColumnMap’,

    IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.

    rt-multicolumn-diff.txt (2.09 KB)