diff options
Diffstat (limited to 'root/html/includes/host_information.tt')
-rw-r--r-- | root/html/includes/host_information.tt | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/root/html/includes/host_information.tt b/root/html/includes/host_information.tt index c0cb7cb..2c9b574 100644 --- a/root/html/includes/host_information.tt +++ b/root/html/includes/host_information.tt @@ -1,4 +1,5 @@ <!-- $Id$ --> +<div style="float: left"> <form action="[% action || c.uri_for() %]" method="POST"> <input type="hidden" name="hostinfo" value="1"> <table border=0> @@ -18,6 +19,16 @@ <input type="text" name="city" value="[% host.city | html %]"> </td> </tr> +<tr><th>Latitude</th> +<td> +<input type="text" id="latitude" name="latitude" value="[% host.latitude | html %]"> +</td> +</tr> +<tr><th>Longitude</th> +<td> +<input type="text" id="longitude" name="longitude" value="[% host.longitude | html %]"> +</td> +</tr> [% FOREACH mirror = c.model('Mirrors').find_mirrors %] [% IF loop.first %] @@ -48,3 +59,40 @@ </table> <input type="submit"> </form> +</div> + +<script type="text/javascript" + src="http://maps.google.com/maps/api/js?sensor=false"> +</script> +<script type="text/javascript"> + function initialize() { + var latlng = new google.maps.LatLng( + [% host.latitude || 0 %], + [% host.longitude || 0 %] + ); + var myOptions = { + zoom: 4, + center: latlng, + mapTypeId: google.maps.MapTypeId.ROADMAP + }; + var map = new google.maps.Map(document.getElementById("map_canvas"), + myOptions); + + google.maps.event.addListener(map, 'click', function(event) { + recordposition(event.latLng); + }); + + function recordposition(location) { + document.getElementById("latitude").value = location.lat(); + document.getElementById("longitude").value = location.lng(); + } + } + +</script> + +<div id="map_canvas" style="float: left; width:40%; height:300px"></div> +<div style="clear: both"></div> + +<script type="text/javascript"> + initialize(); +</script> |