<%doc>

Displays a table for showing rows of data 

example data:
--------------------------------------------------------
| Address      | Status | Name                         |
--------------------------------------------------------
| 192.168.56.5 | Static | vlan56-5.mydomain.com         |
| 192.168.56.5 | Static | vlan56-5.mydomain.com         |
| 192.168.56.5 | Static | vlan56-5.mydomain.com         |
| 192.168.56.5 | Static | vlan56-5.mydomain.com         |
--------------------------------------------------------

Arguments:  
    field_headers  -  array of captions to show on the top row
    data           -  array of array references to show in the rows
    subclass       -  use class "datatabler1_subclass" in the stylesheet
    rowstyle       -  array of style parameters for all columns in a row (any css)
    style          -  array of style parameters for columns (any css).  Overrides rowstyle.
</%doc>

<%args>
@field_headers => undef;
@data          => ();
$subclass      => "";
@style         => ();
@rowstyle      => ();
</%args>

% if( $subclass ) { $subclass = '_'.$subclass; }


<table border="0" width="100%" cellspacing="0">
  <tr>
% if ( @style ){
%     for (my $i=0; $i < scalar @field_headers; $i++) {
          <th class="formtabletitle" style="<% $style[$i] %>"><% $field_headers[$i] %></th>
%     }
% }else{
%     foreach (@field_headers) {
          <th class="formtabletitle"><% $_ %></th>
%     }
% }
  </tr>

% my $i = 0;
% my $toggle = 1;
% foreach my $row ( @data ) {
%    ($toggle %= 2) += 1;
     <tr>
%    if ( @style ){
%        for (my $j=0; $j < scalar @$row; $j++) {
             <td class="datatabler<% $toggle.$subclass %>" style="<% $style[$j] %>"><% $row->[$j] %></td>
%        }
%    }elsif ( @rowstyle ){
%        foreach (@$row) {
             <td class="datatabler<% $toggle.$subclass %>" style="<% $rowstyle[$i] %>"><% $_ %></td>
%       }
%    }else{
%        foreach (@$row) {
             <td class="datatabler<% $toggle.$subclass %>"><% $_ %></td>
%       }
%    }
%    $i++;
     </tr>
% }

</table>
