diff --git a/README.md b/README.md index a0aa03b..678fecb 100644 --- a/README.md +++ b/README.md @@ -31,9 +31,12 @@ nginx -p . -s stop ## TODO: - [x] create page builder + - rename `prep.py` to more informative name (`build_events.py`) - [ ] create blogging system - [ ] create xmpp bot that connects to events section. - [ ] webring system - [x] make page - [ ] populate page -- [ ] make english version (localisation) +- [x] make english version + - double check spelling and wording +- add account and donations page and style them with the site style diff --git a/build_pages.py b/build_pages.py index edda7fd..fe493a1 100644 --- a/build_pages.py +++ b/build_pages.py @@ -5,6 +5,7 @@ PAGES = [ {'name': 'account', 'titleSR': 'Nalog', 'titleEN': 'Account', 'style': 'account'}, {'name': 'contact', 'titleSR': 'Kontakt', 'titleEN': 'Contact', 'style': 'contact'}, {'name': 'events', 'titleSR': 'Događaji', 'titleEN': 'Events', 'style': 'events'}, + {'name': 'events_archive', 'titleSR': 'Arhiva događaja', 'titleEN': 'Events archive', 'style': 'events'}, {'name': 'services', 'titleSR': 'Servisi', 'titleEN': 'Services', 'style': 'services'}, {'name': 'webring', 'titleSR': 'Webring', 'titleEN': 'Webring', 'style': ''}, ] diff --git a/dogadjaji.csv b/dogadjaji.csv index a07c19c..ee7dabe 100644 --- a/dogadjaji.csv +++ b/dogadjaji.csv @@ -1,21 +1,63 @@ datum, vreme, lokacija, tema -03-05-2023, 12:00, Cvijeta Zuzoric https://www.openstreetmap.org/node/256367543, Otvaranje izlozbe (Q&A) +20-12-2022, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, Uvod u računarske mreze, firewall +03-01-2023, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, Hakaton žurka +16-01-2023, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, Radionica privatnosti na internetu +04-01-2023, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, Hakaton žurka +13-02-2023, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, Uvod u Bitcoin radonica +14-02-2023, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, Privacy & Security predavanje +20-02-2023, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, Cyber reconnisance radionica +21-02-2023, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, Uvod u konfiguraciju servera radionica (pomerena) +27-02-2023, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, Šta je Decentrala + hakaton +03-03-2023, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, Uvod u python +10-03-2023, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, Uvod u python +13-03-2023, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, TLS (SSL) kriptografija +14-03-2023, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, Matrix chat protokol +20-03-2023, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, LDAP protokol radionica +21-03-2023, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, Android reverse engineering +25-03-2023, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, Open hackerspace day - film +27-03-2023, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, SQL baze podataka +28-03-2023, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, Esolang +03-04-2023, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, Pentest radionica +04-04-2023, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, Runtime modification of Android apps +10-04-2023, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, Hakaton +11-04-2023, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, Uvod u OpenBSD +17-04-2023, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, Lan party +18-04-2023, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, Pentest radionica nastavak +23-04-2023, 19:00, Polyhedra https://www.openstreetmap.org/node/4856556781, Uvod u mreže +03-05-2023, 12:00, Cvijeta Zuzorić https://www.openstreetmap.org/node/256367543, Otvaranje izlozbe (Q&A) 03-05-2023, 18:00, KC Grad https://www.openstreetmap.org/node/4118716889, Linux install fest -04-05-2023, 17:00, Cvijeta Zuzoric https://www.openstreetmap.org/node/256367543, ULUS izlozba (Q&A) +04-05-2023, 17:00, Cvijeta Zuzorić https://www.openstreetmap.org/node/256367543, ULUS izlozba (Q&A) 04-05-2023, 18:00, Polyhedra https://www.openstreetmap.org/node/4856556781, Uvod u racunarske mreze 04-05-2023, 21:00, n/a, Online sastanak sa Zajednicom za slobodnu tehnologiju iz Kikinde -05-05-2023, 15:30, Cvijeta Zuzoric https://www.openstreetmap.org/node/256367543, ULUS izlozba (Q&A) -06-05-2023, 12:00, Cvijeta Zuzoric https://www.openstreetmap.org/node/256367543, ULUS izlozba (Q&A) -07-05-2023, 16:00, Cvijeta Zuzoric https://www.openstreetmap.org/node/256367543, ULUS izlozba (diskusija) +05-05-2023, 15:30, Cvijeta Zuzorić https://www.openstreetmap.org/node/256367543, ULUS izlozba (Q&A) +06-05-2023, 12:00, Cvijeta Zuzorić https://www.openstreetmap.org/node/256367543, ULUS izlozba (Q&A) +07-05-2023, 16:00, Cvijeta Zuzorić https://www.openstreetmap.org/node/256367543, ULUS izlozba (diskusija) 08-05-2023, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, Linux install day 09-05-2023, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, Cryptoparty - Uvod u privatnost -11-05-2023, 18:00, Polyhedra https://www.openstreetmap.org/node/4856556781, Uvod u racunarske mreze -01-08-2023, 19:00, DC Krov, Tehno veče -07-08-2023, 19:00, DC Krov, Linux ricing -08-08-2023, 19:00, DC Krov, Lambda račun -14-08-2023, 19:00, DC Krov, Linux distro diskusija -15-08-2023, 19:00, DC Krov, Pirati 777 mora -21-08-2023, 19:00, DC Krov, Python vežbe -22-08-2023, 19:00, DC Krov, Autentifikacija na internetu -28-08-2023, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, Podesavanje Mail servera -29-08-2023, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, Prevodjenje wiki-a +11-05-2023, 18:00, Polyhedra https://www.openstreetmap.org/node/4856556781, Uvod u računarske mreže +05-06-2023, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, Šifre +06-06-2023, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, Random i kriptografija +12-06-2023, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, Uvod u Blender +13-06-2023, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, Cybersecurity odbrana +19-06-2023, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, Pisanje BASH skripti +20-06-2023, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, Cybersecurity odbrana +26-06-2023, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, Python vežbe +27-06-2023, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, Cybersecurity odbrana +03-07-2023, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, DNS +04-07-2023, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, Cybersecurity odbrana +10-07-2023, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, Blender, 3D modelovanje +11-07-2023, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, Cybersecurity odbrana +17-07-2023, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, OpenGL +18-07-2023, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, Cybersecurity odbrana +24-07-2023, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, Web scraping +25-07-2023, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, Cybersecurity odbrana +31-07-2023, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, Python - Web development +01-08-2023, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, Tehno veče +07-08-2023, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, Linux ricing +08-08-2023, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, Lambda račun +14-08-2023, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, Linux distro diskusija +15-08-2023, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, Pirati 777 mora +21-08-2023, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, Python vežbe +22-08-2023, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, Autentifikacija na internetu +28-08-2023, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, Podešavanje Mail servera +29-08-2023, 19:00, DC Krov https://www.openstreetmap.org/node/10594728522, Prevođenje wiki-a diff --git a/pages/en/account.html b/pages/en/account.html index 3599186..d0594ac 100644 --- a/pages/en/account.html +++ b/pages/en/account.html @@ -1,3 +1,4 @@ +

