summaryrefslogtreecommitdiffstats
path: root/app/templates
diff options
context:
space:
mode:
Diffstat (limited to 'app/templates')
-rw-r--r--app/templates/403.html20
-rw-r--r--app/templates/index.html20
-rw-r--r--app/templates/layout.html61
-rw-r--r--app/templates/module_list.html15
-rw-r--r--app/templates/module_show.html30
-rw-r--r--app/templates/upload.html80
6 files changed, 226 insertions, 0 deletions
diff --git a/app/templates/403.html b/app/templates/403.html
new file mode 100644
index 0000000..5f2317f
--- /dev/null
+++ b/app/templates/403.html
@@ -0,0 +1,20 @@
+{% extends "layout.html" %}
+{% block body %}
+<h2>Fehler 403 - Zugang verboten</h2>
+
+<p>
+ Du versucht auf Daten zuzugreifen, die nur aus dem Netz der Freien Universität
+ Berlin erreichbar sind.<br />
+ Um dennoch an die Daten zu kommen, kannst du mittels sogenannter
+ VPN-Verbindung, einem Proxy oder einem SSH-Tunnel dich in das Uni-Netz einwählen.
+</p>
+
+<p>
+ Für weitere Informationen siehe folgende Links:
+</p>
+<ul>
+ <li><a href="http://www.spline.de/howtos/sshtunnel/">SSH Tunnel</a></li>
+ <li><a href="http://www.zedat.fu-berlin.de/VPNOverview">Zedat VPN</a></li>
+ <li><a href="http://www.zedat.fu-berlin.de/Proxy-Server">Zedat Proxy</a></li>
+</ul>
+{% endblock %}
diff --git a/app/templates/index.html b/app/templates/index.html
new file mode 100644
index 0000000..14b7fde
--- /dev/null
+++ b/app/templates/index.html
@@ -0,0 +1,20 @@
+{% extends "layout.html" %}
+{% block body %}
+ <h2>Studiengänge</h2>
+
+ <div id="studies">
+ <ul id="studies">
+ {% for name,img_path in studies|sort %}
+ <li>
+ <a href="{{url_for('study_index', study=name)}}">
+ <img src="{{url_for('static',filename=img_path)}}" alt="{{name}}" />
+ {{name.capitalize()}}
+ </a>
+ </li>
+ {% else %}
+ <li>Keine Studiengänge konfiguriert!</li>
+ {% endfor %}
+ </ul>
+ </div>
+
+{% endblock %}
diff --git a/app/templates/layout.html b/app/templates/layout.html
new file mode 100644
index 0000000..4de48c8
--- /dev/null
+++ b/app/templates/layout.html
@@ -0,0 +1,61 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8" />
+ <link rel="stylesheet" type="text/css" media="all" href="{{url_for('static',
+ filename='style_v3.css')}}" />
+ <script type="text/javascript" src="{{url_for('static',filename='jquery-1.8.0.min.js')}}"></script>
+ <title>Fit</title>
+ </head>
+ <body>
+ <div id="header">
+ <h1><a href="/">Archiv</a><small> @ spline</small></h1>
+ {% if study %}
+ <p>
+ <b>Tip</b>: Du kannst alle Klausuren auch als
+ {% set path = 'studies/' + study %}
+ <a href="{{url_for('static', filename=path + '.zip')}}">ZIP</a>- oder
+ <a href="{{url_for('static', filename=path + '.tar.gz')}}">TAR-GZ</a>-Archiv, sowie via
+ <a href="{{url_for('static', filename=path + '.git')}}">git</a> herunterladen
+ </p>
+ {% endif %}
+ </div>
+
+ <div id="content">
+
+ <div id="sub-header">
+ {% if study %}
+ <p>
+ {% if not request.base_url.endswith(url_for('upload', study=study, module = module))%}
+ {% if not request.base_url.endswith(url_for('forbidden')) %}
+ <a href="{{url_for('upload', study=study, module=module)}}">neue Klausur hochladen</a>
+ {% endif %}
+ {% else %}
+ <a href="{{url_for('study_index', study=study, module=module)}}">zurück</a>
+ {% endif %}
+ </p>
+ <h2><a href="{{url_for('study_index', study=study)}}">{{study.capitalize()}}</a></h2>
+ {% endif %}
+
+ <ul class="flashes">
+ {% with messages = get_flashed_messages() %}
+ {% for message in messages %}
+ <li>{{ message }}</li>
+ {% endfor %}
+ {% endwith %}
+ </ul>
+ </div>
+
+ {% block body %}{% endblock %}
+
+ </div>
+
+ <footer>
+ <a href="https://github.com/libgit2/libgit2">libgit2</a>
+ |
+ <a href="https://gitlab.spline.inf.fu-berlin.de/cholin/klausuren">source</a>
+ |
+ <a href="https://github.com/libgit2/pygit2">pygit2</a>
+ </footer>
+ </body>
+</html>
diff --git a/app/templates/module_list.html b/app/templates/module_list.html
new file mode 100644
index 0000000..2b36f30
--- /dev/null
+++ b/app/templates/module_list.html
@@ -0,0 +1,15 @@
+{% extends "layout.html" %}
+{% block body %}
+ <h3>Klausuren</h3>
+
+ <ul>
+ {% for module in modules %}
+ <li>
+ <a href="{{url_for('study_index', study = study, module=module)}}">{{module}}</a>
+ </li>
+ {% else %}
+ <li>Keine Klausuren bisher hochgeladen!</li>
+ {% endfor %}
+ </ul>
+
+{% endblock %}
diff --git a/app/templates/module_show.html b/app/templates/module_show.html
new file mode 100644
index 0000000..cbaec74
--- /dev/null
+++ b/app/templates/module_show.html
@@ -0,0 +1,30 @@
+{% macro render_module_list(module) %}
+<ul id="module-list">
+{% for year,files in module %}
+ <li>
+ {{year}}
+ <ul>
+ {% for name,oid in files %}
+ <li>
+ <a href="{{url_for('study_show', study = study, oid=oid, filename=name)}}">
+ {{name|truncate(40,True)}}
+ </a>
+ </li>
+ {% endfor %}
+ </ul>
+ </li>
+{% else %}
+ <li>Keine Einträge bisher</li>
+{% endfor %}
+</ul>
+{% endmacro %}
+
+{% extends "layout.html" %}
+{% block body %}
+ <div id="module-index">
+ <h3>{{module}}</h3>
+
+ {{ render_module_list(entries)}}
+ </div>
+
+{% endblock %}
diff --git a/app/templates/upload.html b/app/templates/upload.html
new file mode 100644
index 0000000..8683be0
--- /dev/null
+++ b/app/templates/upload.html
@@ -0,0 +1,80 @@
+{% macro render_fields(field, extra_field) %}
+ <p>
+ <label>{{ field.label }}</label>
+ {{ field|safe }}
+
+ {% if extra_field %}
+ {{extra_field(**kwargs)|safe}}
+ {% endif %}
+
+ {% if field.errors or extra_field.errors %}
+ <span class="error">
+ {% for error in field.errors %}{{ error }}{% endfor %}
+ {% for error in extra_field.errors %}{{ error }}{% endfor %}
+ </span>
+ {% endif %}
+ </p>
+{% endmacro %}
+
+{% macro render_field(field) %}
+ {{ render_fields(field, None) }}
+{% endmacro %}
+
+{% extends "layout.html" %}
+{% block body %}
+ <h3>neue Klausur hochladen</h3>
+
+ <div id="upload">
+ <form method="POST" enctype="multipart/form-data"
+ action="{{url_for('upload', study=study, module=module)}}">
+ {{ form.csrf_token }}
+
+ {{ render_field(form.exam) }}
+ {{ render_fields(form.module, form.module_new, placeholder='Modulname') }}
+ {{ render_field(form.year) }}
+
+ <p>
+ <input type="submit" value="Hochladen" />
+ </p>
+ </form>
+
+ <div id="module-index"></div>
+ </div>
+
+ <script type="text/javascript">
+ $(document).ready(function() {
+ var elem = $('#module_new');
+ var module = $('#module');
+
+ var update_modules = function() {
+ var text = module.find("option:selected").text();
+ $.get('/{{study}}/modules/' + text, function(data) {
+ $('#module-index').replaceWith($(data).find('#module-index'));
+ });
+ };
+
+ update_modules();
+
+ if(module.val() != 'new')
+ elem.hide();
+
+ module.change(function(){
+ var current = $(this);
+ var value = current.val();
+ var text = current.find("option:selected").text();
+
+ if(value == 'new') {
+ $('#module-index').fadeOut('fast', function() { elem.fadeIn(); });
+ } else {
+ elem.fadeOut('fast', function() {
+ if(value != '')
+ update_modules();
+ else
+ $('#module-index').fadeOut('fast');
+ });
+
+ }
+ });
+ });
+ </script>
+{% endblock %}