course.html 13.1 KB
Newer Older
1
{% from 'macros.html' import lecture_list_item %}
2
3
4
{% from 'macros.html' import moderator_editor %}
{% from 'macros.html' import moderator_delete %}
{% from 'macros.html' import moderator_checkbox %}
5
{% from 'macros.html' import preview %}
6
{% from 'macros.html' import moderator_permissioneditor %}
Andreas Valder's avatar
Andreas Valder committed
7

Andreas Valder's avatar
Andreas Valder committed
8
{% extends "base.html" %}
9
{% block title %}- {{course.title}}{% endblock %}
Andreas Valder's avatar
Andreas Valder committed
10
{% block content %}
11
12
<div class="panel panel-default">
	<div class="panel-heading">
13
14
15
16
17
18
19
20
21
22
		<span class="panel-title">
			{{ moderator_editor(['courses',course.id,'title'], course.title)}}
			{% if ismod() %}
				<i>(<a href={{ url_for('course', id=course.id) }}>{{course.id}}</a>)</i>
			{% endif %}
		</span>
		<ul class="pull-right list-inline">
			<li>{{ moderator_delete(['courses',course.id,'deleted']) }}</li>
			<li>{{ moderator_permissioneditor('course',course.id,course.perm, global_permissions) }}</li>
		</ul>
Andreas Valder's avatar
Andreas Valder committed
23
	</div>
24
	<div class="row panel-body">
25
26
		<div class="col-xs-12">
			<table class="table-top-aligned table-condensed">
27
				<tbody>
28
					{% if ismod() %}
29
					<tr><td>Semester:</td><td>{{ moderator_editor(['courses',course.id,'semester'], course.semester) }}</td></tr>
30
31
32
					{% else %}
					<tr><td>Semester:</td><td>{{ course.semester|semester(long=True) }}</td></tr>
					{% endif %}
33
34
					<tr><td>Veranstalter:</td><td>{{ moderator_editor(['courses',course.id,'organizer'], course.organizer) }}</td></tr>
					<tr><td>Bemerkungen:</td><td>{{ moderator_editor(['courses',course.id,'description'], course.description) }}</td></tr>
Andreas Valder's avatar
Andreas Valder committed
35
36
37
				</tbody>
			</table>
		</div>
38
	{% if ismod() %}
Andreas Valder's avatar
Andreas Valder committed
39
		<div class="col-xs-12" style="margin-top: 20px">
40
			<table class="table-condensed table-top-aligned">
Andreas Valder's avatar
Andreas Valder committed
41
				<tbody>
42
43
					<tr><td>Sichtbar:</td><td>{{ moderator_checkbox(['courses',course.id,'visible'], course.visible) }}</td></tr>
					<tr><td>Gelistet:</td><td>{{ moderator_checkbox(['courses',course.id,'listed'], course.listed) }}</td></tr>
44
					<tr><td>Nicht im Drehplan:</td><td>{{ moderator_checkbox(['courses',course.id,'external'], course.external) }}</td></tr>
Andreas Valder's avatar
Andreas Valder committed
45
					<tr><td>Videos downloadbar:</td><td>{{ moderator_checkbox(['courses',course.id,'downloadable'], course.downloadable) }}</td></tr>
46
47
					<tr><td>Videos automatisch verschieben:</td><td>{{ moderator_checkbox(['courses',course.id,'autopublish'], course.autopublish) }}</td></tr>
					<tr><td>Videos automatisch sichtbar:</td><td>{{ moderator_checkbox(['courses',course.id,'autovisible'], course.autovisible) }}</td></tr>
48
					<tr><td>Kapitel auf Kursseite:</td><td>{{ moderator_checkbox(['courses',course.id,'coursechapters'], course.coursechapters) }}</td></tr>
49
50
51
					<tr><td>Short:</td><td>{{ moderator_editor(['courses',course.id,'short'], course.short) }}</td></tr>
					<tr><td>Handle:</td><td>{{ moderator_editor(['courses',course.id,'handle'], course.handle) }}</td></tr>
					<tr><td>Thema:</td><td>{{ moderator_editor(['courses',course.id,'subject'], course.subject) }}</td></tr>
