From 32a75095987f9800db3d65c1edb7fcbbbf52d6c2 Mon Sep 17 00:00:00 2001 From: Pontoporeia Date: Mon, 27 Apr 2026 20:41:43 +0200 Subject: [PATCH] feat: add file display to forms and recap pages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Live file preview on all file inputs (file-field partial, edit template): thumbnails for images, emoji icons for PDF/video/zip/vtt, filename + size - New file-preview.js wired via $extraJs in add.php / edit.php and direct
diff --git a/app/public/partage/recapitulatif.php b/app/public/partage/recapitulatif.php index a854740..ee1c2ff 100644 --- a/app/public/partage/recapitulatif.php +++ b/app/public/partage/recapitulatif.php @@ -1,7 +1,7 @@ getThesis($thesisId); if (!$thesis) { http_response_code(404); die('TFE introuvable.'); } +$files = $db->getThesisFiles($thesisId); + // Was the confirmation e-mail sent? $emailSent = !empty($_SESSION['share_email_sent']); unset($_SESSION['share_email_sent']); -// Get the share link slug from the referer path -$pathParts = explode('/', trim($_SERVER['REQUEST_URI'] ?? '', '/')); -$slug = count($pathParts) >= 2 ? $pathParts[0] : null; +// Derive share-link slug from the URI so we can build the "submit another" link. +$pathParts = explode('/', trim(parse_url($_SERVER['REQUEST_URI'] ?? '', PHP_URL_PATH), '/')); +// URI is /partage/recapitulatif?id=N → parts[0]=partage, parts[1]=recapitulatif +// We have no slug here, so just link back to /partage/ root. +$slug = null; + +function partageFormatFileSize(int $bytes): string { + if ($bytes >= 1073741824) return number_format($bytes / 1073741824, 2) . ' GB'; + if ($bytes >= 1048576) return number_format($bytes / 1048576, 2) . ' MB'; + if ($bytes >= 1024) return number_format($bytes / 1024, 2) . ' KB'; + return $bytes . ' B'; +} $pageTitle = 'Merci — TFE enregistré'; ?> @@ -43,20 +53,99 @@ $pageTitle = 'Merci — TFE enregistré'; -
+
+

✅ Merci !

Votre TFE a bien été enregistré sur la plateforme.

📧 Un e-mail de confirmation a été envoyé avec un récapitulatif de votre soumission.

- -

- - - + Soumettre un autre TFE -
+ +
+

Récapitulatif de votre soumission

+
+
Titre
+
+ + +
Sous-titre
+
+ + + +
Auteur·ice(s)
+
+ + + +
Année
+
+ + + +
Orientation
+
+ + + +
Atelier pluridisciplinaire
+
+ + + +
Finalité
+
+ + + +
Mots-clés
+
+ +
+
+ + +
+

Fichiers soumis

+
    + + +
  • + + + <?= $fileName ?> + + + + + + +
    + + + +
    +
  • + +
+
+ +
diff --git a/app/templates/admin/edit.php b/app/templates/admin/edit.php index 4b20c82..1b651dd 100644 --- a/app/templates/admin/edit.php +++ b/app/templates/admin/edit.php @@ -112,7 +112,8 @@ - + +
@@ -149,7 +150,9 @@
+ accept=".pdf,.jpg,.jpeg,.png,.mp4,.zip,.vtt" + data-preview="fp-files"> +
PDF, JPG, PNG, MP4, ZIP. Max 50 MB par fichier. Pour les vidéos, un fichier .vtt de sous-titres peut être joint.
@@ -167,7 +170,8 @@ - + +
diff --git a/app/templates/admin/recapitulatif.php b/app/templates/admin/recapitulatif.php index d0501e5..45a3ed5 100644 --- a/app/templates/admin/recapitulatif.php +++ b/app/templates/admin/recapitulatif.php @@ -84,19 +84,41 @@

Fichiers

- - - - - - - - - - - - -
TypeFichierTailleDate
+
    + + +
  • + + + <?= $fileName ?> + + + + + + +
    + + + + +
    +
  • + +
diff --git a/app/templates/head.php b/app/templates/head.php index d006502..852162d 100644 --- a/app/templates/head.php +++ b/app/templates/head.php @@ -69,6 +69,9 @@ + + +