# HG changeset patch # User cavaliet # Date 1362407370 -3600 # Node ID b2fbd34b259c918dd988acbe129fb4084a8a45d2 # Parent f44ce0a08750f67ebb3c44e9f1128a10ea2cb31b Duplicate fragment feature and languages updated diff -r f44ce0a08750 -r b2fbd34b259c src/egonomy/locale/en/LC_MESSAGES/django.mo Binary file src/egonomy/locale/en/LC_MESSAGES/django.mo has changed diff -r f44ce0a08750 -r b2fbd34b259c src/egonomy/locale/en/LC_MESSAGES/django.po --- a/src/egonomy/locale/en/LC_MESSAGES/django.po Fri Mar 01 12:05:58 2013 +0100 +++ b/src/egonomy/locale/en/LC_MESSAGES/django.po Mon Mar 04 15:29:30 2013 +0100 @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-02-26 09:32-0600\n" +"POT-Creation-Date: 2013-03-04 08:25-0600\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -25,7 +25,7 @@ msgid "English" msgstr "" -#: views.py:68 views.py:87 +#: views.py:71 views.py:95 msgid "You are not allowed to modify this fragment." msgstr "" @@ -50,10 +50,10 @@ msgid "Fragments created by" msgstr "" -#: templates/egonomy_all_fragments.html:59 -#: templates/egonomy_annotate_picture.html:123 -#: templates/egonomy_create_fragment.html:184 templates/egonomy_home.html:81 -#: templates/egonomy_view_fragment.html:102 +#: templates/egonomy_all_fragments.html:40 +#: templates/egonomy_annotate_picture.html:102 +#: templates/egonomy_create_fragment.html:163 templates/egonomy_home.html:62 +#: templates/egonomy_view_fragment.html:107 msgid "Annotated by" msgstr "" @@ -66,7 +66,7 @@ #: templates/egonomy_all_pictures.html:48 #: templates/egonomy_annotate_picture.html:12 #: templates/egonomy_create_fragment.html:101 templates/egonomy_home.html:39 -#: templates/egonomy_home.html.py:80 templates/egonomy_view_fragment.html:41 +#: templates/egonomy_home.html.py:61 templates/egonomy_view_fragment.html:38 msgid "No title" msgstr "" @@ -128,18 +128,18 @@ msgstr "" #: templates/egonomy_annotate_picture.html:80 templates/egonomy_base.html:36 -#: templates/egonomy_view_fragment.html:53 +#: templates/egonomy_view_fragment.html:50 msgid "by" msgstr "" #: templates/egonomy_annotate_picture.html:85 -#: templates/egonomy_view_fragment.html:64 +#: templates/egonomy_view_fragment.html:65 msgid "Create a fragment" msgstr "" #: templates/egonomy_annotate_picture.html:91 #: templates/egonomy_create_fragment.html:152 -#: templates/egonomy_view_fragment.html:70 +#: templates/egonomy_view_fragment.html:96 msgid "Fragments from this picture" msgstr "" @@ -172,7 +172,7 @@ msgstr "" #: templates/egonomy_create_fragment.html:100 -#: templates/egonomy_view_fragment.html:40 +#: templates/egonomy_view_fragment.html:37 msgid "Source picture" msgstr "" @@ -182,12 +182,12 @@ msgstr "" #: templates/egonomy_create_fragment.html:108 -#: templates/egonomy_view_fragment.html:44 +#: templates/egonomy_view_fragment.html:41 msgid "Fragment's description" msgstr "" #: templates/egonomy_create_fragment.html:112 -#: templates/egonomy_view_fragment.html:48 +#: templates/egonomy_view_fragment.html:45 msgid "Users keywords" msgstr "" @@ -223,7 +223,7 @@ msgid "Last created fragments" msgstr "" -#: templates/egonomy_home.html:80 +#: templates/egonomy_home.html:61 msgid "Fragment from" msgstr "" @@ -231,14 +231,26 @@ msgid "View a fragment" msgstr "" -#: templates/egonomy_view_fragment.html:52 +#: templates/egonomy_view_fragment.html:49 msgid "Last modification" msgstr "" -#: templates/egonomy_view_fragment.html:58 +#: templates/egonomy_view_fragment.html:55 msgid "Modify this fragment" msgstr "" +#: templates/egonomy_view_fragment.html:60 +msgid "Duplicate this fragment" +msgstr "" + +#: templates/egonomy_view_fragment.html:70 +msgid "See the fragment in its full picture" +msgstr "" + +#: templates/egonomy_view_fragment.html:83 +msgid "See the fragment only" +msgstr "" + #: templates/registration/login.html:5 msgid "Login" msgstr "" diff -r f44ce0a08750 -r b2fbd34b259c src/egonomy/locale/fr/LC_MESSAGES/django.mo Binary file src/egonomy/locale/fr/LC_MESSAGES/django.mo has changed diff -r f44ce0a08750 -r b2fbd34b259c src/egonomy/locale/fr/LC_MESSAGES/django.po --- a/src/egonomy/locale/fr/LC_MESSAGES/django.po Fri Mar 01 12:05:58 2013 +0100 +++ b/src/egonomy/locale/fr/LC_MESSAGES/django.po Mon Mar 04 15:29:30 2013 +0100 @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-02-26 09:34-0600\n" +"POT-Creation-Date: 2013-03-04 08:25-0600\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -26,8 +26,8 @@ msgid "English" msgstr "Anglais" -#: views.py:68 -#: views.py:87 +#: views.py:71 +#: views.py:95 msgid "You are not allowed to modify this fragment." msgstr "Vous n'être pas autorisé à modifier ce fragment." @@ -53,11 +53,11 @@ msgid "Fragments created by" msgstr "Fragments créés par" -#: templates/egonomy_all_fragments.html:59 -#: templates/egonomy_annotate_picture.html:123 -#: templates/egonomy_create_fragment.html:184 -#: templates/egonomy_home.html:81 -#: templates/egonomy_view_fragment.html:102 +#: templates/egonomy_all_fragments.html:40 +#: templates/egonomy_annotate_picture.html:102 +#: templates/egonomy_create_fragment.html:163 +#: templates/egonomy_home.html:62 +#: templates/egonomy_view_fragment.html:107 msgid "Annotated by" msgstr "Annoté par" @@ -72,8 +72,8 @@ #: templates/egonomy_annotate_picture.html:12 #: templates/egonomy_create_fragment.html:101 #: templates/egonomy_home.html:39 -#: templates/egonomy_home.html.py:80 -#: templates/egonomy_view_fragment.html:41 +#: templates/egonomy_home.html.py:61 +#: templates/egonomy_view_fragment.html:38 msgid "No title" msgstr "Sans titre" @@ -138,18 +138,18 @@ #: templates/egonomy_annotate_picture.html:80 #: templates/egonomy_base.html:36 -#: templates/egonomy_view_fragment.html:53 +#: templates/egonomy_view_fragment.html:50 msgid "by" msgstr "par" #: templates/egonomy_annotate_picture.html:85 -#: templates/egonomy_view_fragment.html:64 +#: templates/egonomy_view_fragment.html:65 msgid "Create a fragment" msgstr "Créer un fragment" #: templates/egonomy_annotate_picture.html:91 #: templates/egonomy_create_fragment.html:152 -#: templates/egonomy_view_fragment.html:70 +#: templates/egonomy_view_fragment.html:96 msgid "Fragments from this picture" msgstr "Fragments issus de cette image" @@ -182,7 +182,7 @@ msgstr "Nouveau fragment" #: templates/egonomy_create_fragment.html:100 -#: templates/egonomy_view_fragment.html:40 +#: templates/egonomy_view_fragment.html:37 msgid "Source picture" msgstr "Image source" @@ -192,12 +192,12 @@ msgstr "Titre du fragment" #: templates/egonomy_create_fragment.html:108 -#: templates/egonomy_view_fragment.html:44 +#: templates/egonomy_view_fragment.html:41 msgid "Fragment's description" msgstr "Description du fragment" #: templates/egonomy_create_fragment.html:112 -#: templates/egonomy_view_fragment.html:48 +#: templates/egonomy_view_fragment.html:45 msgid "Users keywords" msgstr "Mots-clés Utilisateurs" @@ -233,7 +233,7 @@ msgid "Last created fragments" msgstr "Derniers fragments créés" -#: templates/egonomy_home.html:80 +#: templates/egonomy_home.html:61 msgid "Fragment from" msgstr "Fragment de" @@ -241,14 +241,26 @@ msgid "View a fragment" msgstr "Voir un fragment" -#: templates/egonomy_view_fragment.html:52 +#: templates/egonomy_view_fragment.html:49 msgid "Last modification" msgstr "Dernière modification" -#: templates/egonomy_view_fragment.html:58 +#: templates/egonomy_view_fragment.html:55 msgid "Modify this fragment" msgstr "Modifier ce fragment" +#: templates/egonomy_view_fragment.html:60 +msgid "Duplicate this fragment" +msgstr "Dupliquer ce fragment" + +#: templates/egonomy_view_fragment.html:70 +msgid "See the fragment in its full picture" +msgstr "Voir le fragment dans l'image entière" + +#: templates/egonomy_view_fragment.html:83 +msgid "See the fragment only" +msgstr "Voir le fragment seul" + #: templates/registration/login.html:5 msgid "Login" msgstr "Se connecter" diff -r f44ce0a08750 -r b2fbd34b259c src/egonomy/templates/egonomy_create_fragment.html --- a/src/egonomy/templates/egonomy_create_fragment.html Fri Mar 01 12:05:58 2013 +0100 +++ b/src/egonomy/templates/egonomy_create_fragment.html Mon Mar 04 15:29:30 2013 +0100 @@ -68,7 +68,7 @@
× -

