From 6fe47279b03ea9d2a9d5a7f3b116b15869660287 Mon Sep 17 00:00:00 2001 From: Tobias Feigel Date: Sun, 6 Jul 2025 13:36:43 +0200 Subject: [PATCH] feat: add PGN4Web block support and integrate chess game replay features Implemented a new PGN4Web block with a PHP snippet for game replay functionality. Updated blueprints with PGN-specific fields, modified layout and blockpage templates, and included necessary JavaScript and assets for interactive chess game rendering. Enhanced memorial page with replayable game content. --- assets/js/{png4web.js => pgn4web.js} | 0 content/4_verein/5_memoriam/blockpage.txt | 50 ++++++++++++++++++----- site/blueprints/pages/blockpage.yml | 7 ++++ site/snippets/blocks/pgn4web.php | 35 ++++++++++++++++ site/snippets/layout.php | 4 ++ site/templates/blockpage.php | 7 ++-- 6 files changed, 89 insertions(+), 14 deletions(-) rename assets/js/{png4web.js => pgn4web.js} (100%) create mode 100644 site/snippets/blocks/pgn4web.php diff --git a/assets/js/png4web.js b/assets/js/pgn4web.js similarity index 100% rename from assets/js/png4web.js rename to assets/js/pgn4web.js diff --git a/content/4_verein/5_memoriam/blockpage.txt b/content/4_verein/5_memoriam/blockpage.txt index 152dc69..c216473 100644 --- a/content/4_verein/5_memoriam/blockpage.txt +++ b/content/4_verein/5_memoriam/blockpage.txt @@ -7,31 +7,61 @@ Blocks: [ { "content": { - "level": "h2", - "text": "Dies ist ein Test!" + "location": "kirby", + "image": [ + "file://5jxq9scmokejnvjo" + ], + "src": "", + "alt": "", + "caption": "", + "link": "", + "ratio": "", + "crop": "false" }, - "id": "eb2cb2e3-19f6-4c17-a786-723cdbc8f811", + "id": "21d51ee1-9e2c-4411-8f64-2437e02e2231", "isHidden": false, - "type": "heading" + "type": "image" }, { "content": { - "fen": "rnbqkbnr/p1pp1ppp/1p2p3/8/3P1B2/5N2/PPP1PPPP/RN1QKB1R b KQkq - 1 3" + "text": "

Roland Martius war ein echter Macher, das Herz und der Dreh- und Angelpunkt seines Vereins. Mehr als drei Jahrzehnte kämpfte er am Brett. Als die SF Bad Steben kein geeignetes Spiellokal fanden, baute er kurzerhand einen Raum in seinem Privatanwesen zum Schachzimmer um. Erst im Jahr vor seinem Tod hatte der Bezirksverband sein schachliches Lebenswerk mit dem Ludwig-Schirner-Ehrenpreis gewürdigt.

" }, - "id": "067a448c-31e5-411c-b342-f69519284394", + "id": "24e24e27-d4fc-49a4-bf29-ea8dae277b92", "isHidden": false, - "type": "fen" + "type": "text" }, { "content": { - "fen": "8/8/8/2k5/4K3/8/8/8" + "text": "

Mit Roland verlieren wir nicht nur unseren 2. Vorsitzenden und Jugendleiter, sondern auch einen sehr aktiven Spieler - eine Lücke, die sich nur schwer schließen lässt!

" }, - "id": "970b3cad-3f89-4f19-8be0-c702c522caf4", + "id": "426f0e59-7232-439e-b76a-bb825d0c5c02", "isHidden": false, - "type": "fen" + "type": "text" + }, + { + "content": { + "text": "

Es soll hier aber auch ein schachliches Highlight aus Rolands Leben nicht unerwähnt bleiben. Roland gelang es 1992 bei einer Simultanveranstaltung GM Vlastimil Hort zu besiegen. Die Partie kann hier nachgespielt werden:

" + }, + "id": "7446dc4c-0d1d-4080-82e2-a7b7fbf54463", + "isHidden": false, + "type": "text" + }, + { + "content": { + "pgn": [ + "file://zfnwwz74v2fdfx26" + ] + }, + "id": "fb61c744-c18b-4b43-b1b1-fcb91602a9aa", + "isHidden": false, + "type": "pgn4web" } ] ---- +Herotext: In ehrender Erinnerung gedenken wir unserer verstorbenen Mitglieder, die sich mit Hingabe und Leidenschaft für den Verein eingesetzt haben. Ihr Erbe und ihre Beiträge zum Schachleben in Bad Steben werden stets in unseren Herzen weiterleben. + +---- + Uuid: ko01ys2cbv2pafa8 \ No newline at end of file diff --git a/site/blueprints/pages/blockpage.yml b/site/blueprints/pages/blockpage.yml index 12f89d1..b295098 100644 --- a/site/blueprints/pages/blockpage.yml +++ b/site/blueprints/pages/blockpage.yml @@ -37,4 +37,11 @@ fields: type: textarea image: label: Bild + type: files + - type: pgn4web + label: PGN-Datei + preview: fields + fields: + pgn: + label: PGN-Datei type: files \ No newline at end of file diff --git a/site/snippets/blocks/pgn4web.php b/site/snippets/blocks/pgn4web.php new file mode 100644 index 0000000..f06c325 --- /dev/null +++ b/site/snippets/blocks/pgn4web.php @@ -0,0 +1,35 @@ + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/site/snippets/layout.php b/site/snippets/layout.php index 085c009..99fd6dc 100644 --- a/site/snippets/layout.php +++ b/site/snippets/layout.php @@ -11,6 +11,10 @@ 'assets/css/chess.css' ]) ?> + + diff --git a/site/templates/blockpage.php b/site/templates/blockpage.php index c7ce7f7..b7e5fae 100644 --- a/site/templates/blockpage.php +++ b/site/templates/blockpage.php @@ -20,13 +20,12 @@ function fenToBoard($fen) { } return $board; -} ?> - +}?> -blocks()->toBlocks() ?> + blocks()->toBlocks() ?> +endsnippet() ?> \ No newline at end of file