forked from laysense/laysite
Expand admin system information and license notices
This commit is contained in:
@@ -1,14 +1,65 @@
|
||||
<?php
|
||||
use App\Content\Licenses;
|
||||
use App\Content\View;
|
||||
|
||||
$e = View::escape(...);
|
||||
?>
|
||||
<header class="admin-heading"><h1><?= $e($title) ?></h1></header>
|
||||
<section class="admin-panel admin-system-info" aria-labelledby="system-info-title">
|
||||
<h2 id="system-info-title">版本与运行环境</h2>
|
||||
<dl>
|
||||
<?php foreach (['LaySite' => $laysiteVersion] + $systemInfo as $name => $value): ?>
|
||||
<div><dt><?= $e($name) ?></dt><dd><?= $e($value) ?></dd></div>
|
||||
<div class="admin-about">
|
||||
<section class="admin-panel admin-system-info" aria-labelledby="system-info-title" data-about-metrics
|
||||
data-cpu-total="<?= $e($metrics['cpu']['total'] ?? '') ?>" data-cpu-idle="<?= $e($metrics['cpu']['idle'] ?? '') ?>">
|
||||
<h2 id="system-info-title">版本与运行环境</h2>
|
||||
<dl>
|
||||
<div><dt>LaySite</dt><dd><?= $e($laysiteVersion) ?></dd></div>
|
||||
<div><dt>CPU 占用</dt><dd data-about-cpu>暂不可用</dd></div>
|
||||
<div><dt>内存占用</dt><dd data-about-memory><?= $e($metrics['memory'] ?? '暂不可用') ?></dd></div>
|
||||
<div><dt>媒体库占用</dt><dd><?= $e($mediaUsage['size']) ?><small>已登记文件,含归档资源</small></dd></div>
|
||||
<?php if ($mediaUsage['free'] !== null): ?>
|
||||
<div><dt>媒体磁盘可用</dt><dd><?= $e($mediaUsage['free']) ?></dd></div>
|
||||
<?php endif ?>
|
||||
</dl>
|
||||
<p class="field-note">CPU 和内存显示当前 Linux 系统可见的用量,页面可见时自动更新。</p>
|
||||
<details class="admin-options admin-about-details">
|
||||
<summary>运行环境详情</summary>
|
||||
<dl>
|
||||
<?php foreach ($systemInfo as $name => $value): ?>
|
||||
<div><dt><?= $e($name) ?></dt><dd><?= $e($value) ?></dd></div>
|
||||
<?php endforeach ?>
|
||||
</dl>
|
||||
</details>
|
||||
</section>
|
||||
<section class="admin-panel admin-licenses" aria-labelledby="system-licenses-title">
|
||||
<h2 id="system-licenses-title">开源许可证</h2>
|
||||
<div class="admin-license-project">
|
||||
<div><strong>LaySite</strong><p>GNU Affero General Public License v3.0(<?= $e(Licenses::PROJECT) ?>)</p></div>
|
||||
<a href="/admin/about/license/laysite" target="_blank" rel="noopener noreferrer">查看许可证全文</a>
|
||||
</div>
|
||||
<details class="admin-options admin-about-details">
|
||||
<summary>第三方项目与许可</summary>
|
||||
<ul class="admin-license-list">
|
||||
<?php foreach ($thirdPartyLicenses as $key => $project): ?>
|
||||
<li>
|
||||
<div>
|
||||
<?php if ($project['url'] !== ''): ?><a href="<?= $e($project['url']) ?>" target="_blank" rel="noopener noreferrer"><?= $e($project['name']) ?></a>
|
||||
<?php else: ?><?= $e($project['name']) ?><?php endif ?>
|
||||
<?php if ($project['version'] !== ''): ?><small><?= $e($project['version']) ?></small><?php endif ?>
|
||||
</div>
|
||||
<div>
|
||||
<span><?= $e($project['license']) ?></span>
|
||||
<?php if ($project['file'] !== null): ?>
|
||||
<a href="/admin/about/license/<?= $e($key) ?>" target="_blank" rel="noopener noreferrer" aria-label="<?= $e('查看 ' . $project['name'] . ' 的许可证全文') ?>">许可全文</a>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
</li>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
</details>
|
||||
</section>
|
||||
<nav class="admin-about-links" aria-label="项目链接">
|
||||
<?php foreach (['LaySite' => 'https://laysense.cn/laysite', 'Laysense' => 'https://laysense.cn'] as $name => $url): ?>
|
||||
<a href="<?= $e($url) ?>" target="_blank" rel="noopener noreferrer">
|
||||
<?= View::fragment('studio-icon', ['icon' => 'external']) ?><strong><?= $e($name) ?></strong><span><?= $e($url) ?></span>
|
||||
</a>
|
||||
<?php endforeach ?>
|
||||
</dl>
|
||||
</section>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
@@ -24,6 +24,9 @@ $active = match (true) {
|
||||
<script src="/assets/jquery-4.0.0.min.js" defer></script>
|
||||
<script src="/assets/admin.js" defer></script>
|
||||
<script src="/assets/studio.js" defer></script>
|
||||
<?php if ($adminPath === '/admin/about'): ?>
|
||||
<script src="/assets/admin-about.js" defer></script>
|
||||
<?php endif ?>
|
||||
<?php if (!empty($pageTemplateDrawer)): ?>
|
||||
<link rel="stylesheet" href="/assets/page-template-drawer.css">
|
||||
<script src="/assets/page-template-drawer.js" defer></script>
|
||||
@@ -75,7 +78,7 @@ $active = match (true) {
|
||||
<label>查找资源<input type="search" data-media-query placeholder="搜索文件名或资源路径"></label>
|
||||
<p data-picker-status role="status"></p>
|
||||
<div class="picker-grid" data-picker-items></div>
|
||||
<a class="back-link" href="/admin/media" target="_blank" rel="noopener">打开媒体库上传</a>
|
||||
<a class="back-link" href="/admin/media" target="_blank" rel="noopener noreferrer">打开媒体库上传</a>
|
||||
</dialog>
|
||||
<?php endif ?>
|
||||
</body>
|
||||
|
||||
@@ -25,13 +25,13 @@ $systemLabel = SystemPage::TYPES[$page['page_type']] ?? null;
|
||||
<?php foreach (['header' => '编辑页头', 'footer' => '编辑页脚'] as $kind => $label): ?>
|
||||
<?php $defaultId = $layoutDefaults[$kind . '_id'] ?? ''; $id = $page[$kind . '_id'] ?? $defaultId; ?>
|
||||
<a class="button button-outline" data-page-layout-editor="<?= $e($kind) ?>" data-default-id="<?= $e($defaultId) ?>"
|
||||
href="<?= $id ? '/admin/pages/' . $e(LayoutPage::slug($kind, $id)) : '/admin/new-page?type=' . $e($kind) ?>" target="_blank" rel="noopener"<?= !($page['visibility'][$kind] ?? true) ? ' hidden' : '' ?>><?= View::fragment('studio-icon', ['icon' => $kind]) ?><?= $e($label) ?></a>
|
||||
href="<?= $id ? '/admin/pages/' . $e(LayoutPage::slug($kind, $id)) : '/admin/new-page?type=' . $e($kind) ?>" target="_blank" rel="noopener noreferrer"<?= !($page['visibility'][$kind] ?? true) ? ' hidden' : '' ?>><?= View::fragment('studio-icon', ['icon' => $kind]) ?><?= $e($label) ?></a>
|
||||
<?php endforeach ?>
|
||||
<button type="button" class="button button-outline" data-open-page-templates hidden><?= View::fragment('studio-icon', ['icon' => 'templates']) ?>整页模板</button>
|
||||
<?php if ($systemLabel): ?><a class="button button-outline" href="/admin/settings"><?= View::fragment('studio-icon', ['icon' => 'settings']) ?>站点设置</a>
|
||||
<?php elseif ($page['status'] === 'published'): ?><?= View::fragment('admin-view-link', ['href' => $path, 'icon' => 'external']) ?><?php endif ?>
|
||||
<?php endif ?>
|
||||
<?= View::fragment('admin-view-link', ['href' => $previewUrl, 'icon' => 'preview', 'label' => '预览页面']) ?>
|
||||
<?= View::fragment('admin-view-link', ['href' => $previewUrl, 'icon' => 'preview', 'label' => '打开预览', 'showLabel' => true]) ?>
|
||||
</div>
|
||||
</header>
|
||||
<?= View::fragment('admin-feedback', compact('error', 'saved')) ?>
|
||||
|
||||
@@ -6,7 +6,12 @@ $label ??= match ($icon) {
|
||||
'external' => '查看公开页面',
|
||||
'preview' => '打开预览',
|
||||
'globe' => '访问网站',
|
||||
default => '打开链接',
|
||||
};
|
||||
$showLabel ??= false;
|
||||
$hint = $e($label . '(在新标签页打开)');
|
||||
?>
|
||||
<a class="button button-outline admin-view-link admin-view-link-<?= $e($icon) ?>" href="<?= $e($href) ?>" target="_blank" rel="noopener" aria-label="<?= $hint ?>" title="<?= $hint ?>"><?= View::fragment('studio-icon', compact('icon')) ?></a>
|
||||
<a class="button button-outline admin-view-link admin-view-link-<?= $e($icon) ?><?= $showLabel ? ' admin-view-link-labelled' : '' ?>"
|
||||
href="<?= $e($href) ?>" target="_blank" rel="noopener noreferrer" aria-label="<?= $hint ?>" title="<?= $hint ?>">
|
||||
<?= View::fragment('studio-icon', compact('icon')) ?><?php if ($showLabel): ?><span><?= $e($label) ?></span><?php endif ?>
|
||||
</a>
|
||||
|
||||
@@ -28,4 +28,4 @@ $paths = [
|
||||
'archive' => '<rect x="4" y="4" width="16" height="4" rx="1"/><path d="M5 8v12h14V8m-9 4h4"/>',
|
||||
];
|
||||
?>
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><?= $paths[$icon] ?></svg>
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><?= $paths[$icon] ?? $paths['external'] ?></svg>
|
||||
|
||||
@@ -43,7 +43,7 @@ $previewRoot = '/assets/page-templates/';
|
||||
<div class="page-template-detail">
|
||||
<div>
|
||||
<div class="page-template-image"><img data-template-preview width="768" height="480" alt=""></div>
|
||||
<a class="button button-outline admin-view-link admin-view-link-preview page-template-preview-link" data-template-live target="_blank" rel="noopener"
|
||||
<a class="button button-outline admin-view-link admin-view-link-preview page-template-preview-link" data-template-live target="_blank" rel="noopener noreferrer"
|
||||
aria-label="预览整页模板(在新标签页打开)" title="预览整页模板(在新标签页打开)"><?= View::fragment('studio-icon', ['icon' => 'preview']) ?></a>
|
||||
</div>
|
||||
<form class="admin-form" method="post" action="/admin/new-page">
|
||||
|
||||
Reference in New Issue
Block a user