Merge branch 'master' into xlfd
This commit is contained in:
		
						commit
						880aa68d63
					
				
					 11 changed files with 102 additions and 19 deletions
				
			
		|  | @ -7,7 +7,7 @@ | ||||||
|   <script src="{% static "korektury/opraf.js"%}"></script> |   <script src="{% static "korektury/opraf.js"%}"></script> | ||||||
| 	<title>Korektury {{pdf.nazev}}</title> | 	<title>Korektury {{pdf.nazev}}</title> | ||||||
| </head> | </head> | ||||||
| <body {% if pdf.status = 'zanaseni'%} class="comitting" {% elif pdf.status = 'zastarale' %} class="deprecated" {% endif %}>  | <body {% if pdf.status = 'zanaseni'%} class="comitting" {% elif pdf.status = 'zastarale' %} class="deprecated" {% endif %} onload='place_comments()'> | ||||||
| 	<h1>Korektury {{pdf.nazev}}</h1> | 	<h1>Korektury {{pdf.nazev}}</h1> | ||||||
| 	{% if pdf.status = 'zanaseni' %} <h2> Probíhá zanášení korektur, zvažte, zda chcete přidávat nové </h2> {% endif %} | 	{% if pdf.status = 'zanaseni' %} <h2> Probíhá zanášení korektur, zvažte, zda chcete přidávat nové </h2> {% endif %} | ||||||
| 	{% if pdf.status = 'zastarale' %} <h2> Toto PDF je již zastaralé, nepřidávejte nové korektury </h2> {% endif %} | 	{% if pdf.status = 'zastarale' %} <h2> Toto PDF je již zastaralé, nepřidávejte nové korektury </h2> {% endif %} | ||||||
|  | @ -192,9 +192,11 @@ | ||||||
| 		["img-{{s.strana}}", [{% for o in s.op_id %}["op{{o.id}}",{{o.x}},{{o.y}}],{% endfor %}[]]], | 		["img-{{s.strana}}", [{% for o in s.op_id %}["op{{o.id}}",{{o.x}},{{o.y}}],{% endfor %}[]]], | ||||||
| 	{% endfor %} | 	{% endfor %} | ||||||
| 	[]] | 	[]] | ||||||
| 	for (var i=0;i<comments.length-1;i++){ |         function place_comments() { | ||||||
| 		 place_comments_one_div(comments[i][0], comments[i][1]) |             for (var i=0; i < comments.length-1; i++) { | ||||||
| 	} |                     place_comments_one_div(comments[i][0], comments[i][1]) | ||||||
|  |             } | ||||||
|  |         } | ||||||
| 	{% if scroll %} | 	{% if scroll %} | ||||||
| 		window.scrollTo(0,{{scroll}}); | 		window.scrollTo(0,{{scroll}}); | ||||||
| 	{% endif %} | 	{% endif %} | ||||||
|  |  | ||||||
|  | @ -135,21 +135,32 @@ class KorekturyView(generic.TemplateView): | ||||||
| 
 | 
 | ||||||
|         # Prijemci e-mailu |         # Prijemci e-mailu | ||||||
|         emails = set() |         emails = set() | ||||||
|  |         # e-mail autora korektury | ||||||
|         email = oprava.autor.user.email |         email = oprava.autor.user.email | ||||||
|         # nalezeni e-mailu na organizatory komentaru |         if email: | ||||||
|  |             emails.add(email) | ||||||
|  | 
 | ||||||
|  |         # nalezeni e-mailu na autory komentaru | ||||||
|         for komentar in oprava.komentar_set.all(): |         for komentar in oprava.komentar_set.all(): | ||||||
|             email = komentar.autor.user.email |             email_komentujiciho = komentar.autor.user.email | ||||||
|             if email: |             if email_komentujiciho: | ||||||
|                 emails.add(email) |                 emails.add(email_komentujiciho) | ||||||
|  | 
 | ||||||
|         # zodpovedny org |         # zodpovedny org | ||||||
|         if oprava.pdf.org: |         if oprava.pdf.org: | ||||||
|             email_zobpovedny = oprava.pdf.org.user.email |             email_zobpovedny = oprava.pdf.org.user.email | ||||||
|             if email_zobpovedny: |             if email_zobpovedny: | ||||||
|                 emails.add(email_zobpovedny) |                 emails.add(email_zobpovedny) | ||||||
|  | 
 | ||||||
|         # odstran e-mail autora opravy |         # odstran e-mail autora opravy | ||||||
|  |         email = autor.user.email | ||||||
|         if email: |         if email: | ||||||
|             emails.discard(email) |             emails.discard(email) | ||||||
| 
 | 
 | ||||||