{% if frg_to_modify %}{{ frg_to_modify.title }}{% else %}{% trans 'New fragment' %}{% endif %} :

+

{% if frg_to_modify %}{{ frg_data.title }}{% else %}{% trans 'New fragment' %}{% endif %} :

{% with img.info.image_file as image %} @@ -89,9 +89,9 @@
- + - {% if frg_to_modify %}{% endif %} + {% if frg_to_modify %}{% endif %} {% csrf_token %}
@@ -102,15 +102,15 @@ {% trans "Fragment's title" %} : - + {% trans "Fragment's description" %} : - + {% trans 'Users keywords' %} : - + {% if img.metadata.mots_cles %} diff -r f44ce0a08750 -r b2fbd34b259c src/egonomy/templates/egonomy_view_fragment.html --- a/src/egonomy/templates/egonomy_view_fragment.html Fri Mar 01 12:05:58 2013 +0100 +++ b/src/egonomy/templates/egonomy_view_fragment.html Mon Mar 04 15:29:30 2013 +0100 @@ -55,6 +55,10 @@ {% trans "Modify this fragment" %} {% endifequal %} + +   + {% trans "Duplicate this fragment" %} +
diff -r f44ce0a08750 -r b2fbd34b259c src/egonomy/views.py --- a/src/egonomy/views.py Fri Mar 01 12:05:58 2013 +0100 +++ b/src/egonomy/views.py Mon Mar 04 15:29:30 2013 +0100 @@ -62,15 +62,21 @@ img = get_object_or_404(Image.objects.select_related('info', 'metadata'), id=image_id) frg_list = Fragment.objects.filter(image=img).order_by('-date_saved').select_related('image', 'image__info', 'image__metadata','author') - frg_to_modify = None + frg_to_modify = False + frg_data = None if fragment_pk: - frg_to_modify = get_object_or_404(Fragment.objects.select_related('author'), pk=fragment_pk) + frg_data = get_object_or_404(Fragment.objects.select_related('author'), pk=fragment_pk) # We check if the current user is the fragment's author - if frg_to_modify.author != request.user: + if frg_data.author != request.user: return HttpResponseForbidden(_("You are not allowed to modify this fragment.")) + frg_to_modify = True + else: + frg_duplicate_pk = request.GET.get("duplicate") or None + if frg_duplicate_pk: + frg_data = get_object_or_404(Fragment.objects.select_related('author'), pk=frg_duplicate_pk) return render_to_response("egonomy_create_fragment.html", - {'img': img, 'frg_to_modify': frg_to_modify, 'fragment_list': frg_list}, + {'img': img, 'frg_data': frg_data, 'frg_to_modify': frg_to_modify, 'fragment_list': frg_list}, context_instance=RequestContext(request)) @login_required