Ticket #13117: widget.diff
File widget.diff, 2.0 KB (added by , 15 years ago) |
---|
-
contrib/gis/templates/gis/admin/openlayers.html
29 29 {% block openlayers %}{% include "gis/admin/openlayers.js" %}{% endblock %} 30 30 //]]> 31 31 </script> 32 <div id="{{module}}_recenter"> 33 <label for="{{module}}_lat">Lattitude:</label><input class="{{module}}_lat" type="text"><br> 34 <label for="{{module}}_lng">Longitude:</label><input class="{{module}}_lng" type="text"> 35 <input type="button" class="{{module}}_recenter" value="Recenter" /> 36 </div> 32 37 <div id="{{ id }}_map"{% if LANGUAGE_BIDI %} dir="ltr"{% endif %}></div> 33 38 <a href="javascript:{{ module }}.clearFeatures()">Delete all Features</a> 34 39 {% if display_wkt %}<p> WKT debugging window:</p>{% endif %} -
contrib/gis/templates/gis/admin/openlayers.js
158 158 {{ module }}.enableDrawing(); 159 159 } 160 160 } 161 162 jQuery(document).ready(function() { 163 164 jQuery("input.{{module}}_recenter").click(function() { 165 // when the button is clicked, re-center the 166 // map to the entered coordinates 167 168 //get coordinates from the text boxes 169 var lat = jQuery("input.{{module}}_lat").val(); 170 var lng = jQuery("input.{{module}}_lng").val(); 171 172 // create two projection objects 173 // lat/lng (EPSG:4326) 174 // and the current one (EPSG:900913) 175 var latlng_proj = new OpenLayers.Projection("EPSG:4326"); 176 var this_proj = {{ module }}.map.projection; 177 178 // convert 179 ll = new OpenLayers.LonLat(lng, lat); 180 ll.transform(latlng_proj, this_proj); 181 182 // now re-center 183 {{ module }}.map.setCenter(ll); 184 }); 185 186 });