diff --git a/Schema_new.dia b/Schema_new.dia index f09c0589..c212ec3b 100644 Binary files a/Schema_new.dia and b/Schema_new.dia differ diff --git a/mamweb/static/css/mamweb.css b/mamweb/static/css/mamweb.css index 357b5027..7e7adbfd 100644 --- a/mamweb/static/css/mamweb.css +++ b/mamweb/static/css/mamweb.css @@ -14,8 +14,31 @@ div.container { margin: auto; } +.org-logged-in div.container { + margin-top: 20px; +} + div.login-bar { background: #6a0043; + color: #f9d59e; + width: 100%; + + position: fixed; + margin-top: -20px; + min-height: 20px; + z-index: 20; + + padding-left: 5px; + padding-right: 5px; +} + +div.login-bar div { + display: inline; +} + +a.login-ref-admin { + display: inline; + color: #fffbf6; } /* odkazy a nadpisy */ @@ -74,16 +97,16 @@ h6 { .org-logged-in .mam-text-plugin { - border: dashed 1px #f77; + border: dashed 1px #6a0043; padding: 5px; margin: -5px; } .mam-org-only { - background: #fff0d7; + background: #eee4ec; padding: 10px; margin: 10px -10px; - border: orange 2px dashed; + border: #6a0043 2px dashed; } .mam-org-only .mam-org-only { @@ -123,6 +146,8 @@ h1 { margin-top: 0px; } + + /* Comments */ #id_comment { @@ -191,7 +216,7 @@ vikendovka #header.NOCsoustredeni { background-image: url("../images/header/vylet.jpg");} #header.NOCzadani { background-image: url("../images/header/stiny.jpg");} #header.NOCclanky { background-image: url("../images/header/ohen.jpg");} -#header.NOCarchiv { background-image: url("../images/header/vikendovka.jpg");} +#header.NOCarchiv { background-image: url("../images/header/stiny.jpg");} #header img.logo { @@ -407,6 +432,10 @@ ul.submenu { /* malý tablet, mobil */ @media (max-width: 650px) { + #hide-if-small.login-bar-flatpage { + display: none; + } + #title { display: none; } @@ -558,7 +587,7 @@ div.seznam_orgu { text-align: center; } -div.org_pole { +div.org_pole, div.rocnik_pole { display: inline-block; width: 30%; min-width: 300px; @@ -576,16 +605,24 @@ div.org_email { font-weight: bold; } -/*otáčecí karty organizátorů*/ +/*otáčecí karty (orgové, archiv) */ .flip-card { - width: 200px; - height: 250px; perspective: 1000px; /* Remove this if you don't want the 3D effect */ margin-left: auto; margin-right: auto; } +#organizatori.flip-card { + width: 200px; + height: 250px; +} + +#archiv.flip-card { + width: 210px; + height: 298px; +} + /* This container is needed to position the front and back side */ .flip-card-inner { position: relative; @@ -614,9 +651,10 @@ div.org_email { background-color: #bbb; } -div.foto_org img { +div.flip-card-foto img { width: 100%; height: 100%; + filter: drop-shadow(0px 3px 3px rgba(0, 0, 0, 0.4)); /* FIXME: obecně k obrázkům */ } /* Style the back side */ @@ -631,6 +669,23 @@ div.foto_org img { padding-top: 20px; } +/* karty archiv */ + +div.popis_rocniku { + text-align: left; + font-weight: bold; + margin: 20px; +} + + +div.popis_rocniku a{ + color: black; +} + +div.popis_rocniku a:hover{ + color: #6f2509; +} + /* graf na úvodní stránce */ a span.popup { diff --git a/mamweb/templates/base.html b/mamweb/templates/base.html index a53fa3df..a7616627 100644 --- a/mamweb/templates/base.html +++ b/mamweb/templates/base.html @@ -36,21 +36,21 @@ -
- - {% if user.is_staff %} -
- {% if view.object %} - Objekt {{ view.object }}: {{ view.object }} - {% if view.object.admin_url %}[admin]{% endif %} - {% endif %} - {% if flatpage %} - Stránka {{ flatpage.url }} ({{ flatpage.title }}) - [admin] - {% endif %} -
- {% endif %} + {% if user.is_staff %} +
+ {% if view.object %} + Objekt {{ view.object }}: {{ view.object }} + {% if view.object.admin_url %}{% endif %} + {% endif %} + {% if flatpage %} + + + {% endif %} + +
+ {% endif %} +
diff --git a/seminar/templates/seminar/archiv/cisla.html b/seminar/templates/seminar/archiv/cisla.html index fbb19263..3c4a38b4 100644 --- a/seminar/templates/seminar/archiv/cisla.html +++ b/seminar/templates/seminar/archiv/cisla.html @@ -8,18 +8,56 @@ {% endblock %}{% endblock %} -
+ + + {% for rocnik, url_png in object_list.items %} + +
+ +

+ Ročník {{ rocnik }} +

+ + + {# karta ročníku - zepředu obrázek prvního čísla, zezadu odkaz na jednotlivá čísla a výsledkovku #} + +
+ +
+
+ +
+ {{ rocnik }} +
+ +
+
+
+ Jednotlivá čísla: +
    + {% for cislo in rocnik.cisla.all reversed %} +
  • {{ cislo.poradi }}. číslo {% if cislo.pdf %}(pdf) {% endif %} + {% empty %} + --- + {% endfor %} +
+ Výsledková listina +
+ +
+
+
+ + {# konec karty ročníku #} + +
+
-
    - {% for r in object_list %} -
  • Ročník {{ r }} {% empty %} Nejsou žádné ročníky {% endfor %} -
{% endblock content %} - diff --git a/seminar/templates/seminar/archiv/cislo.html b/seminar/templates/seminar/archiv/cislo.html index 0e2e8a71..80905e00 100644 --- a/seminar/templates/seminar/archiv/cislo.html +++ b/seminar/templates/seminar/archiv/cislo.html @@ -46,7 +46,7 @@
  • Obálkování
  • - {% endif %} + {% endif %} {% if cislo.verejna_vysledkovka %}

    Výsledkovka

    @@ -86,7 +86,7 @@ {% endfor %} - {% endif %} + {% endif %} {% if not cislo.verejna_vysledkovka and user.is_staff %}
    @@ -94,4 +94,3 @@
    {% endblock content %} - diff --git a/seminar/templates/seminar/archiv/rocnik.html b/seminar/templates/seminar/archiv/rocnik.html index c047a5b1..2dd99ab4 100644 --- a/seminar/templates/seminar/archiv/rocnik.html +++ b/seminar/templates/seminar/archiv/rocnik.html @@ -2,13 +2,20 @@ {% block content %}
    -

    +

    {% block nadpis1a %}{% block nadpis1b %} - Ročník {{ rocnik.roman }} + Ročník {{ rocnik }} {% endblock %}{% endblock %} -

    + -

    Ročník číslo {{ rocnik.rocnik }} ({{ rocnik.prvni_rok }}/{{ rocnik.druhy_rok }}) + {% if temata_v_rocniku %} +

    Témata

    + + {% endif %} - {% if temata_v_rocniku %} -

    Témata

    - - {% endif %} - {% if vysledkovka %} {% if user.is_staff %}
    @@ -50,7 +48,3 @@
    {% endblock content %} - - - - diff --git a/seminar/templates/seminar/cojemam/organizatori.html b/seminar/templates/seminar/cojemam/organizatori.html index 8e8f1aaa..a3957101 100644 --- a/seminar/templates/seminar/cojemam/organizatori.html +++ b/seminar/templates/seminar/cojemam/organizatori.html @@ -46,12 +46,12 @@ {# karta organizátora - zepředu fotka, zezadu popis, u neaktivních data kdy organizovali #} -
    +
    -
    +
    {% if org.osoba.foto %} {{org.osoba.jmeno}} {{org.osoba.prijmeni}} {% else %} {# pokud osoba nemá fotku, zobrazuje se defaultní obrázek #} diff --git a/seminar/views/views_all.py b/seminar/views/views_all.py index 771c204c..e72f23aa 100644 --- a/seminar/views/views_all.py +++ b/seminar/views/views_all.py @@ -308,82 +308,137 @@ class ArchivView(generic.ListView): def get_context_data(self, **kwargs): context = super(ArchivView, self).get_context_data(**kwargs) - vyska = 297 # px - sirka = 210 # px + vyska = 594 # px + sirka = 420 # px - # nejnovějších 10 zveřejněných čísel - # cisla = Cislo.objects.filter(verejne_db=True)[:10] - cisla = Cislo.objects.filter(poradi=1)[:10] + # první číslo z každého ročníku + cisla = Cislo.objects.filter(poradi=1) # op == os.path, udělá z argumentů cestu png_dir = op.join(settings.MEDIA_ROOT, "cislo", "png") - # seznam [(url obrázku, číslo)] - urls = [] - - for i, c in enumerate(cisla): - if not c.pdf: - continue - filename = os.path.split(c.pdf.file.name)[1].split(".")[0] - png_filename = "{}-{}px.png".format(filename, vyska) - - # Pokud obrázek neexistuje nebo není aktuální, vytvoř jej - png_path = op.join(png_dir, png_filename) - if not op.exists(png_path) or \ - op.getmtime(png_path) < op.getmtime(c.pdf.path): - - subprocess.call([ - "convert", - "-density", "300x300", - "-geometry", "{}x{}".format(vyska, sirka), - "-background", "white", - "-flatten", - "-rotate", str(90 * i), - "{}[0]".format(c.pdf.path), # titulní strana - png_path - ]) - - urls.append( - (op.join(settings.MEDIA_URL, "cislo", "png", png_filename), c) - ) - vyska, sirka = sirka, vyska / 2 - - tags = [] - - def spirala(urls, tags, idx): - """Rekurzivně prochází urls a generuje strom elementů do tags""" - if idx >= len(urls): - return - - img_url, cislo = urls[idx] - tags.append( - "
    " - .format( - 50 if idx % 4 == 2 else 0, - 50 if idx % 4 == 1 else 0, - 50 if idx % 2 == 1 else 100, - 50 if idx > 0 and idx % 2 == 0 else 100 - ) - ) - tags.append("".format( - cislo.verejne_url(), cislo.kod() - )) - tags.append( - "" - .format( - img_url, - 50 if idx % 4 == 3 else 0, - 50 if idx % 4 == 2 else 0, - 50 if idx % 2 == 0 else 100, - 50 if idx % 2 == 1 else 100 - ) - ) - tags.append("") - spirala(urls, tags, idx + 1) - tags.append("
    ") - spirala(urls, tags, 0) - - context["nahledy"] = "\n".join(tags) + # slovník {(ročník, url obrázku)} + urls ={} + + # for j, rocnik in enumerate(Rocnik.objects.all()): + # urls_rocnik = {} + # for i,c in enumerate(rocnik.cisla.all()): + # if not c.pdf: + # urls_rocnik[c.poradi] = op.join(settings.MEDIA_URL, "cislo", "png", "default.png") + # else: + # filename = os.path.split(c.pdf.file.name)[1].split(".")[0] + # png_filename = "{}.png".format(filename) + + # # Pokud obrázek neexistuje nebo není aktuální, vytvoř jej + # png_path = op.join(png_dir, png_filename) + # if not op.exists(png_path) or \ + # op.getmtime(png_path) < op.getmtime(c.pdf.path): + + # subprocess.call([ + # "convert", + # "-density", "300x300", + # "-geometry", "{}x{}".format(vyska, sirka), + # "-background", "white", + # "-flatten", + # "{}[0]".format(c.pdf.path), # titulní strana + # png_path + # ]) + + # urls_rocnik[c.poradi] = op.join(settings.MEDIA_URL, "cislo", "png", png_filename) + # urls[rocnik] = urls_rocnik + + for i,c in enumerate(cisla): + if not c.pdf: + urls[c.rocnik] = op.join(settings.MEDIA_URL, "cislo", "png", "default.png") + else: + filename = os.path.split(c.pdf.file.name)[1].split(".")[0] + png_filename = "{}.png".format(filename) + + # Pokud obrázek neexistuje nebo není aktuální, vytvoř jej + png_path = op.join(png_dir, png_filename) + if not op.exists(png_path) or \ + op.getmtime(png_path) < op.getmtime(c.pdf.path): + + subprocess.call([ + "convert", + "-density", "300x300", + "-geometry", "{}x{}".format(vyska, sirka), + "-background", "white", + "-flatten", + "{}[0]".format(c.pdf.path), # titulní strana + png_path + ]) + + urls[c.rocnik] = op.join(settings.MEDIA_URL, "cislo", "png", png_filename) + + context["object_list"] = urls + + print(context) + + # for i, c in enumerate(cisla): + # if not c.pdf: + # continue + # filename = os.path.split(c.pdf.file.name)[1].split(".")[0] + # png_filename = "{}-{}px.png".format(filename, vyska) + + # # Pokud obrázek neexistuje nebo není aktuální, vytvoř jej + # png_path = op.join(png_dir, png_filename) + # if not op.exists(png_path) or \ + # op.getmtime(png_path) < op.getmtime(c.pdf.path): + + # subprocess.call([ + # "convert", + # "-density", "300x300", + # "-geometry", "{}x{}".format(vyska, sirka), + # "-background", "white", + # "-flatten", + # "-rotate", str(90 * i), + # "{}[0]".format(c.pdf.path), # titulní strana + # png_path + # ]) + + # urls.append( + # (op.join(settings.MEDIA_URL, "cislo", "png", png_filename), c) + # ) + # vyska, sirka = sirka, vyska / 2 + + # tags = [] + + # def spirala(urls, tags, idx): + # """Rekurzivně prochází urls a generuje strom elementů do tags""" + # if idx >= len(urls): + # return + + # img_url, cislo = urls[idx] + # tags.append( + # "
    " + # .format( + # 50 if idx % 4 == 2 else 0, + # 50 if idx % 4 == 1 else 0, + # 50 if idx % 2 == 1 else 100, + # 50 if idx > 0 and idx % 2 == 0 else 100 + # ) + # ) + # tags.append("".format( + # cislo.verejne_url(), cislo.kod() + # )) + # tags.append( + # "" + # .format( + # img_url, + # 50 if idx % 4 == 3 else 0, + # 50 if idx % 4 == 2 else 0, + # 50 if idx % 2 == 0 else 100, + # 50 if idx % 2 == 1 else 100 + # ) + # ) + # tags.append("") + # spirala(urls, tags, idx + 1) + # tags.append("
    ") + # spirala(urls, tags, 0) + + # context["nahledy"] = "\n".join(tags) + return context ### Výsledky