summaryrefslogtreecommitdiff
path: root/httemplate
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2014-06-30 23:27:42 -0700
committerMark Wells <mark@freeside.biz>2014-06-30 23:27:42 -0700
commit447f1a906b47868497485edc3ba190a808539956 (patch)
tree74841402a78c309775963a00f816773ac5773287 /httemplate
parent507f1809a908cf738252be86bd444253787302b7 (diff)
start of FCC 477 report rewrite, #24047 and #28020
Diffstat (limited to 'httemplate')
-rwxr-xr-xhttemplate/edit/part_pkg.cgi29
-rwxr-xr-xhttemplate/edit/process/part_pkg.cgi8
-rw-r--r--httemplate/elements/tr-input-fcc_options.html25
-rw-r--r--httemplate/misc/part_pkg_fcc_options.html200
-rwxr-xr-xhttemplate/search/477partIA.html8
5 files changed, 256 insertions, 14 deletions
diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi
index 61994f99a..9e55d9f42 100755
--- a/httemplate/edit/part_pkg.cgi
+++ b/httemplate/edit/part_pkg.cgi
@@ -232,18 +232,23 @@
},
},
- ( $conf->exists('cust_pkg-show_fcc_voice_grade_equivalent')
- ? (
- { type => 'tablebreak-tr-title',
- value => 'FCC Form 477 information',
- },
- { field=>'fcc_voip_class',
- type=>'select-voip_class',
- },
- { field=>'fcc_ds0s', type=>'text', size=>6 },
- )
- : ()
- ),
+ { type => 'tablebreak-tr-title',
+ value => 'FCC Form 477 information',
+ },
+ { field => 'fcc_options_string',
+ type => 'input-fcc_options',
+ curr_value_callback => sub {
+ my ($cgi, $part_pkg, $fref) = @_;
+ if ( $cgi->param('fcc_options_string') ) {
+ # error redirect
+ return $cgi->param('fcc_options_string');
+ }
+ my %hash;
+ %hash = $part_pkg->fcc_options
+ if ($part_pkg->pkgpart);
+ return encode_json(\%hash);
+ },
+ },
{ type => 'tablebreak-tr-title',
value => 'External Links', #better name?
diff --git a/httemplate/edit/process/part_pkg.cgi b/httemplate/edit/process/part_pkg.cgi
index 8ea39e1a2..d27ddb0b0 100755
--- a/httemplate/edit/process/part_pkg.cgi
+++ b/httemplate/edit/process/part_pkg.cgi
@@ -127,6 +127,14 @@ my $args_callback = sub {
push @args, 'part_pkg_currency' => \%part_pkg_currency;
###
+ # fcc options
+ ###
+ my $fcc_options_string = $cgi->param('fcc_options_string');
+ if ($fcc_options_string) {
+ push @args, 'fcc_options' => decode_json($fcc_options_string);
+ }
+
+ ###
#pkg_svc
###
diff --git a/httemplate/elements/tr-input-fcc_options.html b/httemplate/elements/tr-input-fcc_options.html
new file mode 100644
index 000000000..bd5083075
--- /dev/null
+++ b/httemplate/elements/tr-input-fcc_options.html
@@ -0,0 +1,25 @@
+<TR>
+ <TH COLSPAN=2>
+ <& hidden.html, 'id' => $id, @_ &>
+%# <& input-text.html, 'id' => $id, @_ &>
+%# XXX debugging
+ <FONT SIZE="+1"><BUTTON TYPE="button" onclick="show_fcc_options()">
+ FCC Form 477 information
+ </BUTTON></FONT>
+% # show some kind of useful summary of the FCC options here
+ </TH>
+</TR>
+<SCRIPT TYPE="text/javascript">
+function show_fcc_options() {
+ <& popup_link_onclick.html,
+ 'action' => $fsurl.'misc/part_pkg_fcc_options.html?id=' . $id,
+ 'actionlabel' => 'FCC Form 477 options',
+ 'width' => 760,
+ 'height' => 600,
+ &>
+}
+</SCRIPT>
+<%init>
+my %opt = @_;
+my $id = $opt{id} || $opt{field};
+</%init>
diff --git a/httemplate/misc/part_pkg_fcc_options.html b/httemplate/misc/part_pkg_fcc_options.html
new file mode 100644
index 000000000..1f5d4a8bf
--- /dev/null
+++ b/httemplate/misc/part_pkg_fcc_options.html
@@ -0,0 +1,200 @@
+<& /elements/header-popup.html &>
+
+<STYLE>
+ fieldset {
+ border: 1px solid #7e0079;
+ border-radius: 8px;
+ background-color: #fff;
+ }
+ fieldset.inv {
+ border: none;
+ }
+ fieldset:disabled {
+ display: none;
+ }
+</STYLE>
+
+<%def .checkbox>
+% my $field = shift;
+% my $extra = shift || '';
+<INPUT TYPE="checkbox" NAME="<% $field %>" ID="<% $field %>" VALUE="1" <%$extra%>>
+</%def>
+
+<FORM NAME="fcc_option_form">
+% # The option structure is hardcoded. The FCC rules changed enough from
+% # the original 477 report to the 2013 revision that any data-driven
+% # mechanism for expressing the original rules would likely fail to
+% # accommodate the new ones. Therefore, we assume that whatever the FCC
+% # does NEXT will also require a rewrite of this form, and we'll deal with
+% # that when it arrives.
+ <P>
+ <LABEL FOR="media">Media type</LABEL>
+ <SELECT NAME="media" ID="media">
+ <OPTION VALUE=""></OPTION>
+% foreach (keys(%$media_types)) {
+ <OPTION VALUE="<% $_ %>"><% $_ %></OPTION>
+% }
+ </SELECT>
+ </P>
+ <P>
+ <& .checkbox, 'is_consumer' &>
+ <LABEL FOR="is_consumer">This is a consumer-grade package</LABEL>
+ </P>
+ <P>
+ <& .checkbox, 'is_broadband' &>
+ <LABEL FOR="is_broadband">This package provides broadband service</LABEL>
+ <FIELDSET ID="broadband">
+ <LABEL FOR="technology">Technology of transmission</LABEL>
+ <SELECT NAME="technology" ID="technology"> </SELECT>
+ <BR>
+ <LABEL FOR="broadband_downstream">Downstream speed (Mbps)</LABEL>
+ <INPUT NAME="broadband_downstream" ID="broadband_downstream">
+ <BR>
+ <LABEL FOR="broadband_upstream">Upstream speed (Mbps)</LABEL>
+ <INPUT NAME="broadband_upstream" ID="broadband_upstream">
+ </FIELDSET>
+ </P>
+ <P>
+ <& .checkbox, 'is_phone' &>
+ <LABEL FOR="is_phone">This package provides local telephone service</LABEL>
+ <FIELDSET ID="phone">
+ <LABEL FOR="phone_wholesale">Marketed as</LABEL>
+ <SELECT NAME="phone_wholesale" ID="phone_wholesale">
+ <OPTION VALUE="">end user</OPTION>
+ <OPTION VALUE="1">wholesale</OPTION>
+ </SELECT>
+ <FIELDSET CLASS="inv" ID="phone0" DISABLED="1">
+ <LABEL FOR="phone_lines">Number of voice-grade equivalents</LABEL>
+ <INPUT NAME="phone_lines" ID="phone_lines">
+ <BR>
+ <LABEL FOR="phone_longdistance">Are you the presubscribed long-distance carrier?</LABEL>
+ <& .checkbox, 'phone_longdistance' &>
+ <BR>
+ <LABEL FOR="phone_localloop">Local loop arrangement</LABEL>
+ <SELECT NAME="phone_localloop" ID="phone_localloop">
+ <OPTION VALUE="owned">You own the local loop</OPTION>
+ <OPTION VALUE="leased">You lease UNE-L from another carrier</OPTION>
+ <OPTION VALUE="resale">You resell another carrier's service</OPTION>
+ </SELECT>
+ </FIELDSET>
+ <FIELDSET CLASS="inv" ID="phone1" DISABLED="1">
+ <LABEL FOR="phone_vges">Number of voice-grade equivalents (if any)</LABEL>
+ <INPUT NAME="phone_vges" ID="phone_vges">
+ <BR>
+ <LABEL FOR="phone_circuits">Number of unswitched circuits (if any)</LABEL>
+ <INPUT NAME="phone_circuits" ID="phone_circuits">
+ </FIELDSET>
+ </FIELDSET>
+ </P>
+ <P>
+ <& .checkbox, 'is_voip' &>
+ <LABEL FOR="is_voip">This package provides VoIP telephone service</LABEL>
+ <FIELDSET ID="voip">
+ <LABEL FOR="voip_ott">Do you also provide last-mile connectivity?</LABEL>
+ <& .checkbox, 'voip_ott' &>
+ </FIELDSET>
+ </P>
+ <DIV WIDTH="100%" STYLE="text-align:center">
+ <INPUT TYPE="submit" VALUE="Save changes">
+ </DIV>
+</FORM>
+
+<SCRIPT TYPE="text/javascript">
+// this form is invoked as a popup; the current values of the parent
+// object are in the form field ID passed as the 'id' param
+
+var parent_id = window.parent.document.getElementById('<% $parent_id %>');
+var curr_values = JSON.parse(window.parent_id.value);
+var form = document.forms['fcc_option_form'];
+var media_types = <% encode_json($media_types) %>
+var technology_labels = <% encode_json($technology_labels) %>
+
+function set_tech_options() {
+ var form = document.forms['fcc_option_form'];
+ var curr_type = form.elements['media'].value;
+ var technology_obj = form.elements['technology'];
+ technology_obj.options.length = 0;
+ if (media_types[curr_type]) {
+ for( var i = 0; i < media_types[curr_type].length; i++ ) {
+ var value = media_types[curr_type][i];
+ var o = document.createElement('OPTION');
+ o.text = technology_labels[value]
+ o.value = value;
+ technology_obj.add(o);
+ }
+ }
+}
+
+function save_changes() {
+ var form = document.forms['fcc_option_form'];
+ var data = {};
+ for (var i = 0; i < form.elements.length; i++) {
+ // quick and dirty test for whether the element is displayed
+ if (form.elements[i].clientHeight > 0) {
+ if (form.elements[i].type == 'checkbox') {
+ if (form.elements[i].checked) {
+ data[ form.elements[i].name ] = 1;
+ }
+ } else {
+ data[ form.elements[i].name ] = form.elements[i].value;
+ }
+ }
+ }
+ parent_id.value = JSON.stringify(data);
+ parent.cClick(); //overlib
+}
+
+function enable_fieldset(fieldset_id) {
+ var fieldset = document.getElementById(fieldset_id);
+ return function () { fieldset.disabled = !this.checked; };
+}
+
+<&| /elements/onload.js &>
+ function addEventListener(target, action, listener) {
+ if (target.addEventListener) {
+ target.addEventListener(action, listener);
+ } else if (target.attachEvent) { // IE 8 fails at everything
+ target.attachEvent('on'+action, listener);
+ }
+ }
+
+ // set up all event handlers
+ addEventListener(form, 'submit', save_changes);
+
+ var sections = [ 'broadband', 'phone', 'voip' ];
+ for(var i = 0; i < sections.length; i++) {
+ var toggle = form.elements['is_'+sections[i]];
+ addEventListener(toggle, 'change', enable_fieldset(sections[i]));
+ }
+
+ addEventListener(form.elements['media'], 'change', set_tech_options);
+ addEventListener(form.elements['phone_wholesale'], 'change',
+ function () {
+ form.elements['phone0'].disabled = (this.value == 1);
+ form.elements['phone1'].disabled = (this.value == '');
+ }
+ );
+
+ // load data from the parent form and trigger handlers
+ for(var i = 0; i < form.elements.length; i++) {
+ var input_obj = form.elements[i];
+ if (input_obj.type == 'submit') {
+ //nothing
+ } else if (input_obj.type == 'checkbox') {
+ input_obj.checked = (curr_values[input_obj.name] > 0);
+ } else {
+ input_obj.value = curr_values[input_obj.name] || '';
+ }
+ input_obj.dispatchEvent( new Event('change') );
+ }
+
+</&>
+
+</SCRIPT>
+<& /elements/footer.html &>
+<%init>
+my $media_types = FS::part_pkg_fcc_option->media_types;
+my $technology_labels = FS::part_pkg_fcc_option->technology_labels;
+
+my $parent_id = $cgi->param('id');
+</%init>
diff --git a/httemplate/search/477partIA.html b/httemplate/search/477partIA.html
index 97f8ac0aa..55e901bb3 100755
--- a/httemplate/search/477partIA.html
+++ b/httemplate/search/477partIA.html
@@ -80,13 +80,17 @@ die "access denied"
my %opt = @_;
my %search_hash;
-
+
for ( qw(agentnum state) ) {
$search_hash{$_} = $cgi->param($_) if $cgi->param($_);
-}
+} # note that separation by state is no longer required after July 2014
$search_hash{'country'} = 'US';
$search_hash{'classnum'} = [ $cgi->param('classnum') ];
+my $info = FS::part_pkg_fcc_option->info;
+
+
+
# arrays of report_option_ numbers, running parallel to
# the download and upload speed arrays
my @download_option = $cgi->param('part1_column_option');