Commit 97116c3a authored by Andreas Valder's avatar Andreas Valder

added gui integration for ical export

parent 7abb816f
......@@ -47,14 +47,18 @@ def calperm(func):
@app.route('/internal/ical/semester/<semester>')
@calperm
def ical_semester(semester):
return export_lectures(query('SELECT lectures.* FROM lectures JOIN courses ON courses.id = lectures.course_id WHERE courses.semester = ? AND lectures.visible = 1', semester),'videoag_semester_'+semester+'.ics')
if semester == 'zeitlos':
semester_q = ''
else:
semester_q = semester
return export_lectures(query('SELECT lectures.* FROM lectures JOIN courses ON courses.id = lectures.course_id WHERE courses.semester = ? AND lectures.visible = 1', semester_q),'videoag_semester_'+semester+'.ics')
@app.route('/internal/ical/all')
@calperm
def ical_all():
return export_lectures(query('SELECT lectures.* FROM lectures lectures.visible = 1', semester),'videoag_all.ics')
@app.route('/internal/ical/handle/<course>')
@app.route('/internal/ical/course/<course>')
@calperm
def ical_course(course):
return export_lectures(query('SELECT lectures.* FROM lectures JOIN handles ON courses.id = lectures.course_id WHERE courses.handle = ? AND lectures.visible = 1', course),'videoag_course_'+course+'.ics')
return export_lectures(query('SELECT lectures.* FROM lectures JOIN courses ON courses.id = lectures.course_id WHERE courses.handle = ? AND lectures.visible = 1', course),'videoag_course_'+course+'.ics')
......@@ -75,7 +75,21 @@
<div class="panel panel-default">
<div class="panel-heading">
<h1 class="panel-title">Videos{% if ismod() %} <a class="btn btn-default" style="margin-right: 5px;" href="{{ url_for('create', table='lectures', time=datetime.now(), title='Noch kein Titel', visible='0', course_id=course.id, ref=url_for('course', id=course.id)) }}">Neuer Termin</a><a class="btn btn-default" style="margin-right: 5px;" href="{{url_for('list_import_sources', id=course['id'])}}">Campus Import</a>{% endif %} <a class="fa fa-rss-square pull-right" aria-hidden="true" href="{{url_for('feed', handle=course.handle)}}" style="text-decoration: none"></a> </h1>
<h1 class="panel-title">Videos
{% if ismod() %}
<a class="btn btn-default" style="margin-right: 5px;" href="{{ url_for('create', table='lectures', time=datetime.now(), title='Noch kein Titel', visible='0', course_id=course.id, ref=url_for('course', id=course.id)) }}">Neuer Termin</a>
<a class="btn btn-default" style="margin-right: 5px;" href="{{url_for('list_import_sources', id=course['id'])}}">Campus Import</a>
{% endif %}
<ul class="list-inline pull-right">
<li>
<a class="fa fa-rss-square" aria-hidden="true" href="{{url_for('feed', handle=course.handle)}}" style="text-decoration: none"></a>
</li>
{% if ismod() %}
<li>
<a class="fa fa-calendar" aria-hidden="true" href="{{url_for('ical_course', course=course.handle)}}" style="text-decoration: none"></a>
</li>
{% endif %}
</h1>
</div>
<ul class="list-group lectureslist">
{% for l in lectures %}
......
......@@ -8,6 +8,9 @@
<a class="fa fa-rss-square btn btn-default" aria-hidden="true" href="{{url_for('courses_feed')}}" style="text-decoration: none"></a>
</li>
{% if ismod() %}
<li>
<a class="fa fa-calendar btn btn-default" aria-hidden="true" href="{{url_for('ical_all')}}" style="text-decoration: none"></a>
</li>
<li>
{% set newhandle = 'new'+(randint(0,1000)|string) %}
<a class="btn btn-default" href="{{ url_for('create', table='courses', handle=newhandle, title='Neue Veranstaltung', responsible=session.user.givenName, ref=url_for('course', handle=newhandle)) }}">Neue Veranstaltung</a>
......@@ -56,7 +59,16 @@
<div class="panel-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion-{{ g.grouper|tagid }}" href="#{{g.grouper|tagid}}" style="color: #222;">
{% if groupedby == 'semester' %}
<h1 class="panel-title">{{g.grouper|semester(long=True)}} ({{g.list|length}} Veranstaltungen)</h1>
<h1 class="panel-title">{{g.grouper|semester(long=True)}} ({{g.list|length}} Veranstaltungen)
<ul class="list-inline pull-right">
{% if ismod() %}
<li>
<a class="fa fa-calendar" aria-hidden="true" href="{{url_for('ical_semester', semester=g.grouper)}}" style="text-decoration: none"></a>
</li>
{% endif %}
</ul>
</h1>
{% else %}
<h1 class="panel-title">{{g.grouper}}</h1>
{% endif %}
......
......@@ -3,7 +3,9 @@
<div class="panel-group" id="accordion">
<div class="panel panel-default">
<div class="hidden-print panel-heading">
<h1 class="panel-title">Drehplan</h1>
<h1 class="panel-title">Drehplan
<a class="pull-right fa fa-calendar" aria-hidden="true" href="{{url_for('ical_all')}}" style="text-decoration: none"></a>
</h1>
</div>
<div class="row hidden-print">
<div style="margin-top: 10px;" class="col-xs-12">
......
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