From 49d9ea969069430ef3fe23e5b1ac3599e929bb04 Mon Sep 17 00:00:00 2001 From: Mark Wells Date: Mon, 10 Oct 2016 11:59:41 -0700 Subject: new tower/sector UI, mapping features, and network monitoring, #37802 --- httemplate/search/elements/gmap.html | 63 +++++-- httemplate/search/sector.html | 1 + httemplate/search/svc_broadband-json.cgi | 108 +++++++++++ httemplate/search/svc_broadband-map.html | 35 ++-- httemplate/search/tower-map.html | 303 +++++++++++++++++++++++++++++++ 5 files changed, 469 insertions(+), 41 deletions(-) create mode 100755 httemplate/search/svc_broadband-json.cgi create mode 100755 httemplate/search/tower-map.html (limited to 'httemplate/search') diff --git a/httemplate/search/elements/gmap.html b/httemplate/search/elements/gmap.html index b7d135dd6..69fdc5a09 100644 --- a/httemplate/search/elements/gmap.html +++ b/httemplate/search/elements/gmap.html @@ -37,6 +37,9 @@ Generic Google Maps front end. <%init> + +my $apikey = FS::Conf->new->config('google_maps_api_key'); + foreach (@features) { $_->{type} = 'Feature'; # any other per-feature massaging can go here @@ -57,7 +60,7 @@ body { height: 100%; margin: 0px; padding: 0px } #map_canvas { height: 100%; } - + + + +
+ + + + + +<& /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 @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 $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') %> ) +
+ +<% emt('Show coverage') %> + -- cgit v1.2.1