Ticket #46: gmaps.patch
| File gmaps.patch, 13.1 kB (added by ChristopherSchmidt, 3 years ago) |
|---|
-
site_index.tt
7 7 <div id="content"> 8 8 [% INCLUDE navbar.tt %] 9 9 <div id="maincontent"> 10 <div id="map" style="float:right;width: 400px; height: 400px"></div> 11 <script defer="defer" type="text/javascript"> 12 //<![CDATA[ 13 14 var map = new GMap(document.getElementById("map")); 15 map.addControl(new GSmallMapControl()); 16 map.centerAndZoom(new GPoint(-71.059270,42.358607), 6); 17 18 [% i = 0 %] 19 [%- FOREACH node = nodes %] 20 [% i = i + 1 %] 21 [% metadata = node.node_data.metadata %] 22 [% IF metadata.latitude.list.first AND metadata.longitude.list.first %] 23 var point[% i %] = new GPoint([% metadata.longitude.list.first %], [% metadata.latitude.list.first %]); 24 var marker[% i %] = new GMarker(point[% i %],baseIcon); 25 var htmlString[% i %] = "<a href=\"?[% node.param %]\">[% node.name %]</a><br />[% metadata.address.list.first %]<br />[% metadata.city.list.first %]"; 26 GEvent.addListener(marker[% i %], "click", function() { 27 marker[% i %].openInfoWindowHtml(htmlString[% i %]); 28 }); 29 map.addOverlay(marker[% i %]); 30 31 32 33 [%- END -%] 34 [%- END -%] 35 //]]> 36 </script> 10 37 <h2>Node List 11 38 [%- IF criterion -%] 12 39 [%- IF criterion.url -%] … … 20 47 [%- END -%] 21 48 </h2> 22 49 <ol> 50 [% i = 0 %] 23 51 [% FOREACH node = nodes %] 52 [% metadata = node.node_data.metadata %] 53 [% i = i + 1 %] 24 54 <li><a href="[% cgi_url %]?[% node.param %]">[% node.name %]</a> 55 [% IF metadata.latitude.list.first AND metadata.longitude.list.first %] <small>(<a href='#' onclick="marker[% i %].openInfoWindowHtml(htmlString[% i %]); return false;">show on map</a>)</small> [% END %] 25 56 [% IF node.distance %]([% node.distance %] metres away)[% END %] 26 57 </li> 27 58 [% END %] -
map_index.tt
1 [% USE CGI %] 2 [% INCLUDE header.tt %] 3 [% INCLUDE banner.tt %] 4 <div id="content"> 5 <a href="" id="permalink">Link to this Page</a> | <a href="" onclick="showTowns(); return false;">Show Town Boundaries</a> 6 <ul style="height:400px; overflow:auto;float:right; width:30%;"> 7 [% i = 0 %] 8 [%- FOREACH node = nodes %] 9 [% metadata = node.node_data.metadata %] 10 [% i = i + 1 %] 11 [% IF metadata.latitude.list.first AND metadata.longitude.list.first %] 12 <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> 13 [%- END -%] 14 [%- END -%] 15 </ul> 16 <table width="100%" height="100%"> 17 <tr> <td> 18 <div id="map" style=" width: 65%; height: 450px"></div> 19 </td></tr></table> 20 <script defer="defer" type="text/javascript"> 21 //<![CDATA[ 22 var map = new GMap(document.getElementById("map")); 23 map.addControl(new GLargeMapControl()); 24 map.addControl(new GMapTypeControl()); 25 map.centerAndZoom(new GPoint([% IF long %][% long %][% ELSE %]-71.059270[% END %],[% IF lat %][% lat %][% ELSE %]42.358607[% END %]), [% IF zoom %][% zoom %][% ELSE %]5[% END %]); 26 27 [% i = 0 %] 28 [%- FOREACH node = nodes %] 29 [% i = i + 1 %] 30 [% metadata = node.node_data.metadata %] 31 [% IF metadata.latitude.list.first AND metadata.longitude.list.first %] 32 var point[% i %] = new GPoint([% metadata.longitude.list.first %], [% metadata.latitude.list.first %]); 33 var marker[% i %] = new GMarker(point[% i %],baseIcon); 34 var htmlString[% i %] = "<a href=\"?[% node.param %]\">[% node.name %]</a> <a style='text-decoration:none;' href=\"?id=[% node.param %];action=edit\">(edit)</a><br />[% metadata.address.list.first %]<br />[% metadata.city.list.first %]"; 35 GEvent.addListener(marker[% i %], "click", function() { 36 marker[% i %].openInfoWindowHtml(htmlString[% i %]); 37 }); 38 map.addOverlay(marker[% i %]); 39 [%- END -%] 40 [%- END -%] 41 function map_recenter() { 42 var center = map.getCenterLatLng(); 43 var link = document.getElementById('permalink'); 44 var zoom = map.getZoomLevel(); 45 link.href = "?action=index;format=map&long="+center.x+"&lat="+center.y+"&zoom="+zoom; 46 } 47 GEvent.addListener(map, "moveend", map_recenter ); 48 //]]> 49 </script> 50 </div> 51 52 [% INCLUDE footer.tt %] -
search.tt
22 22 <a href="[% ss_info_url %]">information page</a> for help and more details. 23 23 </small></p> 24 24 25 <form method="get" action="s earch.cgi">26 <table border="1">25 <form method="get" action="supersearch.cgi"> 26 <table> 27 27 <tr> 28 28 <th> 29 29 <label for="search_upper">Pages containing text:</label> … … 32 32 <input type="text" name="search" value="[% IF search_terms %][% search_terms %][% END %]" size="50" maxlength="80" id="search_upper" /> 33 33 </td> 34 34 </tr> 35 <tr >36 <th> Location:</th>35 <tr valign="top"> 36 <th><p>Location:</p></th> 37 37 <td> 38 38 [% IF coord_field_1 != 'latitude' %] 39 39 <p> … … 56 56 </tr> 57 57 </table> 58 58 </form> 59 59 <script>locations = []; </script> 60 [% IF latitude and longitude %] 61 <div id="map" class='searchmap'></div> 62 <script defer='defer'> 63 var map = new GMap(document.getElementById("map")); 64 map.addOverlay(orangeLine); 65 map.addOverlay(redLine); 66 map.addOverlay(redLineM); 67 map.addOverlay(blueLine); 68 map.addOverlay(greenLine); 69 map.addOverlay(greenLineE); 70 map.addOverlay(greenLineB); 71 map.addOverlay(greenLineC); 72 map.addOverlay(greenLineD); 73 map.addControl(new GSmallMapControl()); 74 map.centerAndZoom(new GPoint([% longitude %], [% latitude %]), 3); 75 </script> 76 [% END %] 60 77 [% IF search_terms OR dist %] 61 78 62 79 <hr /> 63 64 80 [% IF results.size %] 65 81 66 82 <ol start="[% first_num %]"> 67 83 [% FOREACH result = results %] 68 84 <li> 69 <a href="[% result.url %]"><b>[% result.name %]</b></a> (score: [% result.score %])85 <a href="[% result.url %]"><b>[% result.name %]</b></a>[% IF result.score %] (score: [% result.score %])[% END %] 70 86 [% IF result.distance %] 71 87 ([% result.distance %] metres away) 72 88 [% END %][% IF result.summary %] 73 89 <div class="hit_summary"> 74 90 [% result.summary %] 75 </div>[% END %] 91 </div>[% END %] [% IF result.lat AND result.long %]<script> locations.push({'long':[% result.long %], 'lat':[% result.lat %], 'name': "[% result.name %]", 'score': '[% result.score %]', 'distance': '[% result.distance %]', 'summary': "[% result.summary %]"}); </script> [% END %] 76 92 </li> 77 93 [% END %] 78 94 </ol> 79 95 96 [% IF latitude and longitude %] 97 <script defer='defer'> 98 var markers = []; 99 function addEv(myloc,l) { 100 GEvent.addListener(markers[myloc], "click", function() { 101 html = '<div style="width:15em;">'; 102 html += l.name; 103 if (l.score) { 104 html += ' (l.score)'; 105 } 106 if (l.summary) { 107 html += '<br />'+l.summary; 108 } 109 if (l.distance) { 110 html += '<br />'+l.distance+' meters away.'; 111 } 112 html += '</div>'; 113 markers[myloc].openInfoWindowHtml(html); 114 }); 115 } 116 for (var myLocation in locations) { 117 var l = locations[myLocation]; 118 markers[myLocation] = new GMarker(new GPoint(l['long'], l['lat']), baseIcon); 119 addEv(myLocation,l) 120 map.addOverlay(markers[myLocation]); 121 } 122 </script> 123 [% END %] 80 124 <p> 81 125 Matches [% first_num %] - [% last_num %] of [% total_num %]. 82 [% IF (first_num > 20) %]83 <a href="s earch.cgi?search=[% search_terms %]&next=[% first_num - 21 %]">Previous 20results</a>126 [% IF (first_num > page_size) %] 127 <a href="supersearch.cgi?search=[% search_terms %]&next=[% first_num - (page_size + 1) %]">Previous [%- page_size -%] results</a> 84 128 [% END %] 85 [% IF ((first_num > 20) and next_page_startpos) %]129 [% IF ((first_num > page_size) and next_page_startpos) %] 86 130 / 87 131 [% END %] 88 132 [% IF next_page_startpos %] 89 <a href="s earch.cgi?search=[% search_terms %];[% dist_field %]=[% dist %];[% coord_field_1 %]=[% coord_field_1_value %];[% coord_field_2 %]=[% coord_field_2_value %];next=[% next_page_startpos %]">Next90 [% IF ((total_num - last_num >= 20)) %]91 20133 <a href="supersearch.cgi?search=[% search_terms %];[% dist_field %]=[% dist %];[% coord_field_1 %]=[% coord_field_1_value %];[% coord_field_2 %]=[% coord_field_2_value %];next=[% next_page_startpos %]">Next 134 [% IF ((total_num - last_num >= page_size)) %] 135 [%- page_size -%] 92 136 [% ELSE %] 93 137 [% total_num - last_num %] 94 138 [% END %] … … 100 144 <h2>No Items Matched</h2> 101 145 [% END %] 102 146 103 <form method="get" action="s earch.cgi">147 <form method="get" action="supersearch.cgi"> 104 148 <label for="search_lower">Search:</label> 105 149 <input type="text" name="search" id="search_lower" value="[% search_terms %]" size="50" maxlength="80" value="Search text" onclick="this.value=''" /> 106 150 <input type="submit" name="go" class="form_button" value="Go" /> -
node.tt
7 7 [% IF oldid %] 8 8 <div id="redirect_message">(redirected from <a href="[% full_cgi_url %]?id=[% oldid %];redirect=0">[% oldid.replace('_', ' ') %]</a>)</div> 9 9 [% END %] 10 [% IF latitude AND longitude %] 10 11 12 <div id="map" style="float:right; width: 300px; height: 200px"></div> 13 <script defer="defer" type="text/javascript"> 14 //<![CDATA[ 15 16 var map = new GMap(document.getElementById("map")); 17 map.addControl(new GSmallMapControl()); 18 map.centerAndZoom(new GPoint([% longitude %], [% latitude %]), 3); 19 var point0 = new GPoint([% longitude %], [% latitude %]); 20 var marker0 = new GMarker(point0,baseIcon); 21 GEvent.addListener(marker0, "click", function() { 22 marker0.openInfoWindowHtml("[% node_name %]"); 23 }); 24 map.addOverlay(marker0); 25 26 //]]> 27 </script> 28 [% END %] 29 11 30 [% IF current %] 12 31 [% IF backlinks_in_title AND is_indexable_node %] 13 32 <h2 class="node_name"><a href="[% cgi_url %]?action=index;index_type=[% CGI.escape(index_type) %];index_value=[% CGI.escape(index_value) %]">[% node_name %]</a></h2> … … 23 42 </h2> 24 43 [% END %] 25 44 [% IF not (content || coord_field_1_value || coord_field_2_value || latitude || longitude) %] 26 We don't have a node called "[% node_ param %]". Would you like to <a href="[% full_cgi_url %]?action=edit;id=[% node_param %]">create it</a>?45 We don't have a node called "[% node_name %]". Would you like to <a href="/?action=edit;id=[% node_param %]">make it</a>? 27 46 [% ELSE %] 28 47 [% INCLUDE display_metadata.tt %] 29 48 … … 34 53 [% TRY %] 35 54 [% INCLUDE custom_node.tt %] 36 55 [% CATCH %] 37 [% END %]38 56 39 57 [% IF coord_field_1_value AND coord_field_2_value %] 40 58 <br clear="all" /> 41 59 <div id="find_within_distance"> 42 <form action="s earch.cgi">60 <form action="supersearch.cgi"> 43 61 <label for="distance">Find all things within</label> 44 62 <select name="[% dist_field %]" id="distance"> 45 63 <option value="500">500 metres</option> … … 103 121 [% END %] 104 122 </div> 105 123 [% END %] 124 [% END %] 106 125 </div> 107 126 [% INCLUDE footer.tt %] -
header.tt
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01Transitional//EN"2 "http://www.w3.org/TR/html4/loose.dtd">3 <html lang="[% language %]">1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 2 "http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-transitional.dtd"> 3 <html xmlns="http://www.w3.org/1999/xhtml" lang="[% language %]" xmlns:v="urn:schemas-microsoft-com:vml"> 4 4 <head> 5 <style type="text/css"> 6 v\:* { 7 behavior:url(#default#VML); 8 } 9 </style> 5 10 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 6 11 [% IF page_title %] 7 12 <title>[% page_title %]</title> … … 28 33 [% IF deter_robots %] 29 34 <meta name="robots" content="noindex,nofollow" /> 30 35 [% END %] 36 <script src="http://maps.google.com/maps?file=api&v=1&key=[% gmaps_api_key %]" type="text/javascript"></script> 31 37 </head> 32 38 <body> 39 <script defer="defer" type="text/javascript"> 40 //<![CDATA[ 41 42 var baseIcon = new GIcon(); 43 baseIcon.image = "http://www.google.com/mapfiles/marker.png"; 44 baseIcon.shadow = "http://www.google.com/mapfiles/shadow50.png"; 45 baseIcon.iconSize = new GSize(10, 17); 46 baseIcon.shadowSize = new GSize(20, 17); 47 baseIcon.iconAnchor = new GPoint(5, 17); 48 baseIcon.infoWindowAnchor = new GPoint(9, 2); 49 baseIcon.infoShadowAnchor = new GPoint(9, 12); 50 51 52 //]]> 53 </script>
