lecture.html 2.98 KB
Newer Older
Andreas Valder's avatar
Andreas Valder committed
1
{% from 'macros.html' import player %}
Andreas Valder's avatar
Andreas Valder committed
2
3
{% from 'macros.html' import video_download_btn %}
{% from 'macros.html' import video_embed_btn %}
4
{% from 'macros.html' import vtttime %}
5
6
7
{% from 'macros.html' import moderator_editor %}
{% from 'macros.html' import moderator_delete %}
{% from 'macros.html' import moderator_checkbox %}
8
9
{% set page_border = 0 -%}

Andreas Valder's avatar
Andreas Valder committed
10
11
{% extends "base.html" %}
{% block content %}
12
13
<div class="panel panel-default">
	<div class="panel-heading">
14
		<h1 class="panel-title"><strong><a href="{{url_for('course', handle=course.handle)}}#lecture-{{lecture.id}}">{{ course.title }}</strong></a>: {{ lecture.title}}</h1>
15
	</div>
Andreas Valder's avatar
Andreas Valder committed
16
	<div class="panel-body">
Andreas Valder's avatar
Andreas Valder committed
17
18
		<div class="row" style="padding: 0px;">
			<div class="col-sm-6 col-xs-12" style="padding-bottom: 5px;">
Andreas Valder's avatar
Andreas Valder committed
19
				<a href="{{url_for('course', handle=course.handle)}}#lecture-{{lecture.id}}" class="btn btn-default" >Zur Veranstaltungsseite</a>
Andreas Valder's avatar
Andreas Valder committed
20
21
			</div>
			<div class="col-sm-6 col-xs-12">
Andreas Valder's avatar
Andreas Valder committed
22
				<ul class="list-inline pull-right">
23
					<li><button class="btn btn-default" id="hintnewchapter">Kapitelmarker vorschlagen</button></li>
Andreas Valder's avatar
Andreas Valder committed
24
25
26
					<li>{{ video_embed_btn(lecture.id) }}</li>
					<li class="dropdown">{{ video_download_btn(videos) }}</li>
				</ul>
Andreas Valder's avatar
Andreas Valder committed
27
28
			</div>
		</div>
Andreas Valder's avatar
Andreas Valder committed
29
		<div class="row">
Andreas Valder's avatar
Andreas Valder committed
30
			<div class="col-xs-12" style="padding: 0px">
Andreas Valder's avatar
Andreas Valder committed
31
32
				{{ player(lecture, videos) }}
			</div>
33
34
35
36
37
38
39
40
41
42
43
44
			{% if ismod() %}
				<div class="col-xs-12" style="padding-top: 10px;">
					<p>Kapitel:</p>
					<table class="table table-hover">
					<tr>
						<th>Index</th>
						<th>Start</th>
						<th>Kapitel</th>
						<th>Sichtbar</th>
						<th></th>
					</tr>
					{% for c in chapters|sort(attribute='time') %}
45
					<tr>
46
						<td>{{ loop.index }}</td>
47
						<td><a href="javascript:videojs('videoplayer').currentTime({{c['time']}})">{{ vtttime(c['time']) }}</a></td>
48
49
50
51
52
53
54
55
						<td>{{ moderator_editor(['chapters',c.id,'text'],c['text']) }}</td>
						<td>{{ moderator_checkbox(['chapters',c.id,'visible'], c.visible) }}</td>
						<td>{{ moderator_delete(['chapters',c.id,'deleted']) }}</td>
					</tr>
					{% endfor %}
					</table>
				</div>
			{% endif %}
Andreas Valder's avatar
Andreas Valder committed
56
		</div>
57
58
	</div>
</div>
59
60
61
62
63
64
<script>
$(function() {
	$( "#hintnewchapter" ).popover(
			{
				html:true,
				title:'Kapitelmarkierung vorschlagen',
65
66
67
68
69
				content: function() {
					var zeropad = function (num, places) {
						  var zero = places - num.toString().length + 1;
						    return Array(+(zero > 0 && zero)).join("0") + num;
					};
70
					var timestamp = videojs('videoplayer').currentTime()
71
72
73
74
75
					var h = zeropad( Math.trunc(timestamp/3600),2);
					var m = zeropad( Math.trunc((timestamp%3600)/60),2);
					var s = zeropad( Math.trunc(timestamp%60),2);
					var timeasstring = h+':'+m+':'+s
		return '<form method="post" action="{{url_for('suggest_chapter', ref=request.url, lectureid=lecture.id)}}"><input placeholder="00:00.000" name="time" type="text" value="'+timeasstring+'"><br><input placeholder="Kapitel" name="text" type="texz"><br><input type="submit" value="Vorschlagen"></form>'
76

77
					}
78
			})
79

80
81
});
</script>
Andreas Valder's avatar
Andreas Valder committed
82
{% endblock %}