Commit 7f552070 authored by Andreas Valder's avatar Andreas Valder
Browse files

more work on campus import

parent 79faf3c0
......@@ -113,10 +113,10 @@ def course():
@handle_errors('course', 'Diese Veranstaltung existiert nicht!', 404, IndexError)
def course_id(numid=None, id=None):
if numid:
courses = query('SELECT * FROM courses WHERE id = ? AND (? OR visible)', numid, ismod())
courses = query('SELECT * FROM courses WHERE id = ? AND (? OR visible)', numid, ismod())[0]
else:
courses = query('SELECT * FROM courses WHERE handle = ? AND (? OR visible)', id, ismod())
lectures = query('SELECT * FROM lectures WHERE course_id = ? AND (? OR visible)', courses[0]['id'], ismod())
courses = query('SELECT * FROM courses WHERE handle = ? AND (? OR visible)', id, ismod())[0]
lectures = query('SELECT * FROM lectures WHERE course_id = ? AND (? OR visible)', courses['id'], ismod())
videos = query('''
SELECT videos.*, (videos.downloadable AND courses.downloadable) as downloadable, formats.description AS format_description
FROM videos
......@@ -125,8 +125,8 @@ def course_id(numid=None, id=None):
JOIN courses ON (lectures.course_id = courses.id)
WHERE lectures.course_id= ? AND (? OR videos.visible)
ORDER BY lectures.time, formats.prio DESC
''', courses[0]['id'], ismod())
return render_template('course_id.html', course=courses[0], lectures=lectures, videos=videos)
''', courses['id'], ismod())
return render_template('course_id.html', course=courses, lectures=lectures, videos=videos)
@app.route('/faq')
@register_navbar('FAQ', icon='question-sign')
......@@ -302,7 +302,13 @@ def log():
@app.route('/import/<source>/<id>')
@app.route('/import/<source>/<int:numid>')
@handle_errors('course', 'Diese Veranstaltung existiert nicht!', 404, IndexError)
@mod_required
def import_from(numid=None, source=None, id=None):
if source != "campus":
return "Unknown source", 404
return render_template('import_campus.html')
if numid:
courses = query('SELECT * FROM courses WHERE id = ?', numid)[0]
else:
courses = query('SELECT * FROM courses WHERE handle = ?', id)[0]
lectures = query('SELECT * FROM lectures WHERE course_id = ?', courses['id'])
return render_template('import_campus.html', course=courses, lectures=lectures)
......@@ -4,9 +4,30 @@
<div class="panel-group">
<div class="panel panel-default">
<div class="panel-heading">
<h1 class="panel-title">Campus Import</h1>
<h1 class="panel-title">Campus Import für <strong>{{course.title}}</strong> <span><a href="{{url_for('course_id', numid=course.id)}}" class="btn btn-default" >Zur Veranstaltungsseite</a><span> </h1>
</div>
<div class="panel-body">
<div>
<p>Es folgen viele Pärchen an Campus-URL und Veranstaltungstyp Pärchen. Die Campus URL bekommt man aus dem Campus-System (<a href="https://www.campus.rwth-aachen.de/rwth/all/groups.asp">hier</a>). Der Veranstaltungstyp ist z.B. "Vorlesung" oder "Übung" oder "Praktikum".
</p>
<ul class="list-group row">
<li class="list-group-item form-inline">
<span class="input-group">
<input class="form-control" type="text" placeholder="url">
</span>
<span class="input-group">
<input class="form-control" type="test" placeholder="typ">
</span>
</li>
</ul>
<a class="btn btn-default pull-right">speichern und neu Laden</a>
</div>
<div>
<ul class="list-group row">
{% for i in imports %}
{% endfor %}
</ul>
</div>
</div>
</div>
</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