aasdsd
This commit is contained in:
@@ -2,6 +2,34 @@
|
||||
$modules = modules()->all();
|
||||
$error = null;
|
||||
$notice = null;
|
||||
$GLOBALS['layout_header_title'] = 'Aktive Module verwalten';
|
||||
$GLOBALS['layout_header_text'] = '';
|
||||
$GLOBALS['layout_header_actions'] = [
|
||||
['href' => '/modules/install', 'label' => 'Module installieren/aktivieren'],
|
||||
['href' => '/modules/sql-import', 'label' => 'Zentralen SQL-Import öffnen'],
|
||||
];
|
||||
$knownAuthUsers = modules()->knownAuthUsers();
|
||||
$authUserLabels = [];
|
||||
foreach ($knownAuthUsers as $knownAuthUser) {
|
||||
if (!is_array($knownAuthUser)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$label = trim((string) ($knownAuthUser['name'] ?? ''));
|
||||
if ($label === '') {
|
||||
$label = trim((string) ($knownAuthUser['username'] ?? ''));
|
||||
}
|
||||
if ($label === '') {
|
||||
$label = trim((string) ($knownAuthUser['email'] ?? ''));
|
||||
}
|
||||
|
||||
foreach (['sub', 'username', 'email'] as $key) {
|
||||
$value = trim((string) ($knownAuthUser[$key] ?? ''));
|
||||
if ($value !== '' && $label !== '') {
|
||||
$authUserLabels[$value] = $label;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
require_admin();
|
||||
@@ -24,13 +52,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
?>
|
||||
<div class="card">
|
||||
<?php require_auth(); ?>
|
||||
<div class="pill">Module</div>
|
||||
<h1 style="margin-top:.75rem;">Module verwalten</h1>
|
||||
<p class="muted">Hier siehst du nur aktive Module. Installierte Module kannst du unten verwalten.</p>
|
||||
<p style="margin-top:.75rem;">
|
||||
<a class="nav-link" href="/modules/sql-import">Zentralen SQL-Import öffnen</a>
|
||||
</p>
|
||||
|
||||
<?php if ($error): ?>
|
||||
<div class="bg-red-900 border-l-4 border-red-500 text-red-100 p-4 mb-6" role="alert">
|
||||
<?= e($error) ?>
|
||||
@@ -56,7 +77,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$accessParts[] = 'Gruppen: ' . implode(', ', $authGroups);
|
||||
}
|
||||
if ($authUsers !== []) {
|
||||
$accessParts[] = 'Nutzer: ' . implode(', ', $authUsers);
|
||||
$userLabels = array_map(
|
||||
static fn (string $user): string => $authUserLabels[$user] ?? $user,
|
||||
$authUsers
|
||||
);
|
||||
$accessParts[] = 'Nutzer: ' . implode(', ', $userLabels);
|
||||
}
|
||||
$accessLabel = implode(' · ', $accessParts);
|
||||
$accessClass = ' module-admin-badge--success';
|
||||
@@ -118,8 +143,4 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
</article>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
|
||||
<div style="margin-top:1.5rem;">
|
||||
<a class="nav-link" href="/modules/install">Module installieren/aktivieren</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -11,6 +11,15 @@ $headerTitle = $currentModule
|
||||
? (string)($currentModule['title'] ?? $currentModuleName)
|
||||
: ('Nexus' . ($isStagingHost ? ' (staging)' : ''));
|
||||
$headerText = $currentModule ? (string)($currentModule['description'] ?? '') : '';
|
||||
$headerTitle = isset($GLOBALS['layout_header_title']) && is_string($GLOBALS['layout_header_title']) && trim($GLOBALS['layout_header_title']) !== ''
|
||||
? trim($GLOBALS['layout_header_title'])
|
||||
: $headerTitle;
|
||||
$headerText = isset($GLOBALS['layout_header_text']) && is_string($GLOBALS['layout_header_text'])
|
||||
? trim($GLOBALS['layout_header_text'])
|
||||
: $headerText;
|
||||
$headerActions = isset($GLOBALS['layout_header_actions']) && is_array($GLOBALS['layout_header_actions'])
|
||||
? $GLOBALS['layout_header_actions']
|
||||
: [];
|
||||
$auth = app()->auth();
|
||||
$authUser = $auth->user();
|
||||
?>
|
||||
@@ -55,6 +64,23 @@ $authUser = $auth->user();
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="theme-switcher" aria-label="Darstellung">
|
||||
<?php if ($headerActions !== []): ?>
|
||||
<div class="header-actions">
|
||||
<?php foreach ($headerActions as $headerAction): ?>
|
||||
<?php
|
||||
if (!is_array($headerAction)) {
|
||||
continue;
|
||||
}
|
||||
$actionHref = trim((string) ($headerAction['href'] ?? ''));
|
||||
$actionLabel = trim((string) ($headerAction['label'] ?? ''));
|
||||
if ($actionHref === '' || $actionLabel === '') {
|
||||
continue;
|
||||
}
|
||||
?>
|
||||
<a class="nav-link" href="<?= e($actionHref) ?>"><?= e($actionLabel) ?></a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if ($auth->isEnabled()): ?>
|
||||
<a class="auth-pill" href="<?= $authUser === null ? '/auth/login' : '/auth/logout' ?>">
|
||||
<?= $authUser === null ? 'Login' : 'Logout ' . e((string)($authUser['username'] ?? $authUser['name'] ?? '')) ?>
|
||||
|
||||
@@ -414,6 +414,13 @@ body.has-modal-open {
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.header-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 10px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.auth-pill {
|
||||
align-self: end;
|
||||
display: inline-flex;
|
||||
@@ -515,6 +522,10 @@ body.has-modal-open {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.header-actions {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.brand-mark {
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
|
||||
Reference in New Issue
Block a user