52
53
54
55
56
57
58
					<tr><td>Zuständig:</td><td>
						<select id="responsible-select" multiple="multiple">
							{% for user in responsible %}
							<option value="{{ user.id }}"{% if user.responsible %} selected="selected"{% endif %}>{{ user.realname }}</option>
							{% endfor %}
						</select>
					</td></tr>
59
					<tr><td>Interne Bemerkungen:</td><td>{{ moderator_editor(['courses',course.id,'internal'], course.internal) }}</td></tr>
60
61
				</tbody>
			</table>
62
		</div>
63
	{% endif %}
64
65
	</div>
</div>
66
67
68
	
{% if ismod() %}
<div class="panel panel-default">
69
	<div class="panel-heading">
Andreas Valder's avatar
Andreas Valder committed
70
		<a data-toggle="collapse" href="#statspanel" class="plotlyresize"><h1 class="panel-title">Statistiken</h1></a>
71
72
	</div>
	<div class="row panel-body collapse out panel-collapse" id="statspanel">
Andreas Valder's avatar
Andreas Valder committed
73
74
75
76
77
78
		<div class="col-md-6 col-xs-12">
			<p class="text-center">Zuschauer pro Tag</p>
			<div class="plot-view" data-url="{{url_for('stats_viewsperday', req="course", param=course.id)}}"></div>
		</div>
		<div class="col-md-6 col-xs-12">
			<p class="text-center">Zuschauer pro Termin</p>
Andreas Valder's avatar
Andreas Valder committed
79
			<div class="plot-view" data-type="bar" data-url="{{url_for('stats_generic', req="lecture_views", param=course.id)}}"></div>
Andreas Valder's avatar
Andreas Valder committed
80
		</div>
81
82
83
84
	</div>
</div>
{% endif %}

85
86
<div class="panel panel-default">
	<div class="panel-heading">
87
88
89
90
91
92
93
		<h1 class="panel-title">Videos
			{% if ismod() %}
				<a class="btn btn-default" style="margin-right: 5px;" href="{{ url_for('create', table='lectures', time=datetime.now(), title='Noch kein Titel', visible='0', course_id=course.id, ref=url_for('course', id=course.id)) }}">Neuer Termin</a>
				<a class="btn btn-default" style="margin-right: 5px;" href="{{url_for('list_import_sources', id=course['id'])}}">Campus Import</a>
			{% endif %}
			<ul class="list-inline pull-right">
				<li>
94
					<a class="fa fa-rss-square" aria-hidden="true" href="{{url_for('rss_feed', handle=course.handle)}}" style="text-decoration: none"></a>
95
96
97
98
99
100
101
				</li>
			{% if ismod() %}
				<li>
					<a class="fa fa-calendar" aria-hidden="true" href="{{url_for('ical_course', course=course.handle)}}" style="text-decoration: none"></a>
				</li>
			{% endif %}
		</h1>
102
103
104
	</div>
	<ul class="list-group lectureslist">
		{% for l in lectures %}
105
			{{ lecture_list_item(l,videos|selectattr('lecture_id','equalto',l.id)|list,global_permissions,chapters=chapters|selectattr('lecture_id','equalto',l.id))}}
106
107
		{% endfor %}
	</ul>
Andreas Valder's avatar
Andreas Valder committed
108
</div>
109
{% if ismod() %}
110

111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<div class="modal fade" id="editperm" tabindex="-1" role="dialog">
	<div class="modal-dialog" role="document">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
				<h4 class="modal-title">Zugriffsrechte</h4>
			</div>
			<div class="modal-body">
				<div class="row" style="padding-left: 10px; padding-right: 10px;" data-id="-1" data-type="-1" id="editpermdiv">
					<span>Es existieren folgende Zugriffsrechte:</span>
					<select onchange="moderator.permissioneditor.selectpermission(this)" size="6" class="col-xs-12" id="permissionlist">
					</select>
					<select class="col-xs-12 authtype" onchange="moderator.permissioneditor.typechange(this)">
						<option value="public">Öffentlich</option>
						<option selected value="password">Passwort</option>
						<option value="rwth">RWTH intern</option>
						<option value="fsmpi">FSMPI intern</option>
						<option value="l2p">L2P Lernraum</option>
						<option value="none">Kein Zugriff</option>
					</select>
					<input class="col-xs-12 passwordinput authuser" type="text" placeholder="Benutzername">
					<input class="col-xs-10 passwordinput authpassword" type="text" placeholder="Passwort">
					<button class="col-xs-2 passwordinput authpgen" type="button" onclick="$('.authpassword',this.parentNode).val(moderator.permissioneditor.randompw());"><span class="fa fa-refresh" aria-hidden="true"></span></button>
					<input class="col-xs-12 authl2p" type="text" placeholder="Lernraum" style="display: none;">
					<button class="col-xs-4" onclick="moderator.permissioneditor.addbtnclick(this)">Add</button>
					<button class="col-xs-4" onclick="moderator.permissioneditor.updatebtnclick(this)">Update</button>
					<button class="col-xs-4" onclick="moderator.permissioneditor.delbtnclick(this)">Delete</button>
