From e73fb418631c2558a48957294d0699261cec449a Mon Sep 17 00:00:00 2001 From: drclockwork Date: Thu, 29 Jun 2017 19:21:56 +0200 Subject: [PATCH] fix interactive when false --- pod_project/pods/templates/videos/video.html | 16 ++++++++++++---- pod_project/pods/views.py | 6 ++++-- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/pod_project/pods/templates/videos/video.html b/pod_project/pods/templates/videos/video.html index 0c353190..70526f88 100755 --- a/pod_project/pods/templates/videos/video.html +++ b/pod_project/pods/templates/videos/video.html @@ -186,16 +186,24 @@ // Interactive mode if ($('#showinteractive').is(':checked')) { if(str.indexOf('interactive=true') < 0){ - str = str.replace(/(width=)\S+/, '$1' + '\"' + '620' +'\"'); - str = str.replace(/(height=)\S+/, '$1' + '\"' + '400' +'\"'); + str = str.replace(/(width=)\S+/, '$1' + '\"' + '625' +'\"'); + str = str.replace(/(height=)\S+/, '$1' + '\"' + '530' +'\"'); str = str.replace('is_iframe=true', 'is_iframe=true&interactive=true'); - $('#txtpartage').val('{% if request.is_secure %}https{% else %}http{% endif %}://{{ request.META.HTTP_HOST }}{% url 'video' slug=video.slug %}?interactive=true'); + {% if not video.is_draft %} + $('#txtpartage').val('{% if request.is_secure %}https{% else %}http{% endif %}://{{ request.META.HTTP_HOST }}{% url 'video' slug=video.slug %}?interactive=true'); + {% else %} + $('#txtpartageprive').val('{% if request.is_secure %}https{% else %}http{% endif %}://{{ request.META.HTTP_HOST }}/video_priv/{{ video.id }}/{{ hash_id }}/?interactive=true'); + {% endif %} } } else if (str.indexOf('interactive=true') > 0) { str = str.replace(/(width=)\S+/, '$1' + '\"' + '640' +'\"'); str = str.replace(/(height=)\S+/, '$1' + '\"' + '360' +'\"'); str = str.replace('&interactive=true', ''); - $('#txtpartage').val('{% if request.is_secure %}https{% else %}http{% endif %}://{{ request.META.HTTP_HOST }}{% url 'video' slug=video.slug %}?interactive=false'); + {% if not video.is_draft %} + $('#txtpartage').val('{% if request.is_secure %}https{% else %}http{% endif %}://{{ request.META.HTTP_HOST }}{% url 'video' slug=video.slug %}?interactive=false'); + {% else %} + $('#txtpartageprive').val('{% if request.is_secure %}https{% else %}http{% endif %}://{{ request.META.HTTP_HOST }}/video_priv/{{ video.id }}/{{ hash_id }}/'); + {% endif %} } $('#txtintegration').val(str); diff --git a/pod_project/pods/views.py b/pod_project/pods/views.py index ae61587e..5d1f8afd 100755 --- a/pod_project/pods/views.py +++ b/pod_project/pods/views.py @@ -527,7 +527,8 @@ def video(request, slug, slug_c=None, slug_t=None): if h5p_contents.objects.filter(title=video.title).count() > 0: h5p = h5p_contents.objects.get(title=video.title) if request.GET.get('is_iframe') and request.GET.get('interactive'): - return HttpResponseRedirect('/h5p/embed/?contentId=%d' %h5p.content_id) + if request.GET['interactive'] == 'true': + return HttpResponseRedirect('/h5p/embed/?contentId=%d' %h5p.content_id) if request.user == video.owner or request.user.is_superuser: score = getUserScore(h5p.content_id) else: @@ -658,7 +659,8 @@ def video_priv(request, id, slug, slug_c=None, slug_t=None): if h5p_contents.objects.filter(title=video.title).count() > 0: h5p = h5p_contents.objects.get(title=video.title) if request.GET.get('is_iframe') and request.GET.get('interactive'): - return HttpResponseRedirect('/h5p/embed/?contentId=%d' %h5p.content_id) + if request.GET['interactive'] == 'true': + return HttpResponseRedirect('/h5p/embed/?contentId=%d' %h5p.content_id) if request.user == video.owner or request.user.is_superuser: score = getUserScore(h5p.content_id) else: