acces.php: remove Mot de passe column, add key icon copy button, reorder actions, switch URL icon to link-simple; fix dialog functions not on window; fix archive: move form into dialog (native submit); add caret icon to archived links details

This commit is contained in:
Pontoporeia
2026-07-05 12:05:53 +02:00
parent 3e93150c76
commit 3c845f9d40
6 changed files with 39 additions and 51 deletions
+22 -32
View File
@@ -28,7 +28,6 @@
<th scope="col">Objet</th>
<th scope="col">Année</th>
<th scope="col">Statut</th>
<th scope="col">Mot de passe</th>
<th scope="col">Utilisations</th>
<th scope="col">Expiration</th>
<th scope="col">Créé le</th>
@@ -78,34 +77,26 @@
<span style="display:inline-block;padding:var(--space-3xs) var(--space-2xs);border-radius:3px;font-size:var(--step--2);font-weight:500;letter-spacing:0.04em;background:var(--error-muted-bg);color:var(--error);"><?= $statusLabel ?></span>
<?php endif; ?>
</td>
<td>
<?php if ($hasLinkPassword): ?>
<div style="display:flex;align-items:center;gap:var(--space-2xs);">
<span>Oui</span>
<input type="hidden" id="pwd-<?= $link['id'] ?>" value="<?= htmlspecialchars($link['_decrypted_password'] ?? '') ?>">
<button type="button" class="admin-icon-btn" title="Copier le mot de passe"
onclick="event.stopPropagation(); copyTextToClipboard(document.getElementById('pwd-<?= $link['id'] ?>').value)"
style="width:24px;height:24px;">
<?= icon('copy-duplicate') ?>
</button>
</div>
<?php else: ?>
Non
<?php endif; ?>
</td>
<td style="text-align:center;"><?= intval($link['usage_count']) ?></td>
<td><?= $expires ?></td>
<td><?= $created ?></td>
<td class="admin-actions-col">
<div class="admin-actions">
<button type="button" class="admin-icon-btn admin-icon-btn--copy" title="Copier l'URL"
onclick="event.stopPropagation(); copyUrl(<?= $link['id'] ?>)">
<?= icon('link-simple') ?>
</button>
<?php if ($hasLinkPassword): ?>
<input type="hidden" id="pwd-<?= $link['id'] ?>" value="<?= htmlspecialchars($link['_decrypted_password'] ?? '') ?>">
<button type="button" class="admin-icon-btn admin-icon-btn--key" title="Copier le mot de passe"
onclick="event.stopPropagation(); copyTextToClipboard(document.getElementById('pwd-<?= $link['id'] ?>').value)">
<?= icon('key') ?>
</button>
<?php endif; ?>
<button type="button" class="admin-icon-btn admin-icon-btn--edit" title="Éditer"
onclick="event.stopPropagation(); openEditDialog(<?= $link['id'] ?>, <?= htmlspecialchars(json_encode($linkName), ENT_QUOTES) ?>, <?= $hasLinkPassword ? 'true' : 'false' ?>, <?= htmlspecialchars(json_encode($linkExpiresVal), ENT_QUOTES) ?>)">
<?= icon('pencil-note') ?>
</button>
<button type="button" class="admin-icon-btn admin-icon-btn--copy" title="Copier l'URL"
onclick="event.stopPropagation(); copyUrl(<?= $link['id'] ?>)">
<?= icon('copy-duplicate') ?>
</button>
<form method="post" action="actions/acces-etudiante.php" class="publish-form" onclick="event.stopPropagation()">
<input type="hidden" name="csrf_token" value="<?= htmlspecialchars($_SESSION['csrf_token']) ?>">
<input type="hidden" name="action" value="toggle">
@@ -120,16 +111,10 @@
<?php endif; ?>
</button>
</form>
<form method="post" action="actions/acces-etudiante.php" class="publish-form"
id="archive-link-form-<?= $link['id'] ?>" onclick="event.stopPropagation()">
<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="button" class="admin-icon-btn admin-icon-btn--archive" title="Archiver"
onclick="openArchiveLinkDialog(<?= $link['id'] ?>)">
<?= icon('monitor') ?>
</button>
</form>
<button type="button" class="admin-icon-btn admin-icon-btn--archive" title="Archiver"
onclick="event.stopPropagation(); openArchiveLinkDialog(<?= $link['id'] ?>)">
<?= icon('monitor') ?>
</button>
</div>
</td>
</tr>
@@ -139,7 +124,7 @@
<?php endif; ?>
<?php if (!empty($archivedLinks)): ?>
<details style="margin-top:var(--space-m);">
<details class="admin-archived-links" style="margin-top:var(--space-m);">
<summary style="cursor:pointer;font-weight:600;color:var(--text-secondary);font-size:var(--step--1);">
Liens archivés (<?= count($archivedLinks) ?>)
</summary>
@@ -599,7 +584,12 @@
<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="btn btn--warning" onclick="this.closest('dialog').close(); _executeArchiveLink()">Archiver</button>
<form method="post" action="actions/acces-etudiante.php">
<input type="hidden" name="csrf_token" value="<?= htmlspecialchars($_SESSION['csrf_token']) ?>">
<input type="hidden" name="action" value="archive">
<input type="hidden" name="id" id="archive-link-id" value="">
<button type="submit" class="btn btn--warning">Archiver</button>
</form>
<button type="button" class="btn btn--secondary" onclick="this.closest('dialog').close()">Annuler</button>
</div>
</dialog>