diff options
| -rw-r--r-- | chimere/feeds.py | 7 | ||||
| -rw-r--r-- | chimere/forms.py | 12 | ||||
| -rw-r--r-- | chimere/locale/fr/LC_MESSAGES/django.po | 368 | ||||
| -rw-r--r-- | chimere/models.py | 4 | ||||
| -rw-r--r-- | chimere/static/chimere/css/styles.css | 52 | ||||
| -rw-r--r-- | chimere/static/chimere/js/base.js | 2 | ||||
| -rw-r--r-- | chimere/static/chimere/js/jquery.chimere.js | 4 | ||||
| -rw-r--r-- | chimere/templates/chimere/base.html | 11 | ||||
| -rw-r--r-- | chimere/templates/chimere/blocks/multimedia_file.html | 7 | ||||
| -rw-r--r-- | chimere/templates/chimere/blocks/submited.html | 1 | ||||
| -rw-r--r-- | chimere/templates/chimere/blocks/welcome.html | 11 | ||||
| -rw-r--r-- | chimere/templates/chimere/detail.html | 92 | ||||
| -rw-r--r-- | chimere/templates/chimere/feeds/rss.html | 3 | ||||
| -rw-r--r-- | chimere/templates/chimere/feeds/rss_descr.html | 2 | ||||
| -rw-r--r-- | chimere/templates/chimere/main_map.html | 2 | ||||
| -rw-r--r-- | chimere/templates/chimere/main_map_simple.html | 2 | ||||
| -rw-r--r-- | chimere/templatetags/chimere_tags.py | 9 | ||||
| -rw-r--r-- | chimere/tests.py | 68 | ||||
| -rw-r--r-- | chimere/views.py | 2 | ||||
| -rw-r--r-- | docs/install.rst | 8 |
20 files changed, 397 insertions, 270 deletions
diff --git a/chimere/feeds.py b/chimere/feeds.py index 100dd6b..53444ac 100644 --- a/chimere/feeds.py +++ b/chimere/feeds.py @@ -220,9 +220,6 @@ class LatestPOIsByZoneID(BaseFeed): return reverse('chimere:feeds-areaid', args=['', obj.id]) def items(self, obj): - sql = 'select * from "chimere_marker" where ' + obj.getIncludeSql() - sql += ' and "chimere_marker".available_date is not null' - sql += ' and "chimere_marker".status=\'A\'' - sql += ' order by "chimere_marker".available_date desc limit 15' - q = Marker.objects.raw(sql) + q = Marker.objects.filter(available_date__isnull=False, status='A') + q = q.filter(obj.getIncludeMarker()).order_by('-available_date')[:15] return q diff --git a/chimere/forms.py b/chimere/forms.py index ef2d3fb..5c759c9 100644 --- a/chimere/forms.py +++ b/chimere/forms.py @@ -200,14 +200,16 @@ class MarkerAdminFormBase(forms.ModelForm): Verify the mandatory properties (to be check manualy because it depends on the checked categories) ''' - if not settings.CHIMERE_DAYS_BEFORE_EVENT: - return self.cleaned_data - if self.cleaned_data['end_date'] and \ - not self.cleaned_data['start_date']: + start_date = self.cleaned_data.get('start_date') + end_date = self.cleaned_data.get('end_date') + if end_date and not start_date: msg = _(u"End date has been set with no start date") self._errors["end_date"] = self.error_class([msg]) del self.cleaned_data['end_date'] - + if end_date and start_date and start_date > end_date: + msg = _(u"End date can't be before start date") + self._errors["end_date"] = self.error_class([msg]) + raise forms.ValidationError(msg) for pm in self.pms: if not pm.mandatory or self.cleaned_data[pm.getNamedId()]: continue diff --git a/chimere/locale/fr/LC_MESSAGES/django.po b/chimere/locale/fr/LC_MESSAGES/django.po index c22919a..08d14f3 100644 --- a/chimere/locale/fr/LC_MESSAGES/django.po +++ b/chimere/locale/fr/LC_MESSAGES/django.po @@ -7,17 +7,17 @@ msgid "" msgstr "" "Project-Id-Version: 2.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-10-14 16:46+0200\n" +"POT-Creation-Date: 2012-10-31 09:48+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:734 +#: __init__.py:8 models.py:735 msgid "Multimedia files" msgstr "Fichiers multimedias" -#: __init__.py:9 models.py:790 +#: __init__.py:9 models.py:791 msgid "Picture files" msgstr "Fichiers d'image" @@ -45,7 +45,7 @@ msgstr "Flux RSS" msgid "Contact us" msgstr "Nous contacter" -#: admin.py:53 templates/chimere/feeds/rss.html:69 +#: admin.py:53 templates/chimere/feeds/rss.html:70 msgid "Validate" msgstr "Valider" @@ -125,44 +125,48 @@ msgstr "" msgid "You have to set \"source\" or \"source file\"." msgstr "Vous devez spécifier le champ « Source » ou « Fichier source »." -#: forms.py:204 +#: forms.py:206 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:215 +#: forms.py:210 +msgid "End date can't be before start date" +msgstr "La date de fin ne peut pas être antérieure à la date de début" + +#: forms.py:220 msgid "This field is mandatory for the selected categories" msgstr "Ce champ est obligatoire pour les catégories sélectionnées" -#: forms.py:478 +#: forms.py:483 msgid "File" msgstr "Fichier" -#: forms.py:484 +#: forms.py:489 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:489 models.py:53 models.py:101 models.py:163 models.py:184 -#: models.py:197 models.py:212 models.py:352 models.py:668 models.py:724 -#: models.py:767 models.py:883 models.py:1199 models.py:1211 models.py:1384 +#: forms.py:494 models.py:53 models.py:101 models.py:163 models.py:184 +#: models.py:197 models.py:212 models.py:353 models.py:669 models.py:725 +#: models.py:768 models.py:884 models.py:1200 models.py:1212 models.py:1385 #: utils.py:454 templates/chimere/edit.html:39 #: templates/chimere/edit_route.html:36 #: templates/chimere/blocks/alternate_multimedia.html:39 msgid "Name" msgstr "Nom" -#: forms.py:498 models.py:1248 +#: forms.py:503 models.py:1249 msgid "Area" msgstr "Zone" -#: forms.py:558 +#: forms.py:563 msgid "Start" msgstr "Départ" -#: forms.py:559 +#: forms.py:564 msgid "Finish" msgstr "Arrivée :" -#: forms.py:560 +#: forms.py:565 msgid "Speed" msgstr "Vitesse" @@ -170,13 +174,13 @@ msgstr "Vitesse" msgid "Mnemonic" msgstr "Mnémonique" -#: models.py:56 models.py:102 models.py:185 models.py:213 models.py:363 -#: models.py:672 models.py:1217 models.py:1386 models.py:1427 +#: models.py:56 models.py:102 models.py:185 models.py:213 models.py:364 +#: models.py:673 models.py:1218 models.py:1387 models.py:1428 msgid "Available" msgstr "Disponible" -#: models.py:57 models.py:173 models.py:186 models.py:223 models.py:726 -#: models.py:782 models.py:1216 models.py:1373 models.py:1385 +#: models.py:57 models.py:173 models.py:186 models.py:230 models.py:727 +#: models.py:783 models.py:1217 models.py:1374 models.py:1386 msgid "Order" msgstr "Ordre" @@ -188,15 +192,15 @@ msgstr "Chemin du patron" msgid "Page" msgstr "Page" -#: models.py:103 models.py:443 +#: models.py:103 models.py:444 msgid "Is front page" msgstr "Est en page principale" -#: models.py:105 models.py:1395 +#: models.py:105 models.py:1396 msgid "Date" msgstr "Date" -#: models.py:107 models.py:725 +#: models.py:107 models.py:726 msgid "Url" msgstr "Url" @@ -217,7 +221,7 @@ msgstr "Paramètres" msgid "TinyUrl" msgstr "Mini-url" -#: models.py:167 models.py:174 models.py:221 +#: models.py:167 models.py:174 models.py:225 msgid "Color theme" msgstr "Thème de couleur" @@ -229,24 +233,24 @@ msgstr "Code" msgid "Color" msgstr "Couleur" -#: models.py:192 models.py:210 templates/chimere/main_map.html:13 +#: models.py:192 models.py:210 msgid "Category" msgstr "Catégorie" -#: models.py:198 models.py:664 models.py:768 models.py:949 +#: models.py:198 models.py:665 models.py:769 models.py:950 #: templates/chimere/blocks/alternate_multimedia.html:43 msgid "Image" msgstr "Image" -#: models.py:200 models.py:770 models.py:951 +#: models.py:200 models.py:771 models.py:952 msgid "Height" msgstr "Hauteur" -#: models.py:201 models.py:771 models.py:952 +#: models.py:201 models.py:772 models.py:953 msgid "Width" msgstr "Largeur" -#: models.py:205 models.py:218 +#: models.py:205 models.py:222 msgid "Icon" msgstr "Icône" @@ -255,335 +259,339 @@ msgid "Available for submission" msgstr "Disponible pour proposition" #: models.py:216 -msgid "Displayed in the layer menu" -msgstr "Apparaît dans le menu des couches ?" - -#: models.py:219 -msgid "Hover icon" -msgstr "Icône en survol" - -#: models.py:224 -msgid "Is dated" -msgstr "Est daté" - -#: models.py:225 msgid "Marker" msgstr "Point d'intérêt" -#: models.py:226 models.py:945 models.py:960 +#: models.py:217 models.py:946 models.py:961 #: templates/chimere/edit_route.html:27 msgid "Route" msgstr "Trajet" -#: models.py:227 +#: models.py:218 msgid "Both" msgstr "Mixte" -#: models.py:228 +#: models.py:219 msgid "Item type" msgstr "Type d'élément" -#: models.py:234 +#: models.py:220 +msgid "Is dated" +msgstr "Est daté" + +#: models.py:223 +msgid "Hover icon" +msgstr "Icône en survol" + +#: models.py:227 +msgid "Displayed in the layer menu" +msgstr "Apparaît dans le menu des couches ?" + +#: models.py:229 +msgid "Routing warn" +msgstr "Avertissement sur les itinéraires" + +#: models.py:235 msgid "Sub-category" msgstr "Sous-catégorie" -#: models.py:235 +#: models.py:236 msgid "Sub-categories" msgstr "Sous-catégories" -#: models.py:311 +#: models.py:312 msgid "Importer type" msgstr "Type d'import" -#: models.py:314 models.py:374 +#: models.py:315 models.py:375 msgid "Source" msgstr "Source" -#: models.py:316 +#: models.py:317 msgid "Source file" msgstr "Fichier source" -#: models.py:318 +#: models.py:319 msgid "Filter" msgstr "Filtre" -#: models.py:320 +#: models.py:321 msgid "Name by default" msgstr "Nom par défaut" -#: models.py:322 +#: models.py:323 msgid "SRID" msgstr "SRID" -#: models.py:323 +#: models.py:324 msgid "Zipped file" msgstr "Fichier zippé" -#: models.py:324 models.py:380 +#: models.py:325 models.py:381 msgid "Origin" msgstr "Origine" -#: models.py:326 models.py:382 +#: models.py:327 models.py:383 msgid "License" msgstr "Licence" -#: models.py:329 +#: models.py:330 msgid "Associated subcategories" msgstr "Sous-catégories associées" -#: models.py:330 utils.py:458 +#: models.py:331 utils.py:458 msgid "State" msgstr "État" -#: models.py:334 +#: models.py:335 msgid "Importer" msgstr "Import" -#: models.py:354 +#: models.py:355 msgid "Submitter session key" msgstr "Clé de session du demandeur" -#: models.py:356 +#: models.py:357 msgid "Submitter name or nickname" msgstr "Nom ou pseudo du demandeur" -#: models.py:358 +#: models.py:359 msgid "Submitter email" msgstr "Courriel du demandeur" -#: models.py:360 +#: models.py:361 msgid "Submitter comment" msgstr "Commentaire du demandeur" -#: models.py:362 +#: models.py:363 msgid "Submited" msgstr "Soumis" -#: models.py:364 +#: models.py:365 msgid "Modified" msgstr "Modifié" -#: models.py:365 +#: models.py:366 msgid "Disabled" msgstr "Désactivé" -#: models.py:366 +#: models.py:367 msgid "Imported" msgstr "Importé" -#: models.py:367 +#: models.py:368 msgid "Excluded" msgstr "Exclu" -#: models.py:369 +#: models.py:370 msgid "Status" msgstr "État" -#: models.py:370 +#: models.py:371 msgid "Import key" msgstr "Clé d'import" -#: models.py:372 +#: models.py:373 msgid "Import version" msgstr "Version de l'import" -#: models.py:376 +#: models.py:377 msgid "Modified since last import" msgstr "Modifié depuis le dernier import" -#: models.py:378 +#: models.py:379 msgid "Not to be imported inside OSM" msgstr "Ne pas importer dans OSM" -#: models.py:385 templates/chimere/edit.html:56 +#: models.py:386 templates/chimere/edit.html:56 #: templates/chimere/edit_route.html:52 msgid "Start date" msgstr "Date de début" -#: models.py:386 +#: models.py:387 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:388 templates/chimere/edit.html:62 +#: models.py:389 templates/chimere/edit.html:62 #: templates/chimere/edit_route.html:58 msgid "End date" msgstr "Date de fin" -#: models.py:389 +#: models.py:390 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:435 +#: models.py:436 msgid "Reference marker" msgstr "Point d'intérêt de référence" -#: models.py:436 utils.py:460 +#: models.py:437 utils.py:460 msgid "Localisation" msgstr "Localisation" -#: models.py:438 +#: models.py:439 msgid "Available Date" msgstr "Date de mise en disponibilité" -#: models.py:442 utils.py:459 templates/chimere/edit.html:49 +#: models.py:443 utils.py:459 templates/chimere/edit.html:49 #: templates/chimere/edit_route.html:46 msgid "Description" msgstr "Description" -#: models.py:506 models.py:1437 +#: models.py:507 models.py:1438 msgid "Point of interest" msgstr "Point d'intérêt" -#: models.py:662 +#: models.py:663 msgid "Audio" msgstr "Audio" -#: models.py:663 +#: models.py:664 msgid "Video" msgstr "Vidéo" -#: models.py:665 +#: models.py:666 msgid "Other" msgstr "Autre" -#: models.py:666 +#: models.py:667 msgid "Media type" msgstr "Type de media" -#: models.py:669 +#: models.py:670 msgid "Mime type" msgstr "Type mime" -#: models.py:671 +#: models.py:672 msgid "Inside an iframe" msgstr "À l'intérieur d'un iframe" -#: models.py:675 +#: models.py:676 msgid "Multimedia type" msgstr "Type de multimedia" -#: models.py:676 +#: models.py:677 msgid "Multimedia types" msgstr "Types de multimedia" -#: models.py:711 +#: models.py:712 msgid "Extension name" msgstr "Nom de l'extension" -#: models.py:713 +#: models.py:714 msgid "Associated multimedia type" msgstr "Type de multimedia associé" -#: models.py:717 +#: models.py:718 msgid "Multimedia extension" msgstr "Extension de fichier multimedia" -#: models.py:718 +#: models.py:719 msgid "Multimedia extensions" msgstr "Extensions de fichier multimedia" -#: models.py:728 models.py:772 +#: models.py:729 models.py:773 msgid "Display inside the description?" msgstr "Apparaît dans la description ?" -#: models.py:733 +#: models.py:734 msgid "Multimedia file" msgstr "Fichier multimedia" -#: models.py:774 +#: models.py:775 msgid "Thumbnail" msgstr "Miniature" -#: models.py:778 +#: models.py:779 msgid "Thumbnail height" msgstr "Hauteur de la miniature" -#: models.py:780 +#: models.py:781 msgid "Thumbnail width" msgstr "Largeur de la miniature" -#: models.py:789 +#: models.py:790 msgid "Picture file" msgstr "Fichier d'image" -#: models.py:884 +#: models.py:885 msgid "Raw file (gpx or kml)" msgstr "Fichier brut (gpx ou kml)" -#: models.py:886 +#: models.py:887 msgid "Simplified file" msgstr "Fichier simplifié" -#: models.py:888 +#: models.py:889 msgid "KML" msgstr "KML" -#: models.py:888 +#: models.py:889 msgid "GPX" msgstr "GPX" -#: models.py:893 +#: models.py:894 msgid "Route file" msgstr "Fichier de trajet" -#: models.py:894 +#: models.py:895 msgid "Route files" msgstr "Fichiers de trajet" -#: models.py:944 +#: models.py:945 msgid "Reference route" msgstr "Trajet de référence" -#: models.py:948 +#: models.py:949 msgid "Associated file" msgstr "Fichier associé" -#: models.py:1200 +#: models.py:1201 msgid "Layer code" msgstr "Code pour la couche" -#: models.py:1206 +#: models.py:1207 msgid "Layer" msgstr "Couche" -#: models.py:1212 +#: models.py:1213 msgid "Area urn" msgstr "Urn de la zone" -#: models.py:1214 templates/chimere/blocks/welcome.html:3 +#: models.py:1215 templates/chimere/blocks/welcome.html:3 msgid "Welcome message" msgstr "Message d'accueil" -#: models.py:1218 +#: models.py:1219 msgid "Upper left corner" msgstr "Coin en haut à gauche" -#: models.py:1220 +#: models.py:1221 msgid "Lower right corner" msgstr "Coin en bas à droite" -#: models.py:1222 +#: models.py:1223 msgid "Default area" msgstr "Zone par défaut" -#: models.py:1223 +#: models.py:1224 msgid "Only one area is set by default" msgstr "Seule une zone est définie par défaut" -#: models.py:1227 +#: models.py:1228 msgid "Sub-categories checked by default" msgstr "Sous-catégories cochées par défaut" -#: models.py:1229 +#: models.py:1230 msgid "Sub-categories dynamicaly displayed" msgstr "Sous-categories affichées dynamiquement" -#: models.py:1230 +#: models.py:1231 msgid "" "If checked, categories are only displayed in the menu if they are available " "on the current extent." @@ -591,76 +599,76 @@ msgstr "" "Si coché, les catégories sont disponibles sur le menu seulement si elles " "apparaissent sur la zone affichée." -#: models.py:1234 models.py:1389 +#: models.py:1235 models.py:1390 msgid "Restricted to theses sub-categories" msgstr "Restreindre à ces sous-categories" -#: models.py:1235 +#: models.py:1236 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:1237 +#: models.py:1238 msgid "Link to an external CSS" msgstr "Lien vers une feuille de style externe" -#: models.py:1239 +#: models.py:1240 msgid "Restrict to the area extent" msgstr "Restreindre à l'étendue de la zone" -#: models.py:1374 widgets.py:86 +#: models.py:1375 widgets.py:86 msgid "Default layer" msgstr "Couche par défaut" -#: models.py:1378 models.py:1379 +#: models.py:1379 models.py:1380 msgid "Layers" msgstr "Couches" -#: models.py:1387 +#: models.py:1388 msgid "Mandatory" msgstr "Obligatoire" -#: models.py:1390 +#: models.py:1391 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:1392 +#: models.py:1393 msgid "Text" msgstr "Texte" -#: models.py:1393 +#: models.py:1394 msgid "Long text" msgstr "Texte long" -#: models.py:1394 +#: models.py:1395 msgid "Password" msgstr "Mot de passe" -#: models.py:1396 +#: models.py:1397 msgid "Choices" msgstr "Choix" -#: models.py:1404 +#: models.py:1405 msgid "Type" msgstr "Type" -#: models.py:1409 models.py:1425 models.py:1439 +#: models.py:1410 models.py:1426 models.py:1440 msgid "Property model" msgstr "Modèle de propriété" -#: models.py:1426 models.py:1440 +#: models.py:1427 models.py:1441 msgid "Value" msgstr "Valeur" -#: models.py:1432 +#: models.py:1433 msgid "Model property choice" msgstr "Choix pour les modèles de propriété" -#: models.py:1451 +#: models.py:1452 msgid "Property" msgstr "Propriété" @@ -749,7 +757,8 @@ msgid "Failed to create field" msgstr "Ne peut pas créer un champ" #: utils.py:455 templates/chimere/edit.html:44 -#: templates/chimere/edit_route.html:41 +#: templates/chimere/edit_route.html:41 templates/chimere/main_map.html:13 +#: templates/chimere/main_map_simple.html:10 msgid "Categories" msgstr "Catégories" @@ -794,19 +803,19 @@ msgstr "" "vouloir lancer la requête sur la planète entière fixez la « bounding box » " "à -180,-90,180,90" -#: views.py:268 +#: views.py:271 msgid "There are missing field(s) and/or errors in the submited form." msgstr "Il y a des champs manquants ou des erreurs dans ce formulaire." -#: views.py:353 +#: views.py:356 msgid "Bad file. Please check it with an external software." msgstr "Fichier incohérent. Merci de le vérifier avec un logiciel externe." -#: views.py:465 +#: views.py:468 msgid "Comments/request on the map" msgstr "Commentaires/requètes sur la carte" -#: views.py:468 +#: views.py:471 msgid "" "Thank you for your contribution. It will be taken into account. If you have " "left your email you may be contacted soon for more details." @@ -815,52 +824,56 @@ msgstr "" "laissé votre courriel vous serez peut-être contacté bientôt pour plus de " "détails." -#: views.py:472 +#: views.py:475 msgid "Temporary error. Renew your message later." msgstr "Erreur temporaire. Réenvoyez votre message plus tard." -#: views.py:624 +#: views.py:629 msgid "No category available in this area." msgstr "Pas de catégorie disponible sur cette zone." -#: views.py:768 +#: views.py:729 +msgid "Bad geometry" +msgstr "Géométrie incorrecte" + +#: views.py:804 msgid "Incorrect choice in the list" msgstr "Choix incorrect dans la liste" -#: widgets.py:245 +#: widgets.py:233 msgid "Street, City, Country" msgstr "Rue, Commune, Pays" -#: widgets.py:312 +#: widgets.py:300 msgid "Latitude" msgstr "Latitude" -#: widgets.py:312 +#: widgets.py:300 msgid "Longitude" msgstr "Longitude" -#: widgets.py:337 +#: widgets.py:325 msgid "Invalid point" msgstr "Point invalide" -#: widgets.py:390 +#: widgets.py:378 msgid "Creation mode" msgstr "Mode création" -#: widgets.py:391 +#: widgets.py:379 msgid "To start drawing the route click on the toggle button: \"Draw\"." msgstr "" "Pour commencer le dessin cliquez sur le bouton : « Tracer »." -#: widgets.py:393 +#: widgets.py:381 msgid "Then click on the map to begin the drawing." msgstr "Puis cliquez sur la carte pour commencer le dessin." -#: widgets.py:394 +#: widgets.py:382 msgid "You can add points by clicking again." msgstr "Vous pouvez ajouter des points en cliquant de nouveau." -#: widgets.py:395 +#: widgets.py:383 msgid "" "To finish the drawing double click. When the drawing is finished you can " "edit it." @@ -868,7 +881,7 @@ msgstr "" "Pour finir le tracé double-cliquez. Quand le tracé est fini vous pouvez " "toujours l'éditer." -#: widgets.py:397 +#: widgets.py:385 msgid "" "While creating to undo a drawing click again on the toggle button \"Stop " "drawing\"." @@ -876,17 +889,17 @@ msgstr "" "En mode création vous pouvez annuler un tracé en appuyant sur le bouton " "« Arrêter le tracé »." -#: widgets.py:402 +#: widgets.py:390 msgid "Modification mode" msgstr "Mode modification" -#: widgets.py:403 +#: widgets.py:391 msgid "To move a point click on it and drag it to the desired position." msgstr "" "Pour bouger un point, cliquez dessus, maintenez le click pour le déposer à " "la position désirée." -#: widgets.py:404 +#: widgets.py:392 msgid "" "To delete a point move the mouse cursor over it and press the \"d\" or \"Del" "\" key." @@ -894,7 +907,7 @@ msgstr "" "Pour supprimer un point, mettez le curseur de la souris sur celui-ci et " "appuyez sur le touche « d » ou « Suppr »." -#: widgets.py:406 +#: widgets.py:394 msgid "" "To add a point click in the middle of a segment and drag the new point to " "the desired position" @@ -903,39 +916,39 @@ msgstr "" "maintenez le bouton appuyé et déplacez le nouveau point à la position " "désirée." -#: widgets.py:413 +#: widgets.py:401 msgid "Give a name and set category before uploading a file." msgstr "" "Renseignez le nom et choisissez au moins une catégorie avant de déposer un " "fichier." -#: widgets.py:416 +#: widgets.py:404 msgid "Upload a route file (GPX or KML)" msgstr "Déposer un trajet (fichier GPX ou KML)" -#: widgets.py:417 +#: widgets.py:405 msgid "or" msgstr "ou" -#: widgets.py:422 +#: widgets.py:410 msgid "Start \"hand\" drawing" msgstr "Commencer le tracé manuellement" -#: widgets.py:445 +#: widgets.py:433 msgid "Move on the map" msgstr "Se déplacer" -#: widgets.py:445 +#: widgets.py:433 msgid "Draw" msgstr "Tracer" -#: widgets.py:525 +#: widgets.py:513 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:591 +#: widgets.py:579 msgid "Select..." msgstr "Sélectionner..." @@ -951,7 +964,7 @@ msgstr "Erreur interne du serveur" msgid "Chimère administration" msgstr "Administration de Chimère" -#: templates/chimere/base.html:19 +#: templates/chimere/base.html:12 msgid "You must enable JavaScript in your browser to display Chimère." msgstr "" "Vous devez activer le JavaScript dans votre navigateur pour afficher Chimère." @@ -1048,10 +1061,6 @@ msgstr "Proposez" msgid "Add/modify a route" msgstr "Ajout ou modifier un trajet" -#: templates/chimere/main_map_simple.html:10 -msgid "Topics" -msgstr "Thèmes" - #: templates/chimere/upload_file.html:13 msgid "Thank you for your submission!" msgstr "Merci pour votre proposition !" @@ -1198,7 +1207,7 @@ msgstr "" "libre Flash." #: templates/chimere/blocks/news.html:42 -#: templates/chimere/blocks/welcome.html:47 +#: templates/chimere/blocks/welcome.html:52 msgid "See it on the map" msgstr "Voir sur la carte" @@ -1254,19 +1263,19 @@ msgstr "" msgid "Thank you" msgstr "Merci" -#: templates/chimere/blocks/submited.html:11 +#: templates/chimere/blocks/submited.html:12 msgid "Add a new item" msgstr "Ajout d'un nouvel élément" -#: templates/chimere/blocks/submited.html:15 +#: templates/chimere/blocks/submited.html:16 msgid "Continue edition of this item" msgstr "Continuer l'édition de cet élément" -#: templates/chimere/blocks/submited.html:19 +#: templates/chimere/blocks/submited.html:20 msgid "Return to the map" msgstr "Retourner à la carte" -#: templates/chimere/blocks/welcome.html:5 +#: templates/chimere/blocks/welcome.html:9 msgid "Welcome" msgstr "Accueil" @@ -1286,7 +1295,7 @@ msgstr "Tous les nouveaux points d'intérêt" msgid "New points of interest by category" msgstr "Les nouveaux points d'intérêt par catégorie" -#: templates/chimere/feeds/rss.html:25 templates/chimere/feeds/rss.html:47 +#: templates/chimere/feeds/rss.html:25 templates/chimere/feeds/rss.html:48 msgid "New points of interest by area" msgstr "Les nouveaux points d'intérêt par zone" @@ -1294,11 +1303,11 @@ msgstr "Les nouveaux points d'intérêt par zone" msgid "Choose a category" msgstr "Choisir une catégorie" -#: templates/chimere/feeds/rss.html:50 +#: templates/chimere/feeds/rss.html:51 msgid "Choose a pre-defined areas" msgstr "Choisir une zone pré-définie" -#: templates/chimere/feeds/rss.html:64 +#: templates/chimere/feeds/rss.html:65 msgid "Or select the area by zooming and panning this map" msgstr "Ou sélectionner une zone en zoomant et en se déplaçant sur cette carte" @@ -1310,10 +1319,13 @@ msgstr "Description :" msgid ":" msgstr " :" -#: templatetags/chimere_tags.py:76 +#: templatetags/chimere_tags.py:79 #, python-format msgid "Welcome to the %s" msgstr "Bienvenue sur %s" +#~ msgid "Topics" +#~ msgstr "Thèmes" + #~ msgid "Administration de Chimère" #~ msgstr "Administration de Chimère" diff --git a/chimere/models.py b/chimere/models.py index 077419b..a34635d 100644 --- a/chimere/models.py +++ b/chimere/models.py @@ -1100,11 +1100,11 @@ def getDateCondition(): after = (datetime.datetime.now() + \ datetime.timedelta(settings.CHIMERE_DAYS_BEFORE_EVENT) ).strftime('%Y-%m-%d') - date_condition = " and %(alias)s.start_date is null or " + date_condition = " and (%(alias)s.start_date is null or " date_condition += "(%(alias)s.start_date >= '" + now + "' and " date_condition += "%(alias)s.start_date <='" + after + "')" date_condition += " or (%(alias)s.start_date <='" + now + "' and " - date_condition += "%(alias)s.end_date >='" + now + "') " + date_condition += "%(alias)s.end_date >='" + now + "')) " return date_condition class SimplePoint: diff --git a/chimere/static/chimere/css/styles.css b/chimere/static/chimere/css/styles.css index bfdf36e..caee1a6 100644 --- a/chimere/static/chimere/css/styles.css +++ b/chimere/static/chimere/css/styles.css @@ -320,16 +320,22 @@ ul#action-2 { margin:4px 8px; } -#detail_content{ +#news_content{ + overflow:auto; +} + +.detail_content{ overflow:auto; height:80%; } -#detail_content img{ +#news_content img, +.detail_content img{ max-width:280px; } -#detail_content p{ +#news_content p, +.detail_content p{ padding:0.2em 0; margin:0; } @@ -705,8 +711,13 @@ p.warning{ } #no-js-message{ - z-index:1000; + z-index:5000; text-align:center; + position:absolute; + top:0; + bottom:0; + height:100%; + width:100%; } @@ -914,8 +925,11 @@ ul#multimedia_list_content li.multimedia{ .small-gallery{ width:320px; - min-height:30px; + min-height:35px; text-align:center; + margin-left:auto; + margin-right:auto; + margin-top:15px; } .small-gallery .media-player, @@ -924,11 +938,37 @@ ul#multimedia_list_content li.multimedia{ { width:300px; min-height:50px; - /*height:180px;*/ +} + +p.legend{ + padding:0; + margin:0; + text-align:center; +} +.small-gallery p.legend{ + font-size:0.9em; +} + +.ui-tabs-panel{ + overflow:auto; +} + +.media-img{ + max-height:400px; +} + +.media-video, +.media-img, +.media-player{ + display:block; + margin-left:auto; + margin-right:auto; + margin-top:10px; } /** jme **/ + /*overlay controls*/ .media-controls-wrapper { position: absolute; diff --git a/chimere/static/chimere/js/base.js b/chimere/static/chimere/js/base.js index 4482879..ba2ffc2 100644 --- a/chimere/static/chimere/js/base.js +++ b/chimere/static/chimere/js/base.js @@ -69,7 +69,7 @@ function saveExtent() { var extent = map.getExtent().transform(map.getProjectionObject(), epsg_display_projection); document.cookie = extent_key + "=" + extent.toArray().join('_') - + ';path="/"'; + + ';path=/'; } function getExtent() { diff --git a/chimere/static/chimere/js/jquery.chimere.js b/chimere/static/chimere/js/jquery.chimere.js index 381f8bb..24d4af1 100644 --- a/chimere/static/chimere/js/jquery.chimere.js +++ b/chimere/static/chimere/js/jquery.chimere.js @@ -1391,8 +1391,8 @@ OpenLayers.Layer.MapQuestOSM = OpenLayers.Class(OpenLayers.Layer.XYZ, { if (!settings.map) return; var extent = settings.map.getExtent().transform(EPSG_PROJECTION, EPSG_DISPLAY_PROJECTION); - document.cookie = extent_key + "=" + extent.toArray().join('_') - + ';path="/"'; + document.cookie = extent_key + '=' + extent.toArray().join('_') + + ';path=/'; } }; // End of public methods var helpers = { diff --git a/chimere/templates/chimere/base.html b/chimere/templates/chimere/base.html index e4d514a..620c84f 100644 --- a/chimere/templates/chimere/base.html +++ b/chimere/templates/chimere/base.html @@ -7,6 +7,11 @@ <link rel="stylesheet" href="{{ css_area }}" />{% endif %} {% endblock %} {% block header %} +<noscript> + <div id="no-js-message"> + <p id='no-js' class='warning'>{% trans "You must enable JavaScript in your browser to display Chimère."%}</p> + </div> +</noscript> {% block page_title %} {% include "chimere/blocks/page_title.html" %} {% endblock %} @@ -15,12 +20,6 @@ {% endblock %} {% endblock %} {% block content %} - <div id="no-js-message"> - <p id='no-js' class='warning'>{% trans "You must enable JavaScript in your browser to display Chimère."%}</p> - </div> -<script type="text/javascript"> - $("#no-js").hide(); -</script> {% block top %}{% endblock %} {% block message_map %}{% endblock %} {% block message_edit %}{% endblock %} diff --git a/chimere/templates/chimere/blocks/multimedia_file.html b/chimere/templates/chimere/blocks/multimedia_file.html index d659348..a360a9e 100644 --- a/chimere/templates/chimere/blocks/multimedia_file.html +++ b/chimere/templates/chimere/blocks/multimedia_file.html @@ -1,14 +1,14 @@ {% load i18n %} {% if multimedia_item.picture %} -<a rel="prettyPhoto" href='{{multimedia_item.picture.url}}' ><img class='thumbnail' alt="{{multimedia_item.name}}" src='{{multimedia_item.thumbnailfile.url}}'/></a>{% endif %} +<a rel="prettyPhoto" href='{{multimedia_item.picture.url}}' ><img class='media-img thumbnail' alt="{{multimedia_item.name}}" src='{{multimedia_item.thumbnailfile.url}}'/></a>{% endif %} {% if multimedia_item.url %} {% if multimedia_item.multimedia_type.iframe %} -<iframe class='video' src='{{multimedia_item.url}}'> +<iframe class='media-video video' src='{{multimedia_item.url}}'> </iframe> {% else %} {% ifequal multimedia_item.multimedia_type.media_type 'I' %} -<img alt="{{multimedia_item.name}}" src='{{multimedia_item.url}}'/> +<img class='media-img' alt="{{multimedia_item.name}}" src='{{multimedia_item.url}}'/> {% else %} <div class="media-player"> <span class="media-label">{{multimedia_item.name}}</span> @@ -27,3 +27,4 @@ {% endifequal %} {% endif %} {% endif %} +{% if multimedia_item.name %}<p class='legend'><strong>{{multimedia_item.name}}</strong></p>{% endif %} diff --git a/chimere/templates/chimere/blocks/submited.html b/chimere/templates/chimere/blocks/submited.html index ad264f8..5e4e546 100644 --- a/chimere/templates/chimere/blocks/submited.html +++ b/chimere/templates/chimere/blocks/submited.html @@ -7,6 +7,7 @@ $("#submited-window").dialog({ title:"{% trans "Thank you" %}", modal: true, + zIndex: 2002, buttons:{ "{% trans "Add a new item" %}": function() { diff --git a/chimere/templates/chimere/blocks/welcome.html b/chimere/templates/chimere/blocks/welcome.html index 72d37b3..3ec2ccf 100644 --- a/chimere/templates/chimere/blocks/welcome.html +++ b/chimere/templates/chimere/blocks/welcome.html @@ -2,8 +2,13 @@ {% if news_lst or welcome_message %} <a href='#' id='welcome_button' class='ui-widget ui-button ui-state-default ui-corner-all'>{% trans "Welcome message"%}</a> <script type='text/javascript'> -function display_welcome(){$("#welcome").dialog({title:"{% trans "Welcome"%}", - width:360});} +function display_welcome(){ + var width = $(window).width(); + width = width - 40*width/100; + var height = $(window).height()-200; + $("#welcome").dialog({title:"{% trans "Welcome"%}", + width:width, height:height}); +} $("#welcome_button").bind('click', display_welcome); $(function(){ $('#welcome div.media-player').jmeEmbedControls(); @@ -13,7 +18,7 @@ $(function(){ }); </script> <div id='welcome' style='display:none'> - <div id='detail_content'> + <div id='news_content'> {% if welcome_message %} <div id='welcome_message'> {{welcome_message|safe}} diff --git a/chimere/templates/chimere/detail.html b/chimere/templates/chimere/detail.html index 858a7ae..7fd2b2b 100644 --- a/chimere/templates/chimere/detail.html +++ b/chimere/templates/chimere/detail.html @@ -1,6 +1,6 @@ {% load i18n sanitize chimere_tags %} <h2 class='ui-widget ui-state-default ui-corner-all ui-widget-header'>{{ marker.name }}</h2> -<div id='detail_content'> +<div class='detail_content'> {% if marker.default_pictures or marker.default_pictures or marker.default_multimedia_items%} <div class='small-gallery'> {% for picture in marker.default_pictures %} @@ -13,19 +13,19 @@ {%endif%} <div> {% if dated %} - <p id='detail_start_date'><label>{% trans "Date:" %}</label> <span>{{marker.start_date|date:"D d M Y"}} + <p class='detail_start_date'><label>{% trans "Date:" %}</label> <span>{{marker.start_date|date:"D d M Y"}} {% if marker.end_date %} - {{marker.end_date|date:"D d M Y"}}</p>{% endif %}</span> {% endif %} {% if marker.description %} <p class='description'>{{ marker.description|sanitize:"p b i br hr strong em img:src:alt span:style a:href:target ul li ol h1 h2 h3 h4 table td tr th"|safe}}</p> {% endif %} {% for property in marker.getProperties %} - <p id='{{property.propertymodel.getNamedId}}'>{{ property.value|sanitize:"p b i br hr strong em img:src:alt span:style a:href:target ul li ol h1 h2 h3 h4 table td tr th"|safe}}</p> + <p class='{{property.propertymodel.getNamedId}}'>{{ property.value|sanitize:"p b i br hr strong em img:src:alt span:style a:href:target ul li ol h1 h2 h3 h4 table td tr th"|safe}}</p> {% endfor %} {% if marker.origin %}<p class='detail_source'><strong>{% trans "Source:" %}</strong> <span>{{marker.origin}}</span></p>{% endif %} {% if marker.license %}<p class='detail_license'><strong>{% trans "License:" %}</strong> <span>{{marker.license}}</span></p>{% endif %} {% if marker.multimedia_items %} - <a href='#' id='show_gallery_link'>{% trans "Show multimedia gallery" %}</a> + <a href='#' class='show_gallery_link'>{% trans "Show multimedia gallery" %}</a> {% endif %} </div> {% if moderator_emails %} @@ -36,13 +36,13 @@ {% endif %} </div> {% if marker.multimedia_items %} -<div id='gallery-{{marker.pk}}' class='gallery'> +<div id='gallery-{{time_now}}' class='gallery'> <div class='tabs'> <ul>{% for item in marker.multimedia_items %} - <li><a href="#tab-{{ forloop.counter }}">{{ item.name }}</a></li>{% endfor %} + <li><a href="#tab-{{time_now}}-{{ forloop.counter }}">{{ item.name }}</a></li>{% endfor %} </ul> {% for multimedia_item in marker.multimedia_items %} - <div id="tab-{{ forloop.counter }}" class='{% ifequal multimedia_item.multimedia_type.media_type 'V' %}video{% else %}other{% endifequal %}'> + <div id="tab-{{time_now}}-{{ forloop.counter }}" class='{% ifequal multimedia_item.multimedia_type.media_type 'V' %}video{% else %}other{% endifequal %}'> {% multimedia_render multimedia_item %} </div>{% endfor %} </div> @@ -50,50 +50,52 @@ {% endif %} <script language='javascript' type='text/javascript'> $('html').addClass('js-on'); -$(function(){ - $("#gallery-{{marker.pk}}").dialog({title:"{{marker.name}}", autoOpen: false, - height: "auto", width: "auto"}); - $('div.media-player').jmeEmbedControls(); - $('.tabs').tabs({ - select: function(event, ui) { +$(document).ready(function(){ + $("#gallery-{{time_now}}").dialog({title:"{{marker.name}}", autoOpen: false, + height: "auto", width: "auto", + open: function(event,ui) { + $('.tabs').tabs({ + select: function(event, ui) { + //pause all medias + $('video').each(function(index){$(this).pause()}); + $('audio').each(function(index){$(this).pause()}); + //start current tabvideo + $('ui.panel video').each(function(index){ + //prevents a Flash-Bug in IE with newest Flash-Player + $(this).reinitMedia({queue: true}) + .play() + ;}); + $('ui.panel audio').each(function(index){ + //prevents a Flash-Bug in IE with newest Flash-Player + $(this).reinitMedia({queue: true}) + .play() + ;}); + } + }); + $('div.media-player').jmeEmbedControls(); + $('.video div.media-player').bind('useractive', function(){ + $('div.media-controls', this).stop().animate({opacity: 1}); + }).bind('userinactive', function(){ + $('div.media-controls', this).stop().animate({opacity: 0}); + }); + $("#gallery-{{time_now}}").dialog("option", "height", 'auto'); + $("#gallery-{{time_now}}").dialog("option", "width", 'auto'); + $("#gallery-{{time_now}}").dialog("option", "position", + ['center', 'center']); + }, + close: function(event, ui){ //pause all medias $('video').each(function(index){$(this).pause()}); $('audio').each(function(index){$(this).pause()}); - //start current tabvideo - $('ui.panel video').each(function(index){ - //prevents a Flash-Bug in IE with newest Flash-Player - $(this).reinitMedia({queue: true}) - .play() - ;}); - $('ui.panel audio').each(function(index){ - //prevents a Flash-Bug in IE with newest Flash-Player - $(this).reinitMedia({queue: true}) - .play() - ;}); + $('.tabs').tabs('destroy'); + } }); - $('.video div.media-player').bind('useractive', function(){ - $('div.media-controls', this).stop().animate({opacity: 1}); - }).bind('userinactive', function(){ - $('div.media-controls', this).stop().animate({opacity: 0}); + $('div.media-player').jmeEmbedControls(); + $('.show_gallery_link').click(function(){ + $("#gallery-{{time_now}}").dialog('open'); + return false; }); -}); -$("#gallery-{{marker.pk}}").bind( "dialogopen", function(event, ui) { - $("#gallery-{{marker.pk}}").dialog("option", "height", 'auto'); - $("#gallery-{{marker.pk}}").dialog("option", "width", 'auto'); - $("#gallery-{{marker.pk}}").dialog("option", "position", ['center', 'center']); -}); -$("#gallery-{{marker.pk}}").bind( "dialogclose", function(event, ui) { - //pause all medias - $('video').each(function(index){$(this).pause()}); - $('audio').each(function(index){$(this).pause()}); -}); -$('#show_gallery_link').click(function(){ - $("#gallery-{{marker.pk}}").dialog('open'); - return false; -}); - -$(document).ready(function(){ $("a[rel^='prettyPhoto']").prettyPhoto({ show_title: false, social_tools: '' diff --git a/chimere/templates/chimere/feeds/rss.html b/chimere/templates/chimere/feeds/rss.html index d36e6bf..43697ae 100644 --- a/chimere/templates/chimere/feeds/rss.html +++ b/chimere/templates/chimere/feeds/rss.html @@ -19,7 +19,7 @@ <div class="fieldWrapper"> <label for="rss_category">{% trans "Type of RSS feed" %}</label> <select name='rss_category' id='rss_category' onchange='document.forms["rss_form"].submit();'> - <option value=""> ---- </option> + <option value=""> -- </option> <option value="global">{% trans "All new points of interest" %}</option> <option value="poi">{% trans "New points of interest by category" %}</option> <option value="area">{% trans "New points of interest by area" %}</option> @@ -32,6 +32,7 @@ <div class="fieldWrapper"> <label for="id_subcategory">{% trans "Choose a category" %}</label> <select name='subcategory' id='subcategory' onchange='document.forms["rss_form"].submit();'> + <option value=""> -- </option> {% for cat_subcat in sub_categories %} <option value ="cat_{{cat_subcat.0.id}}"> ---- {{cat_subcat.0.name}} ---- {% for sub_category in cat_subcat.1 %} diff --git a/chimere/templates/chimere/feeds/rss_descr.html b/chimere/templates/chimere/feeds/rss_descr.html index b157c56..3d0c029 100644 --- a/chimere/templates/chimere/feeds/rss_descr.html +++ b/chimere/templates/chimere/feeds/rss_descr.html @@ -1,6 +1,6 @@ {% load i18n %} {% load sanitize %} -<div id='detail_content'> +<div class='detail_content'> {% for picture in obj.pictures.all %}<a href='{{picture.picture.url}}'><img src='{{picture.thumbnailfile.url}}' alt="{{picture.name}}"/></a>{% endfor %} <ul> {% if obj.description %}<li class='description'><strong>{% trans "Description:" %}</strong> {{ obj.description|sanitize:"p b i br hr strong em img:src:alt span:style a:href:target ul li ol h1 h2 h3 h4"|safe }}</li>{% endif %} diff --git a/chimere/templates/chimere/main_map.html b/chimere/templates/chimere/main_map.html index 3d68f11..a598f02 100644 --- a/chimere/templates/chimere/main_map.html +++ b/chimere/templates/chimere/main_map.html @@ -10,7 +10,7 @@ {% block message_edit %}{% endblock %} {% block sidebar %} <div id='panel' class='draggable ui-widget ui-corner-all'> - <h2 class='ui-widget ui-state-default ui-corner-all ui-widget-header'>{% trans "Category"%}</h2> + <h2 class='ui-widget ui-state-default ui-corner-all ui-widget-header'>{% trans "Categories"%}</h2> <form method='post' name='frm_categories' id='frm_categories'> <div id='categories'> {# Categories are displayed in JS #} diff --git a/chimere/templates/chimere/main_map_simple.html b/chimere/templates/chimere/main_map_simple.html index 621992f..4a1b603 100644 --- a/chimere/templates/chimere/main_map_simple.html +++ b/chimere/templates/chimere/main_map_simple.html @@ -7,7 +7,7 @@ {% block sidebar %} <div id='panel'> <a href='#' onclick='showHide("categories")'> - <h2>{% trans "Topics"%}</h2> + <h2>{% trans "Categories"%}</h2> </a> <form method='post' name='frm_categories' id='frm_categories'> <div id='categories' name='categories'></div> diff --git a/chimere/templatetags/chimere_tags.py b/chimere/templatetags/chimere_tags.py index fcf52e8..a1df004 100644 --- a/chimere/templatetags/chimere_tags.py +++ b/chimere/templatetags/chimere_tags.py @@ -51,8 +51,11 @@ def get_news(area=None): today = date.today() after = today + timedelta(settings.CHIMERE_DAYS_BEFORE_EVENT) q = Q(end_date__gte=today) | Q(end_date__isnull=True) - news += list(Marker.objects.filter(status='A', - start_date__lte=after, is_front_page=True).filter(q)) + q = Marker.objects.filter(status='A', start_date__lte=after, + is_front_page=True).filter(q) + if area: + q = q.filter(area.getIncludeMarker()) + news += list(q) news.sort(key=lambda x:x.date, reverse=True) return news @@ -90,7 +93,7 @@ def display_news(context, title=''): context_data['welcome_message'] = area.welcome_message except ObjectDoesNotExist: pass - context_data['news_lst'] =get_news(area) + context_data['news_lst'] = get_news(area) return context_data @register.inclusion_tag('chimere/blocks/head_jquery.html', takes_context=True) diff --git a/chimere/tests.py b/chimere/tests.py index ddd59b1..c372202 100644 --- a/chimere/tests.py +++ b/chimere/tests.py @@ -9,17 +9,25 @@ test_dir_path = os.path.dirname(test_path) + os.sep from django.conf import settings from django.core.urlresolvers import reverse +from django.template import Context from django.test import TestCase from chimere.models import Area, Icon, Importer, Category, SubCategory, Marker,\ - Route + Route, News +from chimere.forms import MarkerForm +from chimere.templatetags.chimere_tags import display_news from chimere.utils import ShapefileManager -def area_setup(): - area_1 = Area.objects.create(name='area 1', order=1, available=True, +def areas_setup(): + area_1 = Area.objects.create(name='area 1', urn='area-1', order=1, + available=True, upper_left_corner='SRID=4326;POINT(-4.907753 48.507656)', lower_right_corner='SRID=4326;POINT(-4.049447 48.279688)') - return area_1 + area_2 = Area.objects.create(name='area 2', urn='area-2', order=2, + available=True, + upper_left_corner='SRID=4326;POINT(-3 47.5)', + lower_right_corner='SRID=4326;POINT(-2.5 47)') + return [area_1] def subcategory_setup(): category = Category.objects.create(name='Main category', @@ -59,12 +67,15 @@ def marker_setup(sub_categories=[]): markers.append(marker_1) marker_2 = Marker.objects.create(name="Marker 2", status='A', point='SRID=4326;POINT(-3.5 48.4)', - available_date=current_date) + available_date=current_date, + start_date=current_date) marker_2.categories.add(sub_categories[1]) markers.append(marker_2) marker_3 = Marker.objects.create(name="Marker 3", status='A', point='SRID=4326;POINT(-4.5 48.45)', - available_date=current_date - datetime.timedelta(days=60)) + available_date=current_date - datetime.timedelta(days=60), + start_date=current_date - datetime.timedelta(days=60), + end_date=current_date - datetime.timedelta(days=30)) marker_3.categories.add(sub_categories[1]) markers.append(marker_3) return markers @@ -163,7 +174,7 @@ class GeoRSSImporterTest(TestCase, ImporterTest): class FeedsTest(TestCase): def setUp(self): - self.area = area_setup() + self.areas = areas_setup() self.markers = marker_setup() def test_rss(self): @@ -173,4 +184,47 @@ class FeedsTest(TestCase): self.assertEqual(200, response.status_code) doc = lxml.etree.fromstring(response.content) self.assertEqual(int(doc.xpath('count(//item)')), len(self.markers)) + url = reverse('chimere:feeds-areaid', args=('', self.areas[0].pk)) + response = self.client.get(url) + self.assertEqual(200, response.status_code) + doc = lxml.etree.fromstring(response.content) + self.assertEqual(int(doc.xpath('count(//item)')), 2) +class MarkerFormTest(TestCase): + def setUp(self): + self.subcategories = subcategory_setup() + + def test_marker_creation(self): + current_date = datetime.datetime.now() + # end_date before start_date + data = {'name':"Marker 1", 'status':'A', 'available_date':current_date, + 'point':'SRID=4326;POINT(-4.5 48.4)', 'start_date':current_date, + 'end_date':current_date - datetime.timedelta(1), + 'categories':[self.subcategories[0].pk]} + form = MarkerForm(data) + self.assertEqual(form.is_valid(), False) + +class DynamicCategoryTest(TestCase): + def setUp(self): + self.areas = areas_setup() + self.markers = marker_setup() + + def test_dynamic_evaluation(self): + cats = self.areas[0].getCategories(status='A', filter_available=True) + self.assertEqual(len(cats), 1) + +class NewsTest(TestCase): + def setUp(self): + self.areas = areas_setup() + self.markers = marker_setup() + self.news = [] + self.news.append(News.objects.create(title=u"Test news 1", + available=True)) + self.news.append(News.objects.create(title=u"Test news 2", + available=False)) + + def test_news_display(self): + context = display_news(Context({})) + self.assertEqual(len(context['news_lst']), 2) + context = display_news(Context({'area_name':'area-2'})) + self.assertEqual(len(context['news_lst']), 1) diff --git a/chimere/views.py b/chimere/views.py index 835848a..edd0ac4 100644 --- a/chimere/views.py +++ b/chimere/views.py @@ -528,6 +528,8 @@ def getDetail(request, area_name, marker_id): net_dct["body"] = _(settings.CHIMERE_MODIF_EMAIL) response_dct['modif_by_email'] = 'mailto:?to=%(to)s&subject='\ '%(text)s&body=%(body)s%(url)s' % net_dct + # to be sure there is unique IDs during a browsing + response_dct['time_now'] = datetime.datetime.now().strftime('%H%M%S') response_dct['dated'] = settings.CHIMERE_DAYS_BEFORE_EVENT \ and marker.start_date return render_to_response('chimere/detail.html', response_dct, diff --git a/docs/install.rst b/docs/install.rst index 9af5558..10c333e 100644 --- a/docs/install.rst +++ b/docs/install.rst @@ -272,3 +272,11 @@ To activate the website reload apache:: a2ensite chimere /etc/init.d/apache2 reload +If you encounter problem with the upload of files with Unicode chars in their +names activate the appropriate locale in Apache. On a Debian server with UTF-8 +as default encoding in the file */etc/apache2/envvars* uncomment the following +line:: + + . /etc/default/locale + + |
