diff options
author | Olivier Thauvin <nanardon@mageia.org> | 2010-10-04 00:08:58 +0000 |
---|---|---|
committer | Olivier Thauvin <nanardon@mageia.org> | 2010-10-04 00:08:58 +0000 |
commit | e52246e2ad626b360613ec05401dc3c91c5cec3f (patch) | |
tree | 4c2496aa90d71a9db1f6ac7257e6a3a0aa73e06a | |
parent | dfd160a29aeecf3fb34fef921539c6bad98e44ff (diff) | |
download | mgamirrors-e52246e2ad626b360613ec05401dc3c91c5cec3f.tar mgamirrors-e52246e2ad626b360613ec05401dc3c91c5cec3f.tar.gz mgamirrors-e52246e2ad626b360613ec05401dc3c91c5cec3f.tar.bz2 mgamirrors-e52246e2ad626b360613ec05401dc3c91c5cec3f.tar.xz mgamirrors-e52246e2ad626b360613ec05401dc3c91c5cec3f.zip |
- add link between mirror on map + infowin
-rw-r--r-- | root/html/pages/report/index.tt | 26 |
1 files changed, 25 insertions, 1 deletions
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: '<div style="font-size: 75%">' + + '<p><a href="[% c.uri_for('/mirrors', m.hostname) %]">[% m.hostname %]</a></p>' + + [% IF m.syncfrom %] + '<p>Sync from [% m.syncfrom %]</p>' + + [% END %] + '</div>' + }); + 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 %] } |