From a418fce5ab016bebfe456f1fa50053452006c422 Mon Sep 17 00:00:00 2001 From: Mark Wells Date: Tue, 28 Feb 2012 16:16:45 -0800 Subject: directions to customer address, #16585 --- httemplate/view/map.html | 149 ++++++++++++++++------------------------------- 1 file changed, 49 insertions(+), 100 deletions(-) (limited to 'httemplate/view/map.html') diff --git a/httemplate/view/map.html b/httemplate/view/map.html index 1725fd852..3122de6a0 100644 --- a/httemplate/view/map.html +++ b/httemplate/view/map.html @@ -1,120 +1,69 @@ +%# 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> - -my $name = js_string( scalar($cgi->param('name')) ); +<%def .head> + -my $point = [ map scalar($cgi->param($_)), qw( longitude latitude ) ]; + - - -##our own hacked in code for displaying a marker at the center -$header .= ' -var markerOptions = { - map: map, - position: latlng, - title: '. $name. ' -}; -var marker = new google.maps.Marker(markerOptions); -'; +'; - - - #my $div = '
'; - my $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 }); - $header .= " + +<%shared> +my ($lat, $lon, $name); + +<%init> - - "; +$name = $cgi->param('name'); - return ($header,$div) - -} +$lat = $cgi->param('lat'); +$lon = $cgi->param('lon'); +$lat =~ /^-?\d+(\.\d+)?$/ or die "bad latitude: $lat"; +$lon =~ /^-?\d+(\.\d+)?$/ or die "bad longitude: $lat"; -- cgit v1.2.1