LuminaWebsite/admin/reset.php
Maaxxs c4f94bf84a Member feedback: raid input checks and fixed raid points, premades in the raid form, live raid page, Lumina-style dialogs, leadership calendar entries, class-based weapon picker, map and tactics fixes
- Raids: "Max. Spieler" only whole numbers up to groups x 5 (max. 10 groups / 50), gearscore only a number; fixed +1 Lumipunkt per participation, other values only with the new raids.points permission; pick an existing premade per group when creating a raid; unchanged legacy values no longer block editing
- Raid page updates itself every 15 s while visible (raids_live.php, cards rendered by includes/raid_card.php), open editors and confirm dialogs are kept
- Restore takes the new raid_id from the bot (archived messages are now deleted in Discord) and moves settings, attendance and awards; website signups send the server display name
- Premades: dissolve by leadership needs a reason, lead gets DMs on join/assign/decline/remove (source/actor_id sent to the bot), transfer picker skips players who already lead a group, website accept keeps the one-group rule, no commas in names
- Site-wide Lumina dialog (assets/js/confirm-dialog.js) replaces confirm/prompt/alert via data-confirm; error flashes are a dialog you confirm with OK
- Calendar: audience per entry (all / leadership takes part / internal) with the new calendar.leadership permission; day cells list all entries and scroll
- Gear planner: main-hand picker filtered by the set's class, mismatches marked, "keine Klasse" option, link to an external skill/Daevanion plan per set
- Map: correct kisk icons (Elyos on Verteron/Abyss, Altgard fixed), per-map max zoom and bounded panning, German texts, data source note
- Tactics: toolbar as a uniform grid, whole-tactic copy, automatic versions with restore and a 90-day trash, official tactics protected
- Global thin gold scrollbars, readable hover colours, "Sedes Luminis" spelling, patch notes and README, schema version 34

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-23 16:12:18 +02:00

105 lines
4.9 KiB
PHP

<?php
/**
* Daten zuruecksetzen: Testdaten einzelner Bereiche auswaehlen und loeschen. Nur fuer Entwickler
* (DEVELOPER_DISCORD_IDS) - alle anderen sehen die 404-Seite.
*/
require_once __DIR__ . '/../includes/bootstrap.php';
require_login();
if (!is_developer(current_user())) {
show_not_found();
}
require_once __DIR__ . '/../includes/data_reset.php';
$counts = data_reset_counts();
$pageTitle = 'Daten zurücksetzen';
include __DIR__ . '/../includes/header.php';
?>
<div class="panel reset-page">
<h1>Daten zurücksetzen</h1>
<p class="text-muted">
Wähle aus, welche Bereiche geleert werden sollen - z.B. um Testdaten vor dem Start loszuwerden.
Konten, Berechtigungsgruppen und Einstellungen bleiben immer erhalten, ebenso Raids, Events und
Premades (die liegen beim Bot). <strong>Gelöschtes lässt sich nicht wiederherstellen.</strong>
</p>
<form method="post" action="/admin/reset_action.php" id="reset-form">
<?= csrf_field() ?>
<div class="reset-toolbar">
<button type="button" class="button button-secondary button-small" data-reset-select="all">Alle auswählen</button>
<button type="button" class="button button-secondary button-small" data-reset-select="none">Keine</button>
<span class="text-muted" id="reset-selected-count">0 ausgewählt</span>
</div>
<div class="reset-grid">
<?php foreach (DATA_RESET_AREAS as $key => $area): ?>
<?php $count = $counts[$key] ?? 0; ?>
<label class="reset-option<?= $count === 0 ? ' is-empty' : '' ?>">
<input type="checkbox" name="areas[]" value="<?= e($key) ?>" data-label="<?= e($area['label']) ?>">
<span class="reset-option-body">
<span class="reset-option-head">
<strong><?= e($area['label']) ?></strong>
<span class="badge reset-count"><?= e(data_reset_amount($key, $count)) ?></span>
</span>
<span class="reset-option-text"><?= e($area['description']) ?></span>
</span>
</label>
<?php endforeach; ?>
</div>
<div class="reset-confirm">
<label for="reset-confirm-input">
Zur Bestätigung <code><?= e(DATA_RESET_CONFIRM_WORD) ?></code> eintippen:
</label>
<div class="reset-confirm-row">
<input type="text" id="reset-confirm-input" name="confirm" autocomplete="off" spellcheck="false" placeholder="<?= e(DATA_RESET_CONFIRM_WORD) ?>">
<button type="submit" class="button button-danger" id="reset-submit" disabled>
<?= icon('trash') ?> Ausgewählte Daten löschen
</button>
</div>
</div>
</form>
</div>
<script>
(function () {
var form = document.getElementById('reset-form');
var boxes = form.querySelectorAll('input[name="areas[]"]');
var confirmInput = document.getElementById('reset-confirm-input');
var submit = document.getElementById('reset-submit');
var countLabel = document.getElementById('reset-selected-count');
var word = <?= json_encode(DATA_RESET_CONFIRM_WORD, JSON_UNESCAPED_UNICODE) ?>;
function selected() {
return Array.prototype.filter.call(boxes, function (box) { return box.checked; });
}
function update() {
var count = selected().length;
countLabel.textContent = count + ' ausgewählt';
submit.disabled = count === 0 || confirmInput.value.trim().toUpperCase() !== word;
boxes.forEach(function (box) { box.closest('.reset-option').classList.toggle('is-checked', box.checked); });
}
boxes.forEach(function (box) { box.addEventListener('change', update); });
confirmInput.addEventListener('input', update);
form.querySelectorAll('[data-reset-select]').forEach(function (button) {
button.addEventListener('click', function () {
var all = button.getAttribute('data-reset-select') === 'all';
boxes.forEach(function (box) { box.checked = all; });
update();
});
});
// Rueckfrage mit der aktuellen Auswahl (assets/js/confirm-dialog.js liest data-confirm beim Absenden)
function updateConfirm() {
var labels = selected().map(function (box) { return '• ' + box.getAttribute('data-label'); });
form.setAttribute('data-confirm', 'Diese Bereiche endgültig löschen?\n\n' + labels.join('\n'));
}
boxes.forEach(function (box) { box.addEventListener('change', updateConfirm); });
form.setAttribute('data-confirm-title', 'Daten zurücksetzen');
form.setAttribute('data-confirm-danger', '');
form.setAttribute('data-confirm-ok', 'Endgültig löschen');
form.addEventListener('click', updateConfirm);
updateConfirm();
update();
})();
</script>
<?php include __DIR__ . '/../includes/footer.php'; ?>