diff --git a/README.md b/README.md
index c69740c..74a0467 100644
--- a/README.md
+++ b/README.md
@@ -682,11 +682,14 @@ Unter **Wiki** im Menü liegt der Einsteiger-Guide der Legion: Kapitel mit Unter
automatisch nummeriert (3. / 3.1.), mit Suche, „WIP“-Markierung, Verlauf aller Änderungen
und Wiederherstellen alter Versionen. Geschrieben wird in einem einfachen Textformat mit
Knöpfen (fett, Überschrift, Liste, Tabelle, Link, `[[Wiki-Link]]`, Bild-Upload) und
-Live-Vorschau (`includes/wiki.php`, `wiki_render()`); eingegebenes HTML ist nie aktiv.
+Live-Vorschau (`includes/wiki.php`, `wiki_render()`); eingegebenes HTML ist nie aktiv. **Videos:**
+Ein Link zu YouTube (auch Shorts und Startzeit), Twitch (Clip oder Video), Vimeo oder einer
+Videodatei (.mp4/.webm) allein in einer Zeile wird zum eingebetteten Player - im Editor über
+den Knopf „▶ Video“ (`wiki_video_embed()`; YouTube über youtube-nocookie.com).
- **Lesen:** `wiki.view` - bekommen beim Update alle Gruppen, die ins Dashboard dürfen.
- **Schreiben:** `wiki.edit` für ganze Gruppen, oder einzelne Mitglieder, die die Leitung im
- Wiki unter „Mitwirkende“ hinzufügt (Tabelle `wiki_contributors`).
+ Wiki unter „Mitwirkende“ hinzufügt (Tabelle `wiki_contributors`, Suchliste mit Avatar und Gruppe).
- **Verwalten:** `wiki.manage` - Seiten löschen und verschieben, Mitwirkende verwalten,
alte Versionen wiederherstellen.
@@ -770,6 +773,22 @@ die Moderation. Es gelten dieselben Regeln wie bei Kommentaren: Schimpfwortfilte
Links bzw. von neuen Mitgliedern erst nach Freigabe (Moderation → Freigabe), Melden-Knopf,
höchstens 8 neue Termine pro Stunde (`calendar_action.php`).
+## Aktivitätscheck
+
+**Aktivitätscheck** im Menü (`activity.php`, Berechtigung `activity.manage`) bzw. `/aktivitaetscheck`
+im Discord: Der Bot postet im gewählten Kanal eine Nachricht mit den Knöpfen „Ich bin da“ und
+„Ich bin nicht da“ (Knopftexte, Titel, Text, Farbe und Bild frei wählbar, mit Live-Vorschau).
+Antworten kann, wer die Zielrolle hat; die Antwort lässt sich bis zum Ende ändern. Nach der
+eingestellten Zeit - oder vorher über „Jetzt abschließen“ (Website) bzw.
+`/aktivitaetscheck_beenden` - bekommen alle ohne Rückmeldung die gewählten Folgen: PN (Text mit
+{name}/{titel}/{server}), Rolle entfernen, Rolle geben; auf Wunsch auch alle mit „nicht da“.
+Die Liste landet immer im Log-Kanal. „Abbrechen“ beendet ohne Folgen. Die Website zeigt je
+Check, wer da / nicht da / noch offen ist.
+
+Im Bot: `cogs/activity.py` (Tabellen `activity_checks`, `activity_responses`, Knöpfe über
+DynamicItem auch nach Neustarts), API `/api/activity-checks` in `api.py`. Der Bot kann Rollen nur
+unterhalb seiner eigenen Rolle ändern.
+
## Moderation (Galeriebilder und Kommentare)
`includes/moderation.php`, Seite **Admin → Moderation** (`moderation.php`, Berechtigung
diff --git a/activity.php b/activity.php
new file mode 100644
index 0000000..0062639
--- /dev/null
+++ b/activity.php
@@ -0,0 +1,319 @@
+ 0) {
+ $detail = activity_api_request('GET', '/' . $detailId)['check'] ?? null;
+ } else {
+ $checks = activity_api_request('GET', '', ['guild_id' => events_guild_id()])['checks'] ?? [];
+ }
+} catch (Throwable $e) {
+ $apiError = $e->getMessage();
+}
+if ($detailId > 0 && !$detail && !$apiError) {
+ show_not_found();
+}
+
+// Kanaele und Rollen fuer das Formular
+$channels = [];
+$roles = [];
+$pickerError = null;
+if ($detailId === 0) {
+ try {
+ $channels = guilds_api_request('/channels')['channels'] ?? [];
+ $roles = guilds_api_request('/roles')['roles'] ?? [];
+ } catch (Throwable $e) {
+ $pickerError = $e->getMessage();
+ }
+}
+
+/** Discord-IDs -> Website-Konten (Name + Profilbild), fuer die Listen in der Detailansicht. */
+$usersByDiscord = [];
+if ($detail) {
+ $ids = array_merge(array_column($detail['responses'] ?? [], 'user_id'), array_column($detail['pending'] ?? [], 'user_id'),
+ array_column($detail['result']['missing'] ?? [], 'user_id'));
+ $ids = array_values(array_unique(array_map('strval', $ids)));
+ if ($ids) {
+ $stmt = db()->prepare('SELECT id, username, display_name, avatar_filename, discord_id FROM users WHERE discord_id IN ('
+ . implode(',', array_fill(0, count($ids), '?')) . ')');
+ $stmt->execute($ids);
+ foreach ($stmt->fetchAll() as $row) {
+ $usersByDiscord[(string) $row['discord_id']] = $row;
+ }
+ }
+}
+$person = static function (string $discordId, string $fallbackName) use ($usersByDiscord): string {
+ $user = $usersByDiscord[$discordId] ?? null;
+ $name = $user ? ($user['display_name'] !== '' ? $user['display_name'] : $user['username']) : $fallbackName;
+ $avatar = avatar_html($user ?: ['id' => $discordId, 'display_name' => $fallbackName], 28);
+ return '
' . $avatar . ($user ? '' . e($name) . ' ' : '' . e($name) . ' ') . ' ';
+};
+
+/** "noch 2 Tage 4 Std." bzw. "vor 3 Std." */
+$relative = static function (int $timestamp): string {
+ $diff = $timestamp - time();
+ $abs = abs($diff);
+ $text = $abs >= 86400 ? floor($abs / 86400) . ' Tg. ' . floor(($abs % 86400) / 3600) . ' Std.'
+ : ($abs >= 3600 ? floor($abs / 3600) . ' Std. ' . floor(($abs % 3600) / 60) . ' Min.' : max(1, (int) floor($abs / 60)) . ' Min.');
+ return $diff >= 0 ? 'noch ' . $text : 'vor ' . $text;
+};
+
+$roleOptions = static function (string $selected = '', bool $withNone = false) use ($roles): string {
+ $html = $withNone ? '– keine – ' : '– Rolle wählen – ';
+ foreach ($roles as $role) {
+ $rid = (string) ($role['role_id'] ?? '');
+ $html .= '@' . e((string) ($role['name'] ?? '')) . ' ';
+ }
+ return $html;
+};
+
+$openChecks = array_values(array_filter($checks, static fn ($c) => ($c['status'] ?? '') === 'open'));
+$pastChecks = array_values(array_filter($checks, static fn ($c) => ($c['status'] ?? '') !== 'open'));
+
+$pageTitle = $detail ? 'Aktivitätscheck: ' . $detail['title'] : 'Aktivitätschecks';
+$containerWide = true;
+include __DIR__ . '/includes/header.php';
+?>
+
+ Der Discord-Bot ist gerade nicht erreichbar: = e($apiError) ?>
+
+
+
+ $r['status'] === 'present'));
+ $absent = array_values(array_filter($detail['responses'] ?? [], static fn ($r) => $r['status'] === 'absent'));
+ $missing = $isOpen ? ($detail['pending'] ?? []) : ($detail['result']['missing'] ?? []);
+ ?>
+
+
‹ Alle Aktivitätschecks
+
+
+ #= e((string) ($detail['channel_name'] ?? $detail['channel_id'])) ?> · für @= e((string) ($detail['target_role_name'] ?? '?')) ?> ·
+ = $isOpen ? 'endet ' . e(date('d.m.Y H:i', (int) $detail['deadline'])) . ' Uhr (' . e($relative((int) $detail['deadline'])) . ')'
+ : 'beendet ' . e(date('d.m.Y H:i', (int) $detail['closed_at'])) . ' Uhr von ' . e((string) $detail['closed_by']) ?>
+ · Im Discord ansehen
+
+
+
+
+
+
+
+
+ Folgen ohne Rückmeldung= !empty($detail['apply_to_absent']) ? ' (auch bei „nicht da“)' : '' ?>:
+
+ = $parts ? e(implode(' · ', $parts)) : 'keine - nur Liste im Log-Kanal ' ?>
+
+ Ergebnis: = (int) ($detail['result']['dm_sent'] ?? 0) ?> PN verschickt= !empty($detail['result']['dm_failed']) ? ' (' . (int) $detail['result']['dm_failed'] . ' mit geschlossenen PNs)' : '' ?>,
+ = (int) ($detail['result']['roles_changed'] ?? 0) ?> Rollen geändert= !empty($detail['result']['role_errors']) ? ', ' . (int) $detail['result']['role_errors'] . ' Fehler (fehlen dem Bot Rechte?)' : '' ?>
+
+
+
+
+
+
+
✅ Da = count($present) ?>
+
= $person((string) $r['user_id'], (string) $r['user_name']) ?>
+
Noch niemand.
+
+
+
❌ Nicht da = count($absent) ?>
+
= $person((string) $r['user_id'], (string) $r['user_name']) ?>
+
Niemand.
+
+
+
⏳ = $isOpen ? 'Noch offen' : 'Ohne Rückmeldung' ?> = count($missing) ?>
+
= $person((string) $r['user_id'], (string) ($r['user_name'] ?? $r['name'] ?? '?')) ?>
+
= $isOpen ? 'Alle haben sich gemeldet 🎉' : 'Alle haben sich gemeldet 🎉' ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Der Bot postet eine Nachricht mit den Knöpfen „Ich bin da“ und „Ich bin nicht da“. Wer die Zielrolle hat, meldet sich
+ dort zurück. Zur Frist - oder vorher über „Jetzt abschließen“ - bekommen alle ohne Rückmeldung die eingestellten Folgen.
+ Im Discord geht das auch mit /aktivitaetscheck.
+
+
+
Kanäle/Rollen konnten nicht geladen werden: = e($pickerError) ?>
+
+
+
+
+
+
Neuer Aktivitätscheck
+
+
+
+
+
+
Laufende Checks = count($openChecks) ?>
+
Gerade läuft kein Aktivitätscheck.
+
+
+
+
+
+
Beendet
+
+
+
+
+ = e($check['title']) ?>
+ = e(date('d.m.Y', (int) ($check['closed_at'] ?: $check['deadline']))) ?> ·
+ = $check['status'] === 'cancelled' ? 'abgebrochen' : '✅ ' . (int) ($c['present'] ?? 0) . ' · ❌ ' . (int) ($c['absent'] ?? 0) . ' · ohne Rückmeldung: ' . count($check['result']['missing'] ?? []) ?>
+
+
+
+
+
+
+
+
diff --git a/activity_action.php b/activity_action.php
new file mode 100644
index 0000000..46a1d28
--- /dev/null
+++ b/activity_action.php
@@ -0,0 +1,111 @@
+ events_guild_id(),
+ 'channel_id' => $channelId,
+ 'target_role_id' => $roleId,
+ 'title' => mb_substr($title, 0, 100),
+ 'message' => mb_substr($message, 0, 3500),
+ 'color' => preg_match('/^#[0-9a-f]{6}$/i', $color) ? hexdec(substr($color, 1)) : 0xC9A227,
+ 'image_url' => $image !== '' ? $image : null,
+ 'ping_role' => !empty($_POST['ping_role']),
+ 'yes_label' => mb_substr(trim((string) ($_POST['yes_label'] ?? '')), 0, 60) ?: null,
+ 'no_label' => mb_substr(trim((string) ($_POST['no_label'] ?? '')), 0, 60) ?: null,
+ 'duration_minutes' => $minutes,
+ 'dm_enabled' => $dmEnabled,
+ 'dm_message' => $dmEnabled ? mb_substr(trim((string) ($_POST['dm_message'] ?? '')), 0, 1800) : null,
+ 'remove_role_id' => $idField('remove_role_id'),
+ 'add_role_id' => $idField('add_role_id'),
+ 'apply_to_absent' => !empty($_POST['apply_to_absent']),
+ 'created_by' => (int) ($me['discord_id'] ?? 0),
+ ];
+ $result = activity_api_request('POST', '', [], $body);
+ $consequences = array_filter([
+ $dmEnabled ? 'PN' : null,
+ $body['remove_role_id'] ? 'Rolle entfernen' : null,
+ $body['add_role_id'] ? 'Rolle geben' : null,
+ ]);
+ admin_log('📋 Aktivitätscheck gestartet', [
+ 'Titel' => $body['title'],
+ 'Dauer' => $minutes >= 1440 ? ($minutes / 1440) . ' Tage' : ($minutes / 60) . ' Stunden',
+ 'Folgen' => $consequences ? implode(', ', $consequences) : 'keine',
+ ], 'info', 'events');
+ set_flash('success', 'Aktivitätscheck gepostet - die Leute können sich jetzt im Discord zurückmelden.');
+ redirect('/activity.php?id=' . (int) ($result['check_id'] ?? 0));
+
+ case 'close':
+ case 'cancel':
+ $result = activity_api_request('POST', '/' . $id . '/close', [], [
+ 'cancel' => $action === 'cancel',
+ 'closed_by' => $myName . ' (Website)',
+ ])['result'] ?? [];
+ admin_log($action === 'cancel' ? '🚫 Aktivitätscheck abgebrochen' : '📋 Aktivitätscheck abgeschlossen', [
+ 'Check' => '#' . $id,
+ 'Ohne Rückmeldung' => $action === 'cancel' ? '' : (string) count($result['missing'] ?? []),
+ ], $action === 'cancel' ? 'warning' : 'success', 'events');
+ set_flash('success', $action === 'cancel'
+ ? 'Aktivitätscheck abgebrochen - ohne Folgen.'
+ : 'Aktivitätscheck abgeschlossen. Ohne Rückmeldung: ' . count($result['missing'] ?? []) . '.');
+ redirect('/activity.php?id=' . $id);
+
+ case 'delete':
+ activity_api_request('DELETE', '/' . $id);
+ admin_log('🗑️ Aktivitätscheck gelöscht', ['Check' => '#' . $id], 'warning', 'events');
+ set_flash('success', 'Aktivitätscheck gelöscht.');
+ redirect('/activity.php');
+ }
+} catch (InvalidArgumentException $e) {
+ set_flash('error', $e->getMessage());
+ redirect('/activity.php');
+} catch (Throwable $e) {
+ set_flash('error', 'Der Discord-Bot hat nicht mitgespielt: ' . $e->getMessage());
+ redirect($id > 0 ? '/activity.php?id=' . $id : '/activity.php');
+}
+
+redirect('/activity.php');
diff --git a/assets/css/style.css b/assets/css/style.css
index c514e45..eae74df 100644
--- a/assets/css/style.css
+++ b/assets/css/style.css
@@ -530,6 +530,7 @@ input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
+input[type="url"],
input[type="datetime-local"],
textarea,
select {
@@ -5519,3 +5520,93 @@ a.calendar-agenda-entry:hover { text-decoration: none; filter: brightness(1.2);
/* Kommentarfeld: Avatar neben dem Feld (Formulare sind sonst global untereinander) */
.comment-form { flex-direction: row; }
.comment-form textarea { font-family: inherit; font-size: 0.95rem; }
+
+/* ---- Wiki: eingebettete Videos ---- */
+.wiki-video {
+ position: relative;
+ width: 100%;
+ max-width: 860px;
+ aspect-ratio: 16 / 9;
+ margin: 1rem 0;
+ border-radius: 12px;
+ overflow: hidden;
+ background: #000;
+ border: 1px solid var(--border);
+ box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
+}
+.wiki-video iframe, .wiki-video video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
+.wiki-video-portrait { max-width: 340px; aspect-ratio: 9 / 16; }
+.wiki-video-file video { object-fit: contain; background: #000; }
+
+/* Wiki: Mitwirkende hinzufuegen mit Suchliste (Avatare rund) */
+.wiki-contributor-add { align-items: center; }
+.wiki-contributor-add .item-picker { flex: 1 1 240px; min-width: 0; }
+.item-picker-round .item-picker-thumb { border-radius: 50%; object-fit: cover; }
+.item-picker[data-picker-round] .item-picker-preview { border-radius: 50% !important; object-fit: cover; }
+
+/* ---- Aktivitaetschecks ---- */
+.activity-form-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 1.5rem; align-items: start; }
+@media (max-width: 1000px) { .activity-form-grid { grid-template-columns: 1fr; } }
+.activity-form-fields { display: flex; flex-direction: column; gap: 1rem; }
+.activity-form fieldset { border: 1px solid var(--border); border-radius: 12px; padding: 0.9rem 1rem 1rem; margin: 0; display: flex; flex-direction: column; gap: 0.7rem; }
+.activity-form legend { padding: 0 0.4rem; color: var(--gold); font-weight: 700; }
+.activity-form label { display: flex; flex-direction: column; gap: 0.3rem; }
+.activity-form label.checkbox-label { flex-direction: row; align-items: center; gap: 0.5rem; }
+.activity-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; }
+.activity-color-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem; }
+.activity-color-row > span { margin-right: 0.3rem; }
+.activity-swatch { position: relative; flex-direction: row !important; width: 28px; height: 28px; border-radius: 50%; background: var(--swatch); cursor: pointer; border: 2px solid transparent; }
+.activity-swatch input { position: absolute; opacity: 0; }
+.activity-swatch:has(input:checked) { border-color: #fff; box-shadow: 0 0 0 2px var(--swatch); }
+.activity-color-row input[type="color"] { width: 36px; height: 30px; padding: 0; border: 1px solid var(--border); border-radius: 8px; background: none; cursor: pointer; }
+
+.activity-preview-wrap { position: sticky; top: 1rem; }
+.discord-preview { margin-top: 0.4rem; padding: 1rem; border-radius: 10px; background: #313338; color: #dbdee1; font-size: 0.92rem; }
+.discord-ping { display: inline-block; margin-bottom: 0.4rem; padding: 0 0.2rem; border-radius: 3px; background: rgba(88, 101, 242, 0.3); color: #c9cdfb; font-weight: 600; }
+.discord-ping[hidden] { display: none; }
+.discord-embed { border-left: 4px solid #c9a227; border-radius: 4px; background: #2b2d31; padding: 0.7rem 0.9rem; display: flex; flex-direction: column; gap: 0.5rem; max-width: 520px; }
+.discord-embed-title { color: #fff; font-size: 1rem; }
+.discord-embed-text { line-height: 1.45; overflow-wrap: anywhere; }
+.discord-embed-field { display: flex; flex-direction: column; font-size: 0.85rem; }
+.discord-embed-field b { color: #fff; }
+.discord-embed-image { max-width: 100%; border-radius: 4px; }
+.discord-embed-image[hidden] { display: none; }
+.discord-embed-footer { font-size: 0.75rem; color: #949ba4; }
+.discord-buttons { display: flex; gap: 0.5rem; margin-top: 0.6rem; }
+.discord-button { padding: 0.35rem 0.9rem; border-radius: 4px; background: #4e5058; color: #fff; font-weight: 600; font-size: 0.85rem; }
+.discord-button-green { background: #248046; }
+
+.activity-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 0.8rem; }
+.activity-card {
+ display: flex;
+ flex-direction: column;
+ gap: 0.4rem;
+ padding: 0.9rem 1rem;
+ border-radius: 12px;
+ border: 1px solid var(--border);
+ border-left: 4px solid var(--accent, var(--gold));
+ background: rgba(255, 255, 255, 0.03);
+ color: var(--text);
+}
+.activity-card:hover { text-decoration: none; background: rgba(255, 255, 255, 0.06); }
+.activity-card .text-muted { font-size: 0.82rem; }
+.activity-bar { display: flex; height: 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
+.activity-bar i { display: block; height: 100%; }
+.bar-present { background: #3ba55d; }
+.bar-absent { background: #ed4245; }
+.activity-counts { font-size: 0.82rem; color: var(--text-muted); }
+.activity-past { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; }
+.activity-past li { display: flex; flex-wrap: wrap; gap: 0.3rem 0.8rem; align-items: baseline; }
+
+.activity-detail-head .raid-header { margin-top: 0.4rem; }
+.activity-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.6rem 0; }
+.activity-consequences { margin-top: 0.4rem; font-size: 0.9rem; }
+.activity-columns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
+@media (max-width: 900px) { .activity-columns { grid-template-columns: 1fr; } }
+.activity-column h2 { display: flex; align-items: center; gap: 0.5rem; font-size: 1.1rem; }
+.activity-column ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.35rem; }
+.activity-person { display: flex; align-items: center; gap: 0.5rem; }
+.activity-present { border-top: 3px solid #3ba55d; }
+.activity-absent { border-top: 3px solid #ed4245; }
+.activity-missing { border-top: 3px solid #f0b232; }
+.activity-form textarea { font-family: inherit; resize: vertical; }
diff --git a/assets/js/activity.js b/assets/js/activity.js
new file mode 100644
index 0000000..aa1c1c6
--- /dev/null
+++ b/assets/js/activity.js
@@ -0,0 +1,93 @@
+/**
+ * Aktivitaetscheck anlegen: Formular ein-/ausblenden und Live-Vorschau, wie die Nachricht im
+ * Discord aussehen wird (Farbe, Titel, Text, Bild, Knoepfe, Frist).
+ */
+(function () {
+ 'use strict';
+
+ var panel = document.getElementById('activity-create');
+ var form = document.getElementById('activity-form');
+ if (!panel || !form) return;
+
+ document.querySelectorAll('[data-toggle-activity-form]').forEach(function (button) {
+ button.addEventListener('click', function () {
+ panel.hidden = !panel.hidden;
+ if (!panel.hidden) {
+ panel.scrollIntoView({ behavior: 'smooth', block: 'start' });
+ f.title.focus();
+ }
+ });
+ });
+
+ var f = form.elements; // form.title waere das title-Attribut des Formulars, nicht das Feld
+ var dmToggle = form.querySelector('[data-toggle-dm]');
+ var dmField = form.querySelector('.activity-dm');
+ dmToggle.addEventListener('change', function () { dmField.hidden = !dmToggle.checked; });
+
+ function out(name) { return form.querySelector('[data-out="' + name + '"]'); }
+
+ // Discord-Formatierung grob nachbilden: **fett**, *kursiv*, Zeilenumbrueche (Text sicher als Text)
+ function discordText(text) {
+ var div = document.createElement('div');
+ div.textContent = text;
+ return div.innerHTML
+ .replace(/\*\*(.+?)\*\*/g, '$1 ')
+ .replace(/(^|[^*])\*([^*\n]+)\*/g, '$1$2 ')
+ .replace(/\n/g, ' ');
+ }
+
+ function color() {
+ var custom = f.color_custom.value;
+ var picked = form.querySelector('input[name="color"]:checked');
+ return custom && custom.toLowerCase() !== '#c9a227' ? custom : (picked ? picked.value : '#c9a227');
+ }
+
+ function update() {
+ out('title').textContent = f.title.value || 'Aktivitätscheck';
+ out('message').innerHTML = discordText(f.message.value);
+ out('embed').style.borderLeftColor = color();
+
+ var role = f.target_role_id.options[f.target_role_id.selectedIndex];
+ out('role').textContent = role && role.value ? role.textContent.replace(/^@/, '') : 'Rolle';
+ out('ping').hidden = !f.ping_role.checked;
+
+ out('yes').textContent = f.yes_label.value.trim() || 'Ich bin da';
+ out('no').textContent = f.no_label.value.trim() || 'Ich bin nicht da';
+
+ var value = Math.max(1, parseInt(f.duration_value.value, 10) || 1);
+ var ms = value * (f.duration_unit.value === 'hours' ? 3600e3 : 86400e3);
+ var end = new Date(Date.now() + ms);
+ out('deadline').textContent = end.toLocaleString('de-DE', { weekday: 'long', day: '2-digit', month: 'long', hour: '2-digit', minute: '2-digit' })
+ + ' (in ' + value + (f.duration_unit.value === 'hours' ? (value === 1 ? ' Stunde' : ' Stunden') : (value === 1 ? ' Tag' : ' Tagen')) + ')';
+
+ var image = f.image_url.value.trim();
+ var img = out('image');
+ if (/^https:\/\/\S+$/.test(image)) {
+ img.src = image;
+ img.hidden = false;
+ } else {
+ img.hidden = true;
+ }
+ }
+
+ form.addEventListener('input', update);
+ form.addEventListener('change', update);
+ // Eigene Farbe gewaehlt -> Auswahlkreise abwaehlen, Kreis gewaehlt -> eigene Farbe zuruecksetzen
+ f.color_custom.addEventListener('input', function () {
+ form.querySelectorAll('input[name="color"]').forEach(function (r) { r.checked = false; });
+ });
+ form.querySelectorAll('input[name="color"]').forEach(function (radio) {
+ radio.addEventListener('change', function () { f.color_custom.value = '#c9a227'; });
+ });
+
+ form.addEventListener('submit', function (event) {
+ var consequences = [];
+ if (dmToggle.checked) consequences.push('PN');
+ if (f.remove_role_id.value) consequences.push('Rolle entfernen');
+ if (f.add_role_id.value) consequences.push('Rolle geben');
+ var text = 'Check jetzt im Discord posten?\n\nFolgen ohne Rückmeldung: ' + (consequences.length ? consequences.join(', ') : 'keine (nur Liste im Log-Kanal)');
+ if (!window.confirm(text)) event.preventDefault();
+ });
+
+ update();
+})();
diff --git a/assets/js/item-picker.js b/assets/js/item-picker.js
index e3ac0a2..be37afa 100644
--- a/assets/js/item-picker.js
+++ b/assets/js/item-picker.js
@@ -6,7 +6,8 @@
* name - der Text selbst wird gesendet (freie Eingabe erlaubt, z.B. neue Gegenstaende)
* id - ein verstecktes Feld bekommt die ID; nur Eintraege aus der Liste sind gueltig
* submit - wie name, schickt nach der Auswahl das Formular ab (Suche im Verlauf)
- * Optional data-picker-empty: Text, wenn nichts passt.
+ * Optional data-picker-empty: Text, wenn nichts passt; data-picker-invalid: Meldung ohne Auswahl;
+ * data-picker-round: runde Bilder (Avatare).
* Von aussen: element.itemPicker.set(idOderName) und element.itemPicker.refresh().
*/
(function () {
@@ -67,11 +68,14 @@
var iconSlot = root.querySelector('.item-picker-icon');
var searchIcon = iconSlot ? iconSlot.innerHTML : '';
var emptyText = root.dataset.pickerEmpty || 'Kein Gegenstand gefunden.';
+ var invalidText = root.dataset.pickerInvalid || 'Bitte einen Gegenstand aus der Liste wählen.';
var list = document.createElement('ul');
list.className = 'item-picker-list';
list.id = (input.id || 'item-picker-' + Math.random().toString(36).slice(2)) + '-list';
list.setAttribute('role', 'listbox');
+ // Personen (Avatare) rund statt eckiger Gegenstandsbilder
+ if (root.hasAttribute('data-picker-round')) list.classList.add('item-picker-round');
list.hidden = true;
document.body.appendChild(list);
@@ -113,7 +117,7 @@
hidden.dataset.max = item && item.qty != null ? item.qty : '';
hidden.dispatchEvent(new Event('change'));
}
- input.setCustomValidity(id || !input.required ? '' : 'Bitte einen Gegenstand aus der Liste wählen.');
+ input.setCustomValidity(id || !input.required ? '' : invalidText);
}
}
diff --git a/assets/js/wiki-editor.js b/assets/js/wiki-editor.js
index a53deaa..a3dc074 100644
--- a/assets/js/wiki-editor.js
+++ b/assets/js/wiki-editor.js
@@ -68,6 +68,14 @@
if (title) replaceSelection('', '', '[[' + title.trim() + ']]');
} else if (btn.dataset.insert === 'image') {
imageInput.click();
+ } else if (btn.dataset.insert === 'video') {
+ var video = window.prompt('Link zum Video - YouTube, Twitch (Clip oder Video), Vimeo oder eine Videodatei (.mp4/.webm):', 'https://');
+ if (video && /^https?:\/\/\S+$/.test(video.trim())) {
+ // Allein in einer Zeile wird der Link zum eingebetteten Player
+ insertBlock(video.trim());
+ } else if (video && video.trim() !== 'https://') {
+ window.alert('Das sieht nicht nach einem Link aus. Bitte die komplette Adresse einfügen (https://…).');
+ }
}
});
diff --git a/includes/activity_api.php b/includes/activity_api.php
new file mode 100644
index 0000000..9eaedc2
--- /dev/null
+++ b/includes/activity_api.php
@@ -0,0 +1,36 @@
+ $queryParams
+ * @param array|null $jsonBody
+ * @return array
+ * @throws RuntimeException
+ */
+function activity_api_request(string $method, string $path = '', array $queryParams = [], ?array $jsonBody = null): array
+{
+ $base = preg_replace('#/raids$#', '', raids_api_config()['url']);
+
+ return bot_api_request($method, $base . '/activity-checks' . $path, $queryParams, $jsonBody, 'Aktivitätscheck-API');
+}
+
+/** Farben zur schnellen Auswahl (Discord-Embed-Farbe links am Rand). */
+const ACTIVITY_COLORS = [
+ '#c9a227' => 'Gold',
+ '#5865f2' => 'Blurple',
+ '#3ba55d' => 'Grün',
+ '#ed4245' => 'Rot',
+ '#f0b232' => 'Orange',
+ '#9b59b6' => 'Lila',
+ '#1abc9c' => 'Türkis',
+];
+
+const ACTIVITY_DEFAULT_DM = 'Hallo {name}! Du hast dich beim Aktivitätscheck **{titel}** auf **{server}** nicht zurückgemeldet. '
+ . 'Melde dich bitte bei der Gildenleitung, wenn du weiterhin dabei sein möchtest.';
diff --git a/includes/header.php b/includes/header.php
index b3ad488..a2762e5 100644
--- a/includes/header.php
+++ b/includes/header.php
@@ -14,6 +14,7 @@ $canManageRoles = $currentUser && user_has_permission('roles.manage');
$canViewRaids = $currentUser && user_has_permission('raids.view');
$canViewPremades = $currentUser && user_has_permission('premades.view');
$canViewEvents = $currentUser && user_has_permission('events.view');
+$canManageActivity = $currentUser && user_has_permission('activity.manage');
$canViewMap = $currentUser && user_has_permission('map.view');
$canViewWarehouse = $currentUser && user_has_permission('warehouse.view');
$canViewContributions = $currentUser && user_has_permission('contributions.view');
@@ -64,6 +65,7 @@ $isRaidsActive = $currentScript === 'raids.php';
$isPremadesActive = $currentScript === 'premades.php';
$isEventsActive = $currentScript === 'events.php';
$isCalendarActive = $currentScript === 'calendar.php';
+$isActivityActive = $currentScript === 'activity.php';
$isMapActive = $currentScript === 'map.php';
$isWarehouseActive = $currentScript === 'warehouse.php';
$isContributionsActive = in_array($currentScript, ['contributions.php', 'contributions_award.php'], true);
@@ -85,6 +87,7 @@ $pageBackgrounds = [
'premades.php' => 'bg-premades',
'events.php' => 'bg-events',
'calendar.php' => 'bg-events',
+ 'activity.php' => 'bg-events',
'map.php' => 'bg-map',
'warehouse.php' => 'bg-warehouse',
'contributions.php' => 'bg-contributions',
@@ -224,6 +227,11 @@ $otherFlashes = array_values(array_filter($allFlashes, fn (array $f): bool => ($
= icon('bell') ?>Events
+
+
+