diff --git a/TODO.md b/TODO.md index 39acae9..7f6e3d9 100644 --- a/TODO.md +++ b/TODO.md @@ -39,6 +39,14 @@ - [x] Update `root` directive in `nginx/posterg.conf` - [x] Update `STORAGE_ROOT` production path in `app/bootstrap.php` +## Centralise Form Templates + +- [x] Extract shared fieldset partials: `fieldset-tfe-info.php`, `fieldset-academic.php`, `fieldset-files.php`, `fieldset-metadata.php`, `fieldset-licence-explanation.php` +- [x] Refactor `templates/admin/add.php` to use shared partials +- [x] Refactor `templates/admin/edit.php` to use shared partials (with edit-mode callable adapters) +- [x] Refactor `partage/index.php` `renderShareLinkForm()` to use shared partials +- [x] Add TODO comments in `partage/index.php` for student-facing explanations (intro block, per-fieldset notes, email note) + ## File Display in Forms & Recaps - [x] Add live file preview to `file-field.php` partial (`data-preview` attribute + `.file-preview-list` container) diff --git a/app/public/partage/index.php b/app/public/partage/index.php index 9d5aa34..7b0f6ce 100644 --- a/app/public/partage/index.php +++ b/app/public/partage/index.php @@ -182,17 +182,15 @@ function renderShareLinkForm(string $slug, array $link): void die('Erreur lors du chargement du formulaire.'); } - $formData = $_SESSION['form_data_share_' . $slug] ?? []; + $formData = $_SESSION['form_data_share_' . $slug] ?? []; unset($_SESSION['form_data_share_' . $slug]); // Determine allowed objet values for this link - $siteSettings = Database::getInstance()->getAllSettings(); + $siteSettings = Database::getInstance()->getAllSettings(); $objetRestriction = $link['objet_restriction'] ?? null; if ($objetRestriction !== null) { - // Link is locked to one type — always show only that $allowedObjet = [$objetRestriction]; } else { - // Build from enabled site settings $allowedObjet = ['tfe']; if (($siteSettings['objet_these_enabled'] ?? '1') === '1') $allowedObjet[] = 'thèse'; if (($siteSettings['objet_frart_enabled'] ?? '1') === '1') $allowedObjet[] = 'frart'; @@ -205,10 +203,13 @@ function renderShareLinkForm(string $slug, array $link): void } $shareCsrfToken = $_SESSION[$shareCsrfKey]; - $pageTitle = 'Soumettre un TFE'; - - // Determine if previously verified by password + $pageTitle = 'Soumettre un TFE'; $isVerified = !empty($_SESSION['share_verified_' . $slug]); + + // Build old()-compatible callable from $formData (share forms use the array variant). + $shareOldFn = fn(string $key, string $default = '') => old($formData, $key, $default); + // No autofocus in the share form — identity function. + $shareWithAutofocusFn = fn(string $field, array $attrs = []) => $attrs; ?> @@ -242,187 +243,97 @@ function renderShareLinkForm(string $slug, array $link): void
* Champs obligatoires