From 79faf3c02a54ae9b835ab1f8cf0e674490ddd899 Mon Sep 17 00:00:00 2001
From: Andreas Valder <andreasv@fsmpi.rwth-aachen.de>
Date: Fri, 2 Sep 2016 00:17:48 +0200
Subject: [PATCH] started a campus import

---
 server.py                    |  8 ++++++++
 templates/course_id.html     |  2 +-
 templates/import_campus.html | 13 +++++++++++++
 templates/log.html           |  2 +-
 4 files changed, 23 insertions(+), 2 deletions(-)
 create mode 100644 templates/import_campus.html

diff --git a/server.py b/server.py
index 0bb8945..d4208fd 100755
--- a/server.py
+++ b/server.py
@@ -298,3 +298,11 @@ def stats():
 def log():
 	changelog = query('SELECT *, ( "table" || "." || id_value || "." ||field) as path FROM changelog LEFT JOIN users ON (changelog.who = users.id) ORDER BY "when" DESC LIMIT 50')
 	return render_template('log.html', changelog=changelog)
+
+@app.route('/import/<source>/<id>')
+@app.route('/import/<source>/<int:numid>')
+@handle_errors('course', 'Diese Veranstaltung existiert nicht!', 404, IndexError)
+def import_from(numid=None, source=None, id=None):
+	if source != "campus":
+		return "Unknown source", 404
+	return render_template('import_campus.html')
diff --git a/templates/course_id.html b/templates/course_id.html
index 1b1a4e6..c023a5f 100644
--- a/templates/course_id.html
+++ b/templates/course_id.html
@@ -31,7 +31,7 @@
 </div>
 <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="todo">Neuer Termin</a>{% endif %}</h1>
+		<h1 class="panel-title">Videos{% if ismod() %} <a class="btn btn-default" style="margin-right: 5px;" href="todo">Neuer Termin</a><a class="btn btn-default" style="margin-right: 5px;" href="{{url_for('import_from', source="campus", id=course['id'])}}">Campus Import</a>{% endif %}</h1>
 	</div>
 	<ul class="list-group lectureslist">
 		{% for l in lectures %}
diff --git a/templates/import_campus.html b/templates/import_campus.html
new file mode 100644
index 0000000..4a41aa4
--- /dev/null
+++ b/templates/import_campus.html
@@ -0,0 +1,13 @@
+{% from 'macros.html' import preview %}
+{% extends "base.html" %}
+{% block content %}
+<div class="panel-group">
+	<div class="panel panel-default">
+		<div class="panel-heading">
+			<h1 class="panel-title">Campus Import</h1>
+		</div>
+		<div class="panel-body">
+		</div>
+	</div>
+</div>
+{% endblock %}
diff --git a/templates/log.html b/templates/log.html
index 1cc220e..e2551a3 100644
--- a/templates/log.html
+++ b/templates/log.html
@@ -19,7 +19,7 @@
 				{% for i in changelog %}
 					<tr>
 						<td>{{i.when}}</td>
-						<td>{% if (i.who != i.who|string) %}{{i.realname}}{% else %}{{i.who}}{%endif%}</td>
+						<td>{% if (i.who != i.who|string) %}{{i.realname}} ({{i.who}}){% else %}{{i.who}}{%endif%}</td>
 						<td>{{i.path}}</td>
 						<td>"{{i.value_old}}"</td>
 						<td>"{{i.value_new}}"</td>
-- 
GitLab