Merge branch 'master' of git.freeside.biz:/home/git/freeside
[freeside.git] / httemplate / search / 477.html
1 % if ( $type eq 'xml' ) {
2 <?xml version="1.0" encoding="ISO-8859-1"?>
3 <Form_477_submission xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://specialreports.fcc.gov/wcb/Form477/XMLSchema-instance/form_477_upload_Schema.xsd" >
4 % } else { #html
5 <& /elements/header.html, "FCC Form 477 Results - $state" &>
6 %# XXX when we stop supporting IE8, add this to freeside.css using :nth-child
7 %# selectors, and remove it from everywhere else
8 <STYLE TYPE="text/css">
9 .grid TH { background-color: #cccccc; padding: 0px 3px 2px; text-align: right }
10 .row0 TD { background-color: #eeeeee; padding: 0px 3px 2px; text-align: right }
11 .row1 TD { background-color: #ffffff; padding: 0px 3px 2px; text-align: right }
12 </STYLE>
13
14 <TABLE WIDTH="100%">
15   <TR>
16     <TD></TD>
17     <TD ALIGN="right" CLASS="noprint">
18       Download full results<BR>
19 %   $cgi->param('_type', 'xml');
20       as <A HREF="<% $cgi->self_url %>">XML file</A><BR>
21
22 %   $cgi->param('_type', 'html-print');
23       as <A HREF="<% $cgi->self_url %>">printable copy</A>
24
25     </TD>
26 %   $cgi->param('_type', $type );
27   </TR>
28 </TABLE>
29 % } #html
30 % foreach my $part ( @parts ) {
31 %   if ( $part{$part} ) {
32 %
33 %     if ( $part eq 'V' ) {
34 %       next unless ( $part{'IIA'} || $part{'IIB'} );
35 %     }
36 %
37 %     if ( $part eq 'VI_census' ) {
38 %       next unless $part{'IA'};
39 %     }
40 %
41 %     my @reports = ();
42 %     if ( $part eq 'IA' ) {
43 %       for ( my $tech = 0; $tech < scalar(@technology_option); $tech++ ) {
44 %         next unless $technology_option[$tech];
45 %         my $url = &{$url_mangler}($part);
46 %         if ( $type eq 'xml' ) {
47 <<% 'Part_IA_'. chr(65 + $tech) %>>
48 %         }
49 <& "477part${part}.html",
50     'tech_code' => $tech,
51     'url' => $url,
52     'type' => $type
53 &>
54 %         if ( $type eq 'xml' ) {
55 </<% 'Part_IA_'. chr(65 + $tech) %>>
56 %         }
57 %       }
58 %     } else {
59 %       if ( $type eq 'xml' ) {
60 <<% 'Part_'. $part %>>
61 %       }
62 %       my $url = &{$url_mangler}($part);
63 <& "477part${part}.html", 'url' => $url &>
64 %       if ( $type eq 'xml' ) {
65 </<% 'Part_'. $part %>>
66 %       }
67 %     }
68 %   }
69 % }
70 %
71 % if ( $type eq 'xml' ) {
72 </Form_477_submission>
73 % } else {
74 <& /elements/footer.html &>
75 % }
76 <%init>
77
78 my $curuser = $FS::CurrentUser::CurrentUser;
79
80 die "access denied"
81   unless $curuser->access_right('List packages');
82
83 my $state = uc($cgi->param('state'));
84 $state =~ /^[A-Z]{2}$/ or die "illegal state: $state";
85
86 my %part = map { $_ => 1 } grep { /^\w+$/ } $cgi->param('part');
87 my $type = $cgi->param('_type') || 'html';
88 my $xlsname = '477report';
89 my @technology_option = &FS::Report::FCC_477::parse_technology_option($cgi,1);
90
91 # save upload and download mappings
92 my @download = $cgi->param('part1_column_option');
93 my @upload = $cgi->param('part1_row_option');
94 for(my $i=0; $i < scalar(@download); $i++) {
95     &FS::Report::FCC_477::save_fcc477map("part1_column_option_$i",$download[$i]);
96 }
97 for(my $i=0; $i < scalar(@upload); $i++) {
98     &FS::Report::FCC_477::save_fcc477map("part1_row_option_$i",$upload[$i]);
99 }
100
101 my @part2a_row_option = $cgi->param('part2a_row_option');
102 for(my $i=0; $i < scalar(@part2a_row_option); $i++) {
103     &FS::Report::FCC_477::save_fcc477map("part2a_row_option_$i",$part2a_row_option[$i]);
104 }
105
106 my @part2b_row_option = $cgi->param('part2b_row_option');
107 for(my $i=0; $i < scalar(@part2b_row_option); $i++) {
108     &FS::Report::FCC_477::save_fcc477map("part2b_row_option_$i",$part2b_row_option[$i]);
109 }
110
111 my $part5_report_option = $cgi->param('part5_report_option');
112 if ( $part5_report_option ) {
113   FS::Report::FCC_477::save_fcc477map('part5_report_option', $part5_report_option);
114 }
115
116 my $url_mangler = sub {
117   my $part = shift;
118   my $url = $cgi->url('-path_info' => 1, '-full' => 1);
119   $url =~ s/477\./477part$part./;
120   $url;
121 };
122 my @parts = qw( IA IIA IIB IV V VI_census );
123
124 </%init>