Commit 2f255298 authored by Julian Rother's avatar Julian Rother
Browse files

Added panel type "courses"

parent b5ebed8a
......@@ -14642,7 +14642,7 @@ INSERT INTO "videos_data" VALUES(9680,7011,1,0,1,'','','','pub/16ss-dsal/16ss-ds
INSERT INTO "videos_data" VALUES(9681,7012,1,0,1,'','','','pub/16ss-dsal/16ss-dsal-160715-1080p_1.mp4','2016-08-07 22:54:46','2016-08-07 21:02:37','2016-08-07 21:02:43',46,1402602183,4,'e036f7cbd51afd3ab7be10cf77747c00');
INSERT INTO "videos_data" VALUES(9682,7012,1,0,1,'','','','pub/16ss-dsal/16ss-dsal-160715-360p_1.mp4','2016-08-07 22:45:34','2016-08-07 21:02:38','2016-08-07 21:02:45',46,368611109,10,'fae2bda2da55a3005aa6329a2d0227c3');
INSERT INTO "videos_data" VALUES(9683,7012,1,0,1,'','','','pub/16ss-dsal/16ss-dsal-160715-720p_1.mp4','2016-08-07 22:46:00','2016-08-07 21:02:40','2016-08-07 21:02:44',46,721141077,5,'083c0b7693c82078c513707d1402096b');
INSERT INTO "featured" VALUES(1,'Video AG','<p>Wir machen Vorlesungsvideos, damit du dir deine Vorlesungen angucken kannst, wann, wo und so oft <strong>du</strong> willst ;)</p><p><strong>Probleme?</strong><a href="/faq"> Hier gehts zur FAQ</a></p><p>Wenn du die Videos nützlich fandest, schreib doch bitte den Dozenten eine kurze E-Mail. Waren die Videos grauenhaft? Kritik an uns.</p><p>Wenn du mitmachen willst, Fragen oder Anregungen hast, oder nur mal schauen möchtest, komm zu unserem AG-Treffen oder schreib uns eine E-Mail. Insbesondere freuen wir uns über Studis der Mathematik und Physik, die ihre Vorlesungen filmen wollen.</p>','','plain','',0,1,0,'2017-04-09 19:00:00','2017-04-09 19:00:00',0);
INSERT INTO "featured" VALUES(1,'Video AG','<p>Wir machen Vorlesungsvideos, damit du dir deine Vorlesungen angucken kannst, wann, wo und so oft <strong>du</strong> willst ;)</p><p><strong>Probleme?</strong><a href="/faq"> Hier gehts zur FAQ</a></p><p>Wenn du die Videos nützlich fandest, schreib doch bitte den Dozenten eine kurze E-Mail. Waren die Videos grauenhaft? Kritik an uns.</p><p>Wenn du mitmachen willst, Fragen oder Anregungen hast, oder nur mal schauen möchtest, komm zu unserem AG-Treffen oder schreib uns eine E-Mail. Insbesondere freuen wir uns über Studis der Mathematik und Physik, die ihre Vorlesungen filmen wollen.</p>','','plain','','',0,1,0,'2017-04-09 19:00:00','2017-04-09 19:00:00',0);
INSERT INTO "sqlite_sequence" VALUES('changelog',17859);
INSERT INTO "sqlite_sequence" VALUES('courses_data',303);
INSERT INTO "sqlite_sequence" VALUES('formats',30);
......@@ -222,6 +222,7 @@ CREATE TABLE IF NOT EXISTS `featured` (
`internal` text NOT NULL DEFAULT '',
`type` varchar(32) NOT NULL DEFAULT '',
`param` text NOT NULL DEFAULT '',
`param2` text NOT NULL DEFAULT '',
`order` INTEGER NOT NULL,
`visible` INTEGER NOT NULL DEFAULT 0,
`deleted` INTEGER NOT NULL DEFAULT 0,
......
......@@ -331,6 +331,11 @@ def index():
if featured:
newfeatured = featured[-1]['order'] + 1
featured = list(filter(lambda x: not x['deleted'], featured))
for item in featured:
if item['type'] == 'courses':
if item['param'] not in ['title', 'semester', 'organizer', 'subject']:
continue
item['courses'] = query('SELECT * FROM courses WHERE (? OR (visible AND listed)) AND `%s` = ? ORDER BY `%s`'%(item['param'], item['param']), ismod(), item['param2'])
return render_template('index.html', latestvideos=livestreams+latestvideos, upcomming=upcomming, featured=featured, newfeatured=newfeatured)
@app.route('/course')
......@@ -496,7 +501,7 @@ tabs = {
'announcements': ('announcements', 'id', ['text', 'level', 'visible',
'deleted', 'time_publish', 'time_expire'],
['created_by', 'time_created', 'time_updated']),
'featured': ('featured', 'id', ['title', 'text', 'internal', 'visible', 'deleted', 'param', 'order'],
'featured': ('featured', 'id', ['title', 'text', 'internal', 'visible', 'deleted', 'param', 'param2', 'order'],
['created_by', 'time_created', 'time_updated', 'type', 'order']),
'perm': ('perm', 'id', ['type', 'param1', 'param2', 'deleted'],
['course_id', 'lecture_id', 'video_id', 'created_by', 'time_created', 'time_updated']),
......
{% from 'macros.html' import preview %}
{% from 'macros.html' import preview, course_list_item %}
{% extends "base.html" %}
{% set page_border = 0 %}
{% if ismod() %}
......@@ -59,6 +59,7 @@
<ul class="dropdown-menu">
<li><a href="{{ url_for('create', table='featured', title='Neues Panel', type='plain', ref=request.url, order=newfeatured) }}">Nur Text</a></li>
<li><a href="{{ url_for('create', table='featured', title='Neues Panel', type='image', ref=request.url, order=newfeatured) }}">Text mit Bild</a></li>
<li><a href="{{ url_for('create', table='featured', title='Neues Panel', type='courses', param='semester', param2='', ref=request.url, order=newfeatured) }}">Veranstaltungsliste</a></li>
</ul>
</div>
</li>
......@@ -101,6 +102,20 @@
{{ moderator_editor(('featured',item.id,'text'), item.text) }}
</div>
{% endif %}
{% if item.type == 'courses' %}
<ul class="courses-list list-group">
{% for i in item.courses %}
{{ course_list_item(i) }}
{% endfor %}
</ul>
<div class="panel-footer">
{% if ismod() %}
<p>Kategorie: {{ moderator_editor(('featured',item.id,'param'), item.param) }}</p>
<p>Parameter: {{ moderator_editor(('featured',item.id,'param2'), item.param2) }}</p>
{% endif %}
Die vollständige Liste findest du <a href="{{ url_for('courses') }}">hier</a>.
</div>
{% endif %}
</div>
{% endfor %}
</div>
......
Supports Markdown
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