mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-06-25 08:09:18 +02:00
Unify the three public pages (à propos, charte, licence) onto a single grid layout (.page-content) with sticky TOC sidebar, replacing the old separate / / markup. - Merge about.php, charte.php, licence.php templates into shared .page-content / .content-section structure - Add CommonMark HeadingPermalinkExtension for stable heading anchors - Use SlugNormalizer for TOC links so they match rendered heading IDs - Standardize link styling across content blocks: bold black, accent on hover (consistent with global link style) - Fix code block wrapping: use pre-wrap instead of pre, constrain grid columns with min-width:0, auto scrollbar - Fix apropos page grid placement: force content-section into column 2 so contacts and credits stay in the content area, not the sidebar Also includes accumulated WIP changes: - Header gradient: hardcoded purple-to-green (replaces CSS variables) - Search placeholder font - Duration field: replace minutes/sec/heures with h:m:s time inputs - TFE file optional for formats 1,4,6 with client-side JS toggle - Licence form: em-dash to hyphen, details/summary classes - Pill search: block Enter key form submission when no results - Draft autosave: remove CSRF rotation (broke concurrent FilePond uploads) - Language pill: clear hints for excluded main languages - Search results: gradient placeholder cards for items without covers - TFE display: format durée values as XhYm instead of decimal
139 lines
8.1 KiB
PHP
139 lines
8.1 KiB
PHP
<?php
|
||
/**
|
||
* Shared partial - "Degrés d'ouverture et licences" fieldset.
|
||
*
|
||
* Renders:
|
||
* 1. Généralités (editable via form help blocks)
|
||
* 2. Radio choice: Libre / Interne / Interdit (filtered by enabled flags)
|
||
* 3. Licence dropdown + custom licence text input
|
||
* 4. CC2r checkbox
|
||
*
|
||
* Variables consumed:
|
||
* array $formData - raw form data for repopulation
|
||
* array $licenseTypes - [{id, name}]
|
||
* bool $libreEnabled - show Libre option (always true for admin)
|
||
* bool $interneEnabled - show Interne option
|
||
* bool $interditEnabled - show Interdit option
|
||
* string $generalitiesHtml - HTML content for Généralités section (editable)
|
||
* int $defaultAccessTypeId - default selected access type (default: 2)
|
||
*/
|
||
|
||
$formData = $formData ?? [];
|
||
$licenseTypes = $licenseTypes ?? [];
|
||
$libreEnabled = $libreEnabled ?? true;
|
||
$interneEnabled = $interneEnabled ?? true;
|
||
$interditEnabled = $interditEnabled ?? true;
|
||
$generalitiesHtml = $generalitiesHtml ?? '';
|
||
$defaultAccessTypeId = $defaultAccessTypeId ?? 2;
|
||
$adminMode = $adminMode ?? false;
|
||
?>
|
||
<fieldset class="licence-explanation">
|
||
<legend>Degrés d'ouverture et licences</legend>
|
||
|
||
<!-- Degré d'ouverture -->
|
||
<div class="licence-choice">
|
||
<p class="licence-prompt">J'autorise l'erg à archiver mon TFE de la manière suivante :</p>
|
||
<?php
|
||
// access_type_id may be null (meaning "not set"). Keep null to select "-" radio.
|
||
$selectedAccess = array_key_exists('access_type_id', $formData) ? $formData['access_type_id'] : $defaultAccessTypeId;
|
||
?>
|
||
|
||
<?php if ($adminMode): ?>
|
||
<div class="licence-degree">
|
||
<label class="admin-checkbox-label">
|
||
<input type="radio" name="access_type_id" value=""
|
||
hx-post="/admin/fragments/licence.php"
|
||
hx-target=".licence-license-choice"
|
||
hx-swap="outerHTML"
|
||
hx-include="closest fieldset"
|
||
<?= $selectedAccess === '' || $selectedAccess === null ? 'checked' : '' ?>>
|
||
<strong>-</strong> Non défini
|
||
</label>
|
||
</div>
|
||
<?php endif; ?>
|
||
|
||
<?php if ($libreEnabled): ?>
|
||
<div class="licence-degree">
|
||
<label class="admin-checkbox-label">
|
||
<input type="radio" name="access_type_id" value="1"
|
||
hx-post="<?= $adminMode ? '/admin/fragments/licence.php' : '/partage/fragments/licence.php' ?>"
|
||
hx-target=".licence-license-choice"
|
||
hx-swap="outerHTML"
|
||
hx-include="closest fieldset"
|
||
<?= (string)$selectedAccess === '1' ? 'checked' : '' ?> <?= $adminMode ? '' : 'required' ?>>
|
||
<strong>🔓 Libre</strong>
|
||
<br>
|
||
</label>
|
||
<details class="licence-details">
|
||
<summary class="licence-summary"> <svg xmlns="http://www.w3.org/2000/svg" width="1rem" viewBox="0 0 256 256"><path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z"></path></svg> Info</summary>
|
||
<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 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>
|
||
</details>
|
||
</div>
|
||
<?php endif; ?>
|
||
|
||
<?php if ($interneEnabled): ?>
|
||
<div class="licence-degree">
|
||
<label class="admin-checkbox-label">
|
||
<input type="radio" name="access_type_id" value="2"
|
||
hx-post="<?= $adminMode ? '/admin/fragments/licence.php' : '/partage/fragments/licence.php' ?>"
|
||
hx-target=".licence-license-choice"
|
||
hx-swap="outerHTML"
|
||
hx-include="closest fieldset"
|
||
<?= (string)$selectedAccess === '2' ? 'checked' : '' ?> <?= $adminMode ? '' : 'required' ?>>
|
||
<strong>🔒 Interne</strong>
|
||
</label>
|
||
<br>
|
||
<details class="licence-details">
|
||
<summary class="licence-summary"> <svg xmlns="http://www.w3.org/2000/svg" width="1rem" viewBox="0 0 256 256"><path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z"></path></svg> Info</summary>
|
||
<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>
|
||
</details>
|
||
|
||
</div>
|
||
<?php endif; ?>
|
||
|
||
<?php if ($interditEnabled): ?>
|
||
<div class="licence-degree">
|
||
<label class="admin-checkbox-label">
|
||
<input type="radio" name="access_type_id" value="3"
|
||
hx-post="<?= $adminMode ? '/admin/fragments/licence.php' : '/partage/fragments/licence.php' ?>"
|
||
hx-target=".licence-license-choice"
|
||
hx-swap="outerHTML"
|
||
hx-include="closest fieldset"
|
||
<?= (string)$selectedAccess === '3' ? 'checked' : '' ?> <?= $adminMode ? '' : 'required' ?>>
|
||
<strong>🚫 Interdit</strong>
|
||
|
||
</label>
|
||
<br>
|
||
<details class="licence-details">
|
||
<summary class="licence-summary"> <svg xmlns="http://www.w3.org/2000/svg" width="1rem" viewBox="0 0 256 256"><path d="M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Zm16-40a8,8,0,0,1-8,8,16,16,0,0,1-16-16V128a8,8,0,0,1,0-16,16,16,0,0,1,16,16v40A8,8,0,0,1,144,176ZM112,84a12,12,0,1,1,12,12A12,12,0,0,1,112,84Z"></path></svg> Info</summary>
|
||
<p>
|
||
Mon TFE n'est pas disponible en physique ni sur le site. Une note descriptive est disponible sur le site.
|
||
</p>
|
||
</details>
|
||
</div>
|
||
<?php endif; ?>
|
||
<p class="licence-note"><em>L'auteur·ice peut, à tout moment, décider de restreindre son propre choix. Iel ne peut par contre pas l'ouvrir.</em></p>
|
||
</div>
|
||
|
||
<!-- Seed saved licence values for the initial htmx load.
|
||
These are overridden by visible inputs inside .licence-license-choice
|
||
once htmx renders them - later DOM order wins in POST. -->
|
||
<input type="hidden" name="license_id" value="<?= htmlspecialchars((string)($formData['license_id'] ?? '')) ?>">
|
||
<input type="hidden" name="license_custom" value="<?= htmlspecialchars($formData['license_custom'] ?? '') ?>">
|
||
<input type="hidden" name="cc2r" value="<?= !empty($formData['cc2r']) ? '1' : '' ?>">
|
||
<?php $wantLicense = !empty($formData['license_id']) || !empty($formData['license_custom']); ?>
|
||
<input type="hidden" name="want_license" value="<?= $wantLicense ? '1' : '' ?>">
|
||
|
||
<!-- Licence - swapped via htmx when radio changes -->
|
||
<div class="licence-license-choice"
|
||
hx-post="<?= $adminMode ? '/admin/fragments/licence.php' : '/partage/fragments/licence.php' ?>"
|
||
hx-trigger="load"
|
||
hx-include="closest fieldset"
|
||
hx-swap="outerHTML">
|
||
</div>
|
||
</fieldset>
|