X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fsearch%2Ftower-map.html;fp=httemplate%2Fsearch%2Ftower-map.html;h=9c3ee984ffe0b29defec964719a4d7d38ffb9133;hp=0000000000000000000000000000000000000000;hb=41f3ac8d2ba5faada6c6972aff72bff18c4aeb5f;hpb=d817fbfd21c3b3259001c5a97102f2a37a797bc6 diff --git a/httemplate/search/tower-map.html b/httemplate/search/tower-map.html new file mode 100755 index 000000000..9c3ee984f --- /dev/null +++ b/httemplate/search/tower-map.html @@ -0,0 +1,259 @@ +<& /elements/header.html, '' &> + + + + + +
+ + + + + +<& /elements/footer.html &> +<%init> + +die "access denied" unless + $FS::CurrentUser::CurrentUser->access_right('List services'); + +my $conf = new FS::Conf; + +my $apikey = $conf->config('google_maps_api_key'); + +my @features; # geoJSON structure + +my @towers = qsearch('tower', { + 'latitude' => { op=>'!=', value=>''}, + 'longitude' => { op=>'!=', value=>''}, +}); +my %sectors; # towernum => arrayref +my @overlays; +my @towernums; + +foreach my $tower (@towers) { + my $towernum = $tower->towernum; + push @towernums, $towernum; + my @coord = ( + $tower->longitude + 0, + $tower->latitude + 0, + ); + push @features, + { + type => 'Feature', + id => 'tower/'.$towernum, + geometry => { + type => 'Point', + coordinates => \@coord, + }, + properties => { + style => { + icon => { + path => undef, + url => $fsurl.'images/antenna-square-21x51.png', + anchor => { x => 10, y => 4 }, + strokeColor => ($tower->color || 'black'), + }, + }, + content => include('.tower', $tower), + }, + }; + + $sectors{$towernum} = [ $tower->tower_sector ]; + foreach my $sector (@{ $sectors{$towernum} }) { + if ( length($sector->image) > 0 ) { + my $o = { + url => $fsurl.'view/sector_map-png.cgi?' . $sector->sectornum + }; + foreach (qw(south north west east)) { + $o->{$_} = $sector->get($_) + 0; + } + push @overlays, $o; + }; + }; + +} # foreach $tower + +my $tower_data = { + type => 'FeatureCollection', + features => \@features +}; + + +<%def .tower> +% my $tower = shift; +% my $can_edit = $FS::CurrentUser::CurrentUser->access_right('Configuration'); +

+% if ( $can_edit ) { + +% } +Tower #<% $tower->towernum %> | <% $tower->towername %> +% if ( $can_edit ) { + +% } +

+% my $count_query = 'SELECT COUNT(*) FROM svc_broadband LEFT JOIN addr_status using (ip_addr) JOIN tower_sector USING (sectornum) WHERE tower_sector.towernum = '.$tower->towernum; +% my $num_down = FS::Record->scalar_sql("$count_query AND addr_status.up IS NULL AND addr_status._date IS NOT NULL"); +% my $num_up = FS::Record->scalar_sql("$count_query AND addr_status.up IS NOT NULL"); + +<% emt('Show services') %> +( <% $num_up %> <% emt('UP') %> +<% $num_down %> <% emt('DOWN') %> ) +