source: trunk/templates/map_index.tt @ 731

Last change on this file since 731 was 731, checked in by Dominic Hargreaves, 16 years ago

Couple of things missing from previous commit.

File size: 2.6 KB
Line 
1[% INCLUDE header.tt page_title = "Map of all nodes" %]
2[% INCLUDE banner.tt %]
3<div id="content">
4<a href="" id="permalink">Link to this Page</a> | <a href="" onclick="showTowns(); return false;">Show Town Boundaries</a>
5
6<div id="maincontent">
7
8[% IF gmaps_api_key %]
9  <ul style="height:400px; overflow:auto;float:right; width:30%;">
10  [% i = 0 %]
11  [% FOREACH node = nodes %]
12    [% metadata = node.node_data.metadata %]
13    [% i = i + 1 %]
14    [% IF metadata.latitude.list.first AND metadata.longitude.list.first %]
15      <li><a href='#' onclick="marker[% i %].openInfoWindowHtml(htmlString[% i %]); return false;">[% node.name %]</a>[% IF metadata.city.list.first %], [% metadata.city.list.first %][% END %]</li>
16    [% END %]
17  [% END %]
18  </ul>
19
20  <table width="100%" height="100%">
21  <tr><td><div id="map" style=" width: 65%; height: 450px"></div></td></tr>
22  </table>
23
24  <script defer="defer" type="text/javascript">
25    //<![CDATA[
26      var map = new GMap(document.getElementById("map"));
27      map.addControl(new GLargeMapControl());
28      map.addControl(new GMapTypeControl());
29      map.centerAndZoom(new GPoint([% IF long %][% long %][% ELSE %][% centre_long %][% END %],[% IF lat %][% lat %][% ELSE %][% centre_lat %][% END %]), [% IF zoom %][% zoom %][% ELSE %][% default_gmaps_zoom %][% END %]);
30
31      [% i = 0 %]
32      [% FOREACH node = nodes %]
33        [% i = i + 1 %]
34        [% metadata = node.node_data.metadata %]
35        [% IF metadata.latitude.list.first AND metadata.longitude.list.first %]
36          var point[% i %] = new GPoint([% metadata.longitude.list.first %], [% metadata.latitude.list.first %]);
37          var marker[% i %] = new GMarker(point[% i %],baseIcon);
38          var htmlString[% i %] = "<a href=\"?[% node.param %]\">[% node.name %]</a>&nbsp;<a style='text-decoration:none;' href=\"?id=[% node.param %];action=edit\">(edit)</a><br />[% metadata.address.list.first %]<br />[% metadata.city.list.first %]";
39          GEvent.addListener(marker[% i %], "click", function() {
40            marker[% i %].openInfoWindowHtml(htmlString[% i %]);
41            });
42          map.addOverlay(marker[% i %]);
43        [% END %]
44      [% END %]
45      function map_recenter() {
46        var center = map.getCenterLatLng();
47        var link = document.getElementById('permalink');
48        var zoom = map.getZoomLevel();
49        link.href = "?action=index;format=map&long="+center.x+"&lat="+center.y+"&zoom="+zoom;
50      }
51      GEvent.addListener(map, "moveend", map_recenter );
52    //]]>
53  </script>
54[% ELSE %]
55  Sorry, this guide doesn't have Google Maps functionality enabled.
56[% END %]
57
58</div>
59</div>
60
61[% INCLUDE footer.tt %]
Note: See TracBrowser for help on using the repository browser.