X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fview%2Fmap.html;h=01ffc6db73dc799e9603b1b0f92d455cd9d5edd7;hp=1725fd852db24932d629a072cef958eeb667fc01;hb=0ae9ab3d7db1f7c231028717dcdbc0e35e030ed4;hpb=fb4ab1073f0d15d660c6cdc4e07afebf68ef3924 diff --git a/httemplate/view/map.html b/httemplate/view/map.html index 1725fd852..01ffc6db7 100644 --- a/httemplate/view/map.html +++ b/httemplate/view/map.html @@ -1,120 +1,77 @@ +%# the actual page <& /elements/header-popup.html, { title => '',#$name, - head => $head, - etc => 'onload="html_googlemaps_initialize()"', + head => include('.head'), + etc => 'onload="initialize()"', nobr => 1, } &> -<% $map_div %> +
-<%init> +<%def .head> + + + -my $point = [ map scalar($cgi->param($_)), qw( longitude latitude ) ]; + -my( $head, $map_div ) = onload_render( - $name, - map scalar($cgi->param($_)), qw( lat lon ) -); + - '; - - - #my $div = '
'; - my $div = '
'; - - - $header .= ""; - - return ($header,$div) - + +function initialize() { + var latlng = new google.maps.LatLng(<%$lat%>, <%$lon%>); + var myOptions = { + center: latlng, + zoom: 14, + rotateControl: true, + mapTypeId: google.maps.MapTypeId.ROADMAP + }; + + map = new google.maps.Map( + document.getElementById("map_canvas"), + myOptions + ); + map.setOptions( {rotateControl : true }); + + var markerOptions = { + map: map, + position: latlng, + title: <%$name |js_string%> + }; + var marker = new google.maps.Marker(markerOptions); } + + +<%shared> +my ($lat, $lon, $name); +my $conf = new FS::Conf; +my $apikey = $conf->config('google_maps_api_key'); + +<%init> + +$name = $cgi->param('name'); + +$lat = $cgi->param('lat'); +$lon = $cgi->param('lon'); +$lat =~ /^-?\d+(\.\d+)?$/ or die "bad latitude: $lat"; +$lon =~ /^-?\d+(\.\d+)?$/ or die "bad longitude: $lat";