Skip to content
Snippets Groups Projects
Commit bba69c3c authored by Andreas Valder's avatar Andreas Valder
Browse files

more moderator functions

parent a86e3bcf
No related branches found
No related tags found
No related merge requests found
......@@ -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:
......
{% 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>
......
......@@ -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">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment