feat: refactor licence fragment — Libre→CC2r+licence, Interne→opt-in want_license, Interdit→none, add details/summary to license UI

This commit is contained in:
Pontoporeia
2026-05-11 14:19:44 +02:00
parent 927ee2fe2a
commit 8bf95f4e14
10 changed files with 809 additions and 109 deletions

View File

@@ -35,8 +35,9 @@
<p><a href="/admin/add.php" class="btn btn--secondary">Retour au formulaire</a></p>
<?php elseif ($thesis): ?>
<!-- ═══════════ Identité ═══════════ -->
<section>
<h2>Informations de base</h2>
<h2>Identité</h2>
<dl>
<dt>Identifiant</dt><dd><?= htmlspecialchars($thesis['identifier']) ?></dd>
<dt>Titre</dt><dd><?= htmlspecialchars($thesis['title']) ?></dd>
@@ -44,101 +45,221 @@
<dt>Sous-titre</dt><dd><?= htmlspecialchars($thesis['subtitle']) ?></dd>
<?php endif; ?>
<dt>Auteur·ice(s)</dt><dd><?= htmlspecialchars($thesis['authors']) ?></dd>
<dt>Année</dt><dd><?= htmlspecialchars($thesis['year']) ?></dd>
<?php if (!empty($thesis['contact_interne'])): ?>
<dt>Contact (interne)</dt><dd><?= htmlspecialchars($thesis['contact_interne']) ?></dd>
<?php endif; ?>
<dt>Contact public</dt><dd><?= !empty($thesis['contact_public']) ? 'Oui' : 'Non' ?></dd>
<dt>Année</dt><dd><?= htmlspecialchars((string)$thesis['year']) ?></dd>
<dt>Objet</dt><dd><?= htmlspecialchars($thesis['objet'] ?? 'tfe') ?></dd>
<?php if ($thesis['is_doctoral']): ?>
<dt>Doctoral</dt><dd>Oui</dd>
<?php endif; ?>
</dl>
</section>
<!-- ═══════════ Cadre académique ═══════════ -->
<section>
<h2>Détails académiques</h2>
<h2>Cadre académique</h2>
<dl>
<dt>Orientation</dt><dd><?= htmlspecialchars($thesis['orientation'] ?? '') ?></dd>
<dt>Atelier pratique</dt><dd><?= htmlspecialchars($thesis['ap_program'] ?? '') ?></dd>
<dt>Atelier Pratique</dt><dd><?= htmlspecialchars($thesis['ap_program'] ?? '') ?></dd>
<dt>Finalité</dt><dd><?= htmlspecialchars($thesis['finality_type'] ?? '') ?></dd>
<?php if ($thesis['supervisors']): ?>
<dt>Promoteur·ice(s)</dt><dd><?= htmlspecialchars($thesis['supervisors']) ?></dd>
<?php endif; ?>
<?php if (!empty($thesis['jury_promoteurs_ulb'])): ?>
<dt>Promoteur·ice(s) ULB</dt><dd><?= htmlspecialchars($thesis['jury_promoteurs_ulb']) ?></dd>
<?php endif; ?>
<?php if (!empty($thesis['jury_lecteurs_internes'])): ?>
<dt>Lecteur·ices (interne)</dt><dd><?= htmlspecialchars($thesis['jury_lecteurs_internes']) ?></dd>
<?php endif; ?>
<?php if (!empty($thesis['jury_lecteurs_externes'])): ?>
<dt>Lecteur·ices (externe)</dt><dd><?= htmlspecialchars($thesis['jury_lecteurs_externes']) ?></dd>
<?php endif; ?>
</dl>
</section>
<!-- ═══════════ Jury ═══════════ -->
<?php
$hasJury = $thesis['jury_president']
|| $thesis['jury_promoteurs']
|| $thesis['jury_promoteurs_ulb']
|| $thesis['jury_lecteurs_internes']
|| $thesis['jury_lecteurs_externes']
|| $thesis['supervisors'];
?>
<?php if ($hasJury): ?>
<section>
<h2>Jury</h2>
<dl>
<?php if ($thesis['jury_president']): ?>
<dt>Président·e</dt><dd><?= htmlspecialchars($thesis['jury_president']) ?></dd>
<?php endif; ?>
<?php if ($thesis['jury_promoteurs']): ?>
<dt>Promoteur·ice(s)</dt><dd><?= htmlspecialchars($thesis['jury_promoteurs']) ?></dd>
<?php endif; ?>
<?php if ($thesis['jury_promoteurs_ulb']): ?>
<dt>Promoteur·ice(s) ULB</dt><dd><?= htmlspecialchars($thesis['jury_promoteurs_ulb']) ?></dd>
<?php endif; ?>
<?php if ($thesis['jury_lecteurs_internes']): ?>
<dt>Lecteur·ice(s) interne</dt><dd><?= htmlspecialchars($thesis['jury_lecteurs_internes']) ?></dd>
<?php endif; ?>
<?php if ($thesis['jury_lecteurs_externes']): ?>
<dt>Lecteur·ice(s) externe</dt><dd><?= htmlspecialchars($thesis['jury_lecteurs_externes']) ?></dd>
<?php endif; ?>
<?php if ($thesis['supervisors'] && !$thesis['jury_promoteurs']): ?>
<dt>Promoteur·ice(s)</dt><dd><?= htmlspecialchars($thesis['supervisors']) ?></dd>
<?php endif; ?>
<?php if ($thesis['jury_points'] !== null): ?>
<dt>Note du jury</dt><dd><?= htmlspecialchars($thesis['jury_points']) ?>/20</dd>
<?php endif; ?>
</dl>
</section>
<?php endif; ?>
<!-- ═══════════ Contenu ═══════════ -->
<section>
<h2>Contenu</h2>
<dl>
<dt>Synopsis</dt>
<dd class="recap-synopsis"><?= nl2br(htmlspecialchars($thesis['synopsis'] ?? '')) ?></dd>
<?php if ($thesis['context_note']): ?>
<dt>Note contextuelle</dt>
<dd class="recap-long-text"><?= nl2br(htmlspecialchars($thesis['context_note'])) ?></dd>
<?php endif; ?>
<?php if ($thesis['languages']): ?>
<dt>Langue(s)</dt><dd><?= htmlspecialchars($thesis['languages']) ?></dd>
<?php endif; ?>
<?php if ($thesis['formats']): ?>
<dt>Format(s)</dt><dd><?= htmlspecialchars($thesis['formats']) ?></dd>
<?php endif; ?>
<?php if ($thesis['keywords']): ?>
<dt>Mots-clés</dt><dd><?= htmlspecialchars($thesis['keywords']) ?></dd>
<?php endif; ?>
<?php if ($thesis['baiu_link']): ?>
<dt>Lien</dt><dd><a href="<?= htmlspecialchars($thesis['baiu_link']) ?>" target="_blank" rel="noopener"><?= htmlspecialchars($thesis['baiu_link']) ?></a></dd>
<dt>Lien BAIU</dt><dd><a href="<?= htmlspecialchars($thesis['baiu_link']) ?>" target="_blank" rel="noopener"><?= htmlspecialchars($thesis['baiu_link']) ?></a></dd>
<?php endif; ?>
</dl>
</section>
<!-- ═══════════ Accès et licence ═══════════ -->
<section>
<h2>Accès et licence</h2>
<dl>
<dt>Degré d'ouverture</dt><dd><?= htmlspecialchars($thesis['access_type'] ?? '') ?></dd>
<?php if ($thesis['license_type']): ?>
<dt>Licence</dt><dd><?= htmlspecialchars($thesis['license_type']) ?></dd>
<?php endif; ?>
<?php if ($thesis['license_custom']): ?>
<dt>Licence personnalisée</dt><dd><?= htmlspecialchars($thesis['license_custom']) ?></dd>
<?php endif; ?>
<dt>CC2r</dt><dd><?= !empty($thesis['cc2r']) ? 'Acceptée' : 'Non' ?></dd>
<dt>Exemplaire BAIU</dt><dd><?= !empty($thesis['exemplaire_baiu']) ? 'Oui' : 'Non' ?></dd>
<dt>Exemplaire ERG</dt><dd><?= !empty($thesis['exemplaire_erg']) ? 'Oui' : 'Non' ?></dd>
</dl>
</section>
<!-- ═══════════ Dates et publication ═══════════ -->
<section>
<h2>Dates et publication</h2>
<dl>
<?php if ($thesis['submitted_at']): ?>
<dt>Soumis le</dt><dd><?= date('d/m/Y à H:i', strtotime($thesis['submitted_at'])) ?></dd>
<?php endif; ?>
<?php if ($thesis['defense_date']): ?>
<dt>Date de défense</dt><dd><?= date('d/m/Y', strtotime($thesis['defense_date'])) ?></dd>
<?php endif; ?>
<?php if ($thesis['published_at']): ?>
<dt>Publié le</dt><dd><?= date('d/m/Y à H:i', strtotime($thesis['published_at'])) ?></dd>
<?php endif; ?>
<dt>Publié</dt><dd><?= !empty($thesis['is_published']) ? 'Oui' : 'Non' ?></dd>
<?php if ($thesis['jury_note_added']): ?>
<dt>Note du jury ajoutée</dt><dd><?= date('d/m/Y', strtotime($thesis['jury_note_added'])) ?></dd>
<?php endif; ?>
</dl>
</section>
<!-- ═══════════ Remarques ═══════════ -->
<?php if (!empty($thesis['remarks'])): ?>
<section>
<h2>Remarques</h2>
<p class="recap-long-text"><?= nl2br(htmlspecialchars($thesis['remarks'])) ?></p>
</section>
<?php endif; ?>
<!-- ═══════════ Fichiers ═══════════ -->
<?php if (!empty($files)): ?>
<section>
<h2>Fichiers</h2>
<ul class="recap-file-list">
<h2>Fichiers (<?= count($files) ?>)</h2>
<ul class="recap-files-list" role="list">
<?php foreach ($files as $f): ?>
<?php
$mime = $f['mime_type'] ?? '';
$isImage = str_starts_with($mime, 'image/');
$filePath = $f['file_path'] ?? '';
$fileName = htmlspecialchars($f['file_name'] ?? basename($filePath));
$fileType = htmlspecialchars($f['file_type']);
$displayLabel = $f['display_label'] ?? $f['description'] ?? '';
$isImage = str_starts_with($mime, 'image/');
$isPeerTube = str_starts_with($filePath, 'peertube_ids:');
$isExternal = str_starts_with($filePath, 'http://') || str_starts_with($filePath, 'https://');
if ($isPeerTube) {
$_ptUuid = substr($filePath, strlen('peertube_ids:'));
require_once APP_ROOT . '/src/PeerTubeService.php';
$_ptDb = new Database();
$_ptS = PeerTubeService::getSettings($_ptDb);
// Only link to watch page for public (1) and unlisted (2) videos
if ((int)$_ptS['privacy'] <= 2) {
$mediaUrl = PeerTubeService::getWatchUrl($_ptDb, $_ptUuid);
} else {
$mediaUrl = '#';
}
$_ptUuid = substr($filePath, strlen('peertube_ids:'));
$_ptS = PeerTubeService::getSettings($_ptDb);
$mediaUrl = ((int)$_ptS['privacy'] <= 2)
? PeerTubeService::getWatchUrl($_ptDb, $_ptUuid)
: '#';
} elseif ($isExternal) {
$mediaUrl = htmlspecialchars($filePath);
} else {
$mediaUrl = '/media?path=' . urlencode($filePath);
}
$fileName = htmlspecialchars($f['file_name'] ?? basename($filePath));
$fileType = htmlspecialchars($f['file_type']);
$typeIcon = match (true) {
$isPeerTube && $fileType === 'video' => '🎬',
$isPeerTube && $fileType === 'audio' => '🔊',
$fileType === 'cover' => '🖼️',
$fileType === 'note_intention' => '📝',
$fileType === 'main' || ($mime === 'application/pdf') => '📄',
$fileType === 'video' || str_starts_with($mime, 'video/') => '🎬',
$fileType === 'audio' || str_starts_with($mime, 'audio/') => '🔊',
$isImage => '🖼️',
$fileType === 'caption' => '💬',
$fileType === 'annex' => '📎',
$fileType === 'website' => '🌐',
default => '📎',
};
?>
<li class="recap-file-item">
<?php if ($isImage): ?>
<a href="<?= $mediaUrl ?>" target="_blank" rel="noopener" class="recap-file-thumb-link">
<li class="recap-files-list-item">
<figure class="recap-file-figure">
<?php if ($isImage && !$isPeerTube): ?>
<img src="<?= $mediaUrl ?>" alt="<?= $fileName ?>" class="recap-file-thumb" loading="lazy">
</a>
<?php else: ?>
<span class="recap-file-icon">
<?php
if ($isPeerTube && $f['file_type'] === 'video') echo '🎬';
elseif ($isPeerTube && $f['file_type'] === 'audio') echo '🎵';
elseif ($mime === 'application/pdf') echo '📄';
elseif (str_starts_with($mime, 'video/')) echo '🎬';
elseif (str_starts_with($mime, 'audio/')) echo '🎵';
elseif (in_array($mime, ['application/zip','application/x-zip-compressed'])) echo '🗜️';
elseif (str_ends_with($f['file_name'] ?? '', '.vtt')) echo '💬';
else echo '📎';
?>
</span>
<?php endif; ?>
<div class="recap-file-meta">
<a href="<?= $mediaUrl ?>" target="_blank" rel="noopener" class="recap-file-name"><?= $fileName ?></a>
<span class="recap-file-type-badge"><?= $fileType ?></span>
<span class="recap-file-size"><?= formatFileSize($f['file_size']) ?></span>
<span class="recap-file-date"><?= date('d/m/Y H:i', strtotime($f['uploaded_at'])) ?></span>
</div>
<?php else: ?>
<span class="recap-file-icon"><?= $typeIcon ?></span>
<?php endif; ?>
<figcaption class="recap-file-caption">
<div class="recap-file-name-row">
<?php if ($isPeerTube && $mediaUrl !== '#'): ?>
<a href="<?= $mediaUrl ?>" target="_blank" rel="noopener" class="recap-file-name"><?= $fileName ?></a>
<?php elseif ($isExternal): ?>
<a href="<?= $mediaUrl ?>" target="_blank" rel="noopener" class="recap-file-name"><?= $fileName ?></a>
<?php else: ?>
<a href="<?= $mediaUrl ?>" target="_blank" rel="noopener" class="recap-file-name"><?= $fileName ?></a>
<?php endif; ?>
</div>
<?php if ($isPeerTube): ?>
<div class="recap-file-peertube-meta">
<span class="recap-file-peertube-id">ID: <?= htmlspecialchars($_ptUuid) ?></span>
</div>
<?php endif; ?>
<?php if ($displayLabel): ?>
<div class="recap-file-label"><?= htmlspecialchars($displayLabel) ?></div>
<?php endif; ?>
<div class="recap-file-meta-row">
<span class="recap-file-meta"><?= formatFileSize($f['file_size']) ?></span>
<span class="recap-file-meta"><?= date('d/m/Y H:i', strtotime($f['uploaded_at'])) ?></span>
</div>
</figcaption>
</figure>
</li>
<?php endforeach; ?>
</ul>