summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chimere/locale/fr/LC_MESSAGES/django.po324
-rw-r--r--chimere/static/chimere/js/edit_area.js54
-rw-r--r--chimere/widgets.py22
3 files changed, 230 insertions, 170 deletions
diff --git a/chimere/locale/fr/LC_MESSAGES/django.po b/chimere/locale/fr/LC_MESSAGES/django.po
index a59717f..214dfb4 100644
--- a/chimere/locale/fr/LC_MESSAGES/django.po
+++ b/chimere/locale/fr/LC_MESSAGES/django.po
@@ -7,18 +7,18 @@ msgid ""
msgstr ""
"Project-Id-Version: 0.2\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2012-10-04 23:35+0200\n"
+"POT-Creation-Date: 2012-10-06 20:09+0200\n"
"PO-Revision-Date: 2010-03-20 20:00+0100\n"
"Last-Translator: Étienne Loks <etienne.loks@peacefrogs.net>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-#: __init__.py:8 models.py:584
+#: __init__.py:8 models.py:618
msgid "Multimedia files"
msgstr "Fichiers multimedias"
-#: __init__.py:9 models.py:641
+#: __init__.py:9 models.py:674
msgid "Picture files"
msgstr "Fichiers d'image"
@@ -46,47 +46,47 @@ msgstr "Flux RSS"
msgid "Contact us"
msgstr "Nous contacter"
-#: admin.py:63 templates/chimere/feeds/rss.html:69
+#: admin.py:64 templates/chimere/feeds/rss.html:69
msgid "Validate"
msgstr "Valider"
-#: admin.py:74
+#: admin.py:75
msgid "Export to KML"
msgstr "Exporter en KML"
-#: admin.py:88
+#: admin.py:89
msgid "Export to Shapefile"
msgstr "Exporter en Shapefile"
-#: admin.py:98
+#: admin.py:99
msgid "Export to CSV"
msgstr "Exporter en CSV"
-#: admin.py:177
+#: admin.py:184
msgid "Import"
msgstr "Import"
-#: admin.py:183
+#: admin.py:190
msgid "Cancel import"
msgstr "Annuler l'import"
-#: admin.py:189
+#: admin.py:196
msgid "Cancel export"
msgstr "Annuler l'export"
-#: admin.py:197
+#: admin.py:204
msgid "Export to osm"
msgstr "Exporter vers osm"
-#: feeds.py:124 feeds.py:211
+#: feeds.py:128 feeds.py:215
msgid "Last points of interest"
msgstr "Derniers points d'intérêt"
-#: feeds.py:130
+#: feeds.py:134
msgid "Latest points of interest from "
msgstr "Nouveaux points d'intérêt de "
-#: feeds.py:176
+#: feeds.py:180
msgid "Last points of interest by area"
msgstr "Nouveaux points d'intérêt par zone"
@@ -122,405 +122,405 @@ msgstr ""
"Vous devez spécifier le champ « Source » ou « Fichier source » mais pas les "
"deux."
-#: forms.py:123
+#: forms.py:124
msgid "You have to set \"source\" or \"source file\"."
msgstr "Vous devez spécifier le champ « Source » ou « Fichier source »."
-#: forms.py:182
+#: forms.py:183
msgid "End date has been set with no start date"
msgstr "Une date de fin a été donnée sans date de début"
-#: forms.py:193
+#: forms.py:194
msgid "This field is mandatory for the selected categories"
msgstr "Ce champ est obligatoire pour les catégories sélectionnées"
-#: forms.py:398
+#: forms.py:414
msgid "File"
msgstr "Fichier"
-#: forms.py:404
+#: forms.py:420
msgid "Bad file format: this must be a GPX or KML file"
msgstr "Mauvais format de fichier : KML et GPX sont supportés"
-#: forms.py:409 models.py:49 models.py:102 models.py:123 models.py:136
-#: models.py:150 models.py:252 models.py:531 models.py:574 models.py:618
-#: models.py:735 models.py:1029 models.py:1041 models.py:1126 utils.py:448
+#: forms.py:425 models.py:50 models.py:103 models.py:124 models.py:137
+#: models.py:151 models.py:267 models.py:565 models.py:608 models.py:651
+#: models.py:767 models.py:1083 models.py:1095 models.py:1180 utils.py:454
#: templates/chimere/edit.html:39 templates/chimere/edit_route.html:36
msgid "Name"
msgstr "Nom"
-#: forms.py:418 models.py:1078
+#: forms.py:434 models.py:1132
msgid "Area"
msgstr "Zone"
-#: models.py:50 models.py:124 models.py:151 models.py:263 models.py:535
-#: models.py:1047 models.py:1128
+#: models.py:51 models.py:125 models.py:152 models.py:278 models.py:569
+#: models.py:1101 models.py:1182
msgid "Available"
msgstr "Disponible"
-#: models.py:51 models.py:1137
+#: models.py:52 models.py:1191
msgid "Date"
msgstr "Date"
-#: models.py:57 models.py:58
+#: models.py:58 models.py:59
msgid "News"
msgstr "Nouvelle"
-#: models.py:63
+#: models.py:64
msgid "Parameters"
msgstr "Paramètres"
-#: models.py:67
+#: models.py:68
msgid "TinyUrl"
msgstr "Mini-url"
-#: models.py:106 models.py:113 models.py:155
+#: models.py:107 models.py:114 models.py:156
msgid "Color theme"
msgstr "Thème de couleur"
-#: models.py:111
+#: models.py:112
msgid "Code"
msgstr "Code"
-#: models.py:112 models.py:125 models.py:157 models.py:576 models.py:633
-#: models.py:1046 models.py:1115 models.py:1127
+#: models.py:113 models.py:126 models.py:158 models.py:610 models.py:666
+#: models.py:1100 models.py:1169 models.py:1181
msgid "Order"
msgstr "Ordre"
-#: models.py:118
+#: models.py:119
msgid "Color"
msgstr "Couleur"
-#: models.py:131 models.py:149 templates/chimere/main_map.html:13
+#: models.py:132 models.py:150 templates/chimere/main_map.html:13
msgid "Category"
msgstr "Catégorie"
-#: models.py:137 models.py:527 models.py:619 models.py:801
+#: models.py:138 models.py:561 models.py:652 models.py:833
msgid "Image"
msgstr "Image"
-#: models.py:139 models.py:621 models.py:803
+#: models.py:140 models.py:654 models.py:835
msgid "Height"
msgstr "Hauteur"
-#: models.py:140 models.py:622 models.py:804
+#: models.py:141 models.py:655 models.py:836
msgid "Width"
msgstr "Largeur"
-#: models.py:144 models.py:154
+#: models.py:145 models.py:155
msgid "Icon"
msgstr "Icône"
-#: models.py:152
+#: models.py:153
msgid "Available for submission"
msgstr "Disponible pour soumission"
-#: models.py:158
+#: models.py:159
msgid "Marker"
msgstr "Point d'intérêt"
-#: models.py:159 models.py:797 models.py:812
+#: models.py:160 models.py:829 models.py:844
#: templates/chimere/edit_route.html:27
msgid "Route"
msgstr "Trajet"
-#: models.py:160
+#: models.py:161
msgid "Both"
msgstr "Mixte"
-#: models.py:161
+#: models.py:162
msgid "Item type"
msgstr "Type d'élément"
-#: models.py:166
+#: models.py:167
msgid "Sub-category"
msgstr "Sous-catégorie"
-#: models.py:167
+#: models.py:168
msgid "Sub-categories"
msgstr "Sous-catégories"
-#: models.py:219
+#: models.py:226
msgid "Importer type"
msgstr "Type d'import"
-#: models.py:222 models.py:274
+#: models.py:229 models.py:289
msgid "Source"
msgstr "Source"
-#: models.py:224
+#: models.py:231
+msgid "Source file"
+msgstr "Fichier source"
+
+#: models.py:233
msgid "Filter"
msgstr "Filtre"
-#: models.py:226
+#: models.py:235
msgid "Name by default"
msgstr "Nom par défaut"
-#: models.py:229
-msgid "Associated subcategories"
-msgstr "Sous-catégories associées"
-
-#: models.py:230 utils.py:451
-msgid "State"
-msgstr "État"
-
-#: models.py:232
+#: models.py:237
msgid "SRID"
msgstr "SRID"
-#: models.py:233
+#: models.py:238
msgid "Zipped file"
msgstr "Fichier zippé"
-#: models.py:234
-msgid "Source file"
-msgstr "Fichier source"
-
-#: models.py:236 models.py:280
+#: models.py:239 models.py:295
msgid "Origin"
msgstr "Origine"
-#: models.py:238 models.py:282
+#: models.py:241 models.py:297
msgid "License"
msgstr "Licence"
-#: models.py:242
+#: models.py:244
+msgid "Associated subcategories"
+msgstr "Sous-catégories associées"
+
+#: models.py:245 utils.py:458
+msgid "State"
+msgstr "État"
+
+#: models.py:249
msgid "Importer"
msgstr "Import"
-#: models.py:254
+#: models.py:269
msgid "Submitter session key"
msgstr "Clé de session du demandeur"
-#: models.py:256
+#: models.py:271
msgid "Submitter name or nickname"
msgstr "Nom ou pseudo du demandeur"
-#: models.py:258
+#: models.py:273
msgid "Submitter email"
msgstr "Courriel du demandeur"
-#: models.py:260
+#: models.py:275
msgid "Submitter comment"
msgstr "Commentaire du demandeur"
-#: models.py:262
+#: models.py:277
msgid "Submited"
msgstr "Soumis"
-#: models.py:264
+#: models.py:279
msgid "Modified"
msgstr "Modifié"
-#: models.py:265
+#: models.py:280
msgid "Disabled"
msgstr "Désactivé"
-#: models.py:266
+#: models.py:281
msgid "Imported"
msgstr "Importé"
-#: models.py:267
+#: models.py:282
msgid "Excluded"
msgstr "Exclu"
-#: models.py:269
+#: models.py:284
msgid "Status"
msgstr "État"
-#: models.py:270
+#: models.py:285
msgid "Import key"
msgstr "Clé d'import"
-#: models.py:272
+#: models.py:287
msgid "Import version"
msgstr "Version de l'import"
-#: models.py:276
+#: models.py:291
msgid "Modified since last import"
msgstr "Modifié depuis le dernier import"
-#: models.py:278
+#: models.py:293
msgid "Not to be imported inside OSM"
msgstr "À ne pas importer dans OSM"
-#: models.py:285 templates/chimere/edit.html:56
+#: models.py:300 templates/chimere/edit.html:56
#: templates/chimere/edit_route.html:52
msgid "Start date"
msgstr "Date de début"
-#: models.py:286
+#: models.py:301
msgid "Not mandatory. Set it for dated item such as event. Format YYYY-MM-DD"
msgstr ""
"Optionnel. Précisez ce champ pour les éléments datés comme un événement. "
"Format du champ : AAAA-MM-JJ"
-#: models.py:288 templates/chimere/edit.html:62
+#: models.py:303 templates/chimere/edit.html:62
#: templates/chimere/edit_route.html:58
msgid "End date"
msgstr "Date de fin"
-#: models.py:289
+#: models.py:304
msgid ""
"Not mandatory. Set it only if you have a multi-day event. Format YYYY-MM-DD"
msgstr ""
"Optionnel. Précisez ce champ seulement pour des événements durant plusieurs "
"jours. Format du champ : AAAA-MM-JJ"
-#: models.py:325
+#: models.py:350
msgid "Reference marker"
msgstr "Point d'intérêt de référence"
-#: models.py:326 utils.py:453 utils.py:454
+#: models.py:351 utils.py:460
msgid "Localisation"
msgstr "Localisation"
-#: models.py:328
+#: models.py:353
msgid "Available Date"
msgstr "Date de mise en disponibilité"
-#: models.py:332 utils.py:452 templates/chimere/edit.html:49
+#: models.py:357 utils.py:459 templates/chimere/edit.html:49
#: templates/chimere/edit_route.html:46
msgid "Description"
msgstr "Description"
-#: models.py:387 models.py:1162
+#: models.py:415 models.py:1216
msgid "Point of interest"
msgstr "Point d'intérêt"
-#: models.py:525
+#: models.py:559
msgid "Audio"
msgstr "Audio"
-#: models.py:526
+#: models.py:560
msgid "Video"
msgstr "Vidéo"
-#: models.py:528
+#: models.py:562
msgid "Other"
msgstr "Autre"
-#: models.py:529
+#: models.py:563
msgid "Media type"
msgstr "Type de media"
-#: models.py:532
+#: models.py:566
msgid "Mime type"
msgstr "Type mime"
-#: models.py:534
+#: models.py:568
msgid "Inside an iframe"
msgstr "À l'intérieur d'un iframe"
-#: models.py:538
+#: models.py:572
msgid "Multimedia type"
msgstr "Type de multimedia"
-#: models.py:539
+#: models.py:573
msgid "Multimedia types"
msgstr "Types de multimedia"
-#: models.py:575
+#: models.py:609
msgid "Url"
msgstr "Url"
-#: models.py:578 models.py:623
+#: models.py:612 models.py:656
msgid "Display inside the description?"
msgstr "Apparaît dans la description ?"
-#: models.py:583
+#: models.py:617
msgid "Multimedia file"
msgstr "Fichier multimedia"
-#: models.py:625
+#: models.py:658
msgid "Thumbnail"
msgstr "Miniature"
-#: models.py:629
+#: models.py:662
msgid "Thumbnail height"
msgstr "Hauteur de la miniature"
-#: models.py:631
+#: models.py:664
msgid "Thumbnail width"
msgstr "Largeur de la miniature"
-#: models.py:640
+#: models.py:673
msgid "Picture file"
msgstr "Fichier d'image"
-#: models.py:736
+#: models.py:768
msgid "Raw file (gpx or kml)"
msgstr "Fichier brut (gpx ou kml)"
-#: models.py:738
+#: models.py:770
msgid "Simplified file"
msgstr "Fichier simplifié"
-#: models.py:740
+#: models.py:772
msgid "KML"
msgstr "KML"
-#: models.py:740
+#: models.py:772
msgid "GPX"
msgstr "GPX"
-#: models.py:745
+#: models.py:777
msgid "Route file"
msgstr "Fichier de trajet"
-#: models.py:746
+#: models.py:778
msgid "Route files"
msgstr "Fichiers de trajet"
-#: models.py:796
+#: models.py:828
msgid "Reference route"
msgstr "Trajet de référence"
-#: models.py:800
+#: models.py:832
msgid "Associated file"
msgstr "Fichier associé"
-#: models.py:1030
+#: models.py:1084
msgid "Layer code"
msgstr "Code pour la couche"
-#: models.py:1036
+#: models.py:1090
msgid "Layer"
msgstr "Couche"
-#: models.py:1042
+#: models.py:1096
msgid "Area urn"
msgstr "Urn de la zone"
-#: models.py:1044 templates/chimere/blocks/welcome.html:3
+#: models.py:1098 templates/chimere/blocks/welcome.html:3
msgid "Welcome message"
msgstr "Message d'accueil"
-#: models.py:1048
+#: models.py:1102
msgid "Upper left corner"
msgstr "Coin en haut à gauche"
-#: models.py:1050
+#: models.py:1104
msgid "Lower right corner"
msgstr "Coin en bas à droite"
-#: models.py:1052
+#: models.py:1106
msgid "Default area"
msgstr "Zone par défaut"
-#: models.py:1053
+#: models.py:1107
msgid "Only one area is set by default"
msgstr "Seule une zone est définie par défaut"
-#: models.py:1057
+#: models.py:1111
msgid "Sub-categories checked by default"
msgstr "Sous-catégories cochées par défaut"
-#: models.py:1059
+#: models.py:1113
msgid "Sub-categories dynamicaly displayed"
msgstr "Sous-categories affichées dynamiquement"
-#: models.py:1060
+#: models.py:1114
msgid ""
"If checked, categories are only displayed in the menu if they are available "
"on the current extent."
@@ -528,68 +528,68 @@ msgstr ""
"Si coché, les catégories sont disponibles sur le menu seulement si elles "
"apparaissent sur la zone affichée."
-#: models.py:1064 models.py:1131
+#: models.py:1118 models.py:1185
msgid "Restricted to theses sub-categories"
msgstr "Restreindre à ces sous-categories"
-#: models.py:1065
+#: models.py:1119
msgid "If no sub-category is set all sub-categories are available"
msgstr ""
"Si aucune sous-catégorie n'est définie toutes les sous-catégories sont "
"disponibles"
-#: models.py:1067
+#: models.py:1121
msgid "Link to an external CSS"
msgstr "Lien vers une feuille de style externe"
-#: models.py:1069
+#: models.py:1123
msgid "Restrict to the area extent"
msgstr "Restreindre à l'étendue de la zone"
-#: models.py:1116
+#: models.py:1170
msgid "Default layer"
msgstr "Couche par défaut"
-#: models.py:1120 models.py:1121
+#: models.py:1174 models.py:1175
msgid "Layers"
msgstr "Couches"
-#: models.py:1129
+#: models.py:1183
msgid "Mandatory"
msgstr "Obligatoire"
-#: models.py:1132
+#: models.py:1186
msgid ""
"If no sub-category is set all the property applies to all sub-categories"
msgstr ""
"Si aucune sous-catégorie n'est précisée, cette propriété est disponible pour "
"toutes les sous-catégories"
-#: models.py:1134
+#: models.py:1188
msgid "Text"
msgstr "Texte"
-#: models.py:1135
+#: models.py:1189
msgid "Long text"
msgstr "Texte long"
-#: models.py:1136
+#: models.py:1190
msgid "Password"
msgstr "Mot de passe"
-#: models.py:1142
+#: models.py:1196
msgid "Type"
msgstr "Type"
-#: models.py:1147 models.py:1164
+#: models.py:1201 models.py:1218
msgid "Property model"
msgstr "Modèle de propriété"
-#: models.py:1165
+#: models.py:1219
msgid "Value"
msgstr "Valeur"
-#: models.py:1169
+#: models.py:1223
msgid "Property"
msgstr "Propriété"
@@ -643,54 +643,62 @@ msgstr "Export échoué"
msgid "Export canceled"
msgstr "Export annulé"
-#: utils.py:118 utils.py:167
+#: utils.py:123 utils.py:172
msgid "Bad zip file"
msgstr "Mauvais fichier zip"
-#: utils.py:170
+#: utils.py:175
msgid "Missing file(s) inside the zip file"
msgstr "Fichier(s) manquant(s) dans l'archive zip"
-#: utils.py:211
+#: utils.py:216
msgid "Bad XML file"
msgstr "Mauvais fichier XML"
-#: utils.py:300
+#: utils.py:301
msgid "Error while reading the data source."
msgstr "Erreur lors de la lecture de la source."
-#: utils.py:335
+#: utils.py:336
msgid "Type of geographic item of this shapefile is not managed by Chimère."
msgstr ""
"Les types des éléments géographiques de ce fichier Shapefile ne sont pas "
"gérés par Chimère."
-#: utils.py:355
+#: utils.py:356
msgid "Bad Shapefile"
msgstr "Mauvais fichier Shapefile"
-#: utils.py:397
+#: utils.py:398
msgid "Could not create file!"
msgstr "Ne peut pas créer le fichier !"
-#: utils.py:408
+#: utils.py:409
msgid "Failed to create field"
msgstr "Ne peut pas créer un champ"
-#: utils.py:449 templates/chimere/edit.html:44
+#: utils.py:455 templates/chimere/edit.html:44
#: templates/chimere/edit_route.html:41
msgid "Categories"
msgstr "Catégories"
-#: utils.py:510
+#: utils.py:488
+msgid "Invalid CSV format"
+msgstr "Fichier CSV non valide"
+
+#: utils.py:563
+msgid "RSS feed is not well formed"
+msgstr "Flux RSS non valide"
+
+#: utils.py:633
msgid "Nothing to import"
msgstr "Rien à importer"
-#: utils.py:598
+#: utils.py:721
msgid "New items imported - validate them before exporting"
msgstr "Nouveaux éléments importés - valider ceux-ci avant d'exporter"
-#: utils.py:600
+#: utils.py:723
msgid ""
"There are items from a former import not yet validated - validate them "
"before exporting"
@@ -698,15 +706,15 @@ msgstr ""
"Il y a des éléments d'un import précédent pas encore validé - Validez les "
"avant d'exporter"
-#: utils.py:610
+#: utils.py:733
msgid "Bad param"
msgstr "Mauvais paramètre"
-#: utils.py:625
+#: utils.py:748
msgid "No non ambigious tag is defined in the XAPI request"
msgstr "Pas de tag non ambigü définis dans la requête XAPI"
-#: utils.py:627
+#: utils.py:750
msgid ""
"No bounding box is defined in the XAPI request.If you are sure to manage the "
"entire planet set the bounding box to -180,-90,180,90"
@@ -846,7 +854,13 @@ msgstr "Se déplacer"
msgid "Draw"
msgstr "Tracer"
-#: widgets.py:452
+#: widgets.py:394
+msgid "Hold CTRL, click and drag to select area on the map"
+msgstr ""
+"Maintenir la touche Control, cliquez puis glissez pour sélectionner une zone "
+"sur la carte"
+
+#: widgets.py:460
msgid "Select..."
msgstr "Sélectionner..."
diff --git a/chimere/static/chimere/js/edit_area.js b/chimere/static/chimere/js/edit_area.js
index f22d6e3..9c3384f 100644
--- a/chimere/static/chimere/js/edit_area.js
+++ b/chimere/static/chimere/js/edit_area.js
@@ -18,12 +18,25 @@ See the file COPYING for details.
/* area edit */
+var bbox_style = {fill: true, fillColor: "#FFFFFF", fillOpacity: 0.5,
+ stroke: true, strokeOpacity: 0.8, strokeColor: "#FF0000", strokeWidth: 2};
+
var map;
+var box_layer;
+
+function initForm(bounds){
+
+}
-/* update form fields on zoom action */
-function updateForm(){
- var bounds = map.getExtent().transform(epsg_projection,
- epsg_display_projection);
+/* update form fields on select action */
+function updateForm(bounds){
+ if(!bounds.toGeometry) return;
+ var feature = new OpenLayers.Feature.Vector(
+ bounds.toGeometry(), {}, bbox_style);
+ box_layer.destroyFeatures()
+ box_layer.addFeatures(feature);
+ var bounds = bounds.clone().transform(epsg_projection,
+ epsg_display_projection);
document.getElementById('upper_left_lat').value = bounds.top;
document.getElementById('upper_left_lon').value = bounds.left;
document.getElementById('lower_right_lat').value = bounds.bottom;
@@ -34,15 +47,40 @@ function updateForm(){
function init(){
map = new OpenLayers.Map ('map_edit', {
controls:[new OpenLayers.Control.Navigation(),
- new OpenLayers.Control.PanPanel(),
- new OpenLayers.Control.ZoomPanel(),
- new OpenLayers.Control.Attribution()],
+ new OpenLayers.Control.SimplePanZoom()],
maxResolution: 156543.0399,
units: 'm',
projection: epsg_projection,
displayProjection: epsg_display_projection
} );
- map.addLayers([map_layer]);
+ box_layer = new OpenLayers.Layer.Vector("Box layer");
+ map.addLayers([map_layer, box_layer]);
+ var selectControl = new OpenLayers.Control();
+ OpenLayers.Util.extend(selectControl, {
+ draw: function() {
+ this.box = new OpenLayers.Handler.Box(selectControl,
+ {'done': this.notice},
+ {keyMask: navigator.platform.match(/Mac/) ?
+ OpenLayers.Handler.MOD_ALT :OpenLayers.Handler.MOD_CTRL});
+ this.box.activate();
+ },
+
+ notice: function(pxbounds) {
+ ltpixel = map.getLonLatFromPixel(
+ new OpenLayers.Pixel(pxbounds.left, pxbounds.top));
+ rbpixel = map.getLonLatFromPixel(
+ new OpenLayers.Pixel(pxbounds.right, pxbounds.bottom));
+ if (ltpixel.equals(rbpixel))
+ return;
+ if (!ltpixel || !rbpixel) return;
+ bounds = new OpenLayers.Bounds();
+ bounds.extend(ltpixel);
+ bounds.extend(rbpixel);
+ updateForm(bounds);
+ }
+ });
+ map.addControl(selectControl);
+
map.events.register('zoomend', map, updateForm);
map.events.register('moveend', map, updateForm);
/* zoom to the appropriate extent */
diff --git a/chimere/widgets.py b/chimere/widgets.py
index e113305..f336ee1 100644
--- a/chimere/widgets.py
+++ b/chimere/widgets.py
@@ -358,9 +358,11 @@ class AreaWidget(forms.TextInput):
"""
class Media:
css = {
- "all": settings.OSM_CSS_URLS + ["%schimere/css/forms.css" % settings.STATIC_URL,]
+ "all": settings.OSM_CSS_URLS + \
+ ["%schimere/css/forms.css" % settings.STATIC_URL,]
}
- js = settings.OSM_JS_URLS + ["%schimere/js/edit_area.js" % settings.STATIC_URL,
+ js = settings.OSM_JS_URLS + [
+ "%schimere/js/edit_area.js" % settings.STATIC_URL,
"%schimere/js/base.js" % settings.STATIC_URL,]
def render(self, name, value, attrs=None):
@@ -379,7 +381,7 @@ class AreaWidget(forms.TextInput):
lower_right_lon, lower_right_lat = lower_right.x, \
lower_right.y
tpl = getMapJS()
- tpl += u"<div id='map_edit'></div>\n"\
+ tpl += u"</div>\n"\
u"<input type='hidden' name='upper_left_lat' id='upper_left_lat' "\
u"value='%f'/>\n"\
u"<input type='hidden' name='upper_left_lon' id='upper_left_lon' "\
@@ -389,13 +391,19 @@ class AreaWidget(forms.TextInput):
u"<input type='hidden' name='lower_right_lon' id='lower_right_lon' "\
u"value='%f'/>\n" % (
upper_left_lat, upper_left_lon, lower_right_lat, lower_right_lon)
- tpl += u"<script type='text/javascript'>\ninit();"
+ help_msg = _(u"Hold CTRL, click and drag to select area on the map")
+ tpl += u"<p>%s</p>\n" % help_msg
+ tpl += u"<script type='text/javascript'>\n"
+ tpl += u"$(document).ready(function($) {\ninit();\n"
if value:
tpl += u"var extent = new OpenLayers.Bounds(%f, %f, %f, %f);\n"\
u"extent.transform(epsg_display_projection, epsg_projection);\n"\
- u"map.zoomToExtent(extent, true);""" % (upper_left_lon,
- upper_left_lat, lower_right_lon, lower_right_lat)
- tpl += u"</script>\n<hr class='spacer'/>\n"
+ u"updateForm(extent);\n"\
+ u"map.zoomToExtent(extent, true);\n"\
+ u"map.zoomOut();" % (upper_left_lon, upper_left_lat,
+ lower_right_lon, lower_right_lat)
+ tpl += u"});\n</script>\n<hr class='spacer'/>\n"
+ tpl += u"<div id='map_edit'>\n"
return mark_safe(tpl)
def value_from_datadict(self, data, files, name):