mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-06-25 16:19:19 +02:00
Refactor: Form improvements and cleanup: note contextuel, annexes, fichiers
1. fix: form improvements — multiple promoteurices, asterisks, contact dedup, bentopdf - Multiple promoteurice (interne + ULB): both fieldsets now support dynamic add/remove rows (same pattern as lecteurs). field names changed to arrays (jury_promoteur[], jury_promoteur_ulb_name[]). Controllers accept both scalar and array forms for backwards compat. - ULB promoteurice: when finality=Approfondi, asterisk appears on legend and first ULB input is marked required (JS toggle). Non-Approfondi hides the fieldset and clears values. - Contact visibility duplication: removed redundant contact_public checkbox from admin add/edit forms (showContact=false). The 'mail' field in fieldset-tfe-info already serves this purpose. - Asterisk fixes: website URL field now has asterisk+required when Site web format selected. Video/audio already had correct required handling. - bentopdf link: clearer full URL 'https://bentopdf.com/' in both fichiers-fragment.php and form.php (edit mode) 2. refactor: merge Note contextuelle into Backoffice, add Lien BAIU, reorder fields Backoffice fieldset now contains in order: 1. Note contextuelle (was standalone fieldset) 2. Points du jury 3. Remarques 4. Lien BAIU (moved from Métadonnées complémentaires) 5. Exemplaire physique BAIU 6. Exemplaire physique ERG 7. Contact interne Métadonnées complémentaires now only has: pages, minutes, annexes checkbox. Removed dead showContextNote variable from form.php, add.php, edit.php. Controller baiu_link still mapped to input name "lien" (no migration needed). 3. refactor: move annexes checkbox from Métadonnées into Fichiers fieldset - Removed 'Ce TFE comporte des annexes' checkbox from fieldset-metadata.php. - Added annexes checkbox + conditional file input to fichiers-fragment.php. When checked, an HTMX swap reveals the 'annexes' file input (multiple, PDF or ZIP/TAR, max 500 MB). - form.php seeds ['has_annexes'] for initial fragment render. - Métadonnées complémentaires now only contains pages + minutes.
This commit is contained in:
@@ -132,11 +132,11 @@ $hxPost = $adminMode ? '/admin/fichiers-fragment.php' : '/partage/fichiers-fragm
|
||||
<div class="admin-file-input">
|
||||
<input type="file" id="tfe-files-input"
|
||||
name="files[]" multiple
|
||||
accept=".pdf,.jpg,.jpeg,.png,.gif,.webp,.zip,.tar,.gz"
|
||||
accept=".pdf,.jpg,.jpeg,.png,.gif,.webp"
|
||||
class="tfe-file-picker">
|
||||
<small class="admin-file-hint">
|
||||
PDF (max 100 MB) · Images (JPG/PNG/GIF/WEBP) · Archives ZIP/TAR (max 500 MB).
|
||||
PDFs trop lourds ? <a href="https://www.bentopdf.com" target="_blank" rel="noopener">bentopdf.com</a>
|
||||
PDF (max 100 MB) · Images (JPG/PNG/GIF/WEBP).
|
||||
PDFs trop lourds ? <a href="https://www.bentopdf.com" target="_blank" rel="noopener">https://bentopdf.com/</a>
|
||||
</small>
|
||||
<ul id="tfe-file-queue" class="tfe-file-queue sortable-list"
|
||||
aria-label="Fichiers sélectionnés (réordonnable)"></ul>
|
||||
@@ -144,6 +144,35 @@ $hxPost = $adminMode ? '/admin/fichiers-fragment.php' : '/partage/fichiers-fragm
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- ── Annexes ── -->
|
||||
<?php
|
||||
$hasAnnexesChecked = !empty($_POST['has_annexes']);
|
||||
?>
|
||||
<div class="admin-form-group">
|
||||
<label class="admin-checkbox-label">
|
||||
<input type="checkbox" name="has_annexes" value="1"
|
||||
<?= $hasAnnexesChecked ? 'checked' : '' ?>
|
||||
hx-post="<?= htmlspecialchars($hxPost) ?>"
|
||||
hx-target="#format-fichiers-block"
|
||||
hx-trigger="change"
|
||||
hx-include="[name='formats[]'], [name='website_url'], [name='website_label'], [name='admin_mode'], [name='has_annexes']"
|
||||
hx-swap="outerHTML">
|
||||
Ce TFE comporte des annexes
|
||||
</label>
|
||||
</div>
|
||||
<?php if ($hasAnnexesChecked): ?>
|
||||
<?php
|
||||
$name = 'annexes';
|
||||
$label = 'Annexes :';
|
||||
$accept = '.pdf,.zip,.tar,.gz';
|
||||
$hint = 'PDF ou archives ZIP/TAR. Max 500 MB.';
|
||||
$required = false;
|
||||
$multiple = true;
|
||||
include APP_ROOT . '/templates/partials/form/file-field.php';
|
||||
?>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- ── Format-specific extras ── -->
|
||||
|
||||
<?php if ($hasSiteWeb): ?>
|
||||
@@ -151,11 +180,12 @@ $hxPost = $adminMode ? '/admin/fichiers-fragment.php' : '/partage/fichiers-fragm
|
||||
<fieldset class="fichiers-format-extra" id="fichiers-website">
|
||||
<legend>Site web</legend>
|
||||
<div class="admin-form-group">
|
||||
<label for="website_url">URL du site :</label>
|
||||
<label for="website_url">URL du site<?= !$adminMode ? ' <span class="asterisk">*</span>' : '' ?> :</label>
|
||||
<div class="admin-file-input">
|
||||
<input type="url" id="website_url" name="website_url"
|
||||
value="<?= $websiteUrl ?>"
|
||||
placeholder="https://mon-tfe.erg.be">
|
||||
placeholder="https://mon-tfe.erg.be"
|
||||
<?= !$adminMode ? 'required' : '' ?>>
|
||||
<small>Le TFE sera affiché comme un site embarqué sur sa page publique.</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -285,7 +285,9 @@ function renderShareLinkForm(string $slug, array $link): void
|
||||
|
||||
// Jury data from repopulation
|
||||
$juryPromoteur = old($formData, 'jury_promoteur');
|
||||
$juryPromoteurs = [];
|
||||
$juryPromoteurUlb = old($formData, 'jury_promoteur_ulb_name');
|
||||
$juryPromoteursUlb = [];
|
||||
$lecteursInternes = [];
|
||||
$lecteursExternes = [];
|
||||
for ($i = 0; $i < 10; $i++) {
|
||||
|
||||
Reference in New Issue
Block a user