Ticket #8972: ol_admin_delete_selected.diff
File ol_admin_delete_selected.diff, 2.2 KB (added by , 16 years ago) |
---|
-
django/contrib/gis/templates/gis/admin/openlayers.html
30 30 //]]> 31 31 </script> 32 32 <div id="{{ id }}_map"></div> 33 < a href="javascript:{{ module }}.clearFeatures()">Delete all Features</a>33 </p>Features: <a href="javascript:{{ module }}.clearSelectedFeatures()">Delete Selected</a> | <a href="javascript:{{ module }}.clearFeatures()">Delete All</a> 34 34 {% if display_wkt %}<p> WKT debugging window:</p>{% endif %} 35 35 <textarea id="{{ id }}" class="vWKTField required" cols="150" rows="10" name="{{ field_name }}">{{ wkt }}</textarea> 36 36 <script type="text/javascript">{% block init_function %}{{ module }}.init();{% endblock %}</script> -
django/contrib/gis/templates/gis/admin/openlayers.js
66 66 {{ module }}.clearFeatures = function (){ 67 67 {{ module }}.deleteFeatures(); 68 68 document.getElementById('{{ id }}').value = ''; 69 {{ module }}.map.setCenter(new OpenLayers.LonLat({{ default_lon }}, {{ default_lat }}), {{ default_zoom }});70 69 } 70 71 {{ module }}.clearSelectedFeatures = function (){ 72 //var selected = {{ module }}.map.layers[1].selectedFeatures; 73 var selected = {{ module }}.layers.vector.selectedFeatures; 74 if (selected && (selected.length > 0)) { 75 {{ module }}.layers.vector.removeFeatures(selected); 76 {{ module }}.layers.vector.selectedFeatures = [] 77 {{ module }}.modify_wkt(); 78 {{ module }}.map.getControlsByClass('OpenLayers.Control.ModifyFeature')[0].unselectFeature(); 79 } 80 } 81 71 82 // Add Select control 72 83 {{ module }}.addSelectControl = function(){ 73 var select = new OpenLayers.Control.SelectFeature({{ module }}.layers.vector, {'toggle' : true, 'clickout' : true });84 var select = new OpenLayers.Control.SelectFeature({{ module }}.layers.vector, {'toggle' : true, 'clickout' : true, 'multipleKey': "shiftKey",'multiple': true}); 74 85 {{ module }}.map.addControl(select); 75 86 select.activate(); 76 87 }