summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjeff <jeff>2010-08-24 17:30:34 +0000
committerjeff <jeff>2010-08-24 17:30:34 +0000
commit51add281a0ca46ffa75bfa5e2aa45c0da9bb9643 (patch)
tree26f251164aa1d2f4f24f812d2fec2aa073bf653e
parent798c63aa6265165ea56c3a7543e3e477e6dc12d4 (diff)
fixup 477 XML output
-rwxr-xr-xhttemplate/search/477.html8
-rwxr-xr-xhttemplate/search/477partIA_detail.html40
-rwxr-xr-xhttemplate/search/477partVI_census.html (renamed from httemplate/search/477partVI.html)2
-rwxr-xr-xhttemplate/search/report_477.html2
4 files changed, 34 insertions, 18 deletions
diff --git a/httemplate/search/477.html b/httemplate/search/477.html
index 63eab7a..d586406 100755
--- a/httemplate/search/477.html
+++ b/httemplate/search/477.html
@@ -35,7 +35,7 @@
% next unless ( $part{'IIA'} || $part{'IIB'} );
% }
%
-% if ( $part eq 'VI' ) {
+% if ( $part eq 'VI_census' ) {
% next unless $part{'IA'};
% }
%
@@ -55,12 +55,12 @@
% }
% } else {
% if ( $type eq 'xml' ) {
-<<% 'Part_'. uc($part) %>>
+<<% 'Part_'. $part %>>
% }
% my $url = &{$url_mangler}($part);
<% include( "477part${part}.html", 'url' => $url ) %>
% if ( $type eq 'xml' ) {
-</<% 'Part_'. uc($part) %>>
+</<% 'Part_'. $part %>>
% }
% }
% }
@@ -88,6 +88,6 @@ my $url_mangler = sub {
$url =~ s/477\./477part$part./;
$url;
};
-my @parts = qw( IA IIA IIB IV V VI );
+my @parts = qw( IA IIA IIB IV V VI_census );
</%init>
diff --git a/httemplate/search/477partIA_detail.html b/httemplate/search/477partIA_detail.html
index 546d56c..2e60d02 100755
--- a/httemplate/search/477partIA_detail.html
+++ b/httemplate/search/477partIA_detail.html
@@ -60,6 +60,13 @@ my $technology = $FS::Report::FCC_477::technology[$tech_code] || 'unknown';
my $html_init = "<H2>Part IA $technology breakdown by speeds</H2>";
my $xml_prefix = 'PartIA_'. chr(65 + $tech_code);
+if ($cgi->param('_type') eq 'xml') {
+ #rotate data pi/2
+ my @temp = @column_option;
+ @column_option = @row_option;
+ @row_option = @temp;
+}
+
my $query = 'SELECT '. join(' UNION ALL SELECT ',@row_option);
my $count_query = 'SELECT '. scalar(@row_option);
@@ -102,24 +109,33 @@ my @fields = (
);
shift @fields if $cgi->param('_type') eq 'xml';
+my $rowchar = 102; # 'f' -- rows are columns! (pi/2)
+my $opentag = 0;
my $xml_element = sub {
my ($rowref, $column) = (shift, shift);
- my $row = $rowref->[0];
+ my $row = chr($rowchar);
+
+ if ($column == 8) {
+ $opentag++;
+ if ($opentag > 1) { # a new row
+ $rowchar++;
+ $opentag = 0;
+ }
+ }
- $row++;
- $xml_prefix. $column. $row;
+ $xml_prefix. $row. $column;
};
-my @xml_elements = (
- sub { &{$xml_element}(shift, 'f') },
- sub { &{$xml_element}(shift, 'g') },
- sub { &{$xml_element}(shift, 'h') },
- sub { &{$xml_element}(shift, 'i') },
- sub { &{$xml_element}(shift, 'j') },
- sub { &{$xml_element}(shift, 'k') },
- sub { &{$xml_element}(shift, 'l') },
- sub { &{$xml_element}(shift, 'm') },
+my @xml_elements = ( # -- columns are rows! (pi/2)
+ sub { &{$xml_element}(shift, 1) },
+ sub { &{$xml_element}(shift, 2) },
+ sub { &{$xml_element}(shift, 3) },
+ sub { &{$xml_element}(shift, 4) },
+ sub { &{$xml_element}(shift, 5) },
+ sub { &{$xml_element}(shift, 6) },
+ sub { &{$xml_element}(shift, 7) },
+ sub { &{$xml_element}(shift, 8) },
);
</%init>
diff --git a/httemplate/search/477partVI.html b/httemplate/search/477partVI_census.html
index db572bc..5f3039d 100755
--- a/httemplate/search/477partVI.html
+++ b/httemplate/search/477partVI_census.html
@@ -33,7 +33,7 @@
'upload',
'download',
'technology_code',
- sub { '' }, # doesn't really work
+ sub { $cgi->param('_type') eq 'xml' ? '0' : '' }, # doesn't really work
'quantity',
sub { my $row = shift; sprintf "%.2f", $row->residential },
],
diff --git a/httemplate/search/report_477.html b/httemplate/search/report_477.html
index bc2a958..7ac497a 100755
--- a/httemplate/search/report_477.html
+++ b/httemplate/search/report_477.html
@@ -181,7 +181,7 @@
<% include( '/elements/tr-checkbox.html',
'label' => 'Enable part VI?',
'field' => 'part',
- 'value' => 'VI',
+ 'value' => 'VI_census',
)
%>