diff --git a/files/etc/config.mesh/system b/files/etc/config.mesh/system
index 17090087..23f9e78a 100644
--- a/files/etc/config.mesh/system
+++ b/files/etc/config.mesh/system
@@ -21,4 +21,9 @@ config button
option min '12'
option max '20'
+config map
+ option leafletjs 'http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.js'
+ option leafletcss 'http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.css'
+ option maptiles 'http://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=pk.eyJ1IjoiazVkbHEiLCJhIjoiY2lqMnlieTM4MDAyNXUwa3A2eHMxdXE3MiJ9.BRFvx4q2vi70z5Uu2zRYQw'
+
include /etc/aredn_include/system_netled
diff --git a/files/etc/config/system b/files/etc/config/system
index 4284c310..5014ca6a 100644
--- a/files/etc/config/system
+++ b/files/etc/config/system
@@ -19,3 +19,8 @@ config button
option handler 'firstboot -y && reboot'
option min '12'
option max '20'
+
+config map
+ option leafletjs 'http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.js'
+ option leafletcss 'http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.css'
+ option maptiles 'http://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=pk.eyJ1IjoiazVkbHEiLCJhIjoiY2lqMnlieTM4MDAyNXUwa3A2eHMxdXE3MiJ9.BRFvx4q2vi70z5Uu2zRYQw'
\ No newline at end of file
diff --git a/files/www/cgi-bin/setup b/files/www/cgi-bin/setup
index 4ad5eca6..55f73dc2 100755
--- a/files/www/cgi-bin/setup
+++ b/files/www/cgi-bin/setup
@@ -41,6 +41,7 @@ $debug = 0;
BEGIN {push @INC, '/www/cgi-bin'};
use perlfunc;
use channelmaps;
+use ucifunc;
#
# load the config parms
#
@@ -464,6 +465,12 @@ if($parms{button_save})
system "rm -rf /tmp/web/save";
reboot_page("/cgi-bin/status") if $parms{button_reboot};
+#
+# Retreive map url, css, and js locations
+#
+my ($rc, $maptiles)=&uci_get_indexed_option("system","map",0,"maptiles");
+my ($rc, $leafletcss)=&uci_get_indexed_option("system","map",0,"leafletcss");
+my ($rc, $leafletjs)=&uci_get_indexed_option("system","map",0,"leafletjs");
#
# generate the page
@@ -471,8 +478,8 @@ reboot_page("/cgi-bin/status") if $parms{button_reboot};
http_header() unless $debug == 2;
html_header(nvram_get("node") . " setup", 0);
-print "\n" if($pingOk);
-print "\n" if($pingOk);
+print "\n";
+print "\n";
print "";
print "
\n";
@@ -551,7 +558,7 @@ function toggleMap(toggleButton) {
// force the map to redraw
map.invalidateSize();
return false;
-}" if(pingOk);
+}";
print "";
@@ -1027,19 +1034,18 @@ print "";
print " ";
print "";
+print " ";
if($pingOk)
{
- print " ";
print " ";
} else {
- print " ";
print " ";
}
print " | \n";
print "Longitude | | ";
print "Grid Square | |
\n";
-print " |
" if($pingOk);
+print " |
";
print "
|
";
print "
Timezone |
@@ -1084,34 +1090,36 @@ show_parse_errors();
page_footer();
-if($pingOk)
-{
- print <
- var map = L.map('map').setView([0.0, 0.0], 1);
- L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=pk.eyJ1IjoiazVkbHEiLCJhIjoiY2lqMnlieTM4MDAyNXUwa3A2eHMxdXE3MiJ9.BRFvx4q2vi70z5Uu2zRYQw', {
- maxZoom: 18,
- attribution: 'Map data © OpenStreetMap contributors, ' +
- 'CC-BY-SA, ' +
- 'Imagery ©Mapbox',
- id: 'mapbox.streets'
- }).addTo(map);
+print <
+var map = L.map('map').setView([0.0, 0.0], 1);
+var dotIcon = L.icon({iconUrl: '/dot.png'});
+EOF
+print "L.tileLayer('$maptiles',";
+print <OpenStreetMap contributors, ' +
+ 'CC-BY-SA, ' +
+ 'Imagery ©Mapbox',
+ id: 'mapbox.streets'
+ }).addTo(map);
- var marker;
+var marker;
- function onMapClick(e) {
- marker= new L.marker(e.latlng,{draggable: true});
- map.addLayer(marker);
- document.getElementsByName('latitude')[0].value=e.latlng.lat.toFixed(6).toString();
- document.getElementsByName('longitude')[0].value=e.latlng.lng.toFixed(6).toString();
- map.off('click', onMapClick);
- marker.on('drag', onMarkerDrag);
- }
+function onMapClick(e) {
+ marker= new L.marker(e.latlng,{draggable: true, icon: dotIcon});
+ map.addLayer(marker);
+ document.getElementsByName('latitude')[0].value=e.latlng.lat.toFixed(6).toString();
+ document.getElementsByName('longitude')[0].value=e.latlng.lng.toFixed(6).toString();
+ map.off('click', onMapClick);
+ marker.on('drag', onMarkerDrag);
+}
EOF
if($lat and $lon)
{
- print "marker= new L.marker([$lat,$lon],{draggable: true});";
+ print "marker= new L.marker([$lat,$lon],{draggable: true, icon: dotIcon});";
print "map.addLayer(marker);";
print "map.setView([$lat,$lon],13);";
print "marker.on('drag', onMarkerDrag);";
@@ -1128,6 +1136,6 @@ EOF
}
EOF
-}
+#}
print "\n";
-print "