diff options
| author | etienne <etienne@9215b0d5-fb2c-4bbd-8d3e-bd2e9090e864> | 2009-01-23 22:34:35 +0000 |
|---|---|---|
| committer | etienne <etienne@9215b0d5-fb2c-4bbd-8d3e-bd2e9090e864> | 2009-01-23 22:34:35 +0000 |
| commit | ccea45fa5494a2a89b99e0a222c16ee897884b09 (patch) | |
| tree | 5bb7708cec5051ee370989c1b053a6d58459b95f /main | |
| parent | a8bdd41fd72ec1bfd4d1632274f0bc30e57fb00c (diff) | |
| download | Chimère-ccea45fa5494a2a89b99e0a222c16ee897884b09.tar.bz2 Chimère-ccea45fa5494a2a89b99e0a222c16ee897884b09.zip | |
Modification of hard link to manage then in settings. Correction of false submission of route.
git-svn-id: http://www.peacefrogs.net/svn/chimere/trunk@26 9215b0d5-fb2c-4bbd-8d3e-bd2e9090e864
Diffstat (limited to 'main')
| -rw-r--r-- | main/actions.py | 4 | ||||
| -rw-r--r-- | main/views.py | 15 | ||||
| -rw-r--r-- | main/widgets.py | 12 |
3 files changed, 18 insertions, 13 deletions
diff --git a/main/actions.py b/main/actions.py index 89ba987..46f8928 100644 --- a/main/actions.py +++ b/main/actions.py @@ -23,11 +23,11 @@ Actions available in the main interface from django.utils.translation import ugettext_lazy as _ from django.contrib.auth import models -main_path = 'chimere/' +from settings import EXTRA_URL class Action: def __init__(self, id, path, label): - self.id, self.path, self.label = id, main_path + path, label + self.id, self.path, self.label = id, EXTRA_URL + path, label actions = [Action('view', '', _('View')), Action('edit', 'edit', _('Add a new point of interest')), diff --git a/main/views.py b/main/views.py index d88e67a..723e565 100644 --- a/main/views.py +++ b/main/views.py @@ -42,16 +42,10 @@ def index(request): Main page """ subcategories = SubCategory.getAvailable() - # by default all subcategories are checked for cat, sub_cats in subcategories: - all_checked = True for sub_category in sub_cats: if sub_category.id in settings.DEFAULT_CATEGORIES: sub_category.selected = True - elif all_checked: - all_checked = False - if all_checked: - cat.selected = True extra = "" tab = " "*4 for url in URL_OSM_CSS: @@ -59,7 +53,7 @@ def index(request): for url in URL_OSM_JS + ["%sbase.js" % settings.MEDIA_URL, "%smain_map.js" % settings.MEDIA_URL,]: extra += tab + '<script src="%s"></script>\n' % url - extra += tab + '<script src="/chimere/jsi18n/"></script>\n' + extra += tab + '<script src="/' + settings.EXTRA_URL + 'jsi18n/"></script>\n' # show the welcome page today = datetime.date.today().strftime('%y-%m-%d') display_welcome = None @@ -72,6 +66,7 @@ def index(request): 'sub_categories':subcategories, 'extra_head':extra + getMapJS(), 'media_path':settings.MEDIA_URL, + 'extra_url':settings.EXTRA_URL, 'welcome':welcome(request, display_welcome), 'areas':Area.getAvailable() } @@ -104,7 +99,7 @@ def edit(request): marker.status = 'S' marker.save() notifyStaff(marker) - return HttpResponseRedirect('/chimere/submited/edit') + return HttpResponseRedirect('/' + settings.EXTRA_URL +'submited/edit') else: # An unbound form form = MarkerForm() @@ -113,6 +108,7 @@ def edit(request): response_dct = {'actions':actions, 'action_selected':'edit', 'error_message':'', 'media_path':settings.MEDIA_URL, + 'extra_url':settings.EXTRA_URL, 'form':form, 'extra_head':form.media, 'sub_categories':SubCategory.getAvailable(['M', 'B']), @@ -138,7 +134,7 @@ def editRoute(request): route.status = 'S' route.save() notifyStaff(route) - return HttpResponseRedirect('/chimere/submited/edit_route') + return HttpResponseRedirect('/' + settings.EXTRA_URL + 'submited/edit_route') else: # An unbound form form = RouteForm() @@ -149,6 +145,7 @@ def editRoute(request): 'media_path':settings.MEDIA_URL, 'form':form, 'extra_head':form.media, + 'extra_url':settings.EXTRA_URL, 'sub_categories':SubCategory.getAvailable(['R', 'B']), 'route_widget':RouteChooserWidget().render('route', None), 'properties':declared_fields diff --git a/main/widgets.py b/main/widgets.py index 8e6bd19..4bf95fc 100644 --- a/main/widgets.py +++ b/main/widgets.py @@ -24,6 +24,7 @@ Extra widgets and fields from django import forms from django.utils.safestring import mark_safe from django.utils.translation import ugettext as _ +from django.contrib.gis.geos import fromstr from chimere import settings from django.contrib.gis.db import models @@ -180,9 +181,16 @@ onclick='toggleDrawOff();'>%s</div> tpl += """<script type='text/javascript'><!-- init();""" if value: - tpl += """ + val = value + if type(value) == unicode: + try: + val = fromstr(value) + except: + pass + if hasattr(val, 'json'): + tpl += """ var geometry='%s'; -initFeature(geometry);""" % value.json +initFeature(geometry);""" % val.json tpl += """ // --></script> """ |
