summaryrefslogtreecommitdiff
path: root/main
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 /main
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
Diffstat (limited to 'main')
-rw-r--r--main/views.py26
-rw-r--r--main/widgets.py5
2 files changed, 24 insertions, 7 deletions
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