src/ldt/ldt/ldt_utils/views/workspace.py
changeset 931 cc5442349bdd
parent 915 5d08847528dd
parent 930 e107b2225680
child 937 16cc07633339
--- a/src/ldt/ldt/ldt_utils/views/workspace.py	Mon Nov 12 13:28:31 2012 +0100
+++ b/src/ldt/ldt/ldt_utils/views/workspace.py	Mon Nov 12 16:17:22 2012 +0100
@@ -23,7 +23,6 @@
 import django.core.urlresolvers
 import ldt.auth as ldt_auth
 from django.utils.safestring import mark_safe
-import logging
 
 
 
@@ -99,9 +98,10 @@
     
     embed_rendered = dict((typestr,
                            (lambda s:escape(render_to_string("ldt/ldt_utils/partial/embed_%s.html" % (s), rend_dict, context_instance=RequestContext(request))))(typestr))
-                           for typestr in ('player', 'seo_body', 'seo_meta', 'links'))
+                           for typestr in ('seo_body', 'seo_meta', 'links'))
 
     rend_dict['embed_rendered'] = embed_rendered
+
     return render_to_response("ldt/ldt_utils/embed_popup.html", rend_dict, context_instance=RequestContext(request))
 
 
@@ -125,17 +125,52 @@
     rend_dict = get_datas_for_embed(request, json_url, player_id, ldt_id)
     
     # Manage iframe options
+    rend_dict["player_height"]=request.GET.get("player_height")
+    rend_dict["player_width"]=request.GET.get("player_width")
     if request.GET.has_key("polemic"):
         rend_dict["polemic"] = request.GET.get("polemic")
+        rend_dict["polemic_defaultColor"] = request.GET.get("polemic_defaultColor")
+        rend_dict["polemic_foundColor"] = request.GET.get("polemic_foundColor")
+        rend_dict["polemic_okColor"] = request.GET.get("polemic_okColor")
+        rend_dict["polemic_koColor"] = request.GET.get("polemic_koColor")
+        rend_dict["polemic_refColor"] = request.GET.get("polemic_refColor")
+        rend_dict["polemic_qColor"] = request.GET.get("polemic_qColor")
+
     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
-    
-    rend_dict["annotation_block"]= True
-    
-
+    if request.GET.has_key("createannotation"):
+        rend_dict["createannotation"] = {'true': True, 'false': False, "0": False, "1": True}.get(request.GET.get("createannotation").lower())
+    if request.GET.has_key("tag_titles"):
+       rend_dict["tag_titles"] = request.GET.get("tag_titles") 
+    if request.GET.has_key("sparkline"):
+        rend_dict["sparkline"] = request.GET.get("sparkline")
+        rend_dict["sparkline_lineColor"] = request.GET.get("sparkline_lineColor")
+        rend_dict["sparkline_fillColor"] = request.GET.get("sparkline_fillColor")
+    if request.GET.has_key("slideshare"):
+        rend_dict["slideshare"] = {'true': True, 'false': False, "0": False, "1": True}.get(request.GET.get("slideshare").lower())
+    if request.GET.has_key("social"):
+        rend_dict["social"] = {'true': True, 'false': False, "0": False, "1": True}.get(request.GET.get("social").lower())     
+        if request.GET.has_key("show_url"):
+            rend_dict["show_url"] = {'true': True, 'false': False, "0": False, "1": True}.get(request.GET.get("show_url").lower())     
+        if request.GET.has_key("show_twitter"):
+            rend_dict["show_twitter"] = {'true': True, 'false': False, "0": False, "1": True}.get(request.GET.get("show_twitter").lower())     
+        if request.GET.has_key("show_fb"):
+            rend_dict["show_fb"] = {'true': True, 'false': False, "0": False, "1": True}.get(request.GET.get("show_fb").lower())     
+        if request.GET.has_key("show_gplus"):
+            rend_dict["show_gplus"] = {'true': True, 'false': False, "0": False, "1": True}.get(request.GET.get("show_gplus").lower())     
+        if request.GET.has_key("show_mail"):
+            rend_dict["show_mail"] = {'true': True, 'false': False, "0": False, "1": True}.get(request.GET.get("show_mail").lower())     
+    if request.GET.has_key("annotation"):
+        rend_dict["annotation"] = {'true': True, 'false': False, "0": False, "1": True}.get(request.GET.get("annotation").lower())
+    if request.GET.has_key("tweet"):
+        rend_dict["tweet"] ={'true': True, 'false': False, "0": False, "1": True}.get(request.GET.get("tweet").lower())
+    if request.GET.has_key("segments"):
+        rend_dict["segments"] = request.GET.get("segments")
+    if request.GET.has_key("tagcloud"):
+        rend_dict["tagcloud"] = {'true': True, 'false': False, "0": False, "1": True}.get(request.GET.get("tagcloud").lower())
     return render_to_response("ldt/ldt_utils/embed_iframe.html", rend_dict, context_instance=RequestContext(request))
 
 
@@ -155,21 +190,21 @@
     stream_mode = project.stream_mode
     if stream_mode != "video":
         stream_mode = 'radio'
-
-    player_width = 550
-    player_height = 380
     
     if stream_mode == 'radio':
         player_height = 1
         
     if not ldt_auth.check_access(request.user, project):
         return HttpResponseForbidden(_("You can not access this project"))
-
+    WEB_URL=settings.WEB_URL
+    LDT_MEDIA_PREFIX=settings.LDT_MEDIA_PREFIX
+    LANGUAGE_CODE=settings.LANGUAGE_CODE
     ps = ProjectJsonSerializer(project, from_contents=True, from_display=True)
     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, 'annotations_list':False, 'iframe_url':iframe_url}
+                'external_url': external_url,
+                 'polemic':False, 'show_mic_record':False, 'annotations_list':False, 'iframe_url':iframe_url, 'WEB_URL':WEB_URL,
+                  'LDT_MEDIA_PREFIX':LDT_MEDIA_PREFIX, 'LANGUAGE_CODE':LANGUAGE_CODE}
     
     return rend_dict