Commit c407e098 authored by Matija Obreza's avatar Matija Obreza
Browse files

Google Maps: i18n, no streetView

parent 32572456
......@@ -160,6 +160,7 @@
<c:if test="${accessionEnvironment.latitude ne null}">
<tr>
<td colspan="2">
<h4><spring:message code="accession.collecting.site" /></h4>
<div id="accessionMap" style="width: 100%; height: 300px">Loading Google Maps...</div>
</td>
</tr>
......@@ -244,7 +245,7 @@
<c:if test="${accessionEnvironment ne null and accessionEnvironment.latitude ne null}">
<script type="text/javascript">
jQuery(document).ready(function() {
var accessionMap=GoogleMaps.map($("#accessionMap"), { center: new GoogleMaps.LatLng(${accessionEnvironment.latitude}, ${accessionEnvironment.longitude}), markerTitle: "<spring:escapeBody javaScriptEscape="true">${accession.accessionName}, ${accession.instituteCode}</spring:escapeBody>" });
var accessionMap=GoogleMaps.map("${pageContext.response.locale.language}", $("#accessionMap"), { center: new GoogleMaps.LatLng(${accessionEnvironment.latitude}, ${accessionEnvironment.longitude}), markerTitle: "<spring:escapeBody javaScriptEscape="true">${accession.accessionName}, ${accession.instituteCode}</spring:escapeBody>" });
});
</script>
</c:if>
......
......@@ -30,15 +30,17 @@ GoogleMaps = {
defaultOptions: {
zoom: 5,
center: new GoogleMaps.LatLng(0, 0),
mapTypeId: "terrain"
mapTypeId: "terrain",
streetViewControl: false
},
map: function(doms, mapOptions) {
map: function(language, doms, mapOptions) {
var mapOpt = {
zoom: mapOptions.zoom || this.defaultOptions.zoom,
center: mapOptions.center || this.defaultOptions.center,
mapTypeId: mapOptions.mapTypeId || this.defaultOptions.mapTypeId,
markerTitle: mapOptions.markerTitle || null
markerTitle: mapOptions.markerTitle || null,
streetViewControl: mapOptions.streetViewControl || this.defaultOptions.streetViewControl
};
doms.each(function(idx,el) {
if ($.inArray(el, this.loadedMaps) < 0) {
......@@ -47,15 +49,15 @@ GoogleMaps = {
}
});
this.loadGoogleMaps();
this.loadGoogleMaps(language);
},
loadGoogleMaps: function() {
loadGoogleMaps: function(language) {
if (! this.loaded) {
this.loaded = true;
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = 'https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&&callback=GoogleMaps.onLoad';
script.src = 'https://maps.googleapis.com/maps/api/js?language=' + language + '&v=3&sensor=false&&callback=GoogleMaps.onLoad';
document.body.appendChild(script);
} else {
this.onLoad();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment