# HG changeset patch # User obledc # Date 1378812316 -7200 # Node ID de4e97ded3c601df1adfaf0411f394d7742da068 # Parent 44a8b4a109fd3b6ba8585eaa78817755c7b3daa9 new diff -r 44a8b4a109fd -r de4e97ded3c6 alcatel/controller/DocumentaryFile.py --- a/alcatel/controller/DocumentaryFile.py Wed Sep 04 10:03:16 2013 +0200 +++ b/alcatel/controller/DocumentaryFile.py Tue Sep 10 13:25:16 2013 +0200 @@ -11,7 +11,6 @@ from dataparser.ClientDocumentaryFileAttributes import ClientDocumentaryFileAttributes from dataparser.ClientDocumentaryFileVisibilityAttributes import ClientDocumentaryFileVisibilityAttribute -from dataparser.ClientDocumentaryFileDeleteAttributes import ClientDocumentaryFileDeleteAttributes from document.models import Cluster from document.models import Image from document.models import Document @@ -58,6 +57,54 @@ return json + + def modify(self,attr): + logger.info('modify') + + logger.info('get_description = ' + str(attr.get_description().encode("utf8"))) + logger.info('get_title = ' + str(attr.get_title().encode("utf8"))) + logger.info('get_visibility = ' + str(attr.get_visibility())) + try: + documentaryfile = Documentaryfile.objects.get(pk=attr.get_documentary_file_id()) + except Documentaryfile.DoesNotExist: + json = '{"Error": "Invalid documentary id"}' + logger.info(json) + return json + + logger.info('documentaryfile.user.name = ' + str(documentaryfile.user.username)) + if documentaryfile.user.username == attr.get_user(): + if attr.get_visibility() == 'on': + visibility_attr = True + else: + visibility_attr = False + '''else: + json = '{"Error" : "Invalid visibility parameter"}' + logger.info(json) + return json''' + + for thecluster in documentaryfile.cluster_set.all(): + for thedocument in thecluster.document.all(): + for theannotationdoc in thedocument.annotationdocument_set.all(): + theannotationdoc.visibility = visibility_attr + theannotationdoc.save() + + title_attr = str(attr.get_title().encode("utf8")) + description_attr = str(attr.get_description().encode("utf8")) + + documentaryfile.visibility = visibility_attr + documentaryfile.title = title_attr + documentaryfile.description = description_attr + + documentaryfile.save() + json = '{"modif": ok "}' + logger.info(json) + else: + json = '{"Error": "User does not matched"}' + logger.info(json) + + return json + + def visibilityChange(self): logger.info('visibilityChange') attr = ClientDocumentaryFileVisibilityAttribute(self.request) diff -r 44a8b4a109fd -r de4e97ded3c6 alcatel/controller/DocumentaryFiles.py --- a/alcatel/controller/DocumentaryFiles.py Wed Sep 04 10:03:16 2013 +0200 +++ b/alcatel/controller/DocumentaryFiles.py Tue Sep 10 13:25:16 2013 +0200 @@ -72,8 +72,8 @@ jsonfile['nb_articles'] = nb_articles nb_articles = 0 jsonfile['date'] = docfile.date.isoformat() - jsonfile['description'] = str(docfile.description) - jsonfile['title'] = str(docfile.title) + jsonfile['description'] = str(docfile.description.encode("utf8")) + jsonfile['title'] = str(docfile.title.encode("utf8")) image = Image.objects.get(id=docfile.image_id) jsonfile['url_image'] = str(image.url) diff -r 44a8b4a109fd -r de4e97ded3c6 alcatel/dataparser/ClientDocumentaryFileAttributes.py --- a/alcatel/dataparser/ClientDocumentaryFileAttributes.py Wed Sep 04 10:03:16 2013 +0200 +++ b/alcatel/dataparser/ClientDocumentaryFileAttributes.py Tue Sep 10 13:25:16 2013 +0200 @@ -36,6 +36,14 @@ logger.info('No description attribute in the http post request.' + str(err)) return description + def get_documentary_file_id(self): + documentary_file_id = '' + try: + documentary_file_id = self.request.POST['documentary_file_id'] + except Exception, err: + logger.info('No documentary_file_id attribute in the http post request. ' + str(err)) + return documentary_file_id + def get_query_id(self): query_id = '' try: diff -r 44a8b4a109fd -r de4e97ded3c6 alcatel/django/templates/article.html --- a/alcatel/django/templates/article.html Wed Sep 04 10:03:16 2013 +0200 +++ b/alcatel/django/templates/article.html Tue Sep 10 13:25:16 2013 +0200 @@ -25,17 +25,45 @@ - - - - {% endblock %} {% block contentright %} - + + +
+ ajouter une annotation
+
+
+
+
+
+
+
{% endblock %} - \ No newline at end of file + + + {% block streamgraphjs %} + + + + + + + + + {% endblock %} + + + \ No newline at end of file diff -r 44a8b4a109fd -r de4e97ded3c6 alcatel/django/templates/base.html --- a/alcatel/django/templates/base.html Wed Sep 04 10:03:16 2013 +0200 +++ b/alcatel/django/templates/base.html Tue Sep 10 13:25:16 2013 +0200 @@ -330,6 +330,12 @@ + {% block streamgraphjs %} + {% endblock %} + + + + diff -r 44a8b4a109fd -r de4e97ded3c6 alcatel/django/templates/clusterDoc.html --- a/alcatel/django/templates/clusterDoc.html Wed Sep 04 10:03:16 2013 +0200 +++ b/alcatel/django/templates/clusterDoc.html Tue Sep 10 13:25:16 2013 +0200 @@ -24,7 +24,7 @@ {% endblock %} {% block body %} - + {% endblock %} {% block query %} @@ -130,4 +130,9 @@ {% block affichage %} {% endblock %} {% block filtrestreamgraph %}{% endblock %} - {% block filtretreemap %}
{% endblock %} \ No newline at end of file + {% block filtretreemap %}{% endblock %} + + {% block streamgraphjs %} + + {% endblock %} + \ No newline at end of file diff -r 44a8b4a109fd -r de4e97ded3c6 alcatel/django/templates/dossiersdocumentaire.html --- a/alcatel/django/templates/dossiersdocumentaire.html Wed Sep 04 10:03:16 2013 +0200 +++ b/alcatel/django/templates/dossiersdocumentaire.html Tue Sep 10 13:25:16 2013 +0200 @@ -55,7 +55,24 @@

- + + +
+
{% csrf_token %} +
+ + + + + +

+ + + +
+
+
+ + +