mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-06-25 16:19:19 +02:00
style: normalize headers, overtype editor rounded corners, remove duplicate cover preview, thesis-add-header grid layout, subtitle below header with top gradient
This commit is contained in:
@@ -50,6 +50,7 @@ $selectedFormats = isset($_POST['formats']) && is_array($_POST['formats'])
|
||||
: [];
|
||||
|
||||
$adminMode = ($_POST['admin_mode'] ?? '0') === '1';
|
||||
$editMode = ($_POST['edit_mode'] ?? '0') === '1';
|
||||
|
||||
$hasSiteWeb = $siteWebId && in_array($siteWebId, $selectedFormats, true);
|
||||
$hasVideo = $videoId && in_array($videoId, $selectedFormats, true);
|
||||
@@ -70,6 +71,10 @@ $hxPost = $adminMode ? '/admin/fichiers-fragment.php' : '/partage/fichiers-fragm
|
||||
?>
|
||||
<div id="format-fichiers-block">
|
||||
<input type="hidden" name="admin_mode" value="<?= $adminMode ? '1' : '0' ?>">
|
||||
<input type="hidden" name="edit_mode" value="<?= $editMode ? '1' : '0' ?>">
|
||||
<?php if ($editMode && ($_POST['_cover'] ?? null)): ?>
|
||||
<input type="hidden" name="_cover" value="<?= htmlspecialchars($_POST['_cover']) ?>">
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- ═══════════════════ Format(s) ═══════════════════ -->
|
||||
<fieldset>
|
||||
@@ -81,7 +86,7 @@ $hxPost = $adminMode ? '/admin/fichiers-fragment.php' : '/partage/fichiers-fragm
|
||||
hx-post="<?= htmlspecialchars($hxPost) ?>"
|
||||
hx-target="#format-fichiers-block"
|
||||
hx-trigger="change"
|
||||
hx-include="this, [name='website_url'], [name='website_label'], [name='admin_mode']"
|
||||
hx-include="this, [name='website_url'], [name='website_label'], [name='admin_mode'], [name='edit_mode'], [name='_cover']"
|
||||
hx-swap="outerHTML">
|
||||
<legend class="sr-only">Format(s) du TFE</legend>
|
||||
<ul>
|
||||
@@ -108,13 +113,26 @@ $hxPost = $adminMode ? '/admin/fichiers-fragment.php' : '/partage/fichiers-fragm
|
||||
<!-- ── 1. Couverture (always) ── -->
|
||||
<div>
|
||||
<?php
|
||||
$_cover = $_POST['_cover'] ?? null;
|
||||
if ($editMode && $_cover): ?>
|
||||
<div class="admin-banner-preview">
|
||||
<img src="/media?path=<?= urlencode($_cover) ?>"
|
||||
alt="Couverture actuelle" style="max-height:180px;">
|
||||
<label class="admin-checkbox-label">
|
||||
<input type="checkbox" name="remove_cover" value="1"> Supprimer la couverture
|
||||
</label>
|
||||
</div>
|
||||
<?php endif;
|
||||
$name = 'couverture';
|
||||
$label = 'Image de couverture (optionnel) :';
|
||||
$accept = 'image/jpeg,image/png,image/webp';
|
||||
$hint = 'JPG, PNG ou WEBP. Format 4:3 recommandé. Max 20 MB.';
|
||||
$hint = ($editMode && $_cover)
|
||||
? 'Laisser vide pour conserver la couverture actuelle. JPG, PNG ou WEBP. Max 20 MB.'
|
||||
: 'JPG, PNG ou WEBP. Format 4:3 recommandé. Max 20 MB.';
|
||||
$required = false;
|
||||
$id = 'couverture';
|
||||
include APP_ROOT . '/templates/partials/form/file-field.php';
|
||||
unset($_cover);
|
||||
?>
|
||||
</div>
|
||||
|
||||
@@ -162,7 +180,7 @@ $hxPost = $adminMode ? '/admin/fichiers-fragment.php' : '/partage/fichiers-fragm
|
||||
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-include="[name='formats[]'], [name='website_url'], [name='website_label'], [name='admin_mode'], [name='edit_mode'], [name='_cover'], [name='has_annexes']"
|
||||
hx-swap="outerHTML">
|
||||
Ce TFE comporte des annexes
|
||||
</label>
|
||||
|
||||
@@ -42,6 +42,13 @@ if ($slug === 'fichiers-fragment' && $_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
exit;
|
||||
}
|
||||
|
||||
// Special route: /partage/licence-fragment (HTMX fragment — licence section with conditional required)
|
||||
if ($slug === 'licence-fragment' && $_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
App::boot();
|
||||
require_once __DIR__ . '/licence-fragment.php';
|
||||
exit;
|
||||
}
|
||||
|
||||
// Special route: /partage/recapitulatif?id=N
|
||||
if ($slug === 'recapitulatif' || $slug === 'recapitulatif.php') {
|
||||
App::boot();
|
||||
@@ -267,7 +274,7 @@ function renderShareLinkForm(string $slug, array $link): void
|
||||
|
||||
// Load all form help blocks in one query.
|
||||
$helpBlocks = Database::getInstance()->getAllFormHelpBlocks();
|
||||
$helpFn = fn(string $key) => $helpBlocks[$key]['content'] ?? '';
|
||||
$helpFn = fn(string $key) => empty($helpBlocks[$key]['enabled']) ? '' : ($helpBlocks[$key]['content'] ?? '');
|
||||
|
||||
// ── Shared form variables ──────────────────────────────────────────────
|
||||
$mode = 'partage';
|
||||
@@ -356,6 +363,7 @@ function renderShareLinkForm(string $slug, array $link): void
|
||||
<?php if ($isVerified): ?>
|
||||
<span class="share-badge">🔓 Accès partagé</span>
|
||||
<?php endif; ?>
|
||||
<p class="thesis-add-subtitle">Formulaire pour <a href="/">XAMXAM</a></p>
|
||||
</div>
|
||||
|
||||
<?php include APP_ROOT . '/templates/partials/form/form.php'; ?>
|
||||
|
||||
47
app/public/partage/licence-fragment.php
Normal file
47
app/public/partage/licence-fragment.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
* HTMX fragment: renders the licence section with conditional required states.
|
||||
*
|
||||
* POST: access_type_id, license_id, license_custom, cc2r, admin_mode
|
||||
*
|
||||
* When access_type_id=1 (Libre): licence fields are required.
|
||||
* When access_type_id=2|3 (Interne/Interdit): licence fields are optional.
|
||||
*/
|
||||
require_once __DIR__ . '/../../bootstrap.php';
|
||||
|
||||
$accessTypeId = $_POST['access_type_id'] ?? '2';
|
||||
$licenseId = $_POST['license_id'] ?? '';
|
||||
$licenseCustom = $_POST['license_custom'] ?? '';
|
||||
$cc2r = !empty($_POST['cc2r']);
|
||||
$adminMode = ($_POST['admin_mode'] ?? '0') === '1';
|
||||
|
||||
$required = !$adminMode && $accessTypeId === '1';
|
||||
|
||||
require_once APP_ROOT . '/src/Database.php';
|
||||
$db = Database::getInstance();
|
||||
$licenseTypes = $db->getAllLicenseTypes();
|
||||
?>
|
||||
|
||||
<div class="licence-license-choice">
|
||||
<?php
|
||||
$name = 'license_id'; $label = 'Licence :'; $options = $licenseTypes;
|
||||
$selected = $licenseId; $placeholder = '— Sélectionner —';
|
||||
include APP_ROOT . '/templates/partials/form/select-field.php';
|
||||
?>
|
||||
|
||||
<?php
|
||||
$name = 'license_custom'; $label = 'Ou précisez une autre licence :';
|
||||
$value = htmlspecialchars($licenseCustom);
|
||||
$hint = 'Ex: CC BY-NC 4.0, Tous droits réservés...';
|
||||
include APP_ROOT . '/templates/partials/form/text-field.php';
|
||||
?>
|
||||
|
||||
<div class="admin-form-group">
|
||||
<label class="admin-checkbox-label">
|
||||
<input type="checkbox" name="cc2r" value="1"
|
||||
<?= $cc2r ? 'checked' : '' ?>>
|
||||
J'accepte les Conditions Collectives de Réutilisation (CC2r)
|
||||
</label>
|
||||
<small><a href="https://cc2r.net/" target="_blank" rel="noopener">En savoir plus sur la CC2r ↗</a></small>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user