macros.html 7.01 KB
Newer Older
1
{% macro preview(lecture) %}
Andreas Valder's avatar
Andreas Valder committed
2
<li class="list-group-item">
3
	<a class="hidden-xs" href="{{url_for('lecture', id=lecture['id'])}}" title="{{ lecture['coursetitle'] }}">
Andreas Valder's avatar
Andreas Valder committed
4
		<div class="row">
Julian Rother's avatar
Cleanup    
Julian Rother committed
5
			<img class="col-xs-4" src="{{ config.VIDEOPREFIX }}/{{ lecture['titlefile'] }}" alt="Vorschaubild">
Andreas Valder's avatar
Andreas Valder committed
6
			<div class="col-xs-4">
7
8
				<span style="color: #000;"><strong>{{ lecture['short'] }}</strong></span><br>
				<span style="color: #000;">{{ lecture['time'] }}</span>
9
				{% if lecture['speaker'] %}
10
					<div class="small" style="color: #000;">Gehalten von {{ lecture['speaker'] }} </div>
11
				{% endif %}
Andreas Valder's avatar
Andreas Valder committed
12
			</div>
13
			<div class="col-xs-4" style="color: #000;">
Andreas Valder's avatar
.    
Andreas Valder committed
14
15
				<div style="color: #000;">{{ lecture['title']  }}</div>
				<p style="font-style: italic; color: #777;">{{ lecture['comment'] }}</p>
16
			</div>
Andreas Valder's avatar
Andreas Valder committed
17
18
		</div>
	</a>
19
	<a class="visible-xs" href="{{url_for('lecture', id=lecture['id'])}}" title="{{ lecture['coursetitle'] }}">
Andreas Valder's avatar
Andreas Valder committed
20
		<div class="row">
Julian Rother's avatar
Cleanup    
Julian Rother committed
21
			<img class="col-xs-12" src="{{ config.VIDEOPREFIX }}/{{ lecture['titlefile'] }}" alt="Vorschaubild">
Andreas Valder's avatar
Andreas Valder committed
22
23
24
25
26
		</div>
		<div class="row">
			<div class="col-xs-12">
				<span style="color: #000;"><strong>{{ lecture['short'] }}</strong></span>
				<span style="color: #000;">{{ lecture['time'] }}</span>
Andreas Valder's avatar
.    
Andreas Valder committed
27
			</div>
Andreas Valder's avatar
Andreas Valder committed
28
29
30
31
32
		</div>
		{% if lecture['speaker'] %}
		<div class="row">
			<div class="col-xs-12">
				<div class="small" style="color: #000;">Gehalten von {{ lecture['speaker'] }} </div>
Andreas Valder's avatar
.    
Andreas Valder committed
33
			</div>
Andreas Valder's avatar
Andreas Valder committed
34
35
36
37
38
		</div>
		{% endif %}
		<div class="row">
			<div class="col-xs-12">
				<div style="color: #000;">{{ lecture['title']  }}</div>
Andreas Valder's avatar
.    
Andreas Valder committed
39
			</div>
Andreas Valder's avatar
Andreas Valder committed
40
41
42
43
		</div>
		<div class="row">
			<div class="col-xs-12">
				<p style="font-style: italic; color: #777;">{{ lecture['comment'] }}</p>
Andreas Valder's avatar
Andreas Valder committed
44
			</div>
Andreas Valder's avatar
Andreas Valder committed
45
46
		</div>
	</a>
Andreas Valder's avatar
Andreas Valder committed
47
48
</li>

Andreas Valder's avatar
Andreas Valder committed
49
50
{% endmacro %}

Julian Rother's avatar
Julian Rother committed
51
{% macro player(lecture, videos) %}
52
53
54
55
<script src="{{url_for('static', filename='mediaelementjs/mediaelement-and-player.js')}}"></script>
<script src="{{url_for('static', filename='mediaelementjs/mep-feature-sourcechooser.js')}}"></script>
<link rel="stylesheet" href="{{url_for('static', filename='mediaelementjs/mediaelementplayer.css')}}"/>
<video class="player" width="640" height="360" style="width: 100%; height: 100%;" controls="controls">
Andreas Valder's avatar
Andreas Valder committed
56
	{% for v in videos %}
