Commit bf07427b authored by Christoph's avatar Christoph

Merge remote-tracking branch 'origin/themesupport'

parents 5c2a044f fe92cd47
......@@ -25,4 +25,28 @@ sendmails = True
pdf2txt = "pdf2txt"
## config for by-url theme-selection
themes_by_url = [ ("eva.fsi.informatik.uni-erlangen.de", "fsi_inf")
, ("www.eva.fsi.informatik.uni-erlangen.de", "fsi_inf")
, ("eva.fsi.cs.fau.de", "fsi_inf")
, ("www.eva.fsi.cs.fau.de", "fsi_inf")
, ("eva.fsi.mb.fau.de", "fsi_mb")
, ("www.eva.fsi.mb.fau.de", "fsi_mb")
, ("eva.fsi.mb.uni-erlangen.de", "fsi_mb")
, ("www.eva.fsi.mb.uni-erlangen.de", "fsi_mb")
, ("eva.mb.fsi.fau.de", "fsi_mb")
, ("www.eva.mb.fsi.fau.de", "fsi_mb")
, ("eva.mb.fsi.uni-erlangen.de", "fsi_mb")
, ("www.eva.mb.fsi.uni-erlangen.de", "fsi_mb")
, ("eva.fachschaft.techfak.fau.de", "fsv_tech")
, ("www.eva.fachschaft.techfak.fau.de", "fsv_tech")
, ("eva.fachschaft.techfak.uni-erlangen.de", "fsv_tech")
, ("www.eva.fachschaft.techfak.uni-erlangen.de", "fsv_tech")
]
default_theme = "fsi_inf"
from config.local import *
=== geschichte ===
bis WS2014/15 war die fsi-eva ein fsi-inf-projekt, und die entsprechende
"corporate identity" war einfach mit eingeflochten.
dann kamen die maschinenbauer und haben gefragt, ob sie
mit{machen,benutzen} können. zuerst war die idee, unter
eva.mb.fsi.fau.de (oder ähnlicher subdomain) eine zweite instanz
aufzusetzen. dann kam man aber drauf, dass man sowieso dinge wie ggs.
exportveranstaltungen verlinken wollen würde, und es viel sinnvoller
wäre, ein gemeinsames portal zu haben, mit verschiedenen ansichten.
=== theme-orte ===
an verschiedenen orten war zum zeitpunkt als ich theme-zeug eingebaut
hab fsi-inf-spezifisches design im rest verwoben. die idee war, das
durch entsprechend <theme-name>/<urspruenglicher-datei-name> zu
ersetzen, so dass es jetzt kein style.css mehr sondern ein
fsi_inf/style.css gibt.
== übersicht ==
* static/style.css -> static/$theme/style.css
* web/templates/(.*).xml -> web/templates/$theme/$1.xml
ich hab's mittlerweile so gebaut, dass für $theme zuerst in
web/templates/$theme/$file geschaut wird, und dann in web/templates/$file
(geht nicht für static-zeugs, das wird nicht vom gleichen loader geladen)
=== neues theme ===
* web/templates/$theme/header.xml anlegen
* static/$theme/style.css anlegen
* in web/templates/faq.xml stehen bisher hardcoded fsi-inf und fsi-mb
adressen; man kann aber im theme eigene faq.xml bauen, die nur passende™
adressen enthalten
--dario 2015-07-19
......@@ -94,7 +94,7 @@ a {
}
a:hover, .fat a:hover {
backgorund-color: inherit;
background-color: inherit;
color: #000;
}
......@@ -118,7 +118,7 @@ ul {
ul.head_navigation, ul.head_subnavigation
{
border-left: 1px solid #000;
border-right: solid 1px #666;
border-right: 1px solid #666;
margin: 0;
padding: 0;
display: inline-block;
......@@ -464,4 +464,8 @@ ul#entries a span.state, ul#latest a span.state {
padding: 0px;
}
label {
display: inline-block;
}
/* vim: set expandtab shiftwidth=2 tabstop=2: */
This diff is collapsed.
......@@ -81,7 +81,7 @@ $(document).ready(function(){
$(".search").keyup(function() {
setTimeout(handle_search, 0);
});*/
$(".sem").each(function() {
$("ul:not(#latest) .sem").each(function() {
var id = this.parentNode.querySelector("a").getAttribute("xcatid");
if(entries[id]) {
this.parentNode.querySelector("a span").innerHTML = "&#x25B2;";
......@@ -92,10 +92,12 @@ $(document).ready(function(){
$("#shwall").click(function(ev) {
ev.preventDefault();
$(".sem").toggle(true);
$("ul:not(#latest) .sem").toggle(true);
$("#entries li a span").html("&#x25B2;");
for(var i=0; i < $(".sem").length; i++) {
entries[i] = true;
var itms = $(".sem");
for(var i=0; i < itms.length; i++) {
var id = itms[i].parentNode.querySelector("a").getAttribute("xcatid");
entries[id] = true;
}
localStorage.setItem('entries-'+mode, JSON.stringify(entries));
return true;
......@@ -104,7 +106,7 @@ $(document).ready(function(){
$("#collall").click(function(ev) {
ev.preventDefault();
$("#entries li a span").html("&#x25BC;");
$(".sem").toggle(false);
$("ul:not(#latest) .sem").toggle(false);
entries = [];
localStorage.setItem('entries-'+mode, JSON.stringify(entries));
});
......
#!/usr/bin/python
# -*- coding: utf-8 -*-
from jinja2 import Environment, FileSystemLoader
from jinja2 import Environment, FileSystemLoader, BaseLoader
from jinja2.exceptions import TemplateNotFound
from werkzeug import Local, LocalManager, Response
from werkzeug.routing import Map, Rule
from werkzeug.exceptions import BadRequest
import os
import util.gitVersion
import util.univis
import config
......@@ -23,13 +27,21 @@ def expose(rule, **kw):
def url_for(endpoint, _external=False, **values):
return local.url_adapter.build(endpoint, values, force_external=_external)
def theme_for_url(url):
for k, v in config.themes_by_url:
if k == url:
return v
return config.default_theme
def render_template(template, **context):
try:
context['git_commit'] = util.gitVersion.gitVersion(config.basedir)
except:
pass
return Response(jinja_env.get_template(template).render(**context),
mimetype='application/xhtml+xml')
mimetype='application/xhtml+xml')
def profify(name, title):
......@@ -73,8 +85,24 @@ def update_meta_from_request(metadata, form):
return metadata
jinja_env = Environment(loader=FileSystemLoader(config.templates))
class ThemeSupportTemplateLoader(BaseLoader):
def __init__(self, themes):
self.loaders = dict([
(theme, FileSystemLoader(os.path.join(config.templates, theme))) \
for theme in themes])
self.default_loader = FileSystemLoader(config.templates)
def get_source(self, environment, template):
theme = local.theme
try:
return self.loaders[theme].get_source(environment, template)
except TemplateNotFound:
return self.default_loader.get_source(environment, template)
available_themes = [it[1] for it in config.themes_by_url]
jinja_env = Environment(loader=ThemeSupportTemplateLoader(available_themes), cache_size=0)
jinja_env.globals['url_for'] = url_for
jinja_env.filters['profify'] = profify
jinja_env.filters['univislink'] = util.univis.generate_univis_link
......
......@@ -43,6 +43,7 @@ class Eva(object):
local.application = self
request = Request(environ)
local.url_adapter = adapter = url_map.bind_to_environ(environ)
local.theme = theme_for_url(request.host)
if os.path.exists(os.path.join(config.basedir, 'UPGRADE_IN_PROGRESS')):
with open(os.path.join(config.basedir, 'UPGRADE_IN_PROGRESS'), 'r') as f:
......@@ -60,4 +61,5 @@ class Eva(object):
return ClosingIterator(response(environ, start_response),
[local_manager.cleanup])
# vim: set expandtab tabstop=4 shiftwidth=4:
......@@ -3,7 +3,7 @@
<head>
<title>{{title}} « Lehrevaluationen</title>
{% block css %}
<link href="{{ url_for('static', file='style.css') }}" type="text/css" rel="stylesheet" />
<link href="{{ url_for('static', file='%s/style.css' % theme) }}" type="text/css" rel="stylesheet" />
<link href="{{ url_for('static', file='jquery-ui.css') }}" type="text/css" rel="stylesheet" />
{% endblock %}
{% block js %}
......@@ -20,19 +20,7 @@
<div id="topofthepops">
<div id="floppy">
<div id="content">
<div id="head_logo">
<a href="/">
<img src="https://fsi.informatik.uni-erlangen.de/forum/unb_lib/designs/fsi-wide/img/logo.png" alt="FSI Informatik"/>
</a>
</div>
<div class="head_navigation_container">
<ul class="head_navigation">
<li><a href="/">Lehrevaluationen</a></li>
<li><a href="{{ url_for('faq') }}">FAQ</a></li>
<li class="extern"><a href="https://fsi.informatik.uni-erlangen.de/">zur Website</a></li>
<li class="extern"><a href="https://fsi.informatik.uni-erlangen.de/forum/">zum Forum</a></li>
</ul>
</div>
{% include 'header.xml' %}
{% if subentries %}
<div class="head_subnavigation_container">
<ul class="head_subnavigation">
......
......@@ -17,10 +17,12 @@
<h4>Wie sende ich meine Evaluation ein?</h4>
<p>
Evaluationen können einfach per E-Mail
an <a href="mailto:eva-submit-full@fsi.cs.fau.de">eva-submit-full@fsi.cs.fau.de</a>
an <a href="mailto:eva-submit-full@fsi.cs.fau.de">eva-submit-full@fsi.cs.fau.de</a> (Informatik) oder
an <a href="mailto:fsi-mb-eva-submit-full@fau.de">fsi-mb-eva-submit-full@fau.de</a> (Maschinenbau)
eingereicht werden. Sollen die Freitextkommentare <emph>nicht</emph>
mit ver&ouml;ffentlicht werden, muss die E-Mail stattdessen
an <a href="mailto:eva-submit-full@fsi.cs.fau.de">eva-submit-trimmed@fsi.cs.fau.de</a>
an <a href="mailto:eva-submit-full@fsi.cs.fau.de">eva-submit-trimmed@fsi.cs.fau.de</a> (Informatik) bzw.
<a href="mailto:fsi-mb-eva-submit-trimmed@fau.de">fsi-mb-eva-submit-trimmed@fau.de</a> (Maschinenbau)
gesendet werden. Hierbei müssen Sie unbedingt Ihre E-Mail-Adresse der
FAU als Absender verwenden. Optional ist es möglich in der E-Mail
noch Anmerkungen mitzuschicken, welche dann mit angezeigt werden.
......@@ -31,7 +33,10 @@
Bevor eine Evaluation freigeschaltet wird, prüfen wir den Absender
und Inhalt der Evaluation. Sollten Sie eine Evaluation finden die
nicht von Ihnen stammt, wenden Sie sich bitte
an <a href="mailto:eva-admin@fsi.cs.fau.de">eva-admin@fsi.cs.fau.de</a>.
an <a href="mailto:eva-admin@fsi.cs.fau.de">eva-admin@fsi.cs.fau.de</a>
(Informatik und allgemeine technische Fragen) oder <a
href="mailto:fsi-mb-eva-admins@fau.de">fsi-mb-eva-admins@fau.de</a>
(Maschinenbau).
</p>
<h4>Wer kann Evaluationen einsenden?</h4>
......
<!-- FSI Inf header -->
<div id="head_logo">
<a href="/">
<img src="https://fsi.informatik.uni-erlangen.de/forum/unb_lib/designs/fsi-wide/img/logo.png" alt="FSI Informatik"/>
</a>
</div>
<div class="head_navigation_container">
<ul class="head_navigation">
<li><a href="/">Lehrevaluationen</a></li>
<li><a href="{{ url_for('faq') }}">FAQ</a></li>
<li class="extern"><a href="https://fsi.informatik.uni-erlangen.de/">zur Website</a></li>
<li class="extern"><a href="https://fsi.informatik.uni-erlangen.de/forum/">zum Forum</a></li>
</ul>
</div>
<!-- FSI MB header -->
<div id="head_logo">
<a class="home-link" href="/" rel="home">
<h1 class="site-title">Evaluationsportal</h1>
<h2 class="site-description">Fachschaftinitiative Maschinenbau der FAU Erlangen-N&uuml;rnberg</h2>
</a>
</div>
<div class="head_navigation_container">
<ul class="head_navigation">
<li><a href="/">Lehrevaluationen</a></li>
<li><a href="{{ url_for('faq') }}">FAQ</a></li>
<li class="extern"><a href="http://fsi.mb.fau.de">FSI Maschinenbau</a></li>
</ul>
</div>
......@@ -62,6 +62,21 @@
<label for="course INF BA">
<input type="checkbox" id="course INF BA" name="course" value="INF-BA" onclick="this.form.submit()" {% if "INF-BA" in courses %}checked="checked"{% endif %}/>Bachelor Informatik
</label>
<label for="course MB BA">
<input type="checkbox" id="course MB BA" name="course" value="MB-BA" onclick="this.form.submit()" {% if "MB-BA" in courses or "ALL" in courses %}checked="checked"{% endif %}/>Bachelor Maschinenbau
</label>
<label for="course MB MA">
<input type="checkbox" id="course MB MA" name="course" value="MB-MA" onclick="this.form.submit()" {% if "MB-MA" in courses or "ALL" in courses %}checked="checked"{% endif %}/>Master Maschinenbau
</label>
<label for="course WING BA">
<input type="checkbox" id="course WING BA" name="course" value="WING-BA" onclick="this.form.submit()" {% if "WING-BA" in courses or "ALL" in courses %}checked="checked"{% endif %}/>Bachelor Wirtschaftsingeneurwesen (WING)
</label>
<label for="course WING MA">
<input type="checkbox" id="course WING MA" name="course" value="WING-MA" onclick="this.form.submit()" {% if "WING-MA" in courses or "ALL" in courses %}checked="checked"{% endif %}/>Master Wirtschaftsingeneurwesen (WING)
</label>
<label for="course IP BA">
<input type="checkbox" id="course IP BA" name="course" value="IP-BA" onclick="this.form.submit()" {% if "IP-BA" in courses or "ALL" in courses %}checked="checked"{% endif %}/>Bachelor International Production Engineering and Management (IP)
</label>
</p>
</form>
{%if args["searchQuery"] %}
......
......@@ -19,7 +19,7 @@ import config
from pprint import pprint
import datetime
from util.web import expose, render_template, profify, completion_hints, update_meta_from_request
from util.web import expose, render_template, profify, completion_hints, update_meta_from_request, theme_for_url, local
from util.readMetaData import readMeta
from util.general import canonicalize_title, trim_pdf, empty_metadata
from util.univis import get_univis_metadata
......@@ -102,11 +102,13 @@ def overview(request, edit):
if edit:
return render_template('edit.xml', pageEntries=pageEntries,
args=request.args, latest=latest,
moddir = config.modurl)
moddir = config.modurl,
theme = local.theme)
else:
return render_template('list.xml', pageEntries=pageEntries,
args=request.args, latest=latest,
moddir = config.modurl)
moddir = config.modurl,
theme = local.theme)
@expose('/')
def index(request):
......@@ -114,7 +116,8 @@ def index(request):
@expose('/faq/')
def faq(request):
return render_template('faq.xml')
return render_template('faq.xml',
theme = local.theme)
@expose('/show/<document>/')
def show(request, document):
......@@ -122,7 +125,9 @@ def show(request, document):
entry = public_pdf_db[document]
except KeyError:
return NotFound()
return render_template('show.xml', entry = entry)
return render_template('show.xml',
entry = entry,
theme = local.theme)
@expose('/moderation/edit/')
def edit(request):
......@@ -184,10 +189,12 @@ def upload(request):
return render_template('editmulti.xml',
succeded = succeded,
failed = failed,
theme=local.theme,
**completion_hints())
else:
return render_template('upload.xml', args=request.args, moddir = config.modurl)
return render_template('upload.xml', args=request.args, moddir =
config.modurl, theme=local.theme)
@expose('/moderation/edit/<document>/')
def edit_submit(request, document):
......@@ -214,6 +221,7 @@ def edit_submit(request, document):
return render_template('editsingle.xml',
document = document,
failed = failed,
theme = local.theme,
**completion_hints())
else:
return NotFound()
......@@ -252,6 +260,7 @@ def moderate(request, failed=None):
jobs = newjobs
return render_template('moderation.xml', jobs = jobs, failed=failed,
theme = local.theme,
**completion_hints())
......@@ -285,5 +294,4 @@ def edit_article(request, document):
return NotFound()
raise BadRequest()
# vim: set expandtab tabstop=4 shiftwidth=4:
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