mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-05-06 11:09:18 +02:00
Replace browser alert/confirm dialogs with <dialog> modals
- admin/index.php: alert() → no-selection dialog; confirm() bulk actions → bulk-confirm/bulk-delete dialogs; confirm() single delete → delete-thesis dialog; removed redundant confirm on Dépublier (reversible action) - admin/tags.php: confirm() merge/delete → merge-tag/delete-tag dialogs - admin/acces-etudiante.php: confirm() delete link → delete-link dialog - admin/acces.php: confirm() archive link → archive-link dialog - admin/parametres.php: confirm() maintenance/delete-all → enable-maintenance/delete-all-tfe dialogs; admin password confirm() kept with TODO comment - admin/account.php: admin password confirm() kept with TODO comment - admin.css: add .admin-dialog--sm, .admin-dialog__alert, .admin-dialog__footer styles
This commit is contained in:
@@ -20,12 +20,12 @@
|
||||
</form>
|
||||
<?php else: ?>
|
||||
<p>Site public : <strong>en ligne</strong></p>
|
||||
<form method="post" action="actions/maintenance.php">
|
||||
<form method="post" action="actions/maintenance.php" id="enable-maintenance-form">
|
||||
<input type="hidden" name="csrf_token" value="<?= htmlspecialchars($_SESSION['csrf_token']) ?>">
|
||||
<input type="hidden" name="action" value="enable_maintenance">
|
||||
<input type="hidden" name="redirect" value="/admin/parametres.php">
|
||||
<button type="submit" class="param-btn-warning"
|
||||
onclick="return confirm('Mettre le site en maintenance ? Les visiteurs verront une page 503.')">
|
||||
<button type="button" class="param-btn-warning"
|
||||
onclick="document.getElementById('enable-maintenance-dialog').showModal()">
|
||||
Activer la maintenance
|
||||
</button>
|
||||
</form>
|
||||
@@ -50,12 +50,14 @@
|
||||
Supprime définitivement tous les TFE de la base de données, y compris auteurs,
|
||||
promoteurs, tags, fichiers associés. Cette action est <strong>irréversible</strong>.
|
||||
</p>
|
||||
<form method="post" action="actions/delete.php"
|
||||
onsubmit="return confirm('⚠ Supprimer définitivement TOUS les TFE ? Cette action est IRRÉVERSIBLE.')">
|
||||
<input type="hidden" name="csrf_token" value="<?= htmlspecialchars($_SESSION['csrf_token']) ?>">
|
||||
<input type="hidden" name="delete_all" value="1">
|
||||
<button type="submit" class="param-btn-danger">Supprimer tous les TFE (<?= $stats['total'] ?? '?' ?>)</button>
|
||||
</form>
|
||||
<form method="post" action="actions/delete.php" id="delete-all-tfe-form">
|
||||
<input type="hidden" name="csrf_token" value="<?= htmlspecialchars($_SESSION['csrf_token']) ?>">
|
||||
<input type="hidden" name="delete_all" value="1">
|
||||
<button type="button" class="param-btn-danger"
|
||||
onclick="document.getElementById('delete-all-tfe-dialog').showModal()">
|
||||
Supprimer tous les TFE (<?= $stats['total'] ?? '?' ?>)
|
||||
</button>
|
||||
</form>
|
||||
</fieldset>
|
||||
</section>
|
||||
|
||||
@@ -377,8 +379,9 @@
|
||||
Supprime le hash de la base de données. L'accès admin
|
||||
dépendra uniquement de l'authentification nginx Basic Auth si elle est configurée.
|
||||
</p>
|
||||
<?php /* TODO: replace this browser confirm() with a proper <dialog> modal like the other confirmations */ ?>
|
||||
<form method="post" action="/admin/actions/account.php"
|
||||
onsubmit="return confirm('Supprimer le mot de passe PHP ? L\'accès admin ne sera protégé que par nginx Basic Auth.')">>
|
||||
onsubmit="return confirm('Supprimer le mot de passe PHP ? L\'accès admin ne sera protégé que par nginx Basic Auth.')">
|
||||
<input type="hidden" name="csrf_token" value="<?= htmlspecialchars($_SESSION['csrf_token']) ?>">
|
||||
<input type="hidden" name="action" value="remove_credentials">
|
||||
<input type="hidden" name="redirect" value="/admin/parametres.php">
|
||||
@@ -584,3 +587,41 @@ document.body.addEventListener('htmx:afterSwap', function(evt) {
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- Enable maintenance confirm -->
|
||||
<dialog id="enable-maintenance-dialog" class="admin-dialog admin-dialog--sm" aria-labelledby="enable-maint-title">
|
||||
<div class="admin-dialog__header">
|
||||
<h2 id="enable-maint-title">Activer la maintenance</h2>
|
||||
<button type="button" class="admin-dialog__close" aria-label="Fermer"
|
||||
onclick="this.closest('dialog').close()">✕</button>
|
||||
</div>
|
||||
<div class="admin-dialog__alert">
|
||||
<p>Mettre le site en maintenance ? Les visiteurs verront une page 503.</p>
|
||||
</div>
|
||||
<div class="admin-dialog__footer">
|
||||
<button type="button" class="admin-btn admin-btn--warning"
|
||||
onclick="this.closest('dialog').close(); document.getElementById('enable-maintenance-form').submit()">
|
||||
Activer
|
||||
</button>
|
||||
<button type="button" class="admin-btn-secondary" onclick="this.closest('dialog').close()">Annuler</button>
|
||||
</div>
|
||||
</dialog>
|
||||
|
||||
<!-- Delete all TFE confirm -->
|
||||
<dialog id="delete-all-tfe-dialog" class="admin-dialog admin-dialog--sm" aria-labelledby="delete-all-title">
|
||||
<div class="admin-dialog__header">
|
||||
<h2 id="delete-all-title">Supprimer tous les TFE</h2>
|
||||
<button type="button" class="admin-dialog__close" aria-label="Fermer"
|
||||
onclick="this.closest('dialog').close()">✕</button>
|
||||
</div>
|
||||
<div class="admin-dialog__alert">
|
||||
<p>⚠️ Supprimer définitivement <strong>TOUS les TFE</strong> ? Cette action est <strong>IRRÉVERSIBLE</strong>.</p>
|
||||
</div>
|
||||
<div class="admin-dialog__footer">
|
||||
<button type="button" class="admin-btn admin-btn--danger"
|
||||
onclick="this.closest('dialog').close(); document.getElementById('delete-all-tfe-form').submit()">
|
||||
Supprimer tout
|
||||
</button>
|
||||
<button type="button" class="admin-btn-secondary" onclick="this.closest('dialog').close()">Annuler</button>
|
||||
</div>
|
||||
</dialog>
|
||||
|
||||
Reference in New Issue
Block a user