Binary file src/egonomy/locale/en/LC_MESSAGES/django.mo has changed
--- a/src/egonomy/locale/en/LC_MESSAGES/django.po Tue Jul 02 16:38:05 2013 +0200
+++ b/src/egonomy/locale/en/LC_MESSAGES/django.po Tue Jul 02 17:58:37 2013 +0200
@@ -8,7 +8,7 @@
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2013-07-01 10:32-0500\n"
+"POT-Creation-Date: 2013-07-02 10:38-0500\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"
@@ -25,18 +25,22 @@
msgid "English"
msgstr ""
-#: views.py:84 views.py:108
+#: views.py:105 views.py:129
msgid "You are not allowed to modify this fragment."
msgstr ""
-#: views.py:238
+#: views.py:331
msgid "You are not allowed to delete this fragment."
msgstr ""
-#: views.py:490
+#: views.py:583
msgid "You are not allowed to delete this collection."
msgstr ""
+#: views.py:630 views.py:681
+msgid "You are not allowed to modify this collection."
+msgstr ""
+
#: templates/egonomy_all_collections.html:7
#: templates/egonomy_all_collections.html:47
msgid "All collections"
@@ -54,7 +58,7 @@
msgstr ""
#: templates/egonomy_all_collections.html:30
-#: templates/egonomy_annotate_picture.html:71
+#: templates/egonomy_annotate_picture.html:83
msgid "Description"
msgstr ""
@@ -105,19 +109,19 @@
msgid "Annotate a picture"
msgstr ""
-#: templates/egonomy_annotate_picture.html:10
+#: templates/egonomy_annotate_picture.html:14
#: templates/egonomy_create_fragment.html:14
-#: templates/egonomy_create_fragment.html:81
+#: templates/egonomy_create_fragment.html:77
#: templates/egonomy_embed_slideshow.html:70
-#: templates/egonomy_view_fragment.html:88
+#: templates/egonomy_view_fragment.html:100
#: templates/partial/collection_in_list.html:20
#: templates/partial/fragment_in_list.html:15
#: templates/partial/image_in_list.html:28
msgid "No title"
msgstr ""
-#: templates/egonomy_annotate_picture.html:19
-#: templates/egonomy_view_fragment.html:30
+#: templates/egonomy_annotate_picture.html:25
+#: templates/egonomy_view_fragment.html:36
#: templates/partial/fragment_in_list.html:27
#: templates/partial/image_in_list.html:41
#: templates/partial/item_in_collection_list.html:26
@@ -127,10 +131,10 @@
msgid "Create a fragment"
msgstr ""
-#: templates/egonomy_annotate_picture.html:23
-#: templates/egonomy_annotate_picture.html:25
-#: templates/egonomy_view_fragment.html:34
-#: templates/egonomy_view_fragment.html:36
+#: templates/egonomy_annotate_picture.html:29
+#: templates/egonomy_annotate_picture.html:31
+#: templates/egonomy_view_fragment.html:40
+#: templates/egonomy_view_fragment.html:42
#: templates/partial/fragment_in_list.html:23
#: templates/partial/image_in_list.html:37
#: templates/partial/item_in_collection_list.html:22
@@ -144,54 +148,54 @@
msgid "Add to a collection"
msgstr ""
-#: templates/egonomy_annotate_picture.html:75
+#: templates/egonomy_annotate_picture.html:87
#: templates/partial/image_in_list.html:29
msgid "Author"
msgstr ""
-#: templates/egonomy_annotate_picture.html:79
+#: templates/egonomy_annotate_picture.html:91
msgid "Period"
msgstr ""
-#: templates/egonomy_annotate_picture.html:83
+#: templates/egonomy_annotate_picture.html:95
msgid "Production site"
msgstr ""
-#: templates/egonomy_annotate_picture.html:87
+#: templates/egonomy_annotate_picture.html:99
msgid "Localization"
msgstr ""
-#: templates/egonomy_annotate_picture.html:94
+#: templates/egonomy_annotate_picture.html:106
msgid "Keywords"
msgstr ""
-#: templates/egonomy_annotate_picture.html:102
-#: templates/egonomy_create_fragment.html:120
-#: templates/egonomy_view_fragment.html:151
+#: templates/egonomy_annotate_picture.html:114
+#: templates/egonomy_create_fragment.html:116
+#: templates/egonomy_view_fragment.html:163
msgid "Fragments from this picture"
msgstr ""
-#: templates/egonomy_annotate_picture.html:114
-#: templates/egonomy_create_fragment.html:132
-#: templates/egonomy_view_fragment.html:163
+#: templates/egonomy_annotate_picture.html:126
+#: templates/egonomy_create_fragment.html:128
+#: templates/egonomy_view_fragment.html:175
#: templates/partial/fragment_in_list.html:16
msgid "Annotated by"
msgstr ""
-#: templates/egonomy_annotate_picture.html:119
-#: templates/egonomy_create_fragment.html:137
-#: templates/egonomy_view_fragment.html:168
+#: templates/egonomy_annotate_picture.html:131
+#: templates/egonomy_create_fragment.html:133
+#: templates/egonomy_view_fragment.html:180
msgid "No fragment"
msgstr ""
-#: templates/egonomy_annotate_picture.html:124
-#: templates/egonomy_create_fragment.html:142
-#: templates/egonomy_view_fragment.html:173
+#: templates/egonomy_annotate_picture.html:136
+#: templates/egonomy_create_fragment.html:138
+#: templates/egonomy_view_fragment.html:185
msgid "No collection"
msgstr ""
#: templates/egonomy_base.html:36 templates/egonomy_view_collection.html:76
-#: templates/egonomy_view_fragment.html:100
+#: templates/egonomy_view_fragment.html:112
#: templates/partial/collection_in_list.html:21
msgid "by"
msgstr ""
@@ -217,53 +221,53 @@
msgid "New fragment"
msgstr ""
-#: templates/egonomy_create_fragment.html:22
+#: templates/egonomy_create_fragment.html:18
msgid "Erase the drawing"
msgstr ""
-#: templates/egonomy_create_fragment.html:23
+#: templates/egonomy_create_fragment.html:19
msgid "Back to the original drawing"
msgstr ""
+#: templates/egonomy_create_fragment.html:76
+#: templates/egonomy_view_fragment.html:99
+msgid "Source picture"
+msgstr ""
+
#: templates/egonomy_create_fragment.html:80
-#: templates/egonomy_view_fragment.html:87
-msgid "Source picture"
+#: templates/egonomy_create_fragment.html:81
+#: templates/egonomy_view_fragment.html:103
+msgid "Fragment's title"
msgstr ""
#: templates/egonomy_create_fragment.html:84
-#: templates/egonomy_create_fragment.html:85
-#: templates/egonomy_view_fragment.html:91
-msgid "Fragment's title"
-msgstr ""
-
-#: templates/egonomy_create_fragment.html:88
-#: templates/egonomy_view_fragment.html:95
+#: templates/egonomy_view_fragment.html:107
msgid "Fragment's description"
msgstr ""
-#: templates/egonomy_create_fragment.html:97
-#: templates/egonomy_view_fragment.html:138
+#: templates/egonomy_create_fragment.html:93
+#: templates/egonomy_view_fragment.html:150
msgid "Fragment's keywords"
msgstr ""
-#: templates/egonomy_create_fragment.html:101
+#: templates/egonomy_create_fragment.html:97
msgid "Source picture's keywords"
msgstr ""
-#: templates/egonomy_create_fragment.html:111
+#: templates/egonomy_create_fragment.html:107
msgid "Senseetive keywords"
msgstr ""
+#: templates/egonomy_create_fragment.html:108
+#: templates/egonomy_create_fragment.html:238
+msgid "Request keywords from Senseetive API"
+msgstr ""
+
#: templates/egonomy_create_fragment.html:112
-#: templates/egonomy_create_fragment.html:242
-msgid "Request keywords from Senseetive API"
-msgstr ""
-
-#: templates/egonomy_create_fragment.html:116
msgid "Save the fragment"
msgstr ""
-#: templates/egonomy_create_fragment.html:191
+#: templates/egonomy_create_fragment.html:187
msgid "Add all Senseetive keywords to yours"
msgstr ""
@@ -389,35 +393,35 @@
msgid "View a fragment"
msgstr ""
-#: templates/egonomy_view_fragment.html:20
+#: templates/egonomy_view_fragment.html:26
msgid "Modify this fragment"
msgstr ""
-#: templates/egonomy_view_fragment.html:23
+#: templates/egonomy_view_fragment.html:29
#: templates/partial/fragment_in_list.html:29
msgid ""
"Do you really want to delete this fragment ? Warning : this action est "
"irreversible."
msgstr ""
-#: templates/egonomy_view_fragment.html:23
+#: templates/egonomy_view_fragment.html:29
#: templates/partial/fragment_in_list.html:29
msgid "Delete this fragment"
msgstr ""
-#: templates/egonomy_view_fragment.html:27
+#: templates/egonomy_view_fragment.html:33
msgid "Duplicate this fragment"
msgstr ""
-#: templates/egonomy_view_fragment.html:99
+#: templates/egonomy_view_fragment.html:111
msgid "Last modification"
msgstr ""
-#: templates/egonomy_view_fragment.html:107
+#: templates/egonomy_view_fragment.html:119
msgid "See the fragment in its full picture"
msgstr ""
-#: templates/egonomy_view_fragment.html:121
+#: templates/egonomy_view_fragment.html:133
msgid "See the fragment only"
msgstr ""
@@ -452,6 +456,18 @@
msgid "Not documented"
msgstr ""
+#: templates/partial/item_in_collection_list.html:27
+#: templates/partial/item_in_collection_list.html:83
+msgid ""
+"Do you really want to remove this item from this collection ? Warning : this "
+"action est irreversible."
+msgstr ""
+
+#: templates/partial/item_in_collection_list.html:27
+#: templates/partial/item_in_collection_list.html:83
+msgid "Remove from this collection"
+msgstr ""
+
#: templates/registration/login.html:5
msgid "Login"
msgstr ""
Binary file src/egonomy/locale/fr/LC_MESSAGES/django.mo has changed
--- a/src/egonomy/locale/fr/LC_MESSAGES/django.po Tue Jul 02 16:38:05 2013 +0200
+++ b/src/egonomy/locale/fr/LC_MESSAGES/django.po Tue Jul 02 17:58:37 2013 +0200
@@ -8,7 +8,7 @@
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2013-07-01 10:32-0500\n"
+"POT-Creation-Date: 2013-07-02 10:38-0500\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"
@@ -26,19 +26,24 @@
msgid "English"
msgstr "Anglais"
-#: views.py:84
-#: views.py:108
+#: views.py:105
+#: views.py:129
msgid "You are not allowed to modify this fragment."
msgstr "Vous n'êtes pas autorisé à modifier ce fragment."
-#: views.py:238
+#: views.py:331
msgid "You are not allowed to delete this fragment."
msgstr "Vous n'êtes pas autorisé à supprimer ce fragment."
-#: views.py:490
+#: views.py:583
msgid "You are not allowed to delete this collection."
msgstr "Vous n'êtes pas autorisé à supprimer cette collection."
+#: views.py:630
+#: views.py:681
+msgid "You are not allowed to modify this collection."
+msgstr "Vous n'êtes pas autorisé à modifier cette collection."
+
#: templates/egonomy_all_collections.html:7
#: templates/egonomy_all_collections.html:47
msgid "All collections"
@@ -56,7 +61,7 @@
msgstr "Titre"
#: templates/egonomy_all_collections.html:30
-#: templates/egonomy_annotate_picture.html:71
+#: templates/egonomy_annotate_picture.html:83
msgid "Description"
msgstr "Description"
@@ -111,19 +116,19 @@
msgid "Annotate a picture"
msgstr "Annoter une image"
-#: templates/egonomy_annotate_picture.html:10
+#: templates/egonomy_annotate_picture.html:14
#: templates/egonomy_create_fragment.html:14
-#: templates/egonomy_create_fragment.html:81
+#: templates/egonomy_create_fragment.html:77
#: templates/egonomy_embed_slideshow.html:70
-#: templates/egonomy_view_fragment.html:88
+#: templates/egonomy_view_fragment.html:100
#: templates/partial/collection_in_list.html:20
#: templates/partial/fragment_in_list.html:15
#: templates/partial/image_in_list.html:28
msgid "No title"
msgstr "Sans titre"
-#: templates/egonomy_annotate_picture.html:19
-#: templates/egonomy_view_fragment.html:30
+#: templates/egonomy_annotate_picture.html:25
+#: templates/egonomy_view_fragment.html:36
#: templates/partial/fragment_in_list.html:27
#: templates/partial/image_in_list.html:41
#: templates/partial/item_in_collection_list.html:26
@@ -133,10 +138,10 @@
msgid "Create a fragment"
msgstr "Créer un fragment"
-#: templates/egonomy_annotate_picture.html:23
-#: templates/egonomy_annotate_picture.html:25
-#: templates/egonomy_view_fragment.html:34
-#: templates/egonomy_view_fragment.html:36
+#: templates/egonomy_annotate_picture.html:29
+#: templates/egonomy_annotate_picture.html:31
+#: templates/egonomy_view_fragment.html:40
+#: templates/egonomy_view_fragment.html:42
#: templates/partial/fragment_in_list.html:23
#: templates/partial/image_in_list.html:37
#: templates/partial/item_in_collection_list.html:22
@@ -150,55 +155,55 @@
msgid "Add to a collection"
msgstr "Ajouter à une collection"
-#: templates/egonomy_annotate_picture.html:75
+#: templates/egonomy_annotate_picture.html:87
#: templates/partial/image_in_list.html:29
msgid "Author"
msgstr "Auteur"
-#: templates/egonomy_annotate_picture.html:79
+#: templates/egonomy_annotate_picture.html:91
msgid "Period"
msgstr "Période"
-#: templates/egonomy_annotate_picture.html:83
+#: templates/egonomy_annotate_picture.html:95
msgid "Production site"
msgstr "Site de production"
-#: templates/egonomy_annotate_picture.html:87
+#: templates/egonomy_annotate_picture.html:99
msgid "Localization"
msgstr "Localisation"
-#: templates/egonomy_annotate_picture.html:94
+#: templates/egonomy_annotate_picture.html:106
msgid "Keywords"
msgstr "Mots-clés"
-#: templates/egonomy_annotate_picture.html:102
-#: templates/egonomy_create_fragment.html:120
-#: templates/egonomy_view_fragment.html:151
+#: templates/egonomy_annotate_picture.html:114
+#: templates/egonomy_create_fragment.html:116
+#: templates/egonomy_view_fragment.html:163
msgid "Fragments from this picture"
msgstr "Fragments issus de cette image"
-#: templates/egonomy_annotate_picture.html:114
-#: templates/egonomy_create_fragment.html:132
-#: templates/egonomy_view_fragment.html:163
+#: templates/egonomy_annotate_picture.html:126
+#: templates/egonomy_create_fragment.html:128
+#: templates/egonomy_view_fragment.html:175
#: templates/partial/fragment_in_list.html:16
msgid "Annotated by"
msgstr "Annoté par"
-#: templates/egonomy_annotate_picture.html:119
-#: templates/egonomy_create_fragment.html:137
-#: templates/egonomy_view_fragment.html:168
+#: templates/egonomy_annotate_picture.html:131
+#: templates/egonomy_create_fragment.html:133
+#: templates/egonomy_view_fragment.html:180
msgid "No fragment"
msgstr "Pas de fragment"
-#: templates/egonomy_annotate_picture.html:124
-#: templates/egonomy_create_fragment.html:142
-#: templates/egonomy_view_fragment.html:173
+#: templates/egonomy_annotate_picture.html:136
+#: templates/egonomy_create_fragment.html:138
+#: templates/egonomy_view_fragment.html:185
msgid "No collection"
msgstr "Pas de collection"
#: templates/egonomy_base.html:36
#: templates/egonomy_view_collection.html:76
-#: templates/egonomy_view_fragment.html:100
+#: templates/egonomy_view_fragment.html:112
#: templates/partial/collection_in_list.html:21
msgid "by"
msgstr "par"
@@ -227,53 +232,53 @@
msgid "New fragment"
msgstr "Nouveau fragment"
-#: templates/egonomy_create_fragment.html:22
+#: templates/egonomy_create_fragment.html:18
msgid "Erase the drawing"
msgstr "Effacer le tracé"
-#: templates/egonomy_create_fragment.html:23
+#: templates/egonomy_create_fragment.html:19
msgid "Back to the original drawing"
msgstr "Revenir au tracé d'origine"
-#: templates/egonomy_create_fragment.html:80
-#: templates/egonomy_view_fragment.html:87
+#: templates/egonomy_create_fragment.html:76
+#: templates/egonomy_view_fragment.html:99
msgid "Source picture"
msgstr "Image source"
-#: templates/egonomy_create_fragment.html:84
-#: templates/egonomy_create_fragment.html:85
-#: templates/egonomy_view_fragment.html:91
+#: templates/egonomy_create_fragment.html:80
+#: templates/egonomy_create_fragment.html:81
+#: templates/egonomy_view_fragment.html:103
msgid "Fragment's title"
msgstr "Titre du fragment"
-#: templates/egonomy_create_fragment.html:88
-#: templates/egonomy_view_fragment.html:95
+#: templates/egonomy_create_fragment.html:84
+#: templates/egonomy_view_fragment.html:107
msgid "Fragment's description"
msgstr "Description du fragment"
-#: templates/egonomy_create_fragment.html:97
-#: templates/egonomy_view_fragment.html:138
+#: templates/egonomy_create_fragment.html:93
+#: templates/egonomy_view_fragment.html:150
msgid "Fragment's keywords"
msgstr "Mots-clés du fragment"
-#: templates/egonomy_create_fragment.html:101
+#: templates/egonomy_create_fragment.html:97
msgid "Source picture's keywords"
msgstr "Mots-clés de l'image source"
-#: templates/egonomy_create_fragment.html:111
+#: templates/egonomy_create_fragment.html:107
msgid "Senseetive keywords"
msgstr "Mots-clés Senseetive"
-#: templates/egonomy_create_fragment.html:112
-#: templates/egonomy_create_fragment.html:242
+#: templates/egonomy_create_fragment.html:108
+#: templates/egonomy_create_fragment.html:238
msgid "Request keywords from Senseetive API"
msgstr "Demander les mots-clés à l'API Senseetive"
-#: templates/egonomy_create_fragment.html:116
+#: templates/egonomy_create_fragment.html:112
msgid "Save the fragment"
msgstr "Enregistrer le fragment"
-#: templates/egonomy_create_fragment.html:191
+#: templates/egonomy_create_fragment.html:187
msgid "Add all Senseetive keywords to yours"
msgstr "Ajouter tous les mots-clés Senseetive aux votres"
@@ -385,8 +390,8 @@
msgid ""
"Do you really want to delete this collection ? Warning : this action est "
"irreversible."
-msgstr "Voulez-vous vraiment supprimer cette collection ? Attention : cette action est "
-"irréversible."
+msgstr "Voulez-vous vraiment supprimer cette collection ? Attention : cette action "
+"est irréversible."
#: templates/egonomy_view_collection.html:123
msgid "Delete this collection"
@@ -400,11 +405,11 @@
msgid "View a fragment"
msgstr "Voir un fragment"
-#: templates/egonomy_view_fragment.html:20
+#: templates/egonomy_view_fragment.html:26
msgid "Modify this fragment"
msgstr "Modifier ce fragment"
-#: templates/egonomy_view_fragment.html:23
+#: templates/egonomy_view_fragment.html:29
#: templates/partial/fragment_in_list.html:29
msgid ""
"Do you really want to delete this fragment ? Warning : this action est "
@@ -412,24 +417,24 @@
msgstr "Voulez-vous vraiment supprimer ce fragment ? Attention : cette action est "
"irréversible."
-#: templates/egonomy_view_fragment.html:23
+#: templates/egonomy_view_fragment.html:29
#: templates/partial/fragment_in_list.html:29
msgid "Delete this fragment"
msgstr "Supprimer ce fragment"
-#: templates/egonomy_view_fragment.html:27
+#: templates/egonomy_view_fragment.html:33
msgid "Duplicate this fragment"
msgstr "Dupliquer ce fragment"
-#: templates/egonomy_view_fragment.html:99
+#: templates/egonomy_view_fragment.html:111
msgid "Last modification"
msgstr "Dernière modification"
-#: templates/egonomy_view_fragment.html:107
+#: templates/egonomy_view_fragment.html:119
msgid "See the fragment in its full picture"
msgstr "Voir le fragment dans l'image entière"
-#: templates/egonomy_view_fragment.html:121
+#: templates/egonomy_view_fragment.html:133
msgid "See the fragment only"
msgstr "Voir le fragment seul"
@@ -464,6 +469,19 @@
msgid "Not documented"
msgstr "Non renseigné"
+#: templates/partial/item_in_collection_list.html:27
+#: templates/partial/item_in_collection_list.html:83
+msgid ""
+"Do you really want to remove this item from this collection ? Warning : this "
+"action est irreversible."
+msgstr "Voulez-vous vraiment supprimer cet élément de cette collection ? Attention : cette action "
+"est irréversible."
+
+#: templates/partial/item_in_collection_list.html:27
+#: templates/partial/item_in_collection_list.html:83
+msgid "Remove from this collection"
+msgstr "Supprimer de cette collection"
+
#: templates/registration/login.html:5
msgid "Login"
msgstr "Se connecter"
--- a/src/egonomy/templates/partial/item_in_collection_list.html Tue Jul 02 16:38:05 2013 +0200
+++ b/src/egonomy/templates/partial/item_in_collection_list.html Tue Jul 02 17:58:37 2013 +0200
@@ -24,7 +24,9 @@
<a class="tool plus" href="{% url 'login' %}?next={% url 'view_fragment' fragment_pk=fragment.pk %}" title="{% trans 'Add to a collection' %}"></a>
{% endif %}</li>
<li><a class="tool cut" href="{% url 'create_fragment' image_id=fragment.image.id %}" title="{% trans 'Create a fragment'%}"></a></li>
- <li><a title="Supprimer" class="tool trash" href="#"></a></li>
+ {% if user.is_authenticated %}{% ifequal col.author user %}
+ <li><a class="tool trash" href="{% url 'remove_item' %}?collection_pk={{col.pk}}&item_pk={{item.pk}}" onclick="return confirm('{% trans "Do you really want to remove this item from this collection ? Warning : this action est irreversible." %}')" title="{% trans 'Remove from this collection' %}" ></a></li>
+ {% endifequal %}{% endif %}
</ul>
</div>
</div>
@@ -80,7 +82,9 @@
<a class="tool plus" href="{% url 'login' %}?next={% url 'annotate_picture' image_id=img.id %}" title="{% trans 'Add to a collection' %}"></a>
{% endif %}</li>
<li><a class="tool cut" href="{% url 'create_fragment' image_id=img.id %}" title="{% trans 'Create a fragment'%}"></a></li>
- <li><a title="Supprimer" class="tool trash" href="#"></a></li>
+ {% if user.is_authenticated %}{% ifequal col.author user %}
+ <li><a class="tool trash" href="{% url 'remove_item' %}?collection_pk={{col.pk}}&item_pk={{item.pk}}" onclick="return confirm('{% trans "Do you really want to remove this item from this collection ? Warning : this action est irreversible." %}')" title="{% trans 'Remove from this collection' %}" ></a></li>
+ {% endifequal %}{% endif %}
</ul>
</div>
</div>
@@ -88,7 +92,7 @@
<div class="project-title">
{% if col.author == user %}<a class="tool edit toggle" href="#"></a>{% endif %}
<h3>{{ img.metadata.titre }}</h3>
- <h4>{{ img.metadata.auteur }}</h4>
+ <h4>{{ img.metadata.auteur|default:"" }}</h4>
</div>
<p>{{ item.description }}</p>
</div>
--- a/src/egonomy/templates/partial/item_in_collection_mosaic.html Tue Jul 02 16:38:05 2013 +0200
+++ b/src/egonomy/templates/partial/item_in_collection_mosaic.html Tue Jul 02 17:58:37 2013 +0200
@@ -29,7 +29,9 @@
<a class="tool plus" href="{% url 'login' %}?next={% url 'view_fragment' fragment_pk=fragment.pk %}" title="{% trans 'Add to a collection' %}"></a>
{% endif %}</li>
<li><a class="tool cut" href="{% url 'create_fragment' image_id=fragment.image.id %}" title="{% trans 'Create a fragment'%}"></a></li>
- <li><a title="Supprimer" class="tool trash" href="#"></a></li>
+ {% if user.is_authenticated %}{% ifequal col.author user %}
+ <li><a class="tool trash" href="{% url 'remove_item' %}?collection_pk={{col.pk}}&item_pk={{item.pk}}&display=mosaic" onclick="return confirm('{% trans "Do you really want to remove this item from this collection ? Warning : this action est irreversible." %}')" title="{% trans 'Remove from this collection' %}" ></a></li>
+ {% endifequal %}{% endif %}
</ul>
</div>
<div class="content-project">
@@ -69,7 +71,9 @@
<a class="tool plus" href="{% url 'login' %}?next={% url 'annotate_picture' image_id=img.id %}" title="{% trans 'Add to a collection' %}"></a>
{% endif %}</li>
<li><a class="tool cut" href="{% url 'create_fragment' image_id=img.id %}" title="{% trans 'Create a fragment'%}"></a></li>
- <li><a title="Supprimer" class="tool trash" href="#"></a></li>
+ {% if user.is_authenticated %}{% ifequal col.author user %}
+ <li><a class="tool trash" href="{% url 'remove_item' %}?collection_pk={{col.pk}}&item_pk={{item.pk}}&display=mosaic" onclick="return confirm('{% trans "Do you really want to remove this item from this collection ? Warning : this action est irreversible." %}')" title="{% trans 'Remove from this collection' %}" ></a></li>
+ {% endifequal %}{% endif %}
</ul>
</div>
<div class="content-project">
--- a/src/egonomy/urls.py Tue Jul 02 16:38:05 2013 +0200
+++ b/src/egonomy/urls.py Tue Jul 02 17:58:37 2013 +0200
@@ -25,6 +25,7 @@
url(r'^deletecollection/$', 'egonomy.views.delete_collection', name='delete_collection'),
url(r'^viewcollection/(?P<collection_pk>.*)/$', 'egonomy.views.view_collection', name='view_collection'),
url(r'^additem/$', 'egonomy.views.add_item_to_collection', name='add_item'),
+ url(r'^removeitem/$', 'egonomy.views.remove_item_from_collection', name='remove_item'),
url(r'^embedslideshow/(?P<collection_pk>.*)/$', 'egonomy.views.embed_slideshow', name='embed_slideshow'),
url(r'^picturebysearch/$', 'egonomy.views.picture_by_search', name='picture_by_search'),
url(r'^fragmentbysearch/$', 'egonomy.views.fragment_by_search', name='fragment_by_search'),
--- a/src/egonomy/views.py Tue Jul 02 16:38:05 2013 +0200
+++ b/src/egonomy/views.py Tue Jul 02 17:58:37 2013 +0200
@@ -1,3 +1,4 @@
+from datetime import datetime
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
@@ -610,7 +611,7 @@
-
+@login_required
def add_item_to_collection(request):
col_pk = request.POST["collection-pk"]
@@ -623,7 +624,13 @@
col_pk = int(col_pk)
except:
return HttpResponse("Collection number invalid.", status_code=400)
- col = get_object_or_404(Collection, pk=col_pk)
+ col = get_object_or_404(Collection.objects.select_related('author'), pk=col_pk)
+ # We check if the current user is the collection's author
+ if col.author != request.user:
+ return HttpResponseForbidden(_("You are not allowed to modify this collection."))
+ # We update the collection's modification date because by create an item we don't really touch the collection objet
+ col.modification = datetime.now()
+ col.save()
if item_type=="image":
# Test image
@@ -655,3 +662,41 @@
# It is an ajax call, everything is saved and we return the collection's url
return HttpResponse(reverse("view_collection", args=[col_pk]))
+
+
+
+def remove_item_from_collection(request):
+
+ col_pk = request.GET["collection_pk"] or None
+ item_pk = request.GET["item_pk"] or None
+ if "display" in request.GET:
+ display = request.GET["display"] or "list"
+ else:
+ display = "list"
+
+ # Test collection
+ try:
+ col_pk = int(col_pk)
+ except:
+ return HttpResponse("Collection number invalid.", status_code=400)
+ col = get_object_or_404(Collection.objects.select_related('author'), pk=col_pk)
+ # We check if the current user is the collection's author
+ if col.author != request.user:
+ return HttpResponseForbidden(_("You are not allowed to modify this collection."))
+ # We update the collection's modification date because by create an item we don't really touch the collection objet
+ col.modification = datetime.now()
+ col.save()
+
+ # Test item's pk
+ if not item_pk:
+ return HttpResponse("item-id must be set.", status_code=400)
+ # Get item
+ item = get_object_or_404(CollectionItem, pk=item_pk)
+ # Everything has been checked, we can delete the item
+ item.delete()
+
+ #return redirect("view_collection", collection_pk=col.pk)
+ return redirect(reverse("view_collection", args=[col.pk]) + "?display=" + display)
+ # It is an ajax call, everything is saved and we return the collection's url
+ #return HttpResponse(reverse("view_collection", args=[col_pk]))
+