feat: file browser + relink for orphaned files + htmx fix + header cleanup + fix relinked FilePond integration + resolve acces.php conflict markers

This commit is contained in:
Pontoporeia
2026-05-18 17:39:01 +02:00
parent 79eddf5d5a
commit 27e6abc7e4
10 changed files with 268 additions and 205866 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -27,9 +27,6 @@ $_thesisId = $_GET['id'] ?? null;
<?php endif; ?>
</a></li>
<li><a href="/admin/parametres.php" <?= in_array($_currentPage, ['parametres.php', 'system.php', 'status.php', 'logs.php']) ? 'aria-current="page"' : '' ?>>Paramètres</a></li>
<?php if ($_thesisId && $_currentPage === 'recapitulatif.php'): ?>
<li><a href="/admin/edit.php?id=<?= intval($_thesisId) ?>">Modifier</a></li>
<?php endif; ?>
<?php if ($_isAdmin && AdminAuth::hasPassword()): ?>
<li data-nav-logout><a href="/admin/logout.php" aria-label="Déconnexion"><svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" viewBox="0 0 256 256"><path d="M120,216a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V40a8,8,0,0,1,8-8h64a8,8,0,0,1,0,16H56V208h56A8,8,0,0,1,120,216Zm109.66-93.66-40-40a8,8,0,0,0-11.32,11.32L204.69,120H112a8,8,0,0,0,0,16h92.69l-26.35,26.34a8,8,0,0,0,11.32,11.32l40-40A8,8,0,0,0,229.66,122.34Z"></path></svg><span class="sr-only">Déconnexion</span></a></li>
<?php endif; ?>

View File

@@ -88,7 +88,11 @@ $websiteLabel = htmlspecialchars($_POST['website_label'] ?? '');
<button type="button" class="btn btn--sm btn--ghost file-browser-trigger"
data-queue-type="cover"
data-thesis-id="<?= htmlspecialchars((string)($thesisId ?? $_GET['id'] ?? '')) ?>"
onclick="XamxamOpenFileBrowser(this)">
hx-get="/admin/fragments/file-browser.php"
hx-target="#relink-modal-body"
hx-swap="innerHTML"
hx-trigger="click"
onclick="document.getElementById('relink-modal').showModal(); window.__xamxamRelinkCtx = { queueType: 'cover', thesisId: '<?= htmlspecialchars((string)($thesisId ?? $_GET['id'] ?? '')) ?>' };">
📂 Relier un fichier existant
</button>
<?php endif; ?>
@@ -110,7 +114,11 @@ $websiteLabel = htmlspecialchars($_POST['website_label'] ?? '');
<button type="button" class="btn btn--sm btn--ghost file-browser-trigger"
data-queue-type="note_intention"
data-thesis-id="<?= htmlspecialchars((string)($thesisId ?? $_GET['id'] ?? '')) ?>"
onclick="XamxamOpenFileBrowser(this)">
hx-get="/admin/fragments/file-browser.php"
hx-target="#relink-modal-body"
hx-swap="innerHTML"
hx-trigger="click"
onclick="document.getElementById('relink-modal').showModal(); window.__xamxamRelinkCtx = { queueType: 'note_intention', thesisId: '<?= htmlspecialchars((string)($thesisId ?? $_GET['id'] ?? '')) ?>' };">
📂 Relier un fichier existant
</button>
<?php endif; ?>
@@ -142,7 +150,11 @@ $websiteLabel = htmlspecialchars($_POST['website_label'] ?? '');
<button type="button" class="btn btn--sm btn--ghost file-browser-trigger"
data-queue-type="tfe"
data-thesis-id="<?= htmlspecialchars((string)($thesisId ?? $_GET['id'] ?? '')) ?>"
onclick="XamxamOpenFileBrowser(this)">
hx-get="/admin/fragments/file-browser.php"
hx-target="#relink-modal-body"
hx-swap="innerHTML"
hx-trigger="click"
onclick="document.getElementById('relink-modal').showModal(); window.__xamxamRelinkCtx = { queueType: 'tfe', thesisId: '<?= htmlspecialchars((string)($thesisId ?? $_GET['id'] ?? '')) ?>' };">
📂 Relier un fichier existant
</button>
<?php endif; ?>
@@ -166,7 +178,11 @@ $websiteLabel = htmlspecialchars($_POST['website_label'] ?? '');
<button type="button" class="btn btn--sm btn--ghost file-browser-trigger"
data-queue-type="annexe"
data-thesis-id="<?= htmlspecialchars((string)($thesisId ?? $_GET['id'] ?? '')) ?>"
onclick="XamxamOpenFileBrowser(this)">
hx-get="/admin/fragments/file-browser.php"
hx-target="#relink-modal-body"
hx-swap="innerHTML"
hx-trigger="click"
onclick="document.getElementById('relink-modal').showModal(); window.__xamxamRelinkCtx = { queueType: 'annexe', thesisId: '<?= htmlspecialchars((string)($thesisId ?? $_GET['id'] ?? '')) ?>' };">
📂 Relier un fichier existant
</button>
<?php endif; ?>
@@ -189,16 +205,5 @@ $websiteLabel = htmlspecialchars($_POST['website_label'] ?? '');
<!-- ═══════════════════ File Browser Modal (edit mode only) ═══════════════════ -->
<?php if ($editMode): ?>
<dialog id="relink-modal" class="relink-modal">
<div class="relink-modal-header">
<h3>Relier un fichier existant</h3>
<button type="button" class="btn btn--sm btn--ghost" onclick="document.getElementById('relink-modal').close()" aria-label="Fermer">✕</button>
</div>
<div id="relink-modal-body">
<p class="file-browser-loading">Chargement du navigateur de fichiers…</p>
</div>
<div class="relink-modal-footer">
<small>Seuls les fichiers déjà présents dans storage/documents/ ou storage/theses/ sont listés.</small>
</div>
</dialog>
<?php include APP_ROOT . '/templates/partials/form/file-browser-fragment.php'; ?>
<?php endif; ?>

View File

@@ -0,0 +1,25 @@
<?php
/**
* file-browser-fragment.php
*
* Shared dialog modal for the relink file browser.
* Included by the edit form only (admin mode, edit context).
*
* Expected variables:
* (none — the modal is self-contained and uses hx-get for its content)
*/
?>
<dialog id="relink-modal" class="relink-modal">
<div class="relink-modal-header">
<h3>Relier un fichier existant</h3>
<button type="button" class="btn btn--sm btn--ghost"
onclick="document.getElementById('relink-modal').close()"
aria-label="Fermer">✕</button>
</div>
<div id="relink-modal-body">
<p class="file-browser-loading">Chargement du navigateur de fichiers…</p>
</div>
<div class="relink-modal-footer">
<small>Seuls les fichiers déjà présents dans storage/documents/ ou storage/theses/ sont listés.</small>
</div>
</dialog>

View File

@@ -325,7 +325,14 @@ $_buildQueueFilesJson = function (array $files, string $queueType): array {
// Include PeerTube files too — load.php now handles them
$result[] = [
'source' => (string)((int)$f['id']),
'options' => ['type' => 'local'],
'options' => [
'type' => 'local',
'file' => [
'name' => $f['file_name'] ?? basename($f['file_path'] ?? ''),
'size' => (int)($f['file_size'] ?? 0),
'type' => $f['mime_type'] ?? 'application/octet-stream',
],
],
];
}
return $result;