Only use Google Maps API key if configured

This commit is contained in:
Graham Triggs 2016-07-29 16:42:31 +01:00
parent 2ca805b4ff
commit 6881257f57
2 changed files with 10 additions and 5 deletions

View file

@ -454,9 +454,10 @@ public class MapOfScienceVisualizationRequestHandler implements VisualizationReq
ConfigurationProperties properties = ConfigurationProperties.getBean(vreq); ConfigurationProperties properties = ConfigurationProperties.getBean(vreq);
if (properties != null) { if (properties != null) {
body.put("googleMapsKey", properties.getProperty("google.maps.key", "AIzaSyCAexrHLqAu6Rb18DWqwrb-vx1PQQFkAQA")); String key = properties.getProperty("google.maps.key");
} else { if (!StringUtils.isEmpty(key)) {
body.put("googleMapsKey", "AIzaSyCAexrHLqAu6Rb18DWqwrb-vx1PQQFkAQA"); body.put("googleMapsKey", key);
}
} }
return new TemplateResponseValues(standaloneTemplate, body); return new TemplateResponseValues(standaloneTemplate, body);

View file

@ -107,8 +107,12 @@ var i18nStrings = {
}; };
</script> </script>
${scripts.add('<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=${googleMapsKey}"></script>', <#if googleMapsKey??>
'<script type="text/javascript" src="${urls.base}/js/jquery-ui/js/jquery-ui-1.8.9.custom.min.js"></script>', ${scripts.add('<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=${googleMapsKey}"></script>')}
<#else>
${scripts.add('<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>')}
</#if>
${scripts.add('<script type="text/javascript" src="${urls.base}/js/jquery-ui/js/jquery-ui-1.8.9.custom.min.js"></script>',
'<script type="text/javascript" src="${urls.base}/js/jquery_plugins/jquery.blockUI.min.js"></script>', '<script type="text/javascript" src="${urls.base}/js/jquery_plugins/jquery.blockUI.min.js"></script>',
'<script type="text/javascript" src="${urls.base}/js/jquery_plugins/datatable/1.7.6/jquery.dataTables.min.js"></script>', '<script type="text/javascript" src="${urls.base}/js/jquery_plugins/datatable/1.7.6/jquery.dataTables.min.js"></script>',
'<script type="text/javascript" src="${urls.base}/js/visualization/dataTables.helper.js"></script>', '<script type="text/javascript" src="${urls.base}/js/visualization/dataTables.helper.js"></script>',