forked from FWS/FWS-TEMPLATE-Website-OnePage
- La liste des paquets n'affiche plus les captures d'écran : elles restent sur la page « Voir en grand ». - En liste, seules les 3 dernières versions de l'historique sont visibles ; un bouton « Voir plus » déplie les précédentes (la page détail garde l'historique complet). - Un clic sur une capture de la page détail ouvre une visionneuse plein écran (fermeture par croix, clic hors image ou Échap) avec la légende.
112 lines
4.9 KiB
PHP
112 lines
4.9 KiB
PHP
<?php
|
|
/**
|
|
* FWS Linux — page détail « /?p/paquets/N/ » (rendu serveur).
|
|
* Le paquet N en grand : badge, tagline, description, dernière release,
|
|
* historique, captures, liens. Pas de navigation précédent/suivant.
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
if (!defined('FWS_PAGE_SHELL')) {
|
|
/* Accès direct : /p/paquets/detail.php n'est pas une URL publique. */
|
|
http_response_code(404);
|
|
exit('Page introuvable.');
|
|
}
|
|
|
|
/* Le paquet N est identifié par son id en base ; repli sur la position. */
|
|
$pkg = null;
|
|
foreach ($packages as $i => $p) {
|
|
if ((int) ($p['dbId'] ?? 0) === $detailId || ($p['dbId'] ?? 0) === 0 && ($i + 1) === $detailId) {
|
|
$pkg = $p;
|
|
break;
|
|
}
|
|
}
|
|
|
|
if ($pkg === null) {
|
|
http_response_code(404);
|
|
$title = 'Paquet introuvable | FWS Linux';
|
|
echo '<section class="paquet-detail-page">'
|
|
. '<p class="paquet-empty">Ce paquet n\'existe pas (il y en a ' . count($packages) . ').</p>'
|
|
. '<a class="paquet-detail-back" href="/?p/paquets/">← Tous les paquets</a>'
|
|
. '</section>';
|
|
return;
|
|
}
|
|
|
|
$title = $pkg['name'] . ' | FWS Linux';
|
|
$description = (string) ($pkg['tagline'] ?? '') !== '' ? (string) $pkg['tagline'] : (string) ($pkg['description'] ?? '');
|
|
$extraJs[] = '/p/assets/js/packages-ui.js';
|
|
|
|
$latest = $pkg['latest'] ?? null;
|
|
?>
|
|
<section class="paquet-detail-page">
|
|
<a class="paquet-detail-back" href="/?p/paquets/">← Tous les paquets</a>
|
|
|
|
<div class="paquet-detail-hero">
|
|
<span class="paquet-since" title="<?= !empty($pkg['since']) ? e('Depuis le ' . fws_format_date((string) $pkg['since'])) : '' ?>"><?= e($pkg['sinceLabel'] !== '' ? $pkg['sinceLabel'] : 'FWS') ?></span>
|
|
<h1><?= e($pkg['name']) ?></h1>
|
|
<?php if (!empty($pkg['tagline'])): ?><p class="paquet-tagline"><?= e($pkg['tagline']) ?></p><?php endif; ?>
|
|
<?php if (!empty($pkg['description'])): ?><p class="paquet-description"><?= e($pkg['description']) ?></p><?php endif; ?>
|
|
<div class="paquet-detail-latest<?php if ($latest === null || ($latest['name'] ?? '') === ''): ?> paquet-detail-latest-empty<?php endif; ?>">
|
|
<?php if ($latest !== null && ($latest['name'] ?? '') !== ''): ?>
|
|
<span class="paquet-detail-version"><?= e((string) $latest['name']) ?></span>
|
|
<?php if (!empty($latest['date'])): ?>
|
|
<span class="paquet-detail-date">Publiée le <?= e(fws_format_date((string) $latest['date'])) ?></span>
|
|
<?php endif; ?>
|
|
<?php else: ?>
|
|
Aucune release publiée pour le moment.
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="paquet-detail-body">
|
|
<?php if (empty($pkg['changelog'])): ?>
|
|
<div class="paquet-changelog"><h3>Historique</h3><p class="paquet-empty">Historique en cours de rédaction.</p></div>
|
|
<?php else: ?>
|
|
<div class="paquet-changelog"><h3>Historique</h3>
|
|
<ol class="paquet-timeline">
|
|
<?php foreach ($pkg['changelog'] as $entry): ?>
|
|
<li class="paquet-timeline-item">
|
|
<strong class="paquet-timeline-version"><?= e((string) ($entry['version'] ?? '—')) ?></strong>
|
|
<time class="paquet-timeline-date"<?= !empty($entry['date']) ? ' datetime="' . e((string) $entry['date']) . '"' : '' ?>><?= e(fws_format_date(isset($entry['date']) ? (string) $entry['date'] : null)) ?></time>
|
|
<?php if (!empty($entry['notes'])): ?>
|
|
<span class="paquet-timeline-notes"><?= e((string) $entry['notes']) ?></span>
|
|
<?php endif; ?>
|
|
</li>
|
|
<?php endforeach; ?>
|
|
</ol>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<?php if (empty($pkg['screens'])): ?>
|
|
<div class="paquet-screens"><h3>Captures d'écran</h3><p class="paquet-empty">Captures d'écran à venir.</p></div>
|
|
<?php else: ?>
|
|
<div class="paquet-screens"><h3>Captures d'écran</h3>
|
|
<div class="paquet-screens-grid">
|
|
<?php foreach ($pkg['screens'] as $screen): ?>
|
|
<figure>
|
|
<img src="<?= e((string) ($screen['src'] ?? '')) ?>" alt="<?= e((string) ($screen['alt'] ?? $pkg['name'])) ?>" loading="lazy" data-zoom<?php if (!empty($screen['caption'])): ?> data-caption="<?= e((string) $screen['caption']) ?>"<?php endif; ?>>
|
|
<?php if (!empty($screen['caption'])): ?>
|
|
<figcaption><?= e((string) $screen['caption']) ?> <span class="paquet-zoom-hint">— cliquez pour agrandir</span></figcaption>
|
|
<?php else: ?>
|
|
<figcaption><span class="paquet-zoom-hint">Cliquez pour agrandir</span></figcaption>
|
|
<?php endif; ?>
|
|
</figure>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
|
|
<div class="paquet-links">
|
|
<h3>Liens utiles</h3>
|
|
<?php if (empty($pkg['links'])): ?>
|
|
<p class="paquet-empty">Aucun lien pour le moment.</p>
|
|
<?php else: ?>
|
|
<?php foreach ($pkg['links'] as $link): ?>
|
|
<?php $url = (string) ($link['url'] ?? ''); $external = (bool) preg_match('/^https?:\/\//i', $url); ?>
|
|
<a class="button button-secondary" href="<?= e($url) ?>"<?= $external ? ' target="_blank" rel="noopener noreferrer"' : '' ?>><?= e((string) ($link['label'] ?? '') !== '' ? (string) $link['label'] : $url) ?></a>
|
|
<?php endforeach; ?>
|
|
<?php endif; ?>
|
|
</div>
|
|
</section>
|