138
139
140
141
142
				</div>
			</div>
		</div>
	</div>
</div>
143

144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
<div class="modal fade" id="editstream" tabindex="-1" role="dialog">
	<div class="modal-dialog" role="document">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
				<h4 class="modal-title">Livestream einrichten</h4>
			</div>
			<div class="modal-body">
				<form id="editstream-form">
				<div class="row" style="padding-left: 10px; padding-right: 10px;" data-id="-1" data-type="-1">
					{% for snum in [1,2] %}
					<div class="col-xs-6">
						<label>Quelle {{ snum }}</label>
						<select name="source{{ snum }}" class="form-control source-select">
							<option value="">Nichts</option>
							{% for source in live_sources %}
							<option value="{{ source.id }}">{{ source.name }}</option>
							{% endfor %}
						</select>
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
						<img src="{{ url_for('static', filename='smptebars.jpg') }}" style="width: 100%; margin-bottom: 0.5em; margin-top: 0.5em"/>
						<label>Lautstärke</label>
						<div class="row">
							<div class="col-xs-6">
								<input type="range" name="source{{ snum }}_leftvolume" value="100">
							</div>
							<div class="col-xs-6">
								<input type="range" name="source{{ snum }}_rightvolume" value="100">
							</div>
						</div>
						<select name="source{{ snum }}_audiomode" class="form-control" style="margin-top: 0.5em">
							<option value="mono" selected>Mono-Mix</option>
							<option value="stereo">Stereo</option>
							<option value="unchanged">Audio unverändert</option>
							<option value="off">Kein Audio</option>
178
179
180
181
182
183
184
185
						</select>
					</div>
					{% endfor %}
					<div class="col-xs-12" style="margin-top: 1em">
						<label>Video</label>
						<select name="videomode" class="form-control">
							<option value="1" selected>Nur Quelle 1</option>
							<option value="2">Nur Quelle 2</option>
186
187
188
							<option value="lecture4:3">Quelle 1 (4:3) links, Ausschnitt von 2 rechts</option>
							<option value="lecture16:9">Quelle 1 (16:9) links, Ausschnitt von 2 rechts</option>
							<option value="sidebyside">Side-by-Side (Quelle 1 links, 2 rechts)</option>
189
190
191
192
193
						</select>
						<div class="checkbox"><label><input name="video_showlogo" type="checkbox" checked>Video AG-Logo einblenden</label></div>
					</div>
					<div class="col-xs-12" style="margin-top: 1em">
						<label>Weitere Einstellungen</label>
194
195
196
						<div style="margin-top: -1em;">
							<div class="checkbox"><label><input name="audio_normalize" type="checkbox">Lautstärke normalisieren</label></div>
						</div>
197
					</div>
198
				</div>
199
200
201
				</form>
			</div>
			<div class="modal-footer">
202
203
204
				<form class="form-inline" method="post" action="{{ url_for('start_stream') }}">
				<input type="hidden" id="editstream-lectureid" name="lecture_id" value="">
				<button type="submit" id="editstream-start" class="btn btn-danger">Speichern und starten</button>
205
				<button type="button" id="editstream-submit" class="btn btn-primary">Speichern</button>
206
				</form>
207
208
209
210
			</div>
		</div>
	</div>
</div>
211