57
		<source type="video/mp4" src="{{ config.VIDEOPREFIX }}/{{ v.path }}" title="{{ v.format_description }}"/>
Andreas Valder's avatar
Andreas Valder committed
58
	{% endfor %}
Andreas Valder's avatar
Andreas Valder committed
59
</video>
Andreas Valder's avatar
Andreas Valder committed
60
<script>
61
62
63
64
65
66
67
68
		$(function($)
		{
			var player = new MediaElementPlayer('.player', {
				features: [
					'playpause', 'current', 'progress', 'duration', 'volume', 'tracks', 'sourcechooser', 'speed', 'fullscreen',
				],
			});
		});
Andreas Valder's avatar
Andreas Valder committed
69
</script>
Andreas Valder's avatar
Andreas Valder committed
70
{% endmacro %}
71
72

{% macro course_list_item(course,show_semester=False) %}
Andreas Valder's avatar
Andreas Valder committed
73
<li class="list-group-item {% if (not course.visible) or (not course.listed) %}list-group-item-danger{% endif %}">
74
	<div class="row">
75
		<a href="{{url_for('course', handle=course.handle)}}">
Andreas Valder's avatar
Andreas Valder committed
76
77
78
79
80
81
82
83
84
			{% if show_semester %}
				<span class="col-xs-1">
					{{ course.semester }}
				</span>
				<span class="col-xs-6">
			{% else %}
				<span class="col-xs-7">
			{% endif %}
				{{ course.title }}
85
			</span>
Andreas Valder's avatar
Andreas Valder committed
86
87
88
89
90
91
92
			<span class="col-xs-3">
				{{ course.organizer }}
			</span>
			<span class="col-xs-2">
				{{ course.subject }}
			</span>
		</a>
93
94
95
	</div>
</li>
{% endmacro %}
Andreas Valder's avatar
Andreas Valder committed
96

97
{% macro video_download_btn(videos) %}
Andreas Valder's avatar
Andreas Valder committed
98
<span class="btn btn-primary dropdown-toggle{% if videos|length is equalto 0 %} disabled{% endif %}" type="button" data-toggle="dropdown">Download <span class="caret"></span></span>
99
100
<ul class="dropdown-menu">
	{% for v in videos %}
Andreas Valder's avatar
Andreas Valder committed
101
102
103
		{% if v.downloadable %}	
			<li><a href="{{ config.VIDEOPREFIX }}/{{v.path}}">{{ valuecheckbox(['videos',v.id,'visible'], v.visible) }} {{v.format_description}} ({{v.file_size|filesizeformat(true)}})</a></li>
		{% endif %}
104
105
106
107
108
	{% endfor %}
</ul>
<noscript>
	<ul class="pull-right list-unstyled" style="margin-left:10px;">
		{% for v in videos %}
Julian Rother's avatar
Cleanup    
Julian Rother committed
109
		<li><a href="{{ config.VIDEOPREFIX }}/{{v.path}}">{{v.format_description}} ({{v.file_size|filesizeformat(true)}})</a></li>
110
111
112
113
114
		{% endfor %}
	</ul>
</noscript>
{% endmacro %}

Andreas Valder's avatar
Andreas Valder committed
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
{%macro video_embed_btn(lectureid) %}
<a class="btn btn-default" id="embedcodebtn" data-container="body" data-toggle="popover" data-placement="bottom">
	<span>Einbetten</span>
</a>
<script>
{% set embedcode = '<iframe width="700" height="394" src="https://videoag.fsmpi.rwth-aachen.de/site/embed.php?lecture='+lectureid|string+'" frameborder="0" allowfullscreen="true"></iframe>' %}
$('#embedcodebtn').popover(
		{
			html:true,
			title:'Einbettcode',
			content:'<span><input type="text" onclick="this.select()" value="{{embedcode}}"></span>'
		}
		)
</script>
{% endmacro %}