|  |         if not settings.SEND_EMAIL_NOTIFICATIONS: | ||||||
|  |             print "Poslal bych upozornění na tyto adresy: ", " ".join(emails) | ||||||
|  |             return | ||||||
|  | 
 | ||||||
|         send_mail(subject, text, from_email, list(emails)) |         send_mail(subject, text, from_email, list(emails)) | ||||||
| 
 | 
 | ||||||
|     def get_context_data(self, **kwargs): |     def get_context_data(self, **kwargs): | ||||||
|  |  | ||||||
|  | @ -242,6 +242,10 @@ LOGGING = { | ||||||
| 
 | 
 | ||||||
| SEMINAR_RESENI_DIR = os.path.join('reseni') | SEMINAR_RESENI_DIR = os.path.join('reseni') | ||||||
| SEMINAR_KONFERY_DIR = os.path.join('konfery') | SEMINAR_KONFERY_DIR = os.path.join('konfery') | ||||||
| KOREKTURY_PDF_DIR = os.path.join('korektury','pdf') | KOREKTURY_PDF_DIR = os.path.join('korektury', 'pdf') | ||||||
| KOREKTURY_IMG_DIR = os.path.join('korektury','img') | KOREKTURY_IMG_DIR = os.path.join('korektury', 'img') | ||||||
| CISLO_IMG_DIR = os.path.join('cislo','img') | CISLO_IMG_DIR = os.path.join('cislo', 'img') | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | # E-MAIL NOTIFICATIONS | ||||||
|  | SEND_EMAIL_NOTIFICATIONS = False | ||||||
|  |  | ||||||
|  | @ -67,3 +67,5 @@ LOGGING['loggers']['']['handlers'] = ['console', 'mail_admins'] | ||||||
| LOGGING['loggers']['django']['handlers'] = ['console', 'mail_admins'] | LOGGING['loggers']['django']['handlers'] = ['console', 'mail_admins'] | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | # E-MAIL NOTIFICATIONS | ||||||
|  | SEND_EMAIL_NOTIFICATIONS = True | ||||||
|  |  | ||||||
|  | @ -10,7 +10,7 @@ import os.path | ||||||
| # | # | ||||||
| 
 | 
 | ||||||
| # Import common settings | # Import common settings | ||||||
| from .settings_common import * | from .settings_common import * # zatim nutne, casem snad vyresime # noqa | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| # Quick-start development settings - unsuitable for production | # Quick-start development settings - unsuitable for production | ||||||
|  | @ -63,6 +63,3 @@ CSRF_COOKIE_SECURE = True | ||||||
| 
 | 
 | ||||||
| LOGGING['loggers']['']['handlers'] = ['console', 'mail_admins'] | LOGGING['loggers']['']['handlers'] = ['console', 'mail_admins'] | ||||||
| LOGGING['loggers']['django']['handlers'] = ['console', 'mail_admins'] | LOGGING['loggers']['django']['handlers'] = ['console', 'mail_admins'] | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
|  |  | ||||||
							
								
								
									
										24
									
								
								seminar/static/seminar/stvrzenka.sty
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								seminar/static/seminar/stvrzenka.sty
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,24 @@ | ||||||
|  | \newcommand{\stvrzenka}[6]{ | ||||||
|  | 	\removelastskip\bigskip | ||||||
|  | 	\newpage | ||||||
|  | 
 | ||||||
|  | 	\noindent\textbf{Dodavatel:}\hfill\textbf{Stvrzenka č. {\Large #1}} | ||||||
|  | 	 | ||||||
|  | 	{Univerzita Karlova \\ | ||||||
|  | 	\indent Matematicko-fyzikální fakulta \\ | ||||||
|  | 	\indent OVVP, M\&M \\ | ||||||
|  | 	\indent Ke Karlovu 3, 120 00 Praha 2 \\ | ||||||
|  | 	\indent IČ: 00216208 DIČ: CZ00216208} | ||||||
|  | 
 | ||||||
|  | 	\parindent=0pt | ||||||
|  | 	\parskip=0.2in | ||||||
|  | 
 | ||||||
|  | 	\textbf{Celkem Kč:} 700,- \\ | ||||||
|  | 	\textbf{Slovy:} sedmset korun českých | ||||||
|  | 
 | ||||||
|  | 	\textbf{Přijato od (firma, jméno, adresa):} #2 #3, #4, #5 #6 | ||||||
|  | 
 | ||||||
|  | 	\textbf{Účel platby:} příspěvek na stravování | ||||||
|  | 
 | ||||||
|  | 	ze dne \datum \hfill Přijal:\hspace{3cm} | ||||||
|  | } | ||||||
							
								
								
									
										13
									
								
								seminar/static/seminar/stvrzenky.tex
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								seminar/static/seminar/stvrzenky.tex
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,13 @@ | ||||||
|  | \documentclass[12pt,a4paper]{article} | ||||||
|  | \usepackage[czech]{babel} | ||||||
|  | \usepackage[utf8]{inputenc} | ||||||
|  | \usepackage[margin=1in]{geometry} | ||||||
|  | 
 | ||||||
|  | \usepackage{stvrzenka} | ||||||
|  | 
 | ||||||
|  | \pagestyle{empty} | ||||||
|  | \begin{document} | ||||||
|  | 
 | ||||||
|  | \input{ucastnici} | ||||||
|  | 
 | ||||||
|  | \end{document} | ||||||
|  | @ -49,7 +49,8 @@ | ||||||
|           <a href="../{{soustredeni.pk}}/obalky.pdf">Vygenerovat obálky pro účastníky</a><br> |           <a href="../{{soustredeni.pk}}/obalky.pdf">Vygenerovat obálky pro účastníky</a><br> | ||||||
| 		  Seznam účastníků -  | 		  Seznam účastníků -  | ||||||
|           <a href="../{{soustredeni.pk}}/seznam_ucastniku">HTML tabulka pro tisk</a>, |           <a href="../{{soustredeni.pk}}/seznam_ucastniku">HTML tabulka pro tisk</a>, | ||||||
|           <a href="../{{soustredeni.pk}}/export_ucastniku">CSV</a> |           <a href="../{{soustredeni.pk}}/export_ucastniku">CSV</a><br> | ||||||
|  |           <a href="../{{soustredeni.pk}}/stvrzenky/42">Stvrzenky <i>(42 v URL nahraďte prvním číslem z rozsahu)</i></a> | ||||||
|         </div> |         </div> | ||||||
|       {% endif %} |       {% endif %} | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
							
								
								
									
										5
									
								
								seminar/templates/seminar/soustredeni/ucastnici.tex
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								seminar/templates/seminar/soustredeni/ucastnici.tex
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,5 @@ | ||||||
|  | {% load tex %} | ||||||
|  | \newcommand{\datum}{{datum|date:"j. n. Y"|sloz}} | ||||||
|  | {% for u in ucastnici %} | ||||||
|  | \stvrzenka{{u.cislo_stvrzenky|sloz}}{{u.jmeno|sloz}}{{u.prijmeni|sloz}}{{u.ulice|sloz}}{{u.psc|sloz}}{{u.mesto|sloz}} | ||||||
|  | {% endfor %} | ||||||
|  | @ -29,6 +29,7 @@ urlpatterns = [ | ||||||
|         name = 'seminar_seznam_soustredeni'), |         name = 'seminar_seznam_soustredeni'), | ||||||
|     url(r'^soustredeni/probehlo/(?P<soustredeni>\d+)/$', views.SoustredeniView.as_view(), name='seminar_soustredeni'), |     url(r'^soustredeni/probehlo/(?P<soustredeni>\d+)/$', views.SoustredeniView.as_view(), name='seminar_soustredeni'), | ||||||
|     url(r'^soustredeni/(?P<soustredeni>\d+)/seznam_ucastniku$', staff_member_required(views.SoustredeniUcastniciView.as_view()), name='soustredeni_ucastnici'), |     url(r'^soustredeni/(?P<soustredeni>\d+)/seznam_ucastniku$', staff_member_required(views.SoustredeniUcastniciView.as_view()), name='soustredeni_ucastnici'), | ||||||
|  |     url(r'^soustredeni/(?P<soustredeni>\d+)/stvrzenky/(?P<first_num>\d+)$', staff_member_required(views.soustredeniStvrzenkyExportView), name='soustredeni_stvrzenky'), | ||||||
|     url(r'^soustredeni/(?P<soustredeni>\d+)/export_ucastniku$', staff_member_required(views.soustredeniUcastniciExportView), name='soustredeni_ucastnici_export'), |     url(r'^soustredeni/(?P<soustredeni>\d+)/export_ucastniku$', staff_member_required(views.soustredeniUcastniciExportView), name='soustredeni_ucastnici_export'), | ||||||
|     url(r'^soustredeni/(?P<soustredeni>\d+)/fotogalerie/', include('galerie.urls')), |     url(r'^soustredeni/(?P<soustredeni>\d+)/fotogalerie/', include('galerie.urls')), | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -6,7 +6,7 @@ from django.core.urlresolvers import reverse | ||||||
| from django.core.exceptions import PermissionDenied, ObjectDoesNotExist | from django.core.exceptions import PermissionDenied, ObjectDoesNotExist | ||||||
| from django.views import generic | from django.views import generic | ||||||
| from django.utils.translation import ugettext as _ | from django.utils.translation import ugettext as _ | ||||||
| from django.http import Http404 | from django.http import Http404,HttpResponseBadRequest | ||||||
| from django.db.models import Q | from django.db.models import Q | ||||||
| from django.views.decorators.csrf import ensure_csrf_cookie | from django.views.decorators.csrf import ensure_csrf_cookie | ||||||
| from django.contrib.auth import authenticate, login | from django.contrib.auth import authenticate, login | ||||||
|  | @ -530,7 +530,7 @@ class SoustredeniView(generic.DetailView): | ||||||
|     template_name = 'seminar/archiv/soustredeni.html' |     template_name = 'seminar/archiv/soustredeni.html' | ||||||
| 
 | 
 | ||||||
| def soustredeniObalkyView(request,soustredeni): | def soustredeniObalkyView(request,soustredeni): | ||||||
|     soustredeni = Soustredeni.objects.filter(id = soustredeni)[0] |     soustredeni = get_object_or_404(Soustredeni,id = soustredeni) | ||||||
|     return obalkyView(request,soustredeni.ucastnici.all()) |     return obalkyView(request,soustredeni.ucastnici.all()) | ||||||
| 
 | 
 | ||||||
| class SoustredeniUcastniciView(generic.ListView): | class SoustredeniUcastniciView(generic.ListView): | ||||||
|  | @ -541,8 +541,31 @@ class SoustredeniUcastniciView(generic.ListView): | ||||||
|         self.soustredeni = get_object_or_404(Soustredeni, id=self.kwargs["soustredeni"]) |         self.soustredeni = get_object_or_404(Soustredeni, id=self.kwargs["soustredeni"]) | ||||||
|         return Soustredeni_Ucastnici.objects.filter(soustredeni=self.soustredeni).select_related('resitel') |         return Soustredeni_Ucastnici.objects.filter(soustredeni=self.soustredeni).select_related('resitel') | ||||||
| 
 | 
 | ||||||
|  | def soustredeniStvrzenkyExportView(request,soustredeni,first_num): | ||||||
|  |     first_num = int(first_num) | ||||||
|  |     soustredeni = get_object_or_404(Soustredeni,id = soustredeni) | ||||||
|  |     ucastnici = Resitel.objects.filter(soustredeni=soustredeni) | ||||||
|  |     for (idx,u) in enumerate(ucastnici): | ||||||
|  | 	    u.cislo_stvrzenky = first_num+idx; | ||||||
|  |     tex = render(request,'seminar/soustredeni/ucastnici.tex', {'ucastnici': ucastnici, 'datum':soustredeni.datum_zacatku }).content | ||||||
|  | 
 | ||||||
|  |     tempdir = tempfile.mkdtemp() | ||||||
|  |     with open(tempdir+"/ucastnici.tex","w") as texfile: | ||||||
|  |         # Pokud TeX chce ISO Latin, tak se da encode nastavit | ||||||
|  |         texfile.write(tex.decode("utf-8").encode("utf-8")) | ||||||
|  |     shutil.copy(os.path.join(settings.STATIC_ROOT, 'seminar/stvrzenka.sty'),tempdir) | ||||||
|  |     shutil.copy(os.path.join(settings.STATIC_ROOT, 'seminar/stvrzenky.tex'),tempdir) | ||||||
|  |     subprocess.call(["cslatex","stvrzenky.tex"],cwd = tempdir) | ||||||
|  |     subprocess.call(["dvipdf","stvrzenky.dvi"],cwd = tempdir) | ||||||
|  | 
 | ||||||
|  |     with open(tempdir+"/stvrzenky.pdf","rb") as pdffile: | ||||||
|  |         response = HttpResponse(pdffile.read(),content_type='application/pdf') | ||||||
|  |     shutil.rmtree(tempdir) | ||||||
|  |     return response | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| def soustredeniUcastniciExportView(request,soustredeni): | def soustredeniUcastniciExportView(request,soustredeni): | ||||||
|     soustredeni = Soustredeni.objects.filter(id = soustredeni)[0] |     soustredeni = get_object_or_404(Soustredeni,id = soustredeni) | ||||||
|     ucastnici = Resitel.objects.filter(soustredeni=soustredeni) |     ucastnici = Resitel.objects.filter(soustredeni=soustredeni) | ||||||
|     response = HttpResponse(content_type='text/csv') |     response = HttpResponse(content_type='text/csv') | ||||||
|     response['Content-Disposition'] = 'attachment; filename="ucastnici.csv"' |     response['Content-Disposition'] = 'attachment; filename="ucastnici.csv"' | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 Bc. Petr Pecha
						Bc. Petr Pecha