diff options
| -rw-r--r-- | CHANGES.txt | 11 | ||||
| -rw-r--r-- | chimere/__init__.py | 2 | ||||
| -rw-r--r-- | chimere/static/chimere/css/forms.css | 5 | ||||
| -rw-r--r-- | chimere/static/chimere/css/styles.css | 4 | ||||
| -rw-r--r-- | chimere/templates/chimere/blocks/live_coordinates.html | 57 | ||||
| -rw-r--r-- | chimere/widgets.py | 68 | ||||
| -rw-r--r-- | debian/changelog | 6 | 
7 files changed, 102 insertions, 51 deletions
| diff --git a/CHANGES.txt b/CHANGES.txt index 355b988..151bfeb 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,14 @@ +2.0.3 (2013-05-29) +------------------ + +- fixtures: add geobretagne and opencyclemap layers +- force JPG format for thumbnail to prevent resizing errors +- better regexp to manage Youtube links +- documentation update +- more precise error message on shapefile import +- use a template to render PointChooser widget +- ability to set coordinates from live_lonlat +  2.0.2 (2013-02-19)  ------------------ diff --git a/chimere/__init__.py b/chimere/__init__.py index 2ef2100..19d78a9 100644 --- a/chimere/__init__.py +++ b/chimere/__init__.py @@ -2,7 +2,7 @@  # -*- coding: utf-8 -*-  # Copyright (C) 2012-2013  Étienne Loks  <etienne.loks_AT_peacefrogsDOTnet> -VERSION = (2, 0, 2) +VERSION = (2, 0, 3)  def get_version():      return u'.'.join((unicode(num) for num in VERSION)) diff --git a/chimere/static/chimere/css/forms.css b/chimere/static/chimere/css/forms.css index a763a34..7ceaa58 100644 --- a/chimere/static/chimere/css/forms.css +++ b/chimere/static/chimere/css/forms.css @@ -71,6 +71,11 @@ div.bottomform{      float:left;  } +#live_lonlat p{ +    display:inline-table; +    margin-left:0; +} +  .toggle-button{      margin:4px 0;      padding:2px 0; diff --git a/chimere/static/chimere/css/styles.css b/chimere/static/chimere/css/styles.css index 764e0c7..ea7d4c0 100644 --- a/chimere/static/chimere/css/styles.css +++ b/chimere/static/chimere/css/styles.css @@ -756,10 +756,6 @@ table.inline-table td input[type=file]{      width:260px;  } -#live_lonlat { -    display:none; -} -  #live_lonlat p{      display:inline-table;  } diff --git a/chimere/templates/chimere/blocks/live_coordinates.html b/chimere/templates/chimere/blocks/live_coordinates.html new file mode 100644 index 0000000..0199630 --- /dev/null +++ b/chimere/templates/chimere/blocks/live_coordinates.html @@ -0,0 +1,57 @@ +<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); +  var DEFAULT_ZOOM = %s; +  var chimere_init_options = {}; +  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; +  chimere_init_options["checked_categories"] = []; +  if({{default_area}}) chimere_init_options['selected_map_layer'] = {{default_area}}; +</script> + +</div> + + +<div id='map_edit'></div> +<div id='live_lonlat'> +  <p> +    <label for='live_latitude'>{{lat}}</label> +    <input type='texte' 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='texte' 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}}'/> + +<script type="text/javascript"> +  $('#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); +  {% 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()); +    $("#map_edit").chimere("putEditMarker", +        mylonlat.transform(EPSG_DISPLAY_PROJECTION, EPSG_PROJECTION), false); +    $("#map_edit").chimere("settings").map.setCenter(mylonlat); +  }); +</script> diff --git a/chimere/widgets.py b/chimere/widgets.py index 45161e1..4f09c62 100644 --- a/chimere/widgets.py +++ b/chimere/widgets.py @@ -1,6 +1,6 @@  #!/usr/bin/env python  # -*- coding: utf-8 -*- -# Copyright (C) 2008-2012 Étienne Loks  <etienne.loks_AT_peacefrogsDOTnet> +# Copyright (C) 2008-2013 Étienne Loks  <etienne.loks_AT_peacefrogsDOTnet>  # This program is free software: you can redistribute it and/or modify  # it under the terms of the GNU General Public License as @@ -32,6 +32,7 @@ from django.utils.encoding import force_unicode  from django.utils.html import conditional_escape  from django.utils.safestring import mark_safe  from django.utils.translation import ugettext as _ +from django.template.loader import render_to_string  import re @@ -274,52 +275,27 @@ class PointChooserWidget(forms.TextInput):                  value = None          map_layers, default_area = get_map_layers(area_name)          map_layers = [js for n, js, default in map_layers] -        js = """ -        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); -        var DEFAULT_ZOOM = %s; -        var chimere_init_options = {}; -        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; -        chimere_init_options["checked_categories"] = []; -        """ % (settings.STATIC_URL, settings.CHIMERE_EPSG_DISPLAY_PROJECTION, -              settings.CHIMERE_EPSG_PROJECTION, settings.CHIMERE_DEFAULT_CENTER, -              settings.CHIMERE_DEFAULT_ZOOM, settings.STATIC_URL, -              ", ".join(map_layers)) -        if default_area: -            js += "chimere_init_options['selected_map_layer'] = %d;\n" % \ -                  default_area          #TODO: manage area -        tpl = u"<script type='text/javascript'><!--\n"\ -              u"%s// !--></script>\n" % js -        tpl += u"</div><div id='map_edit'></div>"\ -               u"<div id='live_lonlat'>"\ -               u"    <p><label for='live_latitude'>%s</label>"\ -               u" <input type='texte' name='live_latitude' id='live_latitude' "\ -               u"size='8' disabled='true' value='%f'/></p>"\ -               u"<p><label for='live_longitude'>%s</label><input type='texte' "\ -               u"name='live_longitude' id='live_longitude' size='8' "\ -               u"disabled='true' value='%f'/></p>"\ -               u"<input type='hidden' name='%s' id='id_%s' value='%s'/>" % ( -                    _("Latitude"), value_y, _("Longitude"), value_x, name, name, -                    val) -        tpl += "<script type='text/javascript'><!--\n" -        tpl += "$('#map_edit').chimere(chimere_init_options);\n" -        if value: -            tpl += u'var mylonlat = new OpenLayers.LonLat(%f,%f);\n'\ -                   u'$("#map_edit").chimere("putEditMarker", \n'\ -                   u'   mylonlat.transform(EPSG_DISPLAY_PROJECTION, \n'\ -                   u'                      EPSG_PROJECTION), true);\n' % ( -                                                             value_x, value_y) -        tpl += "// --></script>\n" -        return mark_safe(tpl) +        return mark_safe( +            render_to_string('chimere/blocks/live_coordinates.html', +                             {'lat': _("Latitude"), +                              'value_y': value_y, +                              'lon': _("Longitude"), +                              'value_x': value_x, +                              'name': name, +                              'val': val, +                              'isvalue': bool(value), +                              'default_area': "true" if default_area else "false", +                              }) % \ +            (settings.STATIC_URL, +             settings.CHIMERE_EPSG_DISPLAY_PROJECTION, +             settings.CHIMERE_EPSG_PROJECTION, +             settings.CHIMERE_DEFAULT_CENTER, +             settings.CHIMERE_DEFAULT_ZOOM, +             settings.STATIC_URL, +             ", ".join(map_layers) +             ) +            )  class PointField(models.PointField):      ''' diff --git a/debian/changelog b/debian/changelog index 5b0d8a2..6b39166 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +python-django-chimere (2.0.3-1) unstable; urgency=low + +  * New upstream release + + -- Étienne Loks <etienne.loks@peacefrogs.net>  Tue, 29 May 2013 12:21:22 +0100 +  python-django-chimere (2.0.2-1) unstable; urgency=low    * New upstream release | 
