nexus basic
This commit is contained in:
@@ -23,6 +23,12 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$config = [];
|
||||
if ($itemType === 'page_module') {
|
||||
$config['page_module_id'] = (int) ($_POST['page_module_id'] ?? 0);
|
||||
} elseif ($itemType === 'app') {
|
||||
$config['app_id'] = (int) ($_POST['app_id'] ?? 0);
|
||||
} elseif ($itemType === 'widget_template') {
|
||||
$config['widget_template_id'] = (int) ($_POST['widget_template_id'] ?? 0);
|
||||
} elseif ($itemType === 'bookmark_group') {
|
||||
$config['bookmarks'] = trim((string) ($_POST['bookmarks'] ?? ''));
|
||||
} else {
|
||||
$config['url'] = trim((string) ($_POST['target_url'] ?? ''));
|
||||
}
|
||||
@@ -61,10 +67,20 @@ if ($currentDashboard === null) {
|
||||
$currentDashboardId = (int) ($currentDashboard['id'] ?? 0);
|
||||
$dashboardItems = $service->listItems($currentDashboardId);
|
||||
$ownPageModules = $service->listPageModulesForOwner($ownerKey);
|
||||
$availableApps = $service->listApps($ownerKey, true);
|
||||
$availableWidgetTemplates = $service->listWidgetTemplates($ownerKey, true);
|
||||
$pageModuleMap = [];
|
||||
foreach ($ownPageModules as $pageModule) {
|
||||
$pageModuleMap[(int) ($pageModule['id'] ?? 0)] = $pageModule;
|
||||
}
|
||||
$appMap = [];
|
||||
foreach ($availableApps as $appEntry) {
|
||||
$appMap[(int) ($appEntry['id'] ?? 0)] = $appEntry;
|
||||
}
|
||||
$widgetTemplateMap = [];
|
||||
foreach ($availableWidgetTemplates as $template) {
|
||||
$widgetTemplateMap[(int) ($template['id'] ?? 0)] = $template;
|
||||
}
|
||||
|
||||
$GLOBALS['layout_header_base_title'] = 'Nexus';
|
||||
$GLOBALS['layout_header_title'] = 'Nexus';
|
||||
@@ -115,7 +131,7 @@ $GLOBALS['layout_header_text'] = 'Persönliche Arbeitsfläche mit frei platzierb
|
||||
|
||||
<section class="section-box">
|
||||
<h2>Element hinzufügen</h2>
|
||||
<p class="muted">V1 unterstützt direkte Links, iFrames und gespeicherte Seitenmodule.</p>
|
||||
<p class="muted">Verfügbar sind direkte Links, iFrames, persönliche Linklisten, globale Apps, Seitenmodule und wiederverwendbare Widgets.</p>
|
||||
<form method="post" class="setup-form">
|
||||
<input type="hidden" name="action" value="add_item">
|
||||
<input type="hidden" name="dashboard_id" value="<?= $currentDashboardId ?>">
|
||||
@@ -129,7 +145,10 @@ $GLOBALS['layout_header_text'] = 'Persönliche Arbeitsfläche mit frei platzierb
|
||||
<select name="item_type" data-dashboard-item-type>
|
||||
<option value="link">Link</option>
|
||||
<option value="iframe">iFrame</option>
|
||||
<option value="bookmark_group">Linkliste</option>
|
||||
<option value="app">App</option>
|
||||
<option value="page_module">Seitenmodul</option>
|
||||
<option value="widget_template">Widget-Vorlage</option>
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
@@ -142,6 +161,19 @@ $GLOBALS['layout_header_text'] = 'Persönliche Arbeitsfläche mit frei platzierb
|
||||
<span>Ziel-URL</span>
|
||||
<input type="url" name="target_url" placeholder="https://...">
|
||||
</label>
|
||||
<label class="setup-field muted" data-dashboard-bookmarks hidden>
|
||||
<span>Linkliste</span>
|
||||
<textarea name="bookmarks" rows="5" placeholder="Bezeichnung | https://ziel.example Nexus | /dashboard"></textarea>
|
||||
</label>
|
||||
<label class="setup-field muted" data-dashboard-app hidden>
|
||||
<span>App</span>
|
||||
<select name="app_id">
|
||||
<option value="0">Bitte wählen</option>
|
||||
<?php foreach ($availableApps as $appEntry): ?>
|
||||
<option value="<?= (int) ($appEntry['id'] ?? 0) ?>"><?= e((string) ($appEntry['name'] ?? 'App')) ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</label>
|
||||
<label class="setup-field muted" data-dashboard-page-module hidden>
|
||||
<span>Seitenmodul</span>
|
||||
<select name="page_module_id">
|
||||
@@ -151,6 +183,15 @@ $GLOBALS['layout_header_text'] = 'Persönliche Arbeitsfläche mit frei platzierb
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</label>
|
||||
<label class="setup-field muted" data-dashboard-widget-template hidden>
|
||||
<span>Widget-Vorlage</span>
|
||||
<select name="widget_template_id">
|
||||
<option value="0">Bitte wählen</option>
|
||||
<?php foreach ($availableWidgetTemplates as $template): ?>
|
||||
<option value="<?= (int) ($template['id'] ?? 0) ?>"><?= e((string) ($template['name'] ?? 'Widget')) ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
<div class="setup-grid">
|
||||
<label class="setup-field muted">
|
||||
@@ -189,6 +230,11 @@ $GLOBALS['layout_header_text'] = 'Persönliche Arbeitsfläche mit frei platzierb
|
||||
<?php
|
||||
$itemType = (string) ($item['item_type'] ?? 'link');
|
||||
$config = is_array($item['config'] ?? null) ? $item['config'] : [];
|
||||
if ($itemType === 'widget_template' && !empty($config['widget_template_id']) && isset($widgetTemplateMap[(int) $config['widget_template_id']])) {
|
||||
$template = $widgetTemplateMap[(int) $config['widget_template_id']];
|
||||
$itemType = (string) ($template['widget_type'] ?? $itemType);
|
||||
$config = array_merge(is_array($template['config'] ?? null) ? $template['config'] : [], $config);
|
||||
}
|
||||
$columnSpan = max(1, min(4, (int) ($item['column_span'] ?? 1)));
|
||||
$rowSpan = max(1, min(4, (int) ($item['row_span'] ?? 1)));
|
||||
$gridStyles = 'grid-column: span ' . $columnSpan . '; grid-row: span ' . $rowSpan . ';';
|
||||
@@ -202,10 +248,30 @@ $GLOBALS['layout_header_text'] = 'Persönliche Arbeitsfläche mit frei platzierb
|
||||
if ($itemType === 'page_module' && !empty($config['page_module_id'])) {
|
||||
$pageModule = $pageModuleMap[(int) $config['page_module_id']] ?? null;
|
||||
}
|
||||
$appEntry = null;
|
||||
if ($itemType === 'app' && !empty($config['app_id'])) {
|
||||
$appEntry = $appMap[(int) $config['app_id']] ?? null;
|
||||
}
|
||||
$targetUrl = trim((string) ($config['url'] ?? ''));
|
||||
if ($pageModule !== null) {
|
||||
$targetUrl = trim((string) ($pageModule['target_url'] ?? $targetUrl));
|
||||
}
|
||||
if ($appEntry !== null) {
|
||||
$targetUrl = trim((string) ($appEntry['app_url'] ?? $targetUrl));
|
||||
}
|
||||
$bookmarks = [];
|
||||
if ($itemType === 'bookmark_group') {
|
||||
foreach (preg_split('/\r\n|\r|\n/', trim((string) ($config['bookmarks'] ?? ''))) ?: [] as $line) {
|
||||
$line = trim($line);
|
||||
if ($line === '') {
|
||||
continue;
|
||||
}
|
||||
[$label, $url] = array_pad(array_map('trim', explode('|', $line, 2)), 2, '');
|
||||
if ($label !== '' && $url !== '') {
|
||||
$bookmarks[] = ['label' => $label, 'url' => $url];
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
<article class="card-box dashboard-widget" style="<?= e($gridStyles) ?>">
|
||||
<div class="dashboard-widget__head">
|
||||
@@ -224,8 +290,22 @@ $GLOBALS['layout_header_text'] = 'Persönliche Arbeitsfläche mit frei platzierb
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<?php if (($itemType === 'iframe' || ($pageModule !== null && (string) ($pageModule['module_type'] ?? '') === 'iframe')) && $targetUrl !== ''): ?>
|
||||
<?php if ($itemType === 'bookmark_group' && $bookmarks !== []): ?>
|
||||
<div class="dashboard-links">
|
||||
<?php foreach ($bookmarks as $bookmark): ?>
|
||||
<a class="module-button module-button--secondary module-button--small" href="<?= e($bookmark['url']) ?>" target="_blank" rel="noreferrer"><?= e($bookmark['label']) ?></a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php elseif (($itemType === 'iframe' || ($pageModule !== null && (string) ($pageModule['module_type'] ?? '') === 'iframe')) && $targetUrl !== ''): ?>
|
||||
<iframe class="dashboard-widget__frame" src="<?= e($targetUrl) ?>" loading="lazy" referrerpolicy="no-referrer"></iframe>
|
||||
<?php elseif ($appEntry !== null): ?>
|
||||
<div class="dashboard-widget__meta">
|
||||
<?php if (!empty($appEntry['icon_url'])): ?>
|
||||
<img class="dashboard-app-icon" src="<?= e((string) $appEntry['icon_url']) ?>" alt="">
|
||||
<?php endif; ?>
|
||||
<p><?= e((string) ($appEntry['description'] ?? $targetUrl)) ?></p>
|
||||
<a class="module-button module-button--secondary module-button--small" href="<?= e($targetUrl) ?>" target="_blank" rel="noreferrer">App öffnen</a>
|
||||
</div>
|
||||
<?php elseif ($pageModule !== null): ?>
|
||||
<div class="dashboard-widget__meta">
|
||||
<p><?= e((string) ($pageModule['description'] ?? 'Seitenmodul aus der globalen Nexus-Verwaltung.')) ?></p>
|
||||
@@ -249,11 +329,17 @@ $GLOBALS['layout_header_text'] = 'Persönliche Arbeitsfläche mit frei platzierb
|
||||
const typeSelect = document.querySelector('[data-dashboard-item-type]');
|
||||
const urlField = document.querySelector('[data-dashboard-target-url]');
|
||||
const pageModuleField = document.querySelector('[data-dashboard-page-module]');
|
||||
if (!typeSelect || !urlField || !pageModuleField) return;
|
||||
const bookmarksField = document.querySelector('[data-dashboard-bookmarks]');
|
||||
const appField = document.querySelector('[data-dashboard-app]');
|
||||
const widgetTemplateField = document.querySelector('[data-dashboard-widget-template]');
|
||||
if (!typeSelect || !urlField || !pageModuleField || !bookmarksField || !appField || !widgetTemplateField) return;
|
||||
const sync = () => {
|
||||
const isPageModule = typeSelect.value === 'page_module';
|
||||
urlField.hidden = isPageModule;
|
||||
pageModuleField.hidden = !isPageModule;
|
||||
const value = typeSelect.value;
|
||||
urlField.hidden = !['link', 'iframe'].includes(value);
|
||||
pageModuleField.hidden = value !== 'page_module';
|
||||
bookmarksField.hidden = value !== 'bookmark_group';
|
||||
appField.hidden = value !== 'app';
|
||||
widgetTemplateField.hidden = value !== 'widget_template';
|
||||
};
|
||||
typeSelect.addEventListener('change', sync);
|
||||
sync();
|
||||
|
||||
@@ -3,202 +3,143 @@ declare(strict_types=1);
|
||||
|
||||
$auth = app()->auth();
|
||||
$authUser = $auth->user();
|
||||
$service = dashboards();
|
||||
$ownerKey = auth_user_key();
|
||||
$groups = auth_groups();
|
||||
$service = dashboards();
|
||||
$modules = array_values(array_filter(
|
||||
$auth->filterModules(modules()->all()),
|
||||
static fn (array $module): bool => !empty($module['enabled'])
|
||||
));
|
||||
|
||||
$dashboardsList = [];
|
||||
$pageModules = [];
|
||||
$defaultDashboard = null;
|
||||
$dashboardItems = [];
|
||||
|
||||
if ($authUser !== null && $service->available() && $ownerKey !== '') {
|
||||
$defaultDashboard = $service->ensureDefaultDashboard($ownerKey, 'Mein Dashboard');
|
||||
$dashboardsList = $service->listAccessibleDashboards($ownerKey, $groups);
|
||||
$pageModules = $service->listPageModulesForOwner($ownerKey);
|
||||
if ($defaultDashboard !== []) {
|
||||
$dashboardItems = $service->listItems((int) ($defaultDashboard['id'] ?? 0));
|
||||
}
|
||||
$selectedDashboardId = (int) ($_GET['board'] ?? 0);
|
||||
$currentDashboard = $service->available()
|
||||
? $service->resolveHomeDashboard($ownerKey !== '' ? $ownerKey : null, $groups, $authUser !== null, $selectedDashboardId)
|
||||
: null;
|
||||
$dashboardItems = $currentDashboard !== null ? $service->listItems((int) ($currentDashboard['id'] ?? 0)) : [];
|
||||
$accessibleApps = ($authUser !== null && $service->available()) ? $service->listApps($ownerKey, true) : [];
|
||||
$appsById = [];
|
||||
foreach ($accessibleApps as $appEntry) {
|
||||
$appsById[(int) ($appEntry['id'] ?? 0)] = $appEntry;
|
||||
}
|
||||
$widgetTemplates = ($authUser !== null && $service->available()) ? $service->listWidgetTemplates($ownerKey, true) : [];
|
||||
$widgetTemplatesById = [];
|
||||
foreach ($widgetTemplates as $template) {
|
||||
$widgetTemplatesById[(int) ($template['id'] ?? 0)] = $template;
|
||||
}
|
||||
|
||||
$GLOBALS['layout_header_base_title'] = 'Nexus';
|
||||
$GLOBALS['layout_header_title'] = 'Nexus';
|
||||
$GLOBALS['layout_header_context'] = 'Übersicht';
|
||||
$GLOBALS['layout_header_text'] = $authUser === null
|
||||
? 'Zentraler Einstieg in Nexus und die verfügbaren Bereiche.'
|
||||
: 'Persönliche Übersicht aus Dashboards, Seitenmodulen und klassischen Modulen.';
|
||||
$GLOBALS['layout_header_context'] = $currentDashboard !== null ? (string) ($currentDashboard['title'] ?? 'Dashboard') : 'Dashboard';
|
||||
$GLOBALS['layout_header_text'] = $currentDashboard !== null
|
||||
? (string) ($currentDashboard['description'] ?? '')
|
||||
: 'Kein öffentliches oder persönliches Home-Dashboard verfügbar.';
|
||||
|
||||
$renderBookmarks = static function (array $config): array {
|
||||
$items = [];
|
||||
$raw = trim((string) ($config['bookmarks'] ?? ''));
|
||||
if ($raw === '') {
|
||||
return [];
|
||||
}
|
||||
foreach (preg_split('/\r\n|\r|\n/', $raw) ?: [] as $line) {
|
||||
$line = trim($line);
|
||||
if ($line === '') {
|
||||
continue;
|
||||
}
|
||||
[$label, $url] = array_pad(array_map('trim', explode('|', $line, 2)), 2, '');
|
||||
if ($label !== '' && $url !== '') {
|
||||
$items[] = ['label' => $label, 'url' => $url];
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
};
|
||||
?>
|
||||
<div class="module-shell"><div class="module-page-bg"><div class="module-page-stack">
|
||||
<?php if ($authUser !== null): ?>
|
||||
<header class="module-hero submenu-box">
|
||||
<div class="module-hero-top module-hero-top--compact">
|
||||
<nav class="module-tabs" aria-label="Nexus Navigation">
|
||||
<a class="module-button module-button--tab-active" href="/">Nexus Übersicht</a>
|
||||
<a class="module-button module-button--tab" href="/dashboard">Dashboard</a>
|
||||
<a class="module-button module-button--tab" href="/dashboards">Dashboards</a>
|
||||
<a class="module-button module-button--tab" href="/integrations">Integrationen</a>
|
||||
<a class="module-button module-button--tab" href="/page-modules">Seitenmodule</a>
|
||||
<?php if (auth_is_admin()): ?>
|
||||
<a class="module-button module-button--tab" href="/modules">Aktive Module</a>
|
||||
<?php endif; ?>
|
||||
</nav>
|
||||
<div class="module-hero-actions module-submenu-actions">
|
||||
<a class="module-button module-button--secondary module-button--small" href="/settings">Nexus Einstellungen</a>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<?php if ($currentDashboard === null): ?>
|
||||
<section class="section-box">
|
||||
<h2>Mein Standard-Dashboard</h2>
|
||||
<p class="muted">Der schnellste Einstieg in deine wichtigsten Nexus-Inhalte.</p>
|
||||
<?php if ($defaultDashboard === null || $defaultDashboard === []): ?>
|
||||
<div class="dashboard-empty">Kein Dashboard verfügbar.</div>
|
||||
<?php else: ?>
|
||||
<div class="nexus-quick-grid">
|
||||
<article class="card-box nexus-stat-card">
|
||||
<span class="module-admin-meta__label">Dashboard</span>
|
||||
<strong><?= e((string) ($defaultDashboard['title'] ?? 'Mein Dashboard')) ?></strong>
|
||||
<p class="muted"><?= e((string) ($defaultDashboard['description'] ?? 'Persönliches Standard-Dashboard')) ?></p>
|
||||
<a class="module-button module-button--secondary module-button--small" href="/dashboard?id=<?= (int) ($defaultDashboard['id'] ?? 0) ?>">Öffnen</a>
|
||||
</article>
|
||||
<article class="card-box nexus-stat-card">
|
||||
<span class="module-admin-meta__label">Elemente</span>
|
||||
<strong><?= count($dashboardItems) ?></strong>
|
||||
<p class="muted">Aktive Dashboard-Elemente im Standard-Dashboard.</p>
|
||||
</article>
|
||||
<article class="card-box nexus-stat-card">
|
||||
<span class="module-admin-meta__label">Seitenmodule</span>
|
||||
<strong><?= count($pageModules) ?></strong>
|
||||
<p class="muted">Eigene, on-the-fly angelegte Seitenmodule.</p>
|
||||
</article>
|
||||
<article class="card-box nexus-stat-card">
|
||||
<span class="module-admin-meta__label">Klassische Module</span>
|
||||
<strong><?= count($modules) ?></strong>
|
||||
<p class="muted">Aktuell sichtbare, klassische Nexus-Module.</p>
|
||||
</article>
|
||||
</div>
|
||||
<h2>Kein Home-Dashboard verfügbar</h2>
|
||||
<p class="muted">Lege als Administrator ein öffentliches Dashboard fest oder richte dein persönliches Dashboard ein.</p>
|
||||
<?php if ($authUser !== null): ?>
|
||||
<a class="module-button module-button--secondary module-button--small" href="/dashboard">Zum Dashboard</a>
|
||||
<?php endif; ?>
|
||||
</section>
|
||||
|
||||
<?php elseif ($dashboardItems === []): ?>
|
||||
<section class="section-box">
|
||||
<h2>Dashboards</h2>
|
||||
<p class="muted">Eigene und freigegebene Dashboards im globalen Nexus-System.</p>
|
||||
<div class="module-admin-grid module-admin-grid--compact">
|
||||
<?php foreach (array_slice($dashboardsList, 0, 6) as $dashboard): ?>
|
||||
<article class="card-box module-admin-card">
|
||||
<div class="module-admin-card__head">
|
||||
<div class="module-admin-card__title">
|
||||
<h2><?= e((string) ($dashboard['title'] ?? 'Dashboard')) ?></h2>
|
||||
<p><?= e((string) ($dashboard['description'] ?? 'Flexible Dashboard-Fläche für Widgets und Seitenmodule.')) ?></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="module-admin-meta">
|
||||
<div class="module-admin-meta__item">
|
||||
<span class="module-admin-meta__label">Sichtbarkeit</span>
|
||||
<strong class="module-admin-badge"><?= e(ucfirst((string) ($dashboard['visibility'] ?? 'private'))) ?></strong>
|
||||
</div>
|
||||
</div>
|
||||
<div class="module-admin-actions">
|
||||
<a class="module-button module-button--secondary module-button--small" href="/dashboard?id=<?= (int) ($dashboard['id'] ?? 0) ?>">Öffnen</a>
|
||||
</div>
|
||||
</article>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<div class="module-admin-grid">
|
||||
<article class="card-box module-admin-card">
|
||||
<div class="module-admin-card__head">
|
||||
<div class="module-admin-card__title">
|
||||
<h2>Seitenmodule</h2>
|
||||
<p>On-the-fly angelegte Zielseiten und eingebettete Tools.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="module-admin-meta">
|
||||
<div class="module-admin-meta__item">
|
||||
<span class="module-admin-meta__label">Anzahl</span>
|
||||
<strong class="module-admin-badge module-admin-badge--success"><?= count($pageModules) ?></strong>
|
||||
</div>
|
||||
</div>
|
||||
<div class="module-admin-actions">
|
||||
<a class="module-button module-button--secondary module-button--small" href="/page-modules">Verwalten</a>
|
||||
</div>
|
||||
</article>
|
||||
|
||||
<article class="card-box module-admin-card">
|
||||
<div class="module-admin-card__head">
|
||||
<div class="module-admin-card__title">
|
||||
<h2>Integrationen</h2>
|
||||
<p>Zentrale Anbindungen an Home Assistant, Pi-hole, Proxmox und andere Systeme.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="module-admin-actions">
|
||||
<a class="module-button module-button--secondary module-button--small" href="/integrations">Verwalten</a>
|
||||
</div>
|
||||
</article>
|
||||
|
||||
<article class="card-box module-admin-card">
|
||||
<div class="module-admin-card__head">
|
||||
<div class="module-admin-card__title">
|
||||
<h2>Dashboards konfigurieren</h2>
|
||||
<p>Eigene Dashboard-Flächen, Reihenfolge und Standard-Dashboard verwalten.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="module-admin-actions">
|
||||
<a class="module-button module-button--secondary module-button--small" href="/dashboards">Öffnen</a>
|
||||
</div>
|
||||
</article>
|
||||
</div>
|
||||
|
||||
<section class="section-box">
|
||||
<h2>Klassische Module</h2>
|
||||
<p class="muted">Die bisherigen Nexus-Module bleiben parallel zum neuen Grundgerüst bestehen.</p>
|
||||
<div class="module-list">
|
||||
<?php foreach ($modules as $module): ?>
|
||||
<a class="module-row" href="<?= e((string) ($module['entry'] ?? ('/module/' . $module['name']))) ?>">
|
||||
<span class="module-row__icon"><?= e(strtoupper(substr((string) ($module['title'] ?? $module['name']), 0, 1))) ?></span>
|
||||
<span class="module-row__content">
|
||||
<strong class="module-title"><?= e((string) ($module['title'] ?? $module['name'] ?? 'Modul')) ?></strong>
|
||||
<span class="module-desc"><?= e((string) ($module['description'] ?? '')) ?></span>
|
||||
</span>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<h2><?= e((string) ($currentDashboard['title'] ?? 'Dashboard')) ?></h2>
|
||||
<p class="muted">Dieses Dashboard enthält noch keine Elemente.</p>
|
||||
<?php if ($authUser !== null): ?>
|
||||
<a class="module-button module-button--secondary module-button--small" href="/dashboard?id=<?= (int) ($currentDashboard['id'] ?? 0) ?>">Dashboard bearbeiten</a>
|
||||
<?php endif; ?>
|
||||
</section>
|
||||
<?php else: ?>
|
||||
<section class="section-box">
|
||||
<h2>Nexus Einstieg</h2>
|
||||
<p class="muted">Nach der Anmeldung stehen persönliche Dashboards, Integrationen und Seitenmodule bereit.</p>
|
||||
<div class="module-admin-grid">
|
||||
<article class="card-box module-admin-card">
|
||||
<div class="module-admin-card__head">
|
||||
<div class="module-admin-card__title">
|
||||
<h2>Persönliche Dashboards</h2>
|
||||
<p>Mehrere frei konfigurierbare Übersichten pro Benutzer.</p>
|
||||
<div class="dashboard-grid">
|
||||
<?php foreach ($dashboardItems as $item): ?>
|
||||
<?php
|
||||
$itemType = (string) ($item['item_type'] ?? 'link');
|
||||
$config = is_array($item['config'] ?? null) ? $item['config'] : [];
|
||||
if ($itemType === 'widget_template' && !empty($config['widget_template_id']) && isset($widgetTemplatesById[(int) $config['widget_template_id']])) {
|
||||
$template = $widgetTemplatesById[(int) $config['widget_template_id']];
|
||||
$itemType = (string) ($template['widget_type'] ?? $itemType);
|
||||
$config = array_merge(is_array($template['config'] ?? null) ? $template['config'] : [], $config);
|
||||
}
|
||||
$columnSpan = max(1, min(4, (int) ($item['column_span'] ?? 1)));
|
||||
$rowSpan = max(1, min(4, (int) ($item['row_span'] ?? 1)));
|
||||
$gridStyles = 'grid-column: span ' . $columnSpan . '; grid-row: span ' . $rowSpan . ';';
|
||||
if (!empty($item['grid_column'])) {
|
||||
$gridStyles .= 'grid-column-start:' . (int) $item['grid_column'] . ';';
|
||||
}
|
||||
if (!empty($item['grid_row'])) {
|
||||
$gridStyles .= 'grid-row-start:' . (int) $item['grid_row'] . ';';
|
||||
}
|
||||
$targetUrl = trim((string) ($config['url'] ?? ''));
|
||||
$pageModule = null;
|
||||
if ($itemType === 'page_module' && !empty($config['page_module_id'])) {
|
||||
$pageModule = $service->getPageModule((int) $config['page_module_id'], $ownerKey, $groups);
|
||||
$targetUrl = trim((string) ($pageModule['target_url'] ?? $targetUrl));
|
||||
}
|
||||
$appEntry = null;
|
||||
if ($itemType === 'app' && !empty($config['app_id'])) {
|
||||
$appEntry = $appsById[(int) $config['app_id']] ?? null;
|
||||
$targetUrl = trim((string) ($appEntry['app_url'] ?? $targetUrl));
|
||||
}
|
||||
$bookmarks = $itemType === 'bookmark_group' ? $renderBookmarks($config) : [];
|
||||
?>
|
||||
<article class="card-box dashboard-widget" style="<?= e($gridStyles) ?>">
|
||||
<div class="dashboard-widget__head">
|
||||
<div>
|
||||
<span class="module-admin-meta__label"><?= e(strtoupper(str_replace('_', ' ', $itemType))) ?></span>
|
||||
<h2><?= e((string) ($item['title'] ?? 'Element')) ?></h2>
|
||||
<?php if (!empty($item['description'])): ?>
|
||||
<p><?= e((string) $item['description']) ?></p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
<article class="card-box module-admin-card">
|
||||
<div class="module-admin-card__head">
|
||||
<div class="module-admin-card__title">
|
||||
<h2>Integrationen</h2>
|
||||
<p>Zentrale Anbindungen für Fremdsysteme und externe Datenquellen.</p>
|
||||
|
||||
<?php if ($itemType === 'bookmark_group' && $bookmarks !== []): ?>
|
||||
<div class="dashboard-links">
|
||||
<?php foreach ($bookmarks as $bookmark): ?>
|
||||
<a class="module-button module-button--secondary module-button--small" href="<?= e($bookmark['url']) ?>" target="_blank" rel="noreferrer"><?= e($bookmark['label']) ?></a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
<article class="card-box module-admin-card">
|
||||
<div class="module-admin-card__head">
|
||||
<div class="module-admin-card__title">
|
||||
<h2>Seitenmodule</h2>
|
||||
<p>On-the-fly angelegte Links und eingebettete Weboberflächen.</p>
|
||||
<?php elseif (($itemType === 'iframe' || ($pageModule !== null && (string) ($pageModule['module_type'] ?? '') === 'iframe')) && $targetUrl !== ''): ?>
|
||||
<iframe class="dashboard-widget__frame" src="<?= e($targetUrl) ?>" loading="lazy" referrerpolicy="no-referrer"></iframe>
|
||||
<?php elseif ($appEntry !== null): ?>
|
||||
<div class="dashboard-widget__meta">
|
||||
<?php if (!empty($appEntry['icon_url'])): ?>
|
||||
<img class="dashboard-app-icon" src="<?= e((string) $appEntry['icon_url']) ?>" alt="">
|
||||
<?php endif; ?>
|
||||
<p><?= e((string) ($appEntry['description'] ?? $targetUrl)) ?></p>
|
||||
<a class="module-button module-button--secondary module-button--small" href="<?= e($targetUrl) ?>" target="_blank" rel="noreferrer">App öffnen</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php elseif ($pageModule !== null): ?>
|
||||
<div class="dashboard-widget__meta">
|
||||
<p><?= e((string) ($pageModule['description'] ?? 'Seitenmodul aus dem Nexus-System.')) ?></p>
|
||||
<a class="module-button module-button--secondary module-button--small" href="/page-modules/view/<?= (int) ($pageModule['id'] ?? 0) ?>">Öffnen</a>
|
||||
</div>
|
||||
<?php elseif ($targetUrl !== ''): ?>
|
||||
<div class="dashboard-widget__meta">
|
||||
<p><?= e($targetUrl) ?></p>
|
||||
<a class="module-button module-button--secondary module-button--small" href="<?= e($targetUrl) ?>" target="_blank" rel="noreferrer">Öffnen</a>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="dashboard-empty">Für dieses Element ist noch kein Inhalt hinterlegt.</div>
|
||||
<?php endif; ?>
|
||||
</article>
|
||||
</div>
|
||||
</section>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div></div></div>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
require_auth();
|
||||
require_admin();
|
||||
|
||||
$service = dashboards();
|
||||
$ownerKey = auth_user_key();
|
||||
$ownerKey = 'system';
|
||||
$notice = null;
|
||||
$error = null;
|
||||
|
||||
@@ -39,19 +39,21 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
|
||||
$integrations = $service->listIntegrationsForOwner($ownerKey);
|
||||
|
||||
$GLOBALS['layout_header_base_title'] = 'Nexus';
|
||||
$GLOBALS['layout_header_title'] = 'Nexus';
|
||||
$GLOBALS['layout_header_base_title'] = 'Nexus Setup';
|
||||
$GLOBALS['layout_header_title'] = 'Nexus Setup';
|
||||
$GLOBALS['layout_header_context'] = 'Integrationen';
|
||||
$GLOBALS['layout_header_text'] = 'Zentrale Anbindungen an externe Systeme, getrennt vom klassischen Modulsystem.';
|
||||
$GLOBALS['layout_header_text'] = 'Globale Integrationen für spätere Widgets, Apps und Suchfunktionen.';
|
||||
?>
|
||||
<div class="module-shell"><div class="module-page-bg"><div class="module-page-stack">
|
||||
<header class="module-hero submenu-box">
|
||||
<div class="module-hero-top module-hero-top--compact">
|
||||
<nav class="module-tabs" aria-label="Integration Navigation">
|
||||
<a class="module-button module-button--tab" href="/dashboard">Dashboard</a>
|
||||
<a class="module-button module-button--tab" href="/dashboards">Dashboards</a>
|
||||
<nav class="module-tabs" aria-label="Nexus Setup Navigation">
|
||||
<a class="module-button module-button--tab" href="/settings">Allgemein</a>
|
||||
<a class="module-button module-button--tab" href="/settings/widgets">Widgets</a>
|
||||
<a class="module-button module-button--tab-active" href="/integrations">Integrationen</a>
|
||||
<a class="module-button module-button--tab" href="/page-modules">Seitenmodule</a>
|
||||
<a class="module-button module-button--tab" href="/settings/search-engines">Suchmaschinen</a>
|
||||
<a class="module-button module-button--tab" href="/settings/apps">Apps</a>
|
||||
<a class="module-button module-button--tab" href="/dashboards">Dashboards</a>
|
||||
</nav>
|
||||
<div class="module-hero-actions module-submenu-actions">
|
||||
<a class="module-button module-button--secondary module-button--small" href="/">Nexus Übersicht</a>
|
||||
@@ -93,7 +95,6 @@ $GLOBALS['layout_header_text'] = 'Zentrale Anbindungen an externe Systeme, getre
|
||||
<label class="setup-field muted">
|
||||
<span>Sichtbarkeit</span>
|
||||
<select name="visibility">
|
||||
<option value="private">Privat</option>
|
||||
<option value="public">Öffentlich</option>
|
||||
</select>
|
||||
</label>
|
||||
|
||||
@@ -12,6 +12,7 @@ $timezoneOptions = modules()->timezones();
|
||||
$nexusSettings = nexus_settings();
|
||||
$isAdmin = auth_is_admin();
|
||||
$notice = null;
|
||||
$publicDashboards = $isAdmin ? dashboards()->listPublicDashboards() : [];
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$settingsSection = trim((string) ($_POST['settings_section'] ?? 'theme'));
|
||||
@@ -19,6 +20,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$displayTimezoneCustom = isset($_POST['display_timezone_custom']) ? '1' : '0';
|
||||
$displayTimezone = trim((string) ($_POST['display_timezone'] ?? ''));
|
||||
$cronTimezone = trim((string) ($_POST['cron_timezone'] ?? ''));
|
||||
$globalHomeDashboardId = (int) ($_POST['global_home_dashboard_id'] ?? 0);
|
||||
|
||||
foreach (['displayTimezone' => $displayTimezone, 'cronTimezone' => $cronTimezone] as $key => $value) {
|
||||
if ($value !== '') {
|
||||
@@ -33,6 +35,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$nexusSettings['display_timezone_custom'] = $displayTimezoneCustom;
|
||||
$nexusSettings['display_timezone'] = $displayTimezoneCustom === '1' ? $displayTimezone : '';
|
||||
$nexusSettings['cron_timezone'] = $cronTimezone;
|
||||
$nexusSettings['global_home_dashboard_id'] = $globalHomeDashboardId > 0 ? (string) $globalHomeDashboardId : '';
|
||||
nexus_save_settings($nexusSettings);
|
||||
$nexusSettings = nexus_settings();
|
||||
$notice = 'Nexus-Einstellungen gespeichert.';
|
||||
@@ -53,11 +56,35 @@ $effectiveCronTimezone = nexus_cron_timezone_name();
|
||||
$displayTimezoneCustom = !empty($nexusSettings['display_timezone_custom']);
|
||||
$savedDisplayTimezone = trim((string) ($nexusSettings['display_timezone'] ?? ''));
|
||||
$savedCronTimezone = trim((string) ($nexusSettings['cron_timezone'] ?? ''));
|
||||
$globalHomeDashboardId = (int) ($nexusSettings['global_home_dashboard_id'] ?? 0);
|
||||
|
||||
$GLOBALS['layout_header_base_title'] = 'Nexus Setup';
|
||||
$GLOBALS['layout_header_title'] = 'Nexus Setup';
|
||||
$GLOBALS['layout_header_context'] = 'Allgemein';
|
||||
$GLOBALS['layout_header_text'] = 'Globale Grundeinstellungen, Home-Dashboard und systemweite Standardwerte.';
|
||||
?>
|
||||
<div class="module-shell"><div class="module-page-bg"><div class="module-page-stack">
|
||||
<header class="module-hero submenu-box">
|
||||
<div class="module-hero-top module-hero-top--compact">
|
||||
<nav class="module-tabs" aria-label="Nexus Setup Navigation">
|
||||
<a class="module-button module-button--tab-active" href="/settings">Allgemein</a>
|
||||
<?php if ($isAdmin): ?>
|
||||
<a class="module-button module-button--tab" href="/settings/widgets">Widgets</a>
|
||||
<a class="module-button module-button--tab" href="/integrations">Integrationen</a>
|
||||
<a class="module-button module-button--tab" href="/settings/search-engines">Suchmaschinen</a>
|
||||
<a class="module-button module-button--tab" href="/settings/apps">Apps</a>
|
||||
<a class="module-button module-button--tab" href="/dashboards">Dashboards</a>
|
||||
<?php endif; ?>
|
||||
</nav>
|
||||
<div class="module-hero-actions module-submenu-actions">
|
||||
<a class="module-button module-button--secondary module-button--small" href="/">Nexus Übersicht</a>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<section class="section-box">
|
||||
<h1>Nexus Einstellungen</h1>
|
||||
<p class="muted">Persönliche Anzeige und systemweite Standardwerte.</p>
|
||||
<p class="muted">Persönliche Anzeige, Home-Dashboard und systemweite Standardwerte.</p>
|
||||
|
||||
<?php if ($notice): ?>
|
||||
<div class="section-box" style="margin-top:1rem; border-color:var(--accent-2);">
|
||||
@@ -115,6 +142,18 @@ $savedCronTimezone = trim((string) ($nexusSettings['cron_timezone'] ?? ''));
|
||||
<div><?= e($systemTimezone) ?></div>
|
||||
<small class="muted">Diese Zeitzone wird genutzt, wenn keine globale Anzeige-Zeitzone gesetzt ist.</small>
|
||||
</div>
|
||||
<label class="setup-field muted">
|
||||
<span>Öffentliches Home-Dashboard</span>
|
||||
<select name="global_home_dashboard_id">
|
||||
<option value="0">Kein öffentliches Home-Dashboard</option>
|
||||
<?php foreach ($publicDashboards as $dashboard): ?>
|
||||
<option value="<?= (int) ($dashboard['id'] ?? 0) ?>" <?= (int) ($dashboard['id'] ?? 0) === $globalHomeDashboardId ? 'selected' : '' ?>>
|
||||
<?= e((string) ($dashboard['title'] ?? 'Dashboard')) ?>
|
||||
</option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<small class="muted">Dieses öffentliche Dashboard wird am Root-Pfad angezeigt, wenn Nutzer nicht eingeloggt sind.</small>
|
||||
</label>
|
||||
<div class="setup-field muted">
|
||||
<span>Anzeige-Zeitzone</span>
|
||||
<label style="display:flex; align-items:center; gap:10px;">
|
||||
|
||||
125
partials/landingpages/users/settings_apps.php
Normal file
125
partials/landingpages/users/settings_apps.php
Normal file
@@ -0,0 +1,125 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
require_admin();
|
||||
|
||||
$service = dashboards();
|
||||
$ownerKey = 'system';
|
||||
$notice = null;
|
||||
$error = null;
|
||||
$integrations = $service->listIntegrationsForOwner($ownerKey);
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$action = trim((string) ($_POST['action'] ?? ''));
|
||||
try {
|
||||
if ($action === 'create_app') {
|
||||
$service->createApp($ownerKey, [
|
||||
'name' => trim((string) ($_POST['name'] ?? '')),
|
||||
'description' => trim((string) ($_POST['description'] ?? '')),
|
||||
'app_url' => trim((string) ($_POST['app_url'] ?? '')),
|
||||
'icon_url' => trim((string) ($_POST['icon_url'] ?? '')),
|
||||
'integration_id' => (int) ($_POST['integration_id'] ?? 0),
|
||||
'visibility' => 'public',
|
||||
]);
|
||||
$notice = 'App gespeichert.';
|
||||
} elseif ($action === 'delete_app') {
|
||||
$service->deleteApp((int) ($_POST['app_id'] ?? 0), $ownerKey);
|
||||
$notice = 'App gelöscht.';
|
||||
}
|
||||
} catch (\Throwable $exception) {
|
||||
$error = $exception->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
$apps = $service->listApps($ownerKey, true);
|
||||
|
||||
$GLOBALS['layout_header_base_title'] = 'Nexus Setup';
|
||||
$GLOBALS['layout_header_title'] = 'Nexus Setup';
|
||||
$GLOBALS['layout_header_context'] = 'Apps';
|
||||
$GLOBALS['layout_header_text'] = 'Globale Apps, die Nutzer später ihren Dashboards hinzufügen können.';
|
||||
?>
|
||||
<div class="module-shell"><div class="module-page-bg"><div class="module-page-stack">
|
||||
<header class="module-hero submenu-box">
|
||||
<div class="module-hero-top module-hero-top--compact">
|
||||
<nav class="module-tabs" aria-label="Nexus Setup Navigation">
|
||||
<a class="module-button module-button--tab" href="/settings">Allgemein</a>
|
||||
<a class="module-button module-button--tab" href="/settings/widgets">Widgets</a>
|
||||
<a class="module-button module-button--tab" href="/integrations">Integrationen</a>
|
||||
<a class="module-button module-button--tab" href="/settings/search-engines">Suchmaschinen</a>
|
||||
<a class="module-button module-button--tab-active" href="/settings/apps">Apps</a>
|
||||
<a class="module-button module-button--tab" href="/dashboards">Dashboards</a>
|
||||
</nav>
|
||||
<div class="module-hero-actions module-submenu-actions">
|
||||
<a class="module-button module-button--secondary module-button--small" href="/">Nexus Übersicht</a>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<?php if ($error !== null): ?>
|
||||
<section class="section-box"><?= e($error) ?></section>
|
||||
<?php elseif ($notice !== null): ?>
|
||||
<section class="section-box"><?= e($notice) ?></section>
|
||||
<?php endif; ?>
|
||||
|
||||
<section class="section-box">
|
||||
<h2>Neue App</h2>
|
||||
<form method="post" class="setup-form">
|
||||
<input type="hidden" name="action" value="create_app">
|
||||
<div class="setup-grid">
|
||||
<label class="setup-field muted">
|
||||
<span>Name</span>
|
||||
<input type="text" name="name" required>
|
||||
</label>
|
||||
<label class="setup-field muted">
|
||||
<span>App-URL</span>
|
||||
<input type="url" name="app_url" required placeholder="https://...">
|
||||
</label>
|
||||
</div>
|
||||
<div class="setup-grid">
|
||||
<label class="setup-field muted">
|
||||
<span>Beschreibung</span>
|
||||
<input type="text" name="description">
|
||||
</label>
|
||||
<label class="setup-field muted">
|
||||
<span>Icon-URL optional</span>
|
||||
<input type="url" name="icon_url" placeholder="https://.../icon.png">
|
||||
</label>
|
||||
</div>
|
||||
<div class="setup-grid">
|
||||
<label class="setup-field muted">
|
||||
<span>Integration optional</span>
|
||||
<select name="integration_id">
|
||||
<option value="0">Keine Integration</option>
|
||||
<?php foreach ($integrations as $integration): ?>
|
||||
<option value="<?= (int) ($integration['id'] ?? 0) ?>"><?= e((string) ($integration['name'] ?? 'Integration')) ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
<div class="setup-actions setup-actions--footer">
|
||||
<button class="cta-button" type="submit">App speichern</button>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
|
||||
<div class="module-admin-grid">
|
||||
<?php foreach ($apps as $appEntry): ?>
|
||||
<article class="card-box module-admin-card">
|
||||
<div class="module-admin-card__head">
|
||||
<div class="module-admin-card__title">
|
||||
<h2><?= e((string) ($appEntry['name'] ?? 'App')) ?></h2>
|
||||
<p><?= e((string) ($appEntry['description'] ?? ($appEntry['app_url'] ?? ''))) ?></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="module-admin-actions">
|
||||
<a class="module-button module-button--secondary module-button--small" href="<?= e((string) ($appEntry['app_url'] ?? '#')) ?>" target="_blank" rel="noreferrer">Öffnen</a>
|
||||
<form method="post">
|
||||
<input type="hidden" name="action" value="delete_app">
|
||||
<input type="hidden" name="app_id" value="<?= (int) ($appEntry['id'] ?? 0) ?>">
|
||||
<button class="module-button module-button--secondary module-button--small" type="submit">Löschen</button>
|
||||
</form>
|
||||
</div>
|
||||
</article>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div></div></div>
|
||||
142
partials/landingpages/users/settings_search_engines.php
Normal file
142
partials/landingpages/users/settings_search_engines.php
Normal file
@@ -0,0 +1,142 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
require_admin();
|
||||
|
||||
$service = dashboards();
|
||||
$ownerKey = 'system';
|
||||
$notice = null;
|
||||
$error = null;
|
||||
$integrations = $service->listIntegrationsForOwner($ownerKey);
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$action = trim((string) ($_POST['action'] ?? ''));
|
||||
try {
|
||||
if ($action === 'create_search_engine') {
|
||||
$service->createSearchEngine($ownerKey, [
|
||||
'name' => trim((string) ($_POST['name'] ?? '')),
|
||||
'short_code' => trim((string) ($_POST['short_code'] ?? '')),
|
||||
'engine_type' => trim((string) ($_POST['engine_type'] ?? 'template')),
|
||||
'template_url' => trim((string) ($_POST['template_url'] ?? '')),
|
||||
'integration_id' => (int) ($_POST['integration_id'] ?? 0),
|
||||
'visibility' => 'public',
|
||||
'is_default' => isset($_POST['is_default']),
|
||||
]);
|
||||
$notice = 'Suchmaschine gespeichert.';
|
||||
} elseif ($action === 'delete_search_engine') {
|
||||
$service->deleteSearchEngine((int) ($_POST['engine_id'] ?? 0), $ownerKey);
|
||||
$notice = 'Suchmaschine gelöscht.';
|
||||
}
|
||||
} catch (\Throwable $exception) {
|
||||
$error = $exception->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
$engines = $service->listSearchEngines($ownerKey, true);
|
||||
|
||||
$GLOBALS['layout_header_base_title'] = 'Nexus Setup';
|
||||
$GLOBALS['layout_header_title'] = 'Nexus Setup';
|
||||
$GLOBALS['layout_header_context'] = 'Suchmaschinen';
|
||||
$GLOBALS['layout_header_text'] = 'Globale Suchmaschinen für die spätere Suche im Nexus-System.';
|
||||
?>
|
||||
<div class="module-shell"><div class="module-page-bg"><div class="module-page-stack">
|
||||
<header class="module-hero submenu-box">
|
||||
<div class="module-hero-top module-hero-top--compact">
|
||||
<nav class="module-tabs" aria-label="Nexus Setup Navigation">
|
||||
<a class="module-button module-button--tab" href="/settings">Allgemein</a>
|
||||
<a class="module-button module-button--tab" href="/settings/widgets">Widgets</a>
|
||||
<a class="module-button module-button--tab" href="/integrations">Integrationen</a>
|
||||
<a class="module-button module-button--tab-active" href="/settings/search-engines">Suchmaschinen</a>
|
||||
<a class="module-button module-button--tab" href="/settings/apps">Apps</a>
|
||||
<a class="module-button module-button--tab" href="/dashboards">Dashboards</a>
|
||||
</nav>
|
||||
<div class="module-hero-actions module-submenu-actions">
|
||||
<a class="module-button module-button--secondary module-button--small" href="/">Nexus Übersicht</a>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<?php if ($error !== null): ?>
|
||||
<section class="section-box"><?= e($error) ?></section>
|
||||
<?php elseif ($notice !== null): ?>
|
||||
<section class="section-box"><?= e($notice) ?></section>
|
||||
<?php endif; ?>
|
||||
|
||||
<section class="section-box">
|
||||
<h2>Neue Suchmaschine</h2>
|
||||
<form method="post" class="setup-form">
|
||||
<input type="hidden" name="action" value="create_search_engine">
|
||||
<div class="setup-grid">
|
||||
<label class="setup-field muted">
|
||||
<span>Name</span>
|
||||
<input type="text" name="name" required>
|
||||
</label>
|
||||
<label class="setup-field muted">
|
||||
<span>Kurzcode</span>
|
||||
<input type="text" name="short_code" placeholder="g" required>
|
||||
</label>
|
||||
</div>
|
||||
<div class="setup-grid">
|
||||
<label class="setup-field muted">
|
||||
<span>Typ</span>
|
||||
<select name="engine_type">
|
||||
<option value="template">Such-Template</option>
|
||||
<option value="integration">Integration</option>
|
||||
</select>
|
||||
</label>
|
||||
<label class="setup-field muted">
|
||||
<span>Such-URL</span>
|
||||
<input type="url" name="template_url" placeholder="https://www.google.com/search?q=%s">
|
||||
</label>
|
||||
</div>
|
||||
<div class="setup-grid">
|
||||
<label class="setup-field muted">
|
||||
<span>Integration optional</span>
|
||||
<select name="integration_id">
|
||||
<option value="0">Keine Integration</option>
|
||||
<?php foreach ($integrations as $integration): ?>
|
||||
<option value="<?= (int) ($integration['id'] ?? 0) ?>"><?= e((string) ($integration['name'] ?? 'Integration')) ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</label>
|
||||
<label class="setup-field muted">
|
||||
<input type="checkbox" name="is_default" value="1">
|
||||
<span>Als globale Standard-Suche setzen</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="setup-actions setup-actions--footer">
|
||||
<button class="cta-button" type="submit">Suchmaschine speichern</button>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
|
||||
<div class="module-admin-grid">
|
||||
<?php foreach ($engines as $engine): ?>
|
||||
<article class="card-box module-admin-card">
|
||||
<div class="module-admin-card__head">
|
||||
<div class="module-admin-card__title">
|
||||
<h2><?= e((string) ($engine['name'] ?? 'Suche')) ?></h2>
|
||||
<p><?= e((string) (($engine['template_url'] ?? '') ?: 'Integration-basierte Suche.')) ?></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="module-admin-meta">
|
||||
<div class="module-admin-meta__item">
|
||||
<span class="module-admin-meta__label">Kurzcode</span>
|
||||
<strong class="module-admin-badge"><?= e((string) ($engine['short_code'] ?? '')) ?></strong>
|
||||
</div>
|
||||
<div class="module-admin-meta__item">
|
||||
<span class="module-admin-meta__label">Standard</span>
|
||||
<strong class="module-admin-badge<?= !empty($engine['is_default']) ? ' module-admin-badge--success' : '' ?>"><?= !empty($engine['is_default']) ? 'Ja' : 'Nein' ?></strong>
|
||||
</div>
|
||||
</div>
|
||||
<div class="module-admin-actions">
|
||||
<form method="post">
|
||||
<input type="hidden" name="action" value="delete_search_engine">
|
||||
<input type="hidden" name="engine_id" value="<?= (int) ($engine['id'] ?? 0) ?>">
|
||||
<button class="module-button module-button--secondary module-button--small" type="submit">Löschen</button>
|
||||
</form>
|
||||
</div>
|
||||
</article>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div></div></div>
|
||||
130
partials/landingpages/users/settings_widgets.php
Normal file
130
partials/landingpages/users/settings_widgets.php
Normal file
@@ -0,0 +1,130 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
require_admin();
|
||||
|
||||
$service = dashboards();
|
||||
$ownerKey = 'system';
|
||||
$notice = null;
|
||||
$error = null;
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$action = trim((string) ($_POST['action'] ?? ''));
|
||||
try {
|
||||
if ($action === 'create_widget') {
|
||||
$service->createWidgetTemplate($ownerKey, [
|
||||
'name' => trim((string) ($_POST['name'] ?? '')),
|
||||
'widget_type' => trim((string) ($_POST['widget_type'] ?? 'link')),
|
||||
'description' => trim((string) ($_POST['description'] ?? '')),
|
||||
'visibility' => 'public',
|
||||
'config' => [
|
||||
'url' => trim((string) ($_POST['target_url'] ?? '')),
|
||||
'bookmarks' => trim((string) ($_POST['bookmarks'] ?? '')),
|
||||
],
|
||||
]);
|
||||
$notice = 'Widget-Vorlage gespeichert.';
|
||||
} elseif ($action === 'delete_widget') {
|
||||
$service->deleteWidgetTemplate((int) ($_POST['widget_id'] ?? 0), $ownerKey);
|
||||
$notice = 'Widget-Vorlage gelöscht.';
|
||||
}
|
||||
} catch (\Throwable $exception) {
|
||||
$error = $exception->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
$widgets = $service->listWidgetTemplates($ownerKey, true);
|
||||
|
||||
$GLOBALS['layout_header_base_title'] = 'Nexus Setup';
|
||||
$GLOBALS['layout_header_title'] = 'Nexus Setup';
|
||||
$GLOBALS['layout_header_context'] = 'Widgets';
|
||||
$GLOBALS['layout_header_text'] = 'Globale Widget-Vorlagen, die andere Nutzer in ihre Dashboards übernehmen können.';
|
||||
?>
|
||||
<div class="module-shell"><div class="module-page-bg"><div class="module-page-stack">
|
||||
<header class="module-hero submenu-box">
|
||||
<div class="module-hero-top module-hero-top--compact">
|
||||
<nav class="module-tabs" aria-label="Nexus Setup Navigation">
|
||||
<a class="module-button module-button--tab" href="/settings">Allgemein</a>
|
||||
<a class="module-button module-button--tab-active" href="/settings/widgets">Widgets</a>
|
||||
<a class="module-button module-button--tab" href="/integrations">Integrationen</a>
|
||||
<a class="module-button module-button--tab" href="/settings/search-engines">Suchmaschinen</a>
|
||||
<a class="module-button module-button--tab" href="/settings/apps">Apps</a>
|
||||
<a class="module-button module-button--tab" href="/dashboards">Dashboards</a>
|
||||
</nav>
|
||||
<div class="module-hero-actions module-submenu-actions">
|
||||
<a class="module-button module-button--secondary module-button--small" href="/">Nexus Übersicht</a>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<?php if ($error !== null): ?>
|
||||
<section class="section-box"><?= e($error) ?></section>
|
||||
<?php elseif ($notice !== null): ?>
|
||||
<section class="section-box"><?= e($notice) ?></section>
|
||||
<?php endif; ?>
|
||||
|
||||
<section class="section-box">
|
||||
<h2>Neue Widget-Vorlage</h2>
|
||||
<form method="post" class="setup-form">
|
||||
<input type="hidden" name="action" value="create_widget">
|
||||
<div class="setup-grid">
|
||||
<label class="setup-field muted">
|
||||
<span>Name</span>
|
||||
<input type="text" name="name" required>
|
||||
</label>
|
||||
<label class="setup-field muted">
|
||||
<span>Typ</span>
|
||||
<select name="widget_type">
|
||||
<option value="link">Link</option>
|
||||
<option value="iframe">iFrame</option>
|
||||
<option value="bookmark_group">Linkliste</option>
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
<div class="setup-grid">
|
||||
<label class="setup-field muted">
|
||||
<span>Beschreibung</span>
|
||||
<input type="text" name="description">
|
||||
</label>
|
||||
<label class="setup-field muted">
|
||||
<span>Ziel-URL</span>
|
||||
<input type="url" name="target_url" placeholder="https://...">
|
||||
</label>
|
||||
</div>
|
||||
<div class="setup-grid">
|
||||
<label class="setup-field muted">
|
||||
<span>Linkliste optional</span>
|
||||
<textarea name="bookmarks" rows="5" placeholder="Name | https://ziel.example Monitoring | https://grafana.example"></textarea>
|
||||
</label>
|
||||
</div>
|
||||
<div class="setup-actions setup-actions--footer">
|
||||
<button class="cta-button" type="submit">Widget speichern</button>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
|
||||
<div class="module-admin-grid">
|
||||
<?php foreach ($widgets as $widget): ?>
|
||||
<article class="card-box module-admin-card">
|
||||
<div class="module-admin-card__head">
|
||||
<div class="module-admin-card__title">
|
||||
<h2><?= e((string) ($widget['name'] ?? 'Widget')) ?></h2>
|
||||
<p><?= e((string) ($widget['description'] ?? 'Globale Widget-Vorlage.')) ?></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="module-admin-meta">
|
||||
<div class="module-admin-meta__item">
|
||||
<span class="module-admin-meta__label">Typ</span>
|
||||
<strong class="module-admin-badge"><?= e((string) ($widget['widget_type'] ?? 'link')) ?></strong>
|
||||
</div>
|
||||
</div>
|
||||
<div class="module-admin-actions">
|
||||
<form method="post">
|
||||
<input type="hidden" name="action" value="delete_widget">
|
||||
<input type="hidden" name="widget_id" value="<?= (int) ($widget['id'] ?? 0) ?>">
|
||||
<button class="module-button module-button--secondary module-button--small" type="submit">Löschen</button>
|
||||
</form>
|
||||
</div>
|
||||
</article>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div></div></div>
|
||||
Reference in New Issue
Block a user