summaryrefslogtreecommitdiff
path: root/httemplate/search
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2016-04-21 12:07:29 -0700
committerMark Wells <mark@freeside.biz>2016-04-26 12:20:10 -0700
commit2c5024a05daea660bdd4bbb52212a41aed1664dc (patch)
tree0b17e6511f97c31ac5f5b2d65adabb72abdf0157 /httemplate/search
parent9b6a030dbbf8be7f23f1795f3164da0a5a42b08b (diff)
generate sector coverage maps with Splat, checkpoint, #37802
Diffstat (limited to 'httemplate/search')
-rw-r--r--httemplate/search/elements/gmap.html19
-rw-r--r--httemplate/search/sector.html85
-rwxr-xr-xhttemplate/search/svc_broadband-map.html16
3 files changed, 118 insertions, 2 deletions
diff --git a/httemplate/search/elements/gmap.html b/httemplate/search/elements/gmap.html
index 8b070ebf9..632a32338 100644
--- a/httemplate/search/elements/gmap.html
+++ b/httemplate/search/elements/gmap.html
@@ -1,5 +1,6 @@
<%args>
@features
+@overlays
</%args>
<%doc>
Generic Google Maps front end.
@@ -24,6 +25,14 @@ Generic Google Maps front end.
}
}, # end of feature
],
+ overlays => [
+ { url => 'https://localhost/freeside/view/sector_overlay-png.html?102',
+ west => -130.0,
+ east => -128.0,
+ south => 10.0,
+ north => 12.0,
+ }, # make a ground overlay
+ ],
&>
</%doc>
@@ -54,6 +63,7 @@ body { height: 100%; margin: 0px; padding: 0px }
<script type="text/javascript">
var data_geojson = <% encode_json($tree) %>;
+var data_overlays = <% encode_json(\@overlays) %>;
var baseStyle = {
clickable: true,
@@ -75,6 +85,7 @@ var featureStyle = function(feature) {
};
var map;
+var overlays;
function initMap() {
var canvas = $('#map_canvas');
map = new google.maps.Map(canvas[0], { zoom: 6 });
@@ -116,6 +127,14 @@ function initMap() {
}
}); // addListener()
+
+ data_overlays.forEach(function(x) {
+ var url = x.url;
+ delete x.url;
+ var overlay = new google.maps.GroundOverlay( url, x );
+ overlay.setMap(map);
+ overlays.push(overlay);
+ });
}
$().ready( initMap );
diff --git a/httemplate/search/sector.html b/httemplate/search/sector.html
new file mode 100644
index 000000000..d03963237
--- /dev/null
+++ b/httemplate/search/sector.html
@@ -0,0 +1,85 @@
+<& /elements/header.html, {
+ 'title' => 'Sector coverage maps',
+ }
+&>
+<style>
+ a.createmap {
+ font-weight: bold;
+ color: blue;
+ }
+ a.viewmap {
+ font-weight: bold;
+ color: green;
+ }
+</style>
+<table class="grid">
+ <thead>
+ <tr>
+ <th>Tower / sector</th>
+ <th colspan=3>
+ </tr>
+ </thead>
+ <tbody>
+% foreach my $sector (@sectors) {
+% my $sectornum = $sector->sectornum;
+ <tr>
+ <td>
+ <a href="<% $fsurl %>edit/tower.html?<% $sector->towernum |h %>">
+ <% $sector->description |h %>
+ </a>
+ </td>
+
+% my @need_fields = $sector->need_fields_for_coverage;
+% if ( @need_fields ) {
+ <td>Need fields:</td>
+ <td>
+ <% join('<br>', @need_fields) %>
+ </td>
+% } else {
+ <td colspan="2" style="text-align: center">
+% my $text = 'Create map';
+% if ( length($sector->image) > 0 ) {
+% $text = 'Reprocess';
+% }
+ <form name="create_<% $sectornum |h %>">
+ <input type="hidden" name="sectornum" value="<% $sectornum |h %>">
+ <& /elements/progress-init.html,
+ 'create_'.$sectornum,
+ [ 'sectornum' ],
+ $fsurl.'misc/sector-create_map.html',
+ { 'message' => 'Map generated' },
+ "sector$sectornum"
+ &>
+ <a class="createmap" href="#" onclick="sector<% $sectornum %>process()">
+ <% $text %>
+ </a>
+% }
+ </td>
+ <td>
+% if ( length($sector->image) > 0 ) {
+ <a class="viewmap" href="<% $fsurl %>search/svc_broadband-map.html?sectornum=<% $sectornum %>">
+ View map
+ </a>
+% }
+ </td>
+ </tr>
+% } # foreach $sector
+ </tbody>
+</table>
+<& /elements/footer.html &>
+<%init>
+
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
+
+my $query = {
+ table => 'tower_sector',
+ select => 'tower_sector.*,
+ tower.latitude, tower.longitude, tower.color, tower.towername',
+ extra_sql => ' WHERE tower.disabled is null',
+ addl_from => ' JOIN tower USING (towernum)',
+ order_by => ' ORDER BY towername, sectorname',
+};
+
+my @sectors = qsearch($query);
+</%init>
diff --git a/httemplate/search/svc_broadband-map.html b/httemplate/search/svc_broadband-map.html
index 4c660b016..64a7f98de 100755
--- a/httemplate/search/svc_broadband-map.html
+++ b/httemplate/search/svc_broadband-map.html
@@ -1,6 +1,6 @@
<& /elements/header.html, 'Broadband Search Results' &>
-<& elements/gmap.html, features => \@features &>
+<& elements/gmap.html, features => \@features, overlays => \@overlays &>
<& /elements/footer.html &>
<%init>
@@ -76,7 +76,6 @@ foreach my $svc_broadband (@rows) {
}
- my $tower = $towers{$towernum};
if ( $tower->latitude and $tower->longitude ) {
push @features,
{
@@ -146,6 +145,19 @@ foreach my $tower (values(%towers)) {
};
}
+my @overlays;
+foreach my $sector (values %sectors) {
+ if ( length($sector->image) > 0 ) {
+ push @overlays,
+ { url => $fsurl.'view/sector_map-png.cgi?' . $sector->sectornum,
+ west => $sector->west,
+ east => $sector->east,
+ south => $sector->south,
+ north => $sector->north,
+ };
+ };
+};
+
</%init>
<%def .svc_broadband>
% my $svc = shift;