<h4 {if $memberInfo.fieldRequired.county}class="glm-required"{/if}>County:</h4>
<div {if $memberInfo.fieldFail.county}class="glm-form-bad-input" data-tabid="glm-member-info-address"{/if}>
<select name="county">
+ <option value="0"{if $v.default} selected="selected"{/if}></option>
{foreach from=$memberInfo.fieldData.county.list item=v}
<option value="{$v.value}"{if $v.default} selected="selected"{/if}>{$v.name}</option>
{/foreach}
Click and drag anywhere else on the map to move to another area.
</p>
<p><div id="glm-estimate-location" class="button button-secondary">Map Location Using Above Address</div></p>
-
- {if $settings.selected_map_interface == 1}
+
+ {if $settings.selected_map_interface == 1}
<!-- Leaflet Map -->
<div id="LeafletMapContainer" style="height: 400px; width: 100%;"></div>
{/if}
-
- {if $settings.selected_map_interface == 2}
+
+ {if $settings.selected_map_interface == 2}
<!-- Google Map -->
- <div id="GoogleMap" class="glm-map-edit-small" style="height: 400; width: 600px;">(map loads here)</div>
+ <div id="GoogleMap" class="glm-map-edit-small" style="height: 400; width: 600px;">(map loads here)</div>
{/if}
-
-
+
+
<p>
<h4>Specify Position Using Lattitude and Longitude:</h4>
Latitude <input id="glmLat" name="lat" type="text" value="{$memberInfo.fieldData.lat}" class="glm-form-text-input-veryshort">
/*
* Map operations
*/
-
+
var startLat = $('#glmLat').val();
var startLon = $('#glmLng').val();
var defZoom = Number({$settings.maps_default_zoom});
-
- {if $settings.selected_map_interface == 1}
-
+
+ {if $settings.selected_map_interface == 1}
+
/*
* Leaflet Map
* API reference: https://leafletjs.com/reference-1.3.2.html
var leafletMinZoom = 5;
var leafletMaxZoom = 18;
var geocoder;
-
+
// Tile server
L.tileLayer(leafletTileServer, {
attribution: 'Map data © <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="https://www.gaslightmedia.com/">Gaslight Media</a>',
maxZoom: leafletMaxZoom,
id: 'nothot'
}).addTo(leafletMap);
-
+
// Marker
var leafletMarker = L.marker([startLat, startLon], {
draggable: true
}).addTo(leafletMap);
-
+
// Marker Drag/Drop action
leafletMarker.on('dragend', function(event){
var marker = event.target;
var position = marker.getLatLng();
-
+
marker.setLatLng(new L.LatLng(position.lat, position.lng),{ draggable:'true' });
leafletMap.panTo(new L.LatLng(position.lat, position.lng))
-
+
// Assign it to the lat/lon fields for submission
$('#glmLat').val(position.lat.toFixed(6));
$('#glmLng').val(position.lng.toFixed(6));
if( !data[0] || !data[0].lat || !data[0].lon ) {
alert(addressMapFail);
} else {
- assignNewPosition(data);
+ assignNewPosition(data);
alert('We were unable to match all of your address data but did find this location.\n\n' + data[0].display_name + '\n\nPlease check that it is correct and adjust as needed by dragging the map pointer.\nYou may also want to check the city selected in the address.');
}
});
} else {
- assignNewPosition(data);
+ assignNewPosition(data);
}
- });
-
+ });
+
});
// Assign a position found by the Nominatim search above
{/if}
- {if $settings.selected_map_interface == 2}
-
+ {if $settings.selected_map_interface == 2}
+
/*
* Google Maps
* API reference: https://developers.google.com/maps/documentation/javascript/reference
}
});
}
-
+
{/if}
$(window).load(function(){
initMap();
});
-
+
});
</script>