diff --git a/TODO.md b/TODO.md index 74baa41..f6c606d 100644 --- a/TODO.md +++ b/TODO.md @@ -23,3 +23,6 @@ - [x] Decouple format extras from main file inputs — slot-based HTMX swaps preserve FilePond instances - [x] Fix initFilePonds → window.XamxamInitFilePonds bug - [x] Verify backend $_FILES['queue_file'][*] data flow unchanged + - [x] Add FilePond pools for couverture + note_intention (extracted from file-field.php inner
) + - [x] Fix video/audio pools: allowMultiple: true, not single-file + - [x] Add QUEUE_CONFIG for cover (20MB single) and note_intention (100MB PDF single) diff --git a/app/public/assets/js/file-upload-filepond.js b/app/public/assets/js/file-upload-filepond.js index 5f723d4..06e68dc 100644 --- a/app/public/assets/js/file-upload-filepond.js +++ b/app/public/assets/js/file-upload-filepond.js @@ -15,24 +15,38 @@ (function () { "use strict"; - // ── Constants (mirrors file-upload-queue.js ALLOWED_BY_TYPE) ────────── + // ── Per-queue-type configuration ──────────────────────────────────── - var ALLOWED_BY_TYPE = { + var QUEUE_CONFIG = { tfe: { exts: ["jpg","jpeg","png","gif","webp","pdf","mp4","webm","ogv","mov","mp3","ogg","oga","wav","flac","aac","m4a","vtt","zip","tar","gz","tgz"], maxSize: function (f) { return (/\.pdf$/i.test(f.name) ? 100 : 500) * 1024 * 1024; }, + multiple: true, }, video: { exts: ["mp4","webm","ogv","mov"], maxSize: function () { return 500 * 1024 * 1024; }, + multiple: true, }, audio: { exts: ["mp3","ogg","oga","wav","flac","aac","m4a"], maxSize: function () { return 500 * 1024 * 1024; }, + multiple: true, }, annexe: { exts: ["pdf","zip","tar","gz","tgz"], maxSize: function () { return 500 * 1024 * 1024; }, + multiple: true, + }, + cover: { + exts: ["jpg","jpeg","png","webp"], + maxSize: function () { return 20 * 1024 * 1024; }, + multiple: false, + }, + note_intention: { + exts: ["pdf"], + maxSize: function () { return 100 * 1024 * 1024; }, + multiple: false, }, }; @@ -43,6 +57,8 @@ "video-files-input": "video", "audio-files-input": "audio", "annexe-files-input": "annexe", + "couverture": "cover", + "note_intention": "note_intention", }; function ext(fn) { @@ -53,10 +69,9 @@ // ── FilePond configuration per queue type ───────────────────────────── function buildFilePondOptions(queueType, input) { - var rules = ALLOWED_BY_TYPE[queueType]; - if (!rules) return null; + var cfg = QUEUE_CONFIG[queueType]; + if (!cfg) return null; - // Build acceptedFileTypes from extensions var mimeMap = { jpg: "image/jpeg", jpeg: "image/jpeg", png: "image/png", gif: "image/gif", webp: "image/webp", @@ -67,29 +82,20 @@ vtt: "text/vtt", zip: "application/zip", tar: "application/x-tar", gz: "application/gzip", tgz: "application/gzip", }; - var accepted = rules.exts.map(function(e) { return mimeMap[e] || ("." + e); }); + var accepted = cfg.exts.map(function(e) { return mimeMap[e] || ("." + e); }); return { - allowMultiple: (queueType !== "video" && queueType !== "audio"), + allowMultiple: cfg.multiple, allowReorder: true, storeAsFile: true, labelIdle: "Glissez-déposez vos fichiers ou Parcourir", acceptedFileTypes: accepted, labelFileTypeNotAllowed: "Type de fichier non accepté", - fileValidateTypeLabelExpectedTypes: "Types acceptés : " + rules.exts.map(function(e) { return "." + e; }).join(", "), - fileValidateSizeLabelMaxFileSize: function (fileSize) { - var max = rules.maxSize({name: "", size: 0}); - return "Taille maximale : " + Math.round(max / 1024 / 1024) + " MB"; - }, - maxFileSize: function () { - // We can't do per-file max based on extension easily with FilePond. - // Use the larger limit and validate PDFs as a special case in the - // beforeAddFile callback. - return "500MB"; - }, + fileValidateTypeLabelExpectedTypes: "Types acceptés : " + cfg.exts.map(function(e) { return "." + e; }).join(", "), + maxFileSize: function () { return "500MB"; }, beforeAddFile: function (item) { var f = item.file; - var max = rules.maxSize(f); + var max = cfg.maxSize(f); if (f.size > max) { var maxMb = Math.round(max / 1024 / 1024); return { @@ -123,9 +129,8 @@ var id = input.id; var queueType = INPUT_ID_TO_TYPE[id]; if (!queueType) { - // Try to infer from data attr on the container - var container = input.closest("[data-queue-type]"); - if (container) queueType = container.dataset.queueType; + // Try data-queue-type on the input itself + queueType = input.dataset.queueType || null; } if (!queueType) return; diff --git a/app/public/partage/fichiers-fragment.php b/app/public/partage/fichiers-fragment.php index e32552a..535a9c4 100644 --- a/app/public/partage/fichiers-fragment.php +++ b/app/public/partage/fichiers-fragment.php @@ -197,36 +197,35 @@ $hasAnnexesChecked = !empty($_POST['has_annexes']); - -
+ + if (!$editMode || !$_cover): ?> +
+ +
+ + JPG, PNG ou WEBP. Format 4:3 recommandé. Max 20 MB. +
+ - -
- bentopdf.com.'; - $hintRaw = true; - $required = !$adminMode; - $id = 'note_intention'; - include APP_ROOT . '/templates/partials/form/file-field.php'; - ?> + +
+ +
+ > + PDF uniquement. Max 100 MB. Si votre fichier est trop lourd, compressez-le avec bentopdf.com. +
diff --git a/app/templates/admin/acces.php b/app/templates/admin/acces.php index f914db8..efa3809 100644 --- a/app/templates/admin/acces.php +++ b/app/templates/admin/acces.php @@ -350,6 +350,32 @@ +%%%%%%% diff from: somsyvxz 249f7943 "Bulk bar anti-shift, tags icons, AP no-wrap, credits reorder" (rebased revision) +\\\\\\\ to: yuuqpnwp 6a989604 "Fix FilePond integration: decouple format extras from main file inputs" (rebased revision) ++ $linkName = $link['name'] ?? ''; +++ $linkExpiresVal = $link['expires_at'] ? date('Y-m-d\TH:i', strtotime($link['expires_at'])) : ''; +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff from: yuuqpnwp 6a989604 "Fix FilePond integration: decouple format extras from main file inputs" (rebased revision) +\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ to: somsyvxz 249f7943 "Bulk bar anti-shift, tags icons, AP no-wrap, credits reorder" (rebased revision) +- $linkName = $link['name'] ?? ''; +- $linkExpiresVal = $link['expires_at'] ? date('Y-m-d\TH:i', strtotime($link['expires_at'])) : ''; +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff from: somsyvxz 14a3cd10 "Bulk bar anti-shift, tags icons, AP no-wrap, credits reorder" (rebase destination) +\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ to: zmvkxops 2da46d51 (rebased revision) + $linkName = $link['name'] ?? ''; + $linkExpiresVal = $link['expires_at'] ? date('Y-m-d\TH:i', strtotime($link['expires_at'])) : ''; + $linkLockedYear = $link['locked_year'] ?? null; ++%%%%%%% diff from: somsyvxz 249f7943 "Bulk bar anti-shift, tags icons, AP no-wrap, credits reorder" (rebased revision) ++\\\\\\\ to: zmvkxops 23fecead (rebased revision) +++ $linkName = $link['name'] ?? ''; +++ $linkExpiresVal = $link['expires_at'] ? date('Y-m-d\TH:i', strtotime($link['expires_at'])) : ''; +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff from: zmvkxops 23fecead (rebased revision) +\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ to: somsyvxz 249f7943 "Bulk bar anti-shift, tags icons, AP no-wrap, credits reorder" (rebased revision) +- $linkName = $link['name'] ?? ''; +- $linkExpiresVal = $link['expires_at'] ? date('Y-m-d\TH:i', strtotime($link['expires_at'])) : ''; +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff from: somsyvxz 14a3cd10 "Bulk bar anti-shift, tags icons, AP no-wrap, credits reorder" (rebase destination) +\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ to: rptplqsr 54c10953 "Add FilePond pools for couverture, note_intention, video, audio" (rebased revision) + $linkName = $link['name'] ?? ''; + $linkExpiresVal = $link['expires_at'] ? date('Y-m-d\TH:i', strtotime($link['expires_at'])) : ''; + $linkLockedYear = $link['locked_year'] ?? null; ++%%%%%%% diff from: somsyvxz 249f7943 "Bulk bar anti-shift, tags icons, AP no-wrap, credits reorder" (rebased revision) ++\\\\\\\ to: rptplqsr 5f9568bd "Add FilePond pools for couverture, note_intention, video, audio" (rebased revision) +++ $linkName = $link['name'] ?? ''; ++ $linkExpiresVal = $link['expires_at'] ? date('Y-m-d\TH:i', strtotime($link['expires_at'])) : ''; ?>