Andreas Valder's avatar
Andreas Valder committed
131
{% macro lecture_list_item(lecture,videos) %}
132
<li class="list-group-item" id="lecture-{{lecture.id}}">
Andreas Valder's avatar
Andreas Valder committed
133
	<div class="row">
Andreas Valder's avatar
Andreas Valder committed
134
135
136
		<img class="col-sm-2 col-xs-12"src="https://videoag.fsmpi.rwth-aachen.de/{{lecture.titlefile}}" alt="Vorschaubild">
		<span class="col-sm-3 col-xs-12">
			<ul class="list-unstyled">
137
138
139
				<li>{{ valueeditor(['lectures',lecture.id,'title'], lecture.title) }}</li>
				{% if lecture.speaker or ismod() %}<li>Gehalten von {{ valueeditor(['lectures',lecture.id,'speaker'], lecture.speaker) }}</li>{% endif %}
				<li>{{ valueeditor(['lectures',lecture.id,'time'], lecture.time) }} </li>
140
				<li>Dauer: {{ valueeditor(['lectures',lecture.id,'duration'], lecture.duration) }} min</li>
141
142
				{% if  ismod() %}
				{% endif %}
Andreas Valder's avatar
Andreas Valder committed
143
			</ul>
Andreas Valder's avatar
Andreas Valder committed
144
		</span>
Andreas Valder's avatar
Andreas Valder committed
145
		<span class="col-sm-4 col-xs-12">
146
147
			<ul class="list-unstyled">
				<li>{{ valueeditor(['lectures',lecture.id,'comment'], lecture.comment) }}</li>
Andreas Valder's avatar
Andreas Valder committed
148
149
150
				{% if  ismod() %}
				<li>{{ valueeditor(['lectures',lecture.id,'internal'], lecture.internal) }}</li>
				<li>Sichtbar: {{ valuecheckbox(['lectures',lecture.id,'visible'], lecture.visible) }}</li>
151
				<li>Hörsaal: {{ valueeditor(['lectures',lecture.id,'place'], lecture.place) }} </li>
Andreas Valder's avatar
Andreas Valder committed
152
				{% endif %}
153
			</ul>
Andreas Valder's avatar
Andreas Valder committed
154
		</span>
Andreas Valder's avatar
Andreas Valder committed
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
		<div class="col-sm-3 col-xs-12">
			<ul class="pull-right list-inline">
				<li class="dropdown">
						{{ video_download_btn(videos) }}
				</li>
				<li>
						<a href="{{url_for('lecture', id=lecture.id)}}" class="btn btn-default {% if videos|length is equalto 0 %}disabled{% endif %}">
							<span class="glyphicon glyphicon-play"></span>
							Play
						</a>
				</li>
				<li>
						{{ valuedeletebtn(['lectures',lecture.id,'deleted']) }}
				</li>
			</ul>
		</div>
Andreas Valder's avatar
Andreas Valder committed
171
172
173
	</div>
</li>
{% endmacro %}
174
175
176
177
178
179
180

{% macro valueeditor (path,value) %}
	{% if ismod() %}
	<span class="modeditable" data-path="{{path|join('.')}}" ><a class="modeditablesign btn btn-default" tabindex="0" style="padding: 3px; margin-right: 5px;"><span class="glyphicon glyphicon-pencil"></span></a><span class="modeditablevalue">{{ value|safe }}</span></span>
	{% else %}
		{{value|safe}}
	{% endif %}
181
182
183
184
{% endmacro %}

{% macro valuecheckbox (path,value) %}
	{% if ismod() %}
185
	<input type="checkbox" data-path="{{path|join('.')}}" {% if value %} checked {% endif %} onchange="moderatorinterface.change(this)"/>
186
187
	{% endif %}
{% endmacro %}
188
189
190
191
192
193
194
195

{% macro valuedeletebtn (path) %}
	{% if ismod() %}
	<button data-path="{{path|join('.')}}" onclick="moderatorinterface.delete(this)">
			<span class="glyphicon glyphicon-trash"></span>
		</button>
	{% endif %}
{% endmacro %}