-<% include( 'elements/search.html',
- 'title' => 'FCC Form 477 Results',
- 'html_init' => $html_init,
- 'name' => 'regions',
- 'query' => [ @sql_query ],
- 'count_query' => $count_query,
- 'order_by' => 'ORDER BY censustract',
- 'avoid_quote' => 1,
- 'no_csv_header' => 1,
- 'header' => [
- 'County code',
- 'Census tract code',
- 'Upload rate',
- 'Download rate',
- 'Technology code',
- 'Technology code other',
- 'Quantity',
- 'Percentage residential',
- ],
- 'fields' => [
- sub { my $row = shift; substr($row->censustract, 2, 3) },
- sub { my $row = shift; substr($row->censustract, 5) },
- 'upload',
- 'download',
- sub { 7 },
- sub { '' },
- 'quantity',
- sub { my $row = shift; sprintf "%.2f", $row->residential },
- ],
- 'links' => [
- [ $link, $link_suffix ],
- [ $link, $link_suffix ],
- [ $link, $link_suffix ],
- [ $link, $link_suffix ],
- [ $link, $link_suffix ],
- [ $link, $link_suffix ],
- [ $link, $link_suffix ],
- [ $link, $link_suffix ],
- ],
- )
-%>
+<& /elements/header.html, $title &>
+<STYLE TYPE="text/css">
+table.fcc477part {
+ border-collapse: collapse;
+ border: 1px #777 solid;
+ margin-bottom: 20px;
+}
+table.fcc477part td {
+ padding: 0px 4px;
+ border-left: 1px #777 solid;
+ border-right: 1px #777 solid;
+}
+table.fcc477part tbody td {
+ text-align: right;
+}
+table.fcc477part thead tr.head {
+ text-align: center;
+ vertical-align: top;
+ font-weight: bold;
+ border-top: 1px #777 solid;
+ border-bottom: 1px #777 solid;
+}
+table.fcc477part thead tr.subhead {
+ text-align: center;
+ font-weight: bold;
+ font-size: small;
+ border-top: 1px #777 solid;
+ border-bottom: 1px #777 solid;
+}
+.parttitle {
+ font-weight: bold;
+ font-size: large;
+ float: left;
+}
+.errortitle {
+ font-weight: bold;
+ color: #ff0000;
+}
+tr.error td {
+ background-color: #ffdddd;
+}
+tr.error td.error {
+ text-align: left;
+ border: none;
+}
+tr.error ul {
+ margin: 0px;
+ list-style-image: url("<% $fsurl %>images/cross.png");
+}
+a.download {
+ float: right;
+}
+</STYLE>
+% foreach my $partname (@partnames) {
+% my $this_part = $parts{$partname};
+% $cgi->param('parts', $partname);
+% $cgi->param('type', 'csv');
+<table class="fcc477part">
+ <caption>
+ <span class="parttitle"><% $part_titles->{$partname} %></span>
+% if ( $this_part->{num_errors} > 0 ) {
+% # disable downloading while it contains errors
+ <span class="errortitle">
+ <% emt('This section contains [quant,_1,error].', $this_part->{num_errors}) %>
+ </span>
+% } else {
+ <a class="download" href="<% $cgi->self_url %>">Download</a>
+% }
+ </caption>
+% my $header = ".header_$partname";
+% my $data = $this_part->{data};
+% my $error = $this_part->{error};
+ <thead>
+ <& $header &>
+ </thead>
+% my $rownum = 0;
+% foreach my $row (@$data) {
+% my %eh; # error hash
+% if ( $error->[$rownum] ) {
+% %eh = %{ $error->[$rownum] };
+% }
+ <tr<% keys(%eh) ? ' class="error"' : ''%>>
+% my $first = 1;
+% foreach my $item (@$row) {
+ <td>
+% if ($first and $part_link{$partname}) {
+ <a href="<% $part_link{$partname} . "477rownum=$rownum" %>"><% $item || '(empty)' %></a>
+% $first = 0;
+% } else {
+ <% $item %>
+% }
+ </td>
+% } #foreach $item
+% # display errors
+% if ( keys %eh ) {
+ <td class="error"><ul>
+% foreach my $key (sort keys %eh) {
+ <li><% $eh{$key} %></li>
+% }
+ </ul></td>
+% } # if there are errors
+ </tr>
+% $rownum++;
+% } #foreach $row
+</table>
+% } # foreach $partname
+<& /elements/footer.html &>