Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 078fa02a

Von Moritz Bunkus vor mehr als 16 Jahren hinzugefügt

  • ID 078fa02aa17feb2560a76b54a9c98c8c98957de5
  • Vorgänger 1756e2a2
  • Nachfolger 62311126

ReportGenerator: Unterstützung für das Verbinden von Zellen mittels "colspan" für HTML- und CSV-Ausgabe.

Unterschiede anzeigen:

SL/ReportGenerator.pm
322 322
    foreach my $row (@{ $row_set }) {
323 323
      $inner_idx++;
324 324

  
325
      my $output_columns = [ ];
326
      my $skip_next      = 0;
325 327
      foreach my $col_name (@visible_columns) {
328
        if ($skip_next) {
329
          $skip_next--;
330
          next;
331
        }
332

  
326 333
        my $col = $row->{$col_name};
327 334
        $col->{CELL_ROWS} = [ ];
328 335
        foreach my $i (0 .. scalar(@{ $col->{data} }) - 1) {
......
339 346
        } elsif ((1 == scalar @{ $col->{CELL_ROWS} }) && (!defined $col->{CELL_ROWS}->[0]->{data} || ($col->{CELL_ROWS}->[0]->{data} eq ''))) {
340 347
          $col->{CELL_ROWS}->[0]->{data} = ' ';
341 348
        }
349

  
350
        push @{ $output_columns }, $col;
351
        $skip_next = $col->{colspan} ? $col->{colspan} - 1 : 0;
342 352
      }
343 353

  
344 354
      my $row_data = {
345
        'COLUMNS'       => [ map { $row->{$_} } @visible_columns ],
355
        'COLUMNS'       => $output_columns,
346 356
        'outer_idx'     => $outer_idx,
347 357
        'outer_idx_odd' => $outer_idx % 2,
348 358
        'inner_idx'     => $inner_idx,
......
696 706
      $csv->print($stdout, [ map { $self->unescape_string($self->{columns}->{$_}->{text}) } @visible_columns ]);
697 707

  
698 708
    } else {
699
      foreach my $custom_header_row (@{ $self->{custom_headers} }) {
700
        $csv->print($stdout, [ map { $self->unescape_string($_->{text}) } @{ $custom_header_row } ]);
709
      foreach my $row (@{ $self->{custom_headers} }) {
710
        my $fields    = [ ];
711
        my $skip_next = 0;
712

  
713
        foreach my $col (@{ $row }) {
714
          my $num_output = ($col->{colspan} && ($col->{colspan} > 1)) ? $col->{colspan} : 1;
715
          push @{ $fields }, ($self->unescape_string($col->{text})) x $num_output;
716
        }
717

  
718
        $csv->print($stdout, $fields);
701 719
      }
702 720
    }
703 721
  }
......
706 724
    next if ('ARRAY' ne ref $row_set);
707 725
    foreach my $row (@{ $row_set }) {
708 726
      my @data;
727
      my $skip_next = 0;
709 728
      foreach my $col (@visible_columns) {
729
        if ($skip_next) {
730
          $skip_next--;
731
          next;
732
        }
733

  
734
        my $num_output = ($col->{colspan} && ($col->{colspan} > 1)) ? $col->{colspan} : 1;
735
        $skip_next     = $num_output - 1;
736

  
710 737
        push @data, join($eol, map { s/\r?\n/$eol/g; $_ } @{ $row->{$col}->{data} });
738
        push @data, ('') x $skip_next if ($skip_next);
711 739
      }
740

  
712 741
      $csv->print($stdout, \@data);
713 742
    }
714 743
  }
templates/webpages/report_generator/html_report_de.html
41 41
   [%- FOREACH row = HEADER_ROWS %]
42 42
   <tr>
43 43
    [% FOREACH col = row %]
44
     <th class="listheading">
44
     <th class="listheading"
45
     [%- IF col.align %] align="[% HTML.escape(col.align) %]"[% END -%]
46
     [%- IF col.colspan && col.colspan > 1 %] colspan="[% HTML.escape(col.colspan) %]"[% END -%]
47
     >
45 48
      [%- IF col.link -%]<a href="[% col.link %]">[%- END -%]
46 49
      [%- col.text -%]
47 50
      [%- IF col.show_sort_indicator -%]<img border="0" src="image/[% IF col.sort_indicator_direction %]down[% ELSE %]up[% END %].png">[%- END -%]
......
59 62
      [%- FOREACH col = row.COLUMNS %]
60 63
      <td[% IF col.align %] align="[% col.align %]"[% END %]
61 64
         [%- IF col.valign %] valign="[% col.valign %]"[%- END %]
65
         [%- IF col.colspan && col.colspan > 1 %] colspan="[% HTML.escape(col.colspan) %]"[% END -%]
62 66
         [%- SET tdclass = '' %]
63 67
         [%- IF row.BORDER_TOP %][%- SET tdclass = "$tdclass top_border" %][%- END %]
64 68
         [%- IF row.BORDER_BOTTOM %][%- SET tdclass = "$tdclass bottom_border" %][%- END %]
templates/webpages/report_generator/html_report_master.html
41 41
   [%- FOREACH row = HEADER_ROWS %]
42 42
   <tr>
43 43
    [% FOREACH col = row %]
44
     <th class="listheading">
44
     <th class="listheading"
45
     [%- IF col.align %] align="[% HTML.escape(col.align) %]"[% END -%]
46
     [%- IF col.colspan && col.colspan > 1 %] colspan="[% HTML.escape(col.colspan) %]"[% END -%]
47
     >
45 48
      [%- IF col.link -%]<a href="[% col.link %]">[%- END -%]
46 49
      [%- col.text -%]
47 50
      [%- IF col.show_sort_indicator -%]<img border="0" src="image/[% IF col.sort_indicator_direction %]down[% ELSE %]up[% END %].png">[%- END -%]
......
59 62
      [%- FOREACH col = row.COLUMNS %]
60 63
      <td[% IF col.align %] align="[% col.align %]"[% END %]
61 64
         [%- IF col.valign %] valign="[% col.valign %]"[%- END %]
65
         [%- IF col.colspan && col.colspan > 1 %] colspan="[% HTML.escape(col.colspan) %]"[% END -%]
62 66
         [%- SET tdclass = '' %]
63 67
         [%- IF row.BORDER_TOP %][%- SET tdclass = "$tdclass top_border" %][%- END %]
64 68
         [%- IF row.BORDER_BOTTOM %][%- SET tdclass = "$tdclass bottom_border" %][%- END %]

Auch abrufbar als: Unified diff