Ability to turn gridsquare map on and off

This commit is contained in:
Peter Goodhall 2019-06-24 18:21:02 +01:00
parent 9fb7051c1a
commit 91dc6dde94
2 changed files with 17 additions and 3 deletions

View File

@ -100,6 +100,7 @@ $(document).ready(function(){
<?php } ?> <?php } ?>
<?php if ($this->uri->segment(1) == "logbook" && $this->uri->segment(2) != "view") { ?> <?php if ($this->uri->segment(1) == "logbook" && $this->uri->segment(2) != "view") { ?>
<script type="text/javascript" src="<?php echo base_url();?>assets/js/leaflet/L.Maidenhead.js"></script>
<script type="text/javascript" src="<?php echo base_url();?>assets/js/leaflet/leafembed.js"></script> <script type="text/javascript" src="<?php echo base_url();?>assets/js/leaflet/leafembed.js"></script>
<script type="text/javascript"> <script type="text/javascript">
@ -114,7 +115,12 @@ $(document).ready(function(){
var qso_loc = '<?php echo site_url('logbook/qso_map/25/'.$this->uri->segment(3)); ?>'; var qso_loc = '<?php echo site_url('logbook/qso_map/25/'.$this->uri->segment(3)); ?>';
var q_zoom = 2; var q_zoom = 2;
initmap(); <?php if ($this->config->item('map_gridsquares') != FALSE) { ?>
var grid = "Yes";
<?php } else { ?>
var grid = "No";
<?php } ?>
initmap(grid);
</script> </script>
<?php } ?> <?php } ?>

View File

@ -23,11 +23,19 @@ function initmap(ShowGrid = 'No') {
// start the map in South-East England // start the map in South-East England
map.setView(new L.LatLng(q_lat, q_lng), q_zoom); map.setView(new L.LatLng(q_lat, q_lng), q_zoom);
map.addLayer(osm);
map.addLayer(osm);
askForPlots(); askForPlots();
map.on('moveend', onMapMove); map.on('moveend', onMapMove);
if(ShowGrid == "Yes") {
var maidenhead = L.maidenhead().addTo(map);
}
var layerControl = new L.Control.Layers(null, {
'Gridsquares': maidenhead = L.maidenhead()
}).addTo(map);
} }
function getXmlHttpObject() { function getXmlHttpObject() {