Ticket #11810: 11810_v2.diff
File 11810_v2.diff, 2.0 KB (added by , 15 years ago) |
---|
-
django/contrib/gis/templates/gis/admin/openlayers.js
1 1 {# Author: Justin Bronn, Travis Pinney & Dane Springmeyer #} 2 2 {% block vars %}var {{ module }} = {}; 3 3 {{ module }}.map = null; {{ module }}.controls = null; {{ module }}.panel = null; {{ module }}.re = new RegExp("^SRID=\d+;(.+)", "i"); {{ module }}.layers = {}; 4 {{ module }}.modifiable = {{ modifiable|yesno:"true,false" }}; 4 5 {{ module }}.wkt_f = new OpenLayers.Format.WKT(); 5 6 {{ module }}.is_collection = {{ is_collection|yesno:"true,false" }}; 6 7 {{ module }}.collection_type = '{{ collection_type }}'; … … 88 89 } else if ({{ module }}.is_point){ 89 90 draw_ctl = new OpenLayers.Control.DrawFeature(lyr, OpenLayers.Handler.Point, {'displayClass': 'olControlDrawFeaturePoint'}); 90 91 } 91 {% if modifiable %} 92 var mod = new OpenLayers.Control.ModifyFeature(lyr, {'displayClass': 'olControlModifyFeature'}); 93 {{ module }}.controls = [nav, draw_ctl, mod]; 94 {% else %} 95 {{ module }}.controls = [nav, darw_ctl]; 96 {% endif %} 92 if ({{ module }}.modifiable){ 93 var mod = new OpenLayers.Control.ModifyFeature(lyr, {'displayClass': 'olControlModifyFeature'}); 94 {{ module }}.controls = [nav, draw_ctl, mod]; 95 } else { 96 if(!lyr.features.length){ 97 {{ module }}.controls = [nav, draw_ctl]; 98 } else { 99 {{ module }}.controls = [nav]; 100 } 101 } 97 102 } 98 103 {{ module }}.init = function(){ 99 104 {% block map_options %}// The options hash, w/ zoom, resolution, and projection settings. … … 153 158 {% if not scrollable %}{{ module }}.map.getControlsByClass('OpenLayers.Control.Navigation')[0].disableZoomWheel();{% endif %} 154 159 {% endblock %} 155 160 if (wkt){ 156 {{ module }}.enableEditing(); 161 if ({{ module }}.modifiable){ 162 {{ module }}.enableEditing(); 163 } 157 164 } else { 158 165 {{ module }}.enableDrawing(); 159 166 }