--- a/src/ldt/ldt/ldt_utils/templates/front/front_search_results.html Wed Jan 25 14:40:10 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/templates/front/front_search_results.html Wed Jan 25 14:58:21 2012 +0100
@@ -28,8 +28,9 @@
"id" : '{{segment.element_id}}',
"begin" : {{segment.begin}},
"duration" : {{segment.duration}},
- "cutting_id" : '{{segment.cutting_id}}',
+ "cutting_id" : '{{segment.decoupage_id}}',
"project_id" : '{{segment.project_id}}',
+ "ensemble_id" : '{{segment.ensemble_id}}',
},{% endfor %}
],
"stats" : [{{ res.content.stat_annotation }}],
@@ -37,7 +38,7 @@
];
var global_csrf_token = "{{ csrf_token }}";
- var annot_preview_url = "{% url ldt.ldt_utils.views.front.annotation_preview content_iri_id='__CONTENT_IRI_ID__' project_id='__PROJECT_ID__' cutting_id='__CUTTING_ID__' annot_id='__ANNOT_ID__' %}";
+ var annot_preview_url = "{% url ldt.ldt_utils.views.front.annotation_preview project_id='__PROJECT_ID__' content_id='__CONTENT_ID__' ensemble_id='__ENSEMBLE_ID__' cutting_id='__CUTTING_ID__' segment_id='__SEGMENT_ID__' %}";
</script>
<script src="{{LDT_MEDIA_PREFIX}}js/Ldt_front_search_results.js" type="text/javascript"></script>
--- a/src/ldt/ldt/ldt_utils/urls.py Wed Jan 25 14:40:10 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/urls.py Wed Jan 25 14:58:21 2012 +0100
@@ -48,7 +48,7 @@
url(r'^front/search/$', 'views.front.search_index'),
url(r'^front/searchListing', 'views.front.search_listing'),
url(r'^front/medias', 'views.front.all_contents'),
- url(r'^annotpreview/(?P<content_iri_id>.*)/(?P<project_id>.*)/(?P<cutting_id>.*)/(?P<annot_id>.*)$', 'views.front.annotation_preview'),
+ url(r'^annotpreview/(?P<project_id>.*)/(?P<content_id>.*)/(?P<ensemble_id>.*)/(?P<cutting_id>.*)/(?P<segment_id>.*)/$', 'views.front.annotation_preview'),
)
urlpatterns += patterns('',
--- a/src/ldt/ldt/ldt_utils/views/front.py Wed Jan 25 14:40:10 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/views/front.py Wed Jan 25 14:58:21 2012 +0100
@@ -133,39 +133,29 @@
return Tag.objects.cloud_for_model(Content, steps=steps)[:limit]
-def annotation_preview(request, content_iri_id, project_id, cutting_id, annot_id):
+def annotation_preview(request, project_id, content_id, ensemble_id, cutting_id, segment_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 )
+ s = get_object_or_404(Segment, iri_id=content_id, project_id=project_id, cutting_id=cutting_id, element_id=segment_id, ensemble_id=ensemble_id)
+
+ 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
+ }
- 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"
+ mimetype = "application/json; charset=utf-8"
resp = HttpResponse(mimetype=mimetype)
resp['Cache-Control'] = 'no-cache, must-revalidate'
resp['Pragma'] = 'no-cache'