--- a/src/ldt/ldt/ldt_utils/views/front.py Wed Jan 25 12:31:55 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/views/front.py Wed Jan 25 14:25:53 2012 +0100
@@ -5,8 +5,9 @@
from django.http import HttpResponse, HttpResponseServerError
from django.shortcuts import render_to_response, get_object_or_404
from django.template import RequestContext
+from django.utils import simplejson
from guardian.shortcuts import get_objects_for_group
-from ldt.ldt_utils.models import Content, Project
+from ldt.ldt_utils.models import Content, Project, Segment
from ldt.ldt_utils.views.workspace import search_index as ws_search_index, search_listing as ws_search_listing
from ldt.security.utils import add_change_attr
from tagging.models import Tag, TaggedItem
@@ -133,10 +134,44 @@
def annotation_preview(request, content_iri_id, project_id, cutting_id, annot_id):
- return HttpResponse("coucou<br/>content_iri_id = " + content_iri_id +
- "<br/>project_id = " + project_id +
- "<br/>cutting_id = " + cutting_id +
- "<br/>annot_id = " + annot_id)
+
+ if project_id == '_':
+ project_id = ''
+
+ s = Segment.objects.filter(iri_id=content_iri_id, project_id=project_id, cutting_id=cutting_id, element_id=annot_id )
+
+ if not s:
+ annotation = {}
+ else:
+ s = s[0]
+ annotation = {
+ 'project_id': s.project_id,
+ 'iri_id' : s.iri_id,
+ 'ensemble_id' : s.ensemble_id,
+ 'cutting_id' : s.cutting_id,
+ 'element_id' : s.ensemble_id,
+ 'tags' : s.tags,
+ 'title': s.title,
+ 'duration': s.duration,
+ 'start_ts': s.start_ts,
+ 'author': s.author,
+ 'date': s.date,
+ 'abstract': s.abstract
+ }
+
+ mimetype = request.REQUEST.get("mimetype")
+ if mimetype is None:
+ mimetype = "application/json; charset=utf-8"
+ else:
+ mimetype = mimetype.encode("utf-8")
+ if "charset" not in mimetype:
+ mimetype += "; charset=utf-8"
+ resp = HttpResponse(mimetype=mimetype)
+ resp['Cache-Control'] = 'no-cache, must-revalidate'
+ resp['Pragma'] = 'no-cache'
+ resp.write(simplejson.dumps(annotation, indent=settings.LDT_JSON_DEFAULT_INDENT))
+
+ return resp
Binary file src/ldt/ldt/locale/fr/LC_MESSAGES/django.mo has changed
--- a/src/ldt/ldt/locale/fr/LC_MESSAGES/django.po Wed Jan 25 12:31:55 2012 +0100
+++ b/src/ldt/ldt/locale/fr/LC_MESSAGES/django.po Wed Jan 25 14:25:53 2012 +0100
@@ -354,7 +354,7 @@
#: .\ldt_utils\templates\front\front_search_results.html.py:111
msgid "Search results for "
-msgstr "Résultats de recherhce pour "
+msgstr "Résultats de recherche pour "
#: .\ldt_utils\templates\front\front_search_results.html.py:114
#: .\ldt_utils\templates\ldt\ldt_utils\search_results.html.py:62