From e52246e2ad626b360613ec05401dc3c91c5cec3f Mon Sep 17 00:00:00 2001 From: Olivier Thauvin Date: Mon, 4 Oct 2010 00:08:58 +0000 Subject: - add link between mirror on map + infowin --- root/html/pages/report/index.tt | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'root/html') diff --git a/root/html/pages/report/index.tt b/root/html/pages/report/index.tt index b360813..5fac7ab 100644 --- a/root/html/pages/report/index.tt +++ b/root/html/pages/report/index.tt @@ -15,11 +15,35 @@ [% FOREACH m = c.model('Mirrors').find_mirrors %] [% IF m.latitude %] var myLatlng = new google.maps.LatLng([% m.latitude %],[% m.longitude %]); - var marker = new google.maps.Marker({ + var marker[% loop.count %] = new google.maps.Marker({ position: myLatlng, map: map, title:"[% m.hostname %]" }); + var infowindow[% loop.count %] = new google.maps.InfoWindow({ + content: '
' + + '

[% m.hostname %]

' + + [% IF m.syncfrom %] + '

Sync from [% m.syncfrom %]

' + + [% END %] + '
' + }); + google.maps.event.addListener(marker[% loop.count %], 'click', function() { + infowindow[% loop.count %].open(map,marker[% loop.count %]); + }); +[% IF m.syncfrom %] +[% mf = c.model('Mirrors').find_mirrors({ hostname => m.syncfrom }) %] + [% IF mf.0.latitude %] + var fLatLng = new google.maps.LatLng([% mf.0.latitude %], [% mf.0.longitude %]); + var flightPath = new google.maps.Polyline({ + path: [ fLatLng, myLatlng ], + strokeColor: "#FF0000", + strokeOpacity: 1.0, + strokeWeight: 2 + }); + flightPath.setMap(map); + [% END %] +[% END %] [% END %] [% END %] } -- cgit v1.2.1