[Funktionsfähigkeit wiederhergestellt]

This commit is contained in:
xoy 2023-10-04 12:30:59 +02:00
parent 6027629fd6
commit 756e8b2931
8 changed files with 82 additions and 45 deletions

View File

@ -1 +0,0 @@
# Event Dokumentation

View File

@ -1,34 +1,29 @@
# README # README
## Inhaltsverzeichnis ## Projektstruktur
0. [README](https://git.ctdo.de/xoy/ctdo.de/src/branch/master/README.MD) - Übersicht
1. [SCRUMBOARD](https://git.ctdo.de/xoy/ctdo.de/src/branch/master/SCRUMBOARD.MD) - Entwicklungsplan
---
## Struktur
| Name | Pfad | | Name | Pfad |
| --------------------------------- | --------------- | | --------------------------------- | ---------------- |
| Templates | /templates/ | | Templates | /templates/ |
| Seiten / Seiteninhalte | /pages/ | | Seiten / Seiteninhalte | /pages/ |
| Events | /events/ | | Events | /events/ |
| Bilder | /images/ | | Bilder | /images/ |
| Post Bilder | /images/posts/ | | Post Bilder | /images/posts/ |
| Post Bilder | /images/events/ |
| CSS | /css/ | | CSS | /css/ |
| PHP Scripts | /php/ | | PHP Scripts | /php/ |
## Erstellen neuer Events ## Erstellen neuer Events / Blog Posts
Datei im Eventverzeichnis Anlegen: Datei im Eventverzeichnis Anlegen:
- Nummerierung beachten! - Nummerierung beachten!
- *.md* Dateierweiterung verwenden! - *.md* Dateierweiterung verwenden!
``` ```
Blogpost Titel Titel
Blogpost Beschreibung Beschreibung
Blogpost Datum Datum
Blogpost Autor Autor
------------------------ ------------------------
# Content here! # Content here!
``` ```
@ -37,10 +32,10 @@ Strukturierung:
- Header - Header
``` ```
Blogpost Titel Titel
Blogpost Beschreibung Beschreibung
Blogpost Datum Datum
Blogpost Autor Autor
``` ```
- Trenner zwischen Header und Content - Trenner zwischen Header und Content
@ -57,4 +52,4 @@ Unter dem Trenner kann Markdown verwendet werden.
Bilder für Posts kommen in das Verzeichnis */images/posts/* Bilder für Posts kommen in das Verzeichnis */images/posts/*
[Event Dokumentation](https://git.ctdo.de/xoy/ctdo.de/src/branch/master/EVENT.MD) Bilder für Events kommen in das Verzeichnis */images/events/*

View File

@ -6,6 +6,7 @@
} }
* { * {
box-sizing: border-box;
word-wrap: break-word; word-wrap: break-word;
} }

View File

@ -15,10 +15,8 @@ $converter = new CommonMarkConverter([
'allow_unsafe_links' => false, 'allow_unsafe_links' => false,
]); ]);
//$pageloader = new FilesystemLoader(__DIR__ . '/pages');
$templateloader = new FilesystemLoader(__DIR__ . '/templates'); $templateloader = new FilesystemLoader(__DIR__ . '/templates');
//$twig_pages = new Environment($pageloader);
$twig_templates = new Environment($templateloader); $twig_templates = new Environment($templateloader);
$title = ''; $title = '';
@ -56,78 +54,96 @@ if(isset($_GET['page'])) {
switch ($page) { switch ($page) {
case 'index': case 'index':
$content = $converter->convert(file_get_contents(__DIR__ . '/pages/index.md')); $content = $converter->convert(file_get_contents(__DIR__ . '/pages/index.md'));
$content = $twig_templates->render('index.twig', ['content' => $content, 'topic' => $topic, 'treff' => $treff, 'repaircafe' => $repaircafe, 'brunch' => $brunch, 'events' => generate_event_list() ]);
$filetoedit = "pages/index.md";
$css[] = 'home'; $css[] = 'home';
$css[] = 'events'; $css[] = 'events';
break; break;
case 'about': case 'about':
$content = $converter->convert(file_get_contents(__DIR__ . '/pages/about.md')); $content = $converter->convert(file_get_contents(__DIR__ . '/pages/about.md'));
$filetoedit = "pages/about.md";
$css[] = 'about'; $css[] = 'about';
break; break;
case 'treff': case 'treff':
$content = $converter->convert(file_get_contents(__DIR__ . '/pages/treff.md')); $content = $converter->convert(file_get_contents(__DIR__ . '/pages/treff.md'));
$filetoedit = "pages/treff.md";
break; break;
case 'blog': case 'blog':
if(!isset($_GET['id'])) { if(!isset($_GET['id'])) {
$content = $twig_templates->render('blog.twig', [ 'posts' => generate_post_list() ]); $content = $twig_templates->render('blog.twig', [ 'posts' => generate_post_list() ]);
$filetoedit = "templates/blog.twig";
$css[] = 'events'; $css[] = 'events';
} else { } else {
$content = $converter->convert(get_post_content($_GET['id'])); $content = $converter->convert(get_post_content($_GET['id']));
$filetoedit = "posts/".$_GET['id'].".md";
$css[] = 'event'; $css[] = 'event';
} }
break; break;
case 'events': case 'events':
if(!isset($_GET['id'])) { if(!isset($_GET['id'])) {
$content = $twig_templates->render('events.twig', [ 'topic' => $topic, 'treff' => $treff, 'repaircafe' => $repaircafe, 'brunch' => $brunch, 'events' => generate_event_list() ]); $content = $twig_templates->render('events.twig', [ 'topic' => $topic, 'treff' => $treff, 'repaircafe' => $repaircafe, 'brunch' => $brunch, 'events' => generate_event_list() ]);
$filetoedit = "templates/events.twig";
$css[] = 'events'; $css[] = 'events';
} else { } else {
$content = str_mass_replace(array('{{ topicdatum }}', 'Chaostreff Dortmund e.V.', '{{ treffdatum }}', '{{ repaircafedatum }}', '{{ brunchdatum }}'), array(get_next_topic()->date, html_link('/?page=treff', '', 'Chaostreff Dortmund e.V.', FALSE), get_next_treff()->date, get_next_repaircafe()->date, get_next_brunch()->date), $converter->convert(get_event_content($_GET['id']))); $content = str_mass_replace(array('{{ topicdatum }}', 'Chaostreff Dortmund e.V.', '{{ treffdatum }}', '{{ repaircafedatum }}', '{{ brunchdatum }}'), array(get_next_topic()->date, html_link('/?page=treff', '', 'Chaostreff Dortmund e.V.', FALSE), get_next_treff()->date, get_next_repaircafe()->date, get_next_brunch()->date), $converter->convert(get_event_content($_GET['id'])));
$filetoedit = "events/".$_GET['id'].".md";
$css[] = 'event'; $css[] = 'event';
} }
break; break;
case 'kontakt': case 'kontakt':
$content = $twig_templates->render('kontakt.twig'); $content = $twig_templates->render('kontakt.twig');
$filetoedit = "templates/kontakt.twig";
$css[] = 'kontakt'; $css[] = 'kontakt';
break; break;
case 'adresse': case 'adresse':
$content = $converter->convert(file_get_contents(__DIR__ . '/pages/kontakt/adresse.md')).'<iframe scrolling="no" marginheight="0" marginwidth="0" src="https://www.openstreetmap.org/export/embed.html?bbox=7.463200986385346%2C51.52693021432671%2C7.4667415022850046%2C51.52841869497588&amp;layer=mapnik&amp;marker=51.52767446073405%2C7.464971244335175" frameborder="0" class="osm"></iframe>'; $content = $converter->convert(file_get_contents(__DIR__ . '/pages/kontakt/adresse.md')).'<iframe scrolling="no" marginheight="0" marginwidth="0" src="https://www.openstreetmap.org/export/embed.html?bbox=7.463200986385346%2C51.52693021432671%2C7.4667415022850046%2C51.52841869497588&amp;layer=mapnik&amp;marker=51.52767446073405%2C7.464971244335175" frameborder="0" class="osm"></iframe>';
$filetoedit = "pages/kontakt/adresse.md";
break; break;
case 'irc': case 'irc':
$content = $converter->convert(file_get_contents(__DIR__ . '/pages/kontakt/irc.md')); $content = $converter->convert(file_get_contents(__DIR__ . '/pages/kontakt/irc.md'));
$filetoedit = "pages/kontakt/irc.md";
break; break;
case 'mail': case 'mail':
$content = $converter->convert(file_get_contents(__DIR__ . '/pages/kontakt/mail.md')); $content = $converter->convert(file_get_contents(__DIR__ . '/pages/kontakt/mail.md'));
$filetoedit = "pages/kontakt/mail.md";
break; break;
case 'tel': case 'tel':
$content = $converter->convert(file_get_contents(__DIR__ . '/pages/kontakt/tel.md')); $content = $converter->convert(file_get_contents(__DIR__ . '/pages/kontakt/tel.md'));
$filetoedit = "pages/kontakt/tel.md";
break; break;
case 'support': case 'support':
$content = $converter->convert(file_get_contents(__DIR__ . '/pages/support.md')); $content = $converter->convert(file_get_contents(__DIR__ . '/pages/support.md'));
$filetoedit = "pages/kontakt/support.md";
break; break;
case 'verein': case 'verein':
$content = $converter->convert(file_get_contents(__DIR__ . '/pages/verein.md')); $content = $converter->convert(file_get_contents(__DIR__ . '/pages/verein.md'));
$filetoedit = "pages/verein.md";
break; break;
case 'impressum': case 'impressum':
$title = 'impressum'; $title = 'impressum';
$content = $converter->convert(file_get_contents(__DIR__ . '/pages/impressum.md')); $content = $converter->convert(file_get_contents(__DIR__ . '/pages/impressum.md'));
$filetoedit = "pages/impressum.md";
break; break;
case 'datenschutz': case 'datenschutz':
$title = 'datenschutz'; $title = 'datenschutz';
$content = $converter->convert(file_get_contents(__DIR__ . '/pages/datenschutz.md')); $content = $converter->convert(file_get_contents(__DIR__ . '/pages/datenschutz.md'));
$filetoedit = "pages/datenschutz.md";
break; break;
default: default:
$content = $twig_pages->render('404.twig', ['page' => $_GET['page']]); $content = $twig_templates->render('404.twig', ['page' => $_GET['page']]);
$filetoedit = "templates/404.twig";
break; break;
} }
} else { } else {
$active_page = 'index'; $active_page = 'index';
$title = $active_page; $title = $active_page;
//$content = $twig_pages->render('index.twig', [ 'posts' => generate_post_list(4) ]);
$content = $converter->convert(file_get_contents(__DIR__ . '/pages/index.md')); $content = $converter->convert(file_get_contents(__DIR__ . '/pages/index.md'));
$content = $twig_templates->render('index.twig', ['content' => $content, 'topic' => $topic, 'treff' => $treff, 'repaircafe' => $repaircafe, 'brunch' => $brunch, 'events' => generate_event_list() ]);
$css[] = 'home'; $css[] = 'home';
$css[] = 'events'; $css[] = 'events';
} }
$nav = generate_nav($active_page, $pages, $page_names); $nav = generate_nav($active_page, $pages, $page_names);
echo $twig_templates->render('default.twig', ['title' => $title, 'css' => $css, 'nav' => $nav, 'raumstatus' => $raumstatus, 'main' => $content]); echo $twig_templates->render('default.twig', ['title' => $title, 'css' => $css, 'nav' => $nav, 'raumstatus' => $raumstatus, 'main' => $content, 'file_to_edit' => $filetoedit]);
?> ?>

View File

@ -42,6 +42,7 @@
<ul> <ul>
<li> <a href="/?page=impressum">impressum</a> </li> <li> <a href="/?page=impressum">impressum</a> </li>
<li> <a href="/?page=datenschutz">datenschutz</a> </li> <li> <a href="/?page=datenschutz">datenschutz</a> </li>
<li> <a href="https://git.ctdo.de/xoy/ctdo.de/_edit/main/{{ file_to_edit }}" target="_blank">Seite bearbeiten</a> </li>
</ul> </ul>
</nav> </nav>
</footer> </footer>

View File

@ -5,7 +5,7 @@
{% elseif topic.days == 1 %} {% elseif topic.days == 1 %}
<p class="topic">Der nächste <a href="/?page=events&id=topictreff">Topictreff</a> findet morgen [{{ topic.date }}] statt!</p> <p class="topic">Der nächste <a href="/?page=events&id=topictreff">Topictreff</a> findet morgen [{{ topic.date }}] statt!</p>
{% else %} {% else %}
<p class="topic">Der nächste <a href="/?page=events&id=topictreff">Topictreff</a> findet in {{ topic.days }} [{{ topic.date }}] statt!</p> <p class="topic">Der nächste <a href="/?page=events&id=topictreff">Topictreff</a> findet in {{ topic.days }} Tagen [{{ topic.date }}] statt!</p>
{% endif %} {% endif %}
{% if treff.days == 0 %} {% if treff.days == 0 %}
@ -13,7 +13,7 @@
{% elseif treff.days == 1 %} {% elseif treff.days == 1 %}
<p class="topic">Der nächste <a href="/?page=events&id=treff">Treff</a> findet morgen [{{ treff.date }}] statt!</p> <p class="topic">Der nächste <a href="/?page=events&id=treff">Treff</a> findet morgen [{{ treff.date }}] statt!</p>
{% else %} {% else %}
<p class="topic">Der nächste <a href="/?page=events&id=treff">Treff</a> findet in {{ treff.days }} [{{ treff.date }}] statt!</p> <p class="topic">Der nächste <a href="/?page=events&id=treff">Treff</a> findet in {{ treff.days }} Tagen [{{ treff.date }}] statt!</p>
{% endif %} {% endif %}
{% if repaircafe.days == 0 %} {% if repaircafe.days == 0 %}
@ -21,7 +21,7 @@
{% elseif repaircafe.days == 1 %} {% elseif repaircafe.days == 1 %}
<p class="topic">Das nächste <a href="/?page=events&id=repaircafe">RepairCafe</a> findet morgen [{{ repaircafe.date }}] statt!</p> <p class="topic">Das nächste <a href="/?page=events&id=repaircafe">RepairCafe</a> findet morgen [{{ repaircafe.date }}] statt!</p>
{% else %} {% else %}
<p class="topic">Das nächste <a href="/?page=events&id=repaircafe">RepairCafe</a> findet in {{ repaircafe.days }} [{{ repaircafe.date }}] statt!</p> <p class="topic">Das nächste <a href="/?page=events&id=repaircafe">RepairCafe</a> findet in Tagen {{ repaircafe.days }} [{{ repaircafe.date }}] statt!</p>
{% endif %} {% endif %}
{% if brunch.days == 0 %} {% if brunch.days == 0 %}
@ -29,7 +29,7 @@
{% elseif brunch.days == 1 %} {% elseif brunch.days == 1 %}
<p class="topic">Der nächste <a href="/?page=events&id=brunch">Brunch</a> findet morgen [{{ brunch.date }}] statt!</p> <p class="topic">Der nächste <a href="/?page=events&id=brunch">Brunch</a> findet morgen [{{ brunch.date }}] statt!</p>
{% else %} {% else %}
<p class="topic">Der nächste <a href="/?page=events&id=brunch">Brunch</a> findet in {{ brunch.days }} [{{ brunch.date }}] statt!</p> <p class="topic">Der nächste <a href="/?page=events&id=brunch">Brunch</a> findet in {{ brunch.days }} Tagen [{{ brunch.date }}] statt!</p>
{% endif %} {% endif %}
{{ events | raw }} {{ events | raw }}

View File

@ -1,5 +1,37 @@
{{ content | raw }} {{ content | raw }}
<h2>Die nächsten Events:</h2> <h2>Die nächsten Events:</h2>
{{ topic | raw }}
{{ posts | raw }} {% if topic.days == 0 %}
<p class="topic">Der nächste <a href="/?page=events&id=topictreff">Topictreff</a> findet heute [{{ topic.date }}] statt!</p>
{% elseif topic.days == 1 %}
<p class="topic">Der nächste <a href="/?page=events&id=topictreff">Topictreff</a> findet morgen [{{ topic.date }}] statt!</p>
{% else %}
<p class="topic">Der nächste <a href="/?page=events&id=topictreff">Topictreff</a> findet in {{ topic.days }} Tagen [{{ topic.date }}] statt!</p>
{% endif %}
{% if treff.days == 0 %}
<p class="topic">Der nächste <a href="/?page=events&id=treff">Treff</a> findet heute [{{ treff.date }}] statt!</p>
{% elseif treff.days == 1 %}
<p class="topic">Der nächste <a href="/?page=events&id=treff">Treff</a> findet morgen [{{ treff.date }}] statt!</p>
{% else %}
<p class="topic">Der nächste <a href="/?page=events&id=treff">Treff</a> findet in {{ treff.days }} Tagen [{{ treff.date }}] statt!</p>
{% endif %}
{% if repaircafe.days == 0 %}
<p class="topic">Das nächste <a href="/?page=events&id=repaircafe">RepairCafe</a> findet heute [{{ repaircafe.date }}] statt!</p>
{% elseif repaircafe.days == 1 %}
<p class="topic">Das nächste <a href="/?page=events&id=repaircafe">RepairCafe</a> findet morgen [{{ repaircafe.date }}] statt!</p>
{% else %}
<p class="topic">Das nächste <a href="/?page=events&id=repaircafe">RepairCafe</a> findet in Tagen {{ repaircafe.days }} [{{ repaircafe.date }}] statt!</p>
{% endif %}
{% if brunch.days == 0 %}
<p class="topic">Der nächste <a href="/?page=events&id=brunch">Brunch</a> findet heute [{{ brunch.date }}] statt!</p>
{% elseif brunch.days == 1 %}
<p class="topic">Der nächste <a href="/?page=events&id=brunch">Brunch</a> findet morgen [{{ brunch.date }}] statt!</p>
{% else %}
<p class="topic">Der nächste <a href="/?page=events&id=brunch">Brunch</a> findet in {{ brunch.days }} Tagen [{{ brunch.date }}] statt!</p>
{% endif %}
{{ events | raw }}

View File

@ -1,7 +0,0 @@
<?php
require __DIR__ . '/php/util.php';
$u = new Util();
echo var_dump($u->get_next_brunch());