Commit 0b5a3e81 authored by Andreas Valder's avatar Andreas Valder
Browse files

Merge branch 'master' of git.fsmpi.rwth-aachen.de:videoagwebsite/videoagwebsite

parents be5aac12 6e4a1125
......@@ -24,6 +24,7 @@ if config['DB_ENGINE'] == 'sqlite':
cur = db.cursor()
if config['SQLITE_INIT_SCHEMA']:
cur.executescript(open(config['DB_SCHEMA']).read())
if config['SQLITE_INIT_DATA'] and created:
cur.executescript(open(config['DB_DATA']).read())
db.commit()
db.close()
......
......@@ -62,7 +62,8 @@ CREATE TABLE IF NOT EXISTS `courses_data` (
`internal` text NOT NULL DEFAULT '',
`responsible` text NOT NULL DEFAULT '',
`feed_url` text NOT NULL DEFAULT '',
`external` INTEGER NOT NULL DEFAULT 0
`external` INTEGER NOT NULL DEFAULT 0,
`coursechapters` INTEGER NOT NULL DEFAULT 0
);
CREATE TABLE IF NOT EXISTS `filesizes` (
`path` varchar(255) NOT NULL PRIMARY KEY,
......
......@@ -25,7 +25,8 @@ editable_tables = {
'responsible': {'type': 'shortstring'},
'deleted': {'type': 'boolean'},
'description': {'type': 'text'},
'external': {'type': 'boolean', 'description': 'Soll die Veranstaltung nicht im Drehplan angezeigt werden?'}},
'external': {'type': 'boolean', 'description': 'Soll die Veranstaltung nicht im Drehplan angezeigt werden?'},
'coursechapters': {'type': 'boolean', 'description': 'Sollen auf der Kursseite die Kapitelmarker der Videos angezeigt werden?'}},
'creationtime_fields': ['created_by', 'time_created', 'time_updated'] },
'lectures': {
'table': 'lectures_data',
......
......@@ -237,8 +237,11 @@ def course(id=None, handle=None):
JOIN formats ON formats.keywords = "hls"
WHERE streams.active AND (? OR streams.visible) AND lectures.course_id = ?
''', ismod(), course['id'])
chapters = []
if course['coursechapters']:
chapters = query('SELECT chapters.* FROM chapters JOIN lectures ON lectures.id = chapters.lecture_id WHERE lectures.course_id = ? AND NOT chapters.deleted AND chapters.visible ORDER BY time ASC', course['id'])
videos += genlive(livestreams)
return render_template('course.html', course=course, lectures=lectures, videos=videos)
return render_template('course.html', course=course, lectures=lectures, videos=videos, chapters=chapters)
@app.route('/faq')
@register_navbar('FAQ', icon='question-sign')
......
......@@ -43,6 +43,7 @@
<tr><td>Gelistet:</td><td>{{ moderator_checkbox(['courses',course.id,'listed'], course.listed) }}</td></tr>
<tr><td>Nicht im Drehplan:</td><td>{{ moderator_checkbox(['courses',course.id,'external'], course.external) }}</td></tr>
<tr><td>Videos downloadbar:</td><td>{{ moderator_checkbox(['courses',course.id,'downloadable'], course.downloadable) }}</td></tr>
<tr><td>Kapitel auf Kursseite:</td><td>{{ moderator_checkbox(['courses',course.id,'coursechapters'], course.coursechapters) }}</td></tr>
<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>
......@@ -93,7 +94,7 @@
</div>
<ul class="list-group lectureslist">
{% for l in lectures %}
{{ lecture_list_item(l,videos|selectattr('lecture_id','equalto',l.id)|list,global_permissions)}}
{{ lecture_list_item(l,videos|selectattr('lecture_id','equalto',l.id)|list,global_permissions,chapters=chapters|selectattr('lecture_id','equalto',l.id))}}
{% endfor %}
</ul>
</div>
......
......@@ -204,7 +204,7 @@ $('#embedcodebtn').popover(
</script>
{% endmacro %}
{% macro lecture_list_item(lecture,videos,global_permissions) %}
{% macro lecture_list_item(lecture,videos,global_permissions,chapters=[]) %}
<li class="list-group-item{% if lecture.norecording %} text-muted{% endif %}" id="lecture-{{lecture.id}}">
<div class="row">
{% if ismod() or (videos|length > 0) %}
......@@ -228,6 +228,9 @@ $('#embedcodebtn').popover(
</ul>
<ul class="list-unstyled col-sm-3 col-xs-12">
<li>{{ moderator_editor(['lectures',lecture.id,'comment'], lecture.comment) }}</li>
{% for chapter in chapters %}
<li><span class="glyphicon glyphicon-play"></span> <a href="{{url_for('lecture', course=lecture.course.handle, id=lecture.id, t=chapter.time)}}">{{chapter.text}}</a></li>
{% endfor %}
{% if ismod() %}
<li>{{ moderator_editor(['lectures',lecture.id,'internal'], lecture.internal) }}</li>
<li>Sichtbar: {{ moderator_checkbox(['lectures',lecture.id,'visible'], lecture.visible) }}</li>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment