lecture.html 3.83 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
{% from 'macros.html' import stats_viewsperday %}
Andreas Valder's avatar
Andreas Valder committed
9
{% set page_border = 1 -%}
10

Andreas Valder's avatar
Andreas Valder committed
11
{% extends "base.html" %}
12
{% block title %}- {{ course.title }}: {{ lecture.title}}{% endblock %}
13
14
15
16
17
18
19
{% block header %}
{{ super() }}

	<meta property="og:image" content="{{ config.VIDEOPREFIX }}/{{ lecture['titlefile'] }}" />
	<meta property="og:title" content="{{ course.title }}: {{ lecture.title}}" />
	<meta property="og:description" content="{{ lecture.comment }}" />
{% endblock %}
Andreas Valder's avatar
Andreas Valder committed
20
{% block content %}
21
22
<div class="panel panel-default">
	<div class="panel-heading">
23
		<h1 class="panel-title"><strong><a href="{{url_for('course', handle=course.handle)}}#lecture-{{lecture.id}}">{{ course.title }}</strong></a>: {{ lecture.title}}</h1>
24
	</div>
Andreas Valder's avatar
Andreas Valder committed
25
	<div class="panel-body">
Andreas Valder's avatar
Andreas Valder committed
26
		<div class="row" style="padding: 0px;">
27
			<div class="col-xs-12" style="padding-bottom: 5px;">
Andreas Valder's avatar
Andreas Valder committed
28
29
				<a href="{{url_for('course', handle=course.handle)}}#lecture-{{lecture.id}}" class="btn btn-default" >Zur Veranstaltungsseite</a>
				<ul class="list-inline pull-right">
30
					<li><button class="btn btn-default" id="hintnewchapter">Kapitelmarker vorschlagen</button></li>
Andreas Valder's avatar
Andreas Valder committed
31
32
33
					<li>{{ video_embed_btn(lecture.id) }}</li>
					<li class="dropdown">{{ video_download_btn(videos) }}</li>
				</ul>
Andreas Valder's avatar
Andreas Valder committed
34
35
			</div>
		</div>
Andreas Valder's avatar
Andreas Valder committed
36
		<div class="row">
Andreas Valder's avatar
Andreas Valder committed
37
			<div class="col-xs-12" style="padding: 0px">
Andreas Valder's avatar
Andreas Valder committed
38
39
				{{ player(lecture, videos) }}
			</div>
40
41
42
43
44
45
46
47
48
49
50
51
			{% 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') %}
52
					<tr>
53
						<td>{{ loop.index }}</td>
54
						<td><a href="javascript:videojs('videoplayer').currentTime({{c['time']}})">{{ vtttime(c['time']) }}</a></td>
55
56
57
58
59
60
61
						<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>
62
				<div id="statview" class="col-xs-12" style="height:600px"></div>
Julian Rother's avatar
Julian Rother committed
63
				{{stats_viewsperday("statview", "lecture", "Abrufer pro Tag", param=lecture.id)}}
64
			{% endif %}
Andreas Valder's avatar
Andreas Valder committed
65
		</div>
66
67
	</div>
</div>
68
<script>
69
70
71
72
73
74
75
76
77
78
79
80
81
function hintchapterclick (src) {
	$.ajax({
		method: "GET",
		url: $(src).data('url'),
		data: $(src).serialize(),
		success: function(data)
		{
			alert("Kapitelmarker vorgeschlagen. Danke!");
			$('#hintnewchapter').popover('hide');
		}
	});
	return false;
}
82
83
84
85
86
$(function() {
	$( "#hintnewchapter" ).popover(
			{
				html:true,
				title:'Kapitelmarkierung vorschlagen',
87
88
89
90
91
				content: function() {
					var zeropad = function (num, places) {
						  var zero = places - num.toString().length + 1;
						    return Array(+(zero > 0 && zero)).join("0") + num;
					};
92
					var timestamp = videojs('videoplayer').currentTime()
93
94
95
					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);
96
					var timeasstring = h+':'+m+':'+s;
97
					return '<form method="post" data-url="{{ url_for('suggest_chapter', lectureid=lecture.id) }}" onSubmit="return hintchapterclick(this);"><input class="form-control" placeholder="00:00.000" name="time" type="text" value="'+timeasstring+'"><br><input class="form-control" placeholder="Kapitel" name="text" type="texz"><br><input type="submit" class="btn btn-default" value="Vorschlagen"></form>';
98
				}
99
			})
100

101
102
});
</script>
Andreas Valder's avatar
Andreas Valder committed
103
{% endblock %}