summaryrefslogtreecommitdiff
path: root/httemplate/browse
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2016-10-10 11:59:41 -0700
committerMark Wells <mark@freeside.biz>2016-10-10 11:59:41 -0700
commit49d9ea969069430ef3fe23e5b1ac3599e929bb04 (patch)
tree24a3feb13b0a8db68f7a634de239b97d106a5efe /httemplate/browse
parent53a8c81b4f3a414803a52fc8114b26a71055d012 (diff)
new tower/sector UI, mapping features, and network monitoring, #37802
Diffstat (limited to 'httemplate/browse')
-rw-r--r--httemplate/browse/tower-map.html85
-rw-r--r--httemplate/browse/tower.html6
2 files changed, 89 insertions, 2 deletions
diff --git a/httemplate/browse/tower-map.html b/httemplate/browse/tower-map.html
new file mode 100644
index 000000000..62e08fcb5
--- /dev/null
+++ b/httemplate/browse/tower-map.html
@@ -0,0 +1,85 @@
+<& /elements/header.html, 'Towers and sectors' &>
+
+<script type="text/javascript">
+$(function() {
+ var toggles = $('ul.tower_sector_list input[type=checkbox]');
+ toggles.on('click', function() {
+
+
+<& elements/gmap.html, features => \@features, overlays => \@overlays &>
+
+<& /elements/footer.html &>
+<%init>
+
+die "access denied" unless
+ $FS::CurrentUser::CurrentUser->access_right('Configuration');
+
+my $conf = new FS::Conf;
+
+my @features; # geoJSON structure
+
+my %sectors;
+my %towers;
+my %tower_coord;
+my %tower_bounds;
+
+foreach my $tower (qsearch('towers', {})) {
+ my $towernum = $tower->towernum;
+ $towers{$towernum} = $tower;
+ next if !$tower->latitude or !$tower->longitude;
+
+ $tower_coord{$towernum} =
+ [ $tower->longitude + 0,
+ $tower->latitude + 0,
+ ($tower->altitude || 0) + 0,
+ ];
+
+ # should figure out bounds to include coverage areas
+
+ push @features,
+ {
+ id => 'tower/'.$towernum,
+ geometry => {
+ type => 'Point',
+ coordinates => $tower_coord{$towernum},
+ },
+ properties => {
+ style => {
+ icon => {
+ path => undef,
+ url => $fsurl.'images/jcartier-antenna-square-21x51.png',
+ anchor => { x => 10, y => 4 }
+ },
+ },
+ content => include('.tower', $tower),
+ bounds => $tower_bounds{$towernum},
+ },
+ };
+
+ # XXX show sector coverage zones
+} # foreach $svc_broadband
+
+</%init>
+</%def>
+<%def .tower>
+% my $tower = shift;
+% my $can_edit = $FS::CurrentUser::CurrentUser->access_right('Configuration');
+<H3>
+% if ( $can_edit ) {
+% # XXX open within the InfoWindow, or at least in a popup
+ <a target="_blank" href="<% $fsurl %>edit/tower.html?<% $tower->towernum %>">
+% }
+Tower #<% $tower->towernum %> | <% $tower->towername %>
+% if ( $can_edit ) {
+ </a>
+% }
+</H3>
+<ul class="tower_sector_list">
+% foreach my $sector ($tower->tower_sector) { # default sector?
+<li>
+<input type="checkbox" value="<% $sector->sectornum %>">
+<% $sector->sectorname %>
+</li>
+% }
+</ul>
+</%def>
diff --git a/httemplate/browse/tower.html b/httemplate/browse/tower.html
index 16e44c6c0..555b8a39f 100644
--- a/httemplate/browse/tower.html
+++ b/httemplate/browse/tower.html
@@ -3,8 +3,10 @@
'name' => 'towers',
'menubar' => [ 'Add a new tower' =>
$p.'edit/tower.html',
- 'Sector coverage maps' =>
- $p.'search/sector.html',
+ #'Sector coverage maps' =>
+ # $p.'search/sector.html',
+ 'Tower map' =>
+ $p.'search/tower-map.html',
'Download CSV for towercoverage.com' =>
$p.'misc/tower-export.html?format=tc'
],