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:
Pontoporeia
2026-05-08 17:03:42 +02:00
parent 03c5fd217e
commit 8f4f9d00b4
11 changed files with 270 additions and 187 deletions

14
TODO.md
View File

@@ -15,6 +15,20 @@
- [x] `AdminLogger``logPeerTubeUpdate()` audit method
- [x] Direct file upload fallback: when `peertube_upload_enabled = 0`, standard `<input type="file">` + local storage works unchanged
- [x] Backoffice fieldset reorder — Note contextuelle merged in, Lien BAIU added, removed from Métadonnées
- [x] Backoffice order: Note contextuelle → Points du jury → Remarques → Lien BAIU → Exemplaire BAIU → Exemplaire ERG → Contact interne
- [x] Removed standalone "Note contextuelle" fieldset (now inside Backoffice)
- [x] Lien BAIU moved from Métadonnées complémentaires into Backoffice
- [x] Métadonnées fieldset now: pages, minutes, annexes only
- [x] Form fixes batch
- [x] bentopdf link clearer: "PDFs trop lourds ? https://bentopdf.com/" (full URL visible)
- [x] Multiple promoteurices: interne and ULB fields now dynamic (add/remove rows, same as lecteurs)
- [x] Contact visibility duplication removed from admin forms (`showContact = false`; `mail` field in fieldset-tfe-info covers it)
- [x] Asterisk corrections in files section: note_intention, website URL, video, audio all show red asterisk + `required` when non-admin
- [x] ULB promoteurice asterisk + required when finality=Approfondi (JS toggles `<span class="asterisk">*</span>` + `required` on first ULB input)
- [x] Controllers handle `jury_promoteur` and `jury_promoteur_ulb_name` as both scalar and array (backwards compat)
- [x] Fix `just serve` — justfile shebang recipes (`deploy-env`, `reencrypt-password`) used space indentation instead of tabs, causing "extra leading whitespace" parse error
- [x] PDF 100 MB limit + bentopdf mention

View File

@@ -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>

View File

