mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-05-06 19:19:19 +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:
@@ -15,7 +15,7 @@
|
||||
</div>
|
||||
|
||||
<?php if (empty($links)): ?>
|
||||
<p class="admin-empty">Aucun lien d'accès créé. Cliquez sur « Créer un lien » pour générer un lien partageable.</p>
|
||||
<p class="admin-empty">Aucun lien d'accès créé. Cliquez sur « Créer un lien » pour générer un lien partageable.</p>
|
||||
<?php else: ?>
|
||||
<table>
|
||||
<thead>
|
||||
@@ -38,7 +38,7 @@
|
||||
$statusLabel = $isExpired ? 'Expiré' : ($link['is_active'] ? 'Actif' : 'Désactivé');
|
||||
$fullUrl = $baseUrl . '/partage/' . htmlspecialchars($link['slug']);
|
||||
$created = date('d/m/Y H:i', strtotime($link['created_at']));
|
||||
$expires = $link['expires_at'] ? date('d/m/Y', strtotime($link['expires_at'])) : '—';
|
||||
$expires = $link['expires_at'] ? date('d/m/Y', strtotime($link['expires_at'])) : '-';
|
||||
$hasLinkPassword = !empty($link['password_hash']);
|
||||
?>
|
||||
<tr>
|
||||
@@ -92,11 +92,12 @@
|
||||
🔑
|
||||
</button>
|
||||
<form method="post" action="actions/acces-etudiante.php" class="publish-form"
|
||||
onsubmit="return confirm('Archiver ce lien ? Il ne sera plus accessible, mais les statistiques seront conservées.')">
|
||||
id="archive-link-form-<?= $link['id'] ?>">
|
||||
<input type="hidden" name="csrf_token" value="<?= htmlspecialchars($_SESSION['csrf_token']) ?>">
|
||||
<input type="hidden" name="action" value="archive">
|
||||
<input type="hidden" name="id" value="<?= $link['id'] ?>">
|
||||
<button type="submit" class="admin-btn-sm admin-btn-delete" title="Archiver">
|
||||
<button type="button" class="admin-btn-sm admin-btn-delete" title="Archiver"
|
||||
onclick="openArchiveLinkDialog(<?= $link['id'] ?>)">
|
||||
🗄
|
||||
</button>
|
||||
</form>
|
||||
@@ -127,7 +128,7 @@
|
||||
<?php foreach ($archivedLinks as $link): ?>
|
||||
<?php
|
||||
$created = date('d/m/Y H:i', strtotime($link['created_at']));
|
||||
$expires = $link['expires_at'] ? date('d/m/Y', strtotime($link['expires_at'])) : '—';
|
||||
$expires = $link['expires_at'] ? date('d/m/Y', strtotime($link['expires_at'])) : '-';
|
||||
?>
|
||||
<tr>
|
||||
<td>
|
||||
@@ -433,4 +434,30 @@ function openRejectDialog(requestId) {
|
||||
document.getElementById('reject-request-id').value = requestId;
|
||||
document.getElementById('reject-dialog').showModal();
|
||||
}
|
||||
|
||||
let _pendingArchiveLinkId = null;
|
||||
function openArchiveLinkDialog(id) {
|
||||
_pendingArchiveLinkId = id;
|
||||
document.getElementById('archive-link-dialog').showModal();
|
||||
}
|
||||
function _executeArchiveLink() {
|
||||
const form = document.getElementById('archive-link-form-' + _pendingArchiveLinkId);
|
||||
if (form) form.submit();
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- Archive link confirm -->
|
||||
<dialog id="archive-link-dialog" class="admin-dialog admin-dialog--sm" aria-labelledby="archive-link-title">
|
||||
<div class="admin-dialog__header">
|
||||
<h2 id="archive-link-title">Archiver ce lien</h2>
|
||||
<button type="button" class="admin-dialog__close" aria-label="Fermer"
|
||||
onclick="this.closest('dialog').close()">✕</button>
|
||||
</div>
|
||||
<div class="admin-dialog__alert">
|
||||
<p>Archiver ce lien ? Il ne sera plus accessible, mais les statistiques seront conservées.</p>
|
||||
</div>
|
||||
<div class="admin-dialog__footer">
|
||||
<button type="button" class="admin-btn admin-btn--warning" onclick="this.closest('dialog').close(); _executeArchiveLink()">Archiver</button>
|
||||
<button type="button" class="admin-btn-secondary" onclick="this.closest('dialog').close()">Annuler</button>
|
||||
</div>
|
||||
</dialog>
|
||||
|
||||
Reference in New Issue
Block a user