2 <& /elements/header-popup.html, {
4 head => include('.head'),
5 etc => 'onload="initialize()"',
10 <div id="map_canvas"></div>
13 <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
15 <style type="text/css">
18 body { height: 100%; margin: 0px; padding: 0px }
20 #map_canvas { height: 100%; }
22 @media print { #map_canvas { height: 500px; margin: 0; } }
25 <script type="text/javascript" src="https://maps.google.com/maps/api/js?v=3<% $apikey ? '&key='.$apikey : '' %>">
28 <script type="text/javascript">
32 // function name specified by google maps api, special hook for auth errors
33 function gm_authFailure () {
34 document.body.innerHTML =
35 <% include('/elements/google_maps_api_key.html', autherror => $apikey ) |js_string%>;
39 function initialize() {
40 var latlng = new google.maps.LatLng(<%$lat%>, <%$lon%>);
45 mapTypeId: google.maps.MapTypeId.ROADMAP
48 map = new google.maps.Map(
49 document.getElementById("map_canvas"),
52 map.setOptions( {rotateControl : true });
57 title: <%$name |js_string%>
59 var marker = new google.maps.Marker(markerOptions);
64 my ($lat, $lon, $name);
65 my $conf = new FS::Conf;
66 my $apikey = $conf->config('google_maps_api_key');
70 $name = $cgi->param('name');
72 $lat = $cgi->param('lat');
73 $lon = $cgi->param('lon');
74 $lat =~ /^-?\d+(\.\d+)?$/ or die "bad latitude: $lat";
75 $lon =~ /^-?\d+(\.\d+)?$/ or die "bad longitude: $lat";