OpenNIT

Quelltext des aktuellen Standes

Fassung 1.1.1

status_public.php

4 KB
<?php
$logo    = !empty($app_logo) ? $app_logo : '/assets/img/logo-default.png';
$isEmbed = !empty($embed);
$brand   = $brand ?? [];
$accent  = $brand['accent'] ?? '';
// Startseiten-Modus: Logo/Suche stehen im Hero des Inhalts – Kopfzeile entfällt.
$isStart = !$isEmbed && !empty($start_mode);
?>
<!DOCTYPE html>
<html lang="<?= $this->e($this->lang()) ?>">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="robots" content="noindex, nofollow">
    <title><?= $this->te($page_title ?? 'Systemstatus') ?><?= !empty($app_name) ? ' – ' . $this->e($app_name) : '' ?></title>
    <link rel="icon" href="<?= !empty($app_favicon) ? $this->e($app_favicon) : '/assets/img/favicon-default.png' ?>">
    <!-- Design-Tokens vor status.css: status.css referenziert globale var(--…)-Tokens
         (Farben/Grauskala) und ist als eigenständige Seite sonst ohne tokens.css unstyled. -->
    <link rel="stylesheet" href="/assets/css/tokens.css?v=<?= filemtime(dirname(__DIR__, 2) . '/public/assets/css/tokens.css') ?>">
    <?php $_material = ($design_style ?? 'standard') === 'material'; ?>
    <?php if ($_material): ?><link rel="stylesheet" href="/assets/css/theme-material.css?v=<?= filemtime(dirname(__DIR__, 2) . '/public/assets/css/theme-material.css') ?>"><?php endif; ?>
    <link rel="stylesheet" href="/assets/css/status.css?v=<?= filemtime(dirname(__DIR__, 2) . '/public/assets/css/status.css') ?>">
</head>
<body class="sp-body<?= $isEmbed ? ' sp-body--embed' : '' ?><?= $isStart ? ' sp-body--start' : '' ?><?= $_material ? ' design-material' : '' ?>"<?= $accent !== '' ? ' style="--sp-accent:' . $this->e($accent) . '"' : '' ?>>
    <?php if (!$isEmbed && !$isStart): ?>
    <header class="sp-topbar">
        <img src="<?= $this->e($logo) ?>" alt="<?= $this->e($app_name ?? 'OpenNIT') ?>" class="sp-logo">
        <div class="sp-topbar-text">
            <span class="sp-topbar-title"><?= $this->te('Systemstatus') ?></span>
            <?php if (!empty($brand['subtitle'])): ?><span class="sp-topbar-sub"><?= $this->e($brand['subtitle']) ?></span><?php endif; ?>
        </div>
        <?php if (!empty($brand['support_url']) && !empty($brand['support_label'])): ?>
            <a class="sp-support" href="<?= $this->e($brand['support_url']) ?>" target="_blank" rel="noopener"><?= $this->e($brand['support_label']) ?></a>
        <?php endif; ?>
    </header>
    <?php endif; ?>

    <main class="sp-container<?= $isEmbed ? ' sp-container--embed' : '' ?>">
        <?= $content ?>
    </main>

    <?php if (!$isEmbed): ?>
    <footer class="sp-footer">
        Bereitgestellt mit <?= $this->e($app_name ?? 'OpenNIT') ?>
        <?php include __DIR__ . '/_agpl_notice.php'; ?>
    </footer>
    <?php endif; ?>

    <?php if ($isEmbed): ?>
    <script>
    // Teilt der einbettenden Seite die tatsächliche Inhaltshöhe mit, damit das
    // iframe ohne inneres Scrollen so hoch wie nötig gemacht werden kann.
    (function () {
        function postHeight() {
            var h = Math.max(
                document.documentElement.scrollHeight,
                document.body ? document.body.scrollHeight : 0
            );
            try { parent.postMessage({ type: 'opennit-status-height', height: h }, '*'); } catch (e) {}
        }
        window.addEventListener('load', postHeight);
        document.addEventListener('DOMContentLoaded', postHeight);
        window.addEventListener('resize', postHeight);
        if (window.ResizeObserver) {
            try { new ResizeObserver(postHeight).observe(document.documentElement); } catch (e) {}
        } else {
            setInterval(postHeight, 1000);
        }
        postHeight();
    })();
    </script>
    <?php endif; ?>
</body>
</html>