Ticket #8972: ol_admin_delete_selected.2.diff

File ol_admin_delete_selected.2.diff, 2.1 KB (added by springmeyer, 7 years ago)
  • django/contrib/gis/templates/gis/admin/openlayers.html

     
    3030//]]>
    3131</script>
    3232<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>
    3434{% if display_wkt %}<p> WKT debugging window:</p>{% endif %}
    3535<textarea id="{{ id }}" class="vWKTField required" cols="150" rows="10" name="{{ field_name }}">{{ wkt }}</textarea>
    3636<script type="text/javascript">{% block init_function %}{{ module }}.init();{% endblock %}</script>
  • django/contrib/gis/templates/gis/admin/openlayers.js

     
    6666{{ module }}.clearFeatures = function (){
    6767  {{ module }}.deleteFeatures();
    6868  document.getElementById('{{ id }}').value = '';
    69   {{ module }}.map.setCenter(new OpenLayers.LonLat({{ default_lon }}, {{ default_lat }}), {{ default_zoom }});
    7069}
     70
     71{{ module }}.clearSelectedFeatures = function (){
     72  var selected = {{ module }}.layers.vector.selectedFeatures;
     73  if (selected && (selected.length > 0)) {
     74    {{ module }}.layers.vector.removeFeatures(selected);
     75    {{ module }}.modify_wkt();
     76    {{ module }}.map.getControlsByClass('OpenLayers.Control.ModifyFeature')[0].unselectFeature();
     77  }
     78}
     79
    7180// Add Select control
    7281{{ module }}.addSelectControl = function(){   
    73   var select = new OpenLayers.Control.SelectFeature({{ module }}.layers.vector, {'toggle' : true, 'clickout' : true});
     82  var select = new OpenLayers.Control.SelectFeature({{ module }}.layers.vector, {'toggle' : true, 'clickout' : true, 'multipleKey': "shiftKey",'multiple': true});
    7483  {{ module }}.map.addControl(select);
    7584  select.activate();
    7685}
Back to Top