+% if ( $apikey ) {
+
%# the actual page
<& /elements/header-popup.html, {
title => '',#$name,
<div id="map_canvas"></div>
+% } else {
+<& /elements/header-popup.html &>
+<& /elements/google_maps_api_key.html &>
+% }
+
<%def .head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
@media print { #map_canvas { height: 500px; margin: 0; } }
</style>
-<script type="text/javascript"
-src="https://maps.google.com/maps/api/js?v=3.4&sensor=false">
+<script type="text/javascript" src="https://maps.google.com/maps/api/js?v=3&key=<% $apikey %>">
</script>
<script type="text/javascript">
var lengthLine=0;
var map;
+// function name specified by google maps api, special hook for auth errors
+function gm_authFailure () {
+ document.body.innerHTML =
+<% include('/elements/google_maps_api_key.html', autherror => 1) |js_string%>;
+}
+
+
function initialize() {
var latlng = new google.maps.LatLng(<%$lat%>, <%$lon%>);
var myOptions = {
</%def>
<%shared>
my ($lat, $lon, $name);
+my $conf = new FS::Conf;
+my $apikey = $conf->config('google_maps_api_key');
</%shared>
<%init>