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

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;