mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-05-07 03:29:19 +02:00
All admin pages refactored to thin controllers + pure view templates, mirroring the public-page pattern: Controllers (public/admin/*.php): auth, data loading, include template Views (templates/admin/*.php): pure HTML/PHP output Fragment partials (templates/admin/partials/): toast, system-log-panel, system-nginx-config-panel Pages migrated: login, tags, contenus, contenus-edit, account, acces-etudiante, thanks, add, edit, parametres, system, index Fragment endpoints refactored: system-fragment.php, toast-fragment.php Skipped (pure redirects): logout, logs, status, import
55 lines
2.3 KiB
PHP
55 lines
2.3 KiB
PHP
<div class="log-toolbar">
|
|
<form id="lines-form" hx-get="/admin/system-fragment.php"
|
|
hx-target="#sys-tab-panel"
|
|
hx-swap="innerHTML"
|
|
hx-indicator="#sys-tab-panel"
|
|
hx-trigger="change"
|
|
hx-vals='{"tab":"<?= htmlspecialchars($activeTab) ?>"}'>
|
|
<label for="lines-select">Afficher</label>
|
|
<select id="lines-select" name="n" aria-label="Nombre de lignes">
|
|
<?php foreach (SystemController::ALLOWED_LINES as $opt): ?>
|
|
<option value="<?= $opt ?>" <?= $opt === $selectedN ? 'selected' : '' ?>><?= $opt ?> dernières lignes</option>
|
|
<?php endforeach; ?>
|
|
</select>
|
|
</form>
|
|
<?php if ($logLines !== null && count($logLines) > 0): ?>
|
|
<span class="log-count-badge"><?= count($logLines) ?> ligne(s)</span>
|
|
<?php endif; ?>
|
|
</div>
|
|
|
|
<?php if ($logFileMeta): ?>
|
|
<div class="log-meta">
|
|
<span data-label="Fichier"><?= htmlspecialchars(SystemController::LOG_FILES[$activeTab]['path']) ?></span>
|
|
<span data-label="Taille"><?= $logFileMeta['size'] ?></span>
|
|
<span data-label="Modifié"><?= $logFileMeta['mtime'] ?></span>
|
|
</div>
|
|
<?php endif; ?>
|
|
|
|
<?php if ($logError !== null): ?>
|
|
<div class="log-unavailable">
|
|
<strong>Journaux non disponibles</strong>
|
|
<div class="log-unavail-path"><?= $logError ?></div>
|
|
<?php if (php_sapi_name() === 'cli-server'): ?>
|
|
<div class="log-unavail-dev">
|
|
En environnement de développement, les logs nginx ne sont pas disponibles.
|
|
Cette page est pleinement fonctionnelle sur le serveur de production.
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
|
|
<?php elseif (empty($logLines)): ?>
|
|
<div class="log-empty">Le fichier journal est vide.</div>
|
|
|
|
<?php else: ?>
|
|
<div class="log-output" id="log-output" role="log" aria-live="off" aria-label="Contenu du journal">
|
|
<button class="log-copy-btn" id="log-copy-btn" type="button" title="Copier le contenu"
|
|
onclick="copyLogContent(this);return false">
|
|
Copier
|
|
</button>
|
|
<?php foreach ($logLines as $i => $line): ?>
|
|
<span class="log-line <?= SystemController::logLineClass($line) ?>"
|
|
data-n="<?= count($logLines) - $i ?>"><?= htmlspecialchars($line, ENT_QUOTES | ENT_SUBSTITUTE) ?></span>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
<?php endif; ?>
|