summaryrefslogtreecommitdiff
path: root/chimere/templates/chimere/blocks/edit_widget.html
blob: a2b9e48942beabc46673cc63c8c5111f3bdadac2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
{% load unescape i18n %}<script type='text/javascript'>
</script>

<div id='popup'></div>
<div id='map_edit'></div>
<div class='help'>{% trans "To delete a vertice, hold the SHIFT key and click." %}</div>
  <input type='hidden' name='{{name}}' id='id_{{name}}' value='{{value}}'/>

<script type="text/javascript">
  var resolutions;
  var zoomOffset;
  image_path = '{static_url}chimere/img/';
  var EPSG_DISPLAY_PROJECTION = epsg_display_projection = 'EPSG:{display_projection}';
  var EPSG_PROJECTION = epsg_projection = 'EPSG:{projection}';
  var CENTER_LONLAT = centerLonLat = ol.proj.transform(
        {center}, epsg_display_projection, epsg_projection);
  var DEFAULT_ZOOM = {zoom};
  {extra_js}
  var chimere_init_options = {% raw %}{{}}{% endraw %};
  chimere_init_options["input_id"] = 'id_{{name}}';
  chimere_init_options["map_layers"] = [{map_layers}];
  chimere_init_options['dynamic_categories'] = false;
  chimere_init_options['edition'] = true;
  chimere_init_options['edition_type'] = '{edition_type}';
  chimere_init_options["checked_categories"] = [];
  {% if default_area %} chimere_init_options['selected_map_layer'] = {{default_area}};{% endif %}
  function init_map_edit(){% raw %}{{{% endraw %}
      $('#map_edit').chimere(chimere_init_options);
      $('#map_edit').chimere('activateDraw');
      $('#map_edit').chimere('zoom', {% raw %} {{ 'area':{zoom} }} {% endraw %});
      {% if value %}$('#map_edit').chimere('initFeature', '{{value}}');
      {% endif %}
  {% raw %}}}{% endraw %}
  {% if initialized %}init_map_edit();{% endif %}
</script>