[1.1.X] Fixed #11810 -- Fixed typo and errors that prevented modifiable
from working in the geographic admin. Thanks to Rob Coup for the bug report. Refs #12504.
Backport of r12995 from trunk. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.1.X@12996 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
f6b6e0f1d9
commit
be167b804d
@ -111,12 +111,6 @@ class GeoModelAdmin(ModelAdmin):
|
|||||||
}
|
}
|
||||||
return OLMap
|
return OLMap
|
||||||
|
|
||||||
# Using the Beta OSM in the admin requires the following:
|
|
||||||
# (1) The Google Maps Mercator projection needs to be added
|
|
||||||
# to your `spatial_ref_sys` table. You'll need at least GDAL 1.5:
|
|
||||||
# >>> from django.contrib.gis.gdal import SpatialReference
|
|
||||||
# >>> from django.contrib.gis.utils import add_postgis_srs
|
|
||||||
# >>> add_postgis_srs(SpatialReference(900913)) # Adding the Google Projection
|
|
||||||
from django.contrib.gis import gdal
|
from django.contrib.gis import gdal
|
||||||
if gdal.HAS_GDAL:
|
if gdal.HAS_GDAL:
|
||||||
class OSMGeoAdmin(GeoModelAdmin):
|
class OSMGeoAdmin(GeoModelAdmin):
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
{# Author: Justin Bronn, Travis Pinney & Dane Springmeyer #}
|
{# Author: Justin Bronn, Travis Pinney & Dane Springmeyer #}
|
||||||
{% block vars %}var {{ module }} = {};
|
{% block vars %}var {{ module }} = {};
|
||||||
{{ module }}.map = null; {{ module }}.controls = null; {{ module }}.panel = null; {{ module }}.re = new RegExp("^SRID=\d+;(.+)", "i"); {{ module }}.layers = {};
|
{{ module }}.map = null; {{ module }}.controls = null; {{ module }}.panel = null; {{ module }}.re = new RegExp("^SRID=\d+;(.+)", "i"); {{ module }}.layers = {};
|
||||||
|
{{ module }}.modifiable = {{ modifiable|yesno:"true,false" }};
|
||||||
{{ module }}.wkt_f = new OpenLayers.Format.WKT();
|
{{ module }}.wkt_f = new OpenLayers.Format.WKT();
|
||||||
{{ module }}.is_collection = {{ is_collection|yesno:"true,false" }};
|
{{ module }}.is_collection = {{ is_collection|yesno:"true,false" }};
|
||||||
{{ module }}.collection_type = '{{ collection_type }}';
|
{{ module }}.collection_type = '{{ collection_type }}';
|
||||||
@ -88,12 +89,16 @@
|
|||||||
} else if ({{ module }}.is_point){
|
} else if ({{ module }}.is_point){
|
||||||
draw_ctl = new OpenLayers.Control.DrawFeature(lyr, OpenLayers.Handler.Point, {'displayClass': 'olControlDrawFeaturePoint'});
|
draw_ctl = new OpenLayers.Control.DrawFeature(lyr, OpenLayers.Handler.Point, {'displayClass': 'olControlDrawFeaturePoint'});
|
||||||
}
|
}
|
||||||
{% if modifiable %}
|
if ({{ module }}.modifiable){
|
||||||
var mod = new OpenLayers.Control.ModifyFeature(lyr, {'displayClass': 'olControlModifyFeature'});
|
var mod = new OpenLayers.Control.ModifyFeature(lyr, {'displayClass': 'olControlModifyFeature'});
|
||||||
{{ module }}.controls = [nav, draw_ctl, mod];
|
{{ module }}.controls = [nav, draw_ctl, mod];
|
||||||
{% else %}
|
} else {
|
||||||
{{ module }}.controls = [nav, darw_ctl];
|
if(!lyr.features.length){
|
||||||
{% endif %}
|
{{ module }}.controls = [nav, draw_ctl];
|
||||||
|
} else {
|
||||||
|
{{ module }}.controls = [nav];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
{{ module }}.init = function(){
|
{{ module }}.init = function(){
|
||||||
{% block map_options %}// The options hash, w/ zoom, resolution, and projection settings.
|
{% block map_options %}// The options hash, w/ zoom, resolution, and projection settings.
|
||||||
@ -153,7 +158,9 @@
|
|||||||
{% if not scrollable %}{{ module }}.map.getControlsByClass('OpenLayers.Control.Navigation')[0].disableZoomWheel();{% endif %}
|
{% if not scrollable %}{{ module }}.map.getControlsByClass('OpenLayers.Control.Navigation')[0].disableZoomWheel();{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
if (wkt){
|
if (wkt){
|
||||||
|
if ({{ module }}.modifiable){
|
||||||
{{ module }}.enableEditing();
|
{{ module }}.enableEditing();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
{{ module }}.enableDrawing();
|
{{ module }}.enableDrawing();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user