mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-06-26 08:39:18 +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:
14
TODO.md
14
TODO.md
@@ -15,6 +15,20 @@
|
|||||||
- [x] `AdminLogger` — `logPeerTubeUpdate()` audit method
|
- [x] `AdminLogger` — `logPeerTubeUpdate()` audit method
|
||||||
- [x] Direct file upload fallback: when `peertube_upload_enabled = 0`, standard `<input type="file">` + local storage works unchanged
|
- [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] 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
|
- [x] PDF 100 MB limit + bentopdf mention
|
||||||
|
|||||||
@@ -132,11 +132,11 @@ $hxPost = $adminMode ? '/admin/fichiers-fragment.php' : '/partage/fichiers-fragm
|
|||||||
<div class="admin-file-input">
|
<div class="admin-file-input">
|
||||||
<input type="file" id="tfe-files-input"
|
<input type="file" id="tfe-files-input"
|
||||||
name="files[]" multiple
|
name="files[]" multiple
|
||||||
accept=".pdf,.jpg,.jpeg,.png,.gif,.webp,.zip,.tar,.gz"
|
accept=".pdf,.jpg,.jpeg,.png,.gif,.webp"
|
||||||
class="tfe-file-picker">
|
class="tfe-file-picker">
|
||||||
<small class="admin-file-hint">
|
<small class="admin-file-hint">
|
||||||
PDF (max 100 MB) · Images (JPG/PNG/GIF/WEBP) · Archives ZIP/TAR (max 500 MB).
|
PDF (max 100 MB) · Images (JPG/PNG/GIF/WEBP).
|
||||||
PDFs trop lourds ? <a href="https://www.bentopdf.com" target="_blank" rel="noopener">bentopdf.com</a>
|
PDFs trop lourds ? <a href="https://www.bentopdf.com" target="_blank" rel="noopener">https://bentopdf.com/</a>
|
||||||
</small>
|
</small>
|
||||||
<ul id="tfe-file-queue" class="tfe-file-queue sortable-list"
|
<ul id="tfe-file-queue" class="tfe-file-queue sortable-list"
|
||||||
aria-label="Fichiers sélectionnés (réordonnable)"></ul>
|
aria-label="Fichiers sélectionnés (réordonnable)"></ul>
|
||||||
@@ -144,6 +144,35 @@ $hxPost = $adminMode ? '/admin/fichiers-fragment.php' : '/partage/fichiers-fragm
|
|||||||
</div>
|
</div>
|
||||||
</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 ── -->
|
<!-- ── Format-specific extras ── -->
|
||||||
|
|
||||||
<?php if ($hasSiteWeb): ?>
|
<?php if ($hasSiteWeb): ?>
|
||||||
@@ -151,11 +180,12 @@ $hxPost = $adminMode ? '/admin/fichiers-fragment.php' : '/partage/fichiers-fragm
|
|||||||
<fieldset class="fichiers-format-extra" id="fichiers-website">
|
<fieldset class="fichiers-format-extra" id="fichiers-website">
|
||||||
<legend>Site web</legend>
|
<legend>Site web</legend>
|
||||||
<div class="admin-form-group">
|
<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">
|
<div class="admin-file-input">
|
||||||
<input type="url" id="website_url" name="website_url"
|
<input type="url" id="website_url" name="website_url"
|
||||||
value="<?= $websiteUrl ?>"
|
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>
|
<small>Le TFE sera affiché comme un site embarqué sur sa page publique.</small>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -285,7 +285,9 @@ function renderShareLinkForm(string $slug, array $link): void
|
|||||||
|
|
||||||
// Jury data from repopulation
|
// Jury data from repopulation
|
||||||
$juryPromoteur = old($formData, 'jury_promoteur');
|
$juryPromoteur = old($formData, 'jury_promoteur');
|
||||||
|
$juryPromoteurs = [];
|
||||||
$juryPromoteurUlb = old($formData, 'jury_promoteur_ulb_name');
|
$juryPromoteurUlb = old($formData, 'jury_promoteur_ulb_name');
|
||||||
|
$juryPromoteursUlb = [];
|
||||||
$lecteursInternes = [];
|
$lecteursInternes = [];
|
||||||
$lecteursExternes = [];
|
$lecteursExternes = [];
|
||||||
for ($i = 0; $i < 10; $i++) {
|
for ($i = 0; $i < 10; $i++) {
|
||||||
|
|||||||
@@ -364,24 +364,36 @@ class ThesisCreateController
|
|||||||
// Jury members — new structure: separate interne/externe lecteurs
|
// Jury members — new structure: separate interne/externe lecteurs
|
||||||
$juryMembers = [];
|
$juryMembers = [];
|
||||||
$hasPromoteur = false;
|
$hasPromoteur = false;
|
||||||
|
$hasPromoteurUlb = false;
|
||||||
$hasLecteurInt = false;
|
$hasLecteurInt = false;
|
||||||
$hasLecteurExt = false;
|
$hasLecteurExt = false;
|
||||||
if (!empty(trim($post['jury_promoteur'] ?? ''))) {
|
// Promoteurs internes (accept both scalar and array)
|
||||||
$juryMembers[] = [
|
$promoteurs = $post['jury_promoteur'] ?? null;
|
||||||
'name' => trim($post['jury_promoteur']),
|
if ($promoteurs !== null && !is_array($promoteurs)) {
|
||||||
'role' => 'promoteur',
|
$promoteurs = [$promoteurs];
|
||||||
'is_external' => 0,
|
|
||||||
'is_ulb' => 0,
|
|
||||||
];
|
|
||||||
$hasPromoteur = true;
|
|
||||||
}
|
}
|
||||||
if (!empty(trim($post['jury_promoteur_ulb_name'] ?? ''))) {
|
if (is_array($promoteurs)) {
|
||||||
$juryMembers[] = [
|
foreach ($promoteurs as $name) {
|
||||||
'name' => trim($post['jury_promoteur_ulb_name']),
|
$name = trim($name ?? '');
|
||||||
'role' => 'promoteur',
|
if ($name !== '') {
|
||||||
'is_external' => 1,
|
$juryMembers[] = ['name' => $name, 'role' => 'promoteur', 'is_external' => 0, 'is_ulb' => 0];
|
||||||
'is_ulb' => 1,
|
$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) {
|
foreach ($post['jury_lecteur_interne'] ?? [] as $name) {
|
||||||
$name = trim($name);
|
$name = trim($name);
|
||||||
|
|||||||
@@ -606,24 +606,32 @@ class ThesisEditController
|
|||||||
{
|
{
|
||||||
$members = [];
|
$members = [];
|
||||||
|
|
||||||
// Promoteur interne
|
// Promoteurs internes (accept both scalar and array)
|
||||||
if (!empty(trim($post['jury_promoteur'] ?? ''))) {
|
$promoteurs = $post['jury_promoteur'] ?? null;
|
||||||
$members[] = [
|
if ($promoteurs !== null && !is_array($promoteurs)) {
|
||||||
'name' => trim($post['jury_promoteur']),
|
$promoteurs = [$promoteurs];
|
||||||
'role' => 'promoteur',
|
}
|
||||||
'is_external' => 0,
|
if (is_array($promoteurs)) {
|
||||||
'is_ulb' => 0,
|
foreach ($promoteurs as $name) {
|
||||||
];
|
$name = trim($name ?? '');
|
||||||
|
if ($name !== '') {
|
||||||
|
$members[] = ['name' => $name, 'role' => 'promoteur', 'is_external' => 0, 'is_ulb' => 0];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Promoteur ULB
|
// Promoteurs ULB (accept both scalar and array)
|
||||||
if (!empty(trim($post['jury_promoteur_ulb_name'] ?? ''))) {
|
$promoteursUlb = $post['jury_promoteur_ulb_name'] ?? null;
|
||||||
$members[] = [
|
if ($promoteursUlb !== null && !is_array($promoteursUlb)) {
|
||||||
'name' => trim($post['jury_promoteur_ulb_name']),
|
$promoteursUlb = [$promoteursUlb];
|
||||||
'role' => 'promoteur',
|
}
|
||||||
'is_external' => 1,
|
if (is_array($promoteursUlb)) {
|
||||||
'is_ulb' => 1,
|
foreach ($promoteursUlb as $name) {
|
||||||
];
|
$name = trim($name ?? '');
|
||||||
|
if ($name !== '') {
|
||||||
|
$members[] = ['name' => $name, 'role' => 'promoteur', 'is_external' => 1, 'is_ulb' => 1];
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Lecteurs internes
|
// Lecteurs internes
|
||||||
|
|||||||
@@ -11,7 +11,9 @@
|
|||||||
|
|
||||||
// Jury: fresh add (all empty)
|
// Jury: fresh add (all empty)
|
||||||
$juryPromoteur = null;
|
$juryPromoteur = null;
|
||||||
|
$juryPromoteurs = [];
|
||||||
$juryPromoteurUlb = null;
|
$juryPromoteurUlb = null;
|
||||||
|
$juryPromoteursUlb = [];
|
||||||
$lecteursInternes = [];
|
$lecteursInternes = [];
|
||||||
$lecteursExternes = [];
|
$lecteursExternes = [];
|
||||||
$juryPresident = null;
|
$juryPresident = null;
|
||||||
@@ -27,8 +29,7 @@
|
|||||||
$defaultAccessTypeId = 2;
|
$defaultAccessTypeId = 2;
|
||||||
|
|
||||||
// Optional sections
|
// Optional sections
|
||||||
$showContact = true;
|
$showContact = false; // Admin: contact visibility controlled by filling 'mail' field in fieldset-tfe-info
|
||||||
$showContextNote = true;
|
|
||||||
$showBackoffice = true;
|
$showBackoffice = true;
|
||||||
|
|
||||||
// Files: add mode
|
// Files: add mode
|
||||||
|
|||||||
@@ -39,7 +39,9 @@
|
|||||||
|
|
||||||
// Jury data
|
// Jury data
|
||||||
$juryPromoteur = null;
|
$juryPromoteur = null;
|
||||||
|
$juryPromoteurs = [];
|
||||||
$juryPromoteurUlb = null;
|
$juryPromoteurUlb = null;
|
||||||
|
$juryPromoteursUlb = [];
|
||||||
$lecteursInternes = [];
|
$lecteursInternes = [];
|
||||||
$lecteursExternes = [];
|
$lecteursExternes = [];
|
||||||
$juryPresident = null;
|
$juryPresident = null;
|
||||||
@@ -48,9 +50,9 @@
|
|||||||
$juryPresident = $jm['name'];
|
$juryPresident = $jm['name'];
|
||||||
} elseif ($jm['role'] === 'promoteur') {
|
} elseif ($jm['role'] === 'promoteur') {
|
||||||
if (($jm['is_ulb'] ?? 0) == 1) {
|
if (($jm['is_ulb'] ?? 0) == 1) {
|
||||||
$juryPromoteurUlb = $jm['name'];
|
$juryPromoteursUlb[] = $jm;
|
||||||
} else {
|
} else {
|
||||||
$juryPromoteur = $jm['name'];
|
$juryPromoteurs[] = $jm;
|
||||||
}
|
}
|
||||||
} elseif ($jm['role'] === 'lecteur') {
|
} elseif ($jm['role'] === 'lecteur') {
|
||||||
if (($jm['is_external'] ?? 0) == 1) {
|
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;
|
$showPresident = true;
|
||||||
$showPromoteurUlb = true;
|
$showPromoteurUlb = true;
|
||||||
$promoteurUlbConditional = false;
|
$promoteurUlbConditional = false;
|
||||||
@@ -76,8 +85,7 @@
|
|||||||
$formData['cc2r'] = $currentRaw['cc4r'] ?? false;
|
$formData['cc2r'] = $currentRaw['cc4r'] ?? false;
|
||||||
|
|
||||||
// Optional sections
|
// Optional sections
|
||||||
$showContact = true;
|
$showContact = false; // Admin: contact visibility controlled by filling 'mail' field in fieldset-tfe-info
|
||||||
$showContextNote = true;
|
|
||||||
$showBackoffice = true;
|
$showBackoffice = true;
|
||||||
$showPublish = true;
|
$showPublish = true;
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ $adminMode = $adminMode ?? false;
|
|||||||
<div class="admin-file-input">
|
<div class="admin-file-input">
|
||||||
<input type="file" id="tfe-files-input"
|
<input type="file" id="tfe-files-input"
|
||||||
name="files[]" multiple
|
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">
|
class="tfe-file-picker">
|
||||||
<small class="admin-file-hint">
|
<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.
|
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.
|
||||||
|
|||||||
@@ -2,8 +2,9 @@
|
|||||||
/**
|
/**
|
||||||
* Shared partial — "Métadonnées complémentaires" fieldset.
|
* Shared partial — "Métadonnées complémentaires" fieldset.
|
||||||
*
|
*
|
||||||
* Now split: licence/access moved to licence-explanation fieldset.
|
* Fields: duration (pages + minutes).
|
||||||
* This fieldset keeps: duration (pages + minutes), lien (external link).
|
* Annexes checkbox + file input moved to Fichiers fieldset (fichiers-fragment.php).
|
||||||
|
* Lien BAIU moved to Backoffice fieldset.
|
||||||
*
|
*
|
||||||
* Variables consumed:
|
* Variables consumed:
|
||||||
* callable|null $oldFn — callable($key, $default='') for old/current values.
|
* 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)';
|
$type = 'number'; $placeholder = ''; $hint = 'Ex : 32 (pour œuvres audio/vidéo)';
|
||||||
include APP_ROOT . '/templates/partials/form/text-field.php';
|
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>
|
</fieldset>
|
||||||
<?php
|
<?php
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
*
|
*
|
||||||
* Jury data:
|
* Jury data:
|
||||||
* ?string $juryPromoteur, $juryPromoteurUlb, $juryPresident
|
* ?string $juryPromoteur, $juryPromoteurUlb, $juryPresident
|
||||||
|
* array $juryPromoteurs, $juryPromoteursUlb
|
||||||
* array $lecteursInternes, $lecteursExternes
|
* array $lecteursInternes, $lecteursExternes
|
||||||
* bool $showPresident, $showPromoteurUlb, $promoteurUlbConditional
|
* bool $showPresident, $showPromoteurUlb, $promoteurUlbConditional
|
||||||
*
|
*
|
||||||
@@ -31,8 +32,7 @@
|
|||||||
* bool $showContact — Contact checkbox fieldset
|
* bool $showContact — Contact checkbox fieldset
|
||||||
* bool $showCoverPreview — cover image preview + remove checkbox
|
* bool $showCoverPreview — cover image preview + remove checkbox
|
||||||
* bool $showExistingFiles — existing thesis files list (sortable, deletable)
|
* bool $showExistingFiles — existing thesis files list (sortable, deletable)
|
||||||
* bool $showContextNote — Note contextuelle fieldset
|
* bool $showBackoffice — Backoffice fieldset (context_note, jury_points, remarks, baiu_link, exemplaires, contact_interne)
|
||||||
* bool $showBackoffice — Backoffice fieldset (jury_points, remarks, contact_interne, exemplaires)
|
|
||||||
* bool $showEmailConfirmation — E-mail de confirmation fieldset
|
* bool $showEmailConfirmation — E-mail de confirmation fieldset
|
||||||
* bool $showPublish — Publication checkbox fieldset
|
* bool $showPublish — Publication checkbox fieldset
|
||||||
* string $helpFn — fn(string $key): string (for help blocks)
|
* string $helpFn — fn(string $key): string (for help blocks)
|
||||||
@@ -64,7 +64,9 @@ $formData = $formData ?? [];
|
|||||||
$synopsisExtra = $synopsisExtra ?? "";
|
$synopsisExtra = $synopsisExtra ?? "";
|
||||||
|
|
||||||
$juryPromoteur = $juryPromoteur ?? null;
|
$juryPromoteur = $juryPromoteur ?? null;
|
||||||
|
$juryPromoteurs = $juryPromoteurs ?? [];
|
||||||
$juryPromoteurUlb = $juryPromoteurUlb ?? null;
|
$juryPromoteurUlb = $juryPromoteurUlb ?? null;
|
||||||
|
$juryPromoteursUlb = $juryPromoteursUlb ?? [];
|
||||||
$lecteursInternes = $lecteursInternes ?? [];
|
$lecteursInternes = $lecteursInternes ?? [];
|
||||||
$lecteursExternes = $lecteursExternes ?? [];
|
$lecteursExternes = $lecteursExternes ?? [];
|
||||||
$juryPresident = $juryPresident ?? null;
|
$juryPresident = $juryPresident ?? null;
|
||||||
@@ -85,7 +87,6 @@ $showContact = $showContact ?? false;
|
|||||||
$showCoverPreview = $showCoverPreview ?? false;
|
$showCoverPreview = $showCoverPreview ?? false;
|
||||||
$showExistingFiles = $showExistingFiles ?? false;
|
$showExistingFiles = $showExistingFiles ?? false;
|
||||||
$showBannerPreview = false; // Banners merged into covers — field removed
|
$showBannerPreview = false; // Banners merged into covers — field removed
|
||||||
$showContextNote = $showContextNote ?? false;
|
|
||||||
$showBackoffice = $showBackoffice ?? false;
|
$showBackoffice = $showBackoffice ?? false;
|
||||||
$showEmailConfirmation = $showEmailConfirmation ?? false;
|
$showEmailConfirmation = $showEmailConfirmation ?? false;
|
||||||
$showPublish = $showPublish ?? false;
|
$showPublish = $showPublish ?? false;
|
||||||
@@ -239,38 +240,34 @@ $checkedFormatsForSiteWeb = $checkedFormatsForSiteWeb ?? [];
|
|||||||
$helpContent = $helpFn("fieldset_files");
|
$helpContent = $helpFn("fieldset_files");
|
||||||
include APP_ROOT . "/templates/partials/form/form-help-block.php";
|
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;
|
$_savedPost = $_POST;
|
||||||
$_POST['formats'] = $checkedFormatsForSiteWeb;
|
$_POST['formats'] = $checkedFormatsForSiteWeb;
|
||||||
$_POST['website_url'] = $existingWebsiteUrl;
|
$_POST['website_url'] = $existingWebsiteUrl;
|
||||||
$_POST['website_label'] = $existingWebsiteLabel;
|
$_POST['website_label'] = $existingWebsiteLabel;
|
||||||
$_POST['admin_mode'] = $adminMode ? '1' : '0';
|
$_POST['admin_mode'] = $adminMode ? '1' : '0';
|
||||||
|
$_POST['has_annexes'] = $formData['has_annexes'] ?? null;
|
||||||
include APP_ROOT . '/public/partage/fichiers-fragment.php';
|
include APP_ROOT . '/public/partage/fichiers-fragment.php';
|
||||||
$_POST = $_savedPost;
|
$_POST = $_savedPost;
|
||||||
unset($_savedPost);
|
unset($_savedPost);
|
||||||
?>
|
?>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<!-- Edit mode: Format checkboxes (old website fragment) + existing files management -->
|
<!-- Edit mode: reuse the same Format + Fichiers HTMX fragment as add/partage -->
|
||||||
<fieldset>
|
<?php
|
||||||
<legend>Format(s)</legend>
|
// Synthesise POST-like data so fichiers-fragment.php renders the initial state.
|
||||||
<?php
|
$_savedPost = $_POST;
|
||||||
$name = "formats";
|
$_POST['formats'] = $checkedFormatsForSiteWeb;
|
||||||
$label = "Format(s) du TFE :";
|
$_POST['website_url'] = $existingWebsiteUrl;
|
||||||
$options = $formatTypes;
|
$_POST['website_label'] = $existingWebsiteLabel;
|
||||||
$checked = $formData["formats"] ?? [];
|
$_POST['admin_mode'] = $adminMode ? '1' : '0';
|
||||||
$required = !$adminMode;
|
$_POST['has_annexes'] = $formData['has_annexes'] ?? null;
|
||||||
$hxPost = "/admin/format-website-fragment.php";
|
include APP_ROOT . '/public/partage/fichiers-fragment.php';
|
||||||
$hxTarget = "#edit-website-url-fieldset";
|
$_POST = $_savedPost;
|
||||||
$hxSwap = "outerHTML";
|
unset($_savedPost);
|
||||||
$hxInclude = "this, #edit-website-url-fieldset";
|
?>
|
||||||
include APP_ROOT . "/templates/partials/form/checkbox-list.php";
|
|
||||||
?>
|
|
||||||
</fieldset>
|
|
||||||
|
|
||||||
<!-- ═══════════════════ Fichiers (edit mode) ═══════════════════ -->
|
|
||||||
<fieldset>
|
|
||||||
<legend>Fichiers</legend>
|
|
||||||
|
|
||||||
|
<!-- Edit-only: existing files management -->
|
||||||
|
<div id="edit-existing-files-block">
|
||||||
<!-- Cover image -->
|
<!-- Cover image -->
|
||||||
<div class="admin-form-group">
|
<div class="admin-form-group">
|
||||||
<label>Image de couverture :</label>
|
<label>Image de couverture :</label>
|
||||||
@@ -397,64 +394,7 @@ $checkedFormatsForSiteWeb = $checkedFormatsForSiteWeb ?? [];
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
</div><!-- #edit-existing-files-block -->
|
||||||
<!-- 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>';
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<!-- ═══════════════════ Métadonnées complémentaires ═══════════════════ -->
|
<!-- ═══════════════════ Métadonnées complémentaires ═══════════════════ -->
|
||||||
@@ -471,11 +411,13 @@ $checkedFormatsForSiteWeb = $checkedFormatsForSiteWeb ?? [];
|
|||||||
"/templates/partials/form/fieldset-licence-explanation.php";
|
"/templates/partials/form/fieldset-licence-explanation.php";
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<?php if ($showContextNote): ?>
|
<?php if ($showBackoffice): ?>
|
||||||
<!-- ═══════════════════ Note contextuelle ═══════════════════ -->
|
<!-- ═══════════════════ Backoffice ═══════════════════ -->
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>Note contextuelle</legend>
|
<legend>Backoffice</legend>
|
||||||
<div>
|
|
||||||
|
<!-- 1. Note contextuelle -->
|
||||||
|
<div class="admin-form-group">
|
||||||
<label for="context_note">Note contextuelle :</label>
|
<label for="context_note">Note contextuelle :</label>
|
||||||
<div>
|
<div>
|
||||||
<textarea id="context_note" name="context_note"
|
<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>
|
<small>Visible publiquement pour les TFE Interne ou Interdit. Max 1 500 caractères.</small>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
|
||||||
<?php endif; ?>
|
|
||||||
|
|
||||||
<?php if ($showBackoffice): ?>
|
|
||||||
<!-- ═══════════════════ Backoffice ═══════════════════ -->
|
|
||||||
<fieldset>
|
|
||||||
<legend>Backoffice</legend>
|
|
||||||
|
|
||||||
|
<!-- 2. Points du jury -->
|
||||||
<div class="admin-form-group">
|
<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"
|
<input type="number" id="jury_points" name="jury_points"
|
||||||
value="<?= htmlspecialchars(
|
value="<?= htmlspecialchars(
|
||||||
$currentRaw["jury_points"] ??
|
$currentRaw["jury_points"] ??
|
||||||
@@ -505,6 +441,7 @@ $checkedFormatsForSiteWeb = $checkedFormatsForSiteWeb ?? [];
|
|||||||
<small>Note du jury (interne, non visible publiquement).</small>
|
<small>Note du jury (interne, non visible publiquement).</small>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- 3. Remarques -->
|
||||||
<div class="admin-form-group">
|
<div class="admin-form-group">
|
||||||
<label for="remarks">Remarques :</label>
|
<label for="remarks">Remarques :</label>
|
||||||
<textarea id="remarks" name="remarks" rows="4"><?= htmlspecialchars(
|
<textarea id="remarks" name="remarks" rows="4"><?= htmlspecialchars(
|
||||||
@@ -513,18 +450,14 @@ $checkedFormatsForSiteWeb = $checkedFormatsForSiteWeb ?? [];
|
|||||||
<small>Notes internes (non visibles publiquement).</small>
|
<small>Notes internes (non visibles publiquement).</small>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="admin-form-group">
|
<!-- 4. Lien BAIU -->
|
||||||
<label for="contact_interne">Contact interne :</label>
|
<?php
|
||||||
<input type="email" id="contact_interne" name="contact_interne"
|
$name = 'lien'; $label = 'Lien BAIU :'; $value = $oldFn('lien');
|
||||||
value="<?= htmlspecialchars(
|
$type = 'url'; $placeholder = 'https://...'; $hint = '';
|
||||||
$currentRaw["contact_interne"] ??
|
include APP_ROOT . '/templates/partials/form/text-field.php';
|
||||||
($formData["contact_interne"] ??
|
?>
|
||||||
($currentAuthorEmail ?? "")),
|
|
||||||
) ?>"
|
|
||||||
placeholder="ton.email@exemple.be">
|
|
||||||
<small>Adresse de contact interne (non visible publiquement).</small>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
<!-- 5. Exemplaire BAIU -->
|
||||||
<div class="admin-form-group">
|
<div class="admin-form-group">
|
||||||
<label class="admin-checkbox-label">
|
<label class="admin-checkbox-label">
|
||||||
<input type="checkbox" name="exemplaire_baiu" value="1"
|
<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>
|
<small>Case logistique : cocher si un exemplaire physique est disponible à la BAIU.</small>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- 6. Exemplaire ERG -->
|
||||||
<div class="admin-form-group">
|
<div class="admin-form-group">
|
||||||
<label class="admin-checkbox-label">
|
<label class="admin-checkbox-label">
|
||||||
<input type="checkbox" name="exemplaire_erg" value="1"
|
<input type="checkbox" name="exemplaire_erg" value="1"
|
||||||
@@ -552,6 +486,19 @@ $checkedFormatsForSiteWeb = $checkedFormatsForSiteWeb ?? [];
|
|||||||
</label>
|
</label>
|
||||||
<small>Case logistique : cocher si un exemplaire physique est disponible à l'ERG.</small>
|
<small>Case logistique : cocher si un exemplaire physique est disponible à l'ERG.</small>
|
||||||
</div>
|
</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>
|
</fieldset>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,10 @@
|
|||||||
* Jury composition fieldset partial.
|
* Jury composition fieldset partial.
|
||||||
*
|
*
|
||||||
* Variables consumed (all optional — defaults to empty/add-mode):
|
* Variables consumed (all optional — defaults to empty/add-mode):
|
||||||
* $juryPromoteur string|null Promoteur interne name
|
* $juryPromoteur string|null Promoteur interne name (single or primary)
|
||||||
* $juryPromoteurUlb string|null Promoteur ULB name
|
* $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}]
|
* $lecteursInternes array [{name: string}]
|
||||||
* $lecteursExternes array [{name: string}]
|
* $lecteursExternes array [{name: string}]
|
||||||
* $juryPresident string|null President name (edit-only, optional)
|
* $juryPresident string|null President name (edit-only, optional)
|
||||||
@@ -16,7 +18,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$juryPromoteur = $juryPromoteur ?? null;
|
$juryPromoteur = $juryPromoteur ?? null;
|
||||||
|
$juryPromoteurs = $juryPromoteurs ?? [];
|
||||||
$juryPromoteurUlb = $juryPromoteurUlb ?? null;
|
$juryPromoteurUlb = $juryPromoteurUlb ?? null;
|
||||||
|
$juryPromoteursUlb = $juryPromoteursUlb ?? [];
|
||||||
$lecteursInternes = $lecteursInternes ?? [];
|
$lecteursInternes = $lecteursInternes ?? [];
|
||||||
$lecteursExternes = $lecteursExternes ?? [];
|
$lecteursExternes = $lecteursExternes ?? [];
|
||||||
$juryPresident = $juryPresident ?? null;
|
$juryPresident = $juryPresident ?? null;
|
||||||
@@ -44,36 +48,107 @@ if ($addMode && function_exists('old')) {
|
|||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>Composition du jury</legend>
|
<legend>Composition du jury</legend>
|
||||||
|
|
||||||
<!-- Promoteur·ice interne -->
|
<!-- Promoteur·ice(s) interne -->
|
||||||
<div>
|
<fieldset class="admin-jury-lecteurs">
|
||||||
<label for="jury_promoteur">Promoteur·ice interne :<?= $adminMode ? '' : ' <span class="asterisk">*</span>' ?></label>
|
<legend>Promoteur·ice(s) interne<?= $adminMode ? '' : ' <span class="asterisk">*</span>' ?></legend>
|
||||||
<input type="text" id="jury_promoteur" name="jury_promoteur"
|
<div id="jury-promoteur-interne-list" class="admin-jury-list">
|
||||||
value="<?= htmlspecialchars($juryPromoteur ?? '') ?>" placeholder="Nom" <?= $adminMode ? '' : 'required' ?>>
|
<?php if (empty($juryPromoteurs) && $juryPromoteur === null): ?>
|
||||||
</div>
|
<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): ?>
|
<?php if ($showPromoteurUlb): ?>
|
||||||
<!-- Promoteur·ice ULB -->
|
<!-- Promoteur·ice(s) ULB -->
|
||||||
<div id="jury-promoteur-ulb-row"<?= $promoteurUlbConditional ? ' style="display:none"' : '' ?>>
|
<fieldset class="admin-jury-lecteurs" id="jury-promoteur-ulb-row"<?= $promoteurUlbConditional ? ' style="display:none"' : '' ?>>
|
||||||
<label for="jury_promoteur_ulb_name">Promoteur·ice ULB :</label>
|
<legend>Promoteur·ice(s) ULB<span id="jury-ulb-asterisk" style="display:none"> <span class="asterisk">*</span></span></legend>
|
||||||
<input type="text" id="jury_promoteur_ulb_name" name="jury_promoteur_ulb_name"
|
<div id="jury-promoteur-ulb-list" class="admin-jury-list">
|
||||||
value="<?= htmlspecialchars($juryPromoteurUlb ?? '') ?>" placeholder="Nom">
|
<?php if (empty($juryPromoteursUlb) && $juryPromoteurUlb === null): ?>
|
||||||
</div>
|
<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): ?>
|
<?php if ($promoteurUlbConditional): ?>
|
||||||
<script>
|
<script>
|
||||||
(function() {
|
(function() {
|
||||||
var finalitySelect = document.querySelector('select[name="finality"]');
|
var finalitySelect = document.querySelector('select[name="finality"]');
|
||||||
var ulbRow = document.getElementById('jury-promoteur-ulb-row');
|
var ulbRow = document.getElementById('jury-promoteur-ulb-row');
|
||||||
var ulbInput = ulbRow ? ulbRow.querySelector('input') : null;
|
var ulbInput = ulbRow ? ulbRow.querySelector('input') : null;
|
||||||
function toggleUlb() {
|
var ulbAsterisk = document.getElementById('jury-ulb-asterisk');
|
||||||
if (!finalitySelect || !ulbRow) return;
|
function isApprofondiSelected() {
|
||||||
|
if (!finalitySelect) return false;
|
||||||
var selected = finalitySelect.options[finalitySelect.selectedIndex];
|
var selected = finalitySelect.options[finalitySelect.selectedIndex];
|
||||||
var text = (selected && selected.text) ? selected.text.toLowerCase() : '';
|
var text = (selected && selected.text) ? selected.text.toLowerCase() : '';
|
||||||
var isApprofondi = text.includes('approfondi');
|
return text.includes('approfondi');
|
||||||
ulbRow.style.display = isApprofondi ? '' : 'none';
|
}
|
||||||
if (ulbInput) {
|
function toggleUlb() {
|
||||||
ulbInput.required = <?= $adminMode ? 'false' : 'isApprofondi' ?>;
|
if (!ulbRow) return;
|
||||||
ulbInput.disabled = !isApprofondi;
|
var show = isApprofondiSelected();
|
||||||
if (!isApprofondi) ulbInput.value = '';
|
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) {
|
if (finalitySelect) {
|
||||||
|
|||||||
Reference in New Issue
Block a user