1 % unless ($opt{js_only}) {
2 <& hidden.html, 'field' => $id, @_ &>
3 %# <& input-text.html, 'id' => $id, @_ &> # XXX debugging
4 <UL ID="<%$id%>_display_fcc_options" CLASS="fcc_options">
6 <button type="button" class="edit_fcc_button" data-target="<% $id %>">
10 % unless ($opt{html_only}) {
11 % my $popup = $fsurl.'misc/part_pkg_fcc_options.html?id=';
12 % my $popup_name = 'popup-'.time. "-$$-". rand() * 2**32;
13 <SCRIPT TYPE="text/javascript">
14 function edit_fcc_options() {
15 var id = this.dataset['target'];
17 OLiframeContent( '<% $popup %>' + id,
18 760, 600, '<% $popup_name %>', 0, 'auto' ),
19 CAPTION, 'FCC Form 477 options',
20 STICKY, AUTOSTATUSCAP, MIDX, 0, MIDY, 0,
21 DRAGGABLE, CLOSECLICK,
22 BGCOLOR, '#333399', CGCOLOR, '#333399',
27 var technology_labels = <% encode_json(FS::part_pkg_fcc_option->technology_labels) %>;
28 function show_fcc_options(id) {
29 var curr_values = JSON.parse(document.getElementById(id).value);
30 // hardcoded for the same reasons as misc/part_pkg_fcc_options
32 var tech = curr_values['technology'];
34 if (technology_labels[tech]) {
35 tech = technology_labels[tech];
37 tech = 'Technology '+tech; // unknown?
40 var media = curr_values['media'] || 'unknown media';
41 media = media.toLowerCase();
42 if ( curr_values['is_consumer'] ) {
43 out += '<li><strong>Consumer-grade</strong> service</li>';
45 out += '<li><strong>Business-grade</strong> service</li>';
47 if ( curr_values['is_broadband'] ) {
48 out += '<li>Broadband via <strong>' + tech + '</strong>'
49 + '<li><strong>' + curr_values['broadband_downstream']
50 + 'Mbps </strong> down / '
51 + '<strong>' + curr_values['broadband_upstream']
52 + 'Mbps </strong> up</li>';
54 if ( curr_values['is_phone'] ) {
55 if ( curr_values['phone_wholesale'] ) {
56 out += '<li>Wholesale telephone</li>';
57 if ( curr_values['phone_vges'] ) {
58 out += '<li><strong>' + curr_values['phone_vges'] + '</strong>'
59 + ' switched voice-grade lines</li>';
61 if ( curr_values['phone_circuits'] ) {
62 out += '<li><strong>' + curr_values['phone_circuits'] + '</strong>'
63 + ' unswitched circuits</li>';
67 out += '<li>Local telephone over <strong>' + media + '</strong></li>'
68 + '<li><strong>' + curr_values['phone_lines']
69 + '</strong> voice-grade lines</li>';
70 if ( curr_values['phone_localloop'] == 'resale' ) {
71 out += '<li><strong>Resold</strong> from another carrier</li>>';
72 } else if ( curr_values['phone_localloop'] == 'leased' ) {
73 out += '<li>Using <strong>leased circuits</strong> from another carrier</li>';
74 } else if ( curr_values['phone_localloop'] == 'owned' ) {
75 out += '<li>Using <strong>our own circuits</strong></li>';
77 if ( curr_values['phone_longdistance'] ) {
78 out += '<li>Includes <strong>long-distance service</strong></li>';
82 if ( curr_values['is_voip'] ) {
83 out += '<li><strong>VoIP</strong> telephone service over <strong>'
84 + media + '</strong></li>';
85 out += '<li><strong>' + curr_values['voip_sessions'] +
86 '</strong> sessions allowed</li>';
87 if ( curr_values['voip_lastmile'] ) {
88 out += '<li><strong>Including</strong> last-mile connection</li>';
90 out += '<li>Using a <strong>separate</strong> last-mile connection</li>';
93 if ( curr_values['is_mobile'] ) {
94 out += '<li><strong>Mobile</strong> telephone service</li>';
95 if ( curr_values['mobile_direct'] ) {
96 out += '<li>Billed <strong>directly to the user</strong></li>';
100 var out_ul = document.getElementById(id + '_display_fcc_options');
101 out_ul.innerHTML = out;
104 var edit_fcc_buttons = document.getElementsByClassName('edit_fcc_button');
105 for(var i = 0; i < edit_fcc_buttons.length; i++) {
106 var button = edit_fcc_buttons[i];
107 show_fcc_options( button.dataset['target'] );
108 button.addEventListener('click', edit_fcc_options);
115 my $id = $opt{id} || $opt{field};