course.html 4.87 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
48
49
					<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>
					<tr><td>Zuständig:</td><td>{{ moderator_editor(['courses',course.id,'responsible'], course.responsible) }}</td></tr>
50
					<tr><td>Interne Bemerkungen:</td><td>{{ moderator_editor(['courses',course.id,'internal'], course.internal) }}</td></tr>
51
52
				</tbody>
			</table>
53
		</div>
54
	{% endif %}
55
56
	</div>
</div>
57
58
59
60
	
{% if ismod() %}
<div class="panel panel-default">
        <div class="panel-heading">
Andreas Valder's avatar
Andreas Valder committed
61
		<a data-toggle="collapse" href="#statspanel" class="plotlyresize"><h1 class="panel-title">Statistiken</h1></a>
62
63
	</div>
	<div class="row panel-body collapse out panel-collapse" id="statspanel">
Andreas Valder's avatar
Andreas Valder committed
64
65
66
67
68
69
		<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
70
			<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
71
		</div>
72
73
74
75
	</div>
</div>
{% endif %}

76
77
<div class="panel panel-default">
	<div class="panel-heading">
78
		<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 %} <a class="fa fa-rss-square pull-right" aria-hidden="true" href="{{url_for('feed', handle=course.handle)}}" style="text-decoration: none"></a> </h1>
79
80
81
	</div>
	<ul class="list-group lectureslist">
		{% for l in lectures %}
82
			{{ lecture_list_item(l,videos|selectattr('lecture_id','equalto',l.id)|list,global_permissions)}}
83
84
		{% endfor %}
	</ul>
Andreas Valder's avatar
Andreas Valder committed
85
</div>
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101

<script>
$.ajax({
	method: "GET",
	url: "{{url_for('stats_generic', req="lecture_views", param=course.id)}}",
	dataType: "json",
	success: function (traces) {
		var dates={};
		var t = traces[0]
		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")]);
		}
102
103
104
105
106
107
		var counter = $(".viewcounter");
		for (var i=0; i<counter.length; i++) {
			if ($(counter[i]).text() == "loading...") {
				$(counter[i]).text("0");
			}
		}
108
109
110
	}
});
</script>
Andreas Valder's avatar
Andreas Valder committed
111
{% endblock %}