mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-05-06 19:19:19 +02:00
centralise form fieldsets into shared partials; add TODO stubs in partage form
This commit is contained in:
@@ -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;
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
@@ -242,187 +243,97 @@ function renderShareLinkForm(string $slug, array $link): void
|
||||
<div class="flash-success" role="alert"><?= htmlspecialchars($flashSuccess) ?></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- TODO: Add an introductory block here explaining the purpose of this form
|
||||
to students: what xamxam is, what happens after submission, who can see
|
||||
their work, and the general timeline before publication. -->
|
||||
|
||||
<p class="required-note"><span class="asterisk">*</span> Champs obligatoires</p>
|
||||
<form action="/partage/<?= urlencode($slug) ?>/submit" method="post" enctype="multipart/form-data" class="admin-form">
|
||||
<input type="hidden" name="share_link_token" value="<?= htmlspecialchars($shareCsrfToken) ?>">
|
||||
|
||||
<!-- ═══════════════════ Informations du TFE ═══════════════════ -->
|
||||
<fieldset>
|
||||
<legend>Informations du TFE</legend>
|
||||
|
||||
<?php if (count($allowedObjet) > 1): ?>
|
||||
<div class="admin-form-group">
|
||||
<label>Type de travail : <span class="asterisk">*</span></label>
|
||||
<div class="form-radio-group">
|
||||
<?php foreach ($allowedObjet as $objetVal): ?>
|
||||
<label class="admin-checkbox-label">
|
||||
<input type="radio" name="objet" value="<?= htmlspecialchars($objetVal) ?>"
|
||||
<?= (old($formData, 'objet') ?: $allowedObjet[0]) === $objetVal ? 'checked' : '' ?> required>
|
||||
<?= htmlspecialchars(ucfirst($objetVal)) ?>
|
||||
</label>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<input type="hidden" name="objet" value="<?= htmlspecialchars($allowedObjet[0]) ?>">
|
||||
<?php endif; ?>
|
||||
|
||||
<?php $name = 'titre'; $label = 'Titre :'; $value = old($formData, 'titre'); $required = true; include APP_ROOT . '/templates/partials/form/text-field.php'; ?>
|
||||
<?php $name = 'subtitle'; $label = 'Sous-titre (si applicable) :'; $value = old($formData, 'subtitle'); $required = false; include APP_ROOT . '/templates/partials/form/text-field.php'; ?>
|
||||
<?php $name = 'auteurice'; $label = 'Auteur·ice(s) :'; $value = old($formData, 'auteurice'); $required = true; $attrs = ['autocomplete' => 'name']; include APP_ROOT . '/templates/partials/form/text-field.php'; ?>
|
||||
<?php $name = 'mail'; $label = 'Contact(s) (optionnel) [mail/site/insta/etc.] :'; $value = old($formData, 'mail'); $attrs = ['autocomplete' => 'email']; include APP_ROOT . '/templates/partials/form/text-field.php'; ?>
|
||||
|
||||
<div class="admin-form-group">
|
||||
<label class="admin-checkbox-label">
|
||||
<input type="checkbox" name="contact_public" value="1"
|
||||
<?= isset($formData['contact_public']) ? 'checked' : '' ?>>
|
||||
Je veux que mon contact soit accessible à toustes depuis la plateforme xamxam
|
||||
</label>
|
||||
<small>Si cette case est cochée, votre contact apparaîtra sur la page publique de votre TFE.</small>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label for="synopsis">Synopsis :</label>
|
||||
<textarea id="synopsis" name="synopsis" rows="7" required><?= old($formData, 'synopsis') ?></textarea>
|
||||
</div>
|
||||
</fieldset>
|
||||
<?php
|
||||
// TODO: Add a student-facing explanation block for each fieldset below,
|
||||
// describing what information is expected and why it is collected.
|
||||
$oldFn = $shareOldFn;
|
||||
$withAutofocusFn = $shareWithAutofocusFn;
|
||||
// TODO: Add a contextual note for the synopsis field explaining the
|
||||
// expected length, tone, and whether it will be publicly visible.
|
||||
$synopsisExtra = '';
|
||||
include APP_ROOT . '/templates/partials/form/fieldset-tfe-info.php';
|
||||
?>
|
||||
|
||||
<!-- ═══════════════════ Composition du jury ═══════════════════ -->
|
||||
<fieldset>
|
||||
<legend>Composition du jury</legend>
|
||||
|
||||
<?php $name = 'jury_president'; $label = 'Président·e du jury :'; $value = old($formData, 'jury_president'); include APP_ROOT . '/templates/partials/form/text-field.php'; ?>
|
||||
<?php $name = 'jury_promoteur'; $label = 'Promoteur·ice :'; $value = old($formData, 'jury_promoteur'); $hintCheckbox = ['name' => 'jury_promoteur_ext', 'label' => 'Externe à l\'erg', 'checked' => !empty($formData['jury_promoteur_ext'])]; include APP_ROOT . '/templates/partials/form/text-field.php'; ?>
|
||||
|
||||
<div class="jury-additional">
|
||||
<p>Lecteurs·rices (optionnel) :</p>
|
||||
<?php for ($i = 0; $i < 4; $i++): ?>
|
||||
<div class="jury-additional-row">
|
||||
<input type="text"
|
||||
name="jury_lecteurs[]"
|
||||
placeholder="<?= $i === 0 ? 'Nom du lecteur·ice' : ''; ?>"
|
||||
value="<?= old($formData, "jury_lecteurs:$i") ?>">
|
||||
<label class="admin-checkbox-label">
|
||||
<input type="checkbox" name="jury_lecteurs_ext[<?= $i ?>]" value="1"
|
||||
<?= !empty($formData["jury_lecteurs_ext:$i"]) ? 'checked' : '' ?>>
|
||||
Externe
|
||||
</label>
|
||||
</div>
|
||||
<?php endfor; ?>
|
||||
</div>
|
||||
</fieldset>
|
||||
<?php
|
||||
// Seed jury partial from repopulated $formData (share add-mode).
|
||||
$juryPresident = old($formData, 'jury_president') ?: null;
|
||||
$juryPromoteur = old($formData, 'jury_promoteur') ?: null;
|
||||
$juryPromoteurExt = !empty($formData['jury_promoteur_ext']) ? 1 : 0;
|
||||
$juryLecteurs = [];
|
||||
for ($i = 0; $i < 4; $i++) {
|
||||
$name = old($formData, "jury_lecteurs:$i");
|
||||
if ($name !== '') {
|
||||
$juryLecteurs[] = [
|
||||
'name' => $name,
|
||||
'is_external' => !empty($formData["jury_lecteurs_ext:$i"]) ? 1 : 0,
|
||||
];
|
||||
}
|
||||
}
|
||||
// TODO: Add a note explaining the jury composition to students:
|
||||
// who counts as external, what role each member plays, and
|
||||
// whether this information will be publicly visible.
|
||||
require APP_ROOT . '/templates/partials/form/jury-fieldset.php';
|
||||
?>
|
||||
|
||||
<!-- ═══════════════════ Cadre académique ═══════════════════ -->
|
||||
<fieldset>
|
||||
<legend>Cadre académique</legend>
|
||||
|
||||
<?php
|
||||
$name = 'année'; $label = 'Année :'; $value = old($formData, 'année'); $required = true;
|
||||
$type = 'number';
|
||||
$placeholder = date('Y');
|
||||
$attrs = ['min' => 2000, 'max' => date('Y') + 1];
|
||||
include APP_ROOT . '/templates/partials/form/text-field.php';
|
||||
?>
|
||||
|
||||
<?php $name = 'orientation'; $label = 'Orientation :'; $options = $orientations; $selected = isset($formData['orientation']) ? $formData['orientation'] : ''; $required = true; $placeholder = ''; include APP_ROOT . '/templates/partials/form/select-field.php'; ?>
|
||||
<?php $name = 'ap'; $label = 'Atelier pluridisciplinaire :'; $options = $apPrograms; $selected = isset($formData['ap']) ? $formData['ap'] : ''; $required = true; $placeholder = ''; include APP_ROOT . '/templates/partials/form/select-field.php'; ?>
|
||||
<?php $name = 'finality'; $label = 'Finalité du master :'; $options = $finalityTypes; $selected = isset($formData['finality']) ? $formData['finality'] : ''; $required = true; $placeholder = ''; include APP_ROOT . '/templates/partials/form/select-field.php'; ?>
|
||||
|
||||
<?php $name = 'languages'; $label = 'Langue(s) :'; $options = $languages; $checked = $formData['languages'] ?? []; $required = true; include APP_ROOT . '/templates/partials/form/checkbox-list.php'; ?>
|
||||
<?php $name = 'formats'; $label = 'Format(s) :'; $options = $formatTypes; $checked = $formData['formats'] ?? []; include APP_ROOT . '/templates/partials/form/checkbox-list.php'; ?>
|
||||
|
||||
<?php $name = 'tag'; $label = 'Mots-clés :'; $value = old($formData, 'tag'); $placeholder = 'sociologie, anthropologie, ...'; $hint = 'Séparez par des virgules. Max 10 mots-clés.'; include APP_ROOT . '/templates/partials/form/text-field.php'; ?>
|
||||
</fieldset>
|
||||
<?php
|
||||
$oldFn = $shareOldFn;
|
||||
$withAutofocusFn = $shareWithAutofocusFn;
|
||||
// TODO: Add a note for the academic context fieldset clarifying what
|
||||
// orientation/AP/finality values correspond to, and where students
|
||||
// can look them up if unsure.
|
||||
include APP_ROOT . '/templates/partials/form/fieldset-academic.php';
|
||||
?>
|
||||
|
||||
<!-- ═══════════════════ Fichiers ═══════════════════ -->
|
||||
<fieldset>
|
||||
<legend>Fichiers</legend>
|
||||
|
||||
<?php $name = 'couverture'; $label = 'Image de couverture :'; $accept = 'image/jpeg,image/png'; $hint = 'JPG, PNG. Taille max : 10 MB.'; include APP_ROOT . '/templates/partials/form/file-field.php'; ?>
|
||||
<?php $name = 'banner'; $label = 'Image bannière (accueil) :'; $accept = 'image/jpeg,image/png,image/webp'; $hint = 'JPG, PNG ou WEBP. Format paysage recommandé (4:1). Max 5 MB.'; include APP_ROOT . '/templates/partials/form/file-field.php'; ?>
|
||||
<?php $name = 'files'; $label = 'Fichiers du TFE :'; $accept = '.pdf,.jpg,.jpeg,.png,.mp4,.zip,.vtt'; $hint = 'PDF, JPG, PNG, MP4, ZIP. Max 50 MB par fichier. Pour les vidéos, un fichier .vtt de sous-titres peut être joint (il sera associé automatiquement à la vidéo correspondante).'; $multiple = true; include APP_ROOT . '/templates/partials/form/file-field.php'; ?>
|
||||
</fieldset>
|
||||
<?php
|
||||
// TODO: Add a note before the files fieldset explaining accepted formats,
|
||||
// max sizes, what a cover image should look like, and that files
|
||||
// will only be accessible according to the chosen access level.
|
||||
include APP_ROOT . '/templates/partials/form/fieldset-files.php';
|
||||
?>
|
||||
|
||||
<!-- ═══════════════════ Métadonnées complémentaires ═══════════════════ -->
|
||||
<fieldset>
|
||||
<legend>Métadonnées complémentaires</legend>
|
||||
<?php
|
||||
$oldFn = $shareOldFn;
|
||||
$withAutofocusFn = $shareWithAutofocusFn;
|
||||
$showDescription = false;
|
||||
$defaultAccessTypeId = 2;
|
||||
// TODO: Add an explanation of each access level (Libre / Interne / Interdit)
|
||||
// close to the "Visibilité / Accès" select so students understand
|
||||
// the implications before choosing. Cross-reference the licence
|
||||
// fieldset below.
|
||||
include APP_ROOT . '/templates/partials/form/fieldset-metadata.php';
|
||||
?>
|
||||
|
||||
<?php $name = 'license_id'; $label = 'Licence :'; $options = $licenseTypes; $selected = isset($formData['license_id']) ? $formData['license_id'] : ''; $placeholder = '— Inconnue —'; include APP_ROOT . '/templates/partials/form/select-field.php'; ?>
|
||||
|
||||
<?php $name = 'duration_info'; $label = 'Durée / Taille :'; $value = old($formData, 'duration_info'); $placeholder = 'Ex : 84 pages'; $hint = 'Durée (minutes) ou nombre de pages.'; include APP_ROOT . '/templates/partials/form/text-field.php'; ?>
|
||||
|
||||
<?php $name = 'lien'; $label = 'Lien (site / ressource) :'; $value = old($formData, 'lien'); $type = 'url'; $placeholder = 'https://...'; include APP_ROOT . '/templates/partials/form/text-field.php'; ?>
|
||||
|
||||
<?php
|
||||
$accessOptions = array_map(function($at) {
|
||||
return ['id' => $at['id'], 'name' => $at['name']];
|
||||
}, $enabledAccessTypes);
|
||||
$defaultAccessType = 2;
|
||||
$selectedAccessType = isset($formData['access_type_id'])
|
||||
? (int)$formData['access_type_id']
|
||||
: $defaultAccessType;
|
||||
$name = 'access_type_id';
|
||||
$label = 'Visibilité / Accès :';
|
||||
$options = $accessOptions;
|
||||
$selected = $selectedAccessType;
|
||||
$placeholder = null;
|
||||
$required = true;
|
||||
$attrs = [];
|
||||
include APP_ROOT . '/templates/partials/form/select-field.php';
|
||||
?>
|
||||
</fieldset>
|
||||
|
||||
<!-- ═══════════════════ Degrés d'ouverture ═══════════════════ -->
|
||||
<fieldset class="licence-explanation">
|
||||
<legend>Degrés d'ouverture et licences</legend>
|
||||
|
||||
<div class="licence-info">
|
||||
<h3>Je veux que mon TFE soit disponible sous les conditions suivantes :</h3>
|
||||
|
||||
<div class="licence-degree">
|
||||
<h4>🔓 Libre</h4>
|
||||
<p>Mon TFE est en libre accès à tout le monde sur la plateforme des TFE ainsi que dans la bibliothèque de l'erg. Je suis conscient·e des responsabilités et obligations légales qui viennent avec une diffusion externe – et acquiesce avoir lu la documentation prévue à cet effet par l'erg, ainsi qu'avoir discuté des enjeux d'une publication avec l'équipe pédagogique. J'accepte de partager mes droits de diffusion avec l'erg, ce uniquement dans le cadre d'une diffusion sur la plateforme xamxam.</p>
|
||||
<ul>
|
||||
<li><label><input type="checkbox" name="cc4r" value="1"> J'accepte les conditions collectives de réutilisation (CC4r) <em class="hint">(pas obligatoire)</em></label></li>
|
||||
<li><label><input type="checkbox" name="specific_license" value="1"> Je souhaite appliquer une licence spécifique à mon travail <em class="hint">(pas obligatoire)</em></label></li>
|
||||
</ul>
|
||||
<p class="licence-note"><em>Au moins une des deux cases doit être cochée pour le degré Libre.</em></p>
|
||||
</div>
|
||||
|
||||
<div class="licence-degree">
|
||||
<h4>🔒 Interne</h4>
|
||||
<p>Mon TFE et ma note d'intention ne sont accessibles que sur place en physique ainsi que sur la plateforme xamxam par la communauté erg. Une note descriptive est disponible sur le site à toustes. J'autorise une (ré-)utilisation et diffusion dans un contexte académique et didactique au sein de l'erg.</p>
|
||||
<p class="licence-note"><em>La diffusion limitée est protégée par le cadre académique/didactique, le travail pourrait donc être diffusé en interne et être cité par d'autres étudiant·es sans implications légales pour l'auteur·ice ni pour l'école.</em></p>
|
||||
<ul>
|
||||
<li><label><input type="checkbox" name="cc4r" value="1"> J'accepte les conditions collectives de réutilisation (CC4r) <em class="hint">(pas obligatoire)</em></label></li>
|
||||
<li><label><input type="checkbox" name="specific_license" value="1"> Je souhaite appliquer une licence spécifique à mon travail <em class="hint">(pas obligatoire)</em></label></li>
|
||||
</ul>
|
||||
<p class="licence-note"><em>Au moins une des deux cases doit être cochée.</em></p>
|
||||
</div>
|
||||
|
||||
<div class="licence-degree">
|
||||
<h4>🚫 Interdit</h4>
|
||||
<p>Mon TFE n'est pas disponible en physique ni sur le site. Une note descriptive est disponible sur le site.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="licence-generalites">
|
||||
<h3>Généralités</h3>
|
||||
<ul>
|
||||
<li>L'auteur·ice peut décider entre trois degrés de partage de son travail : <strong>libre</strong>, <strong>interne</strong>, <strong>interdit</strong>.</li>
|
||||
<li>L'auteur·ice peut, à tout moment, décider de <strong>restreindre</strong> le degré d'accès à son travail. Il ne peut néanmoins pas l'ouvrir davantage.</li>
|
||||
<li>Le choix effectué dans ce formulaire sera d'application <strong>une semaine après la soutenance orale</strong> de l'auteur·ice. Celui-ci peut donc décider de restreindre ce choix avant sa publication (mais pas l'ouvrir).</li>
|
||||
<li>L'erg se réserve le droit de restreindre le degré d'ouverture du TFE – ce en accord avec le règlement.</li>
|
||||
<li>Dans tous les cas, l'auteur·ice garde les droits d'auteurs, de diffusion, d'utilisation, etc. de son travail – sauf si la licence choisie restreindrait ses droits.</li>
|
||||
<li>La diffusion « xamxam » est indépendante de la diffusion à la BAIU.</li>
|
||||
</ul>
|
||||
</div>
|
||||
</fieldset>
|
||||
<!-- ═══════════════════ Degrés d'ouverture et licences ═══════════════════ -->
|
||||
<?php include APP_ROOT . '/templates/partials/form/fieldset-licence-explanation.php'; ?>
|
||||
|
||||
<!-- ═══════════════════ E-mail de confirmation ═══════════ -->
|
||||
<fieldset>
|
||||
<legend>E-mail de confirmation</legend>
|
||||
<?php $name = 'confirmation_email'; $label = 'Adresse e-mail * :'; $value = old($formData, 'confirmation_email'); $type = 'email'; $required = true; $placeholder = 'ton.email@exemple.be'; $hint = 'Nécessaire pour recevoir le récapitulatif de ta soumission.'; include APP_ROOT . '/templates/partials/form/text-field.php'; ?>
|
||||
<!-- TODO: Add a sentence explaining that the confirmation email is only
|
||||
used to send the submission recap and will not be shared publicly. -->
|
||||
<?php
|
||||
$name = 'confirmation_email';
|
||||
$label = 'Adresse e-mail * :';
|
||||
$value = old($formData, 'confirmation_email');
|
||||
$type = 'email';
|
||||
$required = true;
|
||||
$placeholder = 'ton.email@exemple.be';
|
||||
$hint = 'Nécessaire pour recevoir le récapitulatif de ta soumission.';
|
||||
include APP_ROOT . '/templates/partials/form/text-field.php';
|
||||
?>
|
||||
</fieldset>
|
||||
|
||||
<div class="form-footer">
|
||||
|
||||
Reference in New Issue
Block a user