| author | ymh <ymh.work@gmail.com> |
| Wed, 08 Apr 2015 16:14:12 +0200 | |
| changeset 1352 | ddcabeae57b5 |
| parent 1351 | 1f88f5cb7a73 |
| child 1353 | 08f25d0c9602 |
--- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/embed/iframe_base.html Tue Apr 07 18:36:07 2015 +0200 +++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/embed/iframe_base.html Wed Apr 08 16:14:12 2015 +0200 @@ -7,18 +7,18 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="{{LANGUAGE_CODE}}" lang="{{LANGUAGE_CODE}}"> - <head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> - <meta http-equiv="Cache-Control" content="no-cache, must-revalidate" /> - <meta http-equiv="Pragma" content="no-cache" /> - <meta http-equiv="Cache" content="no store" /> - <meta http-equiv="Expires" content="-1" /> - <title>Ligne de Temps - IRI - Metadata Player</title> - <script type="text/javascript"> - {% if tag_titles or tag_titles == "" %} - tag_string= '{{ tag_titles }}'; - tag_titles_array=tag_string.split(","); - {% endif %} + <head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> + <meta http-equiv="Cache-Control" content="no-cache, must-revalidate" /> + <meta http-equiv="Pragma" content="no-cache" /> + <meta http-equiv="Cache" content="no store" /> + <meta http-equiv="Expires" content="-1" /> + <title>Ligne de Temps - IRI - Metadata Player</title> + <script type="text/javascript"> + {% if tag_titles or tag_titles == "" %} + var tag_string= '{{ tag_titles }}'; + var tag_titles_array=tag_string.split(","); + {% endif %} // Public function to set location's hash. Usefull because browser's security does not allow to get/set document.getElementById("my-iframe").contentWindow.location.hash var setHash = function(e) { @@ -29,55 +29,55 @@ } // we have to listen for 'message' window.addEventListener('message', setHash, false); - </script> - </head> - <body id="init_embed_popup"> - <div style="float:left; width:550px;" id="wrapper_{{player_id}}"> - - <div> - <div id="{{ player_id }}_embed" class="iri_player_embed"></div> - <script type="text/javascript" src='{% static "ldt/metadataplayer/LdtPlayer-core.js" %}'></script> - <script type="text/javascript"> - - if (typeof jQuery == "undefined") { - jQuery = IriSP.jQuery; - } - var metadatas = {metadata: {url: "{{json_url}}"}}; - var metadata_key = "metadata"; - - IriSP.libFiles.defaultDir = '{% static "ldt/js/" %}'; - IriSP.libFiles.locations.jwPlayerSWF = '{% static "ldt/swf/player.swf" %}'; - IriSP.libFiles.locations.recordMicSwf = '{% static "ldt/swf/record_mic.swf" %}'; - IriSP.libFiles.locations.zeroClipboardSwf = '{% static "ldt/swf/ZeroClipboard10.swf" %}'; - IriSP.libFiles.locations.cssjQueryUI = '{% static "ldt/css/jq-css/themes/base/jquery-ui.css" %}'; - IriSP.language = '{{LANGUAGE_CODE}}'; - - IriSP.widgetsDir = '{% static "ldt/metadataplayer" %}'; - var _metadata = { - url: metadatas[metadata_key].url, - format: 'ldt' - }; - - {% block mdplayer_config %} - {% endblock mdplayer_config %} - - _myPlayer = new IriSP.Metadataplayer(_config); - </script> - </div> - </div> - {% if social %} - <div id="Social_ext" class="Ldt-TraceMe Ldt-Widget" style="float:right; width:400px; height:24px;" widget-type="Social"> - </div> - {% endif %} - {% if slideshare %} + </script> + </head> + <body id="init_embed_popup"> + <div style="float:left; width:550px;" id="wrapper_{{player_id}}"> + + <div> + <div id="{{ player_id }}_embed" class="iri_player_embed"></div> + <script type="text/javascript" src='{% static "ldt/metadataplayer/LdtPlayer-core.js" %}'></script> + <script type="text/javascript"> + + if (typeof jQuery == "undefined") { + jQuery = IriSP.jQuery; + } + var metadatas = {metadata: {url: "{{json_url}}"}}; + var metadata_key = "metadata"; + + IriSP.libFiles.defaultDir = '{% static "ldt/js/" %}'; + IriSP.libFiles.locations.jwPlayerSWF = '{% static "ldt/swf/player.swf" %}'; + IriSP.libFiles.locations.recordMicSwf = '{% static "ldt/swf/record_mic.swf" %}'; + IriSP.libFiles.locations.zeroClipboardSwf = '{% static "ldt/swf/ZeroClipboard10.swf" %}'; + IriSP.libFiles.locations.cssjQueryUI = '{% static "ldt/css/jq-css/themes/base/jquery-ui.css" %}'; + IriSP.language = '{{LANGUAGE_CODE}}'; + + IriSP.widgetsDir = '{% static "ldt/metadataplayer" %}'; + var _metadata = { + url: metadatas[metadata_key].url, + format: 'ldt' + }; + + {% block mdplayer_config %} + {% endblock mdplayer_config %} + + _myPlayer = new IriSP.Metadataplayer(_config); + </script> + </div> + </div> + {% if social %} + <div id="Social_ext" class="Ldt-TraceMe Ldt-Widget" style="float:right; width:400px; height:24px;" widget-type="Social"> + </div> + {% endif %} + {% if slideshare %} <div id="Slideshare_ext" class="ext_widget Ldt-TraceMe Ldt-Widget" style="float:left; width:400px;" widget-type="Slideshare"> - </div> + </div> {% endif %} - {% if annotations_list %} + {% if annotations_list %} <div style="float:left; width:400px;" id="AnnotationsList_ext"></div> {% endif %} {% analytics %} - </body> + </body> </html>
--- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/embed/mdplayer_config_base.html Tue Apr 07 18:36:07 2015 +0200 +++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/embed/mdplayer_config_base.html Wed Apr 08 16:14:12 2015 +0200 @@ -36,6 +36,7 @@ var configCss='{% static "ldt/metadataplayer/LdtPlayer-core.css" %}'; var default_thumbnail='{% static "ldt/css/imgs/video_sequence.png" %}'; var segment_api="{% absurl 'segment_api_empty' resource_name='segments' api_name='1.0' %}{% templatetag openvariable %}media{% templatetag closevariable %}/{% templatetag openvariable %}begin{% templatetag closevariable %}/{% templatetag openvariable %}end{% templatetag closevariable %}"; + var annotation_api = "{% absurl 'api_dispatch_list' resource_name='annotations' api_name='1.0' %}"; var LdtPlayer_core='{% static "ldt/metadataplayer/LdtPlayer-core.js" %}'; var creator_name='{{request.user.username}}';
--- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/embed/v1/iframe.html Tue Apr 07 18:36:07 2015 +0200 +++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/embed/v1/iframe.html Wed Apr 08 16:14:12 2015 +0200 @@ -128,7 +128,7 @@ close_after_send: false, slice_annotation_type: ["chap","découpage"], creator_name: '{{request.user.username}}', - creator_avatar: '{% thumbnail request.user.image "48x48" format="PNG" crop="center" as im %}{{WEB_URL}}{{ im.url }}{% endthumbnail %}' || "https://si0.twimg.com/sticky/default_profile_images/default_profile_1_normal.png", + creator_avatar: '{% thumbnail request.user.image "48x48" format="PNG" crop="center" as im %}{{ im.url }}{% endthumbnail %}' || "https://si0.twimg.com/sticky/default_profile_images/default_profile_1_normal.png", {% if not createannotation_polemics %}polemics: []{% endif %} }{% endif %} {% if slideshare %},{
--- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/embed/v2/iframe.html Tue Apr 07 18:36:07 2015 +0200 +++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/embed/v2/iframe.html Wed Apr 08 16:14:12 2015 +0200 @@ -5,178 +5,186 @@ {% load absurl %} {% load analytics %} {% block mdplayer_config %} - var _config = { - width: '{{ player_width }}', - container: '{{ player_id }}_embed', - css: '{% static "ldt/metadataplayer/LdtPlayer-core.css" %}', - default_options: { - metadata: _metadata - }, - widgets: [ - { - type: "AutoPlayer", - {% if external_url %} - video: "{{ external_url }}", - {% else %} - streamer: function(_url) { - var _matches = _url.match(/^[^\/]+\/\/[^\/]+\/[^\/]+\//); - if (_matches) { - return _matches[0]; - } else { - return _url; - } - }, - {% endif %} - height: '{{ player_height }}', - url_transform: function(url) { - // Adaptation to jwplayer 6 - if(url.substr(url.length - 4).toLowerCase()=='.flv'){ - return url.replace('/ddc_player/video/','/ddc_player/flv:video/'); - } - return url.replace('/ddc_player/video/','/ddc_player/mp4:video/'); - }, - autostart: {% if autostart %} true {% else %} false {% endif %} - } - {% if polemic %} - ,{ - type: "Polemic", - {% if polemic == 'all' %} - annotation_type: false, - {% else %} - annotation_type: [ - {% for type in polemic_annotation_types %} - {% if type == polemic_annotation_types|last %} - "{{type}}" - {% else %} - "{{type}}", - {% endif %} - {% endfor %}], - {% endif %} - max_elements: {{ polemic__max_elements }}, - defaultcolor: "#{{ polemic_defaultColor }}", - foundcolor: "#{{ polemic_foundColor }}", - {% if polemics_list %} - polemics : {{ polemics_list|safe }} - {% else %} - polemics : [ - { - "name" : "OK", - "keywords" : [ "++" ], - "color" : "#{{ polemic_okColor }}" - }, - { - "name" : "KO", - "keywords" : [ "--" ], - "color" : "#{{ polemic_koColor }}" - }, - { - "name" : "REF", - "keywords" : [ "==", "http://" ], - "color" : "#{{ polemic_refColor }}" - }, - { - "name" : "Q", - "keywords" : [ "?" ], - "color" : "#{{ polemic_qColor }}" - } - ] - {% endif %} - } - {% endif %} - {% if sparkline %} - ,{ - type: "Sparkline", - lineColor: "#{{ sparkline_lineColor }}", - fillColor: "#{{ sparkline_fillColor }}", - } - {% endif %} - ,{ - type: "Slider" - } - - {% if annotations_list %},{ - type: "AnnotationsList", - container: "AnnotationsList_ext", - ajax_url: "{% absurl 'segment_api_empty' resource_name='segments' api_name='1.0' %}{% templatetag openvariable %}media{% templatetag closevariable %}/{% templatetag openvariable %}begin{% templatetag closevariable %}/{% templatetag openvariable %}end{% templatetag closevariable %}", - ajax_granularity : 300000, - default_thumbnail : '{% static "ldt/css/imgs/video_sequence.png" %}', - show_audio: true, - rtmp_streamer: "rtmp://media.iri.centrepompidou.fr/ddc_micro_record/" - }{% endif %},{ - type: "Controller" - } - {% if segments %},{ - type: "Segments", - annotation_type: [ - {% for type in segments_annotation_types %} - {% if type == segments_annotation_types|last %} - "{{type}}" - {% else %} - "{{type}}", - {% endif %} - {% endfor %}] - } - {% endif %} - {% if multisegments %},{ - type: "MultiSegments" - } - {% endif %} - {% if annotation %},{ - type: "Annotation", - start_minimized: true, - site_name : "Lignes de Temps", - annotation_type: ["chap","découpage"] - } - {% endif %} - {% if tweet %},{ - type: "Tweet", - hide_timeout: 5000 - } - {% endif %} - {% if createannotation %},{ - type: "CreateAnnotation", - api_endpoint_template: "{% absurl 'api_dispatch_list' resource_name='annotations' api_name='1.0' %}", - after_send_timeout: 8000, - {% if tag_titles or tag_titles == "" %} - tag_titles : tag_titles_array, - {% else %} - tag_titles : false, - {% endif %} - show_mic_record: {% if show_mic_record %}true{% else %}false{% endif %}, - close_after_send: false, - slice_annotation_type: ["chap","découpage"], - creator_name: '{{request.user.username}}', - creator_avatar: '{% thumbnail request.user.image "48x48" format="PNG" crop="center" as im %}{{WEB_URL}}{{ im.url }}{% endthumbnail %}' || "https://si0.twimg.com/sticky/default_profile_images/default_profile_1_normal.png", - {% if not createannotation_polemics %}polemics: []{% endif %} - }{% endif %} - {% if slideshare %},{ - type: "Slideshare", - container: "Slideshare_ext", - embed_width: 400, - embed_height: 334, - annotation_type: "slide" - } - {% endif %},{ - type: "Mediafragment" - } - {% if social %},{ - type: "Social", - container: "Social_ext", - show_url: {% if show_url %}true{% else %}false{% endif %}, - show_twitter: {% if show_twitter %}true{% else %}false{% endif %}, - show_fb: {% if show_fb %}true{% else %}false{% endif %}, - show_gplus: {% if show_gplus %}true{% else %}false{% endif %}, - show_mail: {% if show_mail %}true{% else %}false{% endif %}, - url: document.location.href.replace(/#.*$/,""), - text: document.title - } - {% endif %} - - {% if tagcloud %},{ - type: "Tagcloud" - } - {% endif %} - ] - }; + var _config = { + width: '{{ player_width }}', + container: '{{ player_id }}_embed', + css: '{% static "ldt/metadataplayer/LdtPlayer-core.css" %}', + default_options: { + metadata: _metadata + }, + widgets: [ + { + type: "AutoPlayer", + {% if external_url %} + video: "{{ external_url }}", + {% else %} + streamer: function(_url) { + var _matches = _url.match(/^[^\/]+\/\/[^\/]+\/[^\/]+\//); + if (_matches) { + return _matches[0]; + } else { + return _url; + } + }, + {% endif %} + height: '{{ player_height }}', + url_transform: function(url) { + // Adaptation to jwplayer 6 + if(url.substr(url.length - 4).toLowerCase()=='.flv'){ + return url.replace('/ddc_player/video/','/ddc_player/flv:video/'); + } + return url.replace('/ddc_player/video/','/ddc_player/mp4:video/'); + }, + autostart: {% if autostart %} true {% else %} false {% endif %} + } + {% if polemic %} + ,{ + type: "Polemic", + {% if polemic == 'all' %} + annotation_type: false, + {% else %} + annotation_type: [ + {% for type in polemic_annotation_types %} + {% if type == polemic_annotation_types|last %} + "{{type}}" + {% else %} + "{{type}}", + {% endif %} + {% endfor %}], + {% endif %} + max_elements: {{ polemic__max_elements }}, + defaultcolor: "#{{ polemic_defaultColor }}", + foundcolor: "#{{ polemic_foundColor }}", + {% if polemics_list %} + polemics : {{ polemics_list|safe }} + {% else %} + polemics : [ + { + "name" : "OK", + "keywords" : [ "++" ], + "color" : "#{{ polemic_okColor }}" + }, + { + "name" : "KO", + "keywords" : [ "--" ], + "color" : "#{{ polemic_koColor }}" + }, + { + "name" : "REF", + "keywords" : [ "==", "http://" ], + "color" : "#{{ polemic_refColor }}" + }, + { + "name" : "Q", + "keywords" : [ "?" ], + "color" : "#{{ polemic_qColor }}" + } + ] + {% endif %} + } + {% endif %} + {% if sparkline %} + ,{ + type: "Sparkline", + lineColor: "#{{ sparkline_lineColor }}", + fillColor: "#{{ sparkline_fillColor }}", + } + {% endif %} + ,{ + type: "Slider" + } + + {% if annotations_list %},{ + type: "AnnotationsList", + container: "AnnotationsList_ext", + ajax_url: "{% absurl 'segment_api_empty' resource_name='segments' api_name='1.0' %}{% templatetag openvariable %}media{% templatetag closevariable %}/{% templatetag openvariable %}begin{% templatetag closevariable %}/{% templatetag openvariable %}end{% templatetag closevariable %}", + ajax_granularity : 300000, + default_thumbnail : '{% static "ldt/css/imgs/video_sequence.png" %}', + show_audio: true, + rtmp_streamer: "rtmp://media.iri.centrepompidou.fr/ddc_micro_record/" + }{% endif %},{ + type: "Controller" + } + {% if segments %},{ + type: "Segments", + annotation_type: [ + {% for type in segments_annotation_types %} + {% if type == segments_annotation_types|last %} + "{{type}}" + {% else %} + "{{type}}", + {% endif %} + {% endfor %}] + } + {% endif %} + {% if multisegments %},{ + type: "MultiSegments" + } + {% endif %} + {% if annotation %},{ + type: "Annotation", + start_minimized: true, + site_name : "Lignes de Temps", + annotation_type: ["chap","découpage"] + } + {% endif %} + {% if tweet %},{ + type: "Tweet", + hide_timeout: 5000 + } + {% endif %} + {% if createannotation %},{ + type: "CreateAnnotation", + api_endpoint_template: "{% absurl 'api_dispatch_list' resource_name='annotations' api_name='1.0' %}", + after_send_timeout: 8000, + {% if tag_titles or tag_titles == "" %} + tag_titles : tag_titles_array, + {% else %} + tag_titles : false, + {% endif %} + show_mic_record: {% if show_mic_record %}true{% else %}false{% endif %}, + close_after_send: false, + slice_annotation_type: {% if createannotation_annotation_types %} + [{% for type in createannotation_annotation_types %} + {% if forloop.last %} "{{type}}" + {% else %} "{{type}}", + {% endif %} + {% endfor %}] + {% else %} + ["chap","découpage"] + {% endif %}, + creator_name: '{{request.user.username}}', + creator_avatar: '{% thumbnail request.user.image "48x48" format="PNG" crop="center" as im %}{{ im.url }}{% endthumbnail %}' || "https://si0.twimg.com/sticky/default_profile_images/default_profile_1_normal.png", + {% if not createannotation_polemics %}polemics: []{% endif %} + }{% endif %} + {% if slideshare %},{ + type: "Slideshare", + container: "Slideshare_ext", + embed_width: 400, + embed_height: 334, + annotation_type: "slide" + } + {% endif %},{ + type: "Mediafragment" + } + {% if social %},{ + type: "Social", + container: "Social_ext", + show_url: {% if show_url %}true{% else %}false{% endif %}, + show_twitter: {% if show_twitter %}true{% else %}false{% endif %}, + show_fb: {% if show_fb %}true{% else %}false{% endif %}, + show_gplus: {% if show_gplus %}true{% else %}false{% endif %}, + show_mail: {% if show_mail %}true{% else %}false{% endif %}, + url: document.location.href.replace(/#.*$/,""), + text: document.title + } + {% endif %} + + {% if tagcloud %},{ + type: "Tagcloud" + } + {% endif %} + ] + }; {% endblock mdplayer_config %} {% analytics %}
--- a/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/embed/v2/mdplayer_config.html Tue Apr 07 18:36:07 2015 +0200 +++ b/src/ldt/ldt/ldt_utils/templates/ldt/ldt_utils/embed/v2/mdplayer_config.html Wed Apr 08 16:14:12 2015 +0200 @@ -25,15 +25,19 @@ <div id="createannotation_options" class="embedPersonnalisationSecondLevel"> <input type="checkbox" id="show_mic_record_checkbox" value="{% trans 'audio annotation' %}" onClick="put_new_code()" > <span class="infostooltip title" data-title="{% trans 'Audio annotation' %}" data-desc="{% trans 'Allows the user to record an annotation' %}">{% trans 'Audio annotation' %}</span> - </input><br> - <input type="radio" name="annotation_tag" id="default_tags" checked onClick="put_new_code();">{% trans 'Use most used tags ' %}</input> - <input type="radio" name="annotation_tag" id="set_tags"> - <span class="infostooltip title" data-title="{%trans 'Set your own tags : ' %}" data-desc="{% trans 'Write your tags separeted by a comma' %}">{%trans 'Set your own tags : ' %}</span> - <input type="text" id="tag_list" class="tags_area" onChange="put_new_code()"></input> - </input><br> - <input type="checkbox" id="createannotation_polemics_checkbox" value="{% trans '4 polemics buttons' %} ++/--/??/==" onClick="put_new_code()" > - <span class="infostooltip title" data-title="{% trans '4 polemics buttons' %} ++/--/??/==" data-desc="{% trans 'Displays or removes the 4 polemics buttons' %} ++/--/??/==">{% trans '4 polemics buttons' %} ++/--/??/==</span> - </input> + </input><br> + <div id="createannotationSegmentsOptions"> + {% trans 'Display annotation types: (annotation types must be separated by commas, leave blank to display everything) '%} <br> + <input type="text" id="createannotation_annotation_types" value='chap,découpage' onChange="put_new_code()"/><br> + </div> + <input type="radio" name="annotation_tag" id="default_tags" checked onClick="put_new_code();">{% trans 'Use most used tags ' %}</input> + <input type="radio" name="annotation_tag" id="set_tags" onClick="put_new_code();"> + <span class="infostooltip title" data-title="{%trans 'Set your own tags : ' %}" data-desc="{% trans 'Write your tags separeted by a comma' %}">{%trans 'Set your own tags : ' %}</span> + <input type="text" id="tag_list" class="tags_area" onChange="put_new_code()"></input> + </input><br> + <input type="checkbox" id="createannotation_polemics_checkbox" value="{% trans '4 polemics buttons' %} ++/--/??/==" onClick="put_new_code()" > + <span class="infostooltip title" data-title="{% trans '4 polemics buttons' %} ++/--/??/==" data-desc="{% trans 'Displays or removes the 4 polemics buttons' %} ++/--/??/==">{% trans '4 polemics buttons' %} ++/--/??/==</span> + </input> </div> </div> <div id="segments_block">
--- a/src/ldt/ldt/ldt_utils/views/embed/utils.py Tue Apr 07 18:36:07 2015 +0200 +++ b/src/ldt/ldt/ldt_utils/views/embed/utils.py Wed Apr 08 16:14:12 2015 +0200 @@ -1,12 +1,14 @@ from django.conf import settings from django.utils.safestring import mark_safe -from django.core.urlresolvers import reverse import ldt.auth as ldt_auth -from ldt.ldt_utils.models import Content, Project, Segment from ldt.ldt_utils.projectserializer import ProjectJsonSerializer +from ldt.utils.web_url_management import get_web_url -from ldt.utils.web_url_management import get_web_url + +from ldt.ldt_utils.models import Project +from urlparse import urljoin + def get_datas_for_embed(request, json_url, player_id, ldt_id, iframe_base_url): @@ -14,7 +16,7 @@ project_contents = project.contents.all() content = project_contents[0] WEB_URL = get_web_url(request) - iframe_url = mark_safe(WEB_URL+settings.SRC_BASE_URL+str(iframe_base_url)[1:]+"?content_id="+content.iri_id+"&project_id="+ldt_id) + iframe_url = mark_safe(urljoin(WEB_URL,str(iframe_base_url)+"?content_id="+content.iri_id+"&project_id="+ldt_id)) external_url = None if content.src is not None: for external_src in settings.EXTERNAL_STREAM_SRC:
--- a/src/ldt/ldt/ldt_utils/views/embed/v2/views.py Tue Apr 07 18:36:07 2015 +0200 +++ b/src/ldt/ldt/ldt_utils/views/embed/v2/views.py Wed Apr 08 16:14:12 2015 +0200 @@ -1,18 +1,14 @@ import logging from django.core.urlresolvers import reverse_lazy, reverse -from django.http import (HttpResponseForbidden, HttpResponseNotFound, - HttpResponseRedirect) +from django.http import HttpResponseForbidden from django.shortcuts import render_to_response from django.template import RequestContext -from django.template.loader import render_to_string -from django.utils.html import escape from django.utils.translation import ugettext as _ -from django.views.generic import View +from ldt.ldt_utils.models import Content from ldt.ldt_utils.views.embed.meta import ConfigView, IframeView from ldt.ldt_utils.views.embed.utils import get_datas_for_embed -from ldt.utils.web_url_management import get_web_url logger = logging.getLogger(__name__) @@ -64,9 +60,8 @@ rend_dict["player_width"]=550 if request.GET.has_key("polemic"): rend_dict["polemic"] = True - polemic_annotation_types_str = "" if request.GET.get("polemic") == "all": - polemic_annotation_types_str = "false" + rend_dict["polemic_annotation_types"] = [] else: polemic_annotation_types_list = request.GET.get("polemic").split(",") rend_dict["polemic_annotation_types"] = polemic_annotation_types_list @@ -123,6 +118,11 @@ rend_dict["show_mic_record"] = {'true': True, 'false': False, "0": False, "1": True}.get(request.GET.get("show_mic_record").lower()) if rend_dict["show_mic_record"]: rend_dict["createannotation"]=True + if request.GET.has_key("createannotation_annotation_types"): + segments_annotation_types_list = request.GET.get("createannotation_annotation_types").split(",") + rend_dict["createannotation_annotation_types"] = segments_annotation_types_list + else: + rend_dict["createannotation_annotation_types"] = False rend_dict["createannotation_polemics"] = True if request.GET.has_key("createannotation_polemics"): rend_dict["createannotation_polemics"] = {'true': True, 'false': False, "0": False, "1": True}.get(request.GET.get("createannotation_polemics").lower())
--- a/src/ldt/ldt/static/ldt/js/embed/v2/embed.js Tue Apr 07 18:36:07 2015 +0200 +++ b/src/ldt/ldt/static/ldt/js/embed/v2/embed.js Wed Apr 08 16:14:12 2015 +0200 @@ -202,6 +202,7 @@ var tagcloud_val=document.getElementById('tagcloud_checkbox'); var player_height_val=$j('#player_height').val(); var autostart_val=document.getElementById('autostart_checkbox'); + var createannotation_val=document.getElementById('createannotation_checkbox'); var widget_code='\ widgets: [\n\ {\n\ @@ -219,6 +220,8 @@ else { widget_code+='autostart: false\n\}'; } + + if (polemic_val.checked){ defaultcolor= $j("#polemic_default_color").val(); foundcolor=$j("#polemic_found_color").val(); @@ -319,6 +322,27 @@ },{\n\ type: "Mediafragment"\n\ }'; + if(createannotation_val.checked) { + + var tag_titles = ($j('input[name=annotation_tag]:checked').attr('id') === 'set_tags') ? $j('#tag_list').val() : false; + var show_mic_record = $j("#show_mic_record_checkbox").prop('checked'); + var createannotation_polemics = $j('#createannotation_polemics_checkbox').prop('checked'); + var createannotation_annotation_types = $j('#createannotation_annotation_types').val(); + + widget_code += + ',\n{\n' + + ' type: "CreateAnnotation",\n' + + ' api_endpoint_template: "'+ annotation_api +'",\n' + + ' after_send_timeout: 8000,\n' + + ' tag_titles : ' + ( (tag_titles || tag_titles === "") ? JSON.stringify(tag_titles.split(',')) : 'false') + ',\n' + + ' show_mic_record : ' + (show_mic_record ? 'true' : 'false') + ',\n' + + ' close_after_send: false,\n' + + ' slice_annotation_type: ' + (createannotation_annotation_types ? JSON.stringify(createannotation_annotation_types.split(',')) : '["chap","découpage"]') + ',\n' + + ' creator_avatar: "https://si0.twimg.com/sticky/default_profile_images/default_profile_1_normal.png",\n' + + ((!createannotation_polemics) ? ' polemics: []' : '') + '\n' + + '}\n'; + } + if(slideshare_val.checked){ widget_code+='\ ,{\n\ @@ -673,7 +697,6 @@ } function iframe_event() { var wrapper="wrapper_"+player_id; - //$j("#createannotation_block").toggle(true); $j("#createannotation_options").toggle(true); var element = document.getElementById(wrapper); var createannotation_val=document.getElementById('createannotation_checkbox'); @@ -713,6 +736,7 @@ iframeUrl+="&createannotation=True"; var show_mic_record_val = document.getElementById('show_mic_record_checkbox'); var set_tags_val=document.getElementById('set_tags'); + var createannotation_annotation_types = $j('#createannotation_annotation_types').val(); if(show_mic_record_val.checked){ iframeUrl+="&show_mic_record=True"; } @@ -722,6 +746,9 @@ if(!createannotation_polemics_val.checked){ iframeUrl+="&createannotation_polemics=False"; } + if(createannotation_annotation_types) { + iframeUrl += "&createannotation_annotation_types="+createannotation_annotation_types; + } } if (polemic_val.checked){ var polemic_annotation_types_val=document.getElementById("polemic_annotation_types");