212
<script>
213
214
function editstream_update() {
	$('#editstream .source-select').each(function () {
215
216
217
218
		if ($(this).val())
			$(this).siblings('img').prop('src', '{{ config.VIDEOPREFIX }}/thumbnail/s_'+$(this).val()+'.jpg');
		else
			$(this).siblings('img').prop('src', {{ url_for('static', filename='smptebars.jpg')|tojson }});
219
220
221
222
223
224
225
226
227
228
	});
};
function editstream_dump() {
	var res = {};
	$("#editstream input:checkbox[name!='']").each(function () {
		res[$(this).attr('name')] = $(this).prop('checked');
	});
	$("#editstream select[name!='']").each(function () {
		res[$(this).attr('name')] = $(this).val();
	});
229
230
231
	$("#editstream input[type='range'][name!='']").each(function () {
		res[$(this).attr('name')] = $(this).val();
	});
Julian Rother's avatar
Julian Rother committed
232
	return res;
233
};
Julian Rother's avatar
Julian Rother committed
234
function editstream_load(obj) {
235
236
237
238
239
240
241
242
	$("#editstream input:checkbox[name!='']").each(function () {
		if ($(this).attr('name') in obj)
			$(this).prop('checked', obj[$(this).attr('name')]);
	});
	$("#editstream select[name!='']").each(function () {
		if ($(this).attr('name') in obj)
			$(this).val(obj[$(this).attr('name')]);
	});
243
244
245
246
	$("#editstream input[type='range'][name!='']").each(function () {
		if ($(this).attr('name') in obj)
			$(this).val(obj[$(this).attr('name')]);
	});
247
248
249
};
$('#editstream .source-select').on('change', editstream_update);
$('#editstream-submit').on('click', function () {
Julian Rother's avatar
Julian Rother committed
250
251
252
	moderator.api.set($('#editstream').data('currentpath'), JSON.stringify(editstream_dump()), true);
	$('#editstream').modal('hide');
});
253
254
255
256
$('#editstream-start').on('click', function () {
	moderator.api.set($('#editstream').data('currentpath'), JSON.stringify(editstream_dump()), true);
	return true;
});
Julian Rother's avatar
Julian Rother committed
257
258
259
$('#editstream').on('show.bs.modal', function (event) {
	var button = $(event.relatedTarget);
	$('#editstream').data('currentpath', button.data('path'));
260
	$('#editstream-lectureid').val(button.data('lectureid'));
261
	$("#editstream-form")[0].reset();
Julian Rother's avatar
Julian Rother committed
262
263
264
	if (button.data('value'))
		editstream_load(button.data('value'));
	editstream_update();
265
});
Julian Rother's avatar
Julian Rother committed
266

267
268
269
270
271
272
$('#responsible-select').multiselect({enableCaseInsensitiveFiltering: true,
		maxHeight: 200, numberDisplayed: 5, nonSelectedText: 'Niemand',
		nSelectedText: 'ausgewählt', allSelectedText: false,
		onChange: function(option, checked, select) {
			moderator.api.set_map('responsible', {{ course.id }}, option.val(), checked);
		}})
273
274
275
276
$.ajax({
	method: "GET",
	url: "{{url_for('stats_generic', req="lecture_views", param=course.id)}}",
	dataType: "json",
277
278
279
280
281
282
	error: function() {
		var counter = $(".viewcounter");
		for (var i=0; i<counter.length; i++) {
			$(counter[i]).text("0");
		}
	},
283
284
	success: function (traces) {
		var dates={};
285
286
287
288
		var t = traces[0];
		if (!t.x) {
			return;
		}
289
290
291
292
293
294
295
		for (var i=0; i<t.x.length; i++) {
			dates[t.x[i]] = t.y[i];
		}
		var counter = $(".viewcounter");
		for (var i=0; i<counter.length; i++) {
			$(counter[i]).text(dates[$(counter[i]).data("lecturedate")]);
		}
296
297
298
299
300
301
		var counter = $(".viewcounter");
		for (var i=0; i<counter.length; i++) {
			if ($(counter[i]).text() == "loading...") {
				$(counter[i]).text("0");
			}
		}
302
303
304
	}
});
</script>
305
{% endif %}
Andreas Valder's avatar
Andreas Valder committed
306
{% endblock %}