Reverted menu-left-example.png back to original and cleaned up menu-top-example to...
[freeside.git] / httemplate / browse / tower-map.html
1 <& /elements/header.html, 'Towers and sectors' &>
2  
3 <script type="text/javascript">
4 $(function() {
5   var toggles = $('ul.tower_sector_list input[type=checkbox]');
6   toggles.on('click', function() {
7     
8  
9 <& elements/gmap.html, features => \@features, overlays => \@overlays &>
10
11 <& /elements/footer.html &>
12 <%init>
13
14 die "access denied" unless
15   $FS::CurrentUser::CurrentUser->access_right('Configuration');
16
17 my $conf = new FS::Conf;
18
19 my @features; # geoJSON structure
20
21 my %sectors;
22 my %towers;
23 my %tower_coord;
24 my %tower_bounds;
25
26 foreach my $tower (qsearch('towers', {})) {
27   my $towernum = $tower->towernum;
28   $towers{$towernum} = $tower;
29   next if !$tower->latitude or !$tower->longitude;
30
31   $tower_coord{$towernum} =
32   [ $tower->longitude + 0,
33     $tower->latitude + 0,
34     ($tower->altitude || 0) + 0,
35   ];
36
37   # should figure out bounds to include coverage areas
38
39   push @features,
40   {
41     id        => 'tower/'.$towernum,
42     geometry  => {
43       type        => 'Point',
44       coordinates => $tower_coord{$towernum},
45     },
46     properties => {
47       style     => {
48         icon => {
49           path        => undef,
50           url         => $fsurl.'images/jcartier-antenna-square-21x51.png',
51           anchor      => { x => 10, y => 4 }
52         },
53       },
54       content   => include('.tower', $tower),
55       bounds    => $tower_bounds{$towernum},
56     },
57   };
58
59   # XXX show sector coverage zones
60 } # foreach $svc_broadband
61
62 </%init>
63 </%def>
64 <%def .tower>
65 % my $tower = shift;
66 % my $can_edit = $FS::CurrentUser::CurrentUser->access_right('Configuration');
67 <H3>
68 % if ( $can_edit ) {
69 %   # XXX open within the InfoWindow, or at least in a popup
70   <a target="_blank" href="<% $fsurl %>edit/tower.html?<% $tower->towernum %>">
71 % }
72 Tower #<% $tower->towernum %> | <% $tower->towername %>
73 % if ( $can_edit ) {
74   </a>
75 % }
76 </H3>
77 <ul class="tower_sector_list">
78 % foreach my $sector ($tower->tower_sector) { # default sector?
79 <li>
80 <input type="checkbox" value="<% $sector->sectornum %>">
81 <% $sector->sectorname %>
82 </li>
83 % }
84 </ul>
85 </%def>