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

3
seminar/views.py

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

Loading…
Cancel
Save