summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@peacefrogs.net>2011-09-09 17:01:17 +0200
committerÉtienne Loks <etienne.loks@peacefrogs.net>2011-09-09 17:01:17 +0200
commitd3b04460bbb5d1e7eb7ed28220ae305cce6ad6e2 (patch)
tree6c26a535ef8532b912ff892d5936c013015dabfc
parent0ccc30e337bb046000fb76d2337c2fb9792bc71f (diff)
downloadChimère-d3b04460bbb5d1e7eb7ed28220ae305cce6ad6e2.tar.bz2
Chimère-d3b04460bbb5d1e7eb7ed28220ae305cce6ad6e2.zip
Association of a GPX (or KML) file to a route (closes #302)
- template file for upload - js finalisation and debug - css - "artwork" - french translation
-rw-r--r--chimere/locale/fr/LC_MESSAGES/django.po206
-rw-r--r--chimere/main/forms.py15
-rw-r--r--chimere/main/views.py14
-rw-r--r--chimere/main/widgets.py39
-rw-r--r--chimere/static/edit_route_map.js19
-rw-r--r--chimere/static/img/upload.pngbin0 -> 8822 bytes
-rw-r--r--chimere/static/img/upload_images.licence16
-rw-r--r--chimere/static/styles.css13
-rw-r--r--chimere/templates/upload_file.html44
9 files changed, 254 insertions, 112 deletions
diff --git a/chimere/locale/fr/LC_MESSAGES/django.po b/chimere/locale/fr/LC_MESSAGES/django.po
index 36d1e93..67eb990 100644
--- a/chimere/locale/fr/LC_MESSAGES/django.po
+++ b/chimere/locale/fr/LC_MESSAGES/django.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: 0.2\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2010-11-27 18:28+0100\n"
+"POT-Creation-Date: 2011-09-09 15:34+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"
@@ -63,188 +63,212 @@ msgstr "Objet"
msgid "End date has been set with no start date"
msgstr "Une date de fin a été donnée sans date de début"
-#: main/forms.py:268 main/models.py:464
+#: main/forms.py:215 main/models.py:130 main/models.py:196 main/models.py:373
+#: templates/edit.html:39 templates/edit_route.html:39
+msgid "Image"
+msgstr "Image"
+
+#: main/forms.py:268
+msgid "Bad file format: this must be a GPX or KML file"
+msgstr "Mauvais format de fichier : KML et GPX sont supportés"
+
+#: main/forms.py:276 main/models.py:554
msgid "Area"
msgstr "Zone"
-#: main/models.py:37 main/models.py:90 main/models.py:111 main/models.py:124
-#: main/models.py:138 main/models.py:188 main/models.py:282 main/models.py:448
-#: main/models.py:490
+#: main/models.py:42 main/models.py:95 main/models.py:116 main/models.py:129
+#: main/models.py:143 main/models.py:193 main/models.py:315 main/models.py:368
+#: main/models.py:538 main/models.py:580
msgid "Name"
msgstr "Nom"
-#: main/models.py:38 main/models.py:112 main/models.py:139 main/models.py:196
-#: main/models.py:290 main/models.py:452 main/models.py:492
+#: main/models.py:43 main/models.py:117 main/models.py:144 main/models.py:201
+#: main/models.py:378 main/models.py:542 main/models.py:582
msgid "Available"
msgstr "Disponible"
-#: main/models.py:39
+#: main/models.py:44
msgid "Date"
msgstr "Date"
-#: main/models.py:45 main/models.py:46
+#: main/models.py:50 main/models.py:51
msgid "News"
msgstr "Nouvelle"
-#: main/models.py:51
+#: main/models.py:56
msgid "Parameters"
msgstr "Paramètres"
-#: main/models.py:55
+#: main/models.py:60
msgid "TinyUrl"
msgstr "Mini-url"
-#: main/models.py:94 main/models.py:101 main/models.py:142
+#: main/models.py:99 main/models.py:106 main/models.py:147
msgid "Color theme"
msgstr "Thème de couleur"
-#: main/models.py:99
+#: main/models.py:104
msgid "Code"
msgstr "Code"
-#: main/models.py:100 main/models.py:113 main/models.py:144 main/models.py:451
-#: main/models.py:491
+#: main/models.py:105 main/models.py:118 main/models.py:149 main/models.py:541
+#: main/models.py:581
msgid "Order"
msgstr "Ordre"
-#: main/models.py:106
+#: main/models.py:111
msgid "Color"
msgstr "Couleur"
-#: main/models.py:119 main/models.py:137
+#: main/models.py:124 main/models.py:142
msgid "Category"
msgstr "Catégorie"
-#: main/models.py:125 main/models.py:191 main/models.py:285
-#: templates/edit.html:39 templates/edit_route.html:39
-msgid "Image"
-msgstr "Image"
-
-#: main/models.py:127 main/models.py:193 main/models.py:287
+#: main/models.py:132 main/models.py:198 main/models.py:375
msgid "Height"
msgstr "Hauteur"
-#: main/models.py:128 main/models.py:194 main/models.py:288
+#: main/models.py:133 main/models.py:199 main/models.py:376
msgid "Width"
msgstr "Largeur"
-#: main/models.py:132 main/models.py:141
+#: main/models.py:137 main/models.py:146
msgid "Icon"
msgstr "Icône"
-#: main/models.py:145
+#: main/models.py:150
msgid "Marker"
msgstr "Point d'intérêt"
-#: main/models.py:146 main/models.py:284 main/models.py:310
+#: main/models.py:151 main/models.py:370 main/models.py:398
#: templates/edit_route.html:33
msgid "Route"
msgstr "Trajet"
-#: main/models.py:147
+#: main/models.py:152
msgid "Both"
msgstr "Mixte"
-#: main/models.py:148
+#: main/models.py:153
msgid "Item type"
msgstr "Type d'élément"
-#: main/models.py:153
+#: main/models.py:158
msgid "Subcategory"
msgstr "Sous-catégorie"
-#: main/models.py:190
+#: main/models.py:195
msgid "Localisation"
msgstr "Localisation"
-#: main/models.py:195 main/models.py:289
+#: main/models.py:200 main/models.py:377
msgid "Submited"
msgstr "Soumis"
-#: main/models.py:197 main/models.py:291
+#: main/models.py:202 main/models.py:379
msgid "Disabled"
msgstr "Désactivé"
-#: main/models.py:201 main/models.py:302
+#: main/models.py:206 main/models.py:390
msgid "Status"
msgstr "État"
-#: main/models.py:203 main/models.py:296 templates/edit.html:45
+#: main/models.py:208 main/models.py:384 templates/edit.html:45
#: templates/edit_route.html:45
msgid "Start date"
msgstr "Date de début"
-#: main/models.py:204 main/models.py:297
+#: main/models.py:209 main/models.py:385
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"
-#: main/models.py:206 main/models.py:299 templates/edit.html:51
+#: main/models.py:211 main/models.py:387 templates/edit.html:51
#: templates/edit_route.html:51
msgid "End date"
msgstr "Date de fin"
-#: main/models.py:207 main/models.py:300
+#: main/models.py:212 main/models.py:388
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"
-#: main/models.py:210
+#: main/models.py:215
msgid "Available Date"
msgstr "Date de mise en disponibilité"
-#: main/models.py:224 main/models.py:514
+#: main/models.py:230 main/models.py:604
msgid "Point of interest"
msgstr "Point d'intérêt"
-#: main/models.py:449
+#: main/models.py:316
+msgid "Raw file (gpx or kml)"
+msgstr "Fichier brut (gpx ou kml)"
+
+#: main/models.py:317
+msgid "Simplified file"
+msgstr "Fichier simplifié"
+
+#: main/models.py:319
+msgid "KML"
+msgstr "KML"
+
+#: main/models.py:319
+msgid "GPX"
+msgstr "GPX"
+
+#: main/models.py:372
+msgid "Associated file"
+msgstr "Fichier associé"
+
+#: main/models.py:539
msgid "Area urn"
msgstr "Urn de la zone"
-#: main/models.py:453
+#: main/models.py:543
msgid "Upper left corner"
msgstr "Coin en haut à gauche"
-#: main/models.py:455
+#: main/models.py:545
msgid "Lower right corner"
msgstr "Coin en bas à droite"
-#: main/models.py:493
+#: main/models.py:583
msgid "Text"
msgstr "Texte"
-#: main/models.py:494
+#: main/models.py:584
msgid "Long text"
msgstr "Texte long"
-#: main/models.py:495
+#: main/models.py:585
msgid "Password"
msgstr "Mot de passe"
-#: main/models.py:499
+#: main/models.py:589
msgid "Type"
msgstr "Type"
-#: main/models.py:504 main/models.py:516
+#: main/models.py:594 main/models.py:606
msgid "Property model"
msgstr "Modèle de propriété"
-#: main/models.py:517
+#: main/models.py:607
msgid "Value"
msgstr "Valeur"
-#: main/models.py:521
+#: main/models.py:611
msgid "Property"
msgstr "Propriété"
-#: main/views.py:226
+#: main/views.py:275
msgid "Comments/request on the map"
msgstr "Commentaires/requètes sur la carte"
-#: main/views.py:229
+#: main/views.py:278
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."
@@ -253,11 +277,11 @@ msgstr ""
"laissé votre courriel vous serez peut-être contacté bientôt pour plus de "
"détails."
-#: main/views.py:233
+#: main/views.py:282
msgid "Temporary error. Renew your message later."
msgstr "Erreur temporaire. Réenvoyez votre message plus tard."
-#: main/views.py:342
+#: main/views.py:391
msgid "No category available in this area."
msgstr "Pas de catégorie disponible sur cette zone."
@@ -319,12 +343,13 @@ msgstr ""
#: main/widgets.py:175
msgid ""
-"To delete a point move the mouse cursor over it and press the \"d\" key."
+"To delete a point move the mouse cursor over it and press the \"d\" or \"Del"
+"\" key."
msgstr ""
"Pour supprimer un point, mettez le curseur de la souris sur celui-ci et "
-"appuyez sur le touche « d »"
+"appuyez sur le touche « d » ou « Suppr »"
-#: main/widgets.py:176
+#: main/widgets.py:177
msgid ""
"To add a point click in the middle of a segment and drag the new point to "
"the desired position"
@@ -333,27 +358,36 @@ msgstr ""
"maintenez le bouton appuyé et déplacez le nouveau point à la position "
"désirée."
-#: main/widgets.py:185
+#: main/widgets.py:186
+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."
+
+#: main/widgets.py:189
+msgid "Upload a route file (GPX or KML)"
+msgstr "Déposer un trajet (fichier GPX ou KML)"
+
+#: main/widgets.py:195
msgid "Start drawing"
msgstr "Commencer le tracé"
-#: main/widgets.py:185
+#: main/widgets.py:195
msgid "Stop drawing"
msgstr "Arrêter le tracé"
-#: main/widgets.py:323
+#: main/widgets.py:335
msgid "Select..."
msgstr "Sélectionner..."
-#: rss/feeds.py:126 rss/feeds.py:215
+#: rss/feeds.py:128 rss/feeds.py:217
msgid "Last points of interest"
msgstr "Derniers points d'intérêt"
-#: rss/feeds.py:132
+#: rss/feeds.py:134
msgid "Latest points of interest from "
msgstr "Nouveaux points d'intérêt de "
-#: rss/feeds.py:178
+#: rss/feeds.py:180
msgid "Last points of interest by area"
msgstr "Nouveaux points d'intérêt par zone"
@@ -397,11 +431,11 @@ msgstr "Ou sélectionner une zone en zoomant et en se déplaçant sur cette cart
msgid "Validate"
msgstr "Valider"
-#: templates/404.html:4
+#: templates/404.html:10
msgid "Page not found"
msgstr "Page non trouvée"
-#: templates/500.html:4
+#: templates/500.html:10
msgid "Internal server error"
msgstr "Erreur interne du serveur"
@@ -410,7 +444,7 @@ msgid "This site uses Chimère"
msgstr "Ce site utilise Chimère"
#: templates/categories.html:8 templates/categories.html.py:16
-#: templates/main_map.html:17
+#: templates/main_map.html:18
msgid "Zoom to"
msgstr "Zoomer sur"
@@ -438,15 +472,15 @@ msgstr ""
msgid "Submit"
msgstr "Proposer"
-#: templates/detail.html:7
+#: templates/detail.html:8
msgid "Date:"
msgstr "Date :"
-#: templates/detail.html:13
+#: templates/detail.html:15
msgid "Share on"
msgstr "Partager sur"
-#: templates/detail.html:16
+#: templates/detail.html:18
msgid "Share"
msgstr "Partager"
@@ -478,23 +512,23 @@ msgstr "Choisissez une localisation pour ce nouveau site"
msgid "Propose"
msgstr "Proposez"
-#: templates/main_map.html:6 templates/main_map_simple.html:8
+#: templates/main_map.html:7 templates/main_map_simple.html:8
msgid "Topics"
msgstr "Thèmes"
-#: templates/main_map.html:15
+#: templates/main_map.html:16
msgid "Shortcuts"
msgstr "Raccourcis"
-#: templates/main_map.html:26
+#: templates/main_map.html:27
msgid "Welcome message"
msgstr "Message d'accueil"
-#: templates/main_map.html:31
+#: templates/main_map.html:32
msgid "Permalink"
msgstr "Lien permanent"
-#: templates/main_map.html:42
+#: templates/main_map.html:43
msgid "Map"
msgstr "Carte"
@@ -506,21 +540,19 @@ msgstr ""
"Votre proposition a été soumise. Un modérateur va traiter votre proposition "
"sous peu. Merci !"
-#: templates/welcome.html:3
-msgid "Welcome to Chimère"
-msgstr "Bienvenue dans Chimère"
+#: templates/upload_file.html:20
+msgid "Upload a file"
+msgstr "Déposer un fichier"
-#: templates/welcome.html:5
-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."
+#: templates/upload_file.html:37
+msgid "Upload"
+msgstr "Déposer"
#: templates/welcome.html:17
msgid "See it on the map"
msgstr "Voir sur la carte"
+
+#: templates/admin/base_site.html:4 templates/admin/base_site.html.py:7
+msgid "Administration de Chimère"
+msgstr "Administration de Chimère"
+
diff --git a/chimere/main/forms.py b/chimere/main/forms.py
index dc1fbad..89d8a5a 100644
--- a/chimere/main/forms.py
+++ b/chimere/main/forms.py
@@ -30,7 +30,7 @@ from django.core.mail import EmailMessage, BadHeaderError
from chimere import settings
from chimere.main.models import Marker, Route, PropertyModel, Property, Area,\
- News, Category, SubCategory
+ News, Category, SubCategory, RouteFile
from chimere.main.widgets import AreaField, PointField, TextareaWidget
from datetime import timedelta, datetime, tzinfo
@@ -214,6 +214,8 @@ class RouteForm(RouteAdminForm):
"""
picture = forms.ImageField(label=_("Image"), required=False)
point = forms.CharField(label=" ", required=False, widget=forms.HiddenInput)
+ associated_file_id = forms.CharField(label=" ", required=False,
+ widget=forms.HiddenInput)
class Meta:
model = Route
exclude = ('status',)
@@ -225,9 +227,18 @@ class RouteForm(RouteAdminForm):
def save(self, *args, **keys):
"""
- Custom save method in order to manage associated marker
+ Custom save method in order to manage associated marker and file
"""
new_route = super(RouteForm, self).save(*args, **keys)
+ # associate a route file
+ if 'associated_file_id' in self.cleaned_data and \
+ self.cleaned_data['associated_file_id']:
+ #try:
+ file_pk = int(self.cleaned_data['associated_file_id'])
+ new_route.associated_file = RouteFile.objects.get(pk=file_pk)
+ new_route.save()
+ #except:
+ #pass
marker_fields = [f.attname for f in Marker._meta.fields]
marker_dct = dict([(k, self.cleaned_data[k]) for k in self.cleaned_data
if k in marker_fields])
diff --git a/chimere/main/views.py b/chimere/main/views.py
index 812fff6..98c514d 100644
--- a/chimere/main/views.py
+++ b/chimere/main/views.py
@@ -166,12 +166,12 @@ def uploadFile(request, area_name=''):
routefile.save()
response_dct = get_base_response(area_name)
response_dct['gpx_id'] = routefile.pk
- return render_to_response('uploadFile.html', response_dct)
+ return render_to_response('upload_file.html', response_dct)
else:
# An unbound form
form = FileForm()
response_dct.update({'form':form})
- return render_to_response('uploadFile.html', response_dct)
+ return render_to_response('upload_file.html', response_dct)
def processRouteFile(request, area_name='', file_id=None):
if file_id:
@@ -181,7 +181,8 @@ def processRouteFile(request, area_name='', file_id=None):
route = route_file.route
if not route:
return HttpResponse(status=500)
- return HttpResponse(simplejson.dumps({'wkt':route}),
+ return HttpResponse(simplejson.dumps({'wkt':route,
+ 'file_id':file_id}),
'application/javascript', status=200)
except:
return HttpResponse(status=500)
@@ -209,7 +210,7 @@ def editRoute(request, area_name=""):
else:
# An unbound form
form = RouteForm()
- # get the « manualy » declared_fields. Ie: properties
+ # get the "manualy" declared_fields. Ie: properties
declared_fields = form.declared_fields.keys()
response_dct = get_base_response(area_name)
response_dct.update({'actions':actions,
@@ -221,8 +222,9 @@ def editRoute(request, area_name=""):
'extra_head':form.media,
'sub_categories':SubCategory.getAvailable(['R', 'B'],
area_name),
- 'route_widget':RouteChooserWidget().render('route', None,
- area_name=area_name),
+ 'route_widget':RouteChooserWidget().render('route', '',
+ area_name=area_name,
+ routefile_id='',),
'properties':declared_fields
})
# manualy populate the custom widget
diff --git a/chimere/main/widgets.py b/chimere/main/widgets.py
index caac0ea..083fbec 100644
--- a/chimere/main/widgets.py
+++ b/chimere/main/widgets.py
@@ -147,7 +147,7 @@ class RouteChooserWidget(forms.TextInput):
js = ["%sedit_route_map.js" % settings.MEDIA_URL,
"%sbase.js" % settings.MEDIA_URL,] + URL_OSM_JS
- def render(self, name, value, attrs=None, area_name=''):
+ def render(self, name, value, attrs=None, area_name='', routefile_id=None):
'''
Render a map and latitude, longitude information field
'''
@@ -159,25 +159,35 @@ class RouteChooserWidget(forms.TextInput):
<p>%s</p>
<p>%s</p>
<p>%s</p>
-<p>%s</p>""" % (_("Creation mode"),
-_("To start drawing the route click on the toggle button : \"Start drawing\"."),
-_("Then click on the map to begin the drawing."),
-_("You can add points by clicking again."),
-_("To finish the drawing double click. When the drawing is finished you can \
+<p>%s</p>""" % (_(u"Creation mode"),
+_(u"To start drawing the route click on the toggle button : \"Start drawing\"."),
+_(u"Then click on the map to begin the drawing."),
+_(u"You can add points by clicking again."),
+_(u"To finish the drawing double click. When the drawing is finished you can \
edit it."),
-_("While creating to undo a drawing click again on the toggle button \"Stop \
+_(u"While creating to undo a drawing click again on the toggle button \"Stop \
drawing\"."))
help_modify = """<h3>%s</h3>
<p>%s</p>
<p>%s</p>
-<p>%s</p>""" % (_("Modification mode"),
-_("To move a point click on it and drag it to the desired position."),
-_("To delete a point move the mouse cursor over it and press the \"d\" key."),
-_("To add a point click in the middle of a segment and drag the new point to \
+<p>%s</p>""" % (_(u"Modification mode"),
+_(u"To move a point click on it and drag it to the desired position."),
+_(u"To delete a point move the mouse cursor over it and press the \"d\" or \
+\"Del\" key."),
+_(u"To add a point click in the middle of a segment and drag the new point to \
the desired position"))
tpl += u'<script src="%sedit_route_map.js"></script>\n' % \
settings.MEDIA_URL
if not value:
+ # upload a file
+ tpl += u"""<script type='text/javascript'><!--
+ var error_msg = "%s";
+// --></script>
+""" % _(u"Give a name and set category before uploading a file.")
+ tpl += u'<div class="upload"><a href="#" class="upload-button" '\
+ u'onclick="uploadFile(error_msg);return false;">%s</a></div>' % (
+ _(u"Upload a route file (GPX or KML)"))
+
tpl += u"""<div id='draw-toggle-off' class='toggle-button' \
onclick='toggleDrawOn();'>%s</div>
<div id='draw-toggle-on' class='toggle-button' \
@@ -195,7 +205,9 @@ onclick='toggleDrawOff();'>%s</div>
<div class='help-route' id='help-route-modify'%s>%s</div>
<hr class='spacer'/>
<input type='hidden' name='%s' id='id_%s' value="%s"/>
-""" % (style, help_modify, name, name, value)
+<input type='hidden' name='associated_file_id' id='id_associated_file_id' \
+value="%s"/>
+""" % (style, help_modify, name, name, value, routefile_id)
tpl += "<script type='text/javascript'><!--\n"
tpl += "init();\n"
if value:
@@ -212,9 +224,6 @@ initFeature(geometry);""" % val.json
tpl += """
// --></script>
"""
- tpl += u'<a href="#" class="add-button" '\
- u'onclick="open_window(\'%supload_file\');">%s</a>' % (
- settings.BASE_URL, _(u"Upload a route file (GPX or KML)"))
return mark_safe(tpl)
class RouteField(models.LineStringField):
diff --git a/chimere/static/edit_route_map.js b/chimere/static/edit_route_map.js
index cb6f148..52d7ffd 100644
--- a/chimere/static/edit_route_map.js
+++ b/chimere/static/edit_route_map.js
@@ -1,4 +1,4 @@
-/* Copyright (C) 2008 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet>
+/* Copyright (C) 2008-2011 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as
@@ -42,7 +42,6 @@ function featureCreated(event) {
pathModify.activate();
updateForm(event);
pathModify.selectControl.select(event.feature);
-
}
function initFeature(json_geometry){
@@ -141,3 +140,19 @@ function toggleDrawOff() {
document.getElementById('draw-toggle-on').style.display = 'None';
document.getElementById('draw-toggle-off').style.display = 'block';
}
+
+function checkFields(){
+ if (!jQuery("#id_name").val() ||
+ !jQuery("#id_categories").val()){
+ return false;
+ }
+ return true;
+}
+
+function uploadFile(error_msg) {
+ if(!checkFields()){
+ alert(error_msg);
+ return;
+ }
+ open_window(extra_url + 'upload_file');
+}
diff --git a/chimere/static/img/upload.png b/chimere/static/img/upload.png
new file mode 100644
index 0000000..53d7636
--- /dev/null
+++ b/chimere/static/img/upload.png
Binary files differ
diff --git a/chimere/static/img/upload_images.licence b/chimere/static/img/upload_images.licence
new file mode 100644
index 0000000..cf7408c
--- /dev/null
+++ b/chimere/static/img/upload_images.licence
@@ -0,0 +1,16 @@
+Upload image credit
+
+* Farm-Fresh layer gps.png in Farm-Fresh Web Icons
+Author: FatCow Web Hosting
+Licence: Creative Commons Attribution 3.0 United States license
+Url: http://commons.wikimedia.org/wiki/File:Farm-Fresh_layer_gps.png
+
+* Image from the Nuvola icon theme for KDE 3.x by David Vignoni
+Author: David Vignoni
+Licence: GNU Lesser General Public License version 2.1 or any later version
+Url: http://commons.wikimedia.org/wiki/File:Nuvola_apps_download_manager2.svg
+
+* Icon from the Tango! project set.
+Author: The Tango! Desktop Project
+Licence: Public domain
+Url: http://commons.wikimedia.org/wiki/File:Internet-web-browser.svg
diff --git a/chimere/static/styles.css b/chimere/static/styles.css
index 6ee1491..5b02d92 100644
--- a/chimere/static/styles.css
+++ b/chimere/static/styles.css
@@ -511,3 +511,16 @@ color:#b488ff;
}
.simple .cloud img{display:None;}
+
+.upload{
+vertical-align:center;
+background-image:url('img/upload.png');
+background-repeat:no-repeat;
+padding:40px;
+padding-left:80px;
+font-size:20px;;
+}
+
+.window{
+background-color:#FFF;
+}
diff --git a/chimere/templates/upload_file.html b/chimere/templates/upload_file.html
new file mode 100644
index 0000000..21a964a
--- /dev/null
+++ b/chimere/templates/upload_file.html
@@ -0,0 +1,44 @@
+{% load i18n %}
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>{% block title %}Chimère{% endblock %}</title>
+ <script type="text/javascript"><!--
+ var media_path = '{{media_path}}';
+ var extra_url = "{{extra_url}}";
+ // --></script>
+ {% block extra_head %}{{extra_head|safe}}{% endblock %}
+ <link rel="stylesheet" href="{{media_path}}styles.css" />
+ {%if css_area%}<link rel="stylesheet" href="{{media_path}}{{css_area}}" />{%endif%}
+ <script type="text/javascript" src="{{JQUERY_URL}}"></script>
+ {% block head %}{% endblock %}
+</head>
+<body class='window'>
+<div>
+<fieldset class='edit'>
+<legend>{% trans "Upload a file" %}</legend>
+<div class="fieldWrapper">
+{% if gpx_id %}
+<script type="text/javascript"><!--
+ $.get(extra_url + "process_route_file/{{gpx_id}}/", function(data) {
+ var data = jQuery.parseJSON(data);
+ var main_page = opener.document;
+ jQuery(main_page).find("#id_route").val(data.wkt);
+ jQuery(main_page).find("#id_associated_file_id").val(data.file_id);
+ opener.initFeatureFromWkt(data.wkt);
+ opener.focus();
+ self.close();
+ });
+// --></script>
+{% else %}
+<form enctype="multipart/form-data" method='post' action='{{extra_url}}upload_file/'>
+{{ form }}
+<p><input type='submit' value="{% trans 'Upload'%}"/></p>
+</form>
+{% endif %}
+</div>
+</div>
+</body>
+</html>
+