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(): ...@@ -198,10 +198,11 @@ def course():
return app.view_functions['videos'](), 404 return app.view_functions['videos'](), 404
lectures = query('SELECT * FROM lectures WHERE course_id = ? AND (? OR visible)', courses[0]['id'], ismod()) lectures = query('SELECT * FROM lectures WHERE course_id = ? AND (? OR visible)', courses[0]['id'], ismod())
videos = query(''' 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 FROM videos
JOIN lectures ON (videos.lecture_id = lectures.id) JOIN lectures ON (videos.lecture_id = lectures.id)
JOIN formats ON (videos.video_format = formats.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) WHERE lectures.course_id= ? AND (? OR videos.visible)
ORDER BY formats.prio DESC ORDER BY formats.prio DESC
''', courses[0]['id'], ismod()) ''', courses[0]['id'], ismod())
...@@ -234,14 +235,12 @@ def logout(): ...@@ -234,14 +235,12 @@ def logout():
def edit(): def edit():
tabs = { tabs = {
'courses': ('courses_data', 'id', ['visible', 'listed', 'title', 'short', 'courses': ('courses_data', 'id', ['visible', 'listed', 'title', 'short',
'handle', 'organizer', 'subject', 'credits', 'semester', 'downloadable', 'handle', 'organizer', 'subject', 'semester', 'downloadable',
'internal', 'responsible']), 'internal', 'responsible']),
'lectures': ('lectures_data', 'id', ['visible', 'title', 'comment', 'lectures': ('lectures_data', 'id', ['visible', 'title', 'comment',
'internal', 'speaker', 'place', 'time', 'duration', 'jumplist', 'internal', 'speaker', 'place', 'time', 'duration', 'jumplist']),
'titlefile']),
'site_texts': ('site_texts', 'key', ['value']), 'site_texts': ('site_texts', 'key', ['value']),
'videos': ('videos_data', 'id', ['visible', 'downloadable', 'title', 'videos': ('videos_data', 'id', ['visible'])
'comment', 'internal'])
} }
query('BEGIN TRANSACTION') query('BEGIN TRANSACTION')
if request.is_json: if request.is_json:
......
{% from 'macros.html' import lecture_list_item %} {% from 'macros.html' import lecture_list_item %}
{% from 'macros.html' import valueeditor %} {% from 'macros.html' import valueeditor %}
{% from 'macros.html' import valuecheckbox %}
{% from 'macros.html' import preview %} {% from 'macros.html' import preview %}
{% extends "base.html" %} {% extends "base.html" %}
{% block content %} {% block content %}
...@@ -14,6 +15,15 @@ ...@@ -14,6 +15,15 @@
<tr><td>Semester:</td><td>{{ valueeditor(['courses',course.id,'semester'], course.semester) }}</td></tr> <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>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> <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> </tbody>
</table> </table>
</div> </div>
......
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
{% endmacro %} {% endmacro %}
{% macro course_list_item(course,show_semester=False) %} {% 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"> <div class="row">
<a href=/course?courseid={{course.handle}}> <a href=/course?courseid={{course.handle}}>
{% if show_semester %} {% if show_semester %}
...@@ -94,7 +94,7 @@ ...@@ -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> <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"> <ul class="dropdown-menu">
{% for v in videos %} {% 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 %} {% endfor %}
</ul> </ul>
<noscript> <noscript>
...@@ -136,7 +136,10 @@ $('#embedcodebtn').popover( ...@@ -136,7 +136,10 @@ $('#embedcodebtn').popover(
<span class="col-sm-4 col-xs-12"> <span class="col-sm-4 col-xs-12">
<ul class="list-unstyled"> <ul class="list-unstyled">
<li>{{ valueeditor(['lectures',lecture.id,'comment'], lecture.comment) }}</li> <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> </ul>
</span> </span>
<span class="col-sm-3 col-xs-12"> <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