]> git.siccegge.de Git - fachschaftentool.git/commitdiff
fachschaftstoolupdate
authorChristoph Egger <siccegge@cs.fau.de>
Tue, 29 Oct 2013 15:53:04 +0000 (16:53 +0100)
committerChristoph Egger <siccegge@cs.fau.de>
Tue, 29 Oct 2013 15:53:17 +0000 (16:53 +0100)
application.py
fachschaften.sqlite [new file with mode: 0644]
templates/fachschaft.tex
templates/kiflogo.pdf [new file with mode: 0644]
templates/master.tex [new file with mode: 0644]

index c296f31413debd4352aaf81e859c66537f3835ea..1e0fcd890c1f445e51528a2fbbc7547943334ce0 100644 (file)
@@ -1,5 +1,5 @@
 #!/usr/bin/python2
-
+# -*- coding: utf-8 -*-
 import os
 import os.path
 import sqlite3
@@ -74,18 +74,40 @@ def add_process():
 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())
diff --git a/fachschaften.sqlite b/fachschaften.sqlite
new file mode 100644 (file)
index 0000000..51de71c
Binary files /dev/null and b/fachschaften.sqlite differ
index 4ad5b43fb0b3e7c0c81dfcdecf4aad2fee5b862e..723aed08c42ff9fd7d348e46f4f69daa0e7acb52 100644 (file)
@@ -2,25 +2,27 @@
  \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}
diff --git a/templates/kiflogo.pdf b/templates/kiflogo.pdf
new file mode 100644 (file)
index 0000000..abd6a54
Binary files /dev/null and b/templates/kiflogo.pdf differ
diff --git a/templates/master.tex b/templates/master.tex
new file mode 100644 (file)
index 0000000..9cc07c4
--- /dev/null
@@ -0,0 +1,136 @@
+\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}