# HG changeset patch
# User verrierj
# Date 1327499422 -3600
# Node ID 2fdfe3ee94987ffca52e4fed8f33b537a22aef4c
# Parent ba508b67169841e9cbaa1c814c3a674be039b183
Add cutting_id to search results
diff -r ba508b671698 -r 2fdfe3ee9498 src/ldt/ldt/ldt_utils/templates/front/front_search_results.html
--- a/src/ldt/ldt/ldt_utils/templates/front/front_search_results.html Wed Jan 25 14:25:53 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/templates/front/front_search_results.html Wed Jan 25 14:50:22 2012 +0100
@@ -28,6 +28,9 @@
"id" : '{{segment.element_id}}',
"begin" : {{segment.begin}},
"duration" : {{segment.duration}},
+ "cutting_id" : '{{segment.decoupage_id}}',
+ "project_id" : '{{segment.project_id}}',
+ "ensemble_id" : '{{segment.ensemble_id}}',
},{% endfor %}
],
"stats" : [{{ res.content.stat_annotation }}],
@@ -35,7 +38,9 @@
];
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__' %}";
+
+
diff -r ba508b671698 -r 2fdfe3ee9498 src/ldt/ldt/ldt_utils/urls.py
--- a/src/ldt/ldt/ldt_utils/urls.py Wed Jan 25 14:25:53 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/urls.py Wed Jan 25 14:50:22 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.*)/(?P.*)/(?P.*)/(?P.*)$', 'views.front.annotation_preview'),
+ url(r'^annotpreview/(?P.*)/(?P.*)/(?P.*)/(?P.*)/(?P.*)/$', 'views.front.annotation_preview'),
)
urlpatterns += patterns('',
diff -r ba508b671698 -r 2fdfe3ee9498 src/ldt/ldt/ldt_utils/views/front.py
--- a/src/ldt/ldt/ldt_utils/views/front.py Wed Jan 25 14:25:53 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/views/front.py Wed Jan 25 14:50:22 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'