@@ -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++) {

View File

@@ -364,24 +364,36 @@ class ThesisCreateController
// Jury members — new structure: separate interne/externe lecteurs
$juryMembers = [];
$hasPromoteur = false;
$hasPromoteurUlb = false;
$hasLecteurInt = false;
$hasLecteurExt = false;
if (!empty(trim($post['jury_promoteur'] ?? ''))) {
$juryMembers[] = [
'name' => trim($post['jury_promoteur']),
'role' => 'promoteur',
'is_external' => 0,
'is_ulb' => 0,
];
$hasPromoteur = true;
// Promoteurs internes (accept both scalar and array)
$promoteurs = $post['jury_promoteur'] ?? null;
if ($promoteurs !== null && !is_array($promoteurs)) {
$promoteurs = [$promoteurs];
}
if (!empty(trim($post['jury_promoteur_ulb_name'] ?? ''))) {
$juryMembers[] = [
'name' => trim($post['jury_promoteur_ulb_name']),
'role' => 'promoteur',
'is_external' => 1,
'is_ulb' => 1,
];
if (is_array($promoteurs)) {
foreach ($promoteurs as $name) {
$name = trim($name ?? '');
if ($name !== '') {
$juryMembers[] = ['name' => $name, 'role' => 'promoteur', 'is_external' => 0, 'is_ulb' => 0];
$hasPromoteur = true;
}
}
}
// Promoteurs ULB (accept both scalar and array)
$promoteursUlb = $post['jury_promoteur_ulb_name'] ?? null;
if ($promoteursUlb !== null && !is_array($promoteursUlb)) {
$promoteursUlb = [$promoteursUlb];
}
if (is_array($promoteursUlb)) {
foreach ($promoteursUlb as $name) {
$name = trim($name ?? '');
if ($name !== '') {
$juryMembers[] = ['name' => $name, 'role' => 'promoteur', 'is_external' => 1, 'is_ulb' => 1];
$hasPromoteurUlb = true;
}
}
}
foreach ($post['jury_lecteur_interne'] ?? [] as $name) {
$name = trim($name);

View File

@@ -606,24 +606,32 @@ class ThesisEditController
{
$members = [];
// Promoteur interne
if (!empty(trim($post['jury_promoteur'] ?? ''))) {
$members[] = [
'name' => trim($post['jury_promoteur']),
'role' => 'promoteur',
'is_external' => 0,
'is_ulb' => 0,
];
// Promoteurs internes (accept both scalar and array)
$promoteurs = $post['jury_promoteur'] ?? null;
if ($promoteurs !== null && !is_array($promoteurs)) {
$promoteurs = [$promoteurs];
}
if (is_array($promoteurs)) {
foreach ($promoteurs as $name) {
$name = trim($name ?? '');
if ($name !== '') {
$members[] = ['name' => $name, 'role' => 'promoteur', 'is_external' => 0, 'is_ulb' => 0];
}
}
}
// Promoteur ULB
if (!empty(trim($post['jury_promoteur_ulb_name'] ?? ''))) {
$members[] = [
'name' => trim($post['jury_promoteur_ulb_name']),
'role' => 'promoteur',
'is_external' => 1,
'is_ulb' => 1,
];
// Promoteurs ULB (accept both scalar and array)
$promoteursUlb = $post['jury_promoteur_ulb_name'] ?? null;
if ($promoteursUlb !== null && !is_array($promoteursUlb)) {
$promoteursUlb = [$promoteursUlb];
}
if (is_array($promoteursUlb)) {
foreach ($promoteursUlb as $name) {
$name = trim($name ?? '');
if ($name !== '') {
$members[] = ['name' => $name, 'role' => 'promoteur', 'is_external' => 1, 'is_ulb' => 1];
}
}
}
// Lecteurs internes

View File

@@ -11,7 +11,9 @@
// Jury: fresh add (all empty)
$juryPromoteur = null;
$juryPromoteurs = [];
$juryPromoteurUlb = null;
$juryPromoteursUlb = [];
$lecteursInternes = [];
$lecteursExternes = [];
$juryPresident = null;
@@ -27,8 +29,7 @@
$defaultAccessTypeId = 2;
// Optional sections
$showContact = true;
$showContextNote = true;
$showContact = false; // Admin: contact visibility controlled by filling 'mail' field in fieldset-tfe-info
$showBackoffice = true;
// Files: add mode

View File

@@ -39,7 +39,9 @@
// Jury data
$juryPromoteur = null;
$juryPromoteurs = [];
$juryPromoteurUlb = null;
$juryPromoteursUlb = [];
$lecteursInternes = [];
$lecteursExternes = [];
$juryPresident = null;
@@ -48,9 +50,9 @@
$juryPresident = $jm['name'];
} elseif ($jm['role'] === 'promoteur') {
if (($jm['is_ulb'] ?? 0) == 1) {
$juryPromoteurUlb = $jm['name'];
$juryPromoteursUlb[] = $jm;
} else {
$juryPromoteur = $jm['name'];
$juryPromoteurs[] = $jm;
}
} elseif ($jm['role'] === 'lecteur') {
if (($jm['is_external'] ?? 0) == 1) {
@@ -60,6 +62,13 @@
}
}
}
// Backwards compat: if only one, also set the scalar for simple templates
if (!empty($juryPromoteurs) && $juryPromoteur === null) {
$juryPromoteur = $juryPromoteurs[0]['name'];
}
if (!empty($juryPromoteursUlb) && $juryPromoteurUlb === null) {
$juryPromoteurUlb = $juryPromoteursUlb[0]['name'];
}
$showPresident = true;
$showPromoteurUlb = true;
$promoteurUlbConditional = false;
@@ -76,8 +85,7 @@
$formData['cc2r'] = $currentRaw['cc4r'] ?? false;
// Optional sections
$showContact = true;
$showContextNote = true;
$showContact = false; // Admin: contact visibility controlled by filling 'mail' field in fieldset-tfe-info
$showBackoffice = true;
$showPublish = true;

View File

@@ -39,7 +39,7 @@ $adminMode = $adminMode ?? false;
<div class="admin-file-input">
<input type="file" id="tfe-files-input"
name="files[]" multiple
accept=".pdf,.jpg,.jpeg,.png,.gif,.webp,.mp4,.webm,.mov,.ogv,.mp3,.ogg,.oga,.wav,.flac,.aac,.m4a,.zip,.tar,.gz,.vtt"
accept=".pdf,.jpg,.jpeg,.png,.gif,.webp,.mp4,.webm,.mov,.ogv,.mp3,.ogg,.oga,.wav,.flac,.aac,.m4a,.vtt"
class="tfe-file-picker">
<small class="admin-file-hint">
Types acceptés : PDF · JPG/PNG/GIF/WEBP · MP4/WebM/MOV (vidéo) · MP3/OGG/WAV/FLAC (audio) · ZIP/TAR (archives). Max 500 MB par fichier.

View File

@@ -2,8 +2,9 @@
/**
* Shared partial — "Métadonnées complémentaires" fieldset.
*
* Now split: licence/access moved to licence-explanation fieldset.
* This fieldset keeps: duration (pages + minutes), lien (external link).
* Fields: duration (pages + minutes).
* Annexes checkbox + file input moved to Fichiers fieldset (fichiers-fragment.php).
* Lien BAIU moved to Backoffice fieldset.
*
* Variables consumed:
* callable|null $oldFn — callable($key, $default='') for old/current values.
@@ -29,20 +30,5 @@ $formData = $formData ?? [];
$type = 'number'; $placeholder = ''; $hint = 'Ex : 32 (pour œuvres audio/vidéo)';
include APP_ROOT . '/templates/partials/form/text-field.php';
?>
<div class="admin-form-group">
<label class="admin-checkbox-label">
<input type="checkbox" name="has_annexes" value="1"
<?= !empty($formData['has_annexes']) ? 'checked' : '' ?>>
Ce TFE comporte des annexes
</label>
</div>
<?php
$name = 'lien'; $label = 'Lien (site / ressource) :'; $value = $oldFn('lien');
$type = 'url'; $placeholder = 'https://...'; $hint = '';
$attrs = $withAutofocusFn('lien');
include APP_ROOT . '/templates/partials/form/text-field.php';
?>
</fieldset>
<?php

View File

@@ -17,6 +17,7 @@
*
* Jury data:
* ?string $juryPromoteur, $juryPromoteurUlb, $juryPresident
* array $juryPromoteurs, $juryPromoteursUlb
* array $lecteursInternes, $lecteursExternes
* bool $showPresident, $showPromoteurUlb, $promoteurUlbConditional
*
@@ -31,8 +32,7 @@
* bool $showContact — Contact checkbox fieldset
* bool $showCoverPreview — cover image preview + remove checkbox
* bool $showExistingFiles — existing thesis files list (sortable, deletable)
* bool $showContextNote — Note contextuelle fieldset
* bool $showBackoffice — Backoffice fieldset (jury_points, remarks, contact_interne, exemplaires)
* bool $showBackoffice Backoffice fieldset (context_note, jury_points, remarks, baiu_link, exemplaires, contact_interne)
* bool $showEmailConfirmation — E-mail de confirmation fieldset
* bool $showPublish — Publication checkbox fieldset
* string $helpFn — fn(string $key): string (for help blocks)
@@ -64,7 +64,9 @@ $formData = $formData ?? [];
$synopsisExtra = $synopsisExtra ?? "";
$juryPromoteur = $juryPromoteur ?? null;
$juryPromoteurs = $juryPromoteurs ?? [];
$juryPromoteurUlb = $juryPromoteurUlb ?? null;
$juryPromoteursUlb = $juryPromoteursUlb ?? [];
$lecteursInternes = $lecteursInternes ?? [];
$lecteursExternes = $lecteursExternes ?? [];
$juryPresident = $juryPresident ?? null;
@@ -85,7 +87,6 @@ $showContact = $showContact ?? false;
$showCoverPreview = $showCoverPreview ?? false;
$showExistingFiles = $showExistingFiles ?? false;
$showBannerPreview = false; // Banners merged into covers — field removed
$showContextNote = $showContextNote ?? false;
$showBackoffice = $showBackoffice ?? false;
$showEmailConfirmation = $showEmailConfirmation ?? false;
$showPublish = $showPublish ?? false;
@@ -239,38 +240,34 @@ $checkedFormatsForSiteWeb = $checkedFormatsForSiteWeb ?? [];
$helpContent = $helpFn("fieldset_files");
include APP_ROOT . "/templates/partials/form/form-help-block.php";
}
// Temporarily populate $_POST so the fragment can read formats/website values.
// Temporarily populate $_POST so the fragment can read formats/website/annexes values.
$_savedPost = $_POST;
$_POST['formats'] = $checkedFormatsForSiteWeb;
$_POST['website_url'] = $existingWebsiteUrl;
$_POST['website_label'] = $existingWebsiteLabel;
$_POST['admin_mode'] = $adminMode ? '1' : '0';
$_POST['has_annexes'] = $formData['has_annexes'] ?? null;
include APP_ROOT . '/public/partage/fichiers-fragment.php';
$_POST = $_savedPost;
unset($_savedPost);
?>
<?php else: ?>
<!-- Edit mode: Format checkboxes (old website fragment) + existing files management -->
<fieldset>
<legend>Format(s)</legend>
<?php
$name = "formats";
$label = "Format(s) du TFE :";
$options = $formatTypes;
$checked = $formData["formats"] ?? [];
$required = !$adminMode;
$hxPost = "/admin/format-website-fragment.php";
$hxTarget = "#edit-website-url-fieldset";
$hxSwap = "outerHTML";
$hxInclude = "this, #edit-website-url-fieldset";
include APP_ROOT . "/templates/partials/form/checkbox-list.php";
?>
</fieldset>
<!-- ═══════════════════ Fichiers (edit mode) ═══════════════════ -->
<fieldset>
<legend>Fichiers</legend>
<!-- Edit mode: reuse the same Format + Fichiers HTMX fragment as add/partage -->
<?php
// Synthesise POST-like data so fichiers-fragment.php renders the initial state.
$_savedPost = $_POST;
$_POST['formats'] = $checkedFormatsForSiteWeb;
$_POST['website_url'] = $existingWebsiteUrl;
$_POST['website_label'] = $existingWebsiteLabel;
$_POST['admin_mode'] = $adminMode ? '1' : '0';
$_POST['has_annexes'] = $formData['has_annexes'] ?? null;
include APP_ROOT . '/public/partage/fichiers-fragment.php';
$_POST = $_savedPost;
unset($_savedPost);
?>
<!-- Edit-only: existing files management -->
<div id="edit-existing-files-block">
<!-- Cover image -->
<div class="admin-form-group">
<label>Image de couverture :</label>
@@ -397,64 +394,7 @@ $checkedFormatsForSiteWeb = $checkedFormatsForSiteWeb ?? [];
</ul>
</div>
<?php endif; ?>
<!-- New thesis files -->
<div class="admin-form-group admin-files-fieldgroup">
<label>Ajouter des fichiers du TFE :</label>
<div class="admin-file-input">
<input type="file" id="tfe-files-input"
name="files[]" multiple
accept=".pdf,.jpg,.jpeg,.png,.gif,.webp,.mp4,.webm,.mov,.ogv,.mp3,.ogg,.oga,.wav,.flac,.aac,.m4a,.zip,.tar,.gz,.vtt"
class="tfe-file-picker">
<small class="admin-file-hint">
PDF (max 100 MB) · Images (JPG/PNG/GIF/WEBP) · ZIP/TAR (max 500 MB) · autres fichiers.
PDFs trop lourds ? <a href="https://www.bentopdf.com" target="_blank" rel="noopener">bentopdf.com</a>
</small>
<ul id="tfe-file-queue" class="tfe-file-queue sortable-list" aria-label="Nouveaux fichiers (réordonnable)"></ul>
<p id="tfe-file-queue-empty" class="tfe-queue-empty">Aucun nouveau fichier sélectionné.</p>
</div>
</div>
</fieldset>
<!-- Website URL fieldset for edit mode — shown/hidden via HTMX -->
<fieldset id="edit-website-url-fieldset" style="display:none">
<legend>Site web</legend>
<div class="admin-form-group">
<label for="website_url">URL du site :</label>
<div class="admin-file-input">
<input type="url" id="website_url" name="website_url"
value="<?= htmlspecialchars($existingWebsiteUrl) ?>"
placeholder="https://mon-tfe.erg.be">
<small>Si le TFE est un site web, entrez son URL ici. Il sera affiché comme un site embarqué sur la page du TFE.</small>
</div>
</div>
<div class="admin-form-group">
<label for="website_label">Légende :</label>
<input type="text" id="website_label" name="website_label"
value="<?= htmlspecialchars($existingWebsiteLabel) ?>"
placeholder="Description du site (optionnel)"
class="admin-file-label-input"
style="max-width:400px;">
</div>
</fieldset>
<?php
// Server-side: show website fieldset if Site web already checked
$_stmt = Database::getInstance()
->getConnection()
->prepare("SELECT id FROM format_types WHERE name = ? LIMIT 1");
$_stmt->execute(["Site web"]);
$_siteWebId = $_stmt->fetchColumn();
if (
$_siteWebId &&
in_array(
(string) $_siteWebId,
array_map("strval", $checkedFormatsForSiteWeb),
true,
)
) {
echo '<script>document.getElementById("edit-website-url-fieldset").style.display=""</script>';
}
?>
</div><!-- #edit-existing-files-block -->
<?php endif; ?>
<!-- ═══════════════════ Métadonnées complémentaires ═══════════════════ -->
@@ -471,11 +411,13 @@ $checkedFormatsForSiteWeb = $checkedFormatsForSiteWeb ?? [];
"/templates/partials/form/fieldset-licence-explanation.php";
?>
<?php if ($showContextNote): ?>
<!-- ═══════════════════ Note contextuelle ═══════════════════ -->
<?php if ($showBackoffice): ?>
<!-- ═══════════════════ Backoffice ═══════════════════ -->
<fieldset>
<legend>Note contextuelle</legend>
<div>
<legend>Backoffice</legend>
<!-- 1. Note contextuelle -->
<div class="admin-form-group">
<label for="context_note">Note contextuelle :</label>
<div>
<textarea id="context_note" name="context_note"
@@ -486,16 +428,10 @@ $checkedFormatsForSiteWeb = $checkedFormatsForSiteWeb ?? [];
<small>Visible publiquement pour les TFE Interne ou Interdit. Max 1 500 caractères.</small>
</div>
</div>
</fieldset>
<?php endif; ?>
<?php if ($showBackoffice): ?>
<!-- ═══════════════════ Backoffice ═══════════════════ -->
<fieldset>
<legend>Backoffice</legend>
<!-- 2. Points du jury -->
<div class="admin-form-group">
<label for="jury_points">Points :</label>
<label for="jury_points">Points du jury :</label>
<input type="number" id="jury_points" name="jury_points"
value="<?= htmlspecialchars(
$currentRaw["jury_points"] ??
@@ -505,6 +441,7 @@ $checkedFormatsForSiteWeb = $checkedFormatsForSiteWeb ?? [];
<small>Note du jury (interne, non visible publiquement).</small>
</div>
<!-- 3. Remarques -->
<div class="admin-form-group">
<label for="remarks">Remarques :</label>
<textarea id="remarks" name="remarks" rows="4"><?= htmlspecialchars(
@@ -513,18 +450,14 @@ $checkedFormatsForSiteWeb = $checkedFormatsForSiteWeb ?? [];
<small>Notes internes (non visibles publiquement).</small>
</div>
<div class="admin-form-group">
<label for="contact_interne">Contact interne :</label>
<input type="email" id="contact_interne" name="contact_interne"
value="<?= htmlspecialchars(
$currentRaw["contact_interne"] ??
($formData["contact_interne"] ??
($currentAuthorEmail ?? "")),
) ?>"
placeholder="ton.email@exemple.be">
<small>Adresse de contact interne (non visible publiquement).</small>
</div>
<!-- 4. Lien BAIU -->
<?php
$name = 'lien'; $label = 'Lien BAIU :'; $value = $oldFn('lien');
$type = 'url'; $placeholder = 'https://...'; $hint = '';
include APP_ROOT . '/templates/partials/form/text-field.php';
?>
<!-- 5. Exemplaire BAIU -->
<div class="admin-form-group">
<label class="admin-checkbox-label">
<input type="checkbox" name="exemplaire_baiu" value="1"
@@ -539,6 +472,7 @@ $checkedFormatsForSiteWeb = $checkedFormatsForSiteWeb ?? [];
<small>Case logistique : cocher si un exemplaire physique est disponible à la BAIU.</small>
</div>
<!-- 6. Exemplaire ERG -->
<div class="admin-form-group">
<label class="admin-checkbox-label">
<input type="checkbox" name="exemplaire_erg" value="1"
@@ -552,6 +486,19 @@ $checkedFormatsForSiteWeb = $checkedFormatsForSiteWeb ?? [];
</label>
<small>Case logistique : cocher si un exemplaire physique est disponible à l'ERG.</small>
</div>
<!-- 7. Contact interne -->
<div class="admin-form-group">
<label for="contact_interne">Contact interne :</label>
<input type="email" id="contact_interne" name="contact_interne"
value="<?= htmlspecialchars(
$currentRaw["contact_interne"] ??
($formData["contact_interne"] ??
($currentAuthorEmail ?? "")),
) ?>"
placeholder="ton.email@exemple.be">
<small>Adresse de contact interne (non visible publiquement).</small>
</div>
</fieldset>
<?php endif; ?>

View File

@@ -3,8 +3,10 @@
* Jury composition fieldset partial.
*
* Variables consumed (all optional — defaults to empty/add-mode):
* $juryPromoteur string|null Promoteur interne name
* $juryPromoteurUlb string|null Promoteur ULB name
* $juryPromoteur string|null Promoteur interne name (single or primary)
* $juryPromoteurs array [{name: string}] Multiple promoteurs internes
* $juryPromoteurUlb string|null Promoteur ULB name (single or primary)
* $juryPromoteursUlb array [{name: string}] Multiple promoteurs ULB
* $lecteursInternes array [{name: string}]
* $lecteursExternes array [{name: string}]
* $juryPresident string|null President name (edit-only, optional)
@@ -16,7 +18,9 @@
*/
$juryPromoteur = $juryPromoteur ?? null;
$juryPromoteurs = $juryPromoteurs ?? [];
$juryPromoteurUlb = $juryPromoteurUlb ?? null;
$juryPromoteursUlb = $juryPromoteursUlb ?? [];
$lecteursInternes = $lecteursInternes ?? [];
$lecteursExternes = $lecteursExternes ?? [];
$juryPresident = $juryPresident ?? null;
@@ -44,36 +48,107 @@ if ($addMode && function_exists('old')) {
<fieldset>
<legend>Composition du jury</legend>
<!-- Promoteur·ice interne -->
<div>
<label for="jury_promoteur">Promoteur·ice interne :<?= $adminMode ? '' : ' <span class="asterisk">*</span>' ?></label>
<input type="text" id="jury_promoteur" name="jury_promoteur"
value="<?= htmlspecialchars($juryPromoteur ?? '') ?>" placeholder="Nom" <?= $adminMode ? '' : 'required' ?>>
</div>
<!-- Promoteur·ice(s) interne -->
<fieldset class="admin-jury-lecteurs">
<legend>Promoteur·ice(s) interne<?= $adminMode ? '' : ' <span class="asterisk">*</span>' ?></legend>
<div id="jury-promoteur-interne-list" class="admin-jury-list">
<?php if (empty($juryPromoteurs) && $juryPromoteur === null): ?>
<div class="admin-jury-entry">
<input type="text" name="jury_promoteur[]" placeholder="Nom" <?= $adminMode ? '' : 'required' ?>
id="jury_promoteur" aria-label="Promoteur·ice interne 1 — nom">
<button type="button" class="btn btn--sm btn--ghost admin-btn-remove"
onclick="removeJuryRow(this)" aria-label="Supprimer"><span aria-hidden="true">✕</span></button>
</div>
<?php elseif (!empty($juryPromoteurs)): ?>
<?php foreach ($juryPromoteurs as $pi => $pm): ?>
<div class="admin-jury-entry">
<input type="text" name="jury_promoteur[]"
value="<?= htmlspecialchars($pm['name']) ?>" placeholder="Nom"
<?= (!$adminMode && $pi === 0) ? 'required' : '' ?>
aria-label="Promoteur·ice interne <?= $pi + 1 ?> — nom">
<button type="button" class="btn btn--sm btn--ghost admin-btn-remove"
onclick="removeJuryRow(this)" aria-label="Supprimer"><span aria-hidden="true">✕</span></button>
</div>
<?php endforeach; ?>
<?php else: ?>
<div class="admin-jury-entry">
<input type="text" name="jury_promoteur[]"
value="<?= htmlspecialchars($juryPromoteur ?? '') ?>" placeholder="Nom" <?= $adminMode ? '' : 'required' ?>
aria-label="Promoteur·ice interne 1 — nom">
<button type="button" class="btn btn--sm btn--ghost admin-btn-remove"
onclick="removeJuryRow(this)" aria-label="Supprimer"><span aria-hidden="true">✕</span></button>
</div>
<?php endif; ?>
</div>
<button type="button" class="btn btn--secondary admin-add-jury-btn"
onclick="addJuryRow('jury-promoteur-interne-list', 'jury_promoteur', 'Promoteur·ice interne')">
+ Ajouter un·e promoteur·ice interne
</button>
</fieldset>
<?php if ($showPromoteurUlb): ?>
<!-- Promoteur·ice ULB -->
<div id="jury-promoteur-ulb-row"<?= $promoteurUlbConditional ? ' style="display:none"' : '' ?>>
<label for="jury_promoteur_ulb_name">Promoteur·ice ULB :</label>
<input type="text" id="jury_promoteur_ulb_name" name="jury_promoteur_ulb_name"
value="<?= htmlspecialchars($juryPromoteurUlb ?? '') ?>" placeholder="Nom">
</div>
<!-- Promoteur·ice(s) ULB -->
<fieldset class="admin-jury-lecteurs" id="jury-promoteur-ulb-row"<?= $promoteurUlbConditional ? ' style="display:none"' : '' ?>>
<legend>Promoteur·ice(s) ULB<span id="jury-ulb-asterisk" style="display:none"> <span class="asterisk">*</span></span></legend>
<div id="jury-promoteur-ulb-list" class="admin-jury-list">
<?php if (empty($juryPromoteursUlb) && $juryPromoteurUlb === null): ?>
<div class="admin-jury-entry">
<input type="text" name="jury_promoteur_ulb_name[]" placeholder="Nom"
aria-label="Promoteur·ice ULB 1 — nom">
<button type="button" class="btn btn--sm btn--ghost admin-btn-remove"
onclick="removeJuryRow(this)" aria-label="Supprimer"><span aria-hidden="true">✕</span></button>
</div>
<?php elseif (!empty($juryPromoteursUlb)): ?>
<?php foreach ($juryPromoteursUlb as $pi => $pm): ?>
<div class="admin-jury-entry">
<input type="text" name="jury_promoteur_ulb_name[]"
value="<?= htmlspecialchars($pm['name']) ?>" placeholder="Nom"
aria-label="Promoteur·ice ULB <?= $pi + 1 ?> — nom">
<button type="button" class="btn btn--sm btn--ghost admin-btn-remove"
onclick="removeJuryRow(this)" aria-label="Supprimer"><span aria-hidden="true">✕</span></button>
</div>
<?php endforeach; ?>
<?php else: ?>
<div class="admin-jury-entry">
<input type="text" name="jury_promoteur_ulb_name[]"
value="<?= htmlspecialchars($juryPromoteurUlb ?? '') ?>" placeholder="Nom"
aria-label="Promoteur·ice ULB 1 — nom">
<button type="button" class="btn btn--sm btn--ghost admin-btn-remove"
onclick="removeJuryRow(this)" aria-label="Supprimer"><span aria-hidden="true">✕</span></button>
</div>
<?php endif; ?>
</div>
<button type="button" class="btn btn--secondary admin-add-jury-btn"
onclick="addJuryRow('jury-promoteur-ulb-list', 'jury_promoteur_ulb_name', 'Promoteur·ice ULB')">
+ Ajouter un·e promoteur·ice ULB
</button>
</fieldset>
<?php if ($promoteurUlbConditional): ?>
<script>
(function() {
var finalitySelect = document.querySelector('select[name="finality"]');
var ulbRow = document.getElementById('jury-promoteur-ulb-row');
var ulbInput = ulbRow ? ulbRow.querySelector('input') : null;
function toggleUlb() {
if (!finalitySelect || !ulbRow) return;
var ulbAsterisk = document.getElementById('jury-ulb-asterisk');
function isApprofondiSelected() {
if (!finalitySelect) return false;
var selected = finalitySelect.options[finalitySelect.selectedIndex];
var text = (selected && selected.text) ? selected.text.toLowerCase() : '';
var isApprofondi = text.includes('approfondi');
ulbRow.style.display = isApprofondi ? '' : 'none';
if (ulbInput) {
ulbInput.required = <?= $adminMode ? 'false' : 'isApprofondi' ?>;
ulbInput.disabled = !isApprofondi;
if (!isApprofondi) ulbInput.value = '';
return text.includes('approfondi');
}
function toggleUlb() {
if (!ulbRow) return;
var show = isApprofondiSelected();
ulbRow.style.display = show ? '' : 'none';
if (ulbAsterisk) ulbAsterisk.style.display = show ? '' : 'none';
// Mark first ULB input required when finality is Approfondi
if (ulbRow) {
var inputs = ulbRow.querySelectorAll('input[name="jury_promoteur_ulb_name[]"]');
inputs.forEach(function(inp, idx) {
inp.required = <?= $adminMode ? 'false' : 'show && idx === 0' ?>;
inp.disabled = !show;
if (!show) inp.value = '';
});
}
}
if (finalitySelect) {