Browse Source

Merge remote-tracking branch 'origin/master' into jethro

remotes/origin/korektury-ajax
parent
commit
a5a4767efe
  1. 10
      korektury/templates/korektury/opraf.html
  2. 19
      korektury/views.py
  3. 10
      mamweb/settings_common.py
  4. 2
      mamweb/settings_prod.py
  5. 5
      mamweb/settings_test.py

10
korektury/templates/korektury/opraf.html

@ -7,7 +7,7 @@
<script src="{% static "korektury/opraf.js"%}"></script>
<title>Korektury {{pdf.nazev}}</title>
</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>
{% 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 %}
@ -192,9 +192,11 @@
["img-{{s.strana}}", [{% for o in s.op_id %}["op{{o.id}}",{{o.x}},{{o.y}}],{% endfor %}[]]],
{% endfor %}
[]]
for (var i=0;i<comments.length-1;i++){
place_comments_one_div(comments[i][0], comments[i][1])
}
function place_comments() {
for (var i=0; i < comments.length-1; i++) {
place_comments_one_div(comments[i][0], comments[i][1])
}
}
{% if scroll %}
window.scrollTo(0,{{scroll}});
{% endif %}

19
korektury/views.py

@ -135,21 +135,32 @@ class KorekturyView(generic.TemplateView):
# Prijemci e-mailu
emails = set()
# e-mail autora korektury
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():
email = komentar.autor.user.email
if email:
emails.add(email)
email_komentujiciho = komentar.autor.user.email
if email_komentujiciho:
emails.add(email_komentujiciho)
# zodpovedny org
if oprava.pdf.org:
email_zobpovedny = oprava.pdf.org.user.email
if email_zobpovedny:
emails.add(email_zobpovedny)
# odstran e-mail autora opravy
email = autor.user.email
if 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))
def get_context_data(self, **kwargs):

10
mamweb/settings_common.py

@ -242,6 +242,10 @@ LOGGING = {
SEMINAR_RESENI_DIR = os.path.join('reseni')
SEMINAR_KONFERY_DIR = os.path.join('konfery')
KOREKTURY_PDF_DIR = os.path.join('korektury','pdf')
KOREKTURY_IMG_DIR = os.path.join('korektury','img')
CISLO_IMG_DIR = os.path.join('cislo','img')
KOREKTURY_PDF_DIR = os.path.join('korektury', 'pdf')
KOREKTURY_IMG_DIR = os.path.join('korektury', 'img')
CISLO_IMG_DIR = os.path.join('cislo', 'img')
# E-MAIL NOTIFICATIONS
SEND_EMAIL_NOTIFICATIONS = False

2
mamweb/settings_prod.py

@ -67,3 +67,5 @@ LOGGING['loggers']['']['handlers'] = ['console', 'mail_admins']
LOGGING['loggers']['django']['handlers'] = ['console', 'mail_admins']
# E-MAIL NOTIFICATIONS
SEND_EMAIL_NOTIFICATIONS = True

5
mamweb/settings_test.py

@ -10,7 +10,7 @@ import os.path
#
# Import common settings
from .settings_common import *
from .settings_common import * # zatim nutne, casem snad vyresime # noqa
# Quick-start development settings - unsuitable for production
@ -63,6 +63,3 @@ CSRF_COOKIE_SECURE = True
LOGGING['loggers']['']['handlers'] = ['console', 'mail_admins']
LOGGING['loggers']['django']['handlers'] = ['console', 'mail_admins']

Loading…
Cancel
Save