名册每人一份 · 分组两层 · 拖动排序 · 表单合一 · 裁剪可缩放
按用户十点反馈逐条落地(v5,Schema::VERSION = 5): - 名册改成每人一份:新表 person_roster(owner_id, person_id, group_id, sort_order, source)。默认只看「我添加的 + 别人分享给我的」; source='seeded' 是升级时从老 persons.group_id 播进来的(先播数据再删列)。 - 排序不再手填:名册页直接拖动卡片(整版提交,一次 applyLayout 落库), 无 JS 时卡片上的「调整分组」表单照旧可用。 - 分组分两层:管理员在「系统设置」维护公共分组(owner_id=0), 用户在「个人设置」加自己的分组;显示顺序各人各定、互不影响。 - 名册可共享:把名片分享给别的用户(people/share);添加成员时若系统里 已有这个人,可直接复用(people/pick),不必重复录入。 - 「编辑成员」与「改我自己的资料」合并为同一张表(templates/people/form.php), 两个入口 href 完全相同,h1 按改谁切换文案;个人设置页只留 资料入口 + 称呼 + 我的分组三块,删除 templates/settings/_profile.php。 - 系统设置收进头像下拉,顶栏只剩 首页/家谱/名册。 - 裁剪器加缩放(滑块 1-4x、Ctrl+滚轮、还原):缩放只改视图大小, 落库的归一化矩形保持不变。 - 权限:管理员可以改任何人的权限(含自己),只拦「最后一位管理员」被降级。 - 去掉首页「我的一句话」后的链接、家谱说明段、以及「还没归到任何分组」提示。 迁移安全:数据回填(PersonRoster::seedFromPersons)先于删列执行、且不进 tryStep 容错;失败步骤记入 settings.schema_upgrade_warning 并在系统设置页提示。 线上已验证:schema_upgrade_warning 为空,person_roster/person_groups.owner_id 就位,persons.group_id / sort_order 已删。 验证:php -l 48 文件;本地 e2e 277/0、老库升级 81/0、桌面几何 108/0、 移动端几何 180/0、交互 96/0;反向验证 38 条注入 + 2 条缩放注入全部命中; 部署静态断言 53/0,站点自检 7/7(--resolve 锁本机走 443,探针真的进 PHP)。
This commit is contained in:
@@ -31,6 +31,98 @@
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<?php if (($upgradeWarn ?? '') !== ''): ?>
|
||||
<div class="flash" style="margin-top:16px">
|
||||
<div class="flash-item err">
|
||||
<b>上次结构升级有步骤失败了</b>(其余步骤已经跑完,站点可用):<br>
|
||||
<?= e((string)$upgradeWarn) ?><br>
|
||||
<span class="muted small">修好之后可以清掉这条提示。</span>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- ==================== 公共分组 ==================== -->
|
||||
<?php
|
||||
$pubGroups = $pubGroups ?? [];
|
||||
$pubCounts = $pubCounts ?? [];
|
||||
$pubTotal = count($pubGroups);
|
||||
?>
|
||||
<div class="card card-pad" style="margin-top:20px" id="public-groups">
|
||||
<h2 class="section-title">
|
||||
公共分组
|
||||
<span class="hint">全家人共用的一套</span>
|
||||
</h2>
|
||||
<p class="small muted" style="margin:0 0 16px">
|
||||
名册按「关系分组」分栏显示。这里维护的是<b>公共的那一套</b> ——
|
||||
建一次,全家每个人都能拿来用。
|
||||
<br>
|
||||
每个人还可以在「个人设置 → 我的分组」里<b>再加只给自己看的分组</b>,
|
||||
那部分不在这儿、也不会影响别人。挪顺序用 ▲ ▼(▲▼ 调的是"全家的默认顺序",
|
||||
各人仍可在个人设置里改成自己习惯的顺序)。
|
||||
<br>
|
||||
删掉一个分组<b>不会删掉人</b>:名册里归到那一组的人会变成「未分类」,
|
||||
各自重新归类即可。
|
||||
</p>
|
||||
|
||||
<?php if ($pubGroups): ?>
|
||||
<ol class="order-list">
|
||||
<?php foreach ($pubGroups as $i => $g): $gid = (int)$g['id']; ?>
|
||||
<li class="order-row">
|
||||
<span class="order-no"><?= $i + 1 ?></span>
|
||||
<span class="order-name"><?= e((string)$g['name']) ?></span>
|
||||
<span class="order-count"><?= (int)($pubCounts[$gid] ?? 0) ?> 人</span>
|
||||
<form method="post" action="<?= e(url('settings/groups/move')) ?>" class="order-move">
|
||||
<?= csrf_field() ?>
|
||||
<input type="hidden" name="id" value="<?= $gid ?>">
|
||||
<input type="hidden" name="scope" value="public">
|
||||
<button class="btn btn-ghost btn-sm" type="submit" name="dir" value="up"
|
||||
title="上移一组" <?= $i === 0 ? 'disabled' : '' ?>>▲</button>
|
||||
<button class="btn btn-ghost btn-sm" type="submit" name="dir" value="down"
|
||||
title="下移一组" <?= $i === $pubTotal - 1 ? 'disabled' : '' ?>>▼</button>
|
||||
</form>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ol>
|
||||
<?php endif; ?>
|
||||
|
||||
<form method="post" action="<?= e(url('settings/groups/add')) ?>" class="inline-form" style="margin-top:16px">
|
||||
<?= csrf_field() ?>
|
||||
<input type="hidden" name="scope" value="public">
|
||||
<label class="sr-only" for="newPubGroup">新分组名</label>
|
||||
<input class="input" id="newPubGroup" name="name" maxlength="20" placeholder="例如:邻居、亲家、老同事">
|
||||
<button class="btn btn-sm" type="submit">加一个公共分组</button>
|
||||
</form>
|
||||
|
||||
<?php if ($pubGroups): ?>
|
||||
<ul class="group-manage" style="margin-top:14px">
|
||||
<?php foreach ($pubGroups as $g): $gid = (int)$g['id']; ?>
|
||||
<li class="group-manage-row">
|
||||
<form method="post" action="<?= e(url('settings/groups/rename')) ?>" class="group-rename">
|
||||
<?= csrf_field() ?>
|
||||
<input type="hidden" name="id" value="<?= $gid ?>">
|
||||
<input type="hidden" name="scope" value="public">
|
||||
<label class="sr-only" for="pgname<?= $gid ?>">分组名</label>
|
||||
<input class="input" id="pgname<?= $gid ?>" name="name" maxlength="20"
|
||||
value="<?= e((string)$g['name']) ?>">
|
||||
<button class="btn btn-ghost btn-sm" type="submit">改名</button>
|
||||
</form>
|
||||
<span class="group-count muted small"><?= (int)($pubCounts[$gid] ?? 0) ?> 人</span>
|
||||
<details class="del-wrap">
|
||||
<summary class="btn btn-ghost btn-sm">删除</summary>
|
||||
<form method="post" action="<?= e(url('settings/groups/delete')) ?>" class="del-confirm">
|
||||
<?= csrf_field() ?>
|
||||
<input type="hidden" name="id" value="<?= $gid ?>">
|
||||
<input type="hidden" name="scope" value="public">
|
||||
<span class="small muted">这组的人会变成「未分类」,确定?</span>
|
||||
<button class="btn btn-ghost btn-sm danger" type="submit">确认删除</button>
|
||||
</form>
|
||||
</details>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<!-- ==================== 附件存储 ==================== -->
|
||||
<form method="post" action="<?= e(url('settings/storage')) ?>" class="card card-pad" style="margin-top:20px">
|
||||
<?= csrf_field() ?>
|
||||
|
||||
Reference in New Issue
Block a user