X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fview%2Fsvc_broadband.cgi;h=2e93d42fdbba503098533f99161ec0514b6f996c;hb=b6dbe0f12dbbe4ea5209367f905f937789b5b607;hp=22cbb1f44f0705af4faf210f5f597766b83b14d4;hpb=573139dbd6c37808697bfa72a3a468bb0980d4dd;p=freeside.git diff --git a/httemplate/view/svc_broadband.cgi b/httemplate/view/svc_broadband.cgi index 22cbb1f44..2e93d42fd 100644 --- a/httemplate/view/svc_broadband.cgi +++ b/httemplate/view/svc_broadband.cgi @@ -2,6 +2,7 @@ table => 'svc_broadband', labels => \%labels, fields => \@fields, + svc_callback => \&svc_callback, &> <%init> @@ -13,9 +14,17 @@ my %labels = map { $_ => ( ref($fields->{$_}) ); } keys %$fields; +#my %labels = (); + +$labels{'description'} = emt('Description'); $labels{'router'} = emt('Router'); +$labels{'speed_down'} = emt('Download Speed'); +$labels{'speed_up'} = emt('Upload Speed'); +$labels{'ip_addr'} = emt('IP Address'); $labels{'usergroup'} = emt('RADIUS groups'); #? +$labels{'coordinates'} = 'Latitude/Longitude'; + my @fields = ( 'description', { field => 'router', value => \&router }, @@ -24,8 +33,9 @@ my @fields = ( { field => 'ip_addr', value => \&ip_addr }, { field => 'sectornum', value => \§ornum }, 'mac_addr', - 'latitude', - 'longitude', + #'latitude', + #'longitude', + { field => 'coordinates', value => \&coordinates }, 'altitude', 'vlan_profile', 'authkey', @@ -46,8 +56,9 @@ sub router { sub ip_addr { my $svc = shift; my $ip_addr = $svc->ip_addr; - my $out = $ip_addr . ' (' . - include('/elements/popup_link-ping.html', ip => $ip_addr) . ')'; + my $out = $ip_addr; + $out .= ' (' . include('/elements/popup_link-ping.html', ip => $ip_addr) . ')' + if $ip_addr; if ( my $addr_block = $svc->addr_block ) { $out .= '
Netmask: ' . $addr_block->NetAddr->mask . '
Gateway: ' . $addr_block->ip_gateway; @@ -72,4 +83,40 @@ sub sectornum { $link . $tower_sector->description. ( $link ? '' : ''); } +sub coordinates { + my $s = shift; #$svc_broadband + return '' unless $s->latitude && $s->longitude; + + my $d = $s->description; + unless ($d) { + my $cust_pkg = $s->cust_svc->cust_pkg; + $d = $cust_pkg->cust_main->name_short if $cust_pkg; + } + + #'Latitude: '. $s->latitude. ', Longitude: '. $s->longitude. ' '. + $s->latitude. ', '. $s->longitude. ' '. + include('/elements/coord-links.html', $s->latitude, $s->longitude, $d); +} + +sub svc_callback { + # trying to move to the callback style + my ($cgi, $svc_x, $part_svc, $cust_pkg, $fields, $opt) = @_; + # again, we assume at most one of these exports per part_svc + my ($nas_export) = $part_svc->part_export('broadband_nas'); + if ( $nas_export ) { + my $nas = qsearchs('nas', { 'svcnum' => $svc_x->svcnum }); + if ( $nas ) { + $svc_x->set($_, $nas->$_) foreach (fields('nas')); + push @$fields, qw(shortname secret type ports server community); + $opt->{'labels'}{'shortname'} = 'Short name'; + $opt->{'labels'}{'secret'} = 'Shared secret'; + $opt->{'labels'}{'type'} = 'Type'; + $opt->{'labels'}{'ports'} = 'Ports'; + $opt->{'labels'}{'server'} = 'Server'; + $opt->{'labels'}{'community'} = 'Community'; + } #if $nas + } #$nas_export +}; + +