Skip to content
This repository has been archived by the owner on Sep 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #229 from EsupPortail/drclockwork/hotfix_embed_int…
Browse files Browse the repository at this point in the history
…eractive_video

hotfix/interactive when false and video format
  • Loading branch information
DrClockwork authored Jun 29, 2017
2 parents 1f9c22f + e73fb41 commit a03579b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
16 changes: 12 additions & 4 deletions pod_project/pods/templates/videos/video.html
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
6 changes: 4 additions & 2 deletions pod_project/pods/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit a03579b

Please sign in to comment.