summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoretienne <etienne@9215b0d5-fb2c-4bbd-8d3e-bd2e9090e864>2009-01-16 11:30:31 +0000
committeretienne <etienne@9215b0d5-fb2c-4bbd-8d3e-bd2e9090e864>2009-01-16 11:30:31 +0000
commit87da1eec81aa180943a5ee959a7c16951c39b624 (patch)
treefd07f110627453db14ab7c8776e73494a8aad941
parent386c30ef568e7e5cfdc31654c83fc972c9094c15 (diff)
downloadChimère-87da1eec81aa180943a5ee959a7c16951c39b624.tar.bz2
Chimère-87da1eec81aa180943a5ee959a7c16951c39b624.zip
Add a permalink - CSS improvment - French translation
git-svn-id: http://www.peacefrogs.net/svn/chimere/trunk@16 9215b0d5-fb2c-4bbd-8d3e-bd2e9090e864
-rw-r--r--locale/fr/LC_MESSAGES/django.po196
-rw-r--r--main/views.py26
-rw-r--r--main/widgets.py5
-rw-r--r--static/base.js5
-rw-r--r--static/main_map.js91
-rw-r--r--static/styles.css34
-rw-r--r--templates/base.html2
-rw-r--r--templates/main_map.html9
8 files changed, 300 insertions, 68 deletions
diff --git a/locale/fr/LC_MESSAGES/django.po b/locale/fr/LC_MESSAGES/django.po
index dbceb0f..514ca13 100644
--- a/locale/fr/LC_MESSAGES/django.po
+++ b/locale/fr/LC_MESSAGES/django.po
@@ -3,12 +3,11 @@
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
-#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2008-11-24 19:22+0100\n"
+"POT-Creation-Date: 2009-01-16 12:14+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -16,121 +15,211 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-#: main/actions.py:15
+#: main/actions.py:32
msgid "View"
msgstr "Voir"
-#: main/actions.py:15
-msgid "Add"
-msgstr "Ajouter"
+#: main/actions.py:33
+msgid "Add a new point of interest"
+msgstr "Ajout d'un point remarquable"
-#: main/models.py:18 main/models.py:31 main/models.py:43 main/models.py:55
-#: main/models.py:82 main/models.py:152
+#: main/actions.py:34 templates/edit_route.html:9
+msgid "Add a new route"
+msgstr "Ajout d'un nouveau trajet"
+
+#: main/models.py:36 main/models.py:49 main/models.py:61 main/models.py:73
+#: main/models.py:111 main/models.py:179 main/models.py:247
msgid "Name"
msgstr "Nom"
-#: main/models.py:19 main/models.py:32 main/models.py:56 main/models.py:88
-#: main/models.py:154
+#: main/models.py:37 main/models.py:50 main/models.py:74 main/models.py:117
+#: main/models.py:185 main/models.py:249
msgid "Available"
msgstr "Disponible"
-#: main/models.py:20
+#: main/models.py:38
msgid "Date"
msgstr "Date"
-#: main/models.py:26
+#: main/models.py:44
msgid "News"
msgstr "Nouvelle"
-#: main/models.py:33 main/models.py:58 main/models.py:153
+#: main/models.py:51 main/models.py:77 main/models.py:248
msgid "Order"
msgstr "Ordre"
-#: main/models.py:38 main/models.py:54 templates/edit.html:18
+#: main/models.py:56 main/models.py:72 templates/edit.html:18
+#: templates/edit_route.html:18
msgid "Category"
msgstr "Catégorie"
-#: main/models.py:44 main/models.py:85 templates/edit.html:37
+#: main/models.py:62 main/models.py:114 main/models.py:182
+#: templates/edit.html:37 templates/edit_route.html:38
msgid "Image"
msgstr "Image"
-#: main/models.py:49 main/models.py:57
+#: main/models.py:67 main/models.py:75
msgid "Icon"
msgstr "Icone"
-#: main/models.py:63 main/models.py:83
+#: main/models.py:78
+msgid "Marker"
+msgstr "Point d'intérêt"
+
+#: main/models.py:79 main/models.py:181 main/models.py:198
+#: templates/edit_route.html:32
+msgid "Route"
+msgstr "Trajet"
+
+#: main/models.py:80
+msgid "Both"
+msgstr "Mixte"
+
+#: main/models.py:81
+msgid "Item type"
+msgstr "Type d'élément"
+
+#: main/models.py:86 main/models.py:112 main/models.py:180
msgid "Subcategory"
msgstr "Sous-catégorie"
-#: main/models.py:84
+#: main/models.py:113
msgid "Localisation"
msgstr "Localisation"
-#: main/models.py:87
+#: main/models.py:116 main/models.py:184
msgid "Submited"
msgstr "Soumis"
-#: main/models.py:89
+#: main/models.py:118 main/models.py:186
msgid "Disabled"
msgstr "Désactivé"
-#: main/models.py:93
+#: main/models.py:122 main/models.py:190
msgid "Status"
msgstr "État"
-#: main/models.py:101 main/models.py:176
+#: main/models.py:130 main/models.py:271
msgid "Point of interest"
msgstr "Point d'intérêt"
-#: main/models.py:155
+#: main/models.py:250
msgid "Text"
msgstr "Texte"
-#: main/models.py:156
+#: main/models.py:251
msgid "Long text"
msgstr "Texte long"
-#: main/models.py:157
+#: main/models.py:252
msgid "Password"
msgstr "Mot de passe"
-#: main/models.py:161
+#: main/models.py:256
msgid "Type"
msgstr "Type"
-#: main/models.py:166 main/models.py:178
+#: main/models.py:261 main/models.py:273
msgid "Property model"
msgstr "Modèle de propriété"
-#: main/models.py:179
+#: main/models.py:274
msgid "Value"
msgstr "Valeur"
-#: main/models.py:183
+#: main/models.py:278
msgid "Property"
msgstr "Propriété"
-#: main/widgets.py:76
+#: main/widgets.py:93
msgid "Latitude"
msgstr "Latitude"
-#: main/widgets.py:76
+#: main/widgets.py:93
msgid "Longitude"
msgstr "Longitude"
-#: templates/base.html:29 templates/main_map.html:23
+#: main/widgets.py:139
+msgid "Creation mode"
+msgstr "Mode création"
+
+#: main/widgets.py:140
+msgid ""
+"To start drawing the route click on the toggle button : \"Start drawing\"."
+msgstr "Pour commencer le dession cliquez sur le bouton : « Commencer le tracé » "
+
+#: main/widgets.py:141
+msgid "Then click on the map to begin the drawing."
+msgstr "Puis cliquez sur la carte pour commencer le dessin."
+
+#: main/widgets.py:142
+msgid "You can add points by clicking again."
+msgstr "Vous pouvez ajouter des points en cliquant de nouveau."
+
+#: main/widgets.py:143
+msgid ""
+"To finish the drawing double click. When the drawing is finished you can "
+"edit it."
+msgstr ""
+"Pour finir le tracé double-cliquez. Quand le tracé est fini vous "
+"pouvez toujours l'éditer."
+
+#: main/widgets.py:145
+msgid ""
+"While creating to undo a drawing click again on the toggle button \"Stop "
+"drawing\"."
+msgstr ""
+"En mode création vous pouvez annuler un tracé en appuyant sur le bouton "
+"« Arrêter le tracé »"
+
+#: main/widgets.py:150
+msgid "Modification mode"
+msgstr "Mode modification"
+
+#: main/widgets.py:151
+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"
+
+#: main/widgets.py:152
+msgid ""
+"To delete a point move the mouse cursor over it and press the \"d\" key."
+msgstr ""
+"Pour supprimer un point, mettez le curseur de la souris sur celui-ci et "
+"appuyez sur le touche « d »"
+
+#: main/widgets.py:153
+msgid ""
+"To add a point click in the middle of a segment and drag the new point to "
+"the desired position"
+msgstr ""
+"Pour ajouter un nouveau point, cliquez au milieu d'un des segments, "
+"maintenez le bouton appuyé et déplacez le nouveau point à la position "
+"désirée."
+
+#: main/widgets.py:162
+msgid "Start drawing"
+msgstr "Commencer le tracé"
+
+#: main/widgets.py:162
+msgid "Stop drawing"
+msgstr "Arrêter le tracé"
+
+#: templates/base.html:27 templates/main_map.html:42
msgid "This site uses Chimère"
msgstr "Ce site utilise Chimère"
-#: templates/edit.html:9 templates/submited.html:5
+#: templates/edit.html:9
msgid "Add a new site"
msgstr "Ajouter un nouveau site"
-#: templates/edit.html:10
+#: templates/edit.html:10 templates/edit_route.html:10
msgid "indicates a mandatory field"
msgstr "indique un champ obligatoire"
-#: templates/edit.html:13
+#: templates/edit.html:13 templates/edit_route.html:13
msgid "Site name"
msgstr "Nom du site"
@@ -138,19 +227,37 @@ msgstr "Nom du site"
msgid "Point"
msgstr "Point"
-#: templates/edit.html:33
+#: templates/edit.html:33 templates/edit_route.html:33
msgid "Select a location for this new site"
msgstr "Choisissez une localisation pour ce nouveau site"
-#: templates/edit.html:48
+#: templates/edit.html:48 templates/edit_route.html:49
msgid "Propose"
msgstr "Proposez"
-#: templates/main_map.html:23
+#: templates/main_map.html:14 templates/main_map.html.py:19
+msgid "Zoom to"
+msgstr "Zoomer sur"
+
+#: templates/main_map.html:22
+msgid "Display markers and routes waiting for validation"
+msgstr ""
+"Afficher les points remarquables et les trajets en attente de "
+"validation"
+
+#: templates/main_map.html:32
+msgid "Permalink"
+msgstr "Lien permanent"
+
+#: templates/main_map.html:42
msgid "Welcome message"
msgstr "Message d'accueil"
-#: templates/submited.html:6
+#: templates/main_map.html:42
+msgid "Map"
+msgstr "Carte"
+
+#: templates/submited.html:5
msgid ""
"Your proposition has been submited. A moderator will treat your submission "
"shortly. Thanks!"
@@ -167,12 +274,13 @@ msgid ""
"This is the default message. You can overload it by modifying the file "
"welcome.html in the template directory of Chimère. Below this message all "
"news message will be displayed. You can add them in administration pages."
-msgstr ""
-"Ceci est le message par défaut. Vous pouvez le surcharger en modifiant "
-"le fichier welcome.html dans le dossier de patrons de Chimère. En dessous "
-"de ce message toutes les nouvelles vont être affichées. Vous pouvez les "
-"ajouter dans les pages d'administration."
+msgstr ""
+"Ceci est le message par défaut. Vous pouvez le surcharger en modifiant le "
+"fichier welcome.html dans le dossier de patrons de Chimère. En dessous de ce "
+"message toutes les nouvelles vont être affichées. Vous pouvez les ajouter "
+"dans les pages d'administration."
#: templates/welcome.html:15
msgid "Close"
msgstr "Fermer"
+
diff --git a/main/views.py b/main/views.py
index 04b6919..4fd14f3 100644
--- a/main/views.py
+++ b/main/views.py
@@ -32,7 +32,7 @@ from chimere import settings
from chimere.main.actions import actions
from chimere.main.models import SubCategory, PropertyModel, Marker, Route, News
from chimere.main.widgets import getMapJS, PointChooserWidget, \
- RouteChooserWidget, URL_OSM_JS
+ RouteChooserWidget, URL_OSM_JS, URL_OSM_CSS
from chimere.main.forms import MarkerForm, RouteForm
def index(request):
@@ -50,11 +50,14 @@ def index(request):
all_checked = False
if all_checked:
cat.selected = True
- extra_js = ""
+ extra = ""
+ tab = " "*4
+ for url in URL_OSM_CSS:
+ extra += tab + '<link rel="stylesheet" href="%s" />' % url
for url in URL_OSM_JS + ["%sbase.js" % settings.MEDIA_URL,
"%smain_map.js" % settings.MEDIA_URL,]:
- extra_js += '<script src="%s"></script>\n' % url
- extra_js += '<script src="/chimere/jsi18n/"></script>\n'
+ extra += tab + '<script src="%s"></script>\n' % url
+ extra += tab + '<script src="/chimere/jsi18n/"></script>\n'
# show the welcome page
today = datetime.date.today().strftime('%y-%m-%d')
display_welcome = None
@@ -65,10 +68,23 @@ def index(request):
response_dct = {'actions':actions, 'action_selected':'view',
'error_message':'',
'sub_categories':subcategories,
- 'extra_head':extra_js + getMapJS(),
+ 'extra_head':extra + getMapJS(),
'media_path':settings.MEDIA_URL,
'welcome':welcome(request, display_welcome),
}
+ # manage permalink
+ if request.GET:
+ for key in ('zoom', 'lon', 'lat', 'display_submited'):
+ if key in request.GET and request.GET[key]:
+ response_dct['p_'+key] = request.GET[key]
+ else:
+ response_dct['p_'+key] = '""'
+ if 'checked_categories' in request.GET \
+ and request.GET['checked_categories']:
+ cats = request.GET['checked_categories'].split('_')
+ response_dct['p_checked_categories'] = ",".join(cats)
+ else:
+ response_dct['p_checked_categories'] = '';
return render_to_response('main_map.html', response_dct)
def edit(request):
diff --git a/main/widgets.py b/main/widgets.py
index c0aa2f4..a247edc 100644
--- a/main/widgets.py
+++ b/main/widgets.py
@@ -28,6 +28,7 @@ from django.utils.translation import ugettext as _
from chimere import settings
from django.contrib.gis.db import models
+URL_OSM_CSS = ["http://www.openlayers.org/api/theme/default/style.css"]
URL_OSM_JS = ["http://www.openlayers.org/api/OpenLayers.js",
"http://www.openstreetmap.org/openlayers/OpenStreetMap.js"]
@@ -54,7 +55,7 @@ class PointChooserWidget(forms.TextInput):
"""
class Media:
css = {
- "all": ("%sforms.css" % settings.MEDIA_URL,)
+ "all": URL_OSM_CSS + ["%sforms.css" % settings.MEDIA_URL,]
}
js = URL_OSM_JS + ["%sedit_map.js" % settings.MEDIA_URL,
"%sbase.js" % settings.MEDIA_URL,]
@@ -118,7 +119,7 @@ class RouteChooserWidget(forms.TextInput):
"""
class Media:
css = {
- "all": ("%sforms.css" % settings.MEDIA_URL,)
+ "all": URL_OSM_CSS + ["%sforms.css" % settings.MEDIA_URL,]
}
js = ["%sedit_route_map.js" % settings.MEDIA_URL,
"%sbase.js" % settings.MEDIA_URL,] + URL_OSM_JS
diff --git a/static/base.js b/static/base.js
index f880b61..3c7c575 100644
--- a/static/base.js
+++ b/static/base.js
@@ -40,7 +40,10 @@ function getExtent() {
var map_extent;
for (i in cookies){
var items = cookies[i].split('=');
- if (items[0] == 'MAP_EXTENT') map_extent = items[1].split('_');
+ key = items[0].split(' ').join('');
+ if (key == 'MAP_EXTENT'){
+ map_extent = items[1].split('_');
+ }
}
return map_extent;
}
diff --git a/static/main_map.js b/static/main_map.js
index bd149a1..62a9f0d 100644
--- a/static/main_map.js
+++ b/static/main_map.js
@@ -31,6 +31,7 @@ function checkAll(item, ids){
}
var map;
+var permalink;
/* availaible map layers */
var layerMapnik = new OpenLayers.Layer.OSM.Mapnik('Classic');
@@ -76,9 +77,10 @@ function updateCheckedCategories(){
display_submited = false;
for (var i = 0; i < inputs.length; i++) {
input = inputs[i];
+ // 'category_'.length : 9
if (input.checked
- && input.name.substring('category_'.length, 0) == 'category_'){
- id = input.name.substring('category_'.length, input.name.length);
+ && input.name.substring(9, 0) == 'category_'){
+ id = input.name.substring(9, input.name.length);
if(checked_categories) checked_categories += '_';
checked_categories += id;
}
@@ -86,6 +88,7 @@ function updateCheckedCategories(){
display_submited = true;
}
}
+ permalink.updateLink();
}
/* load marker and route layer from a JSON feature string */
@@ -264,6 +267,49 @@ function setDetail(response){
}
}
+/* new permalink createParams method - update when facilities are given to
+personalize the permalink */
+function createParams(center, zoom, layers) {
+ center = center || this.map.getCenter();
+ var params = OpenLayers.Util.getParameters(this.base);
+ // If there's still no center, map is not initialized yet.
+ // Break out of this function, and simply return the params from the
+ // base link.
+ if (center) {
+ //zoom
+ params.zoom = zoom || this.map.getZoom();
+ //lon,lat
+ var lat = center.lat;
+ var lon = center.lon;
+ if (this.displayProjection) {
+ var mapPosition = OpenLayers.Projection.transform(
+ { x: lon, y: lat },
+ this.map.getProjectionObject(),
+ this.displayProjection );
+ lon = mapPosition.x;
+ lat = mapPosition.y;
+ }
+ params.lat = Math.round(lat*100000)/100000;
+ params.lon = Math.round(lon*100000)/100000;
+ //layers
+ layers = layers || this.map.layers;
+ params.layers = '';
+ for (var i=0, len=layers.length; i<len; i++) {
+ var layer = layers[i];
+
+ if (layer.isBaseLayer) {
+ params.layers += (layer == this.map.baseLayer) ? "B" : "0";
+ } else {
+ params.layers += (layer.getVisibility()) ? "T" : "F";
+ }
+ }
+ /* only piece of code added */
+ params.checked_categories = checked_categories;
+ params.display_submited = display_submited;
+ }
+ return params;
+}
+
/* main initialisation function */
function init(){
/* set the main map */
@@ -273,14 +319,47 @@ function init(){
new OpenLayers.Control.ScaleLine()],
maxResolution: 156543.0399,
units: 'm',
- projection: new OpenLayers.Projection('EPSG:4326')
+ projection: new OpenLayers.Projection('EPSG:4326'),
+ theme:null
});
/*projection: new OpenLayers.Projection('EPSG:900913'),
displayProjection: new OpenLayers.Projection('EPSG:4326')*/
+ permalink = new OpenLayers.Control.Permalink("permalink");
+ permalink.createParams = createParams;
+ map.addControl(permalink);
+ // update with the translated permalink label
+ if(permalink_label && permalink.div && permalink.div.childNodes.length > 0){
+ permalink.div.childNodes[0].textContent = permalink_label;
+ }
map.addLayers([layerMapnik, cyclemap]);
- /* zoom to the appropriate extent */
- if (!zoomToCurrentExtent(map)){
- map.setCenter(centerLonLat, 12);
+ /* if from a permalink */
+ if (p_zoom) {
+ var p_centerLonLat = new OpenLayers.LonLat(p_lon, p_lat);
+ map.setCenter(p_centerLonLat, p_zoom);
+ if (p_display_submited) {
+ document.getElementById('display_submited_check').checked = true;
+ }
+ if (p_checked_categories){
+ /* ckeck selected categories and uncheck others */
+ inputs = window.document.forms["frm_categories"];
+ for (var i = 0; i < inputs.length; i++) {
+ input = inputs[i];
+ if (input.name.substring(9, 0) == 'category_'){
+ id = input.name.substring(9, input.name.length);
+ input.checked = false;
+ for (var cc=0; cc < p_checked_categories.length; cc++){
+ if (p_checked_categories[cc] == id){
+ input.checked = true;
+ }
+ }
+ }
+ }
+ }
+ }
+ /* if not zoom to the extent in cookies */
+ else if (!zoomToCurrentExtent(map)){
+ /* if no extent in cookies zoom to default */
+ map.setCenter(centerLonLat, 13);
}
loadGeoObjects();
}
diff --git a/static/styles.css b/static/styles.css
index d7880d7..3f775cb 100644
--- a/static/styles.css
+++ b/static/styles.css
@@ -183,14 +183,6 @@ left:8px;
right:8px;
}
-#permalink {
-z-index:10000;
-position:absolute;
-bottom:50px;
-left:12px;
-font-size:smaller;
-}
-
.news{
}
@@ -236,6 +228,10 @@ font-variant:normal;
color:purple;
}
+.zoom_image{
+cursor:pointer;
+}
+
.errorlist{
color:purple;
font-weight:bold;
@@ -244,3 +240,25 @@ font-weight:bold;
.fieldWrapper{
padding:6px;
}
+
+/* openlayer customisation */
+.olControlPermalink {
+display: block;
+position: absolute;
+bottom:10px;
+left:10px;
+width:150px;
+font-size:small;
+font-weight:bold;
+background-color:white;
+text-align:center;
+border:1px solid;
+}
+
+.olControlPermalink a{
+text-decoration:None;
+}
+
+.olControlScaleLine {
+bottom: 35px;
+} \ No newline at end of file
diff --git a/templates/base.html b/templates/base.html
index e089032..c76fba2 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -4,11 +4,11 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>{% block title %}Chimère{% endblock %}</title>
- <link rel="stylesheet" href="{{ media_path }}styles.css" />
<script type="text/javascript"><!--
var media_path = '{{ media_path }}';
// --></script>
{% block extra_head %}{{extra_head|safe}}{% endblock %}
+ <link rel="stylesheet" href="{{ media_path }}styles.css" />
</head>
<body>
diff --git a/templates/main_map.html b/templates/main_map.html
index d5dc43c..13d2e36 100644
--- a/templates/main_map.html
+++ b/templates/main_map.html
@@ -19,7 +19,7 @@ lst_{{category.id}}.push("{{sub_category.id}}");{% endfor %}
<img class='zoom_image' alt='{% trans "Zoom to" %} {{sub_category.name}}' src='{{media_path}}icons/zoom.png' onclick='zoomToCategory({{sub_category.id}})'/></li>{% endfor %}
</ul>
</li>{% endfor %}
- <li id='display_submited'><input type='checkbox' onclick='loadGeoObjects()' name='display_submited'/> {% trans "Display markers and routes waiting for validation"%}</li>
+ <li id='display_submited'><input type='checkbox' onclick='loadGeoObjects()' name='display_submited' id='display_submited_check'/> {% trans "Display markers and routes waiting for validation"%}</li>
</ul>
</form>
@@ -29,6 +29,13 @@ lst_{{category.id}}.push("{{sub_category.id}}");{% endfor %}
{{welcome}}{% endblock %}
{% block content %}<div id='map'></div>
<script type='text/javascript'><!--
+var permalink_label = '{%trans "Permalink"%}';
+var p_zoom;
+{%if p_zoom %}p_zoom={{p_zoom}};
+var p_lat={{p_lat}};
+var p_lon={{p_lon}};
+var p_display_submited={{p_display_submited}};
+var p_checked_categories = [{{p_checked_categories}}];{%endif%}
init();
// --> </script>{% endblock %}
{% block footer %}