#!/usr/bin/python2
-
+# -*- coding: utf-8 -*-
import os
import os.path
import sqlite3
def download():
db = get_db()
cursor = db.cursor()
+ universities = []
data = StringIO.StringIO()
tar = tarfile.TarFile(mode='w', fileobj=data)
- for fachschaft in cursor.execute("SELECT * from fachschaft"):
+ for fachschaft in cursor.execute("SELECT * from fachschaft").fetchall():
studiengaenge = cursor.execute("SELECT * from studiengang WHERE fachschaft = ?", [fachschaft['rowid']]).fetchall()
fdata = render_template('fachschaft.tex',
fachschaft = fachschaft,
studiengaenge = studiengaenge)
fdata = fdata.encode('utf-8')
- info = tarfile.TarInfo(name='%s.tex' % fachschaft['kurzname'].strip().lower().replace(' ', '_').replace('/','_'))
+ filename = '%s_%s.tex' % (fachschaft['kurzname'].strip().lower().replace(' ', '_').replace('/','_').replace(u'ä', 'ae').replace(u'ü', 'ue').replace(u'ö', 'oe'),
+ fachschaft['rowid'])
+ info = tarfile.TarInfo(name='fachschaften/%s' % filename)
info.size = len(fdata)
tar.addfile(info, StringIO.StringIO(fdata))
- print fdata
+ universities.append(filename)
+
+ # liste.tex
+ fdata = ('\n'.join(['\input{fachschaften/%s}' % (u) for u in universities])).encode('utf-8')
+ info = tarfile.TarInfo(name='liste.tex')
+ info.size = len(fdata)
+ tar.addfile(info, StringIO.StringIO(fdata))
+
+ # master.tex
+ fdata = file(os.path.join(os.path.dirname(__file__), 'templates', 'master.tex')).read()
+ info = tarfile.TarInfo(name='master.tex')
+ info.size = len(fdata)
+ tar.addfile(info, StringIO.StringIO(fdata))
+
+ # kiflogo.pdf
+ fdata = file(os.path.join(os.path.dirname(__file__), 'templates', 'kiflogo.pdf')).read()
+ info = tarfile.TarInfo(name='kiflogo.pdf')
+ info.size = len(fdata)
+ tar.addfile(info, StringIO.StringIO(fdata))
+
tar.close()
responseobj=make_response(data.getvalue())
\begin{frame}
\begin{tabular}{lll}
& \begin{tabular}{p{9cm}}
- {\Large\bf {{fachschaft.langname}}
- \cline{1-1}
- \smash{\rlap{\raisebox{-.5mm}{\hspace*{.3ex}');
- {{fachschaft.stadt}}, {{fachschaft.land}}, {{fachschaft.studenten}}
- Studenten}}} \\\\
- \end{tabular} &
- \rlap{\smash{\raisebox{-18mm}{\includegraphics[width=2cm]{kiflogo}}}}\\
- &\multicolumn{2}{l}{\begin{tabular}{l}' . "\n");
- \textbf{ {{fsorgan}} } \\
- vertritt {{fachschaft.vertreten}} Studenten \\
- {{fachschaft.organisation}}\\
- {{fachschaft.aktive}} Aktive' . '\end{tabular}} \\\\
- &\multicolumn{2}{l}{\begin{tabular}{lll}
- \rlap{\textbf{Studiengang}}\hspace*{6.8cm} &
- \rlap{\textbf{Anf\"anger}}\hspace*{2cm} & \textbf{Vorjahr}
- \\
- {% for studiengang in studiengaenge %}
- {{studiengang.name}} & {{studiengang.anf_dieses}} & {{studiengang.anf_vorjahr}} \\
- {% endfor %}
- \end{tabular}}\\\end{tabular}\\
- \vspace*{\fill} \mbox{}\hspace*{-2.8mm}\insertnavigation{\linewidth}
- \end{frame}
\ No newline at end of file
+ {\Large\bf {{fachschaft.langname}} }\\
+ \hline
+ \smash{\rlap{\raisebox{-.5mm}{\hspace*{.3ex}
+ {{fachschaft.stadt}}, {{fachschaft.land}}, {{fachschaft.studenten}}
+ Studierende }}} \\\\
+ \end{tabular} &
+ \rlap{\smash{\raisebox{-18mm}{\includegraphics[width=2cm]{kiflogo}}}}\\
+ &\multicolumn{2}{l}{\begin{tabular}{l}
+ \textbf{ {{fsorgan}} } \\
+ vertritt {{fachschaft.vertreten}} Studenierende \\
+ {{fachschaft.organisation}}\\
+ {{fachschaft.aktive}} Aktive
+ \end{tabular}} \\\\
+ &\multicolumn{2}{l}{
+ \begin{tabular}{lll}
+ \rlap{\textbf{Studiengang}}\hspace*{6.8cm} &
+ \rlap{\textbf{Anfänger}}\hspace*{2cm} & \textbf{Vorjahr}
+ \\
+ {% for studiengang in studiengaenge %}
+ {{studiengang.name}} & {{studiengang.anf_dieses}} & {{studiengang.anf_vorjahr}} \\ {% endfor %}
+ \end{tabular}}\\
+ \end{tabular}\\
+ \vspace*{\fill} \mbox{}\hspace*{-2.8mm}\insertnavigation{\linewidth}
+ \end{frame}
--- /dev/null
+\documentclass[10pt]{beamer}
+\usepackage{wasysym}
+\usepackage[utf8]{inputenc}
+\usepackage[german]{babel}
+\setbeamersize{text margin left = 1mm}
+\setbeamersize{text margin right = 1mm}
+\usepackage[babel,german=quotes]{csquotes}
+\usepackage{hyperref}
+\usepackage{graphicx}
+\usepackage{xcolor}
+\usepackage[absolute,overlay]{textpos}
+\usepackage{enumitem}
+\usepackage{etoolbox}
+
+\makeatletter
+\patchcmd{\beamer@sectionintoc}{\vskip1.5em}{\vskip0.5em}{}{}
+\makeatother
+
+
+\setitemize{label=\usebeamerfont*{itemize item}%
+ \usebeamercolor[fg]{itemize item}
+ \usebeamertemplate{itemize item}}
+
+\usetheme[pageofpages=of,% String used between the current page and the
+ % total page count.
+ bullet=circle,% Use circles instead of squares for bullets.
+ titleline=true,% Show a line below the frame title.
+ alternativetitlepage=true,% Use the fancy title page.
+ titlepagelogo=bilder/kif_logo.pdf,% Logo for the first page.
+ %watermark=watermark-polito,% Watermark used in every page.
+ %watermarkheight=100px,% Height of the watermark.
+ %watermarkheightmult=4,% The watermark image is 4 times bigger
+ % than watermarkheight.
+ ]{Torino}
+
+\hypersetup{
+ unicode=true,
+ colorlinks=true,
+ linktoc=none,
+ linkcolor=white,
+ urlcolor=uniblau,
+ pdffitwindow=true
+}
+
+
+
+\newcounter{temptemp}
+\makeatletter
+\def\sectionentry#1#2#3#4#5{% section number, section title, page
+ \ifnum#5=\c@part%
+ \setcounter{temptemp}{\c@section}
+ \ifnum#1=\value{temptemp}
+ \box\beamer@sectionbox\hskip1.875ex plus 1fill%
+ \beamer@xpos=0\relax%
+ \beamer@ypos=1\relax%
+ \setbox\beamer@sectionbox=
+ \hbox{\def\insertsectionhead{#2}%
+ \def\insertsectionheadnumber{#1}%
+ \def\insertpartheadnumber{#5}%
+ {%
+ \usebeamerfont{section in head/foot}\usebeamercolor[fg]{section in head/foot}%
+ \hyperlink{Navigation#3}{{\usebeamertemplate{section in head/foot}}}%
+ }%
+ }%
+ \ht\beamer@sectionbox=1.875ex%
+ \dp\beamer@sectionbox=0.75ex%
+ \else
+ \stepcounter{temptemp}
+ \ifnum#1=\value{temptemp}
+ \box\beamer@sectionbox\hskip1.875ex plus 1fill%
+ \beamer@xpos=0\relax%
+ \beamer@ypos=1\relax%
+ \setbox\beamer@sectionbox=
+ \hbox{\def\insertsectionhead{#2}%
+ \def\insertsectionheadnumber{#1}%
+ \def\insertpartheadnumber{#5}%
+ {%
+ \usebeamerfont{section in head/foot}\usebeamercolor[fg]{section in head/foot}%
+ \hyperlink{Navigation#3}{{\color{fg!50!bg}$\RHD$ \usebeamertemplate{section in head/foot shaded}}}%
+ }%
+ }%
+ \ht\beamer@sectionbox=1.875ex%
+ \dp\beamer@sectionbox=0.75ex%
+ \else
+ \stepcounter{temptemp}
+ \ifnum#1=\value{temptemp}
+ \box\beamer@sectionbox\hskip1.875ex plus 1fill%
+ \beamer@xpos=0\relax%
+ \beamer@ypos=1\relax%
+ \setbox\beamer@sectionbox=
+ \hbox{\def\insertsectionhead{#2}%
+ \def\insertsectionheadnumber{#1}%
+ \def\insertpartheadnumber{#5}%
+ {%
+ \usebeamerfont{section in head/foot}\usebeamercolor[fg]{section in head/foot}%
+ \hyperlink{Navigation#3}{{\color{fg!50!bg}$\RHD\RHD$ \usebeamertemplate{section in head/foot shaded}}}%
+ }%
+ }%
+ \ht\beamer@sectionbox=1.875ex%
+ \dp\beamer@sectionbox=0.75ex%
+ \else
+ \addtocounter{temptemp}{-3}
+ \ifnum#1=\value{temptemp}
+ \box\beamer@sectionbox\hskip1.875ex plus 1fill%
+ \beamer@xpos=0\relax%
+ \beamer@ypos=1\relax%
+ \setbox\beamer@sectionbox=
+ \hbox{\def\insertsectionhead{#2}%
+ \def\insertsectionheadnumber{#1}%
+ \def\insertpartheadnumber{#5}%
+ {%
+ \usebeamerfont{section in head/foot}\usebeamercolor[fg]{section in head/foot}%
+ \hyperlink{Navigation#3}{{\usebeamertemplate{section in head/foot shaded} $\LHD$}}%
+ }%
+ }%
+ \ht\beamer@sectionbox=1.875ex%
+ \dp\beamer@sectionbox=0.75ex%
+ \else
+ \box\beamer@sectionbox\hskip1.875ex plus 1fill%
+ \beamer@xpos=0\relax%
+ \beamer@ypos=1\relax%
+ \setbox\beamer@sectionbox=
+ \hbox{\hspace*{-1cm}%
+ }%
+ \ht\beamer@sectionbox=-1.875ex%
+ \dp\beamer@sectionbox=-0.75ex%
+ \fi\fi\fi\fi\fi\ignorespaces}
+\makeatother
+
+
+\begin{document}
+\setbeamertemplate{navigation symbols}{}
+
+\input{liste}
+
+\end{document}