Raids: Raid-Leitung kann Raids als wichtig markieren (Faehnchen auf der Karte) - orange hervorgehoben auf der Raid-Seite und dem Dashboard
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
c24a80c245
commit
07b5f505f0
8 changed files with 99 additions and 5 deletions
|
|
@ -2433,6 +2433,11 @@ input.role-weight-input {
|
|||
.badge-pending { border-color: var(--gold); color: var(--gold); }
|
||||
/* Raid seit dem letzten Besuch der Raid-Seite gepostet (includes/raid_card.php) */
|
||||
.raid-new-badge { border-color: var(--gold); background: var(--gold); color: #1a1a1a; font-weight: 700; }
|
||||
/* Von der Raid-Leitung als wichtig markiert (includes/raid_card.php, dashboard.php) */
|
||||
.raid-card-important { border-color: #e8912d; border-left: 4px solid #e8912d; box-shadow: 0 0 18px rgba(232, 145, 45, 0.18); }
|
||||
.raid-important-badge { display: inline-flex; align-items: center; gap: 0.25rem; border-color: #e8912d; background: #e8912d; color: #1a1a1a; font-weight: 700; }
|
||||
.raid-important-badge .icon { width: 12px; height: 12px; }
|
||||
.raid-important-toggle.active { color: #e8912d; border-color: #e8912d; }
|
||||
/* Raid-Lead: Zeile unter dem Termin, Krone in der Anmeldeliste, Hinweis beim Anlegen */
|
||||
.raid-lead-line { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; margin: -0.5rem 0 0.9rem; font-size: 0.9rem; color: var(--text-muted); }
|
||||
.raid-lead-line a { color: var(--gold); font-weight: 600; }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
require_once __DIR__ . '/includes/bootstrap.php';
|
||||
require_once __DIR__ . '/includes/raids_api.php';
|
||||
require_once __DIR__ . '/includes/raid_attendance.php';
|
||||
require_once __DIR__ . '/includes/contributions.php';
|
||||
require_once __DIR__ . '/includes/bugs.php';
|
||||
require_once __DIR__ . '/includes/activity_points.php';
|
||||
|
|
@ -43,7 +44,14 @@ if ($canViewRaids) {
|
|||
usort($upcomingRaids, static fn (array $a, array $b): int
|
||||
=> ($a['timestamp'] ?? PHP_INT_MAX) <=> ($b['timestamp'] ?? PHP_INT_MAX));
|
||||
|
||||
// Von der Raid-Leitung als wichtig markierte Raids (raid_settings.important) sind hervorgehoben
|
||||
try {
|
||||
$raidSettings = raid_settings_all();
|
||||
} catch (PDOException $e) {
|
||||
$raidSettings = [];
|
||||
}
|
||||
foreach ($upcomingRaids as &$raid) {
|
||||
$raid['_important'] = !empty($raidSettings[(string) ($raid['raid_id'] ?? '')]['important']);
|
||||
$signups = is_array($raid['signups'] ?? null) ? $raid['signups'] : [];
|
||||
$raid['_my_signup'] = null;
|
||||
foreach ($signups as $signup) {
|
||||
|
|
@ -308,7 +316,9 @@ include __DIR__ . '/includes/header.php';
|
|||
?>
|
||||
<tr>
|
||||
<?php $isConsiliumRaid = raid_area($raid) === 'consilium'; ?>
|
||||
<td><a href="/raids.php<?= $isConsiliumRaid ? '?bereich=consilium' : '' ?>#raid-<?= (int) ($raid['raid_id'] ?? 0) ?>"<?= $isConsiliumRaid ? ' title="Raid von ' . e(CONSILIUM_NAME) . '"' : '' ?>><?= $isConsiliumRaid ? '🤝 ' : '' ?><?= e($title) ?></a></td>
|
||||
<td><a href="/raids.php<?= $isConsiliumRaid ? '?bereich=consilium' : '' ?>#raid-<?= (int) ($raid['raid_id'] ?? 0) ?>"<?= $isConsiliumRaid ? ' title="Raid von ' . e(CONSILIUM_NAME) . '"' : '' ?>><?= $isConsiliumRaid ? '🤝 ' : '' ?><?= e($title) ?></a>
|
||||
<?php if (!empty($raid['_important'])): ?><span class="badge raid-important-badge" title="Von der Raid-Leitung als wichtig markiert"><?= icon('flag') ?> Wichtig</span><?php endif; ?>
|
||||
</td>
|
||||
<td class="text-muted">
|
||||
<a class="raid-calendar-link" href="<?= e($calendarUrl) ?>" title="Im Kalender ansehen"><?= icon('calendar') ?><?= e($dateLabel) ?></a>
|
||||
</td>
|
||||
|
|
|
|||
|
|
@ -19,6 +19,16 @@ const PATCHNOTE_TYPES = [
|
|||
];
|
||||
|
||||
const PATCHNOTES = [
|
||||
[
|
||||
'id' => '2026-10-14-a',
|
||||
'date' => '2026-10-14',
|
||||
'title' => 'Wichtige Raids',
|
||||
'summary' => 'Die Raid-Leitung kann Raids als wichtig markieren – sie fallen auf der Raid-Seite und auf dem Dashboard sofort auf.',
|
||||
'changes' => [
|
||||
['type' => 'neu', 'area' => 'Raids', 'text' => 'Als wichtig markierte Raids haben einen orangen Rahmen und das Abzeichen „Wichtig“ – auf der Raid-Seite und bei den nächsten Raids auf dem Dashboard.'],
|
||||
['type' => 'neu', 'area' => 'Raids', 'text' => 'Mit dem Fähnchen oben auf der Raid-Karte markiert die Raid-Leitung (raids.manage) einen Raid als wichtig oder nimmt die Markierung wieder weg. Raid-Leads ohne dieses Recht können es nicht.', 'audience' => 'leitung'],
|
||||
],
|
||||
],
|
||||
[
|
||||
'id' => '2026-10-13-b',
|
||||
'date' => '2026-10-13',
|
||||
|
|
|
|||
|
|
@ -140,13 +140,13 @@ function raid_settings_ensure_defaults(array $raidIds): void
|
|||
}
|
||||
}
|
||||
|
||||
/** @return array{points_present: int, points_absent: int, auto_processed_at: ?string, auto_result: ?string, attendance_checked_at: ?string, checked_by: ?string, lead_user_id: ?int, lead_name: ?string} */
|
||||
/** @return array{points_present: int, points_absent: int, auto_processed_at: ?string, auto_result: ?string, attendance_checked_at: ?string, checked_by: ?string, lead_user_id: ?int, lead_name: ?string, important: bool} */
|
||||
function raid_settings_get(int $raidId): array
|
||||
{
|
||||
$stmt = db()->prepare(
|
||||
"SELECT s.points_present, s.points_absent, s.auto_processed_at, s.auto_result, s.attendance_checked_at,
|
||||
COALESCE(NULLIF(u.display_name, ''), u.username) AS checked_by,
|
||||
s.lead_user_id, COALESCE(NULLIF(l.display_name, ''), l.username) AS lead_name
|
||||
s.lead_user_id, COALESCE(NULLIF(l.display_name, ''), l.username) AS lead_name, s.important
|
||||
FROM raid_settings s
|
||||
LEFT JOIN users u ON u.id = s.attendance_checked_by
|
||||
LEFT JOIN users l ON l.id = s.lead_user_id
|
||||
|
|
@ -164,6 +164,7 @@ function raid_settings_get(int $raidId): array
|
|||
'checked_by' => $row['checked_by'] ?? null,
|
||||
'lead_user_id' => isset($row['lead_user_id']) ? (int) $row['lead_user_id'] : null,
|
||||
'lead_name' => $row['lead_name'] ?? null,
|
||||
'important' => !empty($row['important']),
|
||||
];
|
||||
}
|
||||
|
||||
|
|
@ -194,6 +195,17 @@ function raid_settings_save_points(int $raidId, int $present, int $absent): void
|
|||
)->execute([$raidId, $present, $absent]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Raid als wichtig markieren (oder nicht mehr) - nur die Raid-Leitung (raid_important_action.php). Legt fehlende
|
||||
* Einstellungen vorher mit dem festen Punkt an, damit die neue Zeile die Lumipunkte nicht auf 0 setzt.
|
||||
*/
|
||||
function raid_settings_save_important(int $raidId, bool $important): void
|
||||
{
|
||||
raid_settings_ensure_defaults([$raidId]);
|
||||
db()->prepare('INSERT INTO raid_settings (raid_id, important) VALUES (?, ?) ON DUPLICATE KEY UPDATE important = VALUES(important)')
|
||||
->execute([$raidId, $important ? 1 : 0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Was die Raid-Nachricht im Discord zusaetzlich zeigt und nur hier auf der Website liegt: den Raid-Lead
|
||||
* (Discord-ID, und der Name, falls er nicht auf dem Server ist) und die Lumipunkte als Text.
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ function raid_card_started(array $raid): bool
|
|||
function raid_card_rev(array $raid, ?array $setting): string
|
||||
{
|
||||
$settingFields = [];
|
||||
foreach (['points_present', 'points_absent', 'auto_processed_at', 'auto_result', 'attendance_checked_at', 'lead_user_id', 'lead_name'] as $key) {
|
||||
foreach (['points_present', 'points_absent', 'auto_processed_at', 'auto_result', 'attendance_checked_at', 'lead_user_id', 'lead_name', 'important'] as $key) {
|
||||
$settingFields[$key] = isset($setting[$key]) ? (string) $setting[$key] : null;
|
||||
}
|
||||
return substr(md5((string) json_encode([$raid, $settingFields, raid_card_started($raid)], JSON_UNESCAPED_UNICODE)), 0, 16);
|
||||
|
|
@ -146,6 +146,8 @@ function render_raid_card(array $raid, array $ctx): void
|
|||
// Raids des Consilium Elyseum bringen keine Lumipunkte - dort ist davon nirgends die Rede
|
||||
$isConsilium = raid_area($raid) === 'consilium';
|
||||
$raidStarted = raid_card_started($raid);
|
||||
// Von der Raid-Leitung als wichtig markiert - setzen darf es nur sie, nicht der Raid-Lead
|
||||
$isImportant = !empty($raidSetting['important']);
|
||||
$isNew = !$isArchived && isset($ctx['new_since']) && raid_posted_at($raidId) > (int) $ctx['new_since'];
|
||||
|
||||
// Suchtext fuer die Raid-Suche: Titel, Termin, Anforderungen, Gruppen, Spieler und Klassen
|
||||
|
|
@ -158,7 +160,7 @@ function render_raid_card(array $raid, array $ctx): void
|
|||
$mySignupGroupNumber = $mySignup ? (int) ($mySignup['group'] ?? 0) : null;
|
||||
$mySignupGroupLabel = $mySignupGroupNumber === 0 ? 'Ersatzbank' : ($mySignupGroupNumber ? ($groupNames[$mySignupGroupNumber - 1] ?? ('#' . $mySignupGroupNumber)) : null);
|
||||
?>
|
||||
<div class="panel raid-card<?= $isArchived ? ' panel-archived' : '' ?>" id="raid-<?= $raidId ?>"
|
||||
<div class="panel raid-card<?= $isArchived ? ' panel-archived' : '' ?><?= $isImportant ? ' raid-card-important' : '' ?>" id="raid-<?= $raidId ?>"
|
||||
data-raid-id="<?= $raidId ?>"
|
||||
data-rev="<?= e(raid_card_rev($raid, $raidSetting)) ?>"
|
||||
data-fields-rev="<?= e(substr(md5((string) json_encode([$title, $dateRaw, $requirements, $gearscore, $groupNames, $lockedGroups, $maxSlots, $autoPresent, $autoAbsent], JSON_UNESCAPED_UNICODE)), 0, 12)) ?>"
|
||||
|
|
@ -170,6 +172,9 @@ function render_raid_card(array $raid, array $ctx): void
|
|||
<div class="raid-header">
|
||||
<h2><?= e($title) ?></h2>
|
||||
<div class="badge-group">
|
||||
<?php if ($isImportant): ?>
|
||||
<span class="badge raid-important-badge" title="Von der Raid-Leitung als wichtig markiert"><?= icon('flag') ?> Wichtig</span>
|
||||
<?php endif; ?>
|
||||
<?php if ($isNew): ?>
|
||||
<span class="badge raid-new-badge" title="Seit deinem letzten Besuch dazugekommen">Neu</span>
|
||||
<?php endif; ?>
|
||||
|
|
@ -177,6 +182,15 @@ function render_raid_card(array $raid, array $ctx): void
|
|||
<span class="badge badge-disabled">Archiviert<?= $archivedAt ? ' (' . e((string) $archivedAt) . ')' : '' ?></span>
|
||||
<?php endif; ?>
|
||||
<span class="badge raid-count-badge"><?= $activeCount ?> / <?= $maxSlots ?> angemeldet</span>
|
||||
<?php if ($canManageRaids && !$isArchived): ?>
|
||||
<form method="post" action="/raid_important_action.php" class="inline-form">
|
||||
<?= csrf_field() ?>
|
||||
<input type="hidden" name="raid_id" value="<?= $raidId ?>">
|
||||
<input type="hidden" name="status" value="<?= e($status) ?>">
|
||||
<input type="hidden" name="important" value="<?= $isImportant ? '0' : '1' ?>">
|
||||
<button type="submit" class="icon-button raid-important-toggle<?= $isImportant ? ' active' : '' ?>" title="<?= $isImportant ? 'Nicht mehr als wichtig markieren' : 'Als wichtig markieren' ?>"><?= icon('flag') ?></button>
|
||||
</form>
|
||||
<?php endif; ?>
|
||||
<?php if ($canEditThis): ?>
|
||||
<button type="button" class="icon-button raid-edit-toggle" title="Bearbeiten">
|
||||
<?= icon('edit') ?>
|
||||
|
|
|
|||
|
|
@ -388,6 +388,8 @@ CREATE TABLE IF NOT EXISTS raid_settings (
|
|||
attendance_checked_by INT UNSIGNED NULL,
|
||||
-- Raid-Lead: hat den Raid auf der Website angelegt, verwaltet ihn und traegt die Anwesenheit ein
|
||||
lead_user_id INT UNSIGNED NULL,
|
||||
-- Von der Raid-Leitung als wichtig markiert (hervorgehobene Karte, Hinweis auf dem Dashboard)
|
||||
important TINYINT(1) NOT NULL DEFAULT 0,
|
||||
FOREIGN KEY (attendance_checked_by) REFERENCES users(id) ON DELETE SET NULL,
|
||||
CONSTRAINT fk_raid_settings_lead FOREIGN KEY (lead_user_id) REFERENCES users(id) ON DELETE SET NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
|
||||
|
|
@ -1122,6 +1124,7 @@ function schema_column_upgrades(): array
|
|||
"ALTER TABLE raid_settings ADD COLUMN lead_user_id INT UNSIGNED NULL AFTER attendance_checked_by",
|
||||
"ALTER TABLE raid_settings ADD CONSTRAINT fk_raid_settings_lead FOREIGN KEY (lead_user_id) REFERENCES users(id) ON DELETE SET NULL",
|
||||
],
|
||||
'important' => "ALTER TABLE raid_settings ADD COLUMN important TINYINT(1) NOT NULL DEFAULT 0 AFTER lead_user_id",
|
||||
],
|
||||
// Treffpunkt auf der Karte (Link /map.php?karte=...&x=...&y=...)
|
||||
'calendar_entries' => [
|
||||
|
|
|
|||
38
raid_important_action.php
Normal file
38
raid_important_action.php
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
require_once __DIR__ . '/includes/bootstrap.php';
|
||||
require_once __DIR__ . '/includes/raids_api.php';
|
||||
require_once __DIR__ . '/includes/raid_attendance.php';
|
||||
require_login();
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
|
||||
redirect('/raids.php');
|
||||
}
|
||||
verify_csrf();
|
||||
|
||||
$status = (string) ($_POST['status'] ?? 'active');
|
||||
if (!in_array($status, RAID_STATUSES, true)) {
|
||||
$status = 'active';
|
||||
}
|
||||
$raidId = (int) ($_POST['raid_id'] ?? 0);
|
||||
$area = $raidId > 0 ? raid_area_of($raidId) : null;
|
||||
$redirectTo = '/raids.php?status=' . urlencode($status) . ($area === 'consilium' ? '&bereich=consilium' : '') . ($raidId > 0 ? '#raid-' . $raidId : '');
|
||||
if ($area === null) {
|
||||
set_flash('error', 'Diesen Raid gibt es nicht (mehr).');
|
||||
redirect($redirectTo);
|
||||
}
|
||||
// Wichtig markiert nur die Raid-Leitung des Bereichs - nicht der Raid-Lead seinen eigenen Raid
|
||||
if (!raid_area_can_manage_all($area)) {
|
||||
set_flash('error', 'Raids als wichtig markieren darf nur die Raid-Leitung.');
|
||||
redirect($redirectTo);
|
||||
}
|
||||
|
||||
$important = !empty($_POST['important']);
|
||||
try {
|
||||
raid_settings_save_important($raidId, $important);
|
||||
set_flash('success', $important ? 'Raid ist als wichtig markiert.' : 'Raid ist nicht mehr als wichtig markiert.');
|
||||
admin_log($important ? '❗ Raid als wichtig markiert' : 'Raid nicht mehr wichtig', ['Raid' => admin_log_raid($raidId)]);
|
||||
} catch (Throwable $e) {
|
||||
set_flash('error', 'Speichern fehlgeschlagen: ' . $e->getMessage());
|
||||
}
|
||||
|
||||
redirect($redirectTo);
|
||||
|
|
@ -242,6 +242,8 @@ CREATE TABLE IF NOT EXISTS raid_settings (
|
|||
attendance_checked_by INT UNSIGNED NULL,
|
||||
-- Raid-Lead: hat den Raid auf der Website angelegt, verwaltet ihn und traegt die Anwesenheit ein
|
||||
lead_user_id INT UNSIGNED NULL,
|
||||
-- Von der Raid-Leitung als wichtig markiert (hervorgehobene Karte, Hinweis auf dem Dashboard)
|
||||
important TINYINT(1) NOT NULL DEFAULT 0,
|
||||
FOREIGN KEY (attendance_checked_by) REFERENCES users(id) ON DELETE SET NULL,
|
||||
CONSTRAINT fk_raid_settings_lead FOREIGN KEY (lead_user_id) REFERENCES users(id) ON DELETE SET NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
|
|
|
|||
Loading…
Reference in a new issue