diff options
Diffstat (limited to 'design')
-rw-r--r-- | design/templates/admin/daily/change_form.html | 15 | ||||
-rw-r--r-- | design/templates/gis/admin/openlayers.html | 30 |
2 files changed, 45 insertions, 0 deletions
diff --git a/design/templates/admin/daily/change_form.html b/design/templates/admin/daily/change_form.html new file mode 100644 index 0000000..23c2fb6 --- /dev/null +++ b/design/templates/admin/daily/change_form.html @@ -0,0 +1,15 @@ +{% extends "admin/change_form.html" %} +{% load i18n admin_urls %} +{% block object-tools-items %} + <li> + <a onclick="geoFindMe();" href="javascript:void(0);" class="historylink">Get Location</a> + </li> + <li> + <a href="{% url opts|admin_urlname:'history' original.pk|admin_urlquote %}" class="historylink">{% trans "History" %}</a> + </li> + {% if has_absolute_url %} + <li> + <a href="{% url 'admin:view_on_site' content_type_id original.pk %}" class="viewsitelink">{% trans "View on site" %}</a> + </li> + {% endif %} +{% endblock %} diff --git a/design/templates/gis/admin/openlayers.html b/design/templates/gis/admin/openlayers.html index a61b689..f4efdcc 100644 --- a/design/templates/gis/admin/openlayers.html +++ b/design/templates/gis/admin/openlayers.html @@ -1,4 +1,33 @@ {% block extrastyle %} +<script> +function geoFindMe() { + var output = document.getElementById("out"); + + if (!navigator.geolocation){ + output.innerHTML = "<p>Geolocation is not supported by your browser</p>"; + return; + } + + function success(position) { + var lat = position.coords.latitude; + var lon = position.coords.longitude; + var proj = new OpenLayers.Projection("EPSG:4326"); + var point = new OpenLayers.LonLat(lon, lat); + var wkt = point.transform(proj, geodjango_point.map.getProjectionObject()); + var wkttemp = "SRID=3857;POINT(" + wkt.lon + " "+ wkt.lat + ")"; + geodjango_point.map.setCenter(wkt); + var admin_geom = geodjango_point.read_wkt(wkttemp); + geodjango_point.layers.vector.addFeatures([admin_geom]); + }; + + function error() { + output.innerHTML = "Unable to retrieve your location"; + }; + + + navigator.geolocation.getCurrentPosition(success, error); +} +</script> {% load static %} <style type="text/css"> #{{ id }}_map { width: {{ map_width }}px; height: {{ map_height }}px; } @@ -31,6 +60,7 @@ //]]> </script> <div id="{{ id }}_map"{% if LANGUAGE_BIDI %} dir="ltr"{% endif %}></div> +<div id="out"></div> <a href="javascript:{{ module }}.clearFeatures()">Delete all Features</a> {% if display_wkt %}<p> WKT debugging window:</p>{% endif %} <textarea id="{{ id }}" class="vWKTField required" cols="150" rows="10" name="{{ name }}">{{ wkt }}</textarea> |