Account

If you have created an account on dmz.rs, you can use our XMPP and e-mail server, as well as other services that support LDAP login.

For more on XMPP see this tutorial.

You can see settings for the Thundebird mail client on this image.

diff --git a/pages/en/events.html b/pages/en/events.html index f90dc54..b648774 100644 --- a/pages/en/events.html +++ b/pages/en/events.html @@ -1 +1,2 @@

Events

+

Following list contains all forthcoming events. Held events are listed in archive

diff --git a/pages/en/events_archive.html b/pages/en/events_archive.html new file mode 100644 index 0000000..53829c3 --- /dev/null +++ b/pages/en/events_archive.html @@ -0,0 +1,2 @@ +

Events archive

+

All events that we organized so far.


\ No newline at end of file diff --git a/pages/en/services.html b/pages/en/services.html index 0ba634a..530d752 100644 --- a/pages/en/services.html +++ b/pages/en/services.html @@ -49,6 +49,6 @@

These are some of the services we currently maintain on our servers. To use these services, you can register for each service separately, - or you can create a unique account + or you can create a unique account on our server and use all services with the same account.

diff --git a/pages/en/webring.html b/pages/en/webring.html index 03913f9..ec87b4d 100644 --- a/pages/en/webring.html +++ b/pages/en/webring.html @@ -1,3 +1,4 @@ +

Webring

\ No newline at end of file diff --git a/pages/sr/account.html b/pages/sr/account.html index 9f8bbdc..4781cb8 100644 --- a/pages/sr/account.html +++ b/pages/sr/account.html @@ -1,3 +1,4 @@ +

Nalog

Ako si napravio nalog na dmz.rs možeš koristiti naš XMPP i e-mail server, kao i ostale servise koji podržavaju LDAP login.

Za više o XMPP-u pogledaj tutorial.

Podešavanja za Thundebird mail klijent možeš pogledati na slici.

diff --git a/pages/sr/events.html b/pages/sr/events.html index c6c2c27..4df69a7 100644 --- a/pages/sr/events.html +++ b/pages/sr/events.html @@ -1 +1,2 @@ -

Događaji

\ No newline at end of file +

Događaji

+

Naredna lista sadrži sve predstojeće događaje. Za listu održanih događaja pogledajte arhivu

\ No newline at end of file diff --git a/pages/sr/events_archive.html b/pages/sr/events_archive.html new file mode 100644 index 0000000..600bd8b --- /dev/null +++ b/pages/sr/events_archive.html @@ -0,0 +1,2 @@ +

Arhiva događaja

+

Svi događaji koje smo do sada organzivali.


\ No newline at end of file diff --git a/pages/sr/services.html b/pages/sr/services.html index 00c7a43..f6ff41b 100644 --- a/pages/sr/services.html +++ b/pages/sr/services.html @@ -54,5 +54,5 @@

Ovo su neki od servisa koje trenutno održavamo na našim serverima. Da bi koristio ove servise, možeš da se - registuješ na svaki servis posebno, a možeš i da napraviš jedinstveni nalog na našem + registuješ na svaki servis posebno, a možeš i da napraviš jedinstveni nalog na našem serveru i da koristiš sve servise sa istim nalogom.

diff --git a/pages/sr/webring.html b/pages/sr/webring.html index 03913f9..ec87b4d 100644 --- a/pages/sr/webring.html +++ b/pages/sr/webring.html @@ -1,3 +1,4 @@ +

Webring

\ No newline at end of file diff --git a/prep.py b/prep.py index 0d12672..c3fb0d8 100644 --- a/prep.py +++ b/prep.py @@ -1,92 +1,88 @@ #! /usr/bin/env python +import csv from datetime import datetime -from functools import cmp_to_key -DAYS_SR = ["Ponedeljak", "Utorak", "Sreda", "Četvrtak", "Petak", "Subota", "Nedelja"] -DAYS_EN = ["Monday ", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"] -MONTHS_SR = [ - "Januar", "Februar", "Mart", "April", "Maj", "Jun", - "Jul", "Avgust", "Septembar", "Oktobar", "Novembar", "Decembar", - ] -MONTHS_EN = [ - "January", "February", "March", "April", "May", "June", - "July", "August", "September", "October", "November", "December", - ] +DAYS_SR = ["PON", "UTO", "SRE", "ČET", "PET", "SUB", "NED"] +DAYS_EN = ["MON ", "TUE", "WED", "THU", "FRI", "SAT", "SUN"] + +def load_events(csv_path:str) -> list[dict]: + events = [] + with open(csv_path) as csv_file: + csv_reader = csv.reader(csv_file) + next(csv_reader, None) + for event in csv_reader: + event_date = event[0] + event_date_parsed = datetime.strptime(event_date, "%d-%m-%Y").date() + event_time = event[1] + event_location = event[2] + event_title = event[3] + current_event = {"date":event_date_parsed, + "time":event_time, + "location": event_location, + "title":event_title.strip()} + events.append(current_event) + return events + +def build_html(events: list[dict], dayNames: list[str]) -> str: + events_html = [] + for event in events: + title = event["title"] + location = event["location"] + date = event["date"] + date = dayNames[date.weekday()]+", "+str(date.day)+". "+str(date.month)+". "+str(date.year)+", " + time = event["time"]+"h" + event_html = [] + event_html.append(f"
{date} {time}
") + event_html.append(f"
{title}
") + if "https://" in location: + place,link = location.split("https://") + event_html.append(f"
@{place.strip()}
") + else: + event_html.append(f"
@{location.strip()}
") + + event_html = "".join(event_html) + events_html.append(f"\n
{event_html}
") + return events_html + +events = sorted(load_events("dogadjaji.csv"), key=lambda e: e["date"]) today = datetime.today().date() -def parse_date(date): - return datetime.strptime(date,"%d-%m-%Y").date() - -def compare_events(one, two): - one = parse_date(one.split(", ")[0]) - two = parse_date(two.split(", ")[0]) - if one>two: - return 1 - elif one==two: - return 0 - else: - return -1 - -def is_past_event(event): - return event < today - -def load_events(): - events = [] - with open("dogadjaji.csv", "rt") as file: - file.readline() - for event in file.readlines(): - event = event.strip() - if event != "": - events.append(event) - return events - -def write_events(events): - with open("dogadjaji.csv", "wt") as file: - file.write("datum, vreme, lokacija, tema\n") - for event in events: - file.write(event+"\n") - -def sort_events(events): - return sorted(events, key = cmp_to_key(compare_events)) +past_events = list(filter(lambda e: e["date"] <= today, events)) +new_events = list(filter(lambda e: e["date"] >= today, events)) -def build_html(events, dayNames, monthNames): - newevents = [] - for event in events: - date, time, location, title = event.split(", ") - date = parse_date(date) - if is_past_event(date): - continue - date = dayNames[date.weekday()]+", "+str(date.day)+". "+monthNames[date.month-1]+" "+str(date.year)+"." - time = time+"h" - future_event = [] - future_event.append(" "+date+" ") - future_event.append(" "+time+" ") - if "https://" in location: - place,link = location.split("https://") - future_event.append(" "+place.strip()+" ") - else: - future_event.append(" "+location.strip()+" ") - future_event.append(" "+title+" ") - newevents.append("\n"+"\n".join(future_event)+"\n") - return newevents +page_template = "" -events = load_events() -events = sort_events(events) -write_events(events) +# Build Serbian Events page +new_events_html = build_html(new_events, DAYS_SR) +with open("pages/sr/events.html", "r") as file: + page_template = ([line for line in file])[:2] -newevents = build_html(events, DAYS_SR, MONTHS_SR) +with open("pages/sr/events.html", "w") as file: + file.writelines(page_template + new_events_html) -with open("pages/sr/events.html","wt") as file: - file.writelines(["

Događaji

\n", "\n", "\n"]) - file.writelines(newevents) - file.writelines(["
DatumVremeMestoTema
"]) +# Build English Events page +new_events_html = build_html(new_events, DAYS_EN) +with open("pages/en/events.html", "r") as file: + page_template = ([line for line in file])[:2] -newevents = build_html(events, DAYS_EN, MONTHS_EN) +with open("pages/en/events.html", "w") as file: + file.writelines(page_template + new_events_html) -with open("pages/en/events.html","wt") as file: - file.writelines(["

Events

\n", "\n", ""]) - file.writelines(newevents) - file.writelines(["
DateTimePlaceTopic
"]) +# Build Serbian Archive page +past_events_html = build_html(past_events, DAYS_SR) +with open("pages/sr/events_archive.html", "r") as file: + page_template = ([line for line in file])[:2] + +with open("pages/sr/events_archive.html", "w") as file: + file.writelines(page_template + past_events_html) + +# Build English Archive page +past_events_html = build_html(past_events, DAYS_EN) +with open("pages/en/events_archive.html", "r") as file: + page_template = ([line for line in file])[:2] + +with open("pages/en/events_archive.html", "w") as file: + file.writelines(page_template + past_events_html) diff --git a/site/styles/account.css b/site/styles/account.css index 0276717..e69de29 100644 --- a/site/styles/account.css +++ b/site/styles/account.css @@ -1,4 +0,0 @@ -h1 { - margin-bottom: 2rem; - font-weight: normal; -} \ No newline at end of file diff --git a/site/styles/contact.css b/site/styles/contact.css index 0276717..e69de29 100644 --- a/site/styles/contact.css +++ b/site/styles/contact.css @@ -1,4 +0,0 @@ -h1 { - margin-bottom: 2rem; - font-weight: normal; -} \ No newline at end of file diff --git a/site/styles/events.css b/site/styles/events.css index 8cd147a..85c0916 100644 --- a/site/styles/events.css +++ b/site/styles/events.css @@ -1,30 +1,58 @@ -table { - table-layout: fixed; - border-spacing: 0; +.event { + display: flex; + flex-direction: row; } -th, -td { - padding: 0 1rem 0 1rem; - text-align: left; - border-left: 2px solid var(--border); +.event:hover { + border-bottom: 5px var(--hightlight) solid; } -th { - padding: 1rem 1rem 0 1rem; - border-bottom: 2px solid var(--border); +.event:hover>div { + padding-bottom: calc(0.5rem - 5px); } -td:nth-child(odd) { +.event>div { + padding: 0.5rem; white-space: nowrap; } -td { - padding: 0 1rem 1rem 1rem; - vertical-align: top; +.date { + width: 250px; + font-size: 0.9em; + overflow-x: hidden; + white-space: nowrap; } -h1 { - margin-bottom: 2rem; - font-weight: normal; -} \ No newline at end of file +.title { + border-left: 2px solid var(--border); + font-weight: bold; +} + +.place { + font-size: 0.9em; +} + +@media screen and (max-width: 1160px) { + .event { + flex-direction: column; + margin-bottom: 1rem; + border-left: 2px solid var(--border); + } + + .event > div { + padding: 0 0.5rem; + white-space: normal; + } + + .event:hover { + border-bottom: none; + } + + .event:hover> div { + padding-bottom: 0; + } + + .title { + border-left: none; + } +} diff --git a/site/styles/home.css b/site/styles/home.css index 7e8cc84..2297442 100644 --- a/site/styles/home.css +++ b/site/styles/home.css @@ -1,8 +1,3 @@ -h1 { - margin-bottom: 2rem; - font-weight: normal; -} - dl { padding: 1rem 0; } diff --git a/site/styles/services.css b/site/styles/services.css index 1f842b4..87c2402 100644 --- a/site/styles/services.css +++ b/site/styles/services.css @@ -20,8 +20,3 @@ td { padding: 0 1rem 1rem 1rem; vertical-align: top; } - -h1 { - margin-bottom: 2rem; - font-weight: normal; -} \ No newline at end of file diff --git a/site/styles/style.css b/site/styles/style.css index cbd8559..4553a45 100644 --- a/site/styles/style.css +++ b/site/styles/style.css @@ -68,6 +68,13 @@ main { overflow: auto; } +main h1 { + margin-bottom: 2rem; + font-weight: normal; + font-size: 1.5em; + font-variant-caps: small-caps; +} + a, a:visited { text-decoration: none;