forked from laysense/laysite
Launch LaySite visual editor and MCP workspace
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
<?php use App\Content\View; $e = View::escape(...); ?>
|
||||
<section class="section"><div class="wrap account-panel">
|
||||
<h1>用户中心</h1>
|
||||
<?php if ($error !== ''): ?><p role="alert"><?= $e($error) ?></p><?php endif ?>
|
||||
<?php if ($profile): ?>
|
||||
<?php if ($profile['avatar'] !== ''): ?><img class="account-avatar" src="<?= $e($profile['avatar']) ?>" width="56" height="56" alt=""><?php endif ?>
|
||||
<p><?= $e($profile['name']) ?></p>
|
||||
<form method="post" action="/account/logout">
|
||||
<input type="hidden" name="token" value="<?= $e($profile['logout']) ?>">
|
||||
<button class="button button-outline" type="submit">退出登录</button>
|
||||
</form>
|
||||
<?php else: ?><p>请从站点页头登录。</p><?php endif ?>
|
||||
<p><a href="/">返回首页</a></p>
|
||||
</div></section>
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
use App\Content\View;
|
||||
|
||||
$e = View::escape(...);
|
||||
?>
|
||||
<a class="back-link" href="/admin/articles">返回文章列表</a>
|
||||
<header class="admin-heading"><h1>文章分类</h1></header>
|
||||
<?= View::fragment('admin-feedback', compact('error', 'saved')) ?>
|
||||
<form class="admin-form admin-panel" method="post" action="/admin/article-categories">
|
||||
<input type="hidden" name="csrf" value="<?= $e($token) ?>">
|
||||
<div class="form-grid">
|
||||
<label>分类名称<input name="name" value="<?= $e($name) ?>" required maxlength="60"></label>
|
||||
<label>网址标识<input name="slug" value="<?= $e($slug) ?>" required maxlength="60" pattern="[a-z0-9]+(-[a-z0-9]+)*"></label>
|
||||
</div>
|
||||
<div class="form-submit"><button class="button button-primary" type="submit">创建分类</button></div>
|
||||
</form>
|
||||
<nav class="filter-nav" aria-label="查看分类">
|
||||
<?php foreach ($categories as $key => $label): ?>
|
||||
<a href="/admin/articles?category=<?= $e($key) ?>"><?= $e($label) ?></a>
|
||||
<?php endforeach ?>
|
||||
</nav>
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
use App\Content\View;
|
||||
|
||||
$e = View::escape(...);
|
||||
?>
|
||||
<?php if ($articles): ?>
|
||||
<ul class="admin-list">
|
||||
<?php foreach ($articles as $item): ?>
|
||||
<li>
|
||||
<div><strong><?= $e($item['title']) ?></strong>
|
||||
<small><?= $e(implode('、', $item['categories'])) ?> · <?= $item['status'] === 'published' ? '已发布' : '草稿' ?> · <?= $e(View::date($item['updated_at'])) ?></small>
|
||||
</div>
|
||||
<a class="button button-outline" href="/admin/articles/<?= $e($item['id']) ?>">编辑文章</a>
|
||||
</li>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
<?php else: ?>
|
||||
<p class="empty-state">暂无文章。</p>
|
||||
<?php endif ?>
|
||||
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
use App\Content\Repository;
|
||||
use App\Content\View;
|
||||
|
||||
$e = View::escape(...);
|
||||
?>
|
||||
<a class="back-link" href="/admin/articles">返回文章列表</a>
|
||||
<header class="admin-heading">
|
||||
<h1><?= $e($title) ?></h1>
|
||||
<?php if ($articleId && $article['status'] === 'published' && $article['slug'] !== ''): ?>
|
||||
<a class="button button-outline" href="/articles/<?= $e($article['slug']) ?>">查看公开页面</a>
|
||||
<?php endif ?>
|
||||
</header>
|
||||
<?= View::fragment('admin-feedback', compact('error', 'saved')) ?>
|
||||
<form class="admin-form admin-panel" method="post" action="/admin/articles/<?= $e($articleId ?? 'new') ?>">
|
||||
<input type="hidden" name="csrf" value="<?= $e($token) ?>">
|
||||
<input type="hidden" name="version" value="<?= $e($article['version']) ?>">
|
||||
<label>文章标题<input name="title" value="<?= $e($article['title']) ?>" required maxlength="120"></label>
|
||||
<label>网址标识<input name="slug" value="<?= $e($article['slug']) ?>" required maxlength="100" pattern="[a-z0-9]+(-[a-z0-9]+)*" placeholder="product-update"><small>使用小写英文字母、数字和连字符。</small></label>
|
||||
<?= View::fragment('admin-category-checkboxes', ['name' => 'categories', 'selected' => array_keys($article['categories']), 'categories' => $categories, 'legend' => '文章分类(可多选)']) ?>
|
||||
<label>标签<input name="tags" value="<?= $e(implode(',', $article['tags'])) ?>" placeholder="用逗号分隔"></label>
|
||||
<label>摘要<textarea name="summary" rows="2" maxlength="250"><?= $e($article['summary']) ?></textarea><small>用于动态列表和搜索摘要。</small></label>
|
||||
<div class="article-editor" data-article-editor>
|
||||
<div class="article-editor-heading">
|
||||
<label for="article-source" data-article-editor-label>正文</label>
|
||||
<button type="button" class="button button-outline" data-insert-article-image hidden>从媒体库插入图片</button>
|
||||
</div>
|
||||
<input type="hidden" name="body_format" value="<?= $e($article['body_format']) ?>">
|
||||
<textarea id="article-source" name="body" rows="16" aria-label="文章正文"><?= $e($article['body']) ?></textarea>
|
||||
<div data-editor-host hidden></div>
|
||||
<p class="article-editor-help" data-article-editor-status role="status"></p>
|
||||
</div>
|
||||
<details class="admin-options" <?= array_intersect(array_keys($article['categories']), array_keys(Repository::DIRECTORIES)) ? 'open' : '' ?>>
|
||||
<summary>目录卡片</summary>
|
||||
<div class="form-grid">
|
||||
<?= View::fragment('studio-asset-field', ['name' => 'card_image', 'label' => '封面或标志', 'value' => $article['card']['image'] ?? '']) ?>
|
||||
<label>图片替代文字<input name="card_alt" value="<?= $e($article['card']['alt'] ?? '') ?>" maxlength="120"></label>
|
||||
<label>主链接<input name="card_url" value="<?= $e($article['card']['url'] ?? '') ?>"></label>
|
||||
<label>主链接文字<input name="card_label" value="<?= $e($article['card']['label'] ?? '') ?>" maxlength="120"></label>
|
||||
<label>附加链接<input name="card_extra_url" value="<?= $e($article['card']['extra_url'] ?? '') ?>"></label>
|
||||
<label>附加链接文字<input name="card_extra_label" value="<?= $e($article['card']['extra_label'] ?? '') ?>" maxlength="120"></label>
|
||||
<label>类型说明<input name="card_category_label" value="<?= $e($article['card']['category_label'] ?? '') ?>" maxlength="120"></label>
|
||||
<label>目录排序(从小到大)<input name="card_position" type="number" min="0" max="9999" value="<?= $e($article['card']['position'] ?? 0) ?>"></label>
|
||||
</div>
|
||||
</details>
|
||||
<div class="form-submit">
|
||||
<label>发布状态<select name="status">
|
||||
<option value="draft" <?= $article['status'] === 'draft' ? 'selected' : '' ?>>草稿</option>
|
||||
<option value="published" <?= $article['status'] === 'published' ? 'selected' : '' ?>>已发布</option>
|
||||
</select></label>
|
||||
<button class="button button-primary" type="submit">保存文章</button>
|
||||
</div>
|
||||
</form>
|
||||
<?php if ($articleId !== null): ?>
|
||||
<details class="admin-panel admin-options">
|
||||
<summary>删除文章</summary>
|
||||
<form method="post" action="/admin/articles/<?= $e($articleId) ?>/delete">
|
||||
<input type="hidden" name="csrf" value="<?= $e($token) ?>">
|
||||
<input type="hidden" name="version" value="<?= $e($article['version']) ?>">
|
||||
<p class="field-note">删除后,文章及其目录卡片会从网站移除,且无法恢复。</p>
|
||||
<button class="button button-danger" type="submit">永久删除</button>
|
||||
</form>
|
||||
</details>
|
||||
<?php endif ?>
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
use App\Content\View;
|
||||
|
||||
$e = View::escape(...);
|
||||
$filters = $category ? 'category=' . rawurlencode($category) . '&' : '';
|
||||
|
||||
?>
|
||||
<header class="admin-heading">
|
||||
<h1>文章与动态</h1>
|
||||
<div class="actions">
|
||||
<a class="button button-outline" href="/admin/article-categories">管理分类</a>
|
||||
<a class="button button-primary" href="/admin/articles/new<?= $category ? '?category=' . $e($category) : '' ?>">新建文章</a>
|
||||
</div>
|
||||
</header>
|
||||
<?php if ($deleted): ?><p class="feedback success" role="status">文章已删除。</p><?php endif ?>
|
||||
<nav class="filter-nav" aria-label="筛选文章">
|
||||
<a href="/admin/articles" <?= $category === null ? 'aria-current="page"' : '' ?>>全部</a>
|
||||
<?php foreach ($categories as $key => $name): ?>
|
||||
<a href="/admin/articles?category=<?= $e($key) ?>" <?= $category === (string) $key ? 'aria-current="page"' : '' ?>><?= $e($name) ?></a>
|
||||
<?php endforeach ?>
|
||||
</nav>
|
||||
<div class="admin-panel">
|
||||
<?= View::fragment('admin-article-list', ['articles' => $articles]) ?>
|
||||
</div>
|
||||
<?php if ($pageNumber > 1 || $hasNext): ?>
|
||||
<nav class="pagination" aria-label="文章分页">
|
||||
<?php if ($pageNumber > 1): ?><a class="button button-outline" href="/admin/articles?<?= $e($filters) ?>page=<?= $pageNumber - 1 ?>">上一页</a><?php endif ?>
|
||||
<span>第 <?= $pageNumber ?> 页</span>
|
||||
<?php if ($hasNext): ?><a class="button button-outline" href="/admin/articles?<?= $e($filters) ?>page=<?= $pageNumber + 1 ?>">下一页</a><?php endif ?>
|
||||
</nav>
|
||||
<?php endif ?>
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php use App\Content\View; $e = View::escape(...); ?>
|
||||
<a class="back-link" href="/admin/design">返回站点设计</a>
|
||||
<header class="admin-heading"><h1>站点备份</h1><a class="button button-outline" href="/admin/backup/download">导出备份</a></header>
|
||||
<?php if ($restored): ?><p class="feedback success" role="status">站点已还原。</p><?php endif ?>
|
||||
<?= View::fragment('admin-feedback', ['error' => $error, 'saved' => false]) ?>
|
||||
<section class="admin-panel">
|
||||
<h2>从备份还原</h2>
|
||||
<p>还原会替换现有页面、文章、设计配置及媒体目录记录。先导出当前站点,再选择需要还原的文件。</p>
|
||||
<form class="admin-form" method="post" action="/admin/backup" enctype="multipart/form-data">
|
||||
<input type="hidden" name="csrf" value="<?= $e($token) ?>">
|
||||
<label>LaySite 备份<input type="file" name="backup" accept=".tar,application/x-tar" required></label>
|
||||
<label><span><input type="checkbox" name="replace" value="1" required> 确认替换站点内容</span></label>
|
||||
<div class="form-submit"><button class="button button-danger" type="submit" data-confirm="使用这份备份替换当前站点?">还原站点</button></div>
|
||||
</form>
|
||||
</section>
|
||||
@@ -0,0 +1,4 @@
|
||||
<?php if (is_file(public_path('assets/system/laysite-mark.webp'))): ?>
|
||||
<img class="laysite-mark" src="/assets/system/laysite-mark.webp" alt="" width="42" height="42">
|
||||
<?php endif ?>
|
||||
<span>LaySite</span>
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
use App\Content\View;
|
||||
|
||||
$e = View::escape(...);
|
||||
$checked = array_fill_keys($selected, true);
|
||||
?>
|
||||
<fieldset class="category-checks">
|
||||
<legend><?= $e($legend) ?></legend>
|
||||
<div>
|
||||
<?php foreach ($categories as $key => $label): ?>
|
||||
<label><input type="checkbox" name="<?= $e($name) ?>[]" value="<?= $e($key) ?>" <?= isset($checked[$key]) ? 'checked' : '' ?>> <?= $e($label) ?></label>
|
||||
<?php endforeach ?>
|
||||
</div>
|
||||
</fieldset>
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
use App\Content\View;
|
||||
|
||||
$e = View::escape(...);
|
||||
$live = count(array_filter($pages, static fn (array $page): bool => $page['status'] === 'published'));
|
||||
?>
|
||||
<header class="admin-heading dashboard-heading">
|
||||
<h1>网站后台</h1>
|
||||
<div class="actions">
|
||||
<a class="button button-primary" href="/admin/new-page">新建页面</a>
|
||||
<button type="button" class="button button-outline" data-open-page-templates hidden>整页模板</button>
|
||||
<a class="button button-outline" href="/admin/articles/new">写文章</a>
|
||||
</div>
|
||||
</header>
|
||||
<div class="dashboard-grid">
|
||||
<section class="admin-panel dashboard-pages" aria-labelledby="pages-title" data-page-list>
|
||||
<div class="admin-heading compact">
|
||||
<h2 id="pages-title">网站页面</h2>
|
||||
<p class="field-note"><?= $live ?> 个已发布 · <?= count($pages) - $live ?> 个草稿</p>
|
||||
</div>
|
||||
<div class="dashboard-filters" data-page-filters hidden>
|
||||
<label>查找页面<input type="search" data-page-search placeholder="页面名称或地址"></label>
|
||||
<label>发布状态<select data-page-status>
|
||||
<option value="">全部状态</option>
|
||||
<option value="published">已发布</option>
|
||||
<option value="draft">草稿</option>
|
||||
</select></label>
|
||||
</div>
|
||||
<p class="empty-state" data-page-empty role="status"<?= $pages ? ' hidden' : '' ?>><?= $pages ? '没有匹配的页面。' : '暂无页面。' ?></p>
|
||||
<ul class="admin-list dashboard-page-list">
|
||||
<?php foreach ($pages as $page): ?>
|
||||
<?php $path = $page['slug'] === 'home' ? '/' : '/' . $page['slug']; $published = $page['status'] === 'published'; ?>
|
||||
<li data-page-item="<?= $e($page['status']) ?>" data-page-label="<?= $e($page['name'] . ' ' . $page['title'] . ' ' . $path) ?>">
|
||||
<div class="dashboard-page-label"><strong><?= $e($page['name']) ?></strong><small><?= $e($path) ?></small></div>
|
||||
<span class="dashboard-page-state" data-published="<?= $published ? 'true' : 'false' ?>"><?= $published ? '已发布' : '草稿' ?></span>
|
||||
<div class="dashboard-page-actions">
|
||||
<a class="button button-outline" href="/admin/pages/<?= $e($page['slug']) ?>">编辑页面</a>
|
||||
<a href="<?= $e($published ? $path : '/admin/pages/' . $page['slug'] . '/preview') ?>" target="_blank" rel="noopener"><?= $published ? '查看' : '预览' ?></a>
|
||||
</div>
|
||||
</li>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
</section>
|
||||
<div class="dashboard-secondary">
|
||||
<section class="admin-panel" aria-labelledby="recent-title">
|
||||
<div class="admin-heading compact"><h2 id="recent-title">最近编辑的文章</h2></div>
|
||||
<?= View::fragment('admin-article-list', ['articles' => $articles]) ?>
|
||||
<a class="back-link" href="/admin/articles">管理全部文章</a>
|
||||
</section>
|
||||
<section class="admin-panel dashboard-settings" aria-labelledby="quick-title">
|
||||
<h2 id="quick-title">站点编辑</h2>
|
||||
<ul class="dashboard-setting-buttons">
|
||||
<li><a class="button button-outline" href="/admin/design/header/new">新建页头</a></li>
|
||||
<li><a class="button button-outline" href="/admin/design/footer/new">新建页脚</a></li>
|
||||
<li><a class="button button-outline" href="/admin/settings">站点设置</a></li>
|
||||
<li><a class="button button-outline" href="/admin/media">打开媒体库</a></li>
|
||||
</ul>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
<?= View::fragment('studio-page-templates', compact('token')) ?>
|
||||
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
use App\Content\Buttons;
|
||||
use App\Content\DesignLibrary;
|
||||
use App\Content\SiteDesign;
|
||||
use App\Content\View;
|
||||
|
||||
$e = View::escape(...);
|
||||
$data = $item['payload'];
|
||||
$action = $data['action'][0] ?? [];
|
||||
$provider = $data['provider'] ?? [];
|
||||
?>
|
||||
<a class="back-link" href="/admin/design">返回站点设计</a>
|
||||
<header class="admin-heading">
|
||||
<h1><?= $e(['header' => '页头组件', 'footer' => '页脚组件', 'palette' => '配色方案'][$kind]) ?></h1>
|
||||
<?php if ($key !== 'new'): ?><a class="button button-outline" href="/admin/design/<?= $e($kind) ?>/<?= $e($key) ?>/preview" target="_blank" rel="noopener noreferrer">预览已保存的配置</a><?php endif ?>
|
||||
</header>
|
||||
<?= View::fragment('admin-feedback', compact('error', 'saved')) ?>
|
||||
<form class="admin-form admin-panel" method="post" action="/admin/design/<?= $e($kind) ?>/<?= $e($key) ?>">
|
||||
<input type="hidden" name="csrf" value="<?= $e($token) ?>">
|
||||
<input type="hidden" name="version" value="<?= $e($item['version']) ?>">
|
||||
<label>配置名称<input name="name" maxlength="100" value="<?= $e($item['name']) ?>" required></label>
|
||||
<label>布局模板<select name="preset" data-layout-preset>
|
||||
<?php foreach (DesignLibrary::PRESETS[$kind] as $preset => $label): ?>
|
||||
<option value="<?= $e($preset) ?>" <?= $preset === $item['preset'] ? 'selected' : '' ?>><?= $e($label) ?></option>
|
||||
<?php endforeach ?>
|
||||
</select></label>
|
||||
<?php if ($kind === 'palette'): ?>
|
||||
<div class="palette-fields">
|
||||
<?php foreach (DesignLibrary::COLORS as $color => [$label, $fallback]): ?>
|
||||
<label><?= $e($label) ?><input type="color" name="<?= $e($color) ?>" value="<?= $e($data[$color] ?? $fallback) ?>"></label>
|
||||
<?php endforeach ?>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<fieldset class="admin-options"><legend>组件及顺序</legend>
|
||||
<ul class="admin-list layout-components" data-layout-components>
|
||||
<?php foreach (array_unique([...$data['components'], ...array_keys(DesignLibrary::COMPONENTS[$kind])]) as $component): ?>
|
||||
<li><label><input type="checkbox" name="components[]" value="<?= $e($component) ?>" <?= in_array($component, $data['components'], true) ? 'checked' : '' ?>><?= $e(DesignLibrary::COMPONENTS[$kind][$component]) ?></label>
|
||||
<div class="actions"><button type="button" class="button button-outline" data-component-move="-1">上移</button><button type="button" class="button button-outline" data-component-move="1">下移</button></div></li>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
</fieldset>
|
||||
<div class="form-grid">
|
||||
<label>品牌名称<input name="brand" maxlength="100" value="<?= $e($data['brand']) ?>"></label>
|
||||
<?= View::fragment('studio-asset-field', ['name' => 'logo', 'label' => '品牌图片', 'value' => $data['logo']]) ?>
|
||||
</div>
|
||||
<label>链接列表<textarea name="links" rows="4"><?= $e(SiteDesign::linkText($data['links'])) ?></textarea><small>每行填写「名称 | 链接」。</small></label>
|
||||
<?php if ($kind === 'header'): ?>
|
||||
<fieldset class="admin-options form-grid"><legend>行动按钮</legend>
|
||||
<label>文案<input name="action_label" maxlength="70" value="<?= $e($action[1] ?? '') ?>"></label>
|
||||
<label>链接<input name="action_url" maxlength="1000" value="<?= $e($action[0] ?? '') ?>"></label>
|
||||
<label>样式<select name="action_style"><?php foreach (Buttons::STYLES as $style => $label): ?>
|
||||
<option value="<?= $e($style) ?>" <?= ($action[2] ?? 'outline') === $style ? 'selected' : '' ?>><?= $e($label) ?></option>
|
||||
<?php endforeach ?></select></label>
|
||||
<label><span><input type="checkbox" name="action_blank" value="1" <?= !empty($action[3]) ? 'checked' : '' ?>> 在新标签页打开</span></label>
|
||||
</fieldset>
|
||||
<fieldset class="admin-options form-grid" data-provider-settings><legend>用户区认证</legend>
|
||||
<label>认证方式<select name="provider_mode"><option value="">关闭</option>
|
||||
<?php foreach (['oidc' => 'OpenID Connect', 'oauth2' => 'OAuth 2.0 + 用户资料'] as $mode => $label): ?>
|
||||
<option value="<?= $e($mode) ?>" <?= ($provider['mode'] ?? '') === $mode ? 'selected' : '' ?>><?= $e($label) ?></option>
|
||||
<?php endforeach ?>
|
||||
</select></label>
|
||||
<label>客户端 ID<input name="provider_client_id" value="<?= $e($provider['client_id'] ?? '') ?>"></label>
|
||||
<label>客户端密钥环境变量<input name="provider_secret_env" value="<?= $e($provider['secret_env'] ?? '') ?>" placeholder="LAYSITE_OAUTH_MEMBER_SECRET"></label>
|
||||
<label>令牌端点认证<select name="provider_token_auth">
|
||||
<?php foreach (['' => '自动', 'client_secret_basic' => 'HTTP Basic', 'client_secret_post' => '表单客户端密钥'] as $method => $label): ?>
|
||||
<option value="<?= $e($method) ?>" <?= ($provider['token_auth'] ?? '') === $method ? 'selected' : '' ?>><?= $e($label) ?></option>
|
||||
<?php endforeach ?>
|
||||
</select></label>
|
||||
<label>权限范围<input name="provider_scope" value="<?= $e($provider['scope'] ?? '') ?>" placeholder="openid profile email"></label>
|
||||
<label data-provider-mode="oidc">OIDC Issuer<input name="provider_issuer" value="<?= $e($provider['issuer'] ?? '') ?>" placeholder="https://id.example.com"></label>
|
||||
<?php foreach (['authorization' => '授权端点', 'token' => '令牌端点', 'userinfo' => '用户资料端点', 'subject_field' => '用户 ID 字段', 'name_field' => '名称字段', 'avatar_field' => '头像字段'] as $field => $label): ?>
|
||||
<label data-provider-mode="oauth2"><?= $e($label) ?><input name="provider_<?= $e($field) ?>" value="<?= $e($provider[$field] ?? '') ?>"></label>
|
||||
<?php endforeach ?>
|
||||
<p class="field-note">回调地址 <code><?= $e(View::absolute('/account/callback')) ?></code></p>
|
||||
</fieldset>
|
||||
<?php else: ?>
|
||||
<label>说明文字<textarea name="text" rows="3"><?= $e($data['text']) ?></textarea></label>
|
||||
<label>版权文字<input name="legal" value="<?= $e($data['legal']) ?>"></label>
|
||||
<?php endif ?>
|
||||
<label><span><input type="checkbox" name="make_default" value="1" <?= $default ? 'checked' : '' ?>> 用作站点默认<?= $kind === 'header' ? '页头' : '页脚' ?></span></label>
|
||||
<?php endif ?>
|
||||
<button type="submit" class="button button-primary">保存配置</button>
|
||||
</form>
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
use App\Content\View;
|
||||
|
||||
$e = View::escape(...);
|
||||
?>
|
||||
<header class="admin-heading"><h1>站点设计</h1><div class="actions"><a class="button button-outline" href="/admin/settings">站点设置</a><a class="button button-outline" href="/admin/backup">站点备份</a></div></header>
|
||||
<div class="design-overview">
|
||||
<?php foreach (['header' => '页头', 'footer' => '页脚', 'palette' => '配色方案'] as $kind => $label): ?>
|
||||
<section class="admin-panel">
|
||||
<div class="admin-heading compact"><h2><?= $e($label) ?></h2><a class="button button-outline" href="/admin/design/<?= $e($kind) ?>/new">新建<?= $e($label) ?></a></div>
|
||||
<?php $group = array_filter($items, static fn (array $item): bool => $item['kind'] === $kind); ?>
|
||||
<?php if (!$group): ?><p class="field-note">暂无自定义配置。</p><?php endif ?>
|
||||
<ul class="admin-list">
|
||||
<?php foreach ($group as $item): ?>
|
||||
<li><strong><?= $e($item['name']) ?></strong>
|
||||
<?php if (($site[$kind . '_id'] ?? null) === $item['id']): ?><small>站点默认</small><?php endif ?>
|
||||
<a class="button button-outline" href="/admin/design/<?= $e($kind) ?>/<?= $e($item['id']) ?>">编辑</a>
|
||||
</li>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
</section>
|
||||
<?php endforeach ?>
|
||||
</div>
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
use App\Content\View;
|
||||
use App\Content\Html;
|
||||
|
||||
$e = View::escape(...);
|
||||
?>
|
||||
<div class="editor" data-editor data-format="<?= $format ?>">
|
||||
<label for="editor-text">正文(<?= $format === 'markdown' ? 'Markdown' : 'HTML' ?>)</label>
|
||||
<div class="editor-toolbar">
|
||||
<div role="group" aria-label="插入格式">
|
||||
<button type="button" data-insert="heading">小标题</button>
|
||||
<button type="button" data-insert="bold">粗体</button>
|
||||
<button type="button" data-insert="list">列表</button>
|
||||
<button type="button" data-insert="link">链接</button>
|
||||
</div>
|
||||
<?php if ($format === 'html'): ?>
|
||||
<button type="button" data-rich-media>插入媒体</button>
|
||||
<button type="button" data-source-toggle aria-pressed="false">HTML 源码</button>
|
||||
<?php else: ?>
|
||||
<button data-preview-button type="button" aria-controls="editor-preview" aria-expanded="false">预览正文</button>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
<?php if ($format === 'html'): ?>
|
||||
<div class="rich studio-rich" contenteditable="true" role="textbox" aria-multiline="true" aria-label="可视化正文" data-rich-canvas hidden><?= Html::sanitize($body) ?></div>
|
||||
<p class="field-note" data-rich-status role="status" hidden></p>
|
||||
<?php endif ?>
|
||||
<textarea id="editor-text" name="body" rows="15" spellcheck="false"><?= $e($body) ?></textarea>
|
||||
<?php if ($format === 'html'): ?>
|
||||
<p class="field-note">可以直接编辑文字,插入链接、图片、音视频。复杂区块可切换到 HTML 源码调整。</p>
|
||||
<?php endif ?>
|
||||
<div class="editor-preview rich prose" id="editor-preview" aria-live="polite" hidden></div>
|
||||
</div>
|
||||
@@ -0,0 +1,2 @@
|
||||
<h1><?= App\Content\View::escape($title) ?></h1>
|
||||
<a class="button button-primary" href="/admin">返回内容管理</a>
|
||||
@@ -0,0 +1,3 @@
|
||||
<?php use App\Content\View; ?>
|
||||
<?php if ($error): ?><p class="feedback error" role="alert"><?= View::escape($error) ?></p><?php endif ?>
|
||||
<?php if ($saved && !$error): ?><p class="feedback success" data-save-confirmation role="status">已保存。</p><?php endif ?>
|
||||
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
use App\Content\View;
|
||||
|
||||
$e = View::escape(...);
|
||||
$active = match (true) {
|
||||
str_starts_with($adminPath, '/admin/article') => 'articles',
|
||||
str_starts_with($adminPath, '/admin/media') => 'media',
|
||||
str_starts_with($adminPath, '/admin/settings') || str_starts_with($adminPath, '/admin/design') || str_starts_with($adminPath, '/admin/backup') => 'settings',
|
||||
$adminPath === '/admin/password' => '',
|
||||
default => 'pages',
|
||||
};
|
||||
?>
|
||||
<!doctype html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="robots" content="noindex, nofollow">
|
||||
<link rel="icon" href="/assets/system/laysite-mark.webp" type="image/webp">
|
||||
<title><?= $e($title) ?> CMS</title>
|
||||
<link rel="stylesheet" href="/assets/site.css">
|
||||
<link rel="stylesheet" href="/assets/admin.css">
|
||||
<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 (!empty($pageTemplateDrawer)): ?>
|
||||
<link rel="stylesheet" href="/assets/page-template-drawer.css">
|
||||
<script src="/assets/page-template-drawer.js" defer></script>
|
||||
<?php endif ?>
|
||||
<?php if (!empty($articleEditor)): ?>
|
||||
<link rel="stylesheet" href="/assets/vendor/toastui/toastui-editor.min.css">
|
||||
<script src="/assets/vendor/toastui/toastui-editor.min.js" defer></script>
|
||||
<script src="/assets/vendor/toastui/zh-cn.js" defer></script>
|
||||
<script src="/assets/article-editor.js" defer></script>
|
||||
<?php endif ?>
|
||||
</head>
|
||||
<body class="admin-body">
|
||||
<a class="skip-link" href="#admin-content">跳到内容</a>
|
||||
<header class="admin-bar">
|
||||
<div class="admin-wrap admin-bar-inner">
|
||||
<a class="wordmark" href="/admin" aria-label="LaySite 后台"><?= View::fragment('admin-brand') ?></a>
|
||||
<?php if ($user): ?>
|
||||
<nav class="admin-primary" aria-label="后台导航">
|
||||
<a href="/admin"<?= $active === 'pages' ? ' aria-current="page"' : '' ?>>页面</a>
|
||||
<a href="/admin/articles"<?= $active === 'articles' ? ' aria-current="page"' : '' ?>>文章</a>
|
||||
<a href="/admin/media"<?= $active === 'media' ? ' aria-current="page"' : '' ?>>媒体库</a>
|
||||
<a href="/admin/design"<?= $active === 'settings' ? ' aria-current="page"' : '' ?>>站点设计</a>
|
||||
</nav>
|
||||
<div class="admin-utility">
|
||||
<a href="/">访问网站</a>
|
||||
<details class="admin-account">
|
||||
<summary>账户</summary>
|
||||
<div class="admin-account-menu">
|
||||
<a href="/admin/password">修改密码</a>
|
||||
<form method="post" action="/admin/logout">
|
||||
<input type="hidden" name="csrf" value="<?= $e($token) ?>">
|
||||
<button type="submit">退出登录</button>
|
||||
</form>
|
||||
</div>
|
||||
</details>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<a class="back-link" href="/">返回网站</a>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
</header>
|
||||
<main class="admin-wrap admin-main<?= !empty($wideAdmin) ? ' admin-wide' : '' ?>" id="admin-content"><?= $content ?></main>
|
||||
<?php if ($user): ?>
|
||||
<dialog class="media-picker" id="media-picker" aria-labelledby="picker-heading">
|
||||
<header class="admin-heading compact"><h2 id="picker-heading">从媒体库选择</h2><button class="button button-outline" type="button" data-close-picker>关闭</button></header>
|
||||
<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>
|
||||
</dialog>
|
||||
<?php endif ?>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
use App\Content\View;
|
||||
|
||||
$e = View::escape(...);
|
||||
?>
|
||||
<div class="login-box">
|
||||
<h1>登录内容管理</h1>
|
||||
<p>管理网站页面、媒体和文章。</p>
|
||||
<?php if ($error): ?><p class="feedback error" role="alert"><?= $e($error) ?></p><?php endif ?>
|
||||
<form class="admin-form" method="post" action="/admin/login">
|
||||
<input type="hidden" name="csrf" value="<?= $e($token) ?>">
|
||||
<label>管理员邮箱<input name="email" type="email" value="<?= $e($email) ?>" autocomplete="username" required maxlength="254"></label>
|
||||
<label>密码<input name="password" type="password" autocomplete="current-password" required></label>
|
||||
<button class="button button-primary" type="submit">登录</button>
|
||||
</form>
|
||||
<p class="field-note">忘记密码时,可请服务器管理员通过命令行重设。</p>
|
||||
</div>
|
||||
@@ -0,0 +1,173 @@
|
||||
<?php
|
||||
use App\Content\Buttons;
|
||||
use App\Content\Database;
|
||||
use App\Content\SiteDesign;
|
||||
use App\Content\View;
|
||||
|
||||
$e = View::escape(...);
|
||||
$slug = $page['slug'];
|
||||
$path = $slug === 'home' ? '/' : '/' . $slug;
|
||||
$previewUrl = '/admin/pages/' . $slug . '/preview';
|
||||
?>
|
||||
<a class="back-link" href="/admin">返回页面</a>
|
||||
<header class="admin-heading">
|
||||
<div><h1><?= $e($title) ?></h1><p class="studio-page-meta"><code><?= $e($path) ?></code>
|
||||
<span class="dashboard-page-state" data-published="<?= $page['status'] === 'published' ? 'true' : 'false' ?>"><?= $page['status'] === 'draft' ? '草稿' : '已发布' ?></span></p></div>
|
||||
<div class="actions">
|
||||
<a class="button button-outline" href="#studio-page-settings">页面设置</a>
|
||||
<button type="button" class="button button-outline" data-open-page-templates hidden>整页模板</button>
|
||||
<?php if ($page['status'] === 'published'): ?><a class="button button-outline" href="<?= $e($path) ?>">公开页面</a><?php endif ?>
|
||||
<a class="button button-outline" href="<?= $e($previewUrl) ?>" target="_blank" rel="noopener">打开预览</a>
|
||||
</div>
|
||||
</header>
|
||||
<?= View::fragment('admin-feedback', compact('error', 'saved')) ?>
|
||||
<div class="studio-layout">
|
||||
<aside class="admin-panel studio-library" aria-labelledby="studio-library-title">
|
||||
<h2 id="studio-library-title">页面编辑</h2>
|
||||
<?= View::fragment('studio-templates', [
|
||||
'layers' => View::fragment('studio-layers', compact('page', 'slug', 'token')),
|
||||
'anchorForm' => View::fragment('studio-anchor-form', compact('slug', 'token')),
|
||||
]) ?>
|
||||
</aside>
|
||||
<div class="studio-workspace">
|
||||
<section class="admin-panel studio-preview" data-preview-studio aria-labelledby="studio-preview-title">
|
||||
<div class="admin-heading compact">
|
||||
<h2 id="studio-preview-title">页面画布</h2>
|
||||
<div class="preview-selector" aria-label="预览尺寸">
|
||||
<button type="button" class="button button-outline" data-preview-size="desktop" aria-pressed="true">桌面</button>
|
||||
<button type="button" class="button button-outline" data-preview-size="phone" aria-pressed="false">手机</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="editor-toolbar studio-canvas-toolbar" data-canvas-toolbar hidden aria-label="正文工具">
|
||||
<div>
|
||||
<button type="button" data-canvas-command="heading">小标题</button>
|
||||
<button type="button" data-canvas-command="bold">粗体</button>
|
||||
<button type="button" data-canvas-command="list">列表</button>
|
||||
<button type="button" data-canvas-command="link">插入链接</button>
|
||||
<button type="button" data-canvas-command="media">插入媒体</button>
|
||||
</div>
|
||||
<button class="button button-primary" form="studio-page-settings" type="submit">保存页面</button>
|
||||
</div>
|
||||
<div class="studio-frame-window">
|
||||
<iframe title="可编辑页面画布" src="<?= $e($previewUrl) ?>?canvas=1" sandbox="allow-same-origin"></iframe>
|
||||
<div class="studio-element-tools" data-element-tools role="group" aria-label="所选元素" hidden>
|
||||
<div class="studio-element-align" data-element-align role="group" aria-label="对齐">
|
||||
<?php foreach (['left' => '居左', 'center' => '居中', 'right' => '居右'] as $value => $label): ?>
|
||||
<button type="button" data-align="<?= $value ?>" aria-pressed="false" aria-label="<?= $label ?>" title="<?= $label ?>"><?= View::fragment('studio-icon', ['icon' => $value]) ?></button>
|
||||
<?php endforeach ?>
|
||||
</div>
|
||||
<?php foreach (['module-settings' => ['settings', '模块设置'], 'properties' => ['edit', '属性'], 'copy' => ['copy', '复制'], 'delete' => ['delete', '删除']] as $action => [$icon, $label]): ?>
|
||||
<button type="button" data-element-<?= $action ?> aria-label="<?= $label ?>" title="<?= $label ?>"><?= View::fragment('studio-icon', compact('icon')) ?></button>
|
||||
<?php endforeach ?>
|
||||
</div>
|
||||
<button class="studio-media-handle" type="button" role="slider" aria-label="媒体宽度" aria-valuemin="10" aria-valuemax="100" aria-valuenow="100" data-media-handle hidden></button>
|
||||
<div class="studio-media-sizing" data-media-sizing hidden>
|
||||
<output data-media-size aria-hidden="true"></output>
|
||||
<button class="button button-outline" type="button" data-reset-media>原始尺寸</button>
|
||||
<button class="button button-outline" type="button" data-replace-media>替换媒体</button>
|
||||
</div>
|
||||
</div>
|
||||
<p class="field-note studio-canvas-status" data-canvas-status role="status"></p>
|
||||
<dialog class="media-picker canvas-properties" data-canvas-properties aria-labelledby="canvas-properties-heading">
|
||||
<div class="admin-heading compact"><h2 id="canvas-properties-heading" data-property-heading>编辑属性</h2></div>
|
||||
<form class="admin-form" method="dialog">
|
||||
<label data-property-row="label">文案<input name="label"></label>
|
||||
<label data-property-row="note">副标题<input name="note" maxlength="200"></label>
|
||||
<label data-property-row="url">地址<input name="url" maxlength="1000"></label>
|
||||
<label data-property-row="buttonStyle">按钮样式<select name="buttonStyle">
|
||||
<?php foreach (Buttons::STYLES as $style => $label): ?><option value="<?= $e($style) ?>"><?= $e($label) ?></option><?php endforeach ?>
|
||||
</select></label>
|
||||
<label data-property-row="newTab">打开方式<select name="newTab"><option value="0">当前标签页</option><option value="1">新标签页</option></select></label>
|
||||
<label data-property-row="alt">图片替代文本<input name="alt" maxlength="200"></label>
|
||||
<label data-property-row="quicklinks">目录链接<textarea name="quicklinks" rows="5" placeholder="概览 | #overview"></textarea><small>每行填写「文案 | 链接」。</small></label>
|
||||
<label data-property-row="value">当前值<input name="value" inputmode="numeric"></label>
|
||||
<label data-property-row="max">最大值<input name="max" inputmode="numeric"></label>
|
||||
<label data-property-row="poster">视频封面<input name="poster" maxlength="1000"></label>
|
||||
<p class="feedback error" role="alert" data-property-error hidden></p>
|
||||
<div class="actions">
|
||||
<button type="button" class="button button-outline" data-property-pick="url">从媒体库选择</button>
|
||||
<button type="button" class="button button-outline" data-property-pick="poster">选择视频封面</button>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<button type="submit" class="button button-primary">应用</button>
|
||||
<button type="button" class="button button-outline" data-property-close>取消</button>
|
||||
</div>
|
||||
</form>
|
||||
</dialog>
|
||||
<dialog class="media-picker canvas-module-settings" data-module-dialog aria-labelledby="module-settings-title">
|
||||
<div class="admin-heading compact"><h2 id="module-settings-title">模块设置</h2></div>
|
||||
<form class="admin-form" method="dialog">
|
||||
<label>模块标题<input name="module_title" maxlength="100" required></label>
|
||||
<label>模块简介<textarea name="module_lead" rows="2" maxlength="500"></textarea></label>
|
||||
<?= View::fragment('studio-feed-fields', ['categories' => $categories, 'feed' => [], 'allowOff' => false]) ?>
|
||||
<p class="feedback error" role="alert" data-module-error hidden></p>
|
||||
<div class="actions">
|
||||
<button class="button button-primary" type="submit">应用</button>
|
||||
<button class="button button-outline" data-module-close type="button">取消</button>
|
||||
</div>
|
||||
</form>
|
||||
</dialog>
|
||||
</section>
|
||||
</div>
|
||||
<form id="studio-page-settings" class="admin-form admin-panel studio-inspector" method="post" action="/admin/pages/<?= $e($slug) ?>">
|
||||
<h2>页面设置</h2>
|
||||
<input type="hidden" name="csrf" value="<?= $e($token) ?>">
|
||||
<input type="hidden" name="version" value="<?= $e($page['version']) ?>">
|
||||
<input type="hidden" name="canvas_sections" value="">
|
||||
<input type="hidden" name="alignments" value="<?= $e(Database::json($page['alignments'])) ?>">
|
||||
<details class="studio-hero-settings">
|
||||
<summary>首屏与目录</summary>
|
||||
<div class="studio-hero-controls">
|
||||
<button class="button button-outline" type="button" disabled data-hero-control="image">首屏图片</button>
|
||||
<button class="button button-outline" type="button" disabled data-hero-control="add-action">添加首屏按钮</button>
|
||||
<button class="button button-outline" type="button" disabled data-hero-control="navigation">本页目录</button>
|
||||
</div>
|
||||
</details>
|
||||
<label>页面名称<input name="name" value="<?= $e($page['name']) ?>" required maxlength="100"></label>
|
||||
<label>SEO 标题<input name="title" value="<?= $e($page['title']) ?>" required maxlength="160"></label>
|
||||
<label>SEO 描述<textarea name="description" rows="2" maxlength="300"><?= $e($page['description']) ?></textarea></label>
|
||||
<fieldset class="admin-options form-grid">
|
||||
<legend>页面显示</legend>
|
||||
<?php foreach (['header' => '页头', 'hero' => '首屏', 'footer' => '页脚'] as $area => $label): ?>
|
||||
<?php $visible = $page['visibility'][$area] ?? true; ?>
|
||||
<label><?= $e($label) ?><select name="show_<?= $e($area) ?>">
|
||||
<option value="1" <?= $visible ? 'selected' : '' ?>>显示</option>
|
||||
<option value="0" <?= !$visible ? 'selected' : '' ?>>隐藏</option>
|
||||
</select></label>
|
||||
<?php endforeach ?>
|
||||
</fieldset>
|
||||
<fieldset class="admin-options form-grid"><legend>页头、页脚与配色</legend>
|
||||
<?php foreach (['header' => '页头方案', 'footer' => '页脚方案', 'palette' => '配色方案'] as $kind => $label): ?>
|
||||
<label><?= $e($label) ?><select name="<?= $e($kind) ?>_id">
|
||||
<option value=""><?= $kind === 'palette' ? '页面原有配色' : '站点默认' ?></option>
|
||||
<?php foreach ($designs as $item): ?>
|
||||
<?php if ($item['kind'] !== $kind) continue; ?>
|
||||
<option value="<?= $e($item['id']) ?>" <?= ($page[$kind . '_id'] ?? null) === $item['id'] ? 'selected' : '' ?>><?= $e($item['name']) ?></option>
|
||||
<?php endforeach ?>
|
||||
</select></label>
|
||||
<?php endforeach ?>
|
||||
<a href="/admin/design" target="_blank" rel="noopener noreferrer">管理设计配置</a>
|
||||
</fieldset>
|
||||
<textarea name="hero_actions" hidden><?= $e(Database::json(Buttons::validate($page['actions']))) ?></textarea>
|
||||
<?php
|
||||
$contentFields = [
|
||||
'heading' => $page['heading'], 'accent' => $page['accent'], 'lead' => $page['lead'],
|
||||
'image' => $page['image'], 'alt' => $page['alt'], 'image_scale' => $page['image_scale'],
|
||||
'quicklinks' => SiteDesign::linkText($page['quicklinks']),
|
||||
];
|
||||
?>
|
||||
<?php foreach ($contentFields as $field => $value): ?>
|
||||
<?php if ($field === 'quicklinks'): ?>
|
||||
<textarea name="quicklinks" hidden><?= $e($value) ?></textarea>
|
||||
<?php else: ?>
|
||||
<input type="hidden" name="<?= $e($field) ?>" value="<?= $e($value) ?>">
|
||||
<?php endif ?>
|
||||
<?php endforeach ?>
|
||||
<?php if ($slug !== 'home'): ?>
|
||||
<label>发布状态<select name="status"><option value="draft" <?= $page['status'] === 'draft' ? 'selected' : '' ?>>草稿</option>
|
||||
<option value="published" <?= $page['status'] === 'published' ? 'selected' : '' ?>>已发布</option></select></label>
|
||||
<?php endif ?>
|
||||
<div class="form-submit"><button class="button button-primary" type="submit">保存页面</button></div>
|
||||
</form>
|
||||
</div>
|
||||
<?= View::fragment('studio-page-templates', compact('token')) ?>
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
use App\Content\View;
|
||||
|
||||
$e = View::escape(...);
|
||||
?>
|
||||
<header class="admin-heading"><h1><?= $e($title) ?></h1></header>
|
||||
<?= View::fragment('admin-feedback', compact('error', 'saved')) ?>
|
||||
<form class="admin-form admin-panel password-form" method="post" action="/admin/password">
|
||||
<input type="hidden" name="csrf" value="<?= $e($token) ?>">
|
||||
<label>当前密码<input name="current_password" type="password" autocomplete="current-password" required></label>
|
||||
<label>新密码<input name="new_password" type="password" autocomplete="new-password" minlength="8" required><small>至少 8 个字符,最多 72 字节。</small></label>
|
||||
<label>再次输入新密码<input name="confirm_password" type="password" autocomplete="new-password" minlength="8" required></label>
|
||||
<div class="form-submit"><button class="button button-primary" type="submit">修改密码</button></div>
|
||||
</form>
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
use App\Content\View;
|
||||
|
||||
$e = View::escape(...);
|
||||
$slug = $section['page_slug'];
|
||||
$key = $section['key'];
|
||||
$feed = json_decode($section['feed'] ?? '{}', true, flags: JSON_THROW_ON_ERROR);
|
||||
?>
|
||||
<a class="back-link" href="/admin/pages/<?= $e($slug) ?>">返回页面编辑</a>
|
||||
<header class="admin-heading">
|
||||
<div><h1><?= $e($title) ?></h1><p><?= $e($slug) ?> · #<?= $e($key) ?></p></div>
|
||||
<a class="button button-outline" href="/admin/pages/<?= $e($slug) ?>/preview#<?= $e($key) ?>" target="_blank" rel="noopener">预览区块</a>
|
||||
</header>
|
||||
<?= View::fragment('admin-feedback', compact('error', 'saved')) ?>
|
||||
<form class="admin-form admin-panel" method="post" action="/admin/pages/<?= $e($slug) ?>/<?= $e($key) ?>">
|
||||
<input type="hidden" name="csrf" value="<?= $e($token) ?>">
|
||||
<input type="hidden" name="version" value="<?= $e($section['version']) ?>">
|
||||
<label>区块标题<input name="title" value="<?= $e($section['title']) ?>" required maxlength="100"></label>
|
||||
<label>区块简介<textarea name="lead" rows="2" maxlength="500"><?= $e($section['lead']) ?></textarea></label>
|
||||
<?php if ($savedStyle !== 'hero-links'): ?>
|
||||
<label>区块背景<select name="style">
|
||||
<?php foreach (array_unique([$savedStyle, 'plain', 'tinted']) as $style): ?>
|
||||
<option value="<?= $e($style) ?>" <?= $style === $section['style'] ? 'selected' : '' ?>><?= $e(['plain' => '默认', 'tinted' => '浅色背景'][$style] ?? '保留原布局') ?></option>
|
||||
<?php endforeach ?>
|
||||
</select></label>
|
||||
<details class="admin-options" <?= $feed ? 'open' : '' ?>>
|
||||
<summary>动态模块</summary>
|
||||
<?= View::fragment('studio-feed-fields', ['categories' => $categories, 'feed' => $feed, 'allowOff' => true]) ?>
|
||||
</details>
|
||||
<?php endif ?>
|
||||
<?= View::fragment('admin-editor', ['format' => 'html', 'body' => $section['body']]) ?>
|
||||
<div class="form-submit"><button class="button button-primary" type="submit">保存区块</button></div>
|
||||
</form>
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
use App\Content\View;
|
||||
|
||||
$e = View::escape(...);
|
||||
?>
|
||||
<section class="section article-page" aria-labelledby="archive-title" data-enter>
|
||||
<div class="wrap">
|
||||
<div class="section-heading">
|
||||
<?php if ($backPath): ?><a class="back-link" href="<?= $e($backPath) ?>"><?= $e($backLabel) ?></a><?php endif ?>
|
||||
<h1 id="archive-title"><?= $e($headline) ?></h1>
|
||||
<p><?= $e($description) ?></p>
|
||||
</div>
|
||||
<nav class="filter-nav" aria-label="动态分类">
|
||||
<a href="<?= $e($allPath) ?>" <?= !$category && !$tag ? 'aria-current="page"' : '' ?>>全部</a>
|
||||
<?php foreach ($categories as $key => $label): ?>
|
||||
<a href="<?= $e($categoryLinks[$key]) ?>" <?= $category === (string) $key ? 'aria-current="page"' : '' ?>><?= $e($label) ?></a>
|
||||
<?php endforeach ?>
|
||||
</nav>
|
||||
<?php if (!empty($catalog)): ?>
|
||||
<?= View::fragment('service-cards', ['products' => $articles]) ?>
|
||||
<?php else: ?>
|
||||
<?= View::fragment('article-list', ['articles' => $articles, 'categoryScope' => $categoryScope ?? null]) ?>
|
||||
<?php endif ?>
|
||||
<?php if ($pageNumber > 1 || $hasNext): ?>
|
||||
<nav class="pagination" aria-label="动态分页">
|
||||
<?php if ($pageNumber > 1): ?><a class="button button-outline" href="<?= $e(View::archivePage($archivePath, $pageNumber - 1)) ?>" rel="prev">上一页</a><?php endif ?>
|
||||
<span>第 <?= $e($pageNumber) ?> 页</span>
|
||||
<?php if ($hasNext): ?><a class="button button-outline" href="<?= $e(View::archivePage($archivePath, $pageNumber + 1)) ?>" rel="next">下一页</a><?php endif ?>
|
||||
</nav>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
</section>
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
use App\Content\View;
|
||||
|
||||
$e = View::escape(...);
|
||||
?>
|
||||
<div class="article-feed" <?= count($groups) > 1 ? 'data-article-tabs' : '' ?>>
|
||||
<?php if (count($groups) > 1): ?>
|
||||
<div class="filter-nav article-tabs" data-tab-list role="tablist" aria-labelledby="heading-<?= $e($sectionKey) ?>" hidden>
|
||||
<?php foreach ($groups as $index => $group): ?>
|
||||
<button type="button" role="tab" id="<?= $e($sectionKey) ?>-tab-<?= $index ?>" aria-controls="<?= $e($sectionKey) ?>-articles-<?= $index ?>"><?= $e($group['label']) ?></button>
|
||||
<?php endforeach ?>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
<?php foreach ($groups as $index => $group): ?>
|
||||
<div id="<?= $e($sectionKey) ?>-articles-<?= $index ?>" data-tab-panel>
|
||||
<?php if ($group['label'] !== ''): ?><h3 data-tab-heading><?= $e($group['label']) ?></h3><?php endif ?>
|
||||
<?= View::fragment('article-list', ['articles' => $group['articles'], 'categoryScope' => $group['categories']]) ?>
|
||||
</div>
|
||||
<?php endforeach ?>
|
||||
<?php if ($archivePath !== null): ?>
|
||||
<p class="article-feed-archive"><a class="back-link" href="<?= $e($archivePath) ?>">查看全部动态</a></p>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
use App\Content\View;
|
||||
|
||||
$e = View::escape(...);
|
||||
$scope = isset($categoryScope) ? array_flip($categoryScope) : null;
|
||||
?>
|
||||
<?php if ($articles): ?>
|
||||
<ul class="article-list">
|
||||
<?php foreach ($articles as $item): ?>
|
||||
<?php $labels = $scope === null ? $item['categories'] : array_intersect_key($item['categories'], $scope); ?>
|
||||
<li>
|
||||
<a class="article-row" href="/articles/<?= $e($item['slug']) ?>">
|
||||
<span class="article-category"><?= $e(implode('、', $labels)) ?></span>
|
||||
<span class="article-row-title"><?= $e($item['title']) ?>
|
||||
<?php if ($item['summary']): ?><small><?= $e($item['summary']) ?></small><?php endif ?>
|
||||
</span>
|
||||
<?php if ($item['published_at']): ?><time datetime="<?= $e(View::date($item['published_at'], 'Y-m-d')) ?>"><?= $e(View::date($item['published_at'], 'Y.m.d')) ?></time><?php endif ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
<?php else: ?>
|
||||
<p class="empty-state">暂无已发布的动态。</p>
|
||||
<?php endif ?>
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
use App\Content\View;
|
||||
|
||||
$e = View::escape(...);
|
||||
?>
|
||||
<article class="section article-page" itemscope itemtype="https://schema.org/Article" data-enter>
|
||||
<?php $card = $article['card']; ?>
|
||||
<div class="wrap reading-wrap">
|
||||
<a class="back-link" href="/articles">全部动态</a>
|
||||
<header class="section-heading">
|
||||
<div class="article-meta">
|
||||
<?php foreach ($article['categories'] as $key => $name): ?>
|
||||
<a href="/articles/category/<?= $e($key) ?>" itemprop="articleSection"><?= $e($name) ?></a>
|
||||
<?php endforeach ?>
|
||||
<?php if ($article['published_at']): ?><time itemprop="datePublished" datetime="<?= $e(View::date($article['published_at'], DATE_ATOM)) ?>"><?= $e(View::date($article['published_at'])) ?></time><?php endif ?>
|
||||
<meta itemprop="dateModified" content="<?= $e(View::date($article['updated_at'], DATE_ATOM)) ?>">
|
||||
</div>
|
||||
<h1 itemprop="headline"><?= $e($article['title']) ?></h1>
|
||||
<?php if ($article['summary']): ?><p itemprop="description"><?= $e($article['summary']) ?></p><?php endif ?>
|
||||
<span itemprop="author" itemscope itemtype="https://schema.org/Organization"><meta itemprop="name" content="<?= $e($site['name']) ?>"></span>
|
||||
</header>
|
||||
<?php if (!empty($card['image'])): ?>
|
||||
<img class="article-cover" src="<?= $e($card['image']) ?>" alt="<?= $e($card['alt'] ?? '') ?>">
|
||||
<?php endif ?>
|
||||
<div class="rich prose" itemprop="articleBody">
|
||||
<?php if (trim($articleHtml) !== ''): ?>
|
||||
<?= $articleHtml ?>
|
||||
<?php elseif (!$article['summary'] && empty($card['image']) && empty($card['url'])): ?>
|
||||
<p class="empty-state">此文章的原文暂不可用。</p>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
<?php if (!empty($card['url']) || !empty($card['extra_url'])): ?>
|
||||
<div class="actions">
|
||||
<?php if (!empty($card['url'])): ?><a class="button button-primary" href="<?= $e($card['url']) ?>"><?= $e(($card['label'] ?? '') ?: '访问网站') ?></a><?php endif ?>
|
||||
<?php if (!empty($card['extra_url'])): ?><a href="<?= $e($card['extra_url']) ?>"><?= $e(($card['extra_label'] ?? '') ?: '相关链接') ?></a><?php endif ?>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
<?php if ($article['tags']): ?>
|
||||
<nav class="filter-nav" aria-label="文章标签">
|
||||
<?php foreach ($article['tags'] as $tag): ?>
|
||||
<a href="/articles/tag/<?= $e(rawurlencode($tag)) ?>"><?= $e($tag) ?></a>
|
||||
<?php endforeach ?>
|
||||
</nav>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
</article>
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
use App\Content\View;
|
||||
|
||||
$e = View::escape(...);
|
||||
$data = $footer['payload'];
|
||||
$brand = $data['brand'] ?: $site['name'];
|
||||
?>
|
||||
<footer class="site-footer site-footer-<?= $e($footer['preset']) ?>" id="contact"<?= $showFooter ? '' : ' hidden' ?>>
|
||||
<div class="wrap site-footer-components">
|
||||
<?php foreach ($data['components'] as $component): ?>
|
||||
<?php if ($component === 'brand'): ?>
|
||||
<a class="wordmark site-brand" href="/" aria-label="<?= $e($brand) ?>,首页">
|
||||
<?php if ($data['logo'] !== ''): ?><img src="<?= $e($data['logo']) ?>" alt="<?= $e($brand) ?>" loading="lazy"><?php else: ?><?= $e($brand) ?><?php endif ?>
|
||||
</a>
|
||||
<?php elseif ($component === 'text' && $data['text'] !== ''): ?>
|
||||
<p class="site-footer-text"><?= $e($data['text']) ?></p>
|
||||
<?php elseif ($component === 'links' && $data['links']): ?>
|
||||
<nav class="site-footer-nav" aria-label="页脚导航">
|
||||
<?php foreach ($data['links'] as [$url, $label]): ?><a href="<?= $e($url) ?>"><?= $e($label) ?></a><?php endforeach ?>
|
||||
</nav>
|
||||
<?php elseif ($component === 'legal' && $data['legal'] !== ''): ?>
|
||||
<small><?= $e($data['legal']) ?></small>
|
||||
<?php endif ?>
|
||||
<?php endforeach ?>
|
||||
</div>
|
||||
</footer>
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
use App\Content\Buttons;
|
||||
use App\Content\View;
|
||||
|
||||
$e = View::escape(...);
|
||||
$data = $header['payload'];
|
||||
$brand = $data['brand'] ?: $site['name'];
|
||||
$member = $header['preset'] === 'member' && $data['provider'] !== [];
|
||||
?>
|
||||
<header class="masthead masthead-<?= $e($header['preset']) ?>"<?= $showHeader ? '' : ' hidden' ?>>
|
||||
<div class="wrap masthead-inner">
|
||||
<?php foreach ($data['components'] as $component): ?>
|
||||
<?php if ($component === 'brand'): ?>
|
||||
<a class="wordmark site-brand" href="/" aria-label="<?= $e($brand) ?>,首页">
|
||||
<?php if ($data['logo'] !== ''): ?><img src="<?= $e($data['logo']) ?>" alt="<?= $e($brand) ?>"><?php else: ?><?= $e($brand) ?><?php endif ?>
|
||||
</a>
|
||||
<?php elseif ($component === 'links' && $data['links']): ?>
|
||||
<button class="menu-toggle" type="button" aria-expanded="false" aria-controls="primary-navigation" hidden>
|
||||
<span></span><span></span><span class="sr-only">菜单</span>
|
||||
</button>
|
||||
<nav id="primary-navigation" class="primary-nav" aria-label="主导航">
|
||||
<?php foreach ($data['links'] as [$url, $label]): ?>
|
||||
<a href="<?= $e($url) ?>"<?= $url === $path ? ' aria-current="page"' : '' ?>><?= $e($label) ?></a>
|
||||
<?php endforeach ?>
|
||||
</nav>
|
||||
<?php elseif ($component === 'action' && $data['action']): ?>
|
||||
<?php [$url, $label, $style, $blank] = $data['action'][0]; ?>
|
||||
<a class="<?= $e(Buttons::css($style)) ?> masthead-action" href="<?= $e($url) ?>"<?= Buttons::target($blank) ?>><?= $e($label) ?></a>
|
||||
<?php elseif ($component === 'account' && $member): ?>
|
||||
<?php if ($visitor): ?>
|
||||
<a class="site-account" href="/account" aria-label="打开用户中心">
|
||||
<?php if ($visitor['avatar'] !== ''): ?><img class="account-avatar" src="<?= $e($visitor['avatar']) ?>" alt="" width="36" height="36"><?php else: ?>
|
||||
<span class="account-avatar account-initial" aria-hidden="true"><?= $e(mb_substr($visitor['name'], 0, 1)) ?></span>
|
||||
<?php endif ?>
|
||||
</a>
|
||||
<?php else: ?>
|
||||
<a class="button button-outline site-account" href="/account/login/<?= $e($header['id']) ?>">登录</a>
|
||||
<?php endif ?>
|
||||
<?php endif ?>
|
||||
<?php endforeach ?>
|
||||
</div>
|
||||
</header>
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
use App\Content\View;
|
||||
use App\Content\Assets;
|
||||
use App\Content\DesignLibrary;
|
||||
|
||||
$e = View::escape(...);
|
||||
$canonical = $path !== null && empty($previewMode) ? View::absolute($path) : null;
|
||||
$imageUrl = !empty($socialImage) ? Assets::url($socialImage, $cdn) : '';
|
||||
if (str_starts_with($imageUrl, '/')) {
|
||||
$imageUrl = View::absolute($imageUrl);
|
||||
}
|
||||
$theme = $page['theme'] ?? '';
|
||||
$palette = DesignLibrary::find((int) ($page['palette_id'] ?? 0), 'palette');
|
||||
$showHeader = $page['visibility']['header'] ?? true;
|
||||
$showFooter = $page['visibility']['footer'] ?? true;
|
||||
?>
|
||||
<!doctype html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title><?= $e($title) ?></title>
|
||||
<meta name="description" content="<?= $e($description) ?>">
|
||||
<meta name="theme-color" content="#f5f7fb">
|
||||
<?php if ($canonical): ?>
|
||||
<link rel="canonical" href="<?= $e($canonical) ?>">
|
||||
<meta property="og:url" content="<?= $e($canonical) ?>">
|
||||
<?php endif ?>
|
||||
<?php if (!empty($noindex)): ?><meta name="robots" content="noindex"><?php endif ?>
|
||||
<meta property="og:type" content="<?= isset($article) ? 'article' : 'website' ?>">
|
||||
<meta property="og:locale" content="zh_CN">
|
||||
<meta property="og:site_name" content="<?= $e($site['name']) ?>">
|
||||
<meta property="og:title" content="<?= $e($title) ?>">
|
||||
<meta property="og:description" content="<?= $e($description) ?>">
|
||||
<?php if ($imageUrl !== ''): ?>
|
||||
<meta property="og:image" content="<?= $e($imageUrl) ?>">
|
||||
<meta property="og:image:alt" content="<?= $e($socialAlt ?? '') ?>">
|
||||
<?php endif ?>
|
||||
<?php if (isset($article)): ?>
|
||||
<meta property="article:published_time" content="<?= $e(View::date($article['published_at'], DATE_ATOM)) ?>">
|
||||
<meta property="article:modified_time" content="<?= $e(View::date($article['updated_at'], DATE_ATOM)) ?>">
|
||||
<?php endif ?>
|
||||
<meta name="twitter:card" content="summary_large_image">
|
||||
<link rel="stylesheet" href="/assets/site.css">
|
||||
<?php if ($theme !== ''): ?><link rel="stylesheet" href="/assets/page-themes.css"><?php endif ?>
|
||||
<?php if ($palette): ?><link rel="stylesheet" data-page-palette href="/palette/<?= $e($palette['id']) ?>.css?v=<?= $e($palette['version']) ?>"><?php endif ?>
|
||||
<script src="/assets/jquery-4.0.0.min.js" defer></script>
|
||||
<script src="/assets/site.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
<a class="skip-link" href="#main-content">跳到内容</a>
|
||||
<?php if ($showHeader || !empty($canvas)): ?>
|
||||
<?= View::fragment('header', compact('header', 'site', 'showHeader', 'visitor', 'path')) ?>
|
||||
<?php endif ?>
|
||||
<main id="main-content"<?= $theme !== '' ? ' class="page-theme theme-' . $e($theme) . '"' : '' ?> tabindex="-1"><?= $content ?></main>
|
||||
<?php if ($showFooter || !empty($canvas)): ?>
|
||||
<?= View::fragment('footer', compact('footer', 'site', 'showFooter')) ?>
|
||||
<?php endif ?>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,8 @@
|
||||
<section class="section article-page">
|
||||
<div class="wrap">
|
||||
<p class="overline">404</p>
|
||||
<h1>页面未找到</h1>
|
||||
<p>请检查网址,或回到首页浏览产品与服务。</p>
|
||||
<a class="button button-primary" href="/">返回首页</a>
|
||||
</div>
|
||||
</section>
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
use App\Content\DirectoryCard;
|
||||
use App\Content\Html;
|
||||
use App\Content\View;
|
||||
|
||||
$e = View::escape(...);
|
||||
?>
|
||||
<ul class="network-list">
|
||||
<?php foreach ($articles as $item): ?>
|
||||
<?php
|
||||
$card = $item['card'];
|
||||
['primary' => $target, 'detail' => $detail] = DirectoryCard::links($item, Html::articleBody($item));
|
||||
?>
|
||||
<li>
|
||||
<?php if ($target !== ''): ?><a href="<?= $e($target) ?>"><?php else: ?><span class="network-static"><?php endif ?>
|
||||
<?php if (!empty($card['image'])): ?>
|
||||
<img src="<?= $e($card['image']) ?>" alt="" loading="lazy" width="76" height="28">
|
||||
<?php endif ?>
|
||||
<span><?= $e($item['title']) ?></span>
|
||||
<?php if ($target !== ''): ?></a><?php else: ?></span><?php endif ?>
|
||||
<?php if ($standalone && $detail !== ''): ?>
|
||||
<a class="network-detail" href="<?= $e($detail) ?>">查看详情</a>
|
||||
<?php endif ?>
|
||||
</li>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
use App\Content\Buttons;
|
||||
use App\Content\View;
|
||||
|
||||
$e = View::escape(...);
|
||||
$home = $page['slug'] === 'home';
|
||||
$showHero = $page['visibility']['hero'] ?? true;
|
||||
$heroLinks = array_filter($page['sections'], static fn (array $section): bool => $section['style'] === 'hero-links');
|
||||
$alignments = $page['alignments'];
|
||||
$alignField = static fn (string $name): string => $canvas ? ' data-studio-align-field="' . $name . '"' : '';
|
||||
$field = static fn (string $name): string => $canvas ? ' data-studio-field="' . $name . '"' : '';
|
||||
?>
|
||||
<?php if (!$showHero && !$canvas): ?><h1 class="sr-only"><?= $e($page['name']) ?></h1><?php endif ?>
|
||||
<?php if ($showHero || $canvas || $heroLinks): ?>
|
||||
<section class="hero hero-<?= $e($page['slug']) ?>" id="home" data-enter>
|
||||
<?php if ($showHero || $canvas): ?>
|
||||
<div class="wrap hero-inner<?= $page['image'] === '' ? ' hero-text-only' : '' ?>"<?= $canvas ? ' data-studio-hero-content' : '' ?><?= $showHero ? '' : ' hidden' ?>>
|
||||
<div class="hero-copy">
|
||||
<?php if (!$home): ?>
|
||||
<nav class="breadcrumbs" aria-label="面包屑" itemscope itemtype="https://schema.org/BreadcrumbList">
|
||||
<span itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
|
||||
<a itemprop="item" href="/"><span itemprop="name">首页</span></a>
|
||||
<meta itemprop="position" content="1">
|
||||
</span>
|
||||
<span class="crumb-divider" aria-hidden="true">/</span>
|
||||
<span itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
|
||||
<a itemprop="item" href="/<?= $e($page['slug']) ?>" aria-current="page"><span itemprop="name"<?= $field('name') ?>><?= $e($page['name']) ?></span></a>
|
||||
<meta itemprop="position" content="2">
|
||||
</span>
|
||||
</nav>
|
||||
<?php else: ?>
|
||||
<p class="overline hero-label"><?= $e($site['name']) ?></p>
|
||||
<?php endif ?>
|
||||
<h1<?= isset($alignments['heading']) ? ' class="' . trim(View::alignmentClass($alignments['heading'])) . '"' : '' ?><?= $alignField('heading') ?>><span class="hero-heading-primary"<?= $field('heading') ?>><?= $e($page['heading']) ?></span><?php if ($canvas): ?><span class="studio-accent"<?= $field('accent') ?>><?= $e($page['accent']) ?></span><?php elseif ($page['accent'] !== ''): ?><br><span><?= $e($page['accent']) ?></span><?php endif ?></h1>
|
||||
<p class="hero-lead<?= View::alignmentClass($alignments['lead'] ?? null) ?>"<?= $field('lead') ?><?= $alignField('lead') ?>><?= $e($page['lead']) ?></p>
|
||||
<div class="actions hero-actions<?= View::alignmentClass($alignments['actions'] ?? null) ?>"<?= $alignField('actions') ?>>
|
||||
<?php foreach (Buttons::validate($page['actions']) as $index => [$url, $label, $style, $blank]): ?>
|
||||
<a class="<?= $e(Buttons::css($style)) ?>" href="<?= $e($url) ?>"<?= Buttons::target($blank) ?><?= $canvas ? ' data-studio-action="' . $index . '"' : '' ?>><?= $e($label) ?></a>
|
||||
<?php endforeach ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php if ($canvas || $page['image'] !== ''): ?>
|
||||
<div class="hero-visual app-frame<?= $page['image_scale'] ? ' studio-media-' . $e($page['image_scale']) : '' ?><?= View::alignmentClass($alignments['image'] ?? null) ?>" data-visual<?= $alignField('image') ?><?= $page['image'] === '' ? ' hidden' : '' ?>>
|
||||
<img<?= $page['image'] === '' ? '' : ' src="' . $e($page['image']) . '"' ?> alt="<?= $e($page['alt']) ?>" width="1448" height="1086" fetchpriority="high"<?= $canvas ? ' data-studio-hero-image' : '' ?>>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
<?php foreach ($heroLinks as $section): ?>
|
||||
<?= View::fragment('section', ['section' => $section, 'moment' => false, 'canvas' => $canvas, 'pageSlug' => $page['slug']]) ?>
|
||||
<?php endforeach ?>
|
||||
</section>
|
||||
<?php endif ?>
|
||||
<?php if ($canvas || $page['quicklinks']): ?>
|
||||
<nav class="section-nav" aria-label="本页目录"<?= $canvas ? ' data-studio-navigation' : '' ?><?= !$page['quicklinks'] ? ' hidden' : '' ?>>
|
||||
<div class="wrap section-nav-inner">
|
||||
<?php foreach ($page['quicklinks'] as [$url, $label]): ?>
|
||||
<a href="<?= $e($url) ?>"><?= $e($label) ?></a>
|
||||
<?php endforeach ?>
|
||||
</div>
|
||||
</nav>
|
||||
<?php endif ?>
|
||||
<?php foreach ($page['sections'] as $section): ?>
|
||||
<?php if ($section['style'] !== 'hero-links'): ?>
|
||||
<?= View::fragment('section', ['section' => $section, 'moment' => false, 'canvas' => $canvas, 'pageSlug' => $page['slug']]) ?>
|
||||
<?php endif ?>
|
||||
<?php endforeach ?>
|
||||
<?php if ($canvas): ?>
|
||||
<template data-studio-section-end><?= View::fragment('section', [
|
||||
'section' => ['style' => 'plain', 'key' => 'new', 'version' => null, 'title' => '', 'lead' => '', 'body' => ''],
|
||||
'moment' => false, 'canvas' => true,
|
||||
]) ?></template>
|
||||
<?php endif ?>
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
use App\Content\View;
|
||||
|
||||
$e = View::escape(...);
|
||||
$canvas ??= false;
|
||||
$body = $section['body'];
|
||||
$dynamic = isset($section['feed']);
|
||||
$studio = $canvas ? ' data-studio-section="' . $e($section['version']) . '" data-studio-source="' . $e(base64_encode($section['body'])) . '"' : '';
|
||||
if ($canvas && $dynamic) {
|
||||
$studio .= ' data-studio-dynamic data-studio-feed="' . $e($section['feed']) . '" tabindex="0"';
|
||||
}
|
||||
if ($section['style'] === 'hero-links'):
|
||||
?>
|
||||
<div class="wrap hero-directory-slot" id="<?= $e($section['key']) ?>"<?= $studio ?>>
|
||||
<?php if ($canvas): ?><span data-studio-part="title" hidden><?= $e($section['title']) ?></span><span data-studio-part="lead" hidden><?= $e($section['lead']) ?></span><?php endif ?>
|
||||
<div<?= $canvas ? ' data-studio-part="body"' : '' ?>><?= $body ?></div>
|
||||
</div>
|
||||
<?php
|
||||
return;
|
||||
endif;
|
||||
|
||||
$alignments = json_decode($section['alignments'] ?? '{}', true, flags: JSON_THROW_ON_ERROR);
|
||||
if ($dynamic && $body === '<p><a class="back-link" href="/articles">查看全部动态</a></p>') {
|
||||
$body = '';
|
||||
}
|
||||
$network = $section['networkFeed'] ?? false;
|
||||
$catalog = $section['catalogFeed'] ?? false;
|
||||
?>
|
||||
<section class="section section-<?= $e($section['style']) ?><?= $network ? ' network' : '' ?>" id="<?= $e($section['key']) ?>" aria-labelledby="heading-<?= $e($section['key']) ?>" <?= $moment ? 'data-moment="iris-opens"' : '' ?><?= $studio ?>>
|
||||
<div class="wrap">
|
||||
<div class="section-heading">
|
||||
<h2 id="heading-<?= $e($section['key']) ?>"<?= isset($alignments['title']) ? ' class="' . trim(View::alignmentClass($alignments['title'])) . '"' : '' ?><?= $canvas ? ' data-studio-part="title"' : '' ?>><?= $e($section['title']) ?></h2>
|
||||
<?php if ($canvas || $section['lead']): ?><p<?= isset($alignments['lead']) ? ' class="' . trim(View::alignmentClass($alignments['lead'])) . '"' : '' ?><?= $canvas ? ' data-studio-part="lead"' : '' ?>><?= $e($section['lead']) ?></p><?php endif ?>
|
||||
</div>
|
||||
<?php if ($network): ?>
|
||||
<?php foreach ($section['articleFeed'] as $group): ?>
|
||||
<?php $slug = $group['categories'][0]; $anchor = ($pageSlug ?? '') === 'home' && $section['key'] === 'network' ? $slug : $section['key'] . '-group-' . $slug; ?>
|
||||
<div class="network-group" id="<?= $e($anchor) ?>">
|
||||
<h3><?= $e($group['label']) ?></h3>
|
||||
<?= View::fragment('network-items', ['articles' => $group['articles'], 'standalone' => false]) ?>
|
||||
</div>
|
||||
<?php endforeach ?>
|
||||
<?php if ($section['archivePath'] !== null): ?><p class="article-feed-archive"><a class="back-link" href="<?= $e($section['archivePath']) ?>">查看全部</a></p><?php endif ?>
|
||||
<?php elseif ($catalog): ?>
|
||||
<?= View::fragment('service-cards', ['products' => $section['articleFeed'][0]['articles']]) ?>
|
||||
<?php if ($section['archivePath'] !== null && count($section['articleFeed'][0]['articles']) >= $section['feedLimit']): ?>
|
||||
<p class="article-feed-archive"><a class="back-link" href="<?= $e($section['archivePath']) ?>">查看全部</a></p>
|
||||
<?php endif ?>
|
||||
<?php elseif (!empty($section['articleFeed'])): ?>
|
||||
<?= View::fragment('article-feed', ['groups' => $section['articleFeed'], 'sectionKey' => $section['key'], 'archivePath' => $section['archivePath']]) ?>
|
||||
<?php endif ?>
|
||||
<?php if ($canvas || $body !== ''): ?><div class="rich<?= $dynamic ? ' article-feed-note' : '' ?>"<?= $canvas ? ' data-studio-part="body"' : '' ?>><?= $body ?></div><?php endif ?>
|
||||
</div>
|
||||
</section>
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
use App\Content\DirectoryCard;
|
||||
use App\Content\Html;
|
||||
use App\Content\View;
|
||||
|
||||
$e = View::escape(...);
|
||||
?>
|
||||
<?php if (!$products): ?><p class="empty-state">暂无可查看的产品和服务。</p><?php endif ?>
|
||||
<div class="catalog-grid">
|
||||
<?php foreach ($products as $product): ?>
|
||||
<?php
|
||||
$card = $product['card'];
|
||||
$body = Html::articleBody($product);
|
||||
$target = DirectoryCard::links($product, $body)['primary'];
|
||||
$extra = $card['extra_url'] ?? '';
|
||||
?>
|
||||
<article class="catalog-card">
|
||||
<?php if (!empty($card['image'])): ?>
|
||||
<div class="catalog-image"><img src="<?= $e($card['image']) ?>" alt="<?= $e($card['alt'] ?? '') ?>" loading="lazy"></div>
|
||||
<?php endif ?>
|
||||
<div class="catalog-content">
|
||||
<?php if (!empty($card['category_label'])): ?><p class="overline"><?= $e($card['category_label']) ?></p><?php endif ?>
|
||||
<h3><?php if ($target !== ''): ?><a href="<?= $e($target) ?>"><?= $e($product['title']) ?></a><?php else: ?><?= $e($product['title']) ?><?php endif ?></h3>
|
||||
<?php if ($product['summary']): ?>
|
||||
<p><?= $e($product['summary']) ?></p>
|
||||
<?php else: ?>
|
||||
<div class="rich"><?= $body ?></div>
|
||||
<?php endif ?>
|
||||
<?php if ($target !== '' || $extra !== ''): ?>
|
||||
<div class="actions">
|
||||
<?php if ($target !== ''): ?><a class="button button-primary" href="<?= $e($target) ?>"><?= $e(($card['label'] ?? '') ?: '了解详情') ?></a><?php endif ?>
|
||||
<?php if ($extra !== '' && $extra !== $target): ?><a href="<?= $e($extra) ?>"><?= $e(($card['extra_label'] ?? '') ?: '相关链接') ?></a><?php endif ?>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
</article>
|
||||
<?php endforeach ?>
|
||||
</div>
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
use App\Content\BlockTemplates;
|
||||
use App\Content\View;
|
||||
|
||||
$e = View::escape(...);
|
||||
?>
|
||||
<details class="studio-anchor-create">
|
||||
<summary>按锚点新建区块</summary>
|
||||
<form class="admin-form" method="post" action="/admin/page-blocks/<?= $e($slug) ?>">
|
||||
<input type="hidden" name="csrf" value="<?= $e($token) ?>">
|
||||
<input type="hidden" name="operation" value="create">
|
||||
<label>锚点<input name="key" pattern="[a-z0-9]+(-[a-z0-9]+)*" maxlength="70" placeholder="overview" required></label>
|
||||
<label>模板<select name="preset">
|
||||
<?php foreach (BlockTemplates::groups() as [$category, $templates]): ?>
|
||||
<optgroup label="<?= $e($category) ?>">
|
||||
<?php foreach ($templates as $preset => [$label]): ?>
|
||||
<option value="<?= $e($preset) ?>"><?= $e($label) ?></option>
|
||||
<?php endforeach ?>
|
||||
</optgroup>
|
||||
<?php endforeach ?>
|
||||
</select></label>
|
||||
<button type="submit" class="button button-outline">新建</button>
|
||||
</form>
|
||||
</details>
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
use App\Content\View;
|
||||
|
||||
$e = View::escape(...);
|
||||
?>
|
||||
<div class="asset-field">
|
||||
<label><?= $e($label) ?><input name="<?= $e($name) ?>" value="<?= $e($value) ?>" maxlength="1000"></label>
|
||||
<button type="button" class="button button-outline" data-asset-pick="<?= $e($name) ?>" data-asset-type="image/">媒体库</button>
|
||||
</div>
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
use App\Content\View;
|
||||
|
||||
$e = View::escape(...);
|
||||
$modes = ($allowOff ? ['off' => '不展示'] : []) + ['merged' => '合并列表', 'tabs' => '分类标签页', 'network' => '项目与伙伴卡片', 'catalog' => '产品与服务卡片'];
|
||||
?>
|
||||
<div class="form-grid">
|
||||
<label>展示方式<select name="feed_mode">
|
||||
<?php foreach ($modes as $mode => $label): ?>
|
||||
<option value="<?= $mode ?>" <?= ($feed['mode'] ?? 'off') === $mode ? 'selected' : '' ?>><?= $e($label) ?></option>
|
||||
<?php endforeach ?>
|
||||
</select></label>
|
||||
<label>展示数量<input name="feed_limit" type="number" required min="1" max="30" value="<?= $e($feed['limit'] ?? 6) ?>"><small>分组时每个分类独立计数。</small></label>
|
||||
</div>
|
||||
<?= View::fragment('admin-category-checkboxes', ['name' => 'feed_categories', 'selected' => $feed['categories'] ?? [], 'categories' => $categories, 'legend' => '展示分类']) ?>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
$paths = [
|
||||
'left' => '<path d="M3 6h18M3 10h12M3 14h18M3 18h12"/>',
|
||||
'center' => '<path d="M3 6h18M6 10h12M3 14h18M6 18h12"/>',
|
||||
'right' => '<path d="M3 6h18M9 10h12M3 14h18M9 18h12"/>',
|
||||
'settings' => '<path d="M4 6h12m4 0h0M4 12h3m4 0h9M4 18h10m4 0h2"/><circle cx="17" cy="6" r="2"/><circle cx="9" cy="12" r="2"/><circle cx="16" cy="18" r="2"/>',
|
||||
'edit' => '<path d="m14 5 5 5M5 19l4-.8L20 7.3 16.7 4 5.8 15z"/>',
|
||||
'copy' => '<rect x="8" y="8" width="12" height="12" rx="2"/><path d="M16 4H6a2 2 0 0 0-2 2v10"/>',
|
||||
'delete' => '<path d="M4 7h16M9 7V4h6v3m3 0-.8 13H6.8L6 7m4 4v5m4-5v5"/>',
|
||||
];
|
||||
?>
|
||||
<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>
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use App\Content\View;
|
||||
|
||||
$e = View::escape(...);
|
||||
?>
|
||||
<details class="studio-layers" id="blocks">
|
||||
<summary>区块顺序</summary>
|
||||
<ul class="admin-list studio-blocks">
|
||||
<?php foreach ($page['sections'] as $index => $item): ?>
|
||||
<?php $fixedSlot = $item['style'] === 'hero-links'; ?>
|
||||
<li>
|
||||
<div><strong><?= $e($item['title']) ?></strong><small>#<?= $e($item['key']) ?></small></div>
|
||||
<div class="actions studio-block-actions">
|
||||
<button class="button button-outline" type="button" data-canvas-jump="<?= $e($item['key']) ?>" hidden>在画布编辑</button>
|
||||
<a class="button button-outline" href="/admin/pages/<?= $e($slug) ?>/<?= $e($item['key']) ?>">区块设置</a>
|
||||
<form method="post" action="/admin/page-blocks/<?= $e($slug) ?>">
|
||||
<input type="hidden" name="csrf" value="<?= $e($token) ?>">
|
||||
<input type="hidden" name="key" value="<?= $e($item['key']) ?>">
|
||||
<input type="hidden" name="page_version" value="<?= $e($page['version']) ?>">
|
||||
<input type="hidden" name="version" value="<?= $e($item['version']) ?>">
|
||||
<button class="button button-outline" name="operation" value="up" type="submit" <?= $fixedSlot || $index === 0 || $page['sections'][$index - 1]['style'] === 'hero-links' ? 'disabled' : '' ?>>上移</button>
|
||||
<button class="button button-outline" name="operation" value="down" type="submit" <?= $fixedSlot || $index === count($page['sections']) - 1 ? 'disabled' : '' ?>>下移</button>
|
||||
<button class="button button-outline" name="operation" value="delete" type="submit" data-confirm="删除这个区块?">删除</button>
|
||||
</form>
|
||||
</div>
|
||||
</li>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
</details>
|
||||
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
use App\Content\View;
|
||||
|
||||
$e = View::escape(...);
|
||||
$modules = $kind === 'modules';
|
||||
?>
|
||||
<section role="tabpanel" id="studio-panel-<?= $kind ?>" aria-labelledby="studio-tab-<?= $kind ?>" data-library-panel="<?= $kind ?>" hidden>
|
||||
<ul class="studio-library-categories" data-library-index>
|
||||
<?php foreach ($groups as $group => [$category, $items]): ?>
|
||||
<li><button type="button" data-library-category="<?= $e($group) ?>" data-library-label="<?= $e($category) ?>">
|
||||
<span><?= $e($category) ?></span><small><?= count($items) ?></small>
|
||||
</button></li>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
<?php if ($modules): ?><?= $anchorForm ?><?php endif ?>
|
||||
<div class="studio-library-content" data-library-content hidden>
|
||||
<div class="studio-library-category-title">
|
||||
<button type="button" data-library-back>返回分类</button>
|
||||
<h3 data-library-title></h3>
|
||||
</div>
|
||||
<label class="studio-template-search">查找本分类<input type="search" data-template-search autocomplete="off"></label>
|
||||
<?php if ($modules): ?>
|
||||
<label class="studio-insert-mode"><input type="checkbox" data-template-inline> 插入当前正文</label>
|
||||
<?php endif ?>
|
||||
<p class="field-note" data-template-empty hidden role="status">没有匹配的<?= $modules ? '组件' : '元素' ?>。</p>
|
||||
<?php foreach ($groups as $group => [$category, $items]): ?>
|
||||
<div class="<?= $modules ? 'studio-template-cards' : 'studio-element-items' ?>" data-template-group="<?= $e($group) ?>" hidden>
|
||||
<?php foreach ($items as $key => $item): ?>
|
||||
<?php [$label, $markup, $option, $feed] = array_pad($item, 4, null); ?>
|
||||
<?php if ($modules): ?>
|
||||
<article class="studio-template-card" data-template-card data-library-item data-template-search-text="<?= $e($label . ' ' . $key) ?>">
|
||||
<button type="button" class="studio-template-image" data-template-preview="<?= $e($key) ?>" data-template-title="<?= $e($label) ?>"
|
||||
aria-label="预览<?= $e($label) ?>组件">
|
||||
<img src="/assets/template-previews/<?= $e($key) ?>.webp" alt="" width="768" height="480" loading="lazy">
|
||||
</button>
|
||||
<div class="studio-template-meta">
|
||||
<span><?= $e($label) ?></span>
|
||||
<button type="button" class="button button-outline" disabled data-canvas-template="<?= $e($key) ?>"
|
||||
data-template-title="<?= $e($label) ?>" data-template-lead="<?= $e($option) ?>" data-template-style="<?= $e($item[4] ?? 'plain') ?>"
|
||||
<?= $feed !== null ? 'data-template-feed="' . $e($feed) . '"' : '' ?> aria-label="添加<?= $e($label) ?>组件">添加</button>
|
||||
</div>
|
||||
<template data-preset="<?= $e($key) ?>"><?= $markup ?></template>
|
||||
</article>
|
||||
<?php else: ?>
|
||||
<div data-library-item data-template-search-text="<?= $e($label . ' ' . $key) ?>">
|
||||
<button type="button" disabled data-canvas-element="<?= $e($key) ?>"
|
||||
<?php if ($option): ?>data-element-mime="<?= $e($option) ?>"<?php endif ?>
|
||||
aria-label="插入<?= $e($label) ?>"><?= $e($label) ?></button>
|
||||
<template data-element="<?= $e($key) ?>"><?= $markup ?></template>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
<?php endforeach ?>
|
||||
</div>
|
||||
<?php endforeach ?>
|
||||
</div>
|
||||
<?php if ($modules): ?>
|
||||
<p class="field-note" data-template-status role="status"></p>
|
||||
<ul class="studio-pending" data-template-pending aria-label="待保存区块" hidden></ul>
|
||||
<?php else: ?>
|
||||
<p class="field-note" data-element-status role="status"></p>
|
||||
<?php endif ?>
|
||||
</section>
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
use App\Content\View;
|
||||
|
||||
$e = View::escape(...);
|
||||
?>
|
||||
<header class="admin-heading"><div><h1>媒体库</h1><p>统一查找并引用静态文件、图片、图标和音视频。</p></div></header>
|
||||
<?= View::fragment('admin-feedback', compact('error', 'saved')) ?>
|
||||
<form class="admin-form admin-panel" method="post" action="/admin/media" enctype="multipart/form-data">
|
||||
<input type="hidden" name="csrf" value="<?= $e($token) ?>">
|
||||
<div class="form-grid">
|
||||
<label>文件<input type="file" name="file" accept="image/*,video/*,audio/*,.pdf,.woff,.woff2" required>
|
||||
<small>支持常见图片、SVG 图标、音视频、PDF、WOFF/WOFF2,单文件最大 64 MB。</small>
|
||||
</label>
|
||||
<label>资源名称<input name="label" maxlength="160" placeholder="默认使用文件名"></label>
|
||||
</div>
|
||||
<div class="form-submit"><button type="submit" class="button button-primary">上传文件</button></div>
|
||||
</form>
|
||||
<section class="admin-panel media-library" data-media-library aria-labelledby="library-heading">
|
||||
<h2 id="library-heading">资源列表</h2>
|
||||
<div class="form-grid">
|
||||
<label>搜索<input type="search" data-library-query placeholder="搜索名称或路径"></label>
|
||||
<label>类型<select data-library-type><option value="">全部资源</option><option value="image/">图片与图标</option><option value="video/">视频</option><option value="audio/">音频</option><option value="other">其他文件</option></select></label>
|
||||
</div>
|
||||
<p data-library-count role="status"></p>
|
||||
<div class="media-grid">
|
||||
<?php foreach ($files as $file): ?>
|
||||
<article class="media-card" data-library-card data-mime="<?= $e($file['mime']) ?>" data-search="<?= $e($file['label'] . ' ' . $file['url']) ?>">
|
||||
<?php if (str_starts_with($file['mime'], 'image/')): ?>
|
||||
<img src="<?= $e($file['url']) ?>" alt="" loading="lazy">
|
||||
<?php else: ?>
|
||||
<p class="media-file-type"><?= $e(strtolower(pathinfo($file['url'], PATHINFO_EXTENSION))) ?></p>
|
||||
<?php endif ?>
|
||||
<h3><?= $e($file['label']) ?></h3>
|
||||
<small><?= $e((string) max(1, ceil($file['size'] / 1024))) ?> KB · <?= $file['name'] === '' ? '项目文件' : ($file['archived'] ? '已归档' : '上传文件') ?></small>
|
||||
<div class="actions"><a href="<?= $e($file['url']) ?>" target="_blank" rel="noopener">打开</a><button type="button" class="button button-outline" data-copy-asset="<?= $e($file['url']) ?>">复制路径</button></div>
|
||||
<?php if ($file['name'] !== ''): ?>
|
||||
<details><summary>管理文件</summary>
|
||||
<form class="admin-form" method="post" action="/admin/media/<?= $e($file['name']) ?>">
|
||||
<input type="hidden" name="csrf" value="<?= $e($token) ?>">
|
||||
<label>名称<input name="label" value="<?= $e($file['label']) ?>" maxlength="160" required></label>
|
||||
<label class="media-archive"><input type="checkbox" name="archived" value="1" <?= $file['archived'] ? 'checked' : '' ?>>归档</label>
|
||||
<small>归档从选取器隐藏文件,已有链接仍可访问。</small>
|
||||
<button type="submit" class="button button-outline">保存</button>
|
||||
</form>
|
||||
</details>
|
||||
<?php endif ?>
|
||||
</article>
|
||||
<?php endforeach ?>
|
||||
</div>
|
||||
</section>
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
use App\Content\View;
|
||||
|
||||
$e = View::escape(...);
|
||||
?>
|
||||
<a class="back-link" href="/admin">返回页面</a>
|
||||
<header class="admin-heading">
|
||||
<h1>新建页面</h1>
|
||||
<button type="button" class="button button-outline" data-open-page-templates hidden>整页模板</button>
|
||||
</header>
|
||||
<?= View::fragment('admin-feedback', ['error' => $error, 'saved' => false]) ?>
|
||||
<form class="admin-form admin-panel" method="post" action="/admin/new-page">
|
||||
<input type="hidden" name="csrf" value="<?= $e($token) ?>">
|
||||
<label>页面名称<input name="name" maxlength="100" value="<?= $e($name) ?>" required></label>
|
||||
<label>网址标识<input name="slug" maxlength="70" value="<?= $e($slug) ?>" pattern="[a-z0-9]+(-[a-z0-9]+)*" placeholder="my-page" required>
|
||||
<small>创建后为草稿。可在编辑画布中预览,并自行发布。</small>
|
||||
</label>
|
||||
<div class="form-submit"><button type="submit" class="button button-primary">创建草稿</button></div>
|
||||
</form>
|
||||
<?= View::fragment('studio-page-templates', compact('token', 'openTemplates')) ?>
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
use App\Content\PageTemplates;
|
||||
use App\Content\View;
|
||||
|
||||
$e = View::escape(...);
|
||||
$groups = PageTemplates::groups();
|
||||
$previewRoot = '/assets/page-templates/';
|
||||
?>
|
||||
<dialog class="page-template-drawer" data-page-template-drawer<?= !empty($openTemplates) ? ' data-open-on-load' : '' ?> aria-labelledby="page-template-title">
|
||||
<header class="page-template-header">
|
||||
<h2 id="page-template-title">整页模板</h2>
|
||||
<button type="button" class="button button-outline" data-close-page-templates>关闭</button>
|
||||
</header>
|
||||
<div class="page-template-content">
|
||||
<section data-template-panel="groups" aria-labelledby="page-template-groups">
|
||||
<h3 id="page-template-groups" tabindex="-1">选择套系</h3>
|
||||
<div class="page-template-groups">
|
||||
<?php foreach ($groups as $key => $group): ?>
|
||||
<button type="button" class="page-template-card" data-template-group="<?= $e($key) ?>">
|
||||
<span class="page-template-image"><img src="<?= $e($previewRoot . $key . '.webp') ?>" width="768" height="480" alt="" loading="lazy"></span>
|
||||
<span class="page-template-card-copy"><strong><?= $e($group['name']) ?></strong><small><?= $e($group['description']) ?></small></span>
|
||||
</button>
|
||||
<?php endforeach ?>
|
||||
</div>
|
||||
</section>
|
||||
<?php foreach ($groups as $key => $group): ?>
|
||||
<section data-template-panel="<?= $e($key) ?>" aria-labelledby="page-template-<?= $e($key) ?>" hidden>
|
||||
<button type="button" class="button button-outline page-template-back" data-template-back="groups">返回套系</button>
|
||||
<h3 id="page-template-<?= $e($key) ?>" tabindex="-1"><?= $e($group['name']) ?></h3>
|
||||
<div class="page-template-pages">
|
||||
<?php foreach ($group['pages'] as $pageKey => $pageTemplate): ?>
|
||||
<button type="button" class="page-template-card" data-page-template="<?= $e($pageKey) ?>">
|
||||
<span class="page-template-image"><img src="<?= $e($previewRoot . $pageKey . '.webp') ?>" width="768" height="480" alt="" loading="lazy"></span>
|
||||
<span class="page-template-card-copy"><strong><?= $e($pageTemplate['name']) ?></strong></span>
|
||||
</button>
|
||||
<?php endforeach ?>
|
||||
</div>
|
||||
</section>
|
||||
<?php endforeach ?>
|
||||
<section data-template-panel="detail" aria-labelledby="page-template-detail-heading" hidden>
|
||||
<button type="button" class="button button-outline page-template-back" data-template-back="pages">返回套内页面</button>
|
||||
<h3 id="page-template-detail-heading" data-template-name tabindex="-1"></h3>
|
||||
<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 page-template-preview-link" data-template-live target="_blank" rel="noopener">打开完整页面预览</a>
|
||||
</div>
|
||||
<form class="admin-form" method="post" action="/admin/new-page">
|
||||
<input type="hidden" name="csrf" value="<?= $e($token) ?>">
|
||||
<input type="hidden" name="template">
|
||||
<div class="form-grid">
|
||||
<label>页面名称<input name="name" maxlength="100" required></label>
|
||||
<label>网址标识<input name="slug" maxlength="70" pattern="[a-z0-9]+(-[a-z0-9]+)*" required></label>
|
||||
</div>
|
||||
<div class="form-submit"><button type="submit" class="button button-primary">用此模板创建草稿</button></div>
|
||||
</form>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</dialog>
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
use App\Content\View;
|
||||
|
||||
$e = View::escape(...);
|
||||
?>
|
||||
<a class="back-link" href="/admin/design">返回站点设计</a>
|
||||
<header class="admin-heading"><h1>站点设置</h1></header>
|
||||
<?= View::fragment('admin-feedback', compact('error', 'saved')) ?>
|
||||
<form class="admin-form admin-panel" method="post" action="/admin/settings">
|
||||
<input type="hidden" name="csrf" value="<?= $e($token) ?>">
|
||||
<input type="hidden" name="version" value="<?= $e($version) ?>">
|
||||
<label>站点名称<input name="name" value="<?= $e($name) ?>" maxlength="100" required></label>
|
||||
<label>静态资源 CDN<input name="cdn" value="<?= $e($cdn) ?>" placeholder="https://cdn.example.com"><small>填写后,公开页面的 /assets/ 文件从该地址加载。</small></label>
|
||||
<button type="submit" class="button button-primary">保存设置</button>
|
||||
</form>
|
||||
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use App\Content\BlockTemplates;
|
||||
use App\Content\View;
|
||||
|
||||
$e = View::escape(...);
|
||||
$labels = ['modules' => '组件', 'elements' => '元素', 'layers' => '图层'];
|
||||
?>
|
||||
<div class="studio-presets" data-canvas-presets>
|
||||
<div class="studio-library-tabs" role="tablist" aria-label="页面编辑工具" data-library-tabs hidden>
|
||||
<?php foreach ($labels as $kind => $label): ?>
|
||||
<button type="button" role="tab" id="studio-tab-<?= $kind ?>" aria-controls="studio-panel-<?= $kind ?>"
|
||||
aria-selected="false" tabindex="-1" data-library-tab="<?= $kind ?>"><?= $e($label) ?></button>
|
||||
<?php endforeach ?>
|
||||
</div>
|
||||
<?php foreach (['modules' => BlockTemplates::groups(), 'elements' => BlockTemplates::ELEMENT_GROUPS] as $kind => $groups): ?>
|
||||
<?= View::fragment('studio-library-panel', compact('kind', 'groups', 'anchorForm')) ?>
|
||||
<?php endforeach ?>
|
||||
<section role="tabpanel" id="studio-panel-layers" aria-labelledby="studio-tab-layers" data-library-panel="layers">
|
||||
<?= $layers ?>
|
||||
</section>
|
||||
|
||||
<div class="studio-template-peek" data-template-peek aria-hidden="true" hidden>
|
||||
<img alt="">
|
||||
<p></p>
|
||||
</div>
|
||||
<dialog class="media-picker studio-template-dialog" data-template-dialog aria-labelledby="studio-template-preview-title">
|
||||
<header class="admin-heading compact">
|
||||
<h2 id="studio-template-preview-title"></h2>
|
||||
<button type="button" class="button button-outline" data-template-close>关闭</button>
|
||||
</header>
|
||||
<img alt="" width="768" height="480">
|
||||
<div class="actions"><button type="button" class="button button-primary" data-template-use>添加到画布</button></div>
|
||||
</dialog>
|
||||
</div>
|
||||
Reference in New Issue
Block a user