Browse Source

Merge branch 'test' of gimli.ms.mff.cuni.cz:/akce/mam/git/mamweb into test

middleware_test
parent
commit
b1cc6df91e
  1. 141
      seminar/templates/seminar/archiv/obalky.tex
  2. 3
      seminar/views.py

141
seminar/templates/seminar/archiv/obalky.tex

@ -1,79 +1,94 @@
{% autoescape off %} {% autoescape off %}
{% load staticfiles %} {% load staticfiles %}
{% load tex %} {% load tex %}
\input czech.sty \documentclass[11pt,a4paper,landscape]{article}
\input epsf \usepackage[top=3.75cm,left=8cm]{geometry}
\special{landscape} \usepackage[T1]{fontenc}
\nopagenumbers \usepackage[utf8]{inputenc}
\hoffset=-1in \usepackage[czech]{babel}
\voffset=-1in \usepackage{graphicx}
\advance\voffset by 0.9cm \begin{document}
%nove pridano, aby to fungovalo...
\advance\hoffset by 6.5cm % Nechceme číslování stránek
\hsize=22cm \pagenumbering{gobble}
\vsize=16cm
% Různé fonty na obálce
\font\adrfonta=csssbx10 at 14pt \def\adrfonta#1{%
\font\adrfontb=csssbx10 at 12pt \fontsize{14pt}{14.5pt}\selectfont \textbf{\textsf{#1}}%Časopis M&M
\font\adrfontc=csss12 }
\font\tofont=csr12 at 16pt \def\adrfontb#1{%
\fontsize{12pt}{13pt}\selectfont \textbf{\textsf{#1}}%OPMK UK MFF
\newdimen\fromskip }
\newdimen\toskip \def\adrfontc#1{%
\fromskip=4.35cm \fontsize{12pt}{13pt}\selectfont \textsf{#1}%Adresa, telefon, e-mail
\toskip=13.2cm }
\def\tofont#1{%
\def\first{\relax} \fontsize{16pt}{18pt}\selectfont #1%Adresa řešitele
}
%Podtržítko je znak
\catcode`_=13 \catcode`_=13
%\catcode`_=12
\def_{$\_$} \def_{$\_$}
\advance\voffset by 2.5cm % Odsazení různých adres
\parindent=0pt
%\newdimen\fromskip
\def\obalka#1#2#3#4#5#6#7{ \newdimen\toskip
%\fromskip=4.35cm
\def\jmeno{#1} \toskip=11.7cm
\def\prijm{#2}
\def\skola{#3} % Předsunutí -- na PSČ
\def\popis{} \def\predsunout#1{%
\def\first{} \setbox0=\hbox{#1\,}%
\def\ulice{#4} \hskip -\wd0\relax%
\def\PSC{#5} \box0
\def\mesto{#6} }
\def\stat{#7}
\vskip-4mm\vbox to 0pt{\hbox to 0pt{\hskip1.4cm\epsfysize=2.55cm\epsfbox{lisak.eps}\hss}\vss}
\baselineskip=13pt % Makro na TeXáni naší adresy
\parindent=\fromskip \def\adresaMaM{%
\line{\indent\adrfonta Časopis M\&M,\hfil} \hbox{\adrfonta{Časopis M\&M,}}
\vskip3pt \vskip 3 pt
\line{\indent\adrfontb OPMK UK MFF\hfil} \hbox{\adrfontb{OPMK UK MFF}}
\vskip3pt \vskip 3 pt
\line{\indent\adrfontc Ke Karlovu 3, 121 16 Praha 2\hfil} \hbox{\adrfontc{Ke Karlovu 3, 121 16 Praha 2}}
\line{\indent\adrfontc Tel.: +420 221 911 235\hss} \hbox{\adrfontc{Tel.: +420 221 911 235}}
\line{\indent\adrfontc mam@atrey.karlin.mff.cuni.cz\hfil} \hbox{\adrfontc{mam@matfyz.cz}}
}
\vskip6.15cm % Makro na TeXání adresátovy adresy
\vbox to 0pt{\parindent=1.4cm\hsize=\toskip\advance\hsize by -1cm \def\adresat#1#2#3#4#5#6#7{%
\vbox to 60pt{\vfil} \popis\vss} \def\jmeno{#1}%
\parindent=\toskip \def\prijm{#2}%
\baselineskip=18pt \def\skola{#3}%
\line{\indent\tofont\first\hfil} %\def\popis{}
\line{\indent\tofont\jmeno\ \prijm\hfil} %\def\first{}
\def\ulice{#4}%
\def\PSC{#5}%
\def\mesto{#6}%
\def\stat{#7}%
\hbox{\tofont{\jmeno\ \prijm}}
\ifx \skola \empty \ifx \skola \empty
{} {}
\else \else
\line{\indent\tofont\skola\hfil} \hbox{\tofont{\skola}}
\fi \fi
\line{\indent\tofont\ulice\hfil} \hbox{\tofont{\ulice}}
\line{\tofont\item{\PSC} \mesto\hfil}
\vskip5pt \hbox to 18pt{\tofont{\predsunout{\PSC\ }\mesto}}
\line{\indent\tofont\stat\hfil} \vskip 5 pt
\tofont{\stat}
}
\vfil\eject % Tohle makro vysází samotnou obálku
\def\obalka#1#2#3#4#5#6#7{
% Horní a pravý okraj je zároveň okraj stránky, resetujeme odsazení
\includegraphics[height=2.55cm]{lisak.eps}\hskip 1 em\vbox{%
\adresaMaM}
\vskip 7.3 cm % Od oka
\hskip\toskip%
\vbox{\adresat{#1}{#2}{#3}{#4}{#5}{#6}{#7}}
\vfill\eject
} }
@ -98,6 +113,6 @@
{% endif %} {% endif %}
{% endspaceless %} {% endspaceless %}
{% endfor %} {% endfor %}
\bye \end{document}
{% endautoescape %} {% endautoescape %}

3
seminar/views.py

@ -568,8 +568,7 @@ def obalkyView(request,resitele):
with open(tempdir+"/obalky.tex","w") as texfile: with open(tempdir+"/obalky.tex","w") as texfile:
texfile.write(tex) texfile.write(tex)
shutil.copy(os.path.join(settings.STATIC_ROOT, 'seminar/lisak.eps'),tempdir) shutil.copy(os.path.join(settings.STATIC_ROOT, 'seminar/lisak.eps'),tempdir)
subprocess.call(["csplain","obalky.tex"],cwd = tempdir) subprocess.call(["pdflatex","obalky.tex"],cwd = tempdir)
subprocess.call(["dvipdf","obalky.dvi"],cwd = tempdir)
with open(tempdir+"/obalky.pdf","rb") as pdffile: with open(tempdir+"/obalky.pdf","rb") as pdffile:
response = HttpResponse(pdffile.read(),content_type='application/pdf') response = HttpResponse(pdffile.read(),content_type='application/pdf')

Loading…
Cancel
Save