diff --git a/server.py b/server.py index b6c64af1261e09934fbaba6aa06a8bbbf2f0cc57..46236181f423b16b480ba0276dc2493962967fae 100755 --- a/server.py +++ b/server.py @@ -198,10 +198,11 @@ def course(): return app.view_functions['videos'](), 404 lectures = query('SELECT * FROM lectures WHERE course_id = ? AND (? OR visible)', courses[0]['id'], ismod()) videos = query(''' - SELECT videos.*, formats.description AS format_description + SELECT videos.*, (videos.downloadable AND courses.downloadable) as downloadable, formats.description AS format_description FROM videos JOIN lectures ON (videos.lecture_id = lectures.id) JOIN formats ON (videos.video_format = formats.id) + JOIN courses ON (lectures.course_id = courses.id) WHERE lectures.course_id= ? AND (? OR videos.visible) ORDER BY formats.prio DESC ''', courses[0]['id'], ismod()) @@ -234,14 +235,12 @@ def logout(): def edit(): tabs = { 'courses': ('courses_data', 'id', ['visible', 'listed', 'title', 'short', - 'handle', 'organizer', 'subject', 'credits', 'semester', 'downloadable', + 'handle', 'organizer', 'subject', 'semester', 'downloadable', 'internal', 'responsible']), 'lectures': ('lectures_data', 'id', ['visible', 'title', 'comment', - 'internal', 'speaker', 'place', 'time', 'duration', 'jumplist', - 'titlefile']), + 'internal', 'speaker', 'place', 'time', 'duration', 'jumplist']), 'site_texts': ('site_texts', 'key', ['value']), - 'videos': ('videos_data', 'id', ['visible', 'downloadable', 'title', - 'comment', 'internal']) + 'videos': ('videos_data', 'id', ['visible']) } query('BEGIN TRANSACTION') if request.is_json: diff --git a/templates/course.html b/templates/course.html index 4f2cafc7555543b84f7885d8bf82dad2cac96db1..48483e52e37c97905008981910836c0dabf7d40b 100644 --- a/templates/course.html +++ b/templates/course.html @@ -1,5 +1,6 @@ {% from 'macros.html' import lecture_list_item %} {% from 'macros.html' import valueeditor %} +{% from 'macros.html' import valuecheckbox %} {% from 'macros.html' import preview %} {% extends "base.html" %} {% block content %} @@ -14,6 +15,15 @@ <tr><td>Semester:</td><td>{{ valueeditor(['courses',course.id,'semester'], course.semester) }}</td></tr> <tr><td>Veranstalter:</td><td>{{ valueeditor(['courses',course.id,'organizer'], course.organizer) }}</td></tr> <tr><td>Bemerkungen:</td><td>{{ valueeditor(['courses',course.id,'description'], course.description) }}</td></tr> + {% if ismod() %} + <tr><td>Sichtbar:</td><td>{{ valuecheckbox(['courses',course.id,'visible'], course.visible) }}</td></tr> + <tr><td>Gelistet:</td><td>{{ valuecheckbox(['courses',course.id,'listed'], course.listed) }}</td></tr> + <tr><td>Short:</td><td>{{ valueeditor(['courses',course.id,'short'], course.short) }}</td></tr> + <tr><td>Handle:</td><td>{{ valueeditor(['courses',course.id,'handle'], course.handle) }}</td></tr> + <tr><td>Downloadable:</td><td>{{ valuecheckbox(['courses',course.id,'downloadable'], course.downloadable) }}</td></tr> + <tr><td>Thema:</td><td>{{ valueeditor(['courses',course.id,'subject'], course.subject) }}</td></tr> + <tr><td>Zuständig:</td><td>{{ valueeditor(['courses',course.id,'responsible'], course.responsible) }}</td></tr> + {% endif %} </tbody> </table> </div> diff --git a/templates/macros.html b/templates/macros.html index 07a2e499eb19c5876596250574a4c2fa0ecb79bb..5511ef8333b087c5a443f4c56177b60eb4036eb2 100644 --- a/templates/macros.html +++ b/templates/macros.html @@ -66,7 +66,7 @@ {% endmacro %} {% macro course_list_item(course,show_semester=False) %} -<li class="list-group-item"> +<li class="list-group-item {% if not course.visible %}list-group-item-danger{% endif %}"> <div class="row"> <a href=/course?courseid={{course.handle}}> {% if show_semester %} @@ -94,7 +94,7 @@ <button class="btn btn-primary dropdown-toggle {% if videos|length is equalto 0 %}disabled{% endif %}" type="button" data-toggle="dropdown">Download <span class="caret"></span></button> <ul class="dropdown-menu"> {% for v in videos %} - <li><a href="{{ videoprefix }}/{{v.path}}">{{ valuecheckbox(['videos',v.id,'visible'], v.visible) }} {{v.format_description}} ({{v.file_size|filesizeformat(true)}})</a></li> + {% if v.downloadable %} <li><a href="{{ videoprefix }}/{{v.path}}">{{ valuecheckbox(['videos',v.id,'visible'], v.visible) }} {{v.format_description}} ({{v.file_size|filesizeformat(true)}})</a></li>{% endif %} {% endfor %} </ul> <noscript> @@ -136,7 +136,10 @@ $('#embedcodebtn').popover( <span class="col-sm-4 col-xs-12"> <ul class="list-unstyled"> <li>{{ valueeditor(['lectures',lecture.id,'comment'], lecture.comment) }}</li> - {% if ismod() %}<li>{{ valueeditor(['lectures',lecture.id,'internal'], lecture.internal) }}</li>{% endif %} + {% if ismod() %} + <li>{{ valueeditor(['lectures',lecture.id,'internal'], lecture.internal) }}</li> + <li>Sichtbar: {{ valuecheckbox(['lectures',lecture.id,'visible'], lecture.visible) }}</li> + {% endif %} </ul> </span> <span class="col-sm-3 col-xs-12">