add iframe annotation list feature.
authorcavaliet
Thu, 04 Oct 2012 16:02:30 +0200
changeset 821 ca8127a4cdd5
parent 820 f1a218ea85c3
child 822 26deb644fb66
add iframe annotation list feature.
src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/embed_iframe.html
src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/embed_player.html
src/ldt/ldt/ldt_utils/views/workspace.py
--- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/embed_iframe.html	Thu Oct 04 12:17:41 2012 +0200
+++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/embed_iframe.html	Thu Oct 04 16:02:30 2012 +0200
@@ -12,12 +12,14 @@
 		<meta http-equiv="Expires" content="-1" />
 		<title>Ligne de Temps - IRI - Metadata Player</title>
 	</head>
-
 	<body id="init_embed_popup">
-		<div class="ldt_player" id="wrapper_{{player_id}}">
+		<div style="float:left; width:550px;" id="wrapper_{{player_id}}">
 		{% include "ldt/ldt_utils/partial/embed_player.html" %}  
-		</div>		
-{% analytics %}		
+		</div>
+		{% if annotations_list %}
+        <div style="float:left; width:400px;" id="AnnotationsList_ext"></div>
+        {% endif %}
+{% analytics %}
 	</body>
 </html>
 
--- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/embed_player.html	Thu Oct 04 12:17:41 2012 +0200
+++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/partial/embed_player.html	Thu Oct 04 16:02:30 2012 +0200
@@ -63,7 +63,7 @@
         },{
             type: "AnnotationsList",
             container: "AnnotationsList_ext",
-            ajax_url: "{% url segment_api_empty %}{% templatetag openvariable %}media{% templatetag closevariable %}/{% templatetag openvariable %}begin{% templatetag closevariable %}/{% templatetag openvariable %}end{% templatetag closevariable %}",
+            ajax_url: "{{WEB_URL}}{% url segment_api_empty %}{% templatetag openvariable %}media{% templatetag closevariable %}/{% templatetag openvariable %}begin{% templatetag closevariable %}/{% templatetag openvariable %}end{% templatetag closevariable %}",
             ajax_granularity : 300000,
             default_thumbnail : "{{WEB_URL}}{{LDT_MEDIA_PREFIX}}css/imgs/video_sequence.png",
             show_audio: true,
@@ -83,7 +83,7 @@
             hide_timeout: 5000
         },{
             type: "CreateAnnotation",
-            api_endpoint_template: "{% url annotation_api_empty %}{% templatetag openvariable %}id{% templatetag closevariable %}.json",
+            api_endpoint_template: "{{WEB_URL}}{% url annotation_api_empty %}{% templatetag openvariable %}id{% templatetag closevariable %}.json",
             api_method: "PUT",
             after_send_timeout: 8000,
             show_mic_record: {% if show_mic_record %}true{% else %}false{% endif %},
--- a/src/ldt/ldt/ldt_utils/views/workspace.py	Thu Oct 04 12:17:41 2012 +0200
+++ b/src/ldt/ldt/ldt_utils/views/workspace.py	Thu Oct 04 16:02:30 2012 +0200
@@ -117,11 +117,14 @@
     project_id = request.GET.get("project_id")
     if not project_id:
         content_id = request.GET.get("content_id")
-        content = Content.safe_objects.get(iri_id=content_id)
+        try:
+            content = Content.safe_objects.get(iri_id=content_id)
+        except:
+            return HttpResponseForbidden(_("The content does not exists or you are not allowed to access this content"))
         project = content.get_or_create_front_project()
         project_id = project.ldt_id
     if not project_id :
-        return HttpResponse(_("Parameters project_id or content_id must be given in the url"))
+        return HttpResponseForbidden(_("Parameters project_id or content_id must be given in the url"))
         
     json_url = reverse("projectjson_id", args=[project_id])
     player_id = "player_project_" + project_id
@@ -133,6 +136,9 @@
         rend_dict["polemic"] = request.GET.get("polemic")
     if request.GET.has_key("show_mic_record"):
         rend_dict["show_mic_record"] = {'true': True, 'false': False, "0": False, "1": True}.get(request.GET.get("show_mic_record").lower())
+    if request.GET.has_key("annotations_list"):
+        rend_dict["annotations_list"] = {'true': True, 'false': False, "0": False, "1": True}.get(request.GET.get("annotations_list").lower())
+        rend_dict["player_width"] = 550
     
 
     return render_to_response("ldt/ldt_utils/embed_iframe.html", rend_dict, context_instance=RequestContext(request))
@@ -167,7 +173,7 @@
     annotations = ps.get_annotations(first_cutting=True)
     rend_dict = {'json_url':json_url, 'player_id':player_id, 'annotations':annotations, 'ldt_id': ldt_id, 'stream_mode': stream_mode, 
                  'player_width': player_width, 'player_height': player_height, 'external_url': external_url,
-                 'polemic':False, 'show_mic_record':False}
+                 'polemic':False, 'show_mic_record':False, 'annotations_list':False}
     
     return rend_dict