rebuild
This commit is contained in:
78
partials/landingpages/modules/install.php
Normal file
78
partials/landingpages/modules/install.php
Normal file
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
$modules = modules()->all();
|
||||
$error = null;
|
||||
$notice = null;
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
require_admin();
|
||||
$name = (string)($_POST['module'] ?? '');
|
||||
$action = (string)($_POST['action'] ?? '');
|
||||
if ($name !== '' && ($action === 'enable' || $action === 'disable')) {
|
||||
modules()->setEnabled($name, $action === 'enable');
|
||||
$notice = $action === 'enable' ? 'Modul aktiviert.' : 'Modul deaktiviert.';
|
||||
$modules = modules()->all();
|
||||
} else {
|
||||
$error = 'Ungültige Aktion.';
|
||||
}
|
||||
}
|
||||
|
||||
$active = [];
|
||||
$inactive = [];
|
||||
foreach ($modules as $m) {
|
||||
if (!empty($m['enabled'])) {
|
||||
$active[] = $m;
|
||||
} else {
|
||||
$inactive[] = $m;
|
||||
}
|
||||
}
|
||||
?>
|
||||
<?php require_auth(); ?>
|
||||
<div class="card">
|
||||
<div class="pill">Module</div>
|
||||
<h1 style="margin-top:.75rem;">Module installieren/aktivieren</h1>
|
||||
<p class="muted">Erkannte Module basieren auf Ordnern in <code>modules/</code>.</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) ?>
|
||||
</div>
|
||||
<?php elseif ($notice): ?>
|
||||
<div class="card" style="margin-top:1rem; border-color:var(--accent-2);">
|
||||
<?= e($notice) ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<h3 style="margin-top:1.25rem;">Aktive Module</h3>
|
||||
<div style="margin-top:.5rem;" class="grid">
|
||||
<?php foreach ($active as $module): ?>
|
||||
<div class="card" style="background:var(--panel-2);">
|
||||
<strong><?= e($module['title']) ?></strong>
|
||||
<div class="muted" style="font-size:.85rem;"><?= e($module['description'] ?? '') ?></div>
|
||||
<div style="margin-top:.75rem; display:flex; gap:10px;">
|
||||
<a class="nav-link" href="/module/<?= e($module['name']) ?>">Öffnen</a>
|
||||
<form method="post" style="margin:0;">
|
||||
<input type="hidden" name="module" value="<?= e($module['name']) ?>">
|
||||
<button class="cta-button" name="action" value="disable" style="background:var(--panel); color:var(--text);">Deaktivieren</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
|
||||
<h3 style="margin-top:1.5rem;">Deaktivierte Module</h3>
|
||||
<div style="margin-top:.5rem;" class="grid">
|
||||
<?php foreach ($inactive as $module): ?>
|
||||
<div class="card" style="background:var(--panel-2);">
|
||||
<strong><?= e($module['title']) ?></strong>
|
||||
<div class="muted" style="font-size:.85rem;"><?= e($module['description'] ?? '') ?></div>
|
||||
<div style="margin-top:.75rem; display:flex; gap:10px;">
|
||||
<a class="nav-link" href="/modules/setup/<?= e($module['name']) ?>">Setup</a>
|
||||
<form method="post" style="margin:0;">
|
||||
<input type="hidden" name="module" value="<?= e($module['name']) ?>">
|
||||
<button class="cta-button" name="action" value="enable">Aktivieren</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user