diff options
| author | Étienne Loks <etienne.loks@iggdrasil.net> | 2016-04-06 16:20:42 +0200 |
|---|---|---|
| committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2016-04-06 16:20:42 +0200 |
| commit | 2dc3990379beea996d88737122e9eeaa00bf212f (patch) | |
| tree | 1d0d858a58de09118ac461f88a91a9ddd866ba29 /chimere/templates | |
| parent | 9642d96c9328b61a206a7a5d4df7bbc54de38946 (diff) | |
| download | Chimère-2dc3990379beea996d88737122e9eeaa00bf212f.tar.bz2 Chimère-2dc3990379beea996d88737122e9eeaa00bf212f.zip | |
Manage point edition
Diffstat (limited to 'chimere/templates')
| -rw-r--r-- | chimere/templates/chimere/blocks/head_form.html | 2 | ||||
| -rw-r--r-- | chimere/templates/chimere/blocks/live_coordinates.html | 50 |
2 files changed, 25 insertions, 27 deletions
diff --git a/chimere/templates/chimere/blocks/head_form.html b/chimere/templates/chimere/blocks/head_form.html index 032a711..4c24b29 100644 --- a/chimere/templates/chimere/blocks/head_form.html +++ b/chimere/templates/chimere/blocks/head_form.html @@ -1,2 +1,2 @@ -<script src="{{ TINYMCE_URL }}tiny_mce.js" type="text/javascript"></script> +{% if TINYMCE_URL %}<script src="{{ TINYMCE_URL }}tiny_mce.js" type="text/javascript"></script>{% endif %} diff --git a/chimere/templates/chimere/blocks/live_coordinates.html b/chimere/templates/chimere/blocks/live_coordinates.html index 6d0dfb4..7e8cfd9 100644 --- a/chimere/templates/chimere/blocks/live_coordinates.html +++ b/chimere/templates/chimere/blocks/live_coordinates.html @@ -1,14 +1,15 @@ <script type='text/javascript'> var resolutions; var zoomOffset; - OpenLayers.ImgPath = '%schimere/img/'; - var EPSG_DISPLAY_PROJECTION = epsg_display_projection = new OpenLayers.Projection('EPSG:%s'); - var EPSG_PROJECTION = epsg_projection = new OpenLayers.Projection('EPSG:%s'); - var CENTER_LONLAT = centerLonLat = new OpenLayers.LonLat%s.transform(epsg_display_projection, epsg_projection); + // OpenLayers.ImgPath = '%schimere/img/'; + var EPSG_DISPLAY_PROJECTION = epsg_display_projection = 'EPSG:%s'; + var EPSG_PROJECTION = epsg_projection = 'EPSG:%s'; + var CENTER_LONLAT = centerLonLat = ol.proj.transform(%s, + EPSG_DISPLAY_PROJECTION, EPSG_PROJECTION); var DEFAULT_ZOOM = %s; var chimere_init_options = {}; chimere_init_options["input_id"] = 'id_{{name}}'; - chimere_init_options["default_icon"] = new OpenLayers.Icon('%schimere/img/marker-green.png', new OpenLayers.Size(21, 25), new OpenLayers.Pixel(-(21/2), -25)); + //chimere_init_options["default_icon"] = new OpenLayers.Icon('%schimere/img/marker-green.png', new OpenLayers.Size(21, 25), new OpenLayers.Pixel(-(21/2), -25)); chimere_init_options["map_layers"] = [%s]; chimere_init_options['dynamic_categories'] = false; chimere_init_options['edition'] = true; @@ -23,11 +24,11 @@ <div id='live_lonlat'> <p> <label for='live_latitude'>{{lat}}</label> - <input type='text' name='live_latitude' id='live_latitude' size='8' adisabled='true' value='{{value_y|stringformat:"f"}}'/> + <input type='text' readonly='readonly' name='live_latitude' id='live_latitude' size='8' adisabled='true' value='{{value_y|stringformat:"f"}}'/> </p> <p> <label for='live_longitude'>{{lon}}</label> - <input type='text' name='live_longitude' id='live_longitude' size='8' adisabled='true' value='{{value_x|stringformat:"f"}}'/> + <input type='text' readonly='readonly' name='live_longitude' id='live_longitude' size='8' adisabled='true' value='{{value_x|stringformat:"f"}}'/> </p> <input type='hidden' name='{{name}}' id='id_{{name}}' value='{{val}}'/> @@ -35,27 +36,24 @@ function init_map_edit(){ $('#map_edit').chimere(chimere_init_options); {% if isvalue %} - var mylonlat = new OpenLayers.LonLat({{value_x|stringformat:"f"}}, - {{value_y|stringformat:"f"}}); - $("#map_edit").chimere( - "putEditMarker", - mylonlat.transform(EPSG_DISPLAY_PROJECTION, EPSG_PROJECTION), - true); + var mylonlat = [{{value_x|stringformat:"f"}}, + {{value_y|stringformat:"f"}}]; + $("#map_edit").chimere("putEditMarker", + mylonlat, true); + $('#map_edit').chimere('activateModify'); + {% else %} + $('#map_edit').chimere('activateDraw'); {% endif %} - $('#live_latitude').change(function() { - var mylonlat = new OpenLayers.LonLat($('#live_longitude').val(), - $('#live_latitude').val()); - $("#map_edit").chimere("putEditMarker", - mylonlat.transform(EPSG_DISPLAY_PROJECTION, EPSG_PROJECTION), false); - $("#map_edit").chimere("settings").map.setCenter(mylonlat); - }); - $('#live_longitude').change(function() { - var mylonlat = new OpenLayers.LonLat($('#live_longitude').val(), - $('#live_latitude').val()); + + function update_marker_on_map(){ + var mylonlat = [$('#live_longitude').val(), + $('#live_latitude').val()]; $("#map_edit").chimere("putEditMarker", - mylonlat.transform(EPSG_DISPLAY_PROJECTION, EPSG_PROJECTION), false); - $("#map_edit").chimere("settings").map.setCenter(mylonlat); - }); + mylonlat, + true); + } + $('#live_latitude').change(update_marker_on_map); + $('#live_longitude').change(update_marker_on_map); } {% if initialized %}init_map_edit();{% endif %} </script> |
