Preserve FilePond temp files across partage validation redirects

This commit is contained in:
Pontoporeia
2026-06-11 11:41:25 +02:00
parent b744271cf6
commit 11a6f6a9f2
3 changed files with 14 additions and 7 deletions

View File

@@ -1,6 +1,6 @@
# TODO # TODO
> Last updated: 2026-06-11 > Last updated: 2026-06-11 11:42
> Context: Form Accessibility & Resilience improvements for XAMXAM thesis submission platform > Context: Form Accessibility & Resilience improvements for XAMXAM thesis submission platform
## In Progress ## In Progress
@@ -9,14 +9,13 @@
- [ ] #aria-test-manual Test WCAG changes with VoiceOver and NVDA on full add/edit/partage form flows - [ ] #aria-test-manual Test WCAG changes with VoiceOver and NVDA on full add/edit/partage form flows
- [ ] #nojs-upload-test Test end-to-end: submit partage form with JS disabled, verify files arrive via `$_FILES` - [ ] #nojs-upload-test Test end-to-end: submit partage form with JS disabled, verify files arrive via `$_FILES`
- [ ] #filepond-preserve Preserve FilePond temp file IDs on partage validation redirect `(partage/index.php)` `(FilepondHandler.php)`
- [ ] #two-phase-commit Add two-phase commit: INSERT thesis `status='draft'`, COMMIT, move files, UPDATE to `active` `(ThesisCreateController.php)` - [ ] #two-phase-commit Add two-phase commit: INSERT thesis `status='draft'`, COMMIT, move files, UPDATE to `active` `(ThesisCreateController.php)`
- [ ] #cleanup-drafts Add periodic cleanup job for orphaned drafts (`just cleanup-drafts`) - [ ] #cleanup-drafts Add periodic cleanup job for orphaned drafts (`just cleanup-drafts`)
- [ ] #form-setup-helper Add `ThesisFormSetup` helper class to reduce bootstrap duplication across add/edit/partage `(partage/index.php)` `(admin/add.php)` `(admin/edit.php)` - [ ] #form-setup-helper Add `ThesisFormSetup` helper class to reduce bootstrap duplication across add/edit/partage `(partage/index.php)` `(admin/add.php)` `(admin/edit.php)`
## Completed ## Completed
- [x] #filepond-preserve Preserve FilePond temp file IDs on partage validation redirect `(partage/index.php)` `(FilepondHandler.php)`
- [x] #refactor-partage Extract partage form page chrome to `templates/partage/form-page.php` `(partage/index.php)` - [x] #refactor-partage Extract partage form page chrome to `templates/partage/form-page.php` `(partage/index.php)`
- [x] #htmx-migration HTMX v2 migration: OverType editors, autosave handler, backend `HX-Request` detection ✓ - [x] #htmx-migration HTMX v2 migration: OverType editors, autosave handler, backend `HX-Request` detection ✓
- [x] #filepond-crash FilePond crash on TFE upload forms: root cause fixed (`.filename``.name`), all crashes resolved ✓ - [x] #filepond-crash FilePond crash on TFE upload forms: root cause fixed (`.filename``.name`), all crashes resolved ✓

View File

@@ -536,6 +536,9 @@ function handleShareLinkSubmission(string $slug): void
unset($_SESSION[$shareCsrfKey]); unset($_SESSION[$shareCsrfKey]);
unset($_SESSION['share_verified_' . $slug]); unset($_SESSION['share_verified_' . $slug]);
unset($_SESSION['share_active']); unset($_SESSION['share_active']);
unset($_SESSION['share_primed_files_' . $slug]);
// Clear FilePond temp file tracking — files have been moved to permanent storage
unset($_SESSION['filepond_tmp']);
// Send confirmation e-mail - on delivery failure, redirect to retry page // Send confirmation e-mail - on delivery failure, redirect to retry page
$emailError = null; $emailError = null;

View File

@@ -373,10 +373,15 @@ if ($filesMode === 'add'): ?>
$_POST['admin_mode'] = $adminMode ? '1' : '0'; $_POST['admin_mode'] = $adminMode ? '1' : '0';
$_POST['has_annexes'] = $formData['has_annexes'] ?? null; $_POST['has_annexes'] = $formData['has_annexes'] ?? null;
$existingFilesJsonForCover = []; // Preserve FilePond temp files across validation redirects.
$existingFilesJsonForNoteIntention = []; // Session temp files (uploaded via FilePond before a validation error)
$existingFilesJsonForTfe = []; // survive in $_SESSION['filepond_tmp'] and are fed to FilePond via
$existingFilesJsonForAnnexe = []; // data-existing-files so the user does not have to re-upload.
require_once APP_ROOT . '/src/FilepondHandler.php';
$existingFilesJsonForCover = FilepondHandler::getSessionTempFiles('cover');
$existingFilesJsonForNoteIntention = FilepondHandler::getSessionTempFiles('note_intention');
$existingFilesJsonForTfe = FilepondHandler::getSessionTempFiles('tfe');
$existingFilesJsonForAnnexe = FilepondHandler::getSessionTempFiles('annexe');
include APP_ROOT . '/templates/partials/form/fichiers-fragment.php'; include APP_ROOT . '/templates/partials/form/fichiers-fragment.php';
$_POST = $_savedPost; $_POST = $_savedPost;