From 7716134afb580346e9392554e80146ad6190fad0 Mon Sep 17 00:00:00 2001 From: ZTL123Z <2746395413@qq.com> Date: Thu, 1 Aug 2024 11:38:08 +0800 Subject: [PATCH 01/52] =?UTF-8?q?=E6=81=A2=E5=A4=8D=E4=BB=A5=E5=BE=80?= =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: guke1024 <46668943+guke1024@users.noreply.github.com> --- README.md | 6 +- packages/blog/templates/blog_main.html | 50 +++-- packages/eslint-config/react.yaml | 2 +- packages/hydrooj/locales/zh.yaml | 111 +++++----- packages/hydrooj/setting.yaml | 28 +-- packages/hydrooj/src/handler/contest.ts | 2 +- packages/hydrooj/src/handler/discussion.ts | 10 +- packages/hydrooj/src/handler/domain.ts | 17 ++ packages/hydrooj/src/handler/home.ts | 1 + packages/hydrooj/src/handler/manage.ts | 56 +++++ packages/hydrooj/src/handler/record.ts | 9 +- packages/hydrooj/src/handler/user.ts | 91 +++++++- packages/hydrooj/src/interface.ts | 21 +- packages/hydrooj/src/lib/ui.ts | 8 +- packages/hydrooj/src/model/builtin.ts | 21 -- packages/hydrooj/src/model/contest.ts | 114 +++++----- packages/hydrooj/src/model/domain.ts | 1 + packages/hydrooj/src/model/record.ts | 10 +- packages/hydrooj/src/model/setting.ts | 15 +- packages/hydrooj/src/model/stuinfo.ts | 207 ++++++++++++++++++ packages/hydrooj/src/model/user.ts | 65 +++++- packages/hydrooj/src/plugin-api.ts | 1 + packages/hydrooj/src/script/rating.ts | 45 ++-- packages/hydrooj/src/service/bus.ts | 13 +- packages/prom-client/index.ts | 4 +- packages/prom-client/setting.yaml | 2 +- .../MessagePadDialogueContentContainer.jsx | 12 +- packages/ui-default/locales/zh.yaml | 109 +++++---- packages/ui-default/misc/typography.styl | 7 + .../ui-default/pages/courses_main.page.styl | 51 +++++ .../pages/homework_scoreboard.page.styl | 15 +- .../pages/manage_student_import.page.js | 29 +++ packages/ui-default/pages/ranking.page.styl | 2 +- .../ui-default/pages/record_main.page.styl | 2 +- .../ui-default/pages/stu_class_list.page.styl | 38 ++++ .../pages/stu_class_students.page.styl | 36 +++ .../static/android-chrome-192x192.png | Bin 3611 -> 31995 bytes .../static/apple-touch-icon-180x180.png | Bin 3468 -> 29335 bytes packages/ui-default/static/favicon-16x16.png | Bin 1097 -> 967 bytes packages/ui-default/static/favicon-32x32.png | Bin 1130 -> 2569 bytes packages/ui-default/static/favicon-96x96.png | Bin 2946 -> 11896 bytes packages/ui-default/static/favicon.ico | Bin 67646 -> 4286 bytes .../ui-default/templates/components/user.html | 27 ++- .../ui-default/templates/contest_detail.html | 5 - .../ui-default/templates/courses_main.html | 61 ++++++ .../templates/discussion_detail.html | 12 +- .../templates/discussion_main_or_node.html | 10 +- .../ui-default/templates/domain_create.html | 6 +- .../ui-default/templates/homework_edit.html | 6 +- .../ui-default/templates/layout/html5.html | 5 + .../templates/manage_student_import.html | 27 +++ .../templates/partials/contest_sidebar.html | 5 - .../templates/partials/contest_user.html | 2 +- .../templates/partials/discussion_list.html | 8 +- .../partials/discussion_list_main.html | 17 ++ .../ui-default/templates/partials/footer.html | 28 ++- .../partials/homepage/discussion.html | 12 +- .../partials/homepage/hgnu_tool.html | 13 ++ .../templates/partials/homepage/ranking.html | 5 +- .../homework_default_penalty_rules.yaml | 5 +- .../templates/partials/manage_user_priv.html | 2 +- .../ui-default/templates/partials/nav.html | 5 - .../templates/partials/problem_default.md | 28 +-- .../templates/partials/problem_files.html | 2 +- .../templates/partials/problem_list.html | 4 +- .../partials/problem_sidebar_normal.html | 7 +- .../templates/partials/scoreboard.html | 4 +- .../templates/partials/training_detail.html | 2 +- .../ui-default/templates/problem_detail.html | 2 +- .../ui-default/templates/problem_edit.html | 2 +- packages/ui-default/templates/ranking.html | 4 - .../ui-default/templates/record_main_tr.html | 15 +- .../ui-default/templates/stu_class_list.html | 112 ++++++++++ .../templates/stu_class_students.html | 73 ++++++ .../ui-default/templates/training_detail.html | 4 +- .../ui-default/templates/training_edit.html | 4 +- .../ui-default/templates/user_detail.html | 24 +- .../ui-default/templates/user_register.html | 2 + .../templates/user_register_with_code.html | 22 ++ packages/ui-default/templates/wiki_help.html | 16 +- packages/ui-default/utils/base64.js | 4 +- packages/vjudge/package.json | 6 +- packages/vjudge/src/interface.ts | 1 + packages/vjudge/src/model.ts | 9 + packages/vjudge/src/providers/codeforces.ts | 2 +- packages/vjudge/src/providers/hduoj.ts | 123 ++++++----- packages/vjudge/src/providers/index.ts | 4 +- packages/vjudge/src/providers/kattis.ts | 183 ++++++++++++++++ packages/vjudge/src/providers/loj.ts | 176 +++++++++++++++ packages/vjudge/src/verdict.ts | 23 +- 90 files changed, 1849 insertions(+), 481 deletions(-) create mode 100644 packages/hydrooj/src/model/stuinfo.ts create mode 100644 packages/ui-default/pages/courses_main.page.styl create mode 100644 packages/ui-default/pages/manage_student_import.page.js create mode 100644 packages/ui-default/pages/stu_class_list.page.styl create mode 100644 packages/ui-default/pages/stu_class_students.page.styl create mode 100644 packages/ui-default/templates/courses_main.html create mode 100644 packages/ui-default/templates/manage_student_import.html create mode 100644 packages/ui-default/templates/partials/discussion_list_main.html create mode 100644 packages/ui-default/templates/partials/homepage/hgnu_tool.html create mode 100644 packages/ui-default/templates/stu_class_list.html create mode 100644 packages/ui-default/templates/stu_class_students.html create mode 100644 packages/vjudge/src/providers/kattis.ts create mode 100644 packages/vjudge/src/providers/loj.ts diff --git a/README.md b/README.md index 0fae4ee290..4dd61b51d4 100644 --- a/README.md +++ b/README.md @@ -511,8 +511,4 @@ Telegram [@webpack_exports_undefined](https://t.me/webpack_exports_undefined) - [Github](https://github.com/) 为 Hydro 提供了代码托管与自动构建。 - [criyle](https://github.com/criyle) 提供评测沙箱实现。 -- [Vijos](https://github.com/vijos/vj4) 为 Hydro 提供了 UI 框架。 - -## Sponsors - -- [云斗学院](https://www.yundouxueyuan.com) +- [Vijos](https://github.com/vijos/vj4) 为 Hydro 提供了UI框架。 diff --git a/packages/blog/templates/blog_main.html b/packages/blog/templates/blog_main.html index c33fea4288..5fd95e7433 100644 --- a/packages/blog/templates/blog_main.html +++ b/packages/blog/templates/blog_main.html @@ -6,31 +6,35 @@
- {% if not ddocs.length %} - {{ nothing.render('no blog yet...') }} + {% if not handler.user.hasPerm(perm.PERM_DELETE_DISCUSSION) %} + {{ nothing.render('仅超级管理员可以创建博客!') }} {% else %} -
    - {%- for ddoc in ddocs -%} -
  1. -
    -
    -
    -
    {{ datetimeSpan(ddoc._id, false, 'D')|safe }}
    -
    {{ datetimeSpan(ddoc._id, false, 'YYYY-M')|safe }}
    + {% if not ddocs.length %} + {{ nothing.render('no blog yet...') }} + {% else %} +
      + {%- for ddoc in ddocs -%} +
    1. +
      +
      +
      +
      {{ datetimeSpan(ddoc._id, false, 'D')|safe }}
      +
      {{ datetimeSpan(ddoc._id, false, 'YYYY-M')|safe }}
      +
      +
      +
      +

      {{ ddoc['title'] }}

      +
        +
      • {{ _('{0} views').format(ddoc.views) }}
      • +
      • {{ datetimeSpan(ddoc.updateAt)|safe }}
      • +
      -
      -

      {{ ddoc['title'] }}

      -
        -
      • {{ _('{0} views').format(ddoc.views) }}
      • -
      • {{ datetimeSpan(ddoc.updateAt)|safe }}
      • -
      -
      -
    -
  2. - {%- endfor -%} -
- {% if page and dpcount %}{{ paginator.render(page, dpcount) }}{% endif %} + + {%- endfor -%} + + {% if page and dpcount %}{{ paginator.render(page, dpcount) }}{% endif %} + {% endif %} {% endif %}
@@ -41,7 +45,7 @@

{{ _("{0}'s blog").format(udoc.uname) }}

- {% if handler.user._id == udoc._id %} + {% if handler.user._id == udoc._id and handler.user.hasPerm(perm.PERM_DELETE_DISCUSSION) %}

{{ _('Create a Post') }}

{% endif %}
diff --git a/packages/eslint-config/react.yaml b/packages/eslint-config/react.yaml index 01734d099a..472dcf17d9 100644 --- a/packages/eslint-config/react.yaml +++ b/packages/eslint-config/react.yaml @@ -25,4 +25,4 @@ rules: jsx-a11y/click-events-have-key-events: 0 jsx-a11y/label-has-associated-control: 0 github/array-foreach: 0 - # 'react/no-unknown-property': ['error', { ignore: ['key'] }], \ No newline at end of file + # 'react/no-unknown-property': ['error', { ignore: ['key'] }], diff --git a/packages/hydrooj/locales/zh.yaml b/packages/hydrooj/locales/zh.yaml index 1e3957e509..c424d32537 100644 --- a/packages/hydrooj/locales/zh.yaml +++ b/packages/hydrooj/locales/zh.yaml @@ -1,9 +1,9 @@ __id: zh __langname: 简体中文 '"{data}" copied to clipboard!': “{data}”已复制到剪贴板! -'{0} {1} delete your discussion reply {2} in "{3}"({4}).' : '{0} {1} 从讨论 {3}({4}) 删除了你的回复 {2}。' +'{0} {1} delete your discussion reply {2} in "{3}"({4}).' : '{0} {1} 从公告 {3}({4}) 删除了你的回复 {2}。' '{0} comments': '{0} 条评论' -'{0} discussions': '{0} 条讨论' +'{0} discussions': '{0} 条公告' '{0} is a moderator of this domain.': '{}是这个域的管理者之一。' '{0} limit exceeded (limit: {2} operations in {1} seconds).': '{0} 超过频率限制。限制:{1} 秒内最多 {2} 次操作。' '{0} problems': '{0} 道题' @@ -25,7 +25,7 @@ __langname: 简体中文 'Copy "{data}" failed :(': '复制“{data}”失败 :(' 'Copy failed :(': '复制失败 :(' 'Current dataset: {0}': '当前测试数据: {0}' -'Discussion: Terms Of Service': 讨论区服务条款 +'Discussion: Terms Of Service': 公告区服务条款 'Format: category 1, sub category 1.1, sub category 1.2, ..., sub category 1.x, ..., category n, sub category n.1, sub category n.2, ..., sub category n.m, ...': 格式:分类1, 子分类1.1, 子分类1.2, ..., 子分类1.x, ..., 分类n, 子分类n.1, 子分类n.2, ..., 子分类n.m, ... 'Join {0}': '加入 {0}' 'No': 否 @@ -61,8 +61,8 @@ Add new data: 添加新数据 Add User: 添加用户 Add: 添加 Additional File: 附加文件 -Admin {0} delete your discussion "{1}". : 管理员 {0} 删除了你的讨论 "{1}"。 -Admin {0} delete your discussion tail reply {1} in "{2}"({3}). : 管理员 {0} 从讨论 {2}({3}) 中删除了你的楼中楼回复 {1}。 +Admin {0} delete your discussion "{1}". : 管理员 {0} 删除了你的公告 "{1}"。 +Admin {0} delete your discussion tail reply {1} in "{2}"({3}). : 管理员 {0} 从公告 {2}({3}) 中删除了你的楼中楼回复 {1}。 All {0} Contests: 所有 {0} 比赛 All Contests: 所有比赛 All Homeworks: 所有作业 @@ -177,15 +177,16 @@ Copy QQ Number: 复制QQ号 Copy WeChat Account: 复制微信号 Copy: 复制 Copyright Complaint: 版权申诉 +courses: 课程 CPU Info: CPU信息 Create a contest: 创建一个比赛 -Create a Discussion: 创建一个讨论 +Create a Discussion: 创建一个公告 Create a problem: 创建一个题目 Create Contest: 创建比赛 Create contests: 创建比赛 -Create Discussion in {0}: 在 {0} 下创建讨论 -Create Discussion: 创建讨论 -Create discussions: 创建讨论 +Create Discussion in {0}: 在 {0} 下创建公告 +Create Discussion: 创建公告 +Create discussions: 创建公告 Create Domain: 创建域 Create homework: 创建作业 Create Homework: 创建作业 @@ -219,11 +220,11 @@ Default display language: 默认显示语言 Default Privilege: 用户默认全站权限 Delay: 延迟 Delete a user: 删除用户 -Delete discussion replies of own discussion: 删除自己讨论中的回复 -Delete discussion replies: 删除讨论回复 -Delete discussions: 删除讨论 -Delete own discussion replies: 删除讨论中自己的回复 -Delete own discussions: 删除自己的讨论 +Delete discussion replies of own discussion: 删除自己公告中的回复 +Delete discussion replies: 删除公告回复 +Delete discussions: 删除公告 +Delete own discussion replies: 删除公告中自己的回复 +Delete own discussions: 删除自己的公告 Delete own problem solution replies: 删除题解中自己的回复 Delete own problem solutions: 删除自己的题解 Delete problem solution replies: 删除题解的回复 @@ -240,20 +241,20 @@ Difficulty by algorithm: 算法计算的难度 Difficulty displayed: 显示的难度 Difficulty: 难度 Disabled: 关闭 -Discussion {1} not found.: 讨论 {1} 不存在。 -Discussion category {1} already exists.: 讨论分类 {1} 已经存在。 -Discussion category {1} not found.: 讨论分类 {1} 不存在。 -Discussion node {1} already exists.: 讨论节点 {1} 已经存在。 -Discussion node {1} not found.: 讨论节点 {1} 不存在。 -Discussion Nodes: 讨论节点 -discussion_create: 创建讨论 -discussion_detail: 讨论详情 -discussion_edit: 编辑讨论 -discussion_main: 讨论 -discussion_node: 讨论 -Discussion: 讨论 -Discussions per page: 每页展示的讨论数量 -Discussions: 讨论 +Discussion {1} not found.: 公告 {1} 不存在。 +Discussion category {1} already exists.: 公告分类 {1} 已经存在。 +Discussion category {1} not found.: 公告分类 {1} 不存在。 +Discussion node {1} already exists.: 公告节点 {1} 已经存在。 +Discussion node {1} not found.: 公告节点 {1} 不存在。 +Discussion Nodes: 公告节点 +discussion_create: 创建公告 +discussion_detail: 公告详情 +discussion_edit: 编辑公告 +discussion_main: 公告 +discussion_node: 公告 +Discussion: 公告 +Discussions per page: 每页展示的公告数量 +Discussions: 公告 Display name {1} you want to set is used by others.: 您想要设置的显示名 {1} 已经被其他人使用了。 Display Name: 显示名 display_name: 显示名 @@ -264,8 +265,9 @@ Domain {0} is bulit-in and cannot be modified.: 域 {0} 为内置,不可修改 Domain {0} not found.: 域 {0} 不存在。 Domain ID cannot be changed once the domain is created.: 在创建后不能更改 ID。 Domain ID: 域 ID +domain_create: 创建域 domain_dashboard: 管理域 -domain_discussion: 讨论节点 +domain_discussion: 公告节点 domain_edit: 编辑域资料 domain_file: 我的文件 domain_group: 管理小组 @@ -289,15 +291,15 @@ Edit any contests: 修改任意的比赛 Edit any homework: 修改任意的作业 Edit Contest: 编辑比赛 Edit description of this domain: 修改此域描述 -Edit discussion replies of own discussion: 修改自己讨论中的回复 -Edit discussion replies: 修改讨论的回复 -Edit discussions: 修改讨论 +Edit discussion replies of own discussion: 修改自己公告中的回复 +Edit discussion replies: 修改公告的回复 +Edit discussions: 修改公告 Edit domain settings: 编辑域设置 Edit Domain: 编辑域 Edit Homework: 编辑作业 Edit own contests: 修改自己的比赛 -Edit own discussion replies: 修改讨论中自己的回复 -Edit own discussions: 修改自己的讨论 +Edit own discussion replies: 修改公告中自己的回复 +Edit own discussions: 修改自己的公告 Edit own homework: 修改自己的作业 Edit own problem solution replies: 修改题解中自己的回复 Edit own problem solutions: 修改自己的题解 @@ -355,7 +357,7 @@ Hidden: 隐藏 Hide all tags: 隐藏所有标签 Hide categorical tags: 隐藏分类标签 Hide Selected: 隐藏选中 -Highlight discussions: 高亮讨论 +Highlight discussions: 高亮公告 highlight: 高亮 Highlight: 高亮 Hint: 提示 @@ -401,7 +403,7 @@ In following homework: 在以下作业中 In following training plans: 在下列训练计划中 In Progress: 进行中 Information: 信息 -Init Discussion Nodes: 初始化讨论结点 +Init Discussion Nodes: 初始化公告结点 Initialize: 初始化 Inline codes: 行内代码 Inline formulas: 行内公式 @@ -443,11 +445,11 @@ List View: 列表视图 Live: 正在进行 Live...: 正在进行… Location: 位置 -Lock discussions: 锁定讨论 +Lock discussions: 锁定公告 Lock Topic: 锁定主题 Login to Attend Contest: 登录后参加比赛 Login to Claim Homework: 登录后认领作业 -Login to Create a Discussion: 登录后创建讨论 +Login to Create a Discussion: 登录后创建公告 Login to join training plan: 登录以参加训练计划 Login to Submit: 登录后递交 Login: 登录 @@ -501,10 +503,10 @@ New Training Plan: 新训练计划 New: 创建 No comments so far...: 目前还没有评论... No dataset at present.: 暂无测试数据。 -No discussion yet...: 目前没有讨论… +No discussion yet...: 目前没有公告… No Permission to Attend Contest: 您没有权限参加比赛 No Permission to Claim Homework: 您没有权限认领作业 -No Permission to Create a Discussion: 您没有权限创建讨论 +No Permission to Create a Discussion: 您没有权限创建公告 No Permission to Submit: 您没有权限递交 No problem.: 没有题目。 No solutions so far...: 目前还没有题解... @@ -521,7 +523,7 @@ Not started with a number: 不以数字开头 Not wrapped with space: 两侧不含空格 Numeric PID: 数字题号 Oh, the user doesn't have any contributions!: 啊哦,这个用户还没贡献过题目~ -Oh, the user hasn't created any discussions yet!: 这个用户还没有发布过讨论 +Oh, the user hasn't created any discussions yet!: 这个用户还没有发布过公告 Oh, the user hasn't submitted yet!: 这个用户还没有交过题 _(:зゝ∠)_ Oh, there are no tasks that match the filter!: 喔,目前没有符合过滤条件的任务。 Oh, there is no clarification!: 喔,目前没有提问! @@ -559,7 +561,7 @@ Path {0} not found.: 路径 {0} 不存在。 Peak Memory: 峰值内存 Penalty (Minutes): 罚时(分钟) perm_contest: 比赛 -perm_discussion: 讨论 +perm_discussion: 公告 perm_general: 一般 perm_homework: 作业 perm_problem_solution: 题解 @@ -572,7 +574,7 @@ Permissions: 权限 Phone: 手机号 Pick a problem randomly based on the current filter.: 根据当前过滤条件随机选择一道题 pid: 题目 ID -Pin discussions: 置顶讨论 +Pin discussions: 置顶公告 Pin training plans: 置顶训练计划 Plan: 计划 Please attend contest to see the problems.: 请参加比赛来查看题目。 @@ -629,6 +631,7 @@ Quit Scratchpad: 退出在线编程模式 Quote: 引用 Rank: 排名 ranking: 排名 +React to discussion: 反应公告 Read record codes after accept: 题目通过后读取记录的代码 Recalculates nSubmit and nAccept in problem status.: 重新计算每道题目的 AC 量和提交量 Recommended: 推荐 @@ -643,7 +646,7 @@ Registered at: 注册于 Rejudge problems: 重测题目 Rejudge records: 重测记录 Rejudge: 重测 -Related Discussions: 相关讨论 +Related Discussions: 相关公告 Related: 相关 Relax and try to remember your password.: 放松,尝试回忆您设置的密码。 Remember me: 记住我 @@ -652,7 +655,7 @@ Remove this data: 移除这组数据 Remove: 移除 Repeat Password: 重复密码 Replies per page: 每页展示的回复数量 -Reply discussions: 回复讨论 +Reply discussions: 回复公告 Reply problem solutions: 回复题解 reply: 回复 Reply: 回复 @@ -689,7 +692,7 @@ Secret (visible to admins): 保密(对管理员可见) Secret: 保密 Section: 章节 Security: 安全 -Select a node to create discussion.: 选择一个节点来发表讨论。 +Select a node to create discussion.: 选择一个节点来发表公告。 Select a role: 选择一个角色 Select Category: 选择标签 Select User: 选择用户 @@ -743,7 +746,7 @@ Sorry: 对不起 Sort by: 排序 Source type: 来源类型 Split View: 分屏预览 -Star Topic: 收藏讨论 +Star Topic: 收藏公告 Star: 收藏 Starred Problems: 收藏的题目 Start at: 开始于 @@ -774,7 +777,7 @@ Terms of Service: 服务条款 Test data comes from: 测试数据来自 Testdata Config: 测试数据配置 Text: 文本 -The discussion is locked, you can not reply anymore.: 此讨论已经锁定,您不能再回复。 +The discussion is locked, you can not reply anymore.: 此公告已经锁定,您不能再回复。 The homework's deadline is due but in extension. You can still submit for this problem but your score will be penalized.: 作业已超过截止时间,但仍在延期时间内。您递交题目将无法获得全部分数。 The invitation code to enter to successfully join the domain. You can only use letters and numbers in the code and it should not be longer than 64 characters.: 加入此域的邀请码。您只能使用字母和数字,并且不能长于 64 个字符。 The invitation code you provided is invalid.: 您提供的邀请码无效。 @@ -872,7 +875,7 @@ View contest scoreboard: 查看比赛成绩表 View Contest: 查看比赛 View contests: 查看比赛 View Details: 查看详情 -View discussions: 查看讨论 +View discussions: 查看公告 View domain user displayname: 显示域中用户的显示名 View hidden contest submission status and scoreboard: 查看隐藏的比赛递交状态和成绩表 View hidden homework submission status and scoreboard: 查看隐藏的作业递交状态和成绩表 @@ -880,7 +883,7 @@ View hidden problems: 查看隐藏的题目 View homework scoreboard: 查看作业成绩表 View homework: 查看作业 View Homework: 查看作业 -View or create discussion: 查看与发表讨论 +View or create discussion: 查看与发表公告 View or submit solution: 查看与发表题解 View Owned Problems: 查看自己的题目 View Owned Training Plans: 查看自己的训练计划 @@ -933,4 +936,10 @@ You've already attended this contest.: 您已经参加本次比赛。 You've already claimed this homework.: 您已认领过该作业。 You've already voted.: 您已经投过票。 Your permission: 您的权限 -Your role: 您的角色 \ No newline at end of file +Your role: 您的角色 +# HGNU Added +Stu_Name: 姓名 +Stu_Class: 班级 +Stu_Stuid: 学号 +class: 班级 +manage_student_import: 学生批量导入 diff --git a/packages/hydrooj/setting.yaml b/packages/hydrooj/setting.yaml index 5d79177aa6..25f8546000 100644 --- a/packages/hydrooj/setting.yaml +++ b/packages/hydrooj/setting.yaml @@ -62,29 +62,23 @@ langs: display: C++ address_space_limit: true process_limit: 1 - cc.cc98: - compile: /usr/bin/g++ -Wall -std=c++98 -o foo foo.cc -lm -I/include - display: C++98 - cc.cc98o2: - compile: /usr/bin/g++ -Wall -std=c++98 -o foo foo.cc -lm -O2 -I/include - display: C++98(O2) - cc.cc11: - compile: /usr/bin/g++ -Wall -std=c++11 -o foo foo.cc -lm -I/include - display: C++11 - cc.cc11o2: - compile: /usr/bin/g++ -Wall -std=c++11 -o foo foo.cc -lm -O2 -I/include - display: C++11(O2) - cc.cc14: - display: C++14 - cc.cc14o2: - compile: /usr/bin/g++ -Wall -std=c++14 -o foo foo.cc -lm -O2 -I/include - display: C++14(O2) cc.cc17: compile: /usr/bin/g++ -Wall -std=c++17 -o foo foo.cc -lm -I/include display: C++17 cc.cc17o2: compile: /usr/bin/g++ -Wall -std=c++17 -o foo foo.cc -lm -O2 -I/include display: C++17(O2) + cc.cc14: + display: C++14 + cc.cc14o2: + compile: /usr/bin/g++ -Wall -std=c++14 -o foo foo.cc -lm -O2 -I/include + display: C++14(O2) + cc.cc11: + compile: /usr/bin/g++ -Wall -std=c++11 -o foo foo.cc -lm -I/include + display: C++11 + cc.cc11o2: + compile: /usr/bin/g++ -Wall -std=c++11 -o foo foo.cc -lm -O2 -I/include + display: C++11(O2) pas: compile: /usr/bin/fpc -O2 -o/w/foo foo.pas highlight: pascal diff --git a/packages/hydrooj/src/handler/contest.ts b/packages/hydrooj/src/handler/contest.ts index 2cb4f27cd7..308d3ad0d5 100644 --- a/packages/hydrooj/src/handler/contest.ts +++ b/packages/hydrooj/src/handler/contest.ts @@ -367,7 +367,7 @@ export class ContestScoreboardHandler extends ContestDetailBaseHandler { `@submissions ${submissions.length}`, ].concat( tdoc.pids.map((i, idx) => `@p ${pid(idx)},${escape(pdict[i]?.title || 'Unknown Problem')},20,0`), - teams.map((i, idx) => `@t ${idx + 1},0,1,${escape(udict[i.uid].school || unknownSchool)}-${escape(udict[i.uid].uname)}`), + teams.map((i, idx) => `@t ${idx + 1},0,1,${escape(udict[i.uid].class || unknownSchool)}-${escape(udict[i.uid].name)}`), submissions, ); this.binary(res.join('\n'), `${this.tdoc.title}.ghost`); diff --git a/packages/hydrooj/src/handler/discussion.ts b/packages/hydrooj/src/handler/discussion.ts index 5c61886674..05d2d41731 100644 --- a/packages/hydrooj/src/handler/discussion.ts +++ b/packages/hydrooj/src/handler/discussion.ts @@ -186,12 +186,10 @@ class DiscussionDetailHandler extends DiscussionHandler { reactions[drdoc._id.toHexString()] = reaction; }))); const udict = await user.getList(domainId, uids); - if (!dsdoc?.view && this.user.hasPriv(PRIV.PRIV_USER_PROFILE)) { - await Promise.all([ - discussion.inc(domainId, did, 'views', 1), - discussion.setStatus(domainId, did, this.user._id, { view: true }), - ]); - } + await Promise.all([ + discussion.inc(domainId, did, 'views', 1), + discussion.setStatus(domainId, did, this.user._id, { view: true }), + ]); const path = [ ['Hydro', 'homepage'], ['discussion_main', 'discussion_main'], diff --git a/packages/hydrooj/src/handler/domain.ts b/packages/hydrooj/src/handler/domain.ts index 48d4e255fe..df8a9c9827 100644 --- a/packages/hydrooj/src/handler/domain.ts +++ b/packages/hydrooj/src/handler/domain.ts @@ -362,6 +362,22 @@ class DomainSearchHandler extends Handler { } } +class CourseHandler extends Handler { + async get() { + const domains: any[] = await domain.getMulti({ _id: { $ne: 'system' }, publicToCourses: { $eq: true } }).toArray(); + const uDocs: any = {}; + for await (const d of domains) { + uDocs[d.owner] = await user.getById('system', d.owner); + d['users'] = (await domain.getMultiUserInDomain(d._id).toArray()).length; + } + this.response.template = 'courses_main.html'; + this.response.body = { + domains, + uDocs, + }; + } +} + export async function apply(ctx: Context) { ctx.Route('ranking', '/ranking', DomainRankHandler, PERM.PERM_VIEW_RANKING); ctx.Route('domain_dashboard', '/domain/dashboard', DomainDashboardHandler); @@ -373,4 +389,5 @@ export async function apply(ctx: Context) { ctx.Route('domain_join_applications', '/domain/join_applications', DomainJoinApplicationsHandler); ctx.Route('domain_join', '/domain/join', DomainJoinHandler, PRIV.PRIV_USER_PROFILE); ctx.Route('domain_search', '/domain/search', DomainSearchHandler, PRIV.PRIV_USER_PROFILE); + ctx.Route('courses', '/courses', CourseHandler); } diff --git a/packages/hydrooj/src/handler/home.ts b/packages/hydrooj/src/handler/home.ts index 87cf1d074a..a7141ec3dd 100644 --- a/packages/hydrooj/src/handler/home.ts +++ b/packages/hydrooj/src/handler/home.ts @@ -371,6 +371,7 @@ function set(s: Setting, key: string, value: any) { throw new ValidationError(key); } } + if (s.validator && !s.validator(value)) throw new ValidationError(key); return value; } return undefined; diff --git a/packages/hydrooj/src/handler/manage.ts b/packages/hydrooj/src/handler/manage.ts index 4215d28303..1c6bf38460 100644 --- a/packages/hydrooj/src/handler/manage.ts +++ b/packages/hydrooj/src/handler/manage.ts @@ -11,6 +11,7 @@ import { PRIV, STATUS } from '../model/builtin'; import domain from '../model/domain'; import record from '../model/record'; import * as setting from '../model/setting'; +import StudentModel from '../model/stuinfo'; import * as system from '../model/system'; import user from '../model/user'; import { check } from '../service/check'; @@ -278,6 +279,60 @@ class SystemUserImportHandler extends SystemHandler { this.response.body.messages = messages; } } + +class SystemStudentImportHandler extends SystemHandler { + async get() { + this.response.body.users = []; + this.response.template = 'manage_student_import.html'; + } + + @param('students', Types.Content) + @param('draft', Types.Boolean) + async post(domainId: string, students: string, draft: boolean) { + const users = students.split('\n'); + const udocs = []; + const messages = []; + for (const i in users) { + const u = users[i]; + if (!u.trim()) continue; + let [email, username, password, realname, classname, stuid] = u.split(',').map((t) => t.trim()); + if (!email || !username || !password) [email, username, password, realname, classname, stuid] = u.split('\t').map((t) => t.trim()); + if (email && username && password) { + if (!Types.Email[1](email)) messages.push(`Line ${+i + 1}: Invalid email.`); + else if (!Types.Username[1](username)) messages.push(`Line ${+i + 1}: Invalid username`); + else if (!Types.Password[1](password)) messages.push(`Line ${+i + 1}: Invalid password`); + else if (!/^[\u4E00-\u9FA5]{2,4}$/.test(realname)) messages.push(`Line ${+i + 1}: Invalid realname`); + else if (await user.getByEmail('system', email)) { + messages.push(`Line ${+i + 1}: Email ${email} already exists.`); + } else if (await StudentModel.getStuInfoByStuId(stuid)) { + messages.push(`Line ${+i + 1}: stuid ${stuid} already been registered.`); + } else if (await user.getByUname('system', username)) { + messages.push(`Line ${+i + 1}: Username ${username} already exists.`); + } else { + udocs.push({ + email, username, password, realname, classname, stuid, + }); + } + } else messages.push(`Line ${+i + 1}: Input invalid.`); + } + messages.push(`${udocs.length} students found.`); + logger.info(messages); + if (!draft) { + await Promise.all(udocs.map(async ({ + email, username, password, realname, classname, stuid, + }) => { + try { + const uid = await user.create(email, username, password); + await StudentModel.create(uid, classname, realname, stuid); + } catch (e) { + messages.push(e.message); + } + })); + } + this.response.body.users = udocs; + this.response.body.messages = messages; + } +} /* eslint-enable no-await-in-loop */ const Priv = omit(PRIV, ['PRIV_DEFAULT', 'PRIV_NEVER', 'PRIV_NONE', 'PRIV_ALL']); @@ -325,6 +380,7 @@ export async function apply(ctx) { ctx.Route('manage_setting', '/manage/setting', SystemSettingHandler); ctx.Route('manage_config', '/manage/config', SystemConfigHandler); ctx.Route('manage_user_import', '/manage/userimport', SystemUserImportHandler); + ctx.Route('manage_student_import', '/manage/studentimport', SystemStudentImportHandler); ctx.Route('manage_user_priv', '/manage/userpriv', SystemUserPrivHandler); ctx.Connection('manage_check', '/manage/check-conn', SystemCheckConnHandler); } diff --git a/packages/hydrooj/src/handler/record.ts b/packages/hydrooj/src/handler/record.ts index 9eae08f921..d48d759e81 100644 --- a/packages/hydrooj/src/handler/record.ts +++ b/packages/hydrooj/src/handler/record.ts @@ -17,6 +17,7 @@ import storage from '../model/storage'; import * as system from '../model/system'; import TaskModel from '../model/task'; import user from '../model/user'; +import db from '../service/db'; import { ConnectionHandler, param, subscribe, Types, } from '../service/server'; @@ -24,6 +25,8 @@ import { buildProjection } from '../utils'; import { ContestDetailBaseHandler } from './contest'; import { postJudge } from './judge'; +const collDoc = db.collection('document'); + class RecordListHandler extends ContestDetailBaseHandler { tdoc?: Tdoc<30>; @@ -199,7 +202,11 @@ class RecordDetailHandler extends ContestDetailBaseHandler { const pdoc = await problem.get(domainId, this.rdoc.pid); if (!pdoc?.config || typeof pdoc.config === 'string') throw new ProblemConfigError(); const priority = await record.submissionPriority(this.user._id, -20); - const isContest = this.rdoc.contest && this.rdoc.contest.toString() !== '000000000000000000000000'; + let isContest = this.rdoc.contest && this.rdoc.contest.toString() !== '000000000000000000000000'; + if (this.rdoc.contest) { + const ruleDoc = await collDoc.findOne({ _id: this.rdoc.contest }); + isContest = ruleDoc['rule'] !== 'homework'; + } const rdoc = await record.reset(domainId, rid, true); this.ctx.broadcast('record/change', rdoc); await record.judge(domainId, rid, priority, isContest ? { detail: false } : {}); diff --git a/packages/hydrooj/src/handler/user.ts b/packages/hydrooj/src/handler/user.ts index f74534b928..1c48c42a73 100644 --- a/packages/hydrooj/src/handler/user.ts +++ b/packages/hydrooj/src/handler/user.ts @@ -20,9 +20,11 @@ import * as oplog from '../model/oplog'; import problem, { ProblemDoc } from '../model/problem'; import ScheduleModel from '../model/schedule'; import SolutionModel from '../model/solution'; +import student from '../model/stuinfo'; import * as system from '../model/system'; import token from '../model/token'; import user, { deleteUserCache } from '../model/user'; +import * as bus from '../service/bus'; import { Handler, param, post, Types, } from '../service/server'; @@ -304,15 +306,29 @@ class UserRegisterWithCodeHandler extends Handler { @param('verifyPassword', Types.Password) @param('uname', Types.Username) @param('code', Types.String) + // 学生信息 + @param('stuname', Types.String, (s) => /^[\u4E00-\u9FA5]{2,4}$/.test(s)) + @param('stuid', Types.String, (s) => /^2\d{7}$|2\d{12}$/.test(s)) + @param('stuclass', Types.String, (s) => /^[\u4E00-\u9FA5]{2,4}[1-2][0-9]{3}$/.test(s)) async post( - domainId: string, password: string, verify: string, - uname: string, code: string, + domainId: string, + password: string, + verify: string, + uname: string, + code: string, + // 学生信息 + stuname: string, + stuid: string, + stuclass: string, ) { const tdoc = await token.get(code, token.TYPE_REGISTRATION); if (!tdoc || (!tdoc.mail && !tdoc.phone)) throw new InvalidTokenError(token.TYPE_TEXTS[token.TYPE_REGISTRATION], code); if (password !== verify) throw new VerifyPasswordError(); + if (await student.getStuInfoByStuId(stuid)) throw new UserAlreadyExistError(stuid); if (tdoc.phone) tdoc.mail = `${String.random(12)}@hydro.local`; const uid = await user.create(tdoc.mail, uname, password, undefined, this.request.ip); + // 插入学生信息 + await student.create(uid, stuclass, stuname, stuid); await token.del(code, token.TYPE_REGISTRATION); const [id, mailDomain] = tdoc.mail.split('@'); const $set: any = tdoc.set || {}; @@ -420,12 +436,13 @@ class UserDetailHandler extends Handler { } } const tags = Object.entries(acInfo).sort((a, b) => b[1] - a[1]).slice(0, 20); + const studoc = await student.getStuInfoById(uid); const tsdocs = await ContestModel.getMultiStatus(domainId, { uid, attend: { $exists: true } }).project({ docId: 1 }).toArray(); const tdocs = await ContestModel.getMulti(domainId, { docId: { $in: tsdocs.map((i) => i.docId) } }) .project({ docId: 1, title: 1, rule: 1 }).sort({ _id: -1 }).toArray(); this.response.template = 'user_detail.html'; this.response.body = { - isSelfProfile, udoc, sdoc, pdocs, tags, tdocs, + isSelfProfile, udoc, sdoc, pdocs, tags, tdocs, studoc, }; if (this.user.hasPerm(PERM.PERM_VIEW_PROBLEM_SOLUTION)) { const psdocs = await SolutionModel.getByUser(domainId, uid).limit(10).toArray(); @@ -521,6 +538,71 @@ class OauthCallbackHandler extends Handler { } } +// HGNUOJ 学生信息 +class StudentInfoHandler extends Handler { + // @param('uid', Types.Int) + // async get(domainId: string, uid: number) { + // const res = await student.getStuInfoById(uid); + // this.response.body = res; + // } + + @param('uid', Types.Int) + @post('cls', Types.String, true) + @post('name', Types.String, true) + @post('stuid', Types.String, true) + async post(domainId: string, uid: number, cls?: string, name?: string, stuid?: string) { + const studoc = { + class: cls, name, stuid, + }; + const $set = {}; + for (const key in studoc) { + if (studoc[key] !== undefined) $set[key] = studoc[key]; + } + const res = await student.setById(uid, $set); + return res; + } +} + +// HGNUOJ 班级信息 +class StudentClassHandler extends Handler { + @param('cls', Types.String) + async get(domainId: string, cls: string) { + const udocs = await student.getUserListByClassName(domainId, cls); + udocs.sort((a, b) => parseInt(a.stuid, 10) - parseInt(b.stuid, 10)); + const sdocsTemp = await Promise.all(udocs.map(async ({ _id }) => { + const { updateAt } = await token.getMostRecentSessionByUid(_id, ['createAt', 'updateAt']) || { updateAt: null }; + return { _id, updateAt }; + })); + const sdocs = {}; + for (const sdoc of sdocsTemp) sdocs[sdoc['_id']] = sdoc['updateAt']; + this.response.template = 'stu_class_students.html'; + this.response.body = { + className: cls, + udocs, + sdocs, + }; + this.UiContext.extraTitleContent = cls; + } +} +class ClassHandler extends Handler { + async get(domainId: string) { + const cls: { clsList: any[] } = await student.getClassList(); + const starStudents: any[] = await Promise.all( + cls.clsList.slice(0, 2).map(async ({ _id }) => ({ _id, students: await student.getUserListByClassNameOrdered(domainId, _id, 3) })), + ); + this.response.template = 'stu_class_list.html'; + this.response.body = { + ...cls, starStudents, + }; + } + + async postInvalidateCache() { + await bus.broadcast('student/invalidateClassListCache'); + await bus.broadcast('student/invalidateActivityCache'); + this.back(); + } +} + class ContestModeHandler extends Handler { async get() { const bindings = await user.getMulti({ loginip: { $exists: true } }) @@ -552,6 +634,9 @@ export async function apply(ctx) { ctx.Route('user_lostpass_with_code', '/lostpass/:code', UserLostPassWithCodeHandler); ctx.Route('user_delete', '/user/delete', UserDeleteHandler, PRIV.PRIV_USER_PROFILE); ctx.Route('user_detail', '/user/:uid(-?\\d+)', UserDetailHandler); + ctx.Route('student_detail', '/student/:uid', StudentInfoHandler, PRIV.PRIV_USER_PROFILE); + ctx.Route('student_class', '/class/:cls', StudentClassHandler, PRIV.PRIV_USER_PROFILE); + ctx.Route('class', '/class', ClassHandler, PRIV.PRIV_USER_PROFILE); if (system.get('server.contestmode')) { ctx.Route('contest_mode', '/contestmode', ContestModeHandler, PRIV.PRIV_EDIT_SYSTEM); } diff --git a/packages/hydrooj/src/interface.ts b/packages/hydrooj/src/interface.ts index bfd1da3d6e..6204669529 100644 --- a/packages/hydrooj/src/interface.ts +++ b/packages/hydrooj/src/interface.ts @@ -38,6 +38,7 @@ export interface SystemKeys { 'user.quota': number, } +type Validator = (value: any) => boolean; export interface Setting { family: string, key: string, @@ -48,6 +49,7 @@ export interface Setting { name: string, desc: string, flag: number, + validator?: Validator } export interface OAuthUserResponse { @@ -122,7 +124,13 @@ export interface UserPreferenceDoc { uid: number; content: string; } - +/* HGNUOJ 学生信息 */ +export interface Student extends Dictionary { + _id: number, + name: string, + stuid: string, + class: string +} export type ownerInfo = { owner: number, maintainer?: number[] }; export type User = import('./model/user').User; @@ -355,7 +363,8 @@ export interface JudgeRequest extends Omit { } export interface ScoreboardNode { - type: 'string' | 'rank' | 'user' | 'email' | 'record' | 'records' | 'problem' | 'solved' | 'time' | 'total_score'; + // eslint-disable-next-line max-len + type: 'string' | 'rank' | 'user' | 'email' | 'record' | 'records' | 'problem' | 'solved' | 'time' | 'total_score' | 'stu_class' | 'stu_name' | 'stu_stuid'; value: string; raw?: any; score?: number; @@ -388,7 +397,6 @@ export interface Tdoc { bulletin: string, _join?: any, host?: string[], + publicToCourses: boolean } // Message @@ -546,13 +555,13 @@ export interface ContestRule { ) => Promise; scoreboardRow: ( this: ContestRule, config: ScoreboardConfig, _: (s: string) => string, - tdoc: Tdoc<30>, pdict: ProblemDict, udoc: BaseUser, rank: number, tsdoc: ContestStat & T, + tdoc: Tdoc<30>, pdict: ProblemDict, udoc: Udoc | User, rank: number, tsdoc: ContestStat & T, meta?: any, ) => Promise; scoreboard: ( this: ContestRule, config: ScoreboardConfig, _: (s: string) => string, tdoc: Tdoc<30>, pdict: ProblemDict, cursor: FindCursor, - ) => Promise<[board: ScoreboardRow[], udict: BaseUserDict]>; + ) => Promise<[board: ScoreboardRow[], udict: Udict]>; ranked: (tdoc: Tdoc<30>, cursor: FindCursor) => Promise<[number, ContestStat & T][]>; } @@ -681,6 +690,7 @@ declare module './service/db' { 'blacklist': BlacklistDoc; 'domain': DomainDoc; 'domain.user': any; + 'stu.info': Student; 'record': RecordDoc; 'document': any; 'document.status': StatusDocBase & { @@ -708,6 +718,7 @@ declare module './service/db' { } export interface Model { + student: typeof import('./model/stuinfo').default; blacklist: typeof import('./model/blacklist').default, builtin: typeof import('./model/builtin'), contest: typeof import('./model/contest'), diff --git a/packages/hydrooj/src/lib/ui.ts b/packages/hydrooj/src/lib/ui.ts index 145e956922..6ef620e5da 100644 --- a/packages/hydrooj/src/lib/ui.ts +++ b/packages/hydrooj/src/lib/ui.ts @@ -53,10 +53,10 @@ export const ProblemAdd = (name, args, icon = 'add', text = 'Create Problem') => inject('Nav', 'homepage', { prefix: 'homepage' }); inject('Nav', 'problem_main', { prefix: 'problem' }, PERM.PERM_VIEW_PROBLEM); -inject('Nav', 'training_main', { prefix: 'training' }, PERM.PERM_VIEW_TRAINING); -inject('Nav', 'contest_main', { prefix: 'contest' }, PERM.PERM_VIEW_CONTEST); inject('Nav', 'homework_main', { prefix: 'homework' }, PERM.PERM_VIEW_HOMEWORK); -inject('Nav', 'discussion_main', { prefix: 'discussion' }, PERM.PERM_VIEW_DISCUSSION); +inject('Nav', 'contest_main', { prefix: 'contest' }, PERM.PERM_VIEW_CONTEST); +inject('Nav', 'courses', { prefix: 'courses' }, PRIV.PRIV_USER_PROFILE); +inject('Nav', 'training_main', { prefix: 'training' }, PERM.PERM_VIEW_TRAINING); inject('Nav', 'record_main', { prefix: 'record', query: (handler) => (handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) @@ -64,12 +64,14 @@ inject('Nav', 'record_main', { : ({})), }); inject('Nav', 'ranking', { prefix: 'ranking' }, PERM.PERM_VIEW_RANKING); +inject('Nav', 'discussion_main', { prefix: 'discussion' }, PERM.PERM_VIEW_DISCUSSION); inject('Nav', 'domain_dashboard', { prefix: 'domain' }, PERM.PERM_EDIT_DOMAIN); inject('Nav', 'manage_dashboard', { prefix: 'manage' }, PRIV.PRIV_EDIT_SYSTEM); inject('ProblemAdd', 'problem_create', { icon: 'add', text: 'Create Problem' }); inject('ControlPanel', 'manage_dashboard'); inject('ControlPanel', 'manage_script'); inject('ControlPanel', 'manage_user_import'); +inject('ControlPanel', 'manage_student_import'); inject('ControlPanel', 'manage_user_priv'); inject('ControlPanel', 'manage_setting'); inject('ControlPanel', 'manage_config'); diff --git a/packages/hydrooj/src/model/builtin.ts b/packages/hydrooj/src/model/builtin.ts index 8066689bd4..1f29eb4ab8 100644 --- a/packages/hydrooj/src/model/builtin.ts +++ b/packages/hydrooj/src/model/builtin.ts @@ -188,27 +188,14 @@ PERM.PERM_BASIC = PERM.PERM_VIEW | PERM.PERM_VIEW_RANKING; PERM.PERM_DEFAULT = PERM.PERM_VIEW - | PERM.PREM_VIEW_DISPLAYNAME | PERM.PERM_VIEW_PROBLEM | PERM.PERM_EDIT_PROBLEM_SELF | PERM.PERM_SUBMIT_PROBLEM | PERM.PERM_VIEW_PROBLEM_SOLUTION | PERM.PERM_VIEW_PROBLEM_SOLUTION_ACCEPT - | PERM.PERM_CREATE_PROBLEM_SOLUTION | PERM.PERM_VOTE_PROBLEM_SOLUTION - | PERM.PERM_EDIT_PROBLEM_SOLUTION_SELF - | PERM.PERM_DELETE_PROBLEM_SOLUTION_SELF - | PERM.PERM_REPLY_PROBLEM_SOLUTION - | PERM.PERM_EDIT_PROBLEM_SOLUTION_REPLY_SELF - | PERM.PERM_DELETE_PROBLEM_SOLUTION_REPLY_SELF | PERM.PERM_VIEW_DISCUSSION - | PERM.PERM_CREATE_DISCUSSION - | PERM.PERM_EDIT_DISCUSSION_SELF - | PERM.PERM_REPLY_DISCUSSION | PERM.PERM_ADD_REACTION - | PERM.PERM_EDIT_DISCUSSION_REPLY_SELF - | PERM.PERM_DELETE_DISCUSSION_REPLY_SELF - | PERM.PERM_DELETE_DISCUSSION_REPLY_SELF_DISCUSSION | PERM.PERM_VIEW_CONTEST | PERM.PERM_VIEW_CONTEST_SCOREBOARD | PERM.PERM_ATTEND_CONTEST @@ -216,18 +203,10 @@ PERM.PERM_DEFAULT = PERM.PERM_VIEW | PERM.PERM_VIEW_HOMEWORK | PERM.PERM_VIEW_HOMEWORK_SCOREBOARD | PERM.PERM_ATTEND_HOMEWORK - | PERM.PERM_EDIT_HOMEWORK_SELF | PERM.PERM_VIEW_TRAINING - | PERM.PERM_CREATE_TRAINING - | PERM.PERM_EDIT_TRAINING_SELF | PERM.PERM_SUBMIT_PROBLEM - | PERM.PERM_CREATE_PROBLEM_SOLUTION | PERM.PERM_VOTE_PROBLEM_SOLUTION - | PERM.PERM_REPLY_PROBLEM_SOLUTION - | PERM.PERM_CREATE_DISCUSSION - | PERM.PERM_REPLY_DISCUSSION | PERM.PERM_ATTEND_CONTEST - | PERM.PERM_CREATE_TRAINING | PERM.PERM_ATTEND_HOMEWORK | PERM.PERM_VIEW_RANKING; diff --git a/packages/hydrooj/src/model/contest.ts b/packages/hydrooj/src/model/contest.ts index 76083269e3..daf95dc229 100644 --- a/packages/hydrooj/src/model/contest.ts +++ b/packages/hydrooj/src/model/contest.ts @@ -6,8 +6,8 @@ import { ContestScoreboardHiddenError, ValidationError, } from '../error'; import { - BaseUserDict, ContestRule, ContestRules, ProblemDict, - ScoreboardConfig, ScoreboardNode, ScoreboardRow, SubtaskResult, Tdoc, + ContestRule, ContestRules, ProblemDict, + ScoreboardConfig, ScoreboardNode, ScoreboardRow, SubtaskResult, Tdoc, Udict, } from '../interface'; import ranked from '../lib/rank'; import * as bus from '../service/bus'; @@ -96,14 +96,11 @@ const acm = buildContestRule({ async scoreboardHeader(config, _, tdoc, pdict) { const columns: ScoreboardRow = [ { type: 'rank', value: '#' }, + { type: 'stu_class', value: _('Stu_Class') }, { type: 'user', value: _('User') }, + { type: 'stu_stuid', value: _('Stu_Stuid') }, ]; - if (config.isExport) { - columns.push({ type: 'email', value: _('Email') }); - columns.push({ type: 'string', value: _('School') }); - columns.push({ type: 'string', value: _('Name') }); - columns.push({ type: 'string', value: _('Student ID') }); - } + if (config.isExport) columns.push({ type: 'stu_name', value: _('Stu_Name') }, { type: 'email', value: _('Email') }); columns.push({ type: 'solved', value: `${_('Solved')}\n${_('Total Time')}` }); for (let i = 1; i <= tdoc.pids.length; i++) { const pid = tdoc.pids[i - 1]; @@ -132,14 +129,17 @@ const acm = buildContestRule({ async scoreboardRow(config, _, tdoc, pdict, udoc, rank, tsdoc, meta) { const row: ScoreboardRow = [ { type: 'rank', value: rank.toString() }, + { + type: 'string', + value: udoc.class || '', + }, { type: 'user', value: udoc.uname, raw: tsdoc.uid }, + { + type: 'string', + value: udoc.stuid || '', + }, ]; - if (config.isExport) { - row.push({ type: 'email', value: udoc.mail }); - row.push({ type: 'string', value: udoc.school || '' }); - row.push({ type: 'string', value: udoc.displayName || '' }); - row.push({ type: 'string', value: udoc.studentId || '' }); - } + if (config.isExport) row.push({ type: 'string', value: udoc.name }, { type: 'email', value: udoc.mail }); row.push({ type: 'time', value: `${tsdoc.accept || 0}\n${formatSeconds(tsdoc.time || 0.0, false)}`, @@ -184,7 +184,7 @@ const acm = buildContestRule({ async scoreboard(config, _, tdoc, pdict, cursor) { const rankedTsdocs = await ranked(cursor, (a, b) => a.score === b.score && a.time === b.time); const uids = rankedTsdocs.map(([, tsdoc]) => tsdoc.uid); - const udict = await user.getListForRender(tdoc.domainId, uids); + const udict = await user.getList(tdoc.domainId, uids); // Find first accept const first = {}; const data = await document.collStatus.aggregate([ @@ -252,14 +252,11 @@ const oi = buildContestRule({ async scoreboardHeader(config, _, tdoc, pdict) { const columns: ScoreboardNode[] = [ { type: 'rank', value: '#' }, + { type: 'stu_class', value: _('Stu_Class') }, { type: 'user', value: _('User') }, + { type: 'stu_stuid', value: _('Stu_Stuid') }, ]; - if (config.isExport) { - columns.push({ type: 'email', value: _('Email') }); - columns.push({ type: 'string', value: _('School') }); - columns.push({ type: 'string', value: _('Name') }); - columns.push({ type: 'string', value: _('Student ID') }); - } + if (config.isExport) columns.push({ type: 'stu_name', value: _('Stu_Name') }, { type: 'email', value: _('Email') }); columns.push({ type: 'total_score', value: _('Total Score') }); for (let i = 1; i <= tdoc.pids.length; i++) { const pid = tdoc.pids[i - 1]; @@ -282,14 +279,17 @@ const oi = buildContestRule({ async scoreboardRow(config, _, tdoc, pdict, udoc, rank, tsdoc, meta) { const row: ScoreboardNode[] = [ { type: 'rank', value: rank.toString() }, + { + type: 'string', + value: udoc.class || '', + }, { type: 'user', value: udoc.uname, raw: tsdoc.uid }, + { + type: 'string', + value: udoc.stuid || '', + }, ]; - if (config.isExport) { - row.push({ type: 'email', value: udoc.mail }); - row.push({ type: 'string', value: udoc.school || '' }); - row.push({ type: 'string', value: udoc.displayName || '' }); - row.push({ type: 'string', value: udoc.studentId || '' }); - } + if (config.isExport) row.push({ type: 'string', value: udoc.name }, { type: 'email', value: udoc.mail }); row.push({ type: 'total_score', value: tsdoc.score || 0 }); for (const s of tsdoc.journal || []) { if (!pdict[s.pid]) continue; @@ -330,7 +330,7 @@ const oi = buildContestRule({ async scoreboard(config, _, tdoc, pdict, cursor) { const rankedTsdocs = await ranked(cursor, (a, b) => a.score === b.score); const uids = rankedTsdocs.map(([, tsdoc]) => tsdoc.uid); - const udict = await user.getListForRender(tdoc.domainId, uids); + const udict = await user.getList(tdoc.domainId, uids); const psdict = {}; const first = {}; await Promise.all(tdoc.pids.map(async (pid) => { @@ -405,13 +405,12 @@ const strictioi = buildContestRule({ const row: ScoreboardNode[] = [ { type: 'rank', value: rank.toString() }, { type: 'user', value: udoc.uname, raw: tsdoc.uid }, + { + type: 'string', + value: udoc.stuid || '', + }, ]; - if (config.isExport) { - row.push({ type: 'email', value: udoc.mail }); - row.push({ type: 'string', value: udoc.school || '' }); - row.push({ type: 'string', value: udoc.displayName || '' }); - row.push({ type: 'string', value: udoc.studentId || '' }); - } + if (config.isExport) row.push({ type: 'string', value: udoc.name }, { type: 'email', value: udoc.mail }); row.push({ type: 'total_score', value: tsdoc.score || 0 }); for (const s of tsdoc.journal || []) { if (!pdict[s.pid]) continue; @@ -470,13 +469,14 @@ const ledo = buildContestRule({ const tsddict = tsdoc.detail || {}; const row: ScoreboardRow = [ { type: 'rank', value: rank.toString() }, + { + type: 'string', + value: udoc.class || '', + }, { type: 'user', value: udoc.uname, raw: tsdoc.uid }, ]; if (config.isExport) { row.push({ type: 'email', value: udoc.mail }); - row.push({ type: 'string', value: udoc.school || '' }); - row.push({ type: 'string', value: udoc.displayName || '' }); - row.push({ type: 'string', value: udoc.studentId || '' }); } row.push({ type: 'total_score', @@ -551,13 +551,16 @@ const homework = buildContestRule({ async scoreboardHeader(config, _, tdoc, pdict) { const columns: ScoreboardNode[] = [ { type: 'rank', value: _('Rank') }, + { type: 'stu_class', value: _('Stu_Class') }, { type: 'user', value: _('User') }, { type: 'total_score', value: _('Score') }, ]; if (config.isExport) { - columns.push({ type: 'string', value: _('Original Score') }); + columns.push( + { type: 'string', value: _('Original Score') }, + { type: 'stu_name', value: _('Stu_Name') }, + { type: 'stu_stuid', value: _('Stu_Stuid') }); } - columns.push({ type: 'time', value: _('Total Time') }); for (let i = 1; i <= tdoc.pids.length; i++) { const pid = tdoc.pids[i - 1]; pdict[pid].nAccept = pdict[pid].nSubmit = 0; @@ -571,10 +574,10 @@ const homework = buildContestRule({ type: 'string', value: '#{0} {1}'.format(i, _('Original Score')), }, - { - type: 'time', - value: '#{0} {1}'.format(i, _('Time (Seconds)')), - }, + // { + // type: 'time', + // value: '#{0} {1}'.format(i, _('Time (Seconds)')), + // }, ); } else { columns.push({ @@ -590,6 +593,10 @@ const homework = buildContestRule({ const tsddict = tsdoc.detail || {}; const row: ScoreboardRow = [ { type: 'rank', value: rank.toString() }, + { + type: 'string', + value: udoc.class || '', + }, { type: 'user', value: udoc.uname, @@ -601,33 +608,36 @@ const homework = buildContestRule({ }, ]; if (config.isExport) { - row.push({ type: 'string', value: tsdoc.score || 0 }); + row.push( + { type: 'string', value: tsdoc.score || 0 }, + { type: 'string', value: udoc.name }, + { type: 'string', value: udoc.stuid || '' }); } - row.push({ type: 'time', value: formatSeconds(tsdoc.time || 0, false), raw: tsdoc.time }); for (const s of tsdoc.journal || []) { if (!pdict[s.pid]) continue; pdict[s.pid].nSubmit++; if (s.status === STATUS.STATUS_ACCEPTED) pdict[s.pid].nAccept++; } + // row.push({ type: 'time', value: formatSeconds(tsdoc.time || 0, false), raw: tsdoc.time }); for (const pid of tdoc.pids) { const rid = tsddict[pid]?.rid; const colScore = tsddict[pid]?.penaltyScore ?? ''; const colOriginalScore = tsddict[pid]?.score ?? ''; - const colTime = tsddict[pid]?.time || ''; - const colTimeStr = colTime ? formatSeconds(colTime, false) : ''; + // const colTime = tsddict[pid]?.time || ''; + // const colTimeStr = colTime ? formatSeconds(colTime, false) : ''; if (config.isExport) { row.push( { type: 'string', value: colScore }, { type: 'string', value: colOriginalScore }, - { type: 'time', value: colTime }, + // { type: 'time', value: colTime }, ); } else { row.push({ type: 'record', score: tsddict[pid]?.penaltyScore || 0, value: colScore === colOriginalScore - ? '{0}\n{1}'.format(colScore, colTimeStr) - : '{0} / {1}\n{2}'.format(colScore, colOriginalScore, colTimeStr), + ? '{0}'.format(colScore) + : '{0} / {1}'.format(colScore, colOriginalScore), raw: rid, }); } @@ -637,7 +647,7 @@ const homework = buildContestRule({ async scoreboard(config, _, tdoc, pdict, cursor) { const rankedTsdocs = await ranked(cursor, (a, b) => a.score === b.score); const uids = rankedTsdocs.map(([, tsdoc]) => tsdoc.uid); - const udict = await user.getListForRender(tdoc.domainId, uids); + const udict = await user.getList(tdoc.domainId, uids); const columns = await this.scoreboardHeader(config, _, tdoc, pdict); const rows: ScoreboardRow[] = [ columns, @@ -898,7 +908,7 @@ export function canShowScoreboard(this: { user: User }, tdoc: Tdoc<30>, allowPer export async function getScoreboard( this: Handler, domainId: string, tid: ObjectId, config: ScoreboardConfig, -): Promise<[Tdoc<30>, ScoreboardRow[], BaseUserDict, ProblemDict]> { +): Promise<[Tdoc<30>, ScoreboardRow[], Udict, ProblemDict]> { const tdoc = await get(domainId, tid); if (!canShowScoreboard.call(this, tdoc)) throw new ContestScoreboardHiddenError(tid); const tsdocsCursor = getMultiStatus(domainId, { docId: tid }).sort(RULES[tdoc.rule].statusSort); diff --git a/packages/hydrooj/src/model/domain.ts b/packages/hydrooj/src/model/domain.ts index 5ec4f1b681..4849be77df 100644 --- a/packages/hydrooj/src/model/domain.ts +++ b/packages/hydrooj/src/model/domain.ts @@ -55,6 +55,7 @@ class DomainModel { bulletin, roles: {}, avatar: '', + publicToCourses: false, }; await bus.parallel('domain/create', ddoc); await coll.insertOne(ddoc); diff --git a/packages/hydrooj/src/model/record.ts b/packages/hydrooj/src/model/record.ts index 3d5344da84..77d45191ac 100644 --- a/packages/hydrooj/src/model/record.ts +++ b/packages/hydrooj/src/model/record.ts @@ -17,6 +17,8 @@ import { STATUS } from './builtin'; import problem from './problem'; import task from './task'; +const collDoc = db.collection('document'); + export default class RecordModel { static coll = db.collection('record'); static PROJECTION_LIST: (keyof RecordDoc)[] = [ @@ -131,10 +133,16 @@ export default class RecordModel { data.input = args.input || ''; data.contest = new ObjectId('000000000000000000000000'); } + let isNotContest = true; + if (args.type === 'contest') { + const ruleDoc = await collDoc.findOne({ _id: data.contest }); + isNotContest = ruleDoc['rule'] === 'homework'; + } const res = await RecordModel.coll.insertOne(data); if (addTask) { const priority = await RecordModel.submissionPriority(uid, args.type === 'pretest' ? -20 : (args.type === 'contest' ? 50 : 0)); - await RecordModel.judge(domainId, res.insertedId, priority, args.type === 'contest' ? { detail: false } : {}, { rejudge: data.rejudged }); + await RecordModel.judge(domainId, res.insertedId, priority, + args.type === 'contest' && !isNotContest ? { detail: false } : {}, { rejudge: data.rejudged }); } return res.insertedId; } diff --git a/packages/hydrooj/src/model/setting.ts b/packages/hydrooj/src/model/setting.ts index 135aa7c81b..c24125a696 100644 --- a/packages/hydrooj/src/model/setting.ts +++ b/packages/hydrooj/src/model/setting.ts @@ -46,9 +46,12 @@ export const SYSTEM_SETTINGS_BY_KEY: SettingDict = {}; // eslint-disable-next-line max-len export type SettingType = 'text' | 'yaml' | 'number' | 'float' | 'markdown' | 'password' | 'boolean' | 'textarea' | [string, string][] | Record | 'json'; +type Validator = (value: any) => boolean; + export const Setting = ( family: string, key: string, value: any = null, type: SettingType = 'text', name = '', desc = '', flag = 0, + validator?: Validator, ): _Setting => { let subType = ''; if (type === 'yaml' && typeof value !== 'string') { @@ -66,6 +69,7 @@ export const Setting = ( subType, type: typeof type === 'object' ? 'select' : type, range: typeof type === 'object' ? type : null, + validator, }; }; @@ -186,17 +190,20 @@ PreferenceSetting( ); AccountSetting( + Setting('setting_student', 'stuid', '', 'text', 'Stu_ID', + '', FLAG_DISABLED, (s) => /^2\d{7}$|2\d{12}$/.test(s)), + Setting('setting_student', 'name', '', 'text', 'Stu_RealName', + '', FLAG_DISABLED, (s) => /^[\u4E00-\u9FA5]{2,4}$/.test(s)), + Setting('setting_student', 'class', null, 'text', 'Stu_ClassName', + '', undefined, (s) => /^[\u4E00-\u9FA5]{2,4}[1-2][0-9]{3}$/.test(s)), Setting('setting_info', 'avatar', '', 'text', 'Avatar', 'Allow using gravatar:email qq:id github:name url:link format.'), Setting('setting_info', 'qq', null, 'text', 'QQ'), Setting('setting_info', 'gender', builtin.USER_GENDER_OTHER, builtin.USER_GENDER_RANGE, 'Gender'), - Setting('setting_info', 'bio', null, 'markdown', 'Bio'), - Setting('setting_info', 'school', '', 'text', 'School'), - Setting('setting_info', 'studentId', '', 'text', 'Student ID'), Setting('setting_info', 'phone', null, 'text', 'Phone', null, FLAG_DISABLED), Setting('setting_customize', 'backgroundImage', '/components/profile/backgrounds/1.jpg', 'text', 'Profile Background Image', - 'Choose the background image in your profile page.'), + 'Choose the background image in your profile page.', FLAG_DISABLED), Setting('setting_storage', 'unreadMsg', 0, 'number', 'Unread Message Count', null, FLAG_DISABLED | FLAG_HIDDEN), Setting('setting_storage', 'badge', '', 'text', 'badge info', null, FLAG_DISABLED | FLAG_HIDDEN), Setting('setting_storage', 'banReason', '', 'text', 'ban reason', null, FLAG_DISABLED | FLAG_HIDDEN), diff --git a/packages/hydrooj/src/model/stuinfo.ts b/packages/hydrooj/src/model/stuinfo.ts new file mode 100644 index 0000000000..1e61797029 --- /dev/null +++ b/packages/hydrooj/src/model/stuinfo.ts @@ -0,0 +1,207 @@ +import { pick } from 'lodash'; +import { LRUCache } from 'lru-cache'; +import { Student, User } from '../interface'; +// import { UserNotFoundError } from '../error'; +import { Logger } from '../logger'; +import * as bus from '../service/bus'; +import db from '../service/db'; +import { Value } from '../typeutils'; +// import { PERM, PRIV } from './builtin'; +import { ArgMethod } from '../utils'; +import TokenModel from './token'; +import UserModel from './user'; + +const coll = db.collection('stu.info'); +const domainUsercoll = db.collection('domain.user'); + +const logger = new Logger('model/stuinfo'); +const cache = new LRUCache({ max: 500, ttl: 300 * 1000 }); + +export function deleteStudentCache(studoc: Student | string | undefined | null, receiver = false) { + if (!studoc) return; + if (!receiver) { + bus.broadcast( + 'student/delcache', + JSON.stringify(typeof studoc === 'string' ? studoc : pick(studoc, ['stuid', '_id'])), + ); + } + if (typeof studoc === 'string') { + for (const key of [...cache.keys()].filter((k) => k.endsWith(`/${studoc}`))) cache.delete(key); + return; + } + const id = [`uid/${studoc._id.toString()}`, `stuid/${studoc.stuid.toLowerCase()}`]; + for (const key of [...cache.keys()].filter((k) => id.includes(`${k.split('/')[0]}/${k.split('/')[1]}`))) { + cache.delete(key); + } +} +bus.on('student/delcache', (content) => deleteStudentCache(JSON.parse(content), true)); + +class StudentModel { + @ArgMethod + static async getStuInfoById(_id: number): Promise { + if (cache.has(`uid/${_id}`)) return cache.get(`uid/${_id}`); + const studoc = await coll.findOne({ _id }); + if (!studoc) return null; + cache.set(`uid/${studoc._id}`, studoc); + return studoc; + } + + @ArgMethod + static async getStuInfoByStuId(stuid: string): Promise { + if (cache.has(`stuid/${stuid}`)) return cache.get(`stuid/${stuid}`); + const studoc = await coll.findOne({ stuid }); + if (!studoc) return null; + cache.set(`stuid/${stuid}`, studoc); + return studoc; + } + + @ArgMethod + static async create(uid: number, classname?: string, name?: string, stuid?: string) { + try { + await coll.insertOne({ + _id: uid, + name, + class: classname, + stuid, + }); + bus.broadcast('student/delCacheClassStudentsList', classname); + } catch (e) { + logger.warn('%o', e); + } + } + + @ArgMethod + static async setById(uid: number, $set?: Partial, $unset?: Value, ''>) { + const op: any = {}; + if ($set && Object.keys($set).length) op.$set = $set; + if ($unset && Object.keys($unset).length) op.$unset = $unset; + if (Object.getOwnPropertyNames(op).length === 0) return null; + const res = await coll.findOneAndUpdate({ _id: uid }, op, { returnDocument: 'after' }); + deleteStudentCache(uid.toString()); + return res; + } + + @ArgMethod + static setStuID(uid: number, stuid: string) { + return StudentModel.setById(uid, { stuid }); + } + + @ArgMethod + static setName(uid: number, name: string) { + return StudentModel.setById(uid, { name }); + } + + @ArgMethod + static setClass(uid: number, cls: string) { + return StudentModel.setById(uid, { class: cls }); + } + + static async getUserUidsByClassName(domain: string, cls: string): Promise { + return coll.find({ class: cls }, { sort: { stuid: 1 } }).sort({ _id: 1 }).map((stu) => stu._id).toArray(); + } + + static async getUserListByClassName(domain: string, cls: string): Promise { + const uids: number[] = await this.getUserUidsByClassName(domain, cls); + const udocs: User[] = await Promise.all(uids.map((uid) => UserModel.getById(domain, uid))); + return udocs; + } + + static async getUserListByClassNameOrdered(domain: string, cls: string, limit: number = 3): Promise { + const uids: number[] = await this.getUserUidsByClassName(domain, cls); + const promises: Promise[] = await domainUsercoll.aggregate([ + { $match: { uid: { $in: uids } } }, + { $group: { _id: '$uid', rp: { $avg: '$rp' } } }, + ]) + .sort({ rp: -1 }) + .limit(limit) + .map(async ({ _id }) => await UserModel.getById('system', _id)) + .toArray(); + const topUsers: User[] = await Promise.all(promises); + return topUsers; + } + + static async getClassList(domain: string = 'system'): Promise { + if (cache.has('classList')) return cache.get('classList'); + const startTime = Date.now(); + const clsCursor = await coll.aggregate([ + { $match: { class: { $not: { $in: [null, ''] } } } }, + { $group: { _id: '$class', stuNum: { $sum: 1 } } }, + ]).map((async (cls) => { + const users: number[] = await this.getUserUidsByClassName(domain, cls._id.toString()); + const clsInfoList = await domainUsercoll.aggregate([ + { $match: { uid: { $in: users } } }, + { + $group: { + _id: 'result', + nAccept: { $sum: '$nAccept' }, + nSubmit: { $sum: '$nSubmit' }, + rpSum: { $sum: '$rp' }, + rpAvg: { $avg: '$rp' }, + }, + }, + ]).toArray(); + let activityList: number[]; + if (cache.has(`activity/${cls._id}`)) activityList = cache.get(`activity/${cls._id}`); + else { + activityList = await Promise.all(users.map(async (uid) => ( + await TokenModel.getMostRecentSessionByUid(uid, ['createAt', 'updateAt']))?.updateAt.valueOf() + || (await UserModel.getById(domain, uid))?.loginat.valueOf() + || Date.now() - 7 * 24 * 60 * 60 * 1000)); + activityList = activityList.map((ac) => Math.max(ac, Date.now() - 7 * 24 * 60 * 60 * 1000)); + await bus.broadcast('student/cacheActivity', cls._id, JSON.stringify(activityList)); + } + const activity = (activityList.reduce((pre, cur) => (pre + cur) / 2) % 1e10); + if (!clsInfoList.length) { + return { + ...cls, nAccept: 0, nSubmit: 0, rpSum: 1500 * cls.stuNum, rpAvg: 1500, activity, + }; + } + return { ...clsInfoList[0], ...cls, activity }; + })).toArray(); + const clsList: any[] = await Promise.all(clsCursor); + clsList.forEach((cls) => { cls.rpAvg ||= 1500; }); + const sortWeights = { + rpAvg: 2, + stuNum: 10, + nAccept: 10, + nSubmit: 5, + activity: 2, + }; + const calSortWeight = (cls) => Object.entries(sortWeights).reduce((pre, [key, val]) => pre + cls[key] * val, 0); + const normalize = (val, min, max, newMin, newMax) => ((val - min) / (max - min)) * (newMax - newMin) + newMin; + + const activityList = clsList.map((cls: { activity: number }) => cls.activity / 1e5); + const activityMax = Math.max(...activityList); + const activityMin = Math.min(...activityList); + clsList.forEach((cls) => { cls.activity = normalize(cls.activity / 1e5, activityMin - 1000, activityMax + 1000, 0, 1000); }); + + clsList.forEach((cls) => { cls.weight = calSortWeight(cls); }); + const weightList = clsList.map((cls: { weight: number }) => cls.weight); + const weightMax = Math.max(...weightList); + const weightMin = Math.min(...weightList); + clsList.forEach((cls) => { cls.weight = normalize(cls.weight, weightMin - 1000, weightMax + 1000, 0, 1000); }); + + clsList.sort((a, b) => b.weight - a.weight); + + const res = { cacheTime: Date.now(), clsList }; + await bus.broadcast('student/cacheClassList', JSON.stringify(res)); + logger.info(`caching class list done. (${Date.now() - startTime}ms)`); + return res; + } +} + +bus.on('student/cacheClassList', (content: string) => cache.set('classList', JSON.parse(content))); +bus.on('student/cacheActivity', (cls: string, content: string) => cache.set(`activity/${cls}`, JSON.parse(content))); +bus.on('student/invalidateClassListCache', () => cache.delete('classList')); +bus.on('student/invalidateActivityCache', () => [...cache.keys()].filter((key) => /^activity\//.test(key)).forEach((key) => cache.delete(key))); + +bus.on('app/started', () => db.ensureIndexes( + coll, + { + key: { stuid: 1 }, name: 'stuid', unique: true, sparse: true, + }, + { key: { name: 1 }, name: 'name', sparse: true }, + { key: { class: 1, name: 1 }, name: '(class,name)', sparse: true }, +)); +global.Hydro.model.student = StudentModel; +export default StudentModel; diff --git a/packages/hydrooj/src/model/user.ts b/packages/hydrooj/src/model/user.ts index 4ffcf328dc..5f9e3aa1ca 100644 --- a/packages/hydrooj/src/model/user.ts +++ b/packages/hydrooj/src/model/user.ts @@ -3,7 +3,7 @@ import { LRUCache } from 'lru-cache'; import { Collection, Filter, ObjectId } from 'mongodb'; import { LoginError, UserAlreadyExistError, UserNotFoundError } from '../error'; import { - Authenticator, BaseUserDict, FileInfo, GDoc, + Authenticator, FileInfo, GDoc, ownerInfo, Udict, Udoc, VUdoc, } from '../interface'; import avatar from '../lib/avatar'; @@ -16,6 +16,7 @@ import { ArgMethod, buildProjection } from '../utils'; import { PERM, PRIV } from './builtin'; import domain from './domain'; import * as setting from './setting'; +import StudentModel from './stuinfo'; import * as system from './system'; import token from './token'; @@ -23,6 +24,7 @@ export const coll: Collection = db.collection('user'); // Virtual user, only for display in contest. export const collV: Collection = db.collection('vuser'); export const collGroup: Collection = db.collection('user.group'); +const collStu = db.collection('stu.info'); const cache = new LRUCache({ max: 10000, ttl: 300 * 1000 }); export function deleteUserCache(udoc: { _id: number, uname: string, mail: string } | string | true | undefined | null, receiver = false) { @@ -74,8 +76,12 @@ export class User { authn: boolean; group?: string[]; [key: string]: any; + _studoc: any; + name: string; + class: string; + stuid: string; - constructor(udoc: Udoc, dudoc, scope = PERM.PERM_ALL) { + constructor(udoc: Udoc, dudoc, studoc, scope = PERM.PERM_ALL) { this._id = udoc._id; this._udoc = udoc; @@ -100,6 +106,12 @@ export class User { this.domains = udoc.domains || []; this.tfa = !!udoc.tfa; this.authn = (udoc.authenticators || []).length > 0; + this._studoc = studoc; + if (studoc) { + this.name = studoc.name || ''; + this.stuid = studoc.stuid || ''; + this.class = studoc.class || ''; + } if (dudoc.group) this.group = dudoc.group; for (const key in setting.SETTINGS_BY_KEY) { @@ -155,7 +167,7 @@ export class User { } async private() { - const user = await new User(this._udoc, this._dudoc, this.scope).init(); + const user = await new User(this._udoc, this._dudoc, this._studoc, this.scope).init(); user.avatarUrl = avatar(user.avatar, 128); if (user.pinnedDomains instanceof Array) { const result = await Promise.allSettled(user.pinnedDomains.slice(0, 10).map((i) => domain.get(i))); @@ -185,8 +197,8 @@ function handleMailLower(mail: string) { return data; } -async function initAndCache(udoc: Udoc, dudoc, scope: bigint = PERM.PERM_ALL) { - const res = await new User(udoc, dudoc, scope).init(); +async function initAndCache(udoc: Udoc, dudoc, studoc, scope: bigint = PERM.PERM_ALL) { + const res = await new User(udoc, dudoc, studoc, scope).init(); cache.set(`id/${udoc._id}/${dudoc.domainId}`, res); cache.set(`name/${udoc.unameLower}/${dudoc.domainId}`, res); cache.set(`mail/${udoc.mailLower}/${dudoc.domainId}`, res); @@ -220,19 +232,24 @@ class UserModel { if (cache.has(`id/${_id}/${domainId}`)) return cache.get(`id/${_id}/${domainId}`) || null; const udoc = await (_id < -999 ? collV : coll).findOne({ _id }); if (!udoc) return null; + // HGNUOJ + const studoc = await StudentModel.getStuInfoById(_id); + for (const key in studoc) { + udoc[key] = studoc[key]; + } const [dudoc, groups] = await Promise.all([ domain.getDomainUser(domainId, udoc), UserModel.listGroup(domainId, _id), ]); dudoc.group = groups.map((i) => i.name); if (typeof scope === 'string') scope = BigInt(scope); - return initAndCache(udoc, dudoc, scope); + return initAndCache(udoc, dudoc, studoc, scope); } static async getList(domainId: string, uids: number[]): Promise { const r: Udict = {}; await Promise.all(uniq(uids).map(async (uid) => { - r[uid] = (await UserModel.getById(domainId, uid)) || new User(UserModel.defaultUser, {}); + r[uid] = (await UserModel.getById(domainId, uid)) || new User(UserModel.defaultUser, {}, {}); })); return r; } @@ -244,7 +261,8 @@ class UserModel { const udoc = (await coll.findOne({ unameLower })) || await collV.findOne({ unameLower }); if (!udoc) return null; const dudoc = await domain.getDomainUser(domainId, udoc); - return initAndCache(udoc, dudoc); + const studoc = await StudentModel.getStuInfoById(udoc._id); + return initAndCache(udoc, dudoc, studoc); } @ArgMethod @@ -254,7 +272,8 @@ class UserModel { const udoc = await coll.findOne({ mailLower }); if (!udoc) return null; const dudoc = await domain.getDomainUser(domainId, udoc); - return initAndCache(udoc, dudoc); + const studoc = await StudentModel.getStuInfoById(udoc._id); + return initAndCache(udoc, dudoc, studoc); } @ArgMethod @@ -265,6 +284,21 @@ class UserModel { if ($unset && Object.keys($unset).length) op.$unset = $unset; if ($push && Object.keys($push).length) op.$push = $push; if (op.$set?.loginip) op.$addToSet = { ip: op.$set.loginip }; + // HGNUOJ + const stuinfo = ['stuid', 'name', 'class']; + const studoc = {}; + stuinfo.forEach((element) => { + if (op.$set[element]) { + studoc[element] = op.$set[element]; + delete op.$set[element]; + } + }); + if (!(await StudentModel.getStuInfoById(uid))) await StudentModel.create(uid); + if (studoc['stuid']) { + const stu = await StudentModel.getStuInfoByStuId(studoc['stuid']); + if (stu && stu._id !== uid) throw new UserAlreadyExistError(studoc['stuid']); + } + StudentModel.setById(uid, studoc); const keys = new Set(Object.values(op).flatMap((i) => Object.keys(i))); if (keys.has('mailLower') || keys.has('unameLower')) { const udoc = await coll.findOne({ _id: uid }); @@ -375,11 +409,20 @@ class UserModel { } static async getListForRender(domainId: string, uids: number[]) { - const [udocs, vudocs, dudocs] = await Promise.all([ + const [udocs, vudocs, dudocs, studocs] = await Promise.all([ UserModel.getMulti({ _id: { $in: uids } }, ['_id', 'uname', 'mail', 'avatar', 'school', 'studentId']).toArray(), collV.find({ _id: { $in: uids } }).toArray(), domain.getDomainUserMulti(domainId, uids).project({ uid: true, displayName: true }).toArray(), + collStu.find({ _id: { $in: uids } }).toArray(), ]); + const studict = {}; + for (const studoc of studocs) studict[studoc._id] = studoc; + for (const udoc of udocs) { + const studoc = studict[udoc._id]; + for (const key in studoc) { + udoc[key] = studoc[key]; + } + } const udict = {}; for (const udoc of udocs) udict[udoc._id] = udoc; for (const udoc of vudocs) udict[udoc._id] = udoc; @@ -391,7 +434,7 @@ class UserModel { udict[key].displayName ||= udict[key].uname; udict[key].avatar ||= `gravatar:${udict[key].mail}`; } - return udict as BaseUserDict; + return udict; } @ArgMethod diff --git a/packages/hydrooj/src/plugin-api.ts b/packages/hydrooj/src/plugin-api.ts index 06a8e02961..8f7e91e5ef 100644 --- a/packages/hydrooj/src/plugin-api.ts +++ b/packages/hydrooj/src/plugin-api.ts @@ -29,6 +29,7 @@ export { default as OauthModel } from './model/oauth'; export { default as BlackListModel } from './model/blacklist'; export { default as DomainModel } from './model/domain'; export { default as StorageModel } from './model/storage'; +export { default as StudentModel } from './model/stuinfo'; export { default as TaskModel } from './model/task'; export * from './model/builtin'; export * as JudgeHandler from './handler/judge'; diff --git a/packages/hydrooj/src/script/rating.ts b/packages/hydrooj/src/script/rating.ts index ba8ba0be12..745a88762e 100644 --- a/packages/hydrooj/src/script/rating.ts +++ b/packages/hydrooj/src/script/rating.ts @@ -1,15 +1,17 @@ +/* eslint-disable simple-import-sort/imports */ /* eslint-disable no-cond-assign */ /* eslint-disable no-await-in-loop */ import { NumericDictionary, unionWith } from 'lodash'; import { Filter, ObjectId } from 'mongodb'; -import Schema from 'schemastery'; import { Counter } from '@hydrooj/utils'; +import Schema from 'schemastery'; import { Tdoc, Udoc } from '../interface'; import difficultyAlgorithm from '../lib/difficulty'; import rating from '../lib/rating'; import { PRIV, STATUS } from '../model/builtin'; import * as contest from '../model/contest'; import domain from '../model/domain'; +import record from '../model/record'; import problem from '../model/problem'; import UserModel from '../model/user'; import db from '../service/db'; @@ -24,6 +26,7 @@ interface RpDef { base: number; } +// eslint-disable-next-line @typescript-eslint/no-unused-vars const { log, max, min } = Math; export const RpTypes: Record = { @@ -32,23 +35,33 @@ export const RpTypes: Record = { const problems = await problem.getMulti('', { domainId: { $in: domainIds }, nAccept: { $gt: 0 }, hidden: false }).toArray(); if (problems.length) await report({ message: `Found ${problems.length} problems in ${domainIds[0]}` }); for (const pdoc of problems) { - const cursor = problem.getMultiStatus( - pdoc.domainId, - { - docId: pdoc.docId, - rid: { $ne: null }, - uid: { $ne: pdoc.owner }, - score: { $gt: 0 }, - }, + const nPages = Math.floor( + (await problem.getMultiStatus( + pdoc.domainId, + { + docId: pdoc.docId, + rid: { $ne: null }, + uid: { $ne: pdoc.owner }, + }, + ).count() + 99) / 100, ); - const difficulty = +pdoc.difficulty || difficultyAlgorithm(pdoc.nSubmit, pdoc.nAccept) || 5; - const p = difficulty / 100; - let psdoc; - while (psdoc = await cursor.next()) { - udict[psdoc.uid] += min(psdoc.score, 100) * p; + pdoc.difficulty ||= difficultyAlgorithm(pdoc.nSubmit, pdoc.nAccept) || 5; + const p = pdoc.difficulty / (Math.sqrt(Math.sqrt(pdoc.nAccept)) + 1) / 10; + for (let page = 1; page <= nPages; page++) { + const psdocs = await problem.getMultiStatus( + pdoc.domainId, { docId: pdoc.docId, rid: { $ne: null } }, + ).limit(100).skip((page - 1) * 100).project({ rid: 1, uid: 1 }).toArray(); + const rdict = await record.getList(pdoc.domainId, psdocs.map((psdoc) => psdoc.rid)); + for (const psdoc of psdocs) { + if (rdict[psdoc.rid.toHexString()]) { + const rp = rdict[psdoc.rid.toHexString()].score * p; + udict[psdoc.uid] = (udict[psdoc.uid] || 0) + rp; + } + } } + udict[pdoc.owner] = (udict[pdoc.owner] || 0) + pdoc.difficulty; } - for (const key in udict) udict[key] = max(0, min(udict[key], log(udict[key]) / log(1.03))); + for (const key in udict) udict[key] /= 10; }, hidden: false, base: 0, @@ -83,7 +96,7 @@ export const RpTypes: Record = { for (const key in udict) udict[key] = max(1, udict[key] / 4 - 375); }, hidden: false, - base: 1500, + base: 2000, }, delta: { async run(domainIds, udict) { diff --git a/packages/hydrooj/src/service/bus.ts b/packages/hydrooj/src/service/bus.ts index 7409bc8574..059780e1e7 100644 --- a/packages/hydrooj/src/service/bus.ts +++ b/packages/hydrooj/src/service/bus.ts @@ -6,9 +6,9 @@ import pm2 from '@hydrooj/utils/lib/locate-pm2'; import type { ProblemSolutionHandler } from '../handler/problem'; import type { UserRegisterHandler } from '../handler/user'; import type { - BaseUserDict, ContestBalloonDoc, DiscussionDoc, DomainDoc, FileInfo, + ContestBalloonDoc, DiscussionDoc, DomainDoc, FileInfo, MessageDoc, ProblemDict, ProblemDoc, RecordDoc, - ScoreboardRow, Tdoc, TrainingDoc, User, + ScoreboardRow, Tdoc, TrainingDoc, Udict, User, } from '../interface'; import type { DocType } from '../model/document'; import type { ConnectionHandler, Handler } from './server'; @@ -54,6 +54,13 @@ export interface EventMap extends LifecycleEvents, HandlerEvents { 'user/get': (udoc: User) => void 'user/delcache': (content: string | true) => void + 'student/delcache': (content: any) => void + 'student/delCacheClassStudentsList': (content: string) => void + 'student/cacheActivity': (cls: number, content: string) => void + 'student/cacheClassList': (content: string) => void + 'student/invalidateClassListCache': () => void + 'student/invalidateActivityCache': () => void + 'domain/create': (ddoc: DomainDoc) => VoidReturn 'domain/before-get': (query: Filter) => VoidReturn 'domain/get': (ddoc: DomainDoc) => VoidReturn @@ -91,7 +98,7 @@ export interface EventMap extends LifecycleEvents, HandlerEvents { 'contest/before-add': (payload: Partial>) => VoidReturn 'contest/add': (payload: Partial>, id: ObjectId) => VoidReturn - 'contest/scoreboard': (tdoc: Tdoc<30>, rows: ScoreboardRow[], udict: BaseUserDict, pdict: ProblemDict) => VoidReturn + 'contest/scoreboard': (tdoc: Tdoc<30>, rows: ScoreboardRow[], udict: Udict, pdict: ProblemDict) => VoidReturn 'contest/balloon': (domainId: string, tid: ObjectId, bdoc: ContestBalloonDoc) => VoidReturn 'oplog/log': (type: string, handler: Handler, args: any, data: any) => VoidReturn; diff --git a/packages/prom-client/index.ts b/packages/prom-client/index.ts index 29c55a455a..a15def6357 100644 --- a/packages/prom-client/index.ts +++ b/packages/prom-client/index.ts @@ -1,5 +1,5 @@ import { hostname } from 'os'; -import { AggregatorRegistry, Metric } from 'prom-client'; +import { AggregatorRegistry, MetricObject } from 'prom-client'; import { Context, Handler, SystemModel } from 'hydrooj'; import { createRegistry } from './metrics'; @@ -14,7 +14,7 @@ declare module 'hydrooj' { } } -const instances: Record = {}; +const instances: Record = {}; class MetricsHandler extends Handler { noCheckPermView = true; diff --git a/packages/prom-client/setting.yaml b/packages/prom-client/setting.yaml index d2bcccc77d..5779036da9 100644 --- a/packages/prom-client/setting.yaml +++ b/packages/prom-client/setting.yaml @@ -12,4 +12,4 @@ collect_rate: type: number name: Collect Rate desc: The collect rate scale (default:1) - default: 1 \ No newline at end of file + default: 1 diff --git a/packages/ui-default/components/messagepad/MessagePadDialogueContentContainer.jsx b/packages/ui-default/components/messagepad/MessagePadDialogueContentContainer.jsx index 9dad8fb3b0..aade37b6a9 100644 --- a/packages/ui-default/components/messagepad/MessagePadDialogueContentContainer.jsx +++ b/packages/ui-default/components/messagepad/MessagePadDialogueContentContainer.jsx @@ -92,12 +92,12 @@ export default connect(mapStateToProps)(class MessagePadDialogueContentContainer return ( <>
    {this.renderInner()} diff --git a/packages/ui-default/locales/zh.yaml b/packages/ui-default/locales/zh.yaml index bbb65782bb..53abfafb55 100644 --- a/packages/ui-default/locales/zh.yaml +++ b/packages/ui-default/locales/zh.yaml @@ -2,7 +2,7 @@ __langname: 简体中文 '"{data}" copied to clipboard!': “{data}”已复制到剪贴板! '[Richtext message]': '[富文本消息]' '{0} comments': '{0} 条评论' -'{0} discussions': '{0} 条讨论' +'{0} discussions': '{0} 条公告' '{0} is a moderator of this domain.': '{}是这个域的管理者之一。' '{0} limit exceeded (limit: {2} operations in {1} seconds).': '{0} 超过频率限制。限制:{1} 秒内最多 {2} 次操作。' '{0} problems': '{0} 道题' @@ -205,16 +205,17 @@ Copy Selected: 复制选中 Copy WeChat Account: 复制微信号 Copy: 复制 Copyright Complaint: 版权申诉 +courses_main: 课程 CPU Info: CPU信息 Create a contest: 创建一个比赛 -Create a Discussion: 创建一个讨论 +Create a Discussion: 创建一个公告 Create a Post: 创建一个博文 Create a problem: 创建一个题目 Create Contest: 创建比赛 Create contests: 创建比赛 -Create Discussion in {0}: 在 {0} 下创建讨论 -Create Discussion: 创建讨论 -Create discussions: 创建讨论 +Create Discussion in {0}: 在 {0} 下创建公告 +Create Discussion: 创建公告 +Create discussions: 创建公告 Create Domain: 创建域 Create File: 创建文件 Create Group: 创建小组 @@ -248,12 +249,12 @@ Day: 日 Deadline: 截止时间 Default Code Language: 默认代码语言 Default Code Template: 默认代码模板 -Delete discussion replies of own discussion: 删除自己讨论中的回复 -Delete discussion replies: 删除讨论回复 -Delete discussions: 删除讨论 +Delete discussion replies of own discussion: 删除自己公告中的回复 +Delete discussion replies: 删除公告回复 +Delete discussions: 删除公告 Delete Domain: 删除域 -Delete own discussion replies: 删除讨论中自己的回复 -Delete own discussions: 删除自己的讨论 +Delete own discussion replies: 删除公告中自己的回复 +Delete own discussions: 删除自己的公告 Delete own problem solution replies: 删除题解中自己的回复 Delete own problem solutions: 删除自己的题解 Delete problem solution replies: 删除题解的回复 @@ -272,19 +273,19 @@ Difficulty displayed: 显示的难度 Difficulty: 难度 Disabled: 关闭 Disconnected from the server. trying to reconnect...: 到服务器的连接断开。正在重新连接... -Discussion {1} not found.: 讨论 {1} 不存在。 -Discussion category {1} already exists.: 讨论分类 {1} 已经存在。 -Discussion category {1} not found.: 讨论分类 {1} 不存在。 -Discussion node {1} already exists.: 讨论节点 {1} 已经存在。 -Discussion node {1} not found.: 讨论节点 {1} 不存在。 -Discussion Nodes: 讨论节点 -discussion_create: 创建讨论 -discussion_edit: 编辑讨论 -discussion_main: 讨论 -discussion_node: 讨论 -Discussion: 讨论 -Discussions: 讨论 -Dismiss: 忽略 +Discussion {1} not found.: 公告 {1} 不存在。 +Discussion category {1} already exists.: 公告分类 {1} 已经存在。 +Discussion category {1} not found.: 公告分类 {1} 不存在。 +Discussion node {1} already exists.: 公告节点 {1} 已经存在。 +Discussion node {1} not found.: 公告节点 {1} 不存在。 +Discussion Nodes: 公告节点 +discussion_create: 创建公告 +discussion_edit: 编辑公告 +discussion_main: 公告 +discussion_node: 公告 +discussion_detail: 公告详情 +Discussion: 公告 +Discussions: 公告 Display name {1} you want to set is used by others.: 您想要设置的显示名 {1} 已经被其他人使用了。 Display Name: 显示名 display_name: 显示名 @@ -296,8 +297,9 @@ Domain {0} not found.: 域 {0} 不存在。 Domain ID cannot be changed once the domain is created.: 在创建后不能更改 ID。 Domain ID: 域 ID Domain Settings: 域设置 +domain_create: 创建域 domain_dashboard: 管理域 -domain_discussion: 讨论节点 +domain_discussion: 公告节点 domain_edit: 编辑域资料 domain_join: 加入域 domain_main: 首页 @@ -316,18 +318,20 @@ Download: 下载 Downvote: 差评 Duration (hours): 持续时间 (小时) Duration: 持续时间 +Edited: 已修改 +Edited at: 修改于 Edit any contests: 修改任意的比赛 Edit any homework: 修改任意的作业 Edit Contest: 编辑比赛 Edit description of this domain: 修改此域描述 -Edit discussion replies of own discussion: 修改自己讨论中的回复 -Edit discussion replies: 修改讨论的回复 -Edit discussions: 修改讨论 +Edit discussion replies of own discussion: 修改自己公告中的回复 +Edit discussion replies: 修改公告的回复 +Edit discussions: 修改公告 Edit Domain: 编辑域 Edit Homework: 编辑作业 Edit own contests: 修改自己的比赛 -Edit own discussion replies: 修改讨论中自己的回复 -Edit own discussions: 修改自己的讨论 +Edit own discussion replies: 修改公告中自己的回复 +Edit own discussions: 修改自己的公告 Edit own homework: 修改自己的作业 Edit own problem solution replies: 修改题解中自己的回复 Edit own problem solutions: 修改自己的题解 @@ -341,11 +345,10 @@ Edit problems: 修改题目 Edit Profile: 编辑个人信息 Edit training plans: 修改训练计划 Edit: 编辑 -Edited at: 修改于 -Edited: 已修改 Email Visibility: Email 可见性 Email: 电子邮件 Enabled: 开启 +Enabled Contest Duration (hours): 可参赛时间 (小时) End at: 结束于 End Date: 结束日期 End Time: 结束时间 @@ -401,7 +404,7 @@ Hidden: 隐藏 Hide all tags: 隐藏所有标签 Hide categorical tags: 隐藏分类标签 Hide tags: 隐藏标签 -Highlight discussions: 高亮讨论 +Highlight discussions: 高亮公告 Highlight: 高亮 Hint: 提示 Hint::icon::difficulty: Hydro 中题目的难度,根据递交数、通过率以及每个递交的递交时间和评测结果,综合计算得出,可能不准确。 @@ -500,9 +503,11 @@ Live...: 正在进行… Loading editor...: 正在加载编辑器... Loading file...: 正在加载文件内容... Location: 位置 +Lock scoreboard on last N minutes: 在赛事最后N分钟时锁定成绩表 +Lock Board (minutes): 封榜 (分钟) Login to Attend Contest: 登录后参加比赛 Login to Claim Homework: 登录后认领作业 -Login to Create a Discussion: 登录后创建讨论 +Login to Create a Discussion: 登录后创建公告 Login to Submit: 登录后递交 Login with Github: 使用 Github 登录 Login with Google: 使用 Google 登录 @@ -560,11 +565,11 @@ New Training Plan: 新训练计划 New: 创建 No {0} at current.: 当前没有{0}。 No comments so far...: 目前还没有评论... -No discussion yet...: 目前没有讨论… +No discussion yet...: 目前没有公告… No group available: 没有可用小组 No Permission to Attend Contest: 您没有权限参加比赛 No Permission to Claim Homework: 您没有权限认领作业 -No Permission to Create a Discussion: 您没有权限创建讨论 +No Permission to Create a Discussion: 您没有权限创建公告 No Permission to Submit: 您没有权限递交 No problem.: 没有题目。 No solutions so far...: 目前还没有题解... @@ -584,7 +589,7 @@ Not wrapped with space: 两侧不含空格 Numeric PID: 数字题号 objective: 客观题 Oh, the user doesn't have any contributions!: 啊哦,这个用户还没贡献过题目~ -Oh, the user hasn't created any discussions yet!: 这个用户还没有发布过讨论 +Oh, the user hasn't created any discussions yet!: 这个用户还没有发布过公告 Oh, the user hasn't submitted yet!: 这个用户还没有交过题 _(:зゝ∠)_ Oh, there are no tasks that match the filter!: 喔,目前没有符合过滤条件的任务。 Oh, there is no submission!: 喔,还没有评测记录呢! @@ -621,7 +626,7 @@ Passwords don't match.: 验证密码不匹配。 Path {0} not found.: 路径 {0} 不存在。 Peak Memory: 峰值内存 perm_contest: 比赛 -perm_discussion: 讨论 +perm_discussion: 公告 perm_general: 一般 perm_homework: 作业 perm_problem_solution: 题解 @@ -708,10 +713,11 @@ Ready (☆▽☆): 马上开始 (☆▽☆) Ready: 即将开始 Recent {0} Records: 最近 {0} 条记录 Recent Activities: 最近活动 +Recent Discussion: 最新公告 Recent Problems: 最新题目 Recent Solutions: 最近编写的题解 Recent Submissions: 最近递交 -Recently Created Discussions: 最近创建的讨论 +Recently Created Discussions: 最近创建的公告 Recommended: 推荐 Record {0} not found.: 记录 {0} 不存在。 record_detail: 记录详情 @@ -725,7 +731,7 @@ Rejudge all submissions: 重测整题 Rejudge problems: 重测题目 Rejudge records: 重测记录 Rejudge: 重测 -Related Discussions: 相关讨论 +Related Discussions: 相关公告 Related: 相关 Remember me: 记住我 Remove Selected Group: 移除所选小组 @@ -734,7 +740,7 @@ Remove Selected: 移除选中 Remove this data: 移除这组数据 Remove: 移除 Repeat Password: 重复密码 -Reply discussions: 回复讨论 +Reply discussions: 回复公告 Reply problem solutions: 回复题解 reply: 回复 Reply: 回复 @@ -773,7 +779,7 @@ Secret (visible to admins): 保密(对管理员可见) Secret: 保密 Section: 章节 Security: 安全 -Select a node to create discussion.: 选择一个节点来发表讨论。 +Select a node to create discussion.: 选择一个节点来发表公告。 Select a role: 选择一个角色 Select Category: 选择标签 Select User: 选择用户 @@ -826,8 +832,9 @@ Sorry, there are no users in this domain.: 对不起,此域中没有用户。 Sorry: 对不起 Sort by: 排序 Source type: 来源类型 +Special Thanks: 特别鸣谢 +Star Topic: 收藏公告 Standard mode: 标准模式 -Star Topic: 收藏讨论 Star: 收藏 Starred Users: 关注用户 Start at: 开始于 @@ -975,14 +982,14 @@ View contest scoreboard: 查看比赛成绩表 View Contest: 查看比赛 View contests: 查看比赛 View Details: 查看详情 -View discussions: 查看讨论 +View discussions: 查看公告 View hidden contest submission status and scoreboard: 查看隐藏的比赛递交状态和成绩表 View hidden homework submission status and scoreboard: 查看隐藏的作业递交状态和成绩表 View hidden problems: 查看隐藏的题目 View homework scoreboard: 查看作业成绩表 View homework: 查看作业 View Homework: 查看作业 -View or create discussion: 查看与发表讨论 +View or create discussion: 查看与发表公告 View or submit solution: 查看与发表题解 View Owned Problems: 查看自己的题目 View Owned Training Plans: 查看自己的训练计划 @@ -1042,4 +1049,16 @@ Your account has two factor authentication enabled. Please choose an authenticat Your browser does not support WebAuthn or you are not in secure context.: 您的浏览器不支持WebAuthn或是您不在安全环境中。 Your Device: 你的设备 Your permission: 您的权限 -Your role: 您的角色 \ No newline at end of file +Your role: 您的角色 +# HGNUOJ Added +stu_class_list: 班级列表 +stu_class_students: 班级详情 +setting_student: 学生信息 +Stu_ID: 学号 +Stu_ClassName: 班级 +Reg_Stu_ClassName: 专业班级(例如:软工1901、计算机2006) +Stu_RealName: 姓名 +reg_stuwarn: 请使用真实学生信息填写! +manage_student_import: 学生批量导入 +manage_teacher_register: 教师注册 +manage_user_changepassword: 修改用户密码 diff --git a/packages/ui-default/misc/typography.styl b/packages/ui-default/misc/typography.styl index bcd2e63eb9..9340b579bc 100644 --- a/packages/ui-default/misc/typography.styl +++ b/packages/ui-default/misc/typography.styl @@ -478,6 +478,13 @@ textarea outline: 0px; outline-offset: 2px; +// HGNUOJ Added +.text-badge + display: inline-block + padding: 0 5px 0 5px + background-color: #6495ed + color: white + @font-face font-family: "XiaoLai SC"; font-display: swap; diff --git a/packages/ui-default/pages/courses_main.page.styl b/packages/ui-default/pages/courses_main.page.styl new file mode 100644 index 0000000000..58b942dcfa --- /dev/null +++ b/packages/ui-default/pages/courses_main.page.styl @@ -0,0 +1,51 @@ +.page--courses_main + .course-card + display: inline-block + padding: 15px 20px + padding-bottom: 0 + width: 100% + border-style: solid + border-color: rgba(#AFC2C9, 0.4) + border-width: 1px + box-shadow: 0 2px 3px rgba(#AFC2C9, 0.4) + transition: transform .2s, box-shadow .5s + + .course-card:hover + transform: scale(1.05) translateY(-5px) + box-shadow: 0 2px 8px rgba(#AFC2C9, 0.5) + + .course-card .course-card-header + font-size: 12px + + .course-card .course-card-header h1 + overflow: hidden + text-overflow: ellipsis + white-space: nowrap + font-weight: normal + + .course-card .course-card-body + font-size: 14px + margin-top: 10px + + .course-card .course-card-body p + overflow: hidden + text-overflow: ellipsis + white-space: nowrap + padding: 5px 0 5px 0 + line-height: 20px + + +tablet() + .course-card .course-card-header + font-size: 10px + .course-card .course-card-body + font-size: 10px + .course-card .button + font-size: 4px + + +mobile() + .course-card .course-card-header + font-size: 10px + .course-card .course-card-body + font-size: 10px + .course-card + box-shadow: none \ No newline at end of file diff --git a/packages/ui-default/pages/homework_scoreboard.page.styl b/packages/ui-default/pages/homework_scoreboard.page.styl index ff1064a34f..afb37bb627 100644 --- a/packages/ui-default/pages/homework_scoreboard.page.styl +++ b/packages/ui-default/pages/homework_scoreboard.page.styl @@ -9,14 +9,23 @@ border-right: 1px solid $table-border-color .col--user - min-width: rem(150px) + width: 150px + text-align: center - .col--total_score, .col--time + .col--stu_class + width: 7rem + text-align: center + + .col--stu_name width: rem(100px) text-align: center + .col--total_score, .col--time + width: 3.5rem + text-align: center + .col--problem, .col--record - width: rem(100px) + width: 3rem border-left: 1px solid $table-border-color text-align: center diff --git a/packages/ui-default/pages/manage_student_import.page.js b/packages/ui-default/pages/manage_student_import.page.js new file mode 100644 index 0000000000..4aafd1898e --- /dev/null +++ b/packages/ui-default/pages/manage_student_import.page.js @@ -0,0 +1,29 @@ +import $ from 'jquery'; +import Notification from 'vj/components/notification'; +import { NamedPage } from 'vj/misc/Page'; +import { delay, i18n, request } from 'vj/utils'; + +const page = new NamedPage('manage_student_import', () => { + async function post(draft) { + try { + const res = await request.post('', { + students: $('[name="students"]').val(), + draft, + }); + if (!draft) { + Notification.success(i18n('Created {0} users.', res.users.length)); + await delay(2000); + window.location.reload(); + } else { + $('[name="messages"]').text(res.messages.join('\n')); + } + } catch (error) { + Notification.error(error.message); + } + } + + $('[name="preview"]').on('click', () => post(true)); + $('[name="submit"]').on('click', () => post(false)); +}); + +export default page; diff --git a/packages/ui-default/pages/ranking.page.styl b/packages/ui-default/pages/ranking.page.styl index d62864c228..1fba732a7d 100644 --- a/packages/ui-default/pages/ranking.page.styl +++ b/packages/ui-default/pages/ranking.page.styl @@ -4,7 +4,7 @@ position: relative .col--user - width: rem(220px) + width: rem(300px) .col--rp width: rem(60px) diff --git a/packages/ui-default/pages/record_main.page.styl b/packages/ui-default/pages/record_main.page.styl index 4ecb3124a8..db3fe79014 100644 --- a/packages/ui-default/pages/record_main.page.styl +++ b/packages/ui-default/pages/record_main.page.styl @@ -11,7 +11,7 @@ width: rem(160px) .col--submit-by - width: rem(140px) + width: rem(200px) text-align: right .col--time, .col--memory, .col--lang diff --git a/packages/ui-default/pages/stu_class_list.page.styl b/packages/ui-default/pages/stu_class_list.page.styl new file mode 100644 index 0000000000..63b706192a --- /dev/null +++ b/packages/ui-default/pages/stu_class_list.page.styl @@ -0,0 +1,38 @@ +.page--stu_class_list + .stu-classlist td + height: rem(50px) + font-size: 14px + + .stu-classlist>tr:nth-child(-n+3) .col--rank + height: rem(80px) + font-size: 26px + font-weight: 200 + + .col--rank + width: rem(100px) + position: relative + + .col--classname + min-width: rem(200px) + text-align: left + + .col--stunum, .col--ac, .col--submit, .col--rpavg, .col--rpsum, .col--activity, .col--weight + min-width: rem(100px) + text-align: right + + .col--user-rank + width: rem(60px) + + .col--user-ac, .col--user-ac, .col--user-submit, .col--user-rp + width: rem(60px) + text-align: right + + .col--user-bio + min-width: rem(400px) + + .col--user + width: rem(160px) + + +mobile() + .col--rpavg, .col--rpsum, .col--weight, .col--rpavg, .col--submit, .stu-starclass + display: none \ No newline at end of file diff --git a/packages/ui-default/pages/stu_class_students.page.styl b/packages/ui-default/pages/stu_class_students.page.styl new file mode 100644 index 0000000000..0748e2d7f0 --- /dev/null +++ b/packages/ui-default/pages/stu_class_students.page.styl @@ -0,0 +1,36 @@ +.page--stu_class_students + .col--rank + width: rem(80px) + position: relative + + .col--stuid + width: rem(150px) + text-align: left + + .col--user + width: rem(200px) + text-align: left + + .col--gender + width: rem(80px) + text-align: left + + .col--rp + width: rem(80px) + text-align: right + + .col--ac + width: rem(100px) + text-align: right + + .col--lastactive + width: rem(120px) + text-align: right + + .col--bio + height: 36px !important + display: block + + +mobile() + .col--bio, .col--stuid, .col--lastactive, .col--gender + display: none \ No newline at end of file diff --git a/packages/ui-default/static/android-chrome-192x192.png b/packages/ui-default/static/android-chrome-192x192.png index c740313cc59e49fd576d56e0fe47a3f5a48da0dc..13f806cb15fd1f2b0bcbb15a66b16551130b9b69 100644 GIT binary patch literal 31995 zcmV)Px#1ZP1_K>z@;j|==^1poj532;bRa{vG?BLDy{BLR4&KXw2Be2_^*K~#8N?VSaH zROJ@OzXuqoh=`&fA|R-Q(k)-Oi&he!j`{dXw$AJV15_~4F|G@?S zEdU$-`s=T|-uR-CrYk!zuf4gRW`~44d?b`3=r=Nc_Km7Q!x$@&L z=I392lb`)=e*fbS^T(fmA+#n@!UQH^!i46|J8m}-zcieuP z9Er>w^8TIjb%F%JJu>g2I4#$)L%!T8U%x9~ehS1`juG7oQ-xEDkh(<_xKIL1xLA zTFj#qYG!@*)wkx9EQl8mz9oy|qMBFi3{^|zF?pZKU>=YKT#v86y<#d9%VFwPC}=W?Q;nnT2DzV@N5kdVD89@Uee)lJ zf6M}qhm=5$yz=ERIk4}esJ7p({cc`AdCn|cw@*x+PfU)?=}eRAMNDqd^w{s%`fGO_ zQuE=*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Z!w}63%M%X1ZpQ$-hbp9#nT#y?gGt=iFPB)|!)! z^3^{cbG(Z8#U{STos(`{eS7J|O}fWL(B^OIA#V?*1%};< z=`x&`K7U9niE5>JfV--uWugmu23LnQKLAjNz@gP6-jAj!*>@^!stev07j?O%rj6>o zUUirO2eY6{blKP0Qk+xr-UJu;RLQ1lOHEUgW6JNduQ|S&YL`%b{`>$sS9BISIhuJW zg<2lL$iXViY^&ayBEq6tsHw`Z@kj&h&;=u1^nc?xil}xayHjj^&AuF`gfaBf?2BvUC=tvI9tbBav2Y@w86m7 z2Y;Y-nX95pd)S6q0~nW}7h#h$(Zt3S25zf4tJ*svwj5@-J|7LG;hv^sQ{0~d;A@>- zHRr`j)s6x0Rqyv$FtUxv&!#0_lfzn8BM zfS3I&c)HF02PSO3&9Oe(iU0rrC3HntbYx+4WjbSWWnpw>05UK#F)c7REiyAyFitc& zF*rIiFe@-HIxsLW5nl}e001R)MObuXVRU6WZEs|0W_bWIFfuVMFgGnSGgL4%Ix#pp bGcYSKFgh?WK}_ed00000NkvXXu0mjfl@aWE diff --git a/packages/ui-default/static/favicon-96x96.png b/packages/ui-default/static/favicon-96x96.png index b062922e854d0e87146b112d49f24949afc8e5a1..118d76e7b73e0731302bcccc9ebb779dacd8872d 100644 GIT binary patch literal 11896 zcmV-;E{D;HP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vG?BLDy{BLR4&KXw2BE)7XUK~#8N&7B9J zjddT#|F-PCWfVoqh!DvtduNncW{OHhM6y!7qC$ym4M{X84H;<|ky)YaO%e&={eFJu zJlAuNbMHOplKQ^y(>cz0?m5r%+w1>7N!))B=g*%{uA{J?me6sdjv_h=>d3DnYmy{M z((3Ud=xyQ>V_jzfPZVe;hyQPMkdD&Ybz%o!5KGlP7a&Qm1qo(p}}QN|n;3N|nMTOPVzB zhe7D`PwL?t9Se1QtdCx=<23L6oA_55aPHi>>-5k{M{6C|dIUf7_gS}b%P#lBkK5gj zJqO)s5&G=eb1r?_t6aJ?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kth3MdM)_cYpag`T)JG+sF-Ilu2|*gM z0I6}&OC*gqT2(qe%fhz&8r4f8MpF;2J^7s!IeDwJcsnX$IXD4=z0Y@xTY8h~)mA0U zP}xZt>Q%mJPO%|n`C97T=F@X66ogjsg62A}fNlapSGYOHZu{-sGD^8^1L1jv4&^W5+ z5v1#7k(#RoU0*{m$foh0ndD8YttsE6W=6J`>2z_~xAyX`YQyPAF_i3QRc}GzA->l* zz-!}v@qqnPF$0x}Q<{KXKn`cHQIdSsKkDx62rQ$(d*8C!-~*J*uWTVxD5bcEPW-I? z*(-ADOIjZ<(~7P2SIVppi)*MT{&L^)lh*>~T$hnc& z9CFNgq5i10^1zBMyM_q!5hZKq_(=CYZ0pfL??-#>;$Z)kSZ5s#ft|tw=S>_)HCcsz zw9UsLLzVsM75=@IOP?*P{`ARpq5vDiUa~g7(2%~4gLzKcel7P!O$96JhfzG0z!Yl< z6hx1WyQFH=MFYBlP15vQymWok!T63~g5tDry3=9j+6uxEMgdv3MV2jyxI@M}gip1z02$kt0_9rjpOB}S(FFqB(^D$pJ*Cge6d zCN(b8{UQ`a6^uMQ%l>{O*WT`Te&B-2OU@E`gPmj>p4^e<6K&*(p84oFlEqW>1_x1euZ{ewV=v znB7;nVUGJ4Nc{A=rV4j+HNhOs>>i6E@)$cbF;feoNXpw24IvqGC=ICW!!4%|G#BLU z0*>p*zJmKb%r6>`l5hOA16{F}T%!CVHE% diff --git a/packages/ui-default/static/favicon.ico b/packages/ui-default/static/favicon.ico index 98d24cb7a90421f00a0b0c2144a4b8d9a25c768f..16835cd51551a8d44f1c98c5dbf918fcc2eb1db9 100644 GIT binary patch literal 4286 zcmbVQdr($o8b8g>v`*7ZJN>bJm z6huLxl*CPT1vOn2EkxNw1Qk#a5Frs26p%Z=eSVJ~{61ui>1E#UobR0XeQxjX`905v zVLT&$J$e}YG!lMi7{50RqmN8^WDJqX=Q`xwuN?rowY9ZPY-?)`D=)rsvgq>pl9K$K zdopW^aE`CqH2<35qqy}79=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W^UeDsQ5r6T3%mGy8?>SzT_TiBKv*iC-xC?(ocU~w*`$zuxv!IU0z3_hu{+0Pc zOT4Or{`2|M<{$J!?(?VryZ8gY{QT)(u6RCsAJ0GJ@6YC=zwiTj{`qeEfzS2xAFO!( z^q=W@&ip*~5G?tg|62cmAKTBHL$vbwFYV{eA*(*uyq~TfkI+D0n;$&>T;eg+vn!#^5@ss^B>sP`@bvZoq4|7e!j3`J{CR<=jHOJS3NJt=c7*- zD)IR}=bw*PoR5}1f7+N;ABC0ASDw#!ezo{`6;_=89{T71`-6L4UZJqt^Zfq+iHNc_ diff --git a/packages/ui-default/templates/components/user.html b/packages/ui-default/templates/components/user.html index 9e70f1cb7d..c6b561a529 100644 --- a/packages/ui-default/templates/components/user.html +++ b/packages/ui-default/templates/components/user.html @@ -1,16 +1,31 @@ -{% macro render_inline(udoc, avatar=true, badge=true, modbadge=true, levelbadge=true) %} +{% macro render_inline(udoc, avatar=true, badge=true, modbadge=true, levelbadge=true, classname = true) %} {% if udoc %} + {{ udoc.class }} + {% else %} - {{ udoc.uname }} + 未完善 {% endif %} - + {% endif %} + {% if udoc.name %} + + {% else %} + + {% endif %} {% if badge %} {% if udoc.badge %} {% set _badge = udoc.badge.split('#') %} diff --git a/packages/ui-default/templates/contest_detail.html b/packages/ui-default/templates/contest_detail.html index 190ecfdd7f..77790b5c79 100644 --- a/packages/ui-default/templates/contest_detail.html +++ b/packages/ui-default/templates/contest_detail.html @@ -26,11 +26,6 @@

    {{ tdoc.title }}

    {{ tdoc['content']|markdown|safe }} - {% if model.contest.isOngoing(tdoc, tsdoc) %} -
    -

    {{ _('We will check code similarity after this contest.') }}

    -
    - {% endif %} {% if tdoc.duration %}

    {{ _('The contest is a flexible time contest. You need to complete the contest within a specified time after you attended.') }}

    diff --git a/packages/ui-default/templates/courses_main.html b/packages/ui-default/templates/courses_main.html new file mode 100644 index 0000000000..2ced93c26a --- /dev/null +++ b/packages/ui-default/templates/courses_main.html @@ -0,0 +1,61 @@ +{% extends "layout/basic.html" %} +{% import "components/nothing.html" as nothing with context %} +{% block content %} +
    +
    +
    +
    +

    课程

    +
    +
    + 总计{{ domains.length | d(0) }}个课程 +
    +
    +
    +
    +
    +
    +
    +
    + {% if not domains.length %} + {{ nothing.render('没有课程。') }} + {% else %} +
    + {% set course_cols = 3 %} + {% set class_name = 'medium-' + (12 / course_cols) %} + {% for item in domains %} +
    +
    +
    +

    {{ item.name }}

    +
    +
    +

    创建者:{{ user.render_inline(uDocs[item.owner],false,false,false) }}

    +

    加入人数:{{ item.users }}

    + +
    +
    +
    + {% if loop.index % course_cols and loop.last %} + {% for i in range(0, course_cols - (loop.index % course_cols)) -%} +
    + {%- endfor %} + {% endif %} + {% if loop.index % course_cols === 0 or loop.last %} +
    + {% if not loop.last %} +
    +
    + {% endif %} + {% endif %} + {% endfor %} + {% endif %} +
    +
    +
    +
    + {% endblock %} \ No newline at end of file diff --git a/packages/ui-default/templates/discussion_detail.html b/packages/ui-default/templates/discussion_detail.html index d2c548d131..772d99fab8 100644 --- a/packages/ui-default/templates/discussion_detail.html +++ b/packages/ui-default/templates/discussion_detail.html @@ -20,7 +20,7 @@
  1. {{ ddoc.title }}

  2. - {{ user.render_inline(udict[ddoc.owner]) }} + {{ user.render_inline(udict[ddoc.owner], classname=false) }} @ {{ datetimeSpan(ddoc._id)|safe }}
  3. @@ -35,9 +35,9 @@ {{ _('Edit') }} {% endif %} - {% if ddoc.edited %} + {# {% if ddoc.edited %}
  4. {{ _('Edited') }}
  5. - {% endif %} + {% endif %} #}
  6. {{ _('{0} views').format(ddoc.views) }}
  7. {% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
  8. @@ -73,7 +73,7 @@
  9. -
    +
    {% set udoc = udict[ddoc.owner] %} @@ -118,7 +118,7 @@

    {{ _('{0} comments').format(drcount) }}

    -

    {{ user.render_inline(udoc, avatar=false, modbadge=false) }}

    +

    {{ user.render_inline(udoc, avatar=false, modbadge=false, classname=false) }}

    diff --git a/packages/ui-default/templates/discussion_main_or_node.html b/packages/ui-default/templates/discussion_main_or_node.html index 3fe2918066..9ac87c0d44 100644 --- a/packages/ui-default/templates/discussion_main_or_node.html +++ b/packages/ui-default/templates/discussion_main_or_node.html @@ -38,7 +38,15 @@

    {{ vnode['title'] or _('Create Discussion') }}

    {% endif %} - {% include 'partials/discussion_nodes_widget.html' %} +
    +
    +

    公告

    +
    +
    + 普通用户仅可查看公告。 +
    +
    + {% endblock %} diff --git a/packages/ui-default/templates/domain_create.html b/packages/ui-default/templates/domain_create.html index 3ea0b3cf53..06637a8fdb 100644 --- a/packages/ui-default/templates/domain_create.html +++ b/packages/ui-default/templates/domain_create.html @@ -35,9 +35,13 @@

    {{ _('Create Domain') }}

    + {{ form.checkbox({ + label:'公开到课程页面 (该选项在创建时勾选无效,请在创建后重新在 管理域-编辑域 资料中勾选此选项)', + name:'publicToCourses' }) }}
    +
    {{ form.form_text({ row:false, @@ -94,7 +94,7 @@ columns:null, label:'Content', name:'content', - value:tdoc['content']|default(''), + value:tdoc['content']|default('[^_^]:若需要写内容请删除该注释,若不需要写内容无需删除该注释,会自动不显示'), markdown:true }) }}
    diff --git a/packages/ui-default/templates/layout/html5.html b/packages/ui-default/templates/layout/html5.html index dc06df6fb6..20c51045ea 100644 --- a/packages/ui-default/templates/layout/html5.html +++ b/packages/ui-default/templates/layout/html5.html @@ -56,6 +56,11 @@ } {% endif %} + {% if not isIE(handler.request.headers['user-agent']) and not handler.session.legacy %} diff --git a/packages/ui-default/templates/manage_student_import.html b/packages/ui-default/templates/manage_student_import.html new file mode 100644 index 0000000000..43561955a3 --- /dev/null +++ b/packages/ui-default/templates/manage_student_import.html @@ -0,0 +1,27 @@ +{% import "components/user.html" as user %} +{% extends "manage_base.html" %} +{% block manage_content %} +
    +
    +

    学生导入

    +
    +
    +

    输入学生信息,格式例如:123@abc.com,abc,123456,张三,计科2001,2020310000000,信息用英文逗号隔开,每个学生占一行

    +
    +
    +
    +
    + {{ noscript_note.render() }} +

    + {{ form.form_textarea({ + columns:null, + name:'students', + nospellcheck: true + }) }} +
    + + +
    +
    +
    +{% endblock %} diff --git a/packages/ui-default/templates/partials/contest_sidebar.html b/packages/ui-default/templates/partials/contest_sidebar.html index a052630c6c..a6449f2dbc 100644 --- a/packages/ui-default/templates/partials/contest_sidebar.html +++ b/packages/ui-default/templates/partials/contest_sidebar.html @@ -81,11 +81,6 @@

    {{ tdoc.title }}

    {{ _('Export All Code') }} {% endif %} - {% endif %} - {% if handler.user.hasPerm(perm.PERM_VIEW_DISCUSSION) %} - {% endif %}
    - @@ -46,11 +45,8 @@

      - - -

diff --git a/packages/ui-default/templates/partials/homepage/discussion.html b/packages/ui-default/templates/partials/homepage/discussion.html index aedcb365bd..afe4b28f54 100644 --- a/packages/ui-default/templates/partials/homepage/discussion.html +++ b/packages/ui-default/templates/partials/homepage/discussion.html @@ -1,13 +1,13 @@ {% set ddocs = payload[0] %} {% set vndict = payload[1] %} {% if ddocs.length %} -
+
-

{{ _('Discussion') }}

+

{{ _('Recent Discussion') }}

+
+ {% include "partials/discussion_list_main.html" %} + - {% include "partials/discussion_list.html" %} -
{% endif %} \ No newline at end of file diff --git a/packages/ui-default/templates/partials/homepage/hgnu_tool.html b/packages/ui-default/templates/partials/homepage/hgnu_tool.html new file mode 100644 index 0000000000..1c44ebcab8 --- /dev/null +++ b/packages/ui-default/templates/partials/homepage/hgnu_tool.html @@ -0,0 +1,13 @@ + \ No newline at end of file diff --git a/packages/ui-default/templates/partials/homepage/ranking.html b/packages/ui-default/templates/partials/homepage/ranking.html index bd2e29e41b..8c94cd9033 100644 --- a/packages/ui-default/templates/partials/homepage/ranking.html +++ b/packages/ui-default/templates/partials/homepage/ranking.html @@ -10,14 +10,13 @@

{{ _('Ranking') }}

- {{ _('Rank') }} {{ _('Username') }} {{ _('RP') }} - {{ _('Bio') }} + {{ _('Accept') }} @@ -27,7 +26,7 @@

{{ _('Ranking') }}

{{ loop.index }} {{ user.render_inline(udoc, levelbadge=false) }} {{ udoc.rp|default(0)|round(0) }} - {{ udoc.bio|default('')|truncate(64, true)|markdownInline|safe }} + {{ udoc.nAccept }} {%- endfor -%} diff --git a/packages/ui-default/templates/partials/homework_default_penalty_rules.yaml b/packages/ui-default/templates/partials/homework_default_penalty_rules.yaml index 689730941b..79d4bcf4f3 100644 --- a/packages/ui-default/templates/partials/homework_default_penalty_rules.yaml +++ b/packages/ui-default/templates/partials/homework_default_penalty_rules.yaml @@ -1,6 +1,3 @@ # Format: # hours: coefficient -1: 0.9 -3: 0.8 -12: 0.75 -9999: 0.5 +1: 0 diff --git a/packages/ui-default/templates/partials/manage_user_priv.html b/packages/ui-default/templates/partials/manage_user_priv.html index 9c121ed41e..d0d0bb6e43 100644 --- a/packages/ui-default/templates/partials/manage_user_priv.html +++ b/packages/ui-default/templates/partials/manage_user_priv.html @@ -52,4 +52,4 @@ {%- endfor -%} - \ No newline at end of file + diff --git a/packages/ui-default/templates/partials/nav.html b/packages/ui-default/templates/partials/nav.html index 5b85ceffb1..7197350be7 100644 --- a/packages/ui-default/templates/partials/nav.html +++ b/packages/ui-default/templates/partials/nav.html @@ -64,11 +64,6 @@ {{ _('My Profile') }} -
\ No newline at end of file + diff --git a/packages/ui-default/templates/partials/problem_list.html b/packages/ui-default/templates/partials/problem_list.html index 254889fdf6..5176d127a5 100644 --- a/packages/ui-default/templates/partials/problem_list.html +++ b/packages/ui-default/templates/partials/problem_list.html @@ -30,8 +30,8 @@ {{ _('Status') }} {% endif %} {{ _('Problem') }} - {{ _('Show tags') }} - {{ _('Hide tags') }} + {{ _('Hide tags') }} + {{ _('Show tags') }} {{ _('AC') }} / {{ _('Tried') }} {{ _('Difficulty') }} diff --git a/packages/ui-default/templates/partials/problem_sidebar_normal.html b/packages/ui-default/templates/partials/problem_sidebar_normal.html index bbdde373e0..6d177d73bf 100644 --- a/packages/ui-default/templates/partials/problem_sidebar_normal.html +++ b/packages/ui-default/templates/partials/problem_sidebar_normal.html @@ -65,12 +65,7 @@

{{ pdoc['title'] }}

{% if handler.user.hasPerm(perm.PERM_VIEW_DISCUSSION) or _canViewSolution %} {% endif %} - {% if handler.user.hasPerm(perm.PERM_VIEW_DISCUSSION) %} -
- {% endif %} - {% if _canViewSolution %} + {% if handler.user.hasPerm(perm.PERM_VIEW_PROBLEM_SOLUTION) %} diff --git a/packages/ui-default/templates/partials/scoreboard.html b/packages/ui-default/templates/partials/scoreboard.html index c71caee0b4..798c64f617 100644 --- a/packages/ui-default/templates/partials/scoreboard.html +++ b/packages/ui-default/templates/partials/scoreboard.html @@ -31,7 +31,7 @@ {%- if column.type == 'problem' and column.raw -%} - {{ column.value }}
{{ pdict[column.raw].nAccept|default(0) }}/{{ pdict[column.raw].nSubmit|default(0) }} + {{ column.value }}
{{ pdict[column.raw].nAccept|default(0) }}
/
{{ pdict[column.raw].nSubmit|default(0) }}
{%- else -%} {{ column.value|string|nl2br|safe }} @@ -54,7 +54,7 @@ - {{ user.render_inline(udict[column.raw], badge=false) }} + {{ user.render_inline(udict[column.raw], avatar=false, badge=true, modbadge=false, levelbadge=false, classname=false) }} {%- elif column.type == 'record' and column.raw -%} {{ column.value|string|nl2br|safe }} diff --git a/packages/ui-default/templates/partials/training_detail.html b/packages/ui-default/templates/partials/training_detail.html index f835df3b68..a067b90485 100644 --- a/packages/ui-default/templates/partials/training_detail.html +++ b/packages/ui-default/templates/partials/training_detail.html @@ -160,4 +160,4 @@

  - \ No newline at end of file + diff --git a/packages/ui-default/templates/problem_detail.html b/packages/ui-default/templates/problem_detail.html index 76b004a1a6..0a553a1295 100644 --- a/packages/ui-default/templates/problem_detail.html +++ b/packages/ui-default/templates/problem_detail.html @@ -48,7 +48,7 @@

#{{ String.fromCharCode(65+tdoc.pids.indexOf(pdoc.docId)) if tdoc else pdoc.pid|default(pdoc.docId) }}. {{ pdoc.title }}

{% if tdoc %} -
+
{% for pid in tdoc.pids -%} {% set status = tsdoc.detail[pid].status %} {% set pass = status == STATUS.STATUS_ACCEPTED %} diff --git a/packages/ui-default/templates/problem_edit.html b/packages/ui-default/templates/problem_edit.html index 43f95bad0f..5f2666fb0b 100644 --- a/packages/ui-default/templates/problem_edit.html +++ b/packages/ui-default/templates/problem_edit.html @@ -11,7 +11,7 @@ {{ _('pid') }}
diff --git a/packages/ui-default/templates/ranking.html b/packages/ui-default/templates/ranking.html index bc5c648149..c98c1440c8 100644 --- a/packages/ui-default/templates/ranking.html +++ b/packages/ui-default/templates/ranking.html @@ -21,7 +21,6 @@ {% endif %} {% endfor %} - @@ -34,7 +33,6 @@ {% endif %} {% endfor %} {{ _('Accept') }} - {{ _('Bio') }} @@ -49,7 +47,6 @@ {% endif %} {% endfor %} {{ handler.user.nAccept|default(0) }} - {{ handler.user.bio|default('')|truncate(64, true)|markdownInline|safe }} {% endif %} {%- for udoc in udocs -%} @@ -63,7 +60,6 @@ {% endif %} {% endfor %} {{ udoc.nAccept|default(0) }} - {{ udoc.bio|default('')|truncate(64, true)|markdownInline|safe }} {%- endfor -%} diff --git a/packages/ui-default/templates/record_main_tr.html b/packages/ui-default/templates/record_main_tr.html index 24d648e531..8530d0cf70 100644 --- a/packages/ui-default/templates/record_main_tr.html +++ b/packages/ui-default/templates/record_main_tr.html @@ -1,7 +1,8 @@ {% import "components/record.html" as record with context %} {% import "components/problem.html" as problem with context %} +{% import "components/user.html" as user with context %} +{% set _isPretest = rdoc.contest and rdoc.contest.toString() == '000000000000000000000000' %} - {% set _isPretest = rdoc.contest and rdoc.contest.toString() == '000000000000000000000000' %} {{ record.render_status_td(rdoc, allDomain = all) }} {% if handler.user.hasPerm(perm.PERM_REJUDGE) and not rdoc.files.hack and not _isPretest %} @@ -17,7 +18,11 @@ {% endif %} {% if pdoc and rdoc.contest %} - {{ problem.render_problem_title(pdoc, tdoc=tdoc, show_tags=false, show_invisible_flag=false) }} + {% if not rdoc.contest.attend and (handler.user.own(tdoc) or handler.user.hasPerm(perm.PERM_VIEW_CONTEST_HIDDEN_SCOREBOARD)) %} + {{ problem.render_problem_title(pdoc, show_tags=false, show_invisible_flag=false) }} + {% else %} + {{ problem.render_problem_title(pdoc, tdoc=tdoc, show_tags=false, show_invisible_flag=false) }} + {% endif %} {% elif pdoc and (not pdoc.hidden or handler.user.hasPerm(perm.PERM_VIEW_PROBLEM_HIDDEN) or handler.user.own(pdoc)) %} {{ problem.render_problem_title(pdoc, show_tags=false) }} {% else %} @@ -28,11 +33,7 @@
- {% if handler.user.hasPerm(perm.PREM_VIEW_DISPLAYNAME) and udoc.displayName %} - {{ udoc.displayName }} ({{ udoc.uname }}) - {% else %} - {{ udoc.uname }} - {% endif %} + {{ user.render_inline(udoc,badge=false,avatar=false) }} {% if [STATUS.STATUS_TIME_LIMIT_EXCEEDED, STATUS.STATUS_MEMORY_LIMIT_EXCEEDED, STATUS.STATUS_OUTPUT_LIMIT_EXCEEDED].includes(rdoc['status']) %}≥{% endif %}{{ rdoc.time|round|int }}ms diff --git a/packages/ui-default/templates/stu_class_list.html b/packages/ui-default/templates/stu_class_list.html new file mode 100644 index 0000000000..391067af26 --- /dev/null +++ b/packages/ui-default/templates/stu_class_list.html @@ -0,0 +1,112 @@ +{% extends "layout/basic.html" %} +{% block content %} +
+
+
+
+

班级

+ {% if handler.user.hasPriv(PRIV.PRIV_ALL) %} +
+
+ + +
+
+ {% endif %} +
+
+

总计{{ clsList.length }}个班级 (刷新时间:{{ datetimeSpan(cacheTime) | safe }})

+ {#
排序规则:总计AC数 -> 班级用户数 -> 总计提交数 -> 班级名称字典序
#} +
+
+
+
+
+ {% for clsItem in starStudents %} +
+
+
+

明星班级:{{ clsItem._id }}

+
+
+ + + + + + + + + {# + #} + + + + + + {%- for udoc in clsItem.students -%} + + + + {# + #} + + + + {%- endfor -%} + +
序号用户名总计AC数总计提交数RP个人简介
{{ loop.index }}{{ user.render_inline(udoc,classname=false,modbadge=false) }}{{ udoc.nAccept }}{{ udoc.nSubmit }}{{ udoc.rp | default(1500,true) | round(0) }}{{ udoc.bio|default('')|truncate(64, true)|markdownInline|safe }}
+
+
+
+ {% endfor %} +
+
+
+
+
+

班级列表

+
+
+
+ + + + + + + + + + + + + + + + + + {%- for item in clsList -%} + + + + + + + + + + + {%- endfor -%} + +
序号班级用户数量总计AC数总计提交数平均RP活跃值排名权重
{{ loop.index }} + + {{ item._id }} + + {{ item.stuNum }}{{ item.nAccept }}{{ item.nSubmit }}{{ item.rpAvg | round(0) }}{{ item.activity | round(0) }}{{ item.weight | round(0) }}
+
+
+
+
+
+ {% endblock %} \ No newline at end of file diff --git a/packages/ui-default/templates/stu_class_students.html b/packages/ui-default/templates/stu_class_students.html new file mode 100644 index 0000000000..e34414c59c --- /dev/null +++ b/packages/ui-default/templates/stu_class_students.html @@ -0,0 +1,73 @@ +{% extends "layout/basic.html" %} +{% block content %} +
+
+
+
+

班级:{{ className }}

+
+
+ 该班级下有{{ udocs.length }}个用户 +
+
+
+
+
+
+
+
+
+ {% if not udocs.length %} + {{ nothing.render('该班级还没有人加入哦!') }} + {% else %} + + + + + + + + + + + + + + + + + + + + + + + + + {%- for udoc in udocs -%} + + + + + + + + + + + {%- endfor -%} + +
{{ _('Rank') }}{{ _('Stu_ID') }}{{ _('Username') }}{{ _('Gender') }}{{ _('RP') }}AC数量{{ _('last active at') }}{{ _('Bio') }}
{{ loop.index }}{{ udoc['stuid'] }}{{ user.render_inline(udoc,classname=false) }}{{ model.builtin.USER_GENDER_ICONS[udoc.gender] }}{{ udoc.rp|default(1500)|round(0) }}{{ udoc['nAccept'] }} + {% if sdocs[udoc['_id']] %} + {{ datetimeSpan(sdocs[udoc['_id']])|safe }} + {% else %} + {{ datetimeSpan(udoc['loginat'])|safe }} + {% endif %} + {{ udoc.bio|default('')|truncate(64, true)|markdownInline|safe }}
+ {% endif %} +
+
+
+
+
+ {% endblock %} \ No newline at end of file diff --git a/packages/ui-default/templates/training_detail.html b/packages/ui-default/templates/training_detail.html index 993854e941..603b8d160d 100644 --- a/packages/ui-default/templates/training_detail.html +++ b/packages/ui-default/templates/training_detail.html @@ -23,8 +23,8 @@
- )} - /> - {i18n('Unsupported configure this type of problem. Please refer to the documentation.')}

)} - /> - - - - ); -} +import { + Card, Classes, Switch, Tab, Tabs, TabsExpander, +} from '@blueprintjs/core'; +import React, { useEffect } from 'react'; +import { useDispatch, useSelector } from 'react-redux'; +import { i18n } from 'vj/utils'; +import { testlibCheckers } from '../monaco/schema/problemconfig'; +import { FormItem, ManagedSelect, SingleFileSelect } from './BasicForm'; +import type { RootState } from './reducer/index'; + +export default function ProblemType() { + const Type = useSelector((state: RootState) => state.config.type); + const checkerType = useSelector((state: RootState) => state.config.checker_type); + const filename = useSelector((state: RootState) => state.config.filename); + const subType = useSelector((state: RootState) => state.config.subType); + const checker = useSelector((state: RootState) => state.config.checker); + const [category, setCategory] = React.useState(''); + const dispatch = useDispatch(); + const dispatcher = (base) => (value) => dispatch({ ...base, value }); + useEffect(() => { + if (category || !checker) return; + if (checker.includes('.')) setCategory('custom'); + else setCategory('preset'); + }, [checker]); + return ( + + + + {i18n('Problem Type')} + + { + dispatch({ type: 'CONFIG_FORM_UPDATE', key: 'checker_type', value }); + if (value === 'testlib' && !category) setCategory('custom'); + }} + renderActiveTabPanelOnly + > + {i18n('CheckerType')} + + + + { + dispatch({ type: 'CONFIG_FORM_UPDATE', key: 'checker_type', value: checkerType === 'strict' ? 'default' : 'strict' }); + }} + /> + + + )} + /> + + + + + {category === 'preset' + ? + + + : + + } + + )} + /> + + + + + + + + + )} + /> + + )} + /> + + + + + + )} + /> + + + { + dispatch({ type: 'CONFIG_FORM_UPDATE', key: 'subType', value: subType === 'multi' ? 'single' : 'multi' }); + }} + /> + + + dispatch(({ type: 'CONFIG_FORM_UPDATE', key: 'filename', value: ev.currentTarget.value }))} + className="textbox" + /> + + + )} + /> + {i18n('Unsupported configure this type of problem. Please refer to the documentation.')}

)} + /> + +
+
+ ); +} diff --git a/packages/ui-default/components/problemconfig/index.tsx b/packages/ui-default/components/problemconfig/index.tsx index d3124f2228..5bcd7209e9 100644 --- a/packages/ui-default/components/problemconfig/index.tsx +++ b/packages/ui-default/components/problemconfig/index.tsx @@ -1,50 +1,50 @@ -import { - Button, Dialog, DialogBody, DialogFooter, Tab, Tabs, -} from '@blueprintjs/core'; -import React from 'react'; -import { useSelector } from 'react-redux'; -import { i18n } from 'vj/utils'; -import ProblemConfigEditor from './ProblemConfigEditor'; -import ProblemConfigForm from './ProblemConfigForm'; -import { ProblemConfigTree } from './ProblemConfigTree'; -import { RootState } from './reducer'; - -interface Props { - onSave: () => void -} - -export default function ProblemConfig(props: Props) { - const [selected, setSelected] = React.useState('basic'); - const [open, setOpen] = React.useState(false); - const valid = useSelector((state: RootState) => state.config.__valid); - const errors = useSelector((state: RootState) => state.config.__errors, (a, b) => JSON.stringify(a) === JSON.stringify(b)); - React.useEffect(() => { - if (valid) setOpen(false); - }, [valid]); - - return (<> -
-
- -
-
- (t !== 'errors' && setSelected(t.toString()))} selectedTabId={valid ? selected : 'errors'}> - } /> - } /> - {errors.map((i) => (
{i}
))}
} /> - -
- - setOpen(false)}> - -

{i18n('Errors detected in the config. Confirm save?')}

-
- - - - } /> -
- - ); -} +import { + Button, Dialog, DialogBody, DialogFooter, Tab, Tabs, +} from '@blueprintjs/core'; +import React from 'react'; +import { useSelector } from 'react-redux'; +import { i18n } from 'vj/utils'; +import ProblemConfigEditor from './ProblemConfigEditor'; +import ProblemConfigForm from './ProblemConfigForm'; +import { ProblemConfigTree } from './ProblemConfigTree'; +import { RootState } from './reducer'; + +interface Props { + onSave: () => void +} + +export default function ProblemConfig(props: Props) { + const [selected, setSelected] = React.useState('basic'); + const [open, setOpen] = React.useState(false); + const valid = useSelector((state: RootState) => state.config.__valid); + const errors = useSelector((state: RootState) => state.config.__errors, (a, b) => JSON.stringify(a) === JSON.stringify(b)); + React.useEffect(() => { + if (valid) setOpen(false); + }, [valid]); + + return (<> +
+
+ +
+
+ (t !== 'errors' && setSelected(t.toString()))} selectedTabId={valid ? selected : 'errors'}> + } /> + } /> + {errors.map((i) => (
{i}
))}
} /> + +
+ + setOpen(false)}> + +

{i18n('Errors detected in the config. Confirm save?')}

+
+ + + + } /> +
+ + ); +} diff --git a/packages/ui-default/components/problemconfig/reducer/config.ts b/packages/ui-default/components/problemconfig/reducer/config.ts index 9b4846ae43..6d829640d5 100644 --- a/packages/ui-default/components/problemconfig/reducer/config.ts +++ b/packages/ui-default/components/problemconfig/reducer/config.ts @@ -1,167 +1,167 @@ -import { parseMemoryMB, parseTimeMS, sortFiles } from '@hydrooj/utils/lib/common'; -import Ajv from 'ajv'; -import type { ProblemConfigFile, TestCaseConfig } from 'hydrooj/src/interface'; -import yaml from 'js-yaml'; -import { cloneDeep } from 'lodash'; -import schema from '../../monaco/schema/problemconfig'; - -type State = ProblemConfigFile & { - __loaded: boolean; - __valid: boolean; - __errors: string[]; - __cases: TestCaseConfig[]; -}; -const ajv = new Ajv(); -const validate = ajv.compile(schema); - -export default function reducer(state = { - type: 'default', __loaded: false, __valid: false, __errors: [], __cases: [], subtasks: [], -} as State, action: any = {}): State { - switch (action.type) { - case 'CONFIG_LOAD_FULFILLED': { - const c = { ...state, __loaded: true }; - try { - let data = yaml.load(action.payload.config) as any; - if (typeof data !== 'object') data = { subtasks: [] }; - else data.subtasks ||= []; - if (!validate(data)) { - Object.assign(c, data); - c.__errors = validate.errors.map((i) => `${i.instancePath}: ${i.message}`); - return c; - } - const subtasks = (data as any).subtasks; - for (const subtask of subtasks) { - if (typeof subtask.id !== 'number') { - for (let i = 1; ; i++) { - if (!subtasks.find((s) => s.id === i)) { - subtask.id = i; - break; - } - } - } - } - Object.assign(c, data); - c.__valid = true; - } catch (e) { - c.__errors.push(e.message); - } - return c; - } - case 'CONFIG_FORM_UPDATE': { - const next = { ...state, [action.key]: action.value }; - if (action.key === 'score' && action.value) next.score = +next.score; - if (action.key === 'checker_type' && action.value === 'other') next.checker_type = 'syzoj'; - if (!action.value || (typeof action.value === 'object' && !action.value.join(''))) delete next[action.key]; - return next; - } - case 'CONFIG_CODE_UPDATE': { - try { - const data = yaml.load(action.payload); - if (!validate(data)) { - return { - ...state, - __valid: false, - __errors: validate.errors.map((i) => `${i.instancePath}: ${i.message}`), - __loaded: true, - }; - } - return { - ...state, ...data as object, __valid: true, __errors: [], __loaded: true, - }; - } catch (e) { - return { - ...state, __valid: false, __errors: [e.message], __loaded: true, - }; - } - } - case 'CONFIG_AUTOCASES_UPDATE': { - const next = { ...state }; - const { subtasks } = action; - for (const subtask of subtasks) { - if (subtask.time === parseTimeMS(state.time || '1s')) delete subtask.time; - if (subtask.memory === parseMemoryMB(state.memory || '256m')) delete subtask.memory; - if (subtask.time) subtask.time += 'ms'; - if (subtask.memory) subtask.memory += 'MB'; - if (typeof subtask.id !== 'number') { - for (let i = 1; ; i++) { - if (!subtasks.find((s) => s.id === s)) { - subtask.id = i; - break; - } - } - } - } - if (subtasks.length === 0) next.subtasks = []; - else { - next.subtasks = subtasks.map((subtask) => ( - { ...subtask, ...{ cases: subtask.cases.map((i) => ({ input: i.input, output: i.output })) } })); - } - return next; - } - case 'problemconfig/updateFileIO': { - const n = { ...state, filename: action.filename }; - if (!n.filename) delete n.filename; - return n; - } - case 'problemconfig/updateGlobalConfig': { - const n = { ...state, time: action.time, memory: action.memory }; - if (!n.time) delete n.time; - if (!n.memory) delete n.memory; - return n; - } - case 'problemconfig/addSubtask': { - const subtasks = cloneDeep(state.subtasks); - subtasks.push({ - cases: [], - score: 0, - id: Object.keys(subtasks).map((i) => subtasks[i].id).reduce((a, b) => Math.max(+a, +b), 0) + 1, - }); - return { ...state, subtasks }; - } - case 'problemconfig/updateSubtaskConfig': { - if (!state.subtasks.find((i) => i.id === action.id)) return state; - const subtask = { ...state.subtasks.find((i) => i.id === action.id) }; - const subtasks = [...state.subtasks]; - subtasks.splice(state.subtasks.findIndex((i) => i.id === action.id), 1, subtask); - if (action.payload.time) subtask.time = action.payload.time; - if (action.payload.memory) subtask.memory = action.payload.memory; - if (action.payload.score) subtask.score = +action.payload.score || 0; - if (action.payload.if) subtask.if = action.payload.if; - if (action.payload.type) subtask.type = action.payload.type; - if (!subtask.time) delete subtask.time; - if (!subtask.memory) delete subtask.memory; - return { ...state, subtasks }; - } - case 'problemconfig/addTestcases': { - return { ...state, __cases: sortFiles([...state.__cases, ...action.cases], 'input') }; - } - case 'problemconfig/moveTestcases': { - const testcases = action.payload.cases; - const subtasks = cloneDeep(state.subtasks); - const __cases = action.payload.source === -1 - ? state.__cases.filter((i) => !testcases.find((j) => i.input === j.input && i.output === j.output)) - : action.payload.target === -1 - ? sortFiles([...state.__cases, ...testcases], 'input') - : state.__cases; - for (const key in subtasks) { - const subtask = subtasks[key]; - if (subtask.id === action.payload.source) { - subtask.cases = subtask.cases.filter((i) => !testcases.find((j) => i.input === j.input && i.output === j.output)); - } else if (subtask.id === action.payload.target) { - subtask.cases = sortFiles([...subtask.cases, ...testcases], 'input'); - } - } - return { ...state, subtasks, __cases }; - } - case 'problemconfig/delTestcases': { - const testcases = action.cases; - return { ...state, __cases: state.__cases.filter((i) => !testcases.find((j) => i.input === j.input && i.output === j.output)) }; - } - case 'problemconfig/deleteSubtask': { - const subtasks = state.subtasks.filter((i) => i.id !== action.id); - return { ...state, subtasks }; - } - default: - return state; - } -} +import { parseMemoryMB, parseTimeMS, sortFiles } from '@hydrooj/utils/lib/common'; +import Ajv from 'ajv'; +import type { ProblemConfigFile, TestCaseConfig } from 'hydrooj/src/interface'; +import yaml from 'js-yaml'; +import { cloneDeep } from 'lodash'; +import schema from '../../monaco/schema/problemconfig'; + +type State = ProblemConfigFile & { + __loaded: boolean; + __valid: boolean; + __errors: string[]; + __cases: TestCaseConfig[]; +}; +const ajv = new Ajv(); +const validate = ajv.compile(schema); + +export default function reducer(state = { + type: 'default', __loaded: false, __valid: false, __errors: [], __cases: [], subtasks: [], +} as State, action: any = {}): State { + switch (action.type) { + case 'CONFIG_LOAD_FULFILLED': { + const c = { ...state, __loaded: true }; + try { + let data = yaml.load(action.payload.config) as any; + if (typeof data !== 'object') data = { subtasks: [] }; + else data.subtasks ||= []; + if (!validate(data)) { + Object.assign(c, data); + c.__errors = validate.errors.map((i) => `${i.instancePath}: ${i.message}`); + return c; + } + const subtasks = (data as any).subtasks; + for (const subtask of subtasks) { + if (typeof subtask.id !== 'number') { + for (let i = 1; ; i++) { + if (!subtasks.find((s) => s.id === i)) { + subtask.id = i; + break; + } + } + } + } + Object.assign(c, data); + c.__valid = true; + } catch (e) { + c.__errors.push(e.message); + } + return c; + } + case 'CONFIG_FORM_UPDATE': { + const next = { ...state, [action.key]: action.value }; + if (action.key === 'score' && action.value) next.score = +next.score; + if (action.key === 'checker_type' && action.value === 'other') next.checker_type = 'syzoj'; + if (!action.value || (typeof action.value === 'object' && !action.value.join(''))) delete next[action.key]; + return next; + } + case 'CONFIG_CODE_UPDATE': { + try { + const data = yaml.load(action.payload); + if (!validate(data)) { + return { + ...state, + __valid: false, + __errors: validate.errors.map((i) => `${i.instancePath}: ${i.message}`), + __loaded: true, + }; + } + return { + ...state, ...data as object, __valid: true, __errors: [], __loaded: true, + }; + } catch (e) { + return { + ...state, __valid: false, __errors: [e.message], __loaded: true, + }; + } + } + case 'CONFIG_AUTOCASES_UPDATE': { + const next = { ...state }; + const { subtasks } = action; + for (const subtask of subtasks) { + if (subtask.time === parseTimeMS(state.time || '1s')) delete subtask.time; + if (subtask.memory === parseMemoryMB(state.memory || '256m')) delete subtask.memory; + if (subtask.time) subtask.time += 'ms'; + if (subtask.memory) subtask.memory += 'MB'; + if (typeof subtask.id !== 'number') { + for (let i = 1; ; i++) { + if (!subtasks.find((s) => s.id === s)) { + subtask.id = i; + break; + } + } + } + } + if (subtasks.length === 0) next.subtasks = []; + else { + next.subtasks = subtasks.map((subtask) => ( + { ...subtask, ...{ cases: subtask.cases.map((i) => ({ input: i.input, output: i.output })) } })); + } + return next; + } + case 'problemconfig/updateFileIO': { + const n = { ...state, filename: action.filename }; + if (!n.filename) delete n.filename; + return n; + } + case 'problemconfig/updateGlobalConfig': { + const n = { ...state, time: action.time, memory: action.memory }; + if (!n.time) delete n.time; + if (!n.memory) delete n.memory; + return n; + } + case 'problemconfig/addSubtask': { + const subtasks = cloneDeep(state.subtasks); + subtasks.push({ + cases: [], + score: 0, + id: Object.keys(subtasks).map((i) => subtasks[i].id).reduce((a, b) => Math.max(+a, +b), 0) + 1, + }); + return { ...state, subtasks }; + } + case 'problemconfig/updateSubtaskConfig': { + if (!state.subtasks.find((i) => i.id === action.id)) return state; + const subtask = { ...state.subtasks.find((i) => i.id === action.id) }; + const subtasks = [...state.subtasks]; + subtasks.splice(state.subtasks.findIndex((i) => i.id === action.id), 1, subtask); + if (action.payload.time) subtask.time = action.payload.time; + if (action.payload.memory) subtask.memory = action.payload.memory; + if (action.payload.score) subtask.score = +action.payload.score || 0; + if (action.payload.if) subtask.if = action.payload.if; + if (action.payload.type) subtask.type = action.payload.type; + if (!subtask.time) delete subtask.time; + if (!subtask.memory) delete subtask.memory; + return { ...state, subtasks }; + } + case 'problemconfig/addTestcases': { + return { ...state, __cases: sortFiles([...state.__cases, ...action.cases], 'input') }; + } + case 'problemconfig/moveTestcases': { + const testcases = action.payload.cases; + const subtasks = cloneDeep(state.subtasks); + const __cases = action.payload.source === -1 + ? state.__cases.filter((i) => !testcases.find((j) => i.input === j.input && i.output === j.output)) + : action.payload.target === -1 + ? sortFiles([...state.__cases, ...testcases], 'input') + : state.__cases; + for (const key in subtasks) { + const subtask = subtasks[key]; + if (subtask.id === action.payload.source) { + subtask.cases = subtask.cases.filter((i) => !testcases.find((j) => i.input === j.input && i.output === j.output)); + } else if (subtask.id === action.payload.target) { + subtask.cases = sortFiles([...subtask.cases, ...testcases], 'input'); + } + } + return { ...state, subtasks, __cases }; + } + case 'problemconfig/delTestcases': { + const testcases = action.cases; + return { ...state, __cases: state.__cases.filter((i) => !testcases.find((j) => i.input === j.input && i.output === j.output)) }; + } + case 'problemconfig/deleteSubtask': { + const subtasks = state.subtasks.filter((i) => i.id !== action.id); + return { ...state, subtasks }; + } + default: + return state; + } +} diff --git a/packages/ui-default/components/problemconfig/reducer/index.ts b/packages/ui-default/components/problemconfig/reducer/index.ts index 3ddfbafbd5..fed6a6d949 100644 --- a/packages/ui-default/components/problemconfig/reducer/index.ts +++ b/packages/ui-default/components/problemconfig/reducer/index.ts @@ -1,11 +1,11 @@ -import { combineReducers } from 'redux'; -import config from './config'; -import testdata from './testdata'; - -const reducer = combineReducers({ - config, - testdata, -}); - -export default reducer; -export type RootState = ReturnType; +import { combineReducers } from 'redux'; +import config from './config'; +import testdata from './testdata'; + +const reducer = combineReducers({ + config, + testdata, +}); + +export default reducer; +export type RootState = ReturnType; diff --git a/packages/ui-default/components/problemconfig/reducer/testdata.ts b/packages/ui-default/components/problemconfig/reducer/testdata.ts index dd014b0c0d..8b0e21f41c 100644 --- a/packages/ui-default/components/problemconfig/reducer/testdata.ts +++ b/packages/ui-default/components/problemconfig/reducer/testdata.ts @@ -1,16 +1,16 @@ -export default function reducer(state = [], action: any = {}) { - switch (action.type) { - case 'CONFIG_LOAD_FULFILLED': { - return state.concat(action.payload.testdata); - } - case 'CONFIG_DELETE_TESTDATA': { - const next = state.filter((i) => i.name !== action.value[0]); - return next; - } - case 'CONFIG_ADD_TESTDATA': { - return state.concat([action.value]); - } - default: - return state; - } -} +export default function reducer(state = [], action: any = {}) { + switch (action.type) { + case 'CONFIG_LOAD_FULFILLED': { + return state.concat(action.payload.testdata); + } + case 'CONFIG_DELETE_TESTDATA': { + const next = state.filter((i) => i.name !== action.value[0]); + return next; + } + case 'CONFIG_ADD_TESTDATA': { + return state.concat([action.value]); + } + default: + return state; + } +} diff --git a/packages/ui-default/components/problemconfig/tree/AddTestcase.tsx b/packages/ui-default/components/problemconfig/tree/AddTestcase.tsx index 3c68310a54..78631a5d23 100644 --- a/packages/ui-default/components/problemconfig/tree/AddTestcase.tsx +++ b/packages/ui-default/components/problemconfig/tree/AddTestcase.tsx @@ -1,145 +1,145 @@ -import { - Button, Classes, Dialog, DialogBody, DialogFooter, Icon, -} from '@blueprintjs/core'; -import { readSubtasksFromFiles } from '@hydrooj/utils/lib/common'; -import React, { useEffect, useRef } from 'react'; -import { useSelector, useStore } from 'react-redux'; -import { i18n } from 'vj/utils'; -import FileSelectAutoComplete from '../../autocomplete/components/FileSelectAutoComplete'; -import { RootState } from '../reducer'; - -export function AddTestcase() { - const [open, setOpen] = React.useState(false); - const [input, setInput] = React.useState(''); - const [output, setOutput] = React.useState(''); - const [valid, setValid] = React.useState(false); - const [autoInput, setAutoInput] = React.useState(true); - const [autoOutput, setAutoOutput] = React.useState(true); - const testdata = useSelector((state: RootState) => state.testdata); - const store = useStore(); - const refInput = useRef(); - const refOutput = useRef(); - - useEffect(() => { - const inputValid = testdata.find((i) => i.name === input); - if (input) setAutoInput(false); - else setAutoInput(true); - setValid(inputValid); - if (inputValid && autoOutput) { - const filename = input.substring(0, input.lastIndexOf('.')); - let outputFile = ''; - if (testdata.find((i) => i.name === `${filename}.out`)) outputFile = `${filename}.out`; - else if (testdata.find((i) => i.name === `${filename}.ans`)) outputFile = `${filename}.ans`; - if (outputFile) { - // @ts-ignore - refOutput.current!.setSelectedItems([outputFile]); - setOutput(outputFile); - setAutoOutput(true); - } - } - }, [input]); - - useEffect(() => { - const outputValid = testdata.find((i) => i.name === output); - if (output) setAutoOutput(false); - else setAutoOutput(true); - setValid(outputValid); - if (outputValid && autoInput) { - const filename = output.substring(0, output.lastIndexOf('.')); - if (testdata.find((i) => i.name === `${filename}.in`)) { - // @ts-ignore - refInput.current!.setSelectedItems([`${filename}.in`]); - setInput(`${filename}.in`); - setAutoInput(true); - } - } - }, [output]); - - function onConfirm() { - store.dispatch({ - type: 'problemconfig/addTestcases', - cases: [{ input, output }], - }); - setOpen(false); - } - - function auto() { - const state = store.getState(); - const subtasks = readSubtasksFromFiles(state.testdata.map((i) => i.name), {}); - const current = state.config.subtasks.flatMap((i) => i.cases).concat(state.config.__cases); - const pending = []; - for (const c of subtasks.flatMap((s) => s.cases)) { - if (!current.find((i) => i.input === c.input && i.output === c.output)) { - pending.push({ - input: c.input, - output: c.output, - }); - } - } - store.dispatch({ - type: 'problemconfig/addTestcases', - cases: pending, - }); - } - - return (<> -
  • -
    -   - {i18n('Auto detect')} -
    -
  • -
  • { - setInput(''); - setOutput(''); - setAutoInput(true); - setAutoOutput(true); - setOpen(true); - }} - > -
    -   - {i18n('Add testcase')} -
    -
  • - setOpen(false)}> - -
    -
    - setInput(e)} - placeholder={i18n('Input')} - value={input || ''} - /> -
    -
    - setOutput(e)} - placeholder={i18n('Output')} - value={input || ''} - /> -
    -
    -
    - } - /> -
    - ); -} +import { + Button, Classes, Dialog, DialogBody, DialogFooter, Icon, +} from '@blueprintjs/core'; +import { readSubtasksFromFiles } from '@hydrooj/utils/lib/common'; +import React, { useEffect, useRef } from 'react'; +import { useSelector, useStore } from 'react-redux'; +import { i18n } from 'vj/utils'; +import FileSelectAutoComplete from '../../autocomplete/components/FileSelectAutoComplete'; +import { RootState } from '../reducer'; + +export function AddTestcase() { + const [open, setOpen] = React.useState(false); + const [input, setInput] = React.useState(''); + const [output, setOutput] = React.useState(''); + const [valid, setValid] = React.useState(false); + const [autoInput, setAutoInput] = React.useState(true); + const [autoOutput, setAutoOutput] = React.useState(true); + const testdata = useSelector((state: RootState) => state.testdata); + const store = useStore(); + const refInput = useRef(); + const refOutput = useRef(); + + useEffect(() => { + const inputValid = testdata.find((i) => i.name === input); + if (input) setAutoInput(false); + else setAutoInput(true); + setValid(inputValid); + if (inputValid && autoOutput) { + const filename = input.substring(0, input.lastIndexOf('.')); + let outputFile = ''; + if (testdata.find((i) => i.name === `${filename}.out`)) outputFile = `${filename}.out`; + else if (testdata.find((i) => i.name === `${filename}.ans`)) outputFile = `${filename}.ans`; + if (outputFile) { + // @ts-ignore + refOutput.current!.setSelectedItems([outputFile]); + setOutput(outputFile); + setAutoOutput(true); + } + } + }, [input]); + + useEffect(() => { + const outputValid = testdata.find((i) => i.name === output); + if (output) setAutoOutput(false); + else setAutoOutput(true); + setValid(outputValid); + if (outputValid && autoInput) { + const filename = output.substring(0, output.lastIndexOf('.')); + if (testdata.find((i) => i.name === `${filename}.in`)) { + // @ts-ignore + refInput.current!.setSelectedItems([`${filename}.in`]); + setInput(`${filename}.in`); + setAutoInput(true); + } + } + }, [output]); + + function onConfirm() { + store.dispatch({ + type: 'problemconfig/addTestcases', + cases: [{ input, output }], + }); + setOpen(false); + } + + function auto() { + const state = store.getState(); + const subtasks = readSubtasksFromFiles(state.testdata.map((i) => i.name), {}); + const current = state.config.subtasks.flatMap((i) => i.cases).concat(state.config.__cases); + const pending = []; + for (const c of subtasks.flatMap((s) => s.cases)) { + if (!current.find((i) => i.input === c.input && i.output === c.output)) { + pending.push({ + input: c.input, + output: c.output, + }); + } + } + store.dispatch({ + type: 'problemconfig/addTestcases', + cases: pending, + }); + } + + return (<> +
  • +
    +   + {i18n('Auto detect')} +
    +
  • +
  • { + setInput(''); + setOutput(''); + setAutoInput(true); + setAutoOutput(true); + setOpen(true); + }} + > +
    +   + {i18n('Add testcase')} +
    +
  • + setOpen(false)}> + +
    +
    + setInput(e)} + placeholder={i18n('Input')} + value={input || ''} + /> +
    +
    + setOutput(e)} + placeholder={i18n('Output')} + value={input || ''} + /> +
    +
    +
    + } + /> +
    + ); +} diff --git a/packages/ui-default/components/problemconfig/tree/SelectionManager.tsx b/packages/ui-default/components/problemconfig/tree/SelectionManager.tsx index 53602da3b7..d0405fe96d 100644 --- a/packages/ui-default/components/problemconfig/tree/SelectionManager.tsx +++ b/packages/ui-default/components/problemconfig/tree/SelectionManager.tsx @@ -1,130 +1,130 @@ -import React from 'react'; -import { useSelector } from 'react-redux'; -import { RootState } from '../reducer'; -import { TestcaseGroup } from './Testcase'; - -interface SelectionManagerProps { - subtaskId: number; - subtaskIds: number[]; -} - -function collide(rect1: any, rect2: any): boolean { - if ('getBoundingClientRect' in rect1) rect1 = rect1.getBoundingClientRect(); - if ('getBoundingClientRect' in rect2) rect2 = rect2.getBoundingClientRect(); - const maxX = Math.max(rect1.x + rect1.width, rect2.x + rect2.width); - const maxY = Math.max(rect1.y + rect1.height, rect2.y + rect2.height); - const minX = Math.min(rect1.x, rect2.x); - const minY = Math.min(rect1.y, rect2.y); - return maxX - minX <= rect1.width + rect2.width && maxY - minY <= rect1.height + rect2.height; -} - -export function SelectionManager(props: SelectionManagerProps) { - const { subtaskIds, subtaskId } = props; - const cases = useSelector((state: RootState) => (subtaskId === -1 - ? state.config.__cases || [] - : state.config.subtasks.find((i) => i.id === subtaskId).cases || [])); - // Don't need to trigger a re-render for this property change - const pos = React.useMemo(() => ({ - x: 0, y: 0, endX: 0, endY: 0, - }), []); - const [start, setStart] = React.useState(0); - const [end, setEnd] = React.useState(0); - React.useEffect(() => { - setStart(0); - setEnd(0); - }, [JSON.stringify(cases)]); - - const handleMouseDown = React.useCallback((event: React.MouseEvent) => { - pos.x = event.pageX; - pos.y = event.pageY; - // Check if clicking on a selected testcase - const selected = Array.from($('[data-selected="true"]')); - for (const el of selected) { - if (collide(el, { ...pos, width: 1, height: 1 })) return; - } - // eslint-disable-next-line @typescript-eslint/no-use-before-define - document.body.addEventListener('mousemove', handleMouseMove); - // eslint-disable-next-line @typescript-eslint/no-use-before-define - document.body.addEventListener('mouseup', handleMouseUp); - $('body').css('cursor', 'crosshair') - .append('
    '); - $('#divSelectArea').css({ - top: event.pageY, - left: event.pageX, - zIndex: 9999999, - }).fadeTo(12, 0.2); - }, [JSON.stringify(cases)]); - const handleMouseMove = React.useCallback((event) => { - pos.endX = event.pageX; - pos.endY = event.pageY; - $('#divSelectArea').css({ - top: Math.min(event.pageY, pos.y), - left: Math.min(event.pageX, pos.x), - height: Math.abs(event.pageY - pos.y), - width: Math.abs(event.pageX - pos.x), - }); - }, [JSON.stringify(cases)]); - const handleMouseUp = React.useCallback(() => { - document.body.removeEventListener('mousemove', handleMouseMove); - document.body.removeEventListener('mouseup', handleMouseUp); - const caseEntries = Array.from($(`[data-subtaskid="${subtaskId}"]`)); - const selected = []; - for (let i = 0; i < caseEntries.length; i += 1) { - if (collide(caseEntries[i], $('#divSelectArea')[0])) { - selected.push(cases.indexOf(cases.find((c) => c.input === caseEntries[i].dataset.index))); - } - } - const sorted = selected.sort((a, b) => a - b); - $('#divSelectArea').remove(); - $('body').css('cursor', 'default'); - pos.x = pos.y = pos.endX = pos.endY = 0; - if (!sorted.length) return; - setStart(sorted[0]); - setEnd(sorted[selected.length - 1] + 1); - }, [JSON.stringify(cases)]); - - return ( - <> - {end > start && cases.slice(0, start).map((c, id) => ( - { - setStart(id); - setEnd(id + 1); - }} - /> - ))} - {start <= end && ( - - )} - {end < cases.length && cases.slice(end).map((c, id) => ( - { - setStart(id + end); - setEnd(id + end + 1); - }} - /> - ))} - - ); -} +import React from 'react'; +import { useSelector } from 'react-redux'; +import { RootState } from '../reducer'; +import { TestcaseGroup } from './Testcase'; + +interface SelectionManagerProps { + subtaskId: number; + subtaskIds: number[]; +} + +function collide(rect1: any, rect2: any): boolean { + if ('getBoundingClientRect' in rect1) rect1 = rect1.getBoundingClientRect(); + if ('getBoundingClientRect' in rect2) rect2 = rect2.getBoundingClientRect(); + const maxX = Math.max(rect1.x + rect1.width, rect2.x + rect2.width); + const maxY = Math.max(rect1.y + rect1.height, rect2.y + rect2.height); + const minX = Math.min(rect1.x, rect2.x); + const minY = Math.min(rect1.y, rect2.y); + return maxX - minX <= rect1.width + rect2.width && maxY - minY <= rect1.height + rect2.height; +} + +export function SelectionManager(props: SelectionManagerProps) { + const { subtaskIds, subtaskId } = props; + const cases = useSelector((state: RootState) => (subtaskId === -1 + ? state.config.__cases || [] + : state.config.subtasks.find((i) => i.id === subtaskId).cases || [])); + // Don't need to trigger a re-render for this property change + const pos = React.useMemo(() => ({ + x: 0, y: 0, endX: 0, endY: 0, + }), []); + const [start, setStart] = React.useState(0); + const [end, setEnd] = React.useState(0); + React.useEffect(() => { + setStart(0); + setEnd(0); + }, [JSON.stringify(cases)]); + + const handleMouseDown = React.useCallback((event: React.MouseEvent) => { + pos.x = event.pageX; + pos.y = event.pageY; + // Check if clicking on a selected testcase + const selected = Array.from($('[data-selected="true"]')); + for (const el of selected) { + if (collide(el, { ...pos, width: 1, height: 1 })) return; + } + // eslint-disable-next-line @typescript-eslint/no-use-before-define + document.body.addEventListener('mousemove', handleMouseMove); + // eslint-disable-next-line @typescript-eslint/no-use-before-define + document.body.addEventListener('mouseup', handleMouseUp); + $('body').css('cursor', 'crosshair') + .append('
    '); + $('#divSelectArea').css({ + top: event.pageY, + left: event.pageX, + zIndex: 9999999, + }).fadeTo(12, 0.2); + }, [JSON.stringify(cases)]); + const handleMouseMove = React.useCallback((event) => { + pos.endX = event.pageX; + pos.endY = event.pageY; + $('#divSelectArea').css({ + top: Math.min(event.pageY, pos.y), + left: Math.min(event.pageX, pos.x), + height: Math.abs(event.pageY - pos.y), + width: Math.abs(event.pageX - pos.x), + }); + }, [JSON.stringify(cases)]); + const handleMouseUp = React.useCallback(() => { + document.body.removeEventListener('mousemove', handleMouseMove); + document.body.removeEventListener('mouseup', handleMouseUp); + const caseEntries = Array.from($(`[data-subtaskid="${subtaskId}"]`)); + const selected = []; + for (let i = 0; i < caseEntries.length; i += 1) { + if (collide(caseEntries[i], $('#divSelectArea')[0])) { + selected.push(cases.indexOf(cases.find((c) => c.input === caseEntries[i].dataset.index))); + } + } + const sorted = selected.sort((a, b) => a - b); + $('#divSelectArea').remove(); + $('body').css('cursor', 'default'); + pos.x = pos.y = pos.endX = pos.endY = 0; + if (!sorted.length) return; + setStart(sorted[0]); + setEnd(sorted[selected.length - 1] + 1); + }, [JSON.stringify(cases)]); + + return ( + <> + {end > start && cases.slice(0, start).map((c, id) => ( + { + setStart(id); + setEnd(id + 1); + }} + /> + ))} + {start <= end && ( + + )} + {end < cases.length && cases.slice(end).map((c, id) => ( + { + setStart(id + end); + setEnd(id + end + 1); + }} + /> + ))} + + ); +} diff --git a/packages/ui-default/components/problemconfig/tree/SubtaskSettings.tsx b/packages/ui-default/components/problemconfig/tree/SubtaskSettings.tsx index 6ad8275d65..27700625d9 100644 --- a/packages/ui-default/components/problemconfig/tree/SubtaskSettings.tsx +++ b/packages/ui-default/components/problemconfig/tree/SubtaskSettings.tsx @@ -1,198 +1,198 @@ -import { - Button, ControlGroup, - Dialog, DialogBody, DialogFooter, - Icon, InputGroup, Tag, -} from '@blueprintjs/core'; -import { parseMemoryMB, parseTimeMS } from '@hydrooj/utils/lib/common'; -import { isEqual } from 'lodash'; -import React, { useEffect } from 'react'; -import { useDispatch, useSelector } from 'react-redux'; -import { i18n } from 'vj/utils'; -import CustomSelectAutoComplete from '../../autocomplete/components/CustomSelectAutoComplete'; -import { RootState } from '../reducer'; - -interface SubtaskSettingsProps { - subtaskIds: number[]; - subtaskId: number; - time: string; - memory: string; -} - -export function SubtaskSettings(props: SubtaskSettingsProps) { - const [open, setOpen] = React.useState(false); - const [depsOpen, setDepsOpen] = React.useState(false); - const subtaskIds = props.subtaskIds.filter((i) => i !== props.subtaskId); - const score = useSelector((state: RootState) => state.config.subtasks.find((i) => i.id === props.subtaskId).score); - const time = useSelector((state: RootState) => state.config.subtasks.find((i) => i.id === props.subtaskId).time); - const memory = useSelector((state: RootState) => state.config.subtasks.find((i) => i.id === props.subtaskId).memory); - const deps = useSelector((state: RootState) => state.config.subtasks.find((i) => i.id === props.subtaskId).if || [], isEqual); - const type = useSelector((state: RootState) => state.config.subtasks.find((i) => i.id === props.subtaskId).type || 'min'); - - const [ctime, setTime] = React.useState(time); - const [cmemory, setMemory] = React.useState(memory); - const [cscore, setScore] = React.useState(score); - const [cdeps, setDeps] = React.useState(deps.join(', ')); - const [ctype, setType] = React.useState(type); - - const dispatch = useDispatch(); - useEffect(() => { - dispatch({ - type: 'problemconfig/updateSubtaskConfig', - id: props.subtaskId, - payload: { - type: ctype, - }, - }); - }, [ctype]); - - function onConfirm() { - dispatch({ - type: 'problemconfig/updateSubtaskConfig', - id: props.subtaskId, - payload: { - time: ctime, - memory: cmemory, - score: cscore, - if: cdeps.split(',').map((i) => i.trim()).filter((i) => +i).map((i) => +i), - }, - }); - setOpen(false); - setDepsOpen(false); - } - - return (<> - setOpen(false)}> - - - } - rightElement={ms} - onChange={(ev) => setTime(ev.currentTarget.value ? `${ev.currentTarget.value}ms` : '')} - placeholder={parseTimeMS(props.time, false).toString() || '1000'} - value={ctime ? parseTimeMS(ctime, false).toString() || '' : ''} - /> - } - rightElement={MB} - onChange={(ev) => setMemory(ev.currentTarget.value ? `${ev.currentTarget.value}MB` : '')} - placeholder={parseMemoryMB(props.memory, false).toString() || '256'} - value={cmemory ? parseMemoryMB(cmemory, false).toString() || '' : ''} - /> - } - onChange={(ev) => setScore(+ev.target.value || 0)} - placeholder="Score" - type="number" - value={cscore.toString()} - /> - - - } /> - - setDepsOpen(false)}> - - ({ _id: i, name: `${i18n('Subtask {0}', i)}` }))} - setSelectItems={cdeps.split(',').map((i) => i.trim()).filter((i) => +i).map((i) => +i)} - onChange={(items) => setDeps(items)} - placeholder="dependencies" - multi - /> - - } /> - -
  • setOpen(true)}> -
    - - -    - {time || props.time || '1s'} - -    - {memory || props.memory || '256m'} - - {' '} - {score || 0} -
    -
  • -
  • setDepsOpen(true)}> -
    - - -    - {i18n('Dependencies')}: {deps.length ? deps.join(', ') : i18n('(None)')} -
    -
  • -
  • -
    - - -    - {i18n('Scoring method')} - - - -
    -
  • - ); -} - -export function GlobalSettings() { - const time = useSelector((s: RootState) => s.config?.time); - const memory = useSelector((s: RootState) => s.config?.memory); - const [open, setOpen] = React.useState(false); - const [ctime, setTime] = React.useState(time); - const [cmemory, setMemory] = React.useState(memory); - React.useEffect(() => { - setTime(time); - }, [time]); - React.useEffect(() => { - setMemory(memory); - }, [memory]); - const dispatch = useDispatch(); - function onConfirm() { - dispatch({ - type: 'problemconfig/updateGlobalConfig', - time: ctime, - memory: cmemory, - }); - setOpen(false); - } - return (<> - setOpen(false)}> - - - } - rightElement={ms} - onChange={(ev) => setTime(ev.currentTarget.value ? `${ev.currentTarget.value}ms` : '')} - placeholder="1000" - value={ctime ? parseTimeMS(ctime, false).toString() || '' : ''} - /> - } - rightElement={MB} - onChange={(ev) => setMemory(ev.currentTarget.value ? `${ev.currentTarget.value}MB` : '')} - placeholder="256" - value={cmemory ? parseMemoryMB(cmemory, false).toString() || '' : ''} - /> - - - } /> - -
  • setOpen(true)}> -
    - -    - {time || '1s'} - - {' '} - {memory || '256MB'} -
    -
  • - ); -} +import { + Button, ControlGroup, + Dialog, DialogBody, DialogFooter, + Icon, InputGroup, Tag, +} from '@blueprintjs/core'; +import { parseMemoryMB, parseTimeMS } from '@hydrooj/utils/lib/common'; +import { isEqual } from 'lodash'; +import React, { useEffect } from 'react'; +import { useDispatch, useSelector } from 'react-redux'; +import { i18n } from 'vj/utils'; +import CustomSelectAutoComplete from '../../autocomplete/components/CustomSelectAutoComplete'; +import { RootState } from '../reducer'; + +interface SubtaskSettingsProps { + subtaskIds: number[]; + subtaskId: number; + time: string; + memory: string; +} + +export function SubtaskSettings(props: SubtaskSettingsProps) { + const [open, setOpen] = React.useState(false); + const [depsOpen, setDepsOpen] = React.useState(false); + const subtaskIds = props.subtaskIds.filter((i) => i !== props.subtaskId); + const score = useSelector((state: RootState) => state.config.subtasks.find((i) => i.id === props.subtaskId).score); + const time = useSelector((state: RootState) => state.config.subtasks.find((i) => i.id === props.subtaskId).time); + const memory = useSelector((state: RootState) => state.config.subtasks.find((i) => i.id === props.subtaskId).memory); + const deps = useSelector((state: RootState) => state.config.subtasks.find((i) => i.id === props.subtaskId).if || [], isEqual); + const type = useSelector((state: RootState) => state.config.subtasks.find((i) => i.id === props.subtaskId).type || 'min'); + + const [ctime, setTime] = React.useState(time); + const [cmemory, setMemory] = React.useState(memory); + const [cscore, setScore] = React.useState(score); + const [cdeps, setDeps] = React.useState(deps.join(', ')); + const [ctype, setType] = React.useState(type); + + const dispatch = useDispatch(); + useEffect(() => { + dispatch({ + type: 'problemconfig/updateSubtaskConfig', + id: props.subtaskId, + payload: { + type: ctype, + }, + }); + }, [ctype]); + + function onConfirm() { + dispatch({ + type: 'problemconfig/updateSubtaskConfig', + id: props.subtaskId, + payload: { + time: ctime, + memory: cmemory, + score: cscore, + if: cdeps.split(',').map((i) => i.trim()).filter((i) => +i).map((i) => +i), + }, + }); + setOpen(false); + setDepsOpen(false); + } + + return (<> + setOpen(false)}> + + + } + rightElement={ms} + onChange={(ev) => setTime(ev.currentTarget.value ? `${ev.currentTarget.value}ms` : '')} + placeholder={parseTimeMS(props.time, false).toString() || '1000'} + value={ctime ? parseTimeMS(ctime, false).toString() || '' : ''} + /> + } + rightElement={MB} + onChange={(ev) => setMemory(ev.currentTarget.value ? `${ev.currentTarget.value}MB` : '')} + placeholder={parseMemoryMB(props.memory, false).toString() || '256'} + value={cmemory ? parseMemoryMB(cmemory, false).toString() || '' : ''} + /> + } + onChange={(ev) => setScore(+ev.target.value || 0)} + placeholder="Score" + type="number" + value={cscore.toString()} + /> + + + } /> + + setDepsOpen(false)}> + + ({ _id: i, name: `${i18n('Subtask {0}', i)}` }))} + setSelectItems={cdeps.split(',').map((i) => i.trim()).filter((i) => +i).map((i) => +i)} + onChange={(items) => setDeps(items)} + placeholder="dependencies" + multi + /> + + } /> + +
  • setOpen(true)}> +
    + + +    + {time || props.time || '1s'} + +    + {memory || props.memory || '256m'} + + {' '} + {score || 0} +
    +
  • +
  • setDepsOpen(true)}> +
    + + +    + {i18n('Dependencies')}: {deps.length ? deps.join(', ') : i18n('(None)')} +
    +
  • +
  • +
    + + +    + {i18n('Scoring method')} + + + +
    +
  • + ); +} + +export function GlobalSettings() { + const time = useSelector((s: RootState) => s.config?.time); + const memory = useSelector((s: RootState) => s.config?.memory); + const [open, setOpen] = React.useState(false); + const [ctime, setTime] = React.useState(time); + const [cmemory, setMemory] = React.useState(memory); + React.useEffect(() => { + setTime(time); + }, [time]); + React.useEffect(() => { + setMemory(memory); + }, [memory]); + const dispatch = useDispatch(); + function onConfirm() { + dispatch({ + type: 'problemconfig/updateGlobalConfig', + time: ctime, + memory: cmemory, + }); + setOpen(false); + } + return (<> + setOpen(false)}> + + + } + rightElement={ms} + onChange={(ev) => setTime(ev.currentTarget.value ? `${ev.currentTarget.value}ms` : '')} + placeholder="1000" + value={ctime ? parseTimeMS(ctime, false).toString() || '' : ''} + /> + } + rightElement={MB} + onChange={(ev) => setMemory(ev.currentTarget.value ? `${ev.currentTarget.value}MB` : '')} + placeholder="256" + value={cmemory ? parseMemoryMB(cmemory, false).toString() || '' : ''} + /> + + + } /> + +
  • setOpen(true)}> +
    + +    + {time || '1s'} + + {' '} + {memory || '256MB'} +
    +
  • + ); +} diff --git a/packages/ui-default/components/problemconfig/tree/Testcase.tsx b/packages/ui-default/components/problemconfig/tree/Testcase.tsx index a570014a52..3d1f05e793 100644 --- a/packages/ui-default/components/problemconfig/tree/Testcase.tsx +++ b/packages/ui-default/components/problemconfig/tree/Testcase.tsx @@ -1,79 +1,79 @@ -import { - ContextMenu, Menu, MenuItem, TreeNode, -} from '@blueprintjs/core'; -import { TestCaseConfig } from 'hydrooj'; -import { omit } from 'lodash'; -import React from 'react'; -import { useDrag } from 'react-dnd'; -import { i18n } from 'vj/utils'; - -interface TestcaseNodeProps { - c: TestCaseConfig; - index: number; - time?: string; - memory?: string; - onClick?: () => void; - selected: boolean; - subtaskId: number; - subtaskIds: number[]; -} - -export function TestcaseNode(props: TestcaseNodeProps) { - const { - c, selected, onClick, subtaskIds, subtaskId, - } = props; - return ( - - - {subtaskIds.filter((i) => i !== subtaskId).map((i) => ( - - ))} - {subtaskIds.length <= 1 && ( - - )} - - - } - > -  {c.input} / {c.output}} - path={[0]} - /> - - ); -} - -interface TestcaseGroupProps extends Omit { - cases: TestCaseConfig[]; - onMouseDown?: (event: React.MouseEvent) => void; -} - -export function TestcaseGroup(props: TestcaseGroupProps) { - const { - cases, subtaskId, onClick, index, - } = props; - const [collected, drag] = useDrag(() => ({ - type: 'cases', - collect: (monitor) => ({ - isDragging: monitor.isDragging(), - }), - canDrag: props.selected, - item: { cases, subtaskId }, - }), [JSON.stringify(cases), subtaskId]); - return
    - {cases.map((c, id) => ( - - ))} -
    ; -} +import { + ContextMenu, Menu, MenuItem, TreeNode, +} from '@blueprintjs/core'; +import { TestCaseConfig } from 'hydrooj'; +import { omit } from 'lodash'; +import React from 'react'; +import { useDrag } from 'react-dnd'; +import { i18n } from 'vj/utils'; + +interface TestcaseNodeProps { + c: TestCaseConfig; + index: number; + time?: string; + memory?: string; + onClick?: () => void; + selected: boolean; + subtaskId: number; + subtaskIds: number[]; +} + +export function TestcaseNode(props: TestcaseNodeProps) { + const { + c, selected, onClick, subtaskIds, subtaskId, + } = props; + return ( + + + {subtaskIds.filter((i) => i !== subtaskId).map((i) => ( + + ))} + {subtaskIds.length <= 1 && ( + + )} + + + } + > +  {c.input} / {c.output}} + path={[0]} + /> + + ); +} + +interface TestcaseGroupProps extends Omit { + cases: TestCaseConfig[]; + onMouseDown?: (event: React.MouseEvent) => void; +} + +export function TestcaseGroup(props: TestcaseGroupProps) { + const { + cases, subtaskId, onClick, index, + } = props; + const [collected, drag] = useDrag(() => ({ + type: 'cases', + collect: (monitor) => ({ + isDragging: monitor.isDragging(), + }), + canDrag: props.selected, + item: { cases, subtaskId }, + }), [JSON.stringify(cases), subtaskId]); + return
    + {cases.map((c, id) => ( + + ))} +
    ; +} diff --git a/packages/ui-default/components/profile/backgrounds/gen_thumbnails.sh b/packages/ui-default/components/profile/backgrounds/gen_thumbnails.sh index af394c19f6..0ada80709e 100644 --- a/packages/ui-default/components/profile/backgrounds/gen_thumbnails.sh +++ b/packages/ui-default/components/profile/backgrounds/gen_thumbnails.sh @@ -1,7 +1,7 @@ -#!/bin/bash - -for f in *.jpg -do - echo "$f..." - convert "$f" -strip -interlace Plane -quality 92 -resize 200x124^ -gravity center -extent 200x124 "thumbnail/$f" -done +#!/bin/bash + +for f in *.jpg +do + echo "$f..." + convert "$f" -strip -interlace Plane -quality 92 -resize 200x124^ -gravity center -extent 200x124 "thumbnail/$f" +done diff --git a/packages/ui-default/components/profile/profile.page.styl b/packages/ui-default/components/profile/profile.page.styl index 5702d52598..11108dde7f 100644 --- a/packages/ui-default/components/profile/profile.page.styl +++ b/packages/ui-default/components/profile/profile.page.styl @@ -1,23 +1,23 @@ -.user-profile-avatar - border-radius: 50% !important - -.user-profile-badge - display: inline-block !important - font-size: rem(12px) !important - padding: rem(3px 4px) !important - line-height: 1 !important - - &:hover - text-decoration: none !important - -for n in (1..21) - .user-profile-bg--{n} - background-image: url('backgrounds/' + n + '.jpg') - - .user-profile-bg--thumbnail-{n} - background-image: url('backgrounds/thumbnail/' + n + '.jpg') - -for key, _ in $badge-bg-color - .badge--{key} - background-color: $badge-bg-color[key] !important - color: $badge-text-color[key] !important +.user-profile-avatar + border-radius: 50% !important + +.user-profile-badge + display: inline-block !important + font-size: rem(12px) !important + padding: rem(3px 4px) !important + line-height: 1 !important + + &:hover + text-decoration: none !important + +for n in (1..21) + .user-profile-bg--{n} + background-image: url('backgrounds/' + n + '.jpg') + + .user-profile-bg--thumbnail-{n} + background-image: url('backgrounds/thumbnail/' + n + '.jpg') + +for key, _ in $badge-bg-color + .badge--{key} + background-color: $badge-bg-color[key] !important + color: $badge-text-color[key] !important diff --git a/packages/ui-default/components/react/DomComponent.tsx b/packages/ui-default/components/react/DomComponent.tsx index 2ae7e4881d..7f3ab84fed 100644 --- a/packages/ui-default/components/react/DomComponent.tsx +++ b/packages/ui-default/components/react/DomComponent.tsx @@ -1,14 +1,14 @@ -import $ from 'jquery'; -import { omit } from 'lodash'; -import React from 'react'; - -export default function DomComponent(props: React.HTMLAttributes & { childDom: HTMLElement }) { - const ref = React.useRef(); - React.useEffect(() => { - ref.current.appendChild(props.childDom); - return () => { - $(ref.current).empty(); - }; - }, []); - return
    ; -} +import $ from 'jquery'; +import { omit } from 'lodash'; +import React from 'react'; + +export default function DomComponent(props: React.HTMLAttributes & { childDom: HTMLElement }) { + const ref = React.useRef(); + React.useEffect(() => { + ref.current.appendChild(props.childDom); + return () => { + $(ref.current).empty(); + }; + }, []); + return
    ; +} diff --git a/packages/ui-default/components/react/IconComponent.tsx b/packages/ui-default/components/react/IconComponent.tsx index 1d30d31f21..3e2c6f3d59 100644 --- a/packages/ui-default/components/react/IconComponent.tsx +++ b/packages/ui-default/components/react/IconComponent.tsx @@ -1,20 +1,20 @@ -import classNames from 'classnames'; -import PropTypes from 'prop-types'; -import React from 'react'; - -export default function IconComponent(props: { name: string, className?: string } & React.HTMLAttributes) { - const { - name, - className, - ...rest - } = props; - const cn = classNames(className, `icon icon-${name}`); - return ( - - ); -} - -IconComponent.propTypes = { - name: PropTypes.string.isRequired, - className: PropTypes.string, -}; +import classNames from 'classnames'; +import PropTypes from 'prop-types'; +import React from 'react'; + +export default function IconComponent(props: { name: string, className?: string } & React.HTMLAttributes) { + const { + name, + className, + ...rest + } = props; + const cn = classNames(className, `icon icon-${name}`); + return ( + + ); +} + +IconComponent.propTypes = { + name: PropTypes.string.isRequired, + className: PropTypes.string, +}; diff --git a/packages/ui-default/components/record/record.page.styl b/packages/ui-default/components/record/record.page.styl index fd08b1640f..03c9850487 100644 --- a/packages/ui-default/components/record/record.page.styl +++ b/packages/ui-default/components/record/record.page.styl @@ -1,26 +1,26 @@ -.record-status--text - for key, value in $record-status-color - &.{key} - color: value !important - -.record-status--icon - display: inline-block - width: 1.15em - for key, value in $record-status-icon - &.{key}:before - content: value - color: $record-status-color[key] - -.record-status--border - border-left: rem(3px) solid transparent - for key, value in $record-status-color - &.{key} - border-left: rem(3px) solid lighten(value, 10%) - -.record-status--background - color: #FFF - - for key, value in $record-status-color - &.{key} - background: value - +.record-status--text + for key, value in $record-status-color + &.{key} + color: value !important + +.record-status--icon + display: inline-block + width: 1.15em + for key, value in $record-status-icon + &.{key}:before + content: value + color: $record-status-color[key] + +.record-status--border + border-left: rem(3px) solid transparent + for key, value in $record-status-color + &.{key} + border-left: rem(3px) solid lighten(value, 10%) + +.record-status--background + color: #FFF + + for key, value in $record-status-color + &.{key} + background: value + diff --git a/packages/ui-default/components/rotator/index.js b/packages/ui-default/components/rotator/index.js index cec77a7096..5fe7285fb5 100644 --- a/packages/ui-default/components/rotator/index.js +++ b/packages/ui-default/components/rotator/index.js @@ -1,75 +1,75 @@ -import $ from 'jquery'; -import DOMAttachedObject from 'vj/components/DOMAttachedObject'; -import { delay } from 'vj/utils'; - -const ANIMATION_DURATION = 4000; - -const POS_ABOVE = -1; -const POS_ORIGINAL = 0; -const POS_BELOW = 1; - -const POS_CLASSNAME = { - [POS_ABOVE]: 'pos--above', - [POS_ORIGINAL]: '', - [POS_BELOW]: 'pos--below', -}; - -export default class Rotator extends DOMAttachedObject { - static DOMAttachKey = 'vjRotatorInstance'; - - getItemClass(pos) { - return `rotator__item ${POS_CLASSNAME[pos]}`; - } - - constructor($dom) { - super($dom); - $dom.addClass('rotator'); - this.value = $dom.text(); - this.$item = this - .createItem(this.value, POS_ORIGINAL) - .appendTo($dom.empty()); - } - - createItem(value, initialPosition) { - const $el = $('
    From 78e48fcc6944b960b88c50a4e7689663e61e6d99 Mon Sep 17 00:00:00 2001 From: guke1024 <0124gj@gmail.com> Date: Tue, 6 Aug 2024 21:47:28 +0800 Subject: [PATCH 29/52] =?UTF-8?q?=E7=A6=81=E7=94=A8=E7=AB=99=E5=86=85?= =?UTF-8?q?=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/hydrooj/src/handler/home.ts | 2 +- packages/hydrooj/src/model/setting.ts | 1 + packages/ui-default/templates/components/home.html | 1 - 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/hydrooj/src/handler/home.ts b/packages/hydrooj/src/handler/home.ts index b7310cdf55..1fbaa732ba 100644 --- a/packages/hydrooj/src/handler/home.ts +++ b/packages/hydrooj/src/handler/home.ts @@ -603,6 +603,6 @@ export async function apply(ctx: Context) { ctx.Route('home_avatar', '/home/avatar', HomeAvatarHandler, PRIV.PRIV_USER_PROFILE); ctx.Route('home_domain', '/home/domain', HomeDomainHandler, PRIV.PRIV_USER_PROFILE); ctx.Route('home_domain_create', '/home/domain/create', HomeDomainCreateHandler, PRIV.PRIV_CREATE_DOMAIN); - ctx.Route('home_messages', '/home/messages', HomeMessagesHandler, PRIV.PRIV_USER_PROFILE); + if (system.get('server.message')) ctx.Route('home_messages', '/home/messages', HomeMessagesHandler, PRIV.PRIV_USER_PROFILE); ctx.Connection('home_messages_conn', '/home/messages-conn', HomeMessagesConnectionHandler, PRIV.PRIV_USER_PROFILE); } diff --git a/packages/hydrooj/src/model/setting.ts b/packages/hydrooj/src/model/setting.ts index 52cd77724f..387b854a0d 100644 --- a/packages/hydrooj/src/model/setting.ts +++ b/packages/hydrooj/src/model/setting.ts @@ -260,6 +260,7 @@ SystemSetting( Setting('setting_server', 'server.cors', '', 'text', 'server.cors', 'CORS domains'), Setting('setting_server', 'server.language', 'zh_CN', langRange, 'server.language', 'Default display language'), Setting('setting_server', 'server.login', true, 'boolean', 'server.login', 'Allow builtin-login', FLAG_PRO), + Setting('setting_server', 'server.message', false, 'boolean', 'server.message', 'Allow users send messages'), Setting('setting_server', 'server.checkUpdate', true, 'boolean', 'server.checkUpdate', 'Daily update check'), Setting('setting_server', 'server.ignoreUA', ignoreUA, 'textarea', 'server.ignoreUA', 'ignoredUA'), ServerLangSettingNode, diff --git a/packages/ui-default/templates/components/home.html b/packages/ui-default/templates/components/home.html index cb58e67016..e367497c8c 100644 --- a/packages/ui-default/templates/components/home.html +++ b/packages/ui-default/templates/components/home.html @@ -3,7 +3,6 @@
    From 24d572a94ce80618d83b40367e7ab488e743fcef Mon Sep 17 00:00:00 2001 From: guke1024 <0124gj@gmail.com> Date: Tue, 13 Aug 2024 19:44:16 +0800 Subject: [PATCH 32/52] =?UTF-8?q?=E6=9B=B4=E6=96=B0rating=E8=AE=A1?= =?UTF-8?q?=E7=AE=97=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/hydrooj/src/script/rating.ts | 44 +++++++++------------------ 1 file changed, 15 insertions(+), 29 deletions(-) diff --git a/packages/hydrooj/src/script/rating.ts b/packages/hydrooj/src/script/rating.ts index 696b88e489..ae38d919b9 100644 --- a/packages/hydrooj/src/script/rating.ts +++ b/packages/hydrooj/src/script/rating.ts @@ -1,17 +1,15 @@ -/* eslint-disable simple-import-sort/imports */ /* eslint-disable no-cond-assign */ /* eslint-disable no-await-in-loop */ import { NumericDictionary, unionWith } from 'lodash'; import { Filter, ObjectId } from 'mongodb'; -import { Counter } from '@hydrooj/utils'; import Schema from 'schemastery'; +import { Counter } from '@hydrooj/utils'; import { Tdoc, Udoc } from '../interface'; import difficultyAlgorithm from '../lib/difficulty'; import rating from '../lib/rating'; import { PRIV, STATUS } from '../model/builtin'; import * as contest from '../model/contest'; import domain from '../model/domain'; -import record from '../model/record'; import problem from '../model/problem'; import UserModel from '../model/user'; import db from '../service/db'; @@ -26,8 +24,7 @@ interface RpDef { base: number; } -// eslint-disable-next-line @typescript-eslint/no-unused-vars -const { log, max, min } = Math; +const { max, min } = Math; export const RpTypes: Record = { problem: { @@ -35,31 +32,20 @@ export const RpTypes: Record = { const problems = await problem.getMulti('', { domainId: { $in: domainIds }, nAccept: { $gt: 0 }, hidden: false }).toArray(); if (problems.length) await report({ message: `Found ${problems.length} problems in ${domainIds[0]}` }); for (const pdoc of problems) { - const nPages = Math.floor( - (await problem.getMultiStatus( - pdoc.domainId, - { - docId: pdoc.docId, - rid: { $ne: null }, - uid: { $ne: pdoc.owner }, - }, - ).count() + 99) / 100, + const cursor = problem.getMultiStatus( + pdoc.domainId, + { + docId: pdoc.docId, + rid: { $ne: null }, + score: { $gt: 0 }, + }, ); - pdoc.difficulty ||= difficultyAlgorithm(pdoc.nSubmit, pdoc.nAccept) || 5; - const p = pdoc.difficulty / (Math.sqrt(Math.sqrt(pdoc.nAccept)) + 1) / 10; - for (let page = 1; page <= nPages; page++) { - const psdocs = await problem.getMultiStatus( - pdoc.domainId, { docId: pdoc.docId, rid: { $ne: null } }, - ).limit(100).skip((page - 1) * 100).project({ rid: 1, uid: 1 }).toArray(); - const rdict = await record.getList(pdoc.domainId, psdocs.map((psdoc) => psdoc.rid)); - for (const psdoc of psdocs) { - if (rdict[psdoc.rid.toHexString()]) { - const rp = rdict[psdoc.rid.toHexString()].score * p; - udict[psdoc.uid] = (udict[psdoc.uid] || 0) + rp; - } - } + const difficulty = +pdoc.difficulty || difficultyAlgorithm(pdoc.nSubmit, pdoc.nAccept) || 5; + const p = difficulty / 100; + let psdoc; + while (psdoc = await cursor.next()) { + udict[psdoc.uid] += min(psdoc.score, 100) * p; } - udict[pdoc.owner] = (udict[pdoc.owner] || 0) + pdoc.difficulty; } for (const key in udict) udict[key] /= 10; }, @@ -96,7 +82,7 @@ export const RpTypes: Record = { for (const key in udict) udict[key] = max(1, udict[key] / 4 - 375); }, hidden: false, - base: 2000, + base: 1500, }, delta: { async run(domainIds, udict) { From 721d1726d324c88fe7a9961f2a4d7e07e1a9ca64 Mon Sep 17 00:00:00 2001 From: guke1024 <0124gj@gmail.com> Date: Tue, 13 Aug 2024 21:48:32 +0800 Subject: [PATCH 33/52] =?UTF-8?q?=E4=BF=AE=E5=A4=8Duserpriv=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/ui-default/templates/components/user.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/ui-default/templates/components/user.html b/packages/ui-default/templates/components/user.html index cdd572f7e6..5ea73a040e 100644 --- a/packages/ui-default/templates/components/user.html +++ b/packages/ui-default/templates/components/user.html @@ -18,8 +18,8 @@ {{ udoc.name }} {% else %} - -{% endblock %} +{% import "components/nothing.html" as nothing with context %} +{% extends "layout/basic.html" %} +{% block content %} +{{ set(UiContext, 'tdoc', tdoc) }} +
    +
    +
    +
    +

    {{ _('Balloon Status') }}

    +
    + +
    +
    + {{ noscript_note.render() }} +
    + {% if not tdoc.balloon|length %} + {{ nothing.render('Please set the balloon color for each problem first.') }} + {% else %} + + + + + + + + + + + + + + + + + + + + {% include "partials/contest_balloon.html" %} +
    {{ _('Status') }}{{ _('#') }}{{ _('Problem') }}{{ _('Submit By') }}{{ _('Send By') }}{{ _('Awards') }}
    + {% endif %} +
    +
    +
    +
    + {% include 'partials/contest_sidebar_management.html' %} +
    +
    +{% endblock %} diff --git a/packages/ui-default/templates/contest_scoreboard_download_html.html b/packages/ui-default/templates/contest_scoreboard_download_html.html index c8742d5713..0c0be5696d 100644 --- a/packages/ui-default/templates/contest_scoreboard_download_html.html +++ b/packages/ui-default/templates/contest_scoreboard_download_html.html @@ -1,71 +1,71 @@ - - -

    {{ tdoc.title }}

    -Exported from {{ model.system.get('server.url') }} - - - - {%- for column in rows[0] -%} - - {%- endfor -%} - - - - {%- for row in rows -%}{% if loop.index0 %} - - {%- for column in row -%} - - {%- endfor -%} - - {% endif %}{%- endfor -%} - -
    - {% if column.type == 'problem_detail' %} - {{ column.value }} - {% else %} - {{ column.value }} - {% endif %} -
    - {% if column.type == 'record' and column.raw %} - - {{ column.value|string|nl2br|safe }} - - {% elif column.type == 'records' %} - {%- for record in column.raw -%} - {% if loop.index0 %}/{% endif %} - {% if record.raw %} - - {{ record.value|string|nl2br|safe }} - - {% else %} - {{ record.value|string|nl2br|safe }} - {% endif %} - {%- endfor -%} - {% else %} - {{ column.value|string|nl2br|safe }} - {% endif %} -
    + + +

    {{ tdoc.title }}

    +Exported from {{ model.system.get('server.url') }} + + + + {%- for column in rows[0] -%} + + {%- endfor -%} + + + + {%- for row in rows -%}{% if loop.index0 %} + + {%- for column in row -%} + + {%- endfor -%} + + {% endif %}{%- endfor -%} + +
    + {% if column.type == 'problem_detail' %} + {{ column.value }} + {% else %} + {{ column.value }} + {% endif %} +
    + {% if column.type == 'record' and column.raw %} + + {{ column.value|string|nl2br|safe }} + + {% elif column.type == 'records' %} + {%- for record in column.raw -%} + {% if loop.index0 %}/{% endif %} + {% if record.raw %} + + {{ record.value|string|nl2br|safe }} + + {% else %} + {{ record.value|string|nl2br|safe }} + {% endif %} + {%- endfor -%} + {% else %} + {{ column.value|string|nl2br|safe }} + {% endif %} +
    diff --git a/packages/ui-default/templates/contest_user.html b/packages/ui-default/templates/contest_user.html index d59300c7db..a538adbc1b 100644 --- a/packages/ui-default/templates/contest_user.html +++ b/packages/ui-default/templates/contest_user.html @@ -1,47 +1,47 @@ -{% extends "layout/basic.html" %} -{% import "components/contest.html" as contest with context %} -{% import "components/record.html" as record with context %} -{% import "components/problem.html" as problem with context %} -{% block content %} -{{ set(UiContext, 'tdoc', tdoc) }} -
    -
    -
    -
    -

    {{ _('Attendee Manage') }}

    -
    - -
    -
    - {{ noscript_note.render() }} -
    - - - - - - - - - - - - - - - - - - - {% include "partials/contest_user.html" %} -
    {{ _('User ID') }}{{ _('Username') }}{{ _('Begin Time') }} - {{ _('End Time') }}{{ _('Rank') }}{{ _('Actions') }}
    -
    -
    -
    -
    - {% set owner_udoc = udict[tdoc.owner] %} - {% include "partials/contest_sidebar_management.html" %} -
    -
    -{% endblock %} +{% extends "layout/basic.html" %} +{% import "components/contest.html" as contest with context %} +{% import "components/record.html" as record with context %} +{% import "components/problem.html" as problem with context %} +{% block content %} +{{ set(UiContext, 'tdoc', tdoc) }} +
    +
    +
    +
    +

    {{ _('Attendee Manage') }}

    +
    + +
    +
    + {{ noscript_note.render() }} +
    + + + + + + + + + + + + + + + + + + + {% include "partials/contest_user.html" %} +
    {{ _('User ID') }}{{ _('Username') }}{{ _('Begin Time') }} + {{ _('End Time') }}{{ _('Rank') }}{{ _('Actions') }}
    +
    +
    +
    +
    + {% set owner_udoc = udict[tdoc.owner] %} + {% include "partials/contest_sidebar_management.html" %} +
    +
    +{% endblock %} diff --git a/packages/ui-default/templates/courses_main.html b/packages/ui-default/templates/courses_main.html index c43852f84f..2ced93c26a 100644 --- a/packages/ui-default/templates/courses_main.html +++ b/packages/ui-default/templates/courses_main.html @@ -1,61 +1,61 @@ -{% extends "layout/basic.html" %} -{% import "components/nothing.html" as nothing with context %} -{% block content %} -
    -
    -
    -
    -

    课程

    -
    -
    - 总计{{ domains.length | d(0) }}个课程 -
    -
    -
    -
    -
    -
    -
    -
    - {% if not domains.length %} - {{ nothing.render('没有课程。') }} - {% else %} -
    - {% set course_cols = 3 %} - {% set class_name = 'medium-' + (12 / course_cols) %} - {% for item in domains %} -
    -
    -
    -

    {{ item.name }}

    -
    -
    -

    创建者:{{ user.render_inline(uDocs[item.owner],false,false,false) }}

    -

    加入人数:{{ item.users }}

    - -
    -
    -
    - {% if loop.index % course_cols and loop.last %} - {% for i in range(0, course_cols - (loop.index % course_cols)) -%} -
    - {%- endfor %} - {% endif %} - {% if loop.index % course_cols === 0 or loop.last %} -
    - {% if not loop.last %} -
    -
    - {% endif %} - {% endif %} - {% endfor %} - {% endif %} -
    -
    -
    -
    +{% extends "layout/basic.html" %} +{% import "components/nothing.html" as nothing with context %} +{% block content %} +
    +
    +
    +
    +

    课程

    +
    +
    + 总计{{ domains.length | d(0) }}个课程 +
    +
    +
    +
    +
    +
    +
    +
    + {% if not domains.length %} + {{ nothing.render('没有课程。') }} + {% else %} +
    + {% set course_cols = 3 %} + {% set class_name = 'medium-' + (12 / course_cols) %} + {% for item in domains %} +
    +
    +
    +

    {{ item.name }}

    +
    +
    +

    创建者:{{ user.render_inline(uDocs[item.owner],false,false,false) }}

    +

    加入人数:{{ item.users }}

    + +
    +
    +
    + {% if loop.index % course_cols and loop.last %} + {% for i in range(0, course_cols - (loop.index % course_cols)) -%} +
    + {%- endfor %} + {% endif %} + {% if loop.index % course_cols === 0 or loop.last %} +
    + {% if not loop.last %} +
    +
    + {% endif %} + {% endif %} + {% endfor %} + {% endif %} +
    +
    +
    +
    {% endblock %} \ No newline at end of file diff --git a/packages/ui-default/templates/discussion_create.html b/packages/ui-default/templates/discussion_create.html index 450cdc3120..a594f8ca92 100644 --- a/packages/ui-default/templates/discussion_create.html +++ b/packages/ui-default/templates/discussion_create.html @@ -1,28 +1,28 @@ -{% extends "layout/basic.html" %} -{% block content %} -
    -
    -
    -
    -

    {{ _('Create Discussion in {0}').format(vnode.title) }}

    -
    -
    -
    - {% include "partials/discussion_edit_form.html" %} -
    - - -
    -
    -
    -
    -
    -
    - {% include 'components/md_hint.html' %} -
    -
    -{% endblock %} +{% extends "layout/basic.html" %} +{% block content %} +
    +
    +
    +
    +

    {{ _('Create Discussion in {0}').format(vnode.title) }}

    +
    +
    +
    + {% include "partials/discussion_edit_form.html" %} +
    + + +
    +
    +
    +
    +
    +
    + {% include 'components/md_hint.html' %} +
    +
    +{% endblock %} diff --git a/packages/ui-default/templates/discussion_detail.html b/packages/ui-default/templates/discussion_detail.html index 53b994a3f9..fbf25e8fc2 100644 --- a/packages/ui-default/templates/discussion_detail.html +++ b/packages/ui-default/templates/discussion_detail.html @@ -1,149 +1,149 @@ -{% extends "layout/basic.html" %} -{% import "components/comments_discussion.html" as comments with context %} -{% block content %} -
    -
    -
    -
    - -
    - {{ ddoc['content']|markdown|safe }} -
    -
    - -
    - -
    -
    - {% set udoc = udict[ddoc.owner] %} -
    - -
    - -
    -
    - -
    -
    - {% if vnode.type == model.document.TYPE_PROBLEM %} - {% set pdoc = vnode %} - {% set owner_udoc = udict[vnode.owner] %} - {% include "partials/problem_sidebar.html" %} - {% endif %} -
    -
    -{% endblock %} +{% extends "layout/basic.html" %} +{% import "components/comments_discussion.html" as comments with context %} +{% block content %} +
    +
    +
    +
    + +
    + {{ ddoc['content']|markdown|safe }} +
    +
    + +
    + +
    +
    + {% set udoc = udict[ddoc.owner] %} +
    + +
    + +
    +
    + +
    +
    + {% if vnode.type == model.document.TYPE_PROBLEM %} + {% set pdoc = vnode %} + {% set owner_udoc = udict[vnode.owner] %} + {% include "partials/problem_sidebar.html" %} + {% endif %} +
    +
    +{% endblock %} diff --git a/packages/ui-default/templates/discussion_edit.html b/packages/ui-default/templates/discussion_edit.html index 40cafc311d..f1141f19aa 100644 --- a/packages/ui-default/templates/discussion_edit.html +++ b/packages/ui-default/templates/discussion_edit.html @@ -1,30 +1,30 @@ -{% extends "layout/basic.html" %} -{% block content %} -
    -
    -
    -
    -
    - {% include "partials/discussion_edit_form.html" %} -
    - - {% if handler.user.own(ddoc) or handler.user.hasPerm(perm.PERM_DELETE_DISCUSSION) %} - - {% endif %} - -
    -
    -
    -
    -
    -
    - {% include 'components/md_hint.html' %} -
    -
    -{% endblock %} +{% extends "layout/basic.html" %} +{% block content %} +
    +
    +
    +
    +
    + {% include "partials/discussion_edit_form.html" %} +
    + + {% if handler.user.own(ddoc) or handler.user.hasPerm(perm.PERM_DELETE_DISCUSSION) %} + + {% endif %} + +
    +
    +
    +
    +
    +
    + {% include 'components/md_hint.html' %} +
    +
    +{% endblock %} diff --git a/packages/ui-default/templates/discussion_main_or_node.html b/packages/ui-default/templates/discussion_main_or_node.html index b5128410a5..f9ac8fb6f0 100644 --- a/packages/ui-default/templates/discussion_main_or_node.html +++ b/packages/ui-default/templates/discussion_main_or_node.html @@ -1,55 +1,55 @@ -{% extends "layout/basic.html" %} -{% block content %} -
    -
    -
    - {% include "partials/discussion_list.html" %} -
    -
    -
    - {% if vnode.type == model.document.TYPE_PROBLEM %} - {% set pdoc = vnode %} - {% set owner_udoc = udict[vnode.owner] %} - {% include "partials/problem_sidebar.html" %} - {% elif vnode.type == model.document.TYPE_CONTEST %} - {% set tdoc = vnode %} - {%- if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) -%} - {% set tsdoc = { attend: tdoc.attend } %} - {%- endif -%} - {% set owner_udoc = udict[vnode.owner] %} - {% include "partials/contest_sidebar.html" %} - {% else %} -
    - {% if vnode.pic %}
    {% endif %} -
    -

    {{ vnode['title'] or _('Create Discussion') }}

    -
    -
    - {% if vnode._id %} - {% if handler.user.hasPerm(perm.PERM_CREATE_DISCUSSION) %} -

    {{ _('Create a Discussion') }}

    - {% else %} - {% if not handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %} -

    {{ _('Login to Create a Discussion') }}

    - {% else %} -

    {{ _('No Permission to Create a Discussion') }}

    - {% endif %} - {% endif %} - {% else %} -

    {{ _('Select a node to create discussion.') }}

    - {% endif %} -
    -
    - {% endif %} -
    -
    -

    公告

    -
    -
    - 普通用户仅可查看公告。 -
    -
    - -
    -
    -{% endblock %} +{% extends "layout/basic.html" %} +{% block content %} +
    +
    +
    + {% include "partials/discussion_list.html" %} +
    +
    +
    + {% if vnode.type == model.document.TYPE_PROBLEM %} + {% set pdoc = vnode %} + {% set owner_udoc = udict[vnode.owner] %} + {% include "partials/problem_sidebar.html" %} + {% elif vnode.type == model.document.TYPE_CONTEST %} + {% set tdoc = vnode %} + {%- if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) -%} + {% set tsdoc = { attend: tdoc.attend } %} + {%- endif -%} + {% set owner_udoc = udict[vnode.owner] %} + {% include "partials/contest_sidebar.html" %} + {% else %} +
    + {% if vnode.pic %}
    {% endif %} +
    +

    {{ vnode['title'] or _('Create Discussion') }}

    +
    +
    + {% if vnode._id %} + {% if handler.user.hasPerm(perm.PERM_CREATE_DISCUSSION) %} +

    {{ _('Create a Discussion') }}

    + {% else %} + {% if not handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %} +

    {{ _('Login to Create a Discussion') }}

    + {% else %} +

    {{ _('No Permission to Create a Discussion') }}

    + {% endif %} + {% endif %} + {% else %} +

    {{ _('Select a node to create discussion.') }}

    + {% endif %} +
    +
    + {% endif %} +
    +
    +

    公告

    +
    +
    + 普通用户仅可查看公告。 +
    +
    + +
    +
    +{% endblock %} diff --git a/packages/ui-default/templates/domain_create.html b/packages/ui-default/templates/domain_create.html index 5b12264fa0..d4a0275593 100644 --- a/packages/ui-default/templates/domain_create.html +++ b/packages/ui-default/templates/domain_create.html @@ -1,55 +1,55 @@ -{% extends "layout/basic.html" %} -{% block content %} -
    -
    -
    -
    -

    {{ _('Create Domain') }}

    -
    -
    -
    -

    {{ _('A domain ID cannot be changed after creation. It is supposed to be:') }}

    -
      -
    • {{ _('Unique') }}
    • -
    • {{ _('At least 4 characters') }}
    • -
    • {{ _('Not wrapped with space') }}
    • -
    • {{ _('Not started with a number') }}
    • -
    • {{ _('Only A-Z, a-z, 0-9 and _ are accepted') }}
    • -
    -
    -
    - {{ form.form_text({ - label:'ID', - name:'id', - autofocus:true, - required:true - }) }} - {{ form.form_text({ - label:'Name', - name:'name', - required:true - }) }} - {{ form.form_textarea({ - label:'Bulletin', - name:'bulletin', - markdown:true, - required:true - }) }} - -
    - - -
    -
    -
    -
    -
    -
    +{% extends "layout/basic.html" %} +{% block content %} +
    +
    +
    +
    +

    {{ _('Create Domain') }}

    +
    +
    +
    +

    {{ _('A domain ID cannot be changed after creation. It is supposed to be:') }}

    +
      +
    • {{ _('Unique') }}
    • +
    • {{ _('At least 4 characters') }}
    • +
    • {{ _('Not wrapped with space') }}
    • +
    • {{ _('Not started with a number') }}
    • +
    • {{ _('Only A-Z, a-z, 0-9 and _ are accepted') }}
    • +
    +
    +
    + {{ form.form_text({ + label:'ID', + name:'id', + autofocus:true, + required:true + }) }} + {{ form.form_text({ + label:'Name', + name:'name', + required:true + }) }} + {{ form.form_textarea({ + label:'Bulletin', + name:'bulletin', + markdown:true, + required:true + }) }} + +
    + + +
    +
    +
    +
    +
    +
    {% endblock %} \ No newline at end of file diff --git a/packages/ui-default/templates/domain_edit.html b/packages/ui-default/templates/domain_edit.html index 7518510a90..b312beb5f0 100644 --- a/packages/ui-default/templates/domain_edit.html +++ b/packages/ui-default/templates/domain_edit.html @@ -1,6 +1,6 @@ -{% extends "domain_base.html" %} -{% block domain_content %} -
    - {% include "partials/setting.html" %} -
    -{% endblock %} +{% extends "domain_base.html" %} +{% block domain_content %} +
    + {% include "partials/setting.html" %} +
    +{% endblock %} diff --git a/packages/ui-default/templates/domain_role.html b/packages/ui-default/templates/domain_role.html index b362e68a64..62a08d0852 100644 --- a/packages/ui-default/templates/domain_role.html +++ b/packages/ui-default/templates/domain_role.html @@ -1,71 +1,71 @@ -{% extends "domain_base.html" %} -{% block domain_content %} - -
    -
    -

    {{ _('{0}: Roles').format(domain.name) }}

    -
    - -
    -
    - {{ noscript_note.render() }} -
    - - - - - - - - - - - - - - - {%- for role in roles -%} - {% set isBuiltin = role._id in ['default', 'guest', 'root'] %} - - - - - - {%- endfor -%} - -
    - - {{ _('Role') }}{{ _('Users') }}
    - - - {{ _('Built-in') if isBuiltin else _('User-defined role') }}: {{ role._id }} - - {{ role.count|default('--') }} -
    -
    -
    - -
    -
    -{% endblock %} +{% extends "domain_base.html" %} +{% block domain_content %} + +
    +
    +

    {{ _('{0}: Roles').format(domain.name) }}

    +
    + +
    +
    + {{ noscript_note.render() }} +
    + + + + + + + + + + + + + + + {%- for role in roles -%} + {% set isBuiltin = role._id in ['default', 'guest', 'root'] %} + + + + + + {%- endfor -%} + +
    + + {{ _('Role') }}{{ _('Users') }}
    + + + {{ _('Built-in') if isBuiltin else _('User-defined role') }}: {{ role._id }} + + {{ role.count|default('--') }} +
    +
    +
    + +
    +
    +{% endblock %} diff --git a/packages/ui-default/templates/error.html b/packages/ui-default/templates/error.html index 3257769683..eb08d0900a 100644 --- a/packages/ui-default/templates/error.html +++ b/packages/ui-default/templates/error.html @@ -1,25 +1,25 @@ -{% extends "layout/basic.html" %} -{% block content %} -
    -
    -
    -
    -
    -

    {{ _('Oops!') }}

    -

    {{ _(error.message).formatFromArray(error.params) }}

    -

    {{ _('Technical Information') }}:

    -

    {{ _('Type') }}: {{ error.name }}

    -

    {{ _('Arguments') }}: -

      - {%- for param in error.params -%} - {% if instanceof(param, UserFacingError) %} -
    1. {{ _(param.message).formatFromArray(param.params)}}
    2. - {% else %} -
    3. {{ param }}
    4. - {% endif %} - {%- endfor -%} -
    -

    -
    -
    -{% endblock %} +{% extends "layout/basic.html" %} +{% block content %} +
    +
    +
    +
    +
    +

    {{ _('Oops!') }}

    +

    {{ _(error.message).formatFromArray(error.params) }}

    +

    {{ _('Technical Information') }}:

    +

    {{ _('Type') }}: {{ error.name }}

    +

    {{ _('Arguments') }}: +

      + {%- for param in error.params -%} + {% if instanceof(param, UserFacingError) %} +
    1. {{ _(param.message).formatFromArray(param.params)}}
    2. + {% else %} +
    3. {{ param }}
    4. + {% endif %} + {%- endfor -%} +
    +

    +
    +
    +{% endblock %} diff --git a/packages/ui-default/templates/home_files.html b/packages/ui-default/templates/home_files.html index be2a0e881e..de0f3b5149 100644 --- a/packages/ui-default/templates/home_files.html +++ b/packages/ui-default/templates/home_files.html @@ -1,16 +1,16 @@ -{% extends "layout/home_base.html" %} -{% block home_content %} -
    -
    -

    {{ _('Files') }}

    -
    - -
    -
    - {{ noscript_note.render() }} - {% include "partials/files.html" %} -
    - -
    -
    +{% extends "layout/home_base.html" %} +{% block home_content %} +
    +
    +

    {{ _('Files') }}

    +
    + +
    +
    + {{ noscript_note.render() }} + {% include "partials/files.html" %} +
    + +
    +
    {% endblock %} \ No newline at end of file diff --git a/packages/ui-default/templates/home_messages.html b/packages/ui-default/templates/home_messages.html index fd70abdd16..86ff50fdf7 100644 --- a/packages/ui-default/templates/home_messages.html +++ b/packages/ui-default/templates/home_messages.html @@ -1,9 +1,9 @@ -{% extends "layout/home_base.html" %} -{% block home_content %} -
    -
    - {{ noscript_note.render() }} -
    -
    -
    -{% endblock %} +{% extends "layout/home_base.html" %} +{% block home_content %} +
    +
    + {{ noscript_note.render() }} +
    +
    +
    +{% endblock %} diff --git a/packages/ui-default/templates/home_settings.html b/packages/ui-default/templates/home_settings.html index 7d13b9be30..d468ae6e07 100644 --- a/packages/ui-default/templates/home_settings.html +++ b/packages/ui-default/templates/home_settings.html @@ -1,21 +1,21 @@ -{% extends "layout/home_base.html" %} -{% block home_content %} -{% if category == "account" %} -
    -
    -

    {{ _('Avatar') }}

    -
    -
    -

    {{ _('You can also upload your avatar to Gravatar and it will be automatically updated here.')|safe }}

    -
    -
    - {{ current.uname }} -
    - -
    -
    -{% endif %} -
    - {% include "partials/setting.html" %} -
    -{% endblock %} +{% extends "layout/home_base.html" %} +{% block home_content %} +{% if category == "account" %} +
    +
    +

    {{ _('Avatar') }}

    +
    +
    +

    {{ _('You can also upload your avatar to Gravatar and it will be automatically updated here.')|safe }}

    +
    +
    + {{ current.uname }} +
    + +
    +
    +{% endif %} +
    + {% include "partials/setting.html" %} +
    +{% endblock %} diff --git a/packages/ui-default/templates/homework_files.html b/packages/ui-default/templates/homework_files.html index 431e032f51..d51bf0ac7c 100644 --- a/packages/ui-default/templates/homework_files.html +++ b/packages/ui-default/templates/homework_files.html @@ -1,24 +1,24 @@ -{% extends "layout/basic.html" %} -{% block content %} -{{ set(UiContext, 'tdoc', tdoc) }} -
    -
    -
    -
    -

    {{ _('Files') }}

    -
    - -
    -
    - {{ noscript_note.render() }} - {% include "partials/files.html" %} -
    - -
    -
    -
    -
    - {% include "partials/homework_sidebar.html" %} -
    -
    -{% endblock %} +{% extends "layout/basic.html" %} +{% block content %} +{{ set(UiContext, 'tdoc', tdoc) }} +
    +
    +
    +
    +

    {{ _('Files') }}

    +
    + +
    +
    + {{ noscript_note.render() }} + {% include "partials/files.html" %} +
    + +
    +
    +
    +
    + {% include "partials/homework_sidebar.html" %} +
    +
    +{% endblock %} diff --git a/packages/ui-default/templates/layout/home_base.html b/packages/ui-default/templates/layout/home_base.html index 73b8dd5d81..cf77fc5a48 100644 --- a/packages/ui-default/templates/layout/home_base.html +++ b/packages/ui-default/templates/layout/home_base.html @@ -1,13 +1,13 @@ -{% import "components/home.html" as home with context %} -{% extends "layout/basic.html" %} -{% block content %} -
    -
    - {% block home_content %}{% endblock %} -
    -
    - {{ home.render_sidebar() }} - {% block home_sidebar %}{% endblock %} -
    -
    -{% endblock %} +{% import "components/home.html" as home with context %} +{% extends "layout/basic.html" %} +{% block content %} +
    +
    + {% block home_content %}{% endblock %} +
    +
    + {{ home.render_sidebar() }} + {% block home_sidebar %}{% endblock %} +
    +
    +{% endblock %} diff --git a/packages/ui-default/templates/layout/immersive.html b/packages/ui-default/templates/layout/immersive.html index 8483ba0dab..7d7aa702d1 100644 --- a/packages/ui-default/templates/layout/immersive.html +++ b/packages/ui-default/templates/layout/immersive.html @@ -1,22 +1,22 @@ -{% set layout_name = "immersive" %} -{% set no_path_section = true %} -{% extends "layout/html5.html" %} -{% block body %} - -{% include "partials/nav.html" %} - -
    -
    - {% include "partials/header_mobile.html" %} - -
    - {% block content %}{% endblock %} -
    - -{% set show_topics = false %} -{% include "partials/footer.html" %} -
    - -{% include "partials/login_dialog.html" %} - -{% endblock %} +{% set layout_name = "immersive" %} +{% set no_path_section = true %} +{% extends "layout/html5.html" %} +{% block body %} + +{% include "partials/nav.html" %} + +
    +
    + {% include "partials/header_mobile.html" %} + +
    + {% block content %}{% endblock %} +
    + +{% set show_topics = false %} +{% include "partials/footer.html" %} +
    + +{% include "partials/login_dialog.html" %} + +{% endblock %} diff --git a/packages/ui-default/templates/layout/mail.html b/packages/ui-default/templates/layout/mail.html index c725fc737a..ee3ebacb14 100644 --- a/packages/ui-default/templates/layout/mail.html +++ b/packages/ui-default/templates/layout/mail.html @@ -1,31 +1,31 @@ -{% set layout_name = "mail" %} - -
    -
    -
    {% block title %}{% endblock %} - {{ handler.domain.ui.name|default(model.system.get('server.name')) }}
    -
    -{% block content %}{% endblock %} -
    - -
    -
    - +{% set layout_name = "mail" %} + +
    +
    +
    {% block title %}{% endblock %} - {{ handler.domain.ui.name|default(model.system.get('server.name')) }}
    +
    +{% block content %}{% endblock %} +
    + +
    +
    + diff --git a/packages/ui-default/templates/layout/simple.html b/packages/ui-default/templates/layout/simple.html index 2e8b5e536d..a9ac9511bb 100644 --- a/packages/ui-default/templates/layout/simple.html +++ b/packages/ui-default/templates/layout/simple.html @@ -1,4 +1,4 @@ -{% set layout_name = "basic" %} -{% extends "layout/html5.html" %} -{% block body %} -{% endblock %} +{% set layout_name = "basic" %} +{% extends "layout/html5.html" %} +{% block body %} +{% endblock %} diff --git a/packages/ui-default/templates/layout/wiki_base.html b/packages/ui-default/templates/layout/wiki_base.html index 339ca548eb..910590f39b 100644 --- a/packages/ui-default/templates/layout/wiki_base.html +++ b/packages/ui-default/templates/layout/wiki_base.html @@ -1,16 +1,16 @@ -{% extends "layout/basic.html" %} -{% block content %} -
    -
    - {% block wiki_content %}{% endblock %} -
    -
    -
    - -
    -
    -
    +{% extends "layout/basic.html" %} +{% block content %} +
    +
    + {% block wiki_content %}{% endblock %} +
    +
    +
    + +
    +
    +
    {% endblock %} \ No newline at end of file diff --git a/packages/ui-default/templates/main.html b/packages/ui-default/templates/main.html index 9e0da76fc6..65bbf35487 100644 --- a/packages/ui-default/templates/main.html +++ b/packages/ui-default/templates/main.html @@ -1,22 +1,22 @@ -{% set page_name = "homepage" %} -{% extends "layout/basic.html" %} -{% import "components/contest.html" as contest with context %} -{% import "components/problem.html" as problem with context %} -{% import "components/user.html" as user with context %} -{% block content %} -
    - {% for column in contents %} -
    - {% for s in column.sections %} - {% if templateExists("partials/homepage/" + s[0] + ".html") %} - {% set payload = s[1] %} - {% include "partials/homepage/" + s[0] + ".html" %} - {% else %} - {% set payload = _("Template {0} not found.").format(s[0]) %} - {% include "partials/homepage/error.html" %} - {% endif %} - {% endfor %} -
    - {% endfor %} -
    -{% endblock %} +{% set page_name = "homepage" %} +{% extends "layout/basic.html" %} +{% import "components/contest.html" as contest with context %} +{% import "components/problem.html" as problem with context %} +{% import "components/user.html" as user with context %} +{% block content %} +
    + {% for column in contents %} +
    + {% for s in column.sections %} + {% if templateExists("partials/homepage/" + s[0] + ".html") %} + {% set payload = s[1] %} + {% include "partials/homepage/" + s[0] + ".html" %} + {% else %} + {% set payload = _("Template {0} not found.").format(s[0]) %} + {% include "partials/homepage/error.html" %} + {% endif %} + {% endfor %} +
    + {% endfor %} +
    +{% endblock %} diff --git a/packages/ui-default/templates/manage_base.html b/packages/ui-default/templates/manage_base.html index 305e3695bb..8434cb9561 100644 --- a/packages/ui-default/templates/manage_base.html +++ b/packages/ui-default/templates/manage_base.html @@ -1,24 +1,24 @@ -{% extends "layout/basic.html" %} -{% block content %} -
    -
    - {% block manage_content %}{% endblock %} -
    -
    -
    - -
    -
    -
    -{% endblock %} +{% extends "layout/basic.html" %} +{% block content %} +
    +
    + {% block manage_content %}{% endblock %} +
    +
    +
    + +
    +
    +
    +{% endblock %} diff --git a/packages/ui-default/templates/manage_dashboard.html b/packages/ui-default/templates/manage_dashboard.html index ee8ccc90d9..32695f66ae 100644 --- a/packages/ui-default/templates/manage_dashboard.html +++ b/packages/ui-default/templates/manage_dashboard.html @@ -1,27 +1,27 @@ -{% import "components/user.html" as user %} -{% extends "manage_base.html" %} -{% block manage_content %} -
    -
    -

    {{ _('Messages') }}

    -
    -
    -
    -
    -
    -

    {{ _('Information') }}

    -
    -
    - - -
    -
    -
    -
    -
    -
    {{ _('Avatar') }}
    -
    {{ _('Name') }}
    {{ domain.name }}
    -
    -
    -
    -{% endblock %} +{% import "components/user.html" as user %} +{% extends "manage_base.html" %} +{% block manage_content %} +
    +
    +

    {{ _('Messages') }}

    +
    +
    +
    +
    +
    +

    {{ _('Information') }}

    +
    +
    + + +
    +
    +
    +
    +
    +
    {{ _('Avatar') }}
    +
    {{ _('Name') }}
    {{ domain.name }}
    +
    +
    +
    +{% endblock %} diff --git a/packages/ui-default/templates/manage_script.html b/packages/ui-default/templates/manage_script.html index 0025f38474..ec6636ccfe 100644 --- a/packages/ui-default/templates/manage_script.html +++ b/packages/ui-default/templates/manage_script.html @@ -1,56 +1,56 @@ -{% extends "manage_base.html" %} -{% block manage_content %} - -
    -
    -

    {{ _('Scripts') }}

    - -
    -
    - {{ noscript_note.render() }} - - - - - - - - - - - - - - - {%- for id, script in scripts -%} - {% if not script.hidden %} - - - - - - {% endif %} - {%- endfor -%} - -
    {{ _('ID') }}{{ _('Description') }}{{ _('Action') }}
    {{ id }}{{ _(script.description|default(_('None'))) }} - {{ _('Run') }} -
    -
    -
    -{% endblock %} +{% extends "manage_base.html" %} +{% block manage_content %} + +
    +
    +

    {{ _('Scripts') }}

    + +
    +
    + {{ noscript_note.render() }} + + + + + + + + + + + + + + + {%- for id, script in scripts -%} + {% if not script.hidden %} + + + + + + {% endif %} + {%- endfor -%} + +
    {{ _('ID') }}{{ _('Description') }}{{ _('Action') }}
    {{ id }}{{ _(script.description|default(_('None'))) }} + {{ _('Run') }} +
    +
    +
    +{% endblock %} diff --git a/packages/ui-default/templates/manage_setting.html b/packages/ui-default/templates/manage_setting.html index fe0395d849..0147a7b649 100644 --- a/packages/ui-default/templates/manage_setting.html +++ b/packages/ui-default/templates/manage_setting.html @@ -1,6 +1,6 @@ -{% extends "manage_base.html" %} -{% block manage_content %} -
    - {% include "partials/setting.html" %} -
    -{% endblock %} +{% extends "manage_base.html" %} +{% block manage_content %} +
    + {% include "partials/setting.html" %} +
    +{% endblock %} diff --git a/packages/ui-default/templates/manage_student_import.html b/packages/ui-default/templates/manage_student_import.html index b82c36047c..43561955a3 100644 --- a/packages/ui-default/templates/manage_student_import.html +++ b/packages/ui-default/templates/manage_student_import.html @@ -1,27 +1,27 @@ -{% import "components/user.html" as user %} -{% extends "manage_base.html" %} -{% block manage_content %} -
    -
    -

    学生导入

    -
    -
    -

    输入学生信息,格式例如:123@abc.com,abc,123456,张三,计科2001,2020310000000,信息用英文逗号隔开,每个学生占一行

    -
    -
    -
    -
    - {{ noscript_note.render() }} -

    - {{ form.form_textarea({ - columns:null, - name:'students', - nospellcheck: true - }) }} -
    - - -
    -
    -
    -{% endblock %} +{% import "components/user.html" as user %} +{% extends "manage_base.html" %} +{% block manage_content %} +
    +
    +

    学生导入

    +
    +
    +

    输入学生信息,格式例如:123@abc.com,abc,123456,张三,计科2001,2020310000000,信息用英文逗号隔开,每个学生占一行

    +
    +
    +
    +
    + {{ noscript_note.render() }} +

    + {{ form.form_textarea({ + columns:null, + name:'students', + nospellcheck: true + }) }} +
    + + +
    +
    +
    +{% endblock %} diff --git a/packages/ui-default/templates/manage_user_priv.html b/packages/ui-default/templates/manage_user_priv.html index 6ee164c61d..062cdadcd4 100644 --- a/packages/ui-default/templates/manage_user_priv.html +++ b/packages/ui-default/templates/manage_user_priv.html @@ -1,76 +1,76 @@ -{% extends "manage_base.html" %} -{% block manage_content %} - -
    -
    -

    {{ _('User Privilege') }}

    -
    - -
    -
    - {{ noscript_note.render() }} -
    - - - - - - - - - - - - - - - - - {% include "partials/manage_user_priv.html" %} -
    {{ _('User ID') }}{{ _('Username') }}{{ _('Privilege') }} - {{ _('Value') }}{{ _('Actions') }}
    -
    -
    -{% endblock %} +{% extends "manage_base.html" %} +{% block manage_content %} + +
    +
    +

    {{ _('User Privilege') }}

    +
    + +
    +
    + {{ noscript_note.render() }} +
    + + + + + + + + + + + + + + + + + {% include "partials/manage_user_priv.html" %} +
    {{ _('User ID') }}{{ _('Username') }}{{ _('Privilege') }} + {{ _('Value') }}{{ _('Actions') }}
    +
    +
    +{% endblock %} diff --git a/packages/ui-default/templates/partials/contest.html b/packages/ui-default/templates/partials/contest.html index 460fb4697e..9321ad95af 100644 --- a/packages/ui-default/templates/partials/contest.html +++ b/packages/ui-default/templates/partials/contest.html @@ -1,3 +1,3 @@ - - {{ tdoc.title }} + + {{ tdoc.title }} \ No newline at end of file diff --git a/packages/ui-default/templates/partials/discussion_edit_form.html b/packages/ui-default/templates/partials/discussion_edit_form.html index 1d7129c7f1..741f361af0 100644 --- a/packages/ui-default/templates/partials/discussion_edit_form.html +++ b/packages/ui-default/templates/partials/discussion_edit_form.html @@ -1,45 +1,45 @@ -{% import "components/form.html" as form with context %} -
    -
    - -
    -
    - -
    -
    - -
    -
    -{{ form.form_textarea({ - columns:12, - label:'Content', - name:'content', - value:ddoc.content|default(''), - hotkeys:'ctrl+enter:submit', - markdown:true, - required:true, - extra_style:'height: 500px', - extra_textarea_class:'auto-resize' - }) }} +{% import "components/form.html" as form with context %} +
    +
    + +
    +
    + +
    +
    + +
    +
    +{{ form.form_textarea({ + columns:12, + label:'Content', + name:'content', + value:ddoc.content|default(''), + hotkeys:'ctrl+enter:submit', + markdown:true, + required:true, + extra_style:'height: 500px', + extra_textarea_class:'auto-resize' + }) }} diff --git a/packages/ui-default/templates/partials/discussion_list.html b/packages/ui-default/templates/partials/discussion_list.html index f56b2868ad..de2e70ba8f 100644 --- a/packages/ui-default/templates/partials/discussion_list.html +++ b/packages/ui-default/templates/partials/discussion_list.html @@ -1,50 +1,50 @@ -{% import "components/nothing.html" as nothing with context %} -{% import "components/user.html" as user with context %} -{% import "components/paginator.html" as paginator with context %} -{% if not ddocs.length %} - {{ nothing.render('No discussion yet...') }} -{% else %} -
      - {%- for ddoc in ddocs -%} -
    1. -
      -
      -
      -
      {{ ddoc.views }}
      -
      {{ _('查看') }}
      -
      -
      -
      -

      {{ ddoc['title'] }}

      - -
      -
      -
    2. - {%- endfor -%} -
    - {% if page != undefined and dpcount != undefined %} - {{ paginator.render(page, dpcount) }} - {% endif %} -{% endif %} +{% import "components/nothing.html" as nothing with context %} +{% import "components/user.html" as user with context %} +{% import "components/paginator.html" as paginator with context %} +{% if not ddocs.length %} + {{ nothing.render('No discussion yet...') }} +{% else %} +
      + {%- for ddoc in ddocs -%} +
    1. +
      +
      +
      +
      {{ ddoc.views }}
      +
      {{ _('查看') }}
      +
      +
      +
      +

      {{ ddoc['title'] }}

      + +
      +
      +
    2. + {%- endfor -%} +
    + {% if page != undefined and dpcount != undefined %} + {{ paginator.render(page, dpcount) }} + {% endif %} +{% endif %} diff --git a/packages/ui-default/templates/partials/discussion_list_main.html b/packages/ui-default/templates/partials/discussion_list_main.html index 7fafa64b34..1e9cbd471c 100644 --- a/packages/ui-default/templates/partials/discussion_list_main.html +++ b/packages/ui-default/templates/partials/discussion_list_main.html @@ -1,17 +1,17 @@ -{% import "components/nothing.html" as nothing with context %} -{% import "components/user.html" as user with context %} -{% import "components/paginator.html" as paginator with context %} -{% if not ddocs.length %} - {{ nothing.render('no discussion yet...') }} -{% else %} - {%- set ddoc = ddocs[0] -%} -
    -

    - {{ ddoc['title'] }} - {{ user.render_inline(udict[ddoc.owner], avatar=false, badge=false, classname=false) }}@{{ datetimeSpan(ddoc.updateAt)|safe }} {{ ddoc.views }}次查看 -

    -
    - {% if page != undefined and dpcount != undefined %} - {{ paginator.render(page, dpcount) }} - {% endif %} -{% endif %} +{% import "components/nothing.html" as nothing with context %} +{% import "components/user.html" as user with context %} +{% import "components/paginator.html" as paginator with context %} +{% if not ddocs.length %} + {{ nothing.render('no discussion yet...') }} +{% else %} + {%- set ddoc = ddocs[0] -%} +
    +

    + {{ ddoc['title'] }} + {{ user.render_inline(udict[ddoc.owner], avatar=false, badge=false, classname=false) }}@{{ datetimeSpan(ddoc.updateAt)|safe }} {{ ddoc.views }}次查看 +

    +
    + {% if page != undefined and dpcount != undefined %} + {{ paginator.render(page, dpcount) }} + {% endif %} +{% endif %} diff --git a/packages/ui-default/templates/partials/discussion_nodes_widget.html b/packages/ui-default/templates/partials/discussion_nodes_widget.html index d54418adb6..0e40c458aa 100644 --- a/packages/ui-default/templates/partials/discussion_nodes_widget.html +++ b/packages/ui-default/templates/partials/discussion_nodes_widget.html @@ -1,17 +1,17 @@ -
    -
    -

    {{ _('Discussion Nodes') }}

    -
    -
      - {%- for category, nodes in vnodes|groupby('content') -%} -
    • -

      {{ category }}

      -
        - {%- for node in nodes -%} -
      1. {{ node.docId }}
      2. - {%- endfor -%} -
      -
    • - {%- endfor -%} -
    +
    +
    +

    {{ _('Discussion Nodes') }}

    +
    +
      + {%- for category, nodes in vnodes|groupby('content') -%} +
    • +

      {{ category }}

      +
        + {%- for node in nodes -%} +
      1. {{ node.docId }}
      2. + {%- endfor -%} +
      +
    • + {%- endfor -%} +
    \ No newline at end of file diff --git a/packages/ui-default/templates/partials/hamburger.html b/packages/ui-default/templates/partials/hamburger.html index adec5970fa..d7ad263c21 100644 --- a/packages/ui-default/templates/partials/hamburger.html +++ b/packages/ui-default/templates/partials/hamburger.html @@ -1,7 +1,7 @@ - + diff --git a/packages/ui-default/templates/partials/header_mobile.html b/packages/ui-default/templates/partials/header_mobile.html index 607bb9262e..978adc355d 100644 --- a/packages/ui-default/templates/partials/header_mobile.html +++ b/packages/ui-default/templates/partials/header_mobile.html @@ -1,12 +1,12 @@ -
    -
    -
    - - - -
    -
    - {% include "partials/hamburger.html" %} -
    -
    -
    +
    +
    +
    + + + +
    +
    + {% include "partials/hamburger.html" %} +
    +
    +
    diff --git a/packages/ui-default/templates/partials/homepage/bulletin.html b/packages/ui-default/templates/partials/homepage/bulletin.html index 954d5b7047..767e2c13b9 100644 --- a/packages/ui-default/templates/partials/homepage/bulletin.html +++ b/packages/ui-default/templates/partials/homepage/bulletin.html @@ -1,7 +1,7 @@ -{% if domain.bulletin %} -
    -
    - {{ domain.bulletin|markdown|safe }} -
    -
    +{% if domain.bulletin %} +
    +
    + {{ domain.bulletin|markdown|safe }} +
    +
    {% endif %} \ No newline at end of file diff --git a/packages/ui-default/templates/partials/homepage/contest.html b/packages/ui-default/templates/partials/homepage/contest.html index e58ed68dd3..6330e77392 100644 --- a/packages/ui-default/templates/partials/homepage/contest.html +++ b/packages/ui-default/templates/partials/homepage/contest.html @@ -1,48 +1,48 @@ -{% set tdocs = payload[0] %} -{% set tsdict = payload[1] %} -{% if tdocs.length %} -
    -
    -

    {{ _('Contest') }}

    -
    -
      - {%- for tdoc in tdocs -%} -
    1. -
      -
      -
      -
      {{ datetimeSpan(tdoc['beginAt'], false, 'D')|safe }}
      -
      {{ datetimeSpan(tdoc['beginAt'], false, 'YYYY-M')|safe }}
      -
      -
      -
      -

      {{ tdoc.title }}

      -
        -
      • - {{ _(model.contest.RULES[tdoc.rule].TEXT) }} -
      • - {% if tdoc.rated %} -
      • Rated
      • - {% endif %} -
      • - {{ contest.render_duration(tdoc) }} {{ _('hour(s)') }} -
      • -
      • - {{ tdoc['attend']|default(0) }} -
      • - {% if tsdict[tdoc.docId]['attend'] == 1 %} -
      • - {{ _('Attended') }} -
      • - {% endif %} -
      -
      -
      -
    2. - {%- endfor -%} -
    - -
    +{% set tdocs = payload[0] %} +{% set tsdict = payload[1] %} +{% if tdocs.length %} +
    +
    +

    {{ _('Contest') }}

    +
    +
      + {%- for tdoc in tdocs -%} +
    1. +
      +
      +
      +
      {{ datetimeSpan(tdoc['beginAt'], false, 'D')|safe }}
      +
      {{ datetimeSpan(tdoc['beginAt'], false, 'YYYY-M')|safe }}
      +
      +
      +
      +

      {{ tdoc.title }}

      +
        +
      • + {{ _(model.contest.RULES[tdoc.rule].TEXT) }} +
      • + {% if tdoc.rated %} +
      • Rated
      • + {% endif %} +
      • + {{ contest.render_duration(tdoc) }} {{ _('hour(s)') }} +
      • +
      • + {{ tdoc['attend']|default(0) }} +
      • + {% if tsdict[tdoc.docId]['attend'] == 1 %} +
      • + {{ _('Attended') }} +
      • + {% endif %} +
      +
      +
      +
    2. + {%- endfor -%} +
    + +
    {% endif %} \ No newline at end of file diff --git a/packages/ui-default/templates/partials/homepage/discussion.html b/packages/ui-default/templates/partials/homepage/discussion.html index a5a2514479..afe4b28f54 100644 --- a/packages/ui-default/templates/partials/homepage/discussion.html +++ b/packages/ui-default/templates/partials/homepage/discussion.html @@ -1,13 +1,13 @@ -{% set ddocs = payload[0] %} -{% set vndict = payload[1] %} -{% if ddocs.length %} -
    -
    -

    {{ _('Recent Discussion') }}

    -
    - {% include "partials/discussion_list_main.html" %} - -
    +{% set ddocs = payload[0] %} +{% set vndict = payload[1] %} +{% if ddocs.length %} +
    +
    +

    {{ _('Recent Discussion') }}

    +
    + {% include "partials/discussion_list_main.html" %} + +
    {% endif %} \ No newline at end of file diff --git a/packages/ui-default/templates/partials/homepage/discussion_nodes.html b/packages/ui-default/templates/partials/homepage/discussion_nodes.html index 20dc8ad9f4..d022fe9684 100644 --- a/packages/ui-default/templates/partials/homepage/discussion_nodes.html +++ b/packages/ui-default/templates/partials/homepage/discussion_nodes.html @@ -1,4 +1,4 @@ -{% if handler.user.hasPerm(perm.PERM_VIEW_DISCUSSION) %} - {% set vnodes = payload %} - {% include 'partials/discussion_nodes_widget.html' %} +{% if handler.user.hasPerm(perm.PERM_VIEW_DISCUSSION) %} + {% set vnodes = payload %} + {% include 'partials/discussion_nodes_widget.html' %} {% endif %} \ No newline at end of file diff --git a/packages/ui-default/templates/partials/homepage/error.html b/packages/ui-default/templates/partials/homepage/error.html index 76c61a0231..11db406ecf 100644 --- a/packages/ui-default/templates/partials/homepage/error.html +++ b/packages/ui-default/templates/partials/homepage/error.html @@ -1,5 +1,5 @@ -
    -
    - {{ payload }} -
    +
    +
    + {{ payload }} +
    \ No newline at end of file diff --git a/packages/ui-default/templates/partials/homepage/hitokoto.html b/packages/ui-default/templates/partials/homepage/hitokoto.html index fb815965ff..7e17978b4b 100644 --- a/packages/ui-default/templates/partials/homepage/hitokoto.html +++ b/packages/ui-default/templates/partials/homepage/hitokoto.html @@ -1,6 +1,6 @@ -
    -
    -

    {{ _('Hitokoto') }}

    -
    -
    -
    +
    +
    +

    {{ _('Hitokoto') }}

    +
    +
    +
    diff --git a/packages/ui-default/templates/partials/homepage/homework.html b/packages/ui-default/templates/partials/homepage/homework.html index 31b4d9d76f..ee1cd0cf53 100644 --- a/packages/ui-default/templates/partials/homepage/homework.html +++ b/packages/ui-default/templates/partials/homepage/homework.html @@ -1,45 +1,45 @@ -{% set htdocs = payload[0] %} -{% set htsdict = payload[1] %} -{% if htdocs.length %} -
    -
    -

    {{ _('Homework') }}

    -
    -
      - {%- for tdoc in htdocs -%} -
    1. -
      -
      -
      -
      {{ datetimeSpan(tdoc['penaltySince'], false, 'D')|safe }}
      -
      {{ datetimeSpan(tdoc['penaltySince'], false, 'YYYY-M')|safe }}
      -
      -
      -
      -

      {{ tdoc['title'] }}

      -
        -
      • {{ _('Status') }}: {{ _(model.contest.statusText(tdoc)) }}
      • -
      • {{ _('Open Since') }}: {{ datetimeSpan(tdoc['beginAt'])|safe }}
      • -
      • - {% if model.contest.isExtended(tdoc) or model.contest.isDone(tdoc) %} - {{ _('Hard Deadline') }}: {{ datetimeSpan(tdoc['endAt'])|safe }} - {% else %} - {{ _('Deadline') }}: {{ datetimeSpan(tdoc['penaltySince'])|safe }} - {% endif %} -
      • - {% if htsdict[tdoc['docId']]['attend'] == 1 %} -
      • - {{ _('Claimed') }} -
      • - {% endif %} -
      -
      -
      -
    2. - {%- endfor -%} -
    - -
    +{% set htdocs = payload[0] %} +{% set htsdict = payload[1] %} +{% if htdocs.length %} +
    +
    +

    {{ _('Homework') }}

    +
    +
      + {%- for tdoc in htdocs -%} +
    1. +
      +
      +
      +
      {{ datetimeSpan(tdoc['penaltySince'], false, 'D')|safe }}
      +
      {{ datetimeSpan(tdoc['penaltySince'], false, 'YYYY-M')|safe }}
      +
      +
      +
      +

      {{ tdoc['title'] }}

      +
        +
      • {{ _('Status') }}: {{ _(model.contest.statusText(tdoc)) }}
      • +
      • {{ _('Open Since') }}: {{ datetimeSpan(tdoc['beginAt'])|safe }}
      • +
      • + {% if model.contest.isExtended(tdoc) or model.contest.isDone(tdoc) %} + {{ _('Hard Deadline') }}: {{ datetimeSpan(tdoc['endAt'])|safe }} + {% else %} + {{ _('Deadline') }}: {{ datetimeSpan(tdoc['penaltySince'])|safe }} + {% endif %} +
      • + {% if htsdict[tdoc['docId']]['attend'] == 1 %} +
      • + {{ _('Claimed') }} +
      • + {% endif %} +
      +
      +
      +
    2. + {%- endfor -%} +
    + +
    {% endif %} \ No newline at end of file diff --git a/packages/ui-default/templates/partials/homepage/problem_search.html b/packages/ui-default/templates/partials/homepage/problem_search.html index 03b9db12d4..b7fa0398b7 100644 --- a/packages/ui-default/templates/partials/homepage/problem_search.html +++ b/packages/ui-default/templates/partials/homepage/problem_search.html @@ -1,13 +1,13 @@ -
    -
    -

    {{ _('Search') }}

    -
    -
    -
    - - -
    -
    +
    +
    +

    {{ _('Search') }}

    +
    +
    +
    + + +
    +
    \ No newline at end of file diff --git a/packages/ui-default/templates/partials/homepage/suggestion.html b/packages/ui-default/templates/partials/homepage/suggestion.html index 88dba392cb..0c426cd5bd 100644 --- a/packages/ui-default/templates/partials/homepage/suggestion.html +++ b/packages/ui-default/templates/partials/homepage/suggestion.html @@ -1,34 +1,34 @@ -
    -
    -

    {{ _('Recommended') }}

    -
    -
    -
    +
    +
    +

    {{ _('Recommended') }}

    +
    +
    +
    diff --git a/packages/ui-default/templates/partials/homepage/training.html b/packages/ui-default/templates/partials/homepage/training.html index 9e82e394c0..4594582954 100644 --- a/packages/ui-default/templates/partials/homepage/training.html +++ b/packages/ui-default/templates/partials/homepage/training.html @@ -1,50 +1,50 @@ -{% set tdocs = payload[0] %} -{% set tsdict = payload[1] %} -{% if tdocs.length %} -
    -
    -

    {{ _('Training') }}

    -
    -
      - {%- for tdoc in tdocs -%} -
    1. -
      -
      -
      -
      {{ tdoc.attend|default(0) }}
      -
      {{ _('Enrolled') }}
      -
      -
      -
      -

      {{ tdoc.title }}

      -
      -

      {{ tdoc['content'] }}

      -
      -
        -
      • - {{ _('{0} sections').format(tdoc['dag']|length) }}, {{ _('{0} problems').format(model.training.getPids(tdoc.dag)|length) }} -
      • -
      • - {% if tsdict[tdoc.docId]['enroll'] %} - {% if not tsdict[tdoc.docId]['done'] %} - - {{ _('Completed') }} {{ (100 * tsdict[tdoc.docId]['donePids']|length / model.training.getPids(tdoc.dag)|length)|round|int }}% - {% else %} - - {{ _('Completed') }} 100% - {% endif %} - {% elif handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %} - {{ _('Not Enrolled') }} - {% endif %} -
      • -
      -
      -
      -
    2. - {%- endfor -%} -
    - -
    +{% set tdocs = payload[0] %} +{% set tsdict = payload[1] %} +{% if tdocs.length %} +
    +
    +

    {{ _('Training') }}

    +
    +
      + {%- for tdoc in tdocs -%} +
    1. +
      +
      +
      +
      {{ tdoc.attend|default(0) }}
      +
      {{ _('Enrolled') }}
      +
      +
      +
      +

      {{ tdoc.title }}

      +
      +

      {{ tdoc['content'] }}

      +
      +
        +
      • + {{ _('{0} sections').format(tdoc['dag']|length) }}, {{ _('{0} problems').format(model.training.getPids(tdoc.dag)|length) }} +
      • +
      • + {% if tsdict[tdoc.docId]['enroll'] %} + {% if not tsdict[tdoc.docId]['done'] %} + + {{ _('Completed') }} {{ (100 * tsdict[tdoc.docId]['donePids']|length / model.training.getPids(tdoc.dag)|length)|round|int }}% + {% else %} + + {{ _('Completed') }} 100% + {% endif %} + {% elif handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %} + {{ _('Not Enrolled') }} + {% endif %} +
      • +
      +
      +
      +
    2. + {%- endfor -%} +
    + +
    {% endif %} \ No newline at end of file diff --git a/packages/ui-default/templates/partials/homework.html b/packages/ui-default/templates/partials/homework.html index 1c71122ba7..8dde242cd8 100644 --- a/packages/ui-default/templates/partials/homework.html +++ b/packages/ui-default/templates/partials/homework.html @@ -1,3 +1,3 @@ - - {{ tdoc.title }} + + {{ tdoc.title }} \ No newline at end of file diff --git a/packages/ui-default/templates/partials/homework_default_penalty_rules.yaml b/packages/ui-default/templates/partials/homework_default_penalty_rules.yaml index 734d4ecd40..79d4bcf4f3 100644 --- a/packages/ui-default/templates/partials/homework_default_penalty_rules.yaml +++ b/packages/ui-default/templates/partials/homework_default_penalty_rules.yaml @@ -1,3 +1,3 @@ -# Format: -# hours: coefficient -1: 0 +# Format: +# hours: coefficient +1: 0 diff --git a/packages/ui-default/templates/partials/manage_user_priv.html b/packages/ui-default/templates/partials/manage_user_priv.html index a24f77b2f6..f4611b1587 100644 --- a/packages/ui-default/templates/partials/manage_user_priv.html +++ b/packages/ui-default/templates/partials/manage_user_priv.html @@ -1,78 +1,78 @@ -{% import "components/user.html" as user with context %} - -{% macro show_priv(upriv) %} -{%- if upriv == 0 -%} - PRIV_NONE -{%- elif upriv == -1 -%} - PRIV_ALL -{%- else -%} - {%- for name, priv in Priv -%} - {%- if priv|bitand(upriv) and not priv|bitand(defaultPriv) -%} -

    +{{ name }}

    - {%- elif priv|bitand(defaultPriv) and not priv|bitand(upriv) -%} -

    -{{ name }}

    - {%- endif -%} - {%- endfor -%} -{%- endif -%} -{% endmacro %} - - - - - # - - - Default Privilege - - - {%- for name, priv in Priv -%} - {%- if defaultPriv|bitand(priv) -%} - {{ name }}
    - {%- endif -%} - {%- endfor -%} - - - {{ defaultPriv }} - - - {{ _('Edit') }} - - - {%- for priv, gudocs in udocs|groupby('priv') -%} - {%- if gudocs|length > 50 -%} - - -
    - {%- for udoc in gudocs -%} - [{{udoc._id}}]{{ user.render_inline(udoc, avatar=false, badge=false) }} - {{ _('Edit') }}    - {%- endfor -%} - - - {{ priv }}
    - {{ show_priv(priv) }} - - - {%- else -%} - {%- for udoc in gudocs -%} - - - {{ udoc._id }} - - - {{ user.render_inline(udoc, badge=false) }} - - - {{ show_priv(udoc.priv) }} - - - {{ udoc.priv }} - - - {{ _('Edit') }} - - - {%- endfor -%} - {%- endif -%} - {%- endfor -%} - +{% import "components/user.html" as user with context %} + +{% macro show_priv(upriv) %} +{%- if upriv == 0 -%} + PRIV_NONE +{%- elif upriv == -1 -%} + PRIV_ALL +{%- else -%} + {%- for name, priv in Priv -%} + {%- if priv|bitand(upriv) and not priv|bitand(defaultPriv) -%} +

    +{{ name }}

    + {%- elif priv|bitand(defaultPriv) and not priv|bitand(upriv) -%} +

    -{{ name }}

    + {%- endif -%} + {%- endfor -%} +{%- endif -%} +{% endmacro %} + + + + + # + + + Default Privilege + + + {%- for name, priv in Priv -%} + {%- if defaultPriv|bitand(priv) -%} + {{ name }}
    + {%- endif -%} + {%- endfor -%} + + + {{ defaultPriv }} + + + {{ _('Edit') }} + + + {%- for priv, gudocs in udocs|groupby('priv') -%} + {%- if gudocs|length > 50 -%} + + +
    + {%- for udoc in gudocs -%} + [{{udoc._id}}]{{ user.render_inline(udoc, avatar=false, badge=false) }} + {{ _('Edit') }}    + {%- endfor -%} + + + {{ priv }}
    + {{ show_priv(priv) }} + + + {%- else -%} + {%- for udoc in gudocs -%} + + + {{ udoc._id }} + + + {{ user.render_inline(udoc, badge=false) }} + + + {{ show_priv(udoc.priv) }} + + + {{ udoc.priv }} + + + {{ _('Edit') }} + + + {%- endfor -%} + {%- endif -%} + {%- endfor -%} + diff --git a/packages/ui-default/templates/partials/problem-sidebar-information.html b/packages/ui-default/templates/partials/problem-sidebar-information.html index 72f34f4528..42c5d28a69 100644 --- a/packages/ui-default/templates/partials/problem-sidebar-information.html +++ b/packages/ui-default/templates/partials/problem-sidebar-information.html @@ -1,25 +1,25 @@ -{% import "components/record.html" as record with context %} -{% import "components/problem.html" as problem with context %} -{% import "components/user.html" as user with context %} -
    -
    -
    {{ _('ID') }}
    -
    {{ pdoc.docId }}
    -
    {{ _('Time') }}
    -
    {{ pdoc.config.timeMax if pdoc.config.timeMax == pdoc.config.timeMin else pdoc.config.timeMin+'~'+pdoc.config.timeMax }}ms
    -
    {{ _('Memory') }}
    -
    {{ pdoc.config.memoryMax if pdoc.config.memoryMax == pdoc.config.memoryMin else pdoc.config.memoryMin+'~'+pdoc.config.memoryMax }}MiB
    -
    {{ _('Difficulty') }}
    -
    {{ pdoc['difficulty'] or lib.difficulty(pdoc.nSubmit, pdoc.nAccept) or _('(None)') }}
    -
    {{ _('Tags') }}
    -
    - {{ problem.render_problem_tags(pdoc, true) }} -
    -
    {{ _('# Submissions') }}
    -
    {{ pdoc.nSubmit }}
    -
    {{ _('Accepted') }}
    -
    {{ pdoc.nAccept }}
    -
    {{ _('Uploaded By') }}
    -
    {{ user.render_inline(owner_udoc, badge=false) }}
    -
    +{% import "components/record.html" as record with context %} +{% import "components/problem.html" as problem with context %} +{% import "components/user.html" as user with context %} +
    +
    +
    {{ _('ID') }}
    +
    {{ pdoc.docId }}
    +
    {{ _('Time') }}
    +
    {{ pdoc.config.timeMax if pdoc.config.timeMax == pdoc.config.timeMin else pdoc.config.timeMin+'~'+pdoc.config.timeMax }}ms
    +
    {{ _('Memory') }}
    +
    {{ pdoc.config.memoryMax if pdoc.config.memoryMax == pdoc.config.memoryMin else pdoc.config.memoryMin+'~'+pdoc.config.memoryMax }}MiB
    +
    {{ _('Difficulty') }}
    +
    {{ pdoc['difficulty'] or lib.difficulty(pdoc.nSubmit, pdoc.nAccept) or _('(None)') }}
    +
    {{ _('Tags') }}
    +
    + {{ problem.render_problem_tags(pdoc, true) }} +
    +
    {{ _('# Submissions') }}
    +
    {{ pdoc.nSubmit }}
    +
    {{ _('Accepted') }}
    +
    {{ pdoc.nAccept }}
    +
    {{ _('Uploaded By') }}
    +
    {{ user.render_inline(owner_udoc, badge=false) }}
    +
    \ No newline at end of file diff --git a/packages/ui-default/templates/partials/problem.html b/packages/ui-default/templates/partials/problem.html index 078fc2d460..c7599f75c3 100644 --- a/packages/ui-default/templates/partials/problem.html +++ b/packages/ui-default/templates/partials/problem.html @@ -1,2 +1,2 @@ -{% import "components/problem.html" as problem with context %} +{% import "components/problem.html" as problem with context %} {{ problem.render_problem_title(pdoc, inline=true) }} \ No newline at end of file diff --git a/packages/ui-default/templates/partials/problem_default.md b/packages/ui-default/templates/partials/problem_default.md index 1bbc4c785c..9762b4c849 100644 --- a/packages/ui-default/templates/partials/problem_default.md +++ b/packages/ui-default/templates/partials/problem_default.md @@ -1,22 +1,22 @@ -# 题目描述 - -[^_^]:注释:请将题面写到上方 - -## 输入格式 - -[^_^]:注释:请将输入格式写到上方 - -## 输出格式 - -[^_^]:注释:请将输出格式写到上方 - -# 样例 -```input1 - -``` -[^_^]:注释:请将输出样例写到两个```之间 -```output1 - -``` -[^_^]:注释:请将输出样例写到两个```之间 -[^_^]:注释:若需要添加更多样例,请按照上方格式在下方添加input2,output2,input3... +# 题目描述 + +[^_^]:注释:请将题面写到上方 + +## 输入格式 + +[^_^]:注释:请将输入格式写到上方 + +## 输出格式 + +[^_^]:注释:请将输出格式写到上方 + +# 样例 +```input1 + +``` +[^_^]:注释:请将输出样例写到两个```之间 +```output1 + +``` +[^_^]:注释:请将输出样例写到两个```之间 +[^_^]:注释:若需要添加更多样例,请按照上方格式在下方添加input2,output2,input3... diff --git a/packages/ui-default/templates/partials/problem_lucky.html b/packages/ui-default/templates/partials/problem_lucky.html index 0c25752cfb..bc127a6b11 100644 --- a/packages/ui-default/templates/partials/problem_lucky.html +++ b/packages/ui-default/templates/partials/problem_lucky.html @@ -1,10 +1,10 @@ -
    -

    - - {{ _('Lucky') }} - -

    -
    -

    {{ _('Pick a problem randomly based on the current filter.') }}

    -
    -
    +
    +

    + + {{ _('Lucky') }} + +

    +
    +

    {{ _('Pick a problem randomly based on the current filter.') }}

    +
    +
    diff --git a/packages/ui-default/templates/partials/problem_sidebar.html b/packages/ui-default/templates/partials/problem_sidebar.html index 3d9b9d97ad..c3d8fc2bec 100644 --- a/packages/ui-default/templates/partials/problem_sidebar.html +++ b/packages/ui-default/templates/partials/problem_sidebar.html @@ -1,14 +1,14 @@ -{% if not owner_udoc %} - {% set owner_udoc = udoc %} -{% endif %} -{% if tdoc %} - {% if tdoc.rule == 'homework' %} - {% include "partials/problem_sidebar_homework.html" %} - {% include "partials/homework_sidebar.html" %} - {% else %} - {% include "partials/problem_sidebar_contest.html" %} - {% include "partials/contest_sidebar.html" %} - {% endif %} -{% else %} - {% include "partials/problem_sidebar_normal.html" %} -{% endif %} +{% if not owner_udoc %} + {% set owner_udoc = udoc %} +{% endif %} +{% if tdoc %} + {% if tdoc.rule == 'homework' %} + {% include "partials/problem_sidebar_homework.html" %} + {% include "partials/homework_sidebar.html" %} + {% else %} + {% include "partials/problem_sidebar_contest.html" %} + {% include "partials/contest_sidebar.html" %} + {% endif %} +{% else %} + {% include "partials/problem_sidebar_normal.html" %} +{% endif %} diff --git a/packages/ui-default/templates/partials/problem_stat.html b/packages/ui-default/templates/partials/problem_stat.html index ac3dece0fe..1b9fb62385 100644 --- a/packages/ui-default/templates/partials/problem_stat.html +++ b/packages/ui-default/templates/partials/problem_stat.html @@ -1,3 +1,3 @@ -
    -

    {{ _('{0} problems' if pcountRelation == 'eq' else 'Over {0} problems').format(pcount) }}

    +
    +

    {{ _('{0} problems' if pcountRelation == 'eq' else 'Over {0} problems').format(pcount) }}

    \ No newline at end of file diff --git a/packages/ui-default/templates/partials/setting.html b/packages/ui-default/templates/partials/setting.html index 7ed5e1df3a..436793c6c2 100644 --- a/packages/ui-default/templates/partials/setting.html +++ b/packages/ui-default/templates/partials/setting.html @@ -1,92 +1,92 @@ -
    -{%- for family, family_settings in settings|groupby('family') -%}{%- if family != 'setting_storage' %} -
    -

    {{ _(family) }}

    -
    -
    - {%- for setting in family_settings -%} - {% if not setting.flag|bitand(model.setting.FLAG_HIDDEN) %} - {% set secret = setting.flag|bitand(model.setting.FLAG_SECRET) != 0 %} - {% if setting.type == 'text' or setting.type == 'password' or setting.type == 'number' or setting.type == 'float' %} - {{ form.form_text({ - type:setting.type, - label:setting.name, - help_text:setting.desc, - name:setting.key, - value:'' if (secret or isFileConfig) else (current[setting.key]|default(setting.value)), - disabled:setting.flag|bitand(2), - placeholder:_('(Not changed)') if secret else '' - }) }} - {% elif setting.type == 'select' %} - {{ form.form_select({ - options:setting.range, - label:setting.name, - help_text:setting.desc, - name:setting.key, - value:current[setting.key] or setting.value, - disabled:setting.flag|bitand(2) - }) }} - {% elif setting.type == 'radio' %} - {{ form.form_radio({ - options:setting.range, - label:setting.name, - help_text:setting.desc, - name:setting.key, - value:current[setting.key] or setting.value, - disabled:setting.flag|bitand(2) - }) }} - {% elif setting.type == 'image_radio' %} - {{ form.form_image_radio({ - options:setting.range, - image_class:setting.image_class, - label:setting.name, - help_text:setting.desc, - name:setting.key, - value:current[setting.key] or setting.value, - disabled:setting.flag|bitand(2) - }) }} - {% elif setting.type == 'textarea' %} - {{ form.form_textarea({ - label:setting.name, - help_text:setting.desc, - name:setting.key, - value:'' if secret else (current[setting.key]|default(setting.value)), - disabled:setting.flag|bitand(2), - placeholder:_('(Not changed)') if secret else '', - extra_attr: 'data-yaml' if setting.subType == 'yaml' else '' - }) }} - {% elif setting.type == 'markdown' %} - {{ form.form_textarea({ - label:setting.name, - help_text:setting.desc, - name:setting.key, - value:'' if secret else (current[setting.key]|default(setting.value)), - markdown:true, - disabled:setting.flag|bitand(2), - placeholder:_('(Not changed)') if secret else '' - }) }} - {% elif setting.type == 'boolean' %} - {% set _val = current[setting.key] %} - {{ form.form_checkbox({ - label:setting.name, - placeholder:setting.desc, - name:setting.key, - value:setting.value if (_val === undefined or _val === null) else _val, - disabled:setting.flag|bitand(2) - })}} - {{ form.form_checkbox({ - label:setting.name, - name:'booleanKeys.' + setting.key, - value:true, - extra_class:'display-hidden', - no_label:true - })}} - {% endif %} - {% endif %} - {%- endfor -%} -
    -{%- endif -%}{%- endfor -%} -
    - -
    + +{%- for family, family_settings in settings|groupby('family') -%}{%- if family != 'setting_storage' %} +
    +

    {{ _(family) }}

    +
    +
    + {%- for setting in family_settings -%} + {% if not setting.flag|bitand(model.setting.FLAG_HIDDEN) %} + {% set secret = setting.flag|bitand(model.setting.FLAG_SECRET) != 0 %} + {% if setting.type == 'text' or setting.type == 'password' or setting.type == 'number' or setting.type == 'float' %} + {{ form.form_text({ + type:setting.type, + label:setting.name, + help_text:setting.desc, + name:setting.key, + value:'' if (secret or isFileConfig) else (current[setting.key]|default(setting.value)), + disabled:setting.flag|bitand(2), + placeholder:_('(Not changed)') if secret else '' + }) }} + {% elif setting.type == 'select' %} + {{ form.form_select({ + options:setting.range, + label:setting.name, + help_text:setting.desc, + name:setting.key, + value:current[setting.key] or setting.value, + disabled:setting.flag|bitand(2) + }) }} + {% elif setting.type == 'radio' %} + {{ form.form_radio({ + options:setting.range, + label:setting.name, + help_text:setting.desc, + name:setting.key, + value:current[setting.key] or setting.value, + disabled:setting.flag|bitand(2) + }) }} + {% elif setting.type == 'image_radio' %} + {{ form.form_image_radio({ + options:setting.range, + image_class:setting.image_class, + label:setting.name, + help_text:setting.desc, + name:setting.key, + value:current[setting.key] or setting.value, + disabled:setting.flag|bitand(2) + }) }} + {% elif setting.type == 'textarea' %} + {{ form.form_textarea({ + label:setting.name, + help_text:setting.desc, + name:setting.key, + value:'' if secret else (current[setting.key]|default(setting.value)), + disabled:setting.flag|bitand(2), + placeholder:_('(Not changed)') if secret else '', + extra_attr: 'data-yaml' if setting.subType == 'yaml' else '' + }) }} + {% elif setting.type == 'markdown' %} + {{ form.form_textarea({ + label:setting.name, + help_text:setting.desc, + name:setting.key, + value:'' if secret else (current[setting.key]|default(setting.value)), + markdown:true, + disabled:setting.flag|bitand(2), + placeholder:_('(Not changed)') if secret else '' + }) }} + {% elif setting.type == 'boolean' %} + {% set _val = current[setting.key] %} + {{ form.form_checkbox({ + label:setting.name, + placeholder:setting.desc, + name:setting.key, + value:setting.value if (_val === undefined or _val === null) else _val, + disabled:setting.flag|bitand(2) + })}} + {{ form.form_checkbox({ + label:setting.name, + name:'booleanKeys.' + setting.key, + value:true, + extra_class:'display-hidden', + no_label:true + })}} + {% endif %} + {% endif %} + {%- endfor -%} +
    +{%- endif -%}{%- endfor -%} +
    + +
    \ No newline at end of file diff --git a/packages/ui-default/templates/partials/training_default.json b/packages/ui-default/templates/partials/training_default.json index aa3f947885..847e4bf249 100644 --- a/packages/ui-default/templates/partials/training_default.json +++ b/packages/ui-default/templates/partials/training_default.json @@ -1,14 +1,14 @@ -[ - { - "_id": 1, - "title": "最初的最初 - A+B Problem", - "requireNids": [], - "pids": ["P1000"] - }, - { - "_id": 2, - "title": "最初的进阶", - "requireNids": [1], - "pids": [2, 3] - } -] +[ + { + "_id": 1, + "title": "最初的最初 - A+B Problem", + "requireNids": [], + "pids": ["P1000"] + }, + { + "_id": 2, + "title": "最初的进阶", + "requireNids": [1], + "pids": [2, 3] + } +] diff --git a/packages/ui-default/templates/partials/user.html b/packages/ui-default/templates/partials/user.html index 2759d5b0dc..48c89227c2 100644 --- a/packages/ui-default/templates/partials/user.html +++ b/packages/ui-default/templates/partials/user.html @@ -1,2 +1,2 @@ -{% import "components/user.html" as user with context %} +{% import "components/user.html" as user with context %} {{ user.render_inline(udoc, badge=false) }} \ No newline at end of file diff --git a/packages/ui-default/templates/partials/user_detail/activity.html b/packages/ui-default/templates/partials/user_detail/activity.html index ed1d974dad..4c257f1bd1 100644 --- a/packages/ui-default/templates/partials/user_detail/activity.html +++ b/packages/ui-default/templates/partials/user_detail/activity.html @@ -1,18 +1,18 @@ -
  • -

    {{ _('Recent Activities') }}

    -
    - {% if not tdocs.length %} - {{ nothing.render("This person is lazy and didn't join any contests or homework.") }} - {% else %} -
    - -
    - {% endif %} -
    +
  • +

    {{ _('Recent Activities') }}

    +
    + {% if not tdocs.length %} + {{ nothing.render("This person is lazy and didn't join any contests or homework.") }} + {% else %} +
    + +
    + {% endif %} +
  • \ No newline at end of file diff --git a/packages/ui-default/templates/partials/user_detail/solution.html b/packages/ui-default/templates/partials/user_detail/solution.html index 934ca40e39..7506d46ecb 100644 --- a/packages/ui-default/templates/partials/user_detail/solution.html +++ b/packages/ui-default/templates/partials/user_detail/solution.html @@ -1,29 +1,29 @@ -{% if psdocs %} -
  • -

    {{ _('Recent Solutions') }}

    -
    - {% if not psdocs.length %} - {{ nothing.render("This person is lazy and didn't write any solutions.") }} - {% else %} -
    -
    - {% set _mark = Math.ceil(psdocs.length/4) %} - {% macro col(psdocs) %} -
    - {% endmacro %} -
    - {{ col(psdocs.slice(0, _mark)) }} - {{ col(psdocs.slice(_mark, _mark*2)) }} - {{ col(psdocs.slice(_mark*2, _mark*3)) }} - {{ col(psdocs.slice(_mark*3)) }} -
    -
    -
    - {% endif %} -
    -
  • +{% if psdocs %} +
  • +

    {{ _('Recent Solutions') }}

    +
    + {% if not psdocs.length %} + {{ nothing.render("This person is lazy and didn't write any solutions.") }} + {% else %} +
    +
    + {% set _mark = Math.ceil(psdocs.length/4) %} + {% macro col(psdocs) %} +
    + {% endmacro %} +
    + {{ col(psdocs.slice(0, _mark)) }} + {{ col(psdocs.slice(_mark, _mark*2)) }} + {{ col(psdocs.slice(_mark*2, _mark*3)) }} + {{ col(psdocs.slice(_mark*3)) }} +
    +
    +
    + {% endif %} +
    +
  • {% endif %} \ No newline at end of file diff --git a/packages/ui-default/templates/problem_config.html b/packages/ui-default/templates/problem_config.html index e7f60d2f3d..912dc3cd89 100644 --- a/packages/ui-default/templates/problem_config.html +++ b/packages/ui-default/templates/problem_config.html @@ -1,39 +1,39 @@ -{% extends "layout/basic.html" %} -{% block content %} -
    -
    -
    -
    -

    {{_('Judge Config')}}(Beta)

    -
    -
    - {{ noscript_note.render() }} -
    -
    -
    -
    -
    -
    -
    -

    {{ testdata.length|default(0) }} {{_('Testdata')}}

    -
    - - {% set sidebar = true %} - {% set can_edit = true %} - {% set filetype = "testdata" %} - {% include "partials/problem_files.html" %} -
    - {% include "partials/problem_sidebar.html" %} -
    -
    +{% extends "layout/basic.html" %} +{% block content %} +
    +
    +
    +
    +

    {{_('Judge Config')}}(Beta)

    +
    +
    + {{ noscript_note.render() }} +
    +
    +
    +
    +
    +
    +
    +

    {{ testdata.length|default(0) }} {{_('Testdata')}}

    +
    + + {% set sidebar = true %} + {% set can_edit = true %} + {% set filetype = "testdata" %} + {% include "partials/problem_files.html" %} +
    + {% include "partials/problem_sidebar.html" %} +
    +
    {% endblock %} \ No newline at end of file diff --git a/packages/ui-default/templates/problem_hack.html b/packages/ui-default/templates/problem_hack.html index bf2fadc31e..b8c0ce9acd 100644 --- a/packages/ui-default/templates/problem_hack.html +++ b/packages/ui-default/templates/problem_hack.html @@ -1,41 +1,41 @@ -{% extends "layout/basic.html" %} -{% block content %} -{{ set(UiContext, 'pdoc', pdoc) }} -
    -
    -
    -
    -

    {{ _('Hack submission') }} #{{ rid }}

    -
    -
    -
    - {{ form.form_textarea({label:'Input', columns:12, name:'input', extra_class:'monospace', autofocus:true, nospellcheck:true}) }} -
    -
    -

    {{ _('Or upload a file:') }}

    -
    -
    -
    -
    - -
    -
    - -
    -
    -
    -
    -
    -
    - {% include "partials/problem_sidebar.html" %} -
    -
    - -{% endblock %} +{% extends "layout/basic.html" %} +{% block content %} +{{ set(UiContext, 'pdoc', pdoc) }} +
    +
    +
    +
    +

    {{ _('Hack submission') }} #{{ rid }}

    +
    +
    +
    + {{ form.form_textarea({label:'Input', columns:12, name:'input', extra_class:'monospace', autofocus:true, nospellcheck:true}) }} +
    +
    +

    {{ _('Or upload a file:') }}

    +
    +
    +
    +
    + +
    +
    + +
    +
    +
    +
    +
    +
    + {% include "partials/problem_sidebar.html" %} +
    +
    + +{% endblock %} diff --git a/packages/ui-default/templates/problem_solution.html b/packages/ui-default/templates/problem_solution.html index 9ecdb05956..7a1eae4db2 100644 --- a/packages/ui-default/templates/problem_solution.html +++ b/packages/ui-default/templates/problem_solution.html @@ -1,55 +1,55 @@ -{% extends "layout/basic.html" %} -{% import "components/comments_solution.html" as comments with context %} -{% block content %} -
    -
    -
    -
    -

    {{ _('{0} solutions').format(pscount) }}

    -
    -
    - {{ comments.render( - view = 'solution', - docs = psdocs, - udict = udict, - comment_ref = 'psid', - reply_ref = 'psrid', - comment_placeholder = 'Write Your Solution', - comment_post_op = 'submit', - comment_edit_op = 'edit_solution', - comment_post_text = 'Share', - reply_post_op = 'reply', - reply_edit_op = 'edit_reply', - comment_delete_op = 'delete_solution', - reply_delete_op = 'delete_reply', - comment_post_perm = perm.PERM_CREATE_PROBLEM_SOLUTION, - comment_edit_perm = perm.PERM_NEVER, - comment_edit_self_perm = perm.PERM_EDIT_PROBLEM_SOLUTION_SELF, - comment_delete_perm = perm.PERM_DELETE_PROBLEM_SOLUTION, - comment_delete_self_perm = perm.PERM_DELETE_PROBLEM_SOLUTION_SELF, - reply_post_perm = perm.PERM_REPLY_PROBLEM_SOLUTION, - reply_edit_perm = perm.PERM_NEVER, - reply_edit_self_perm = perm.PERM_EDIT_PROBLEM_SOLUTION_REPLY_SELF, - reply_delete_perm = perm.PERM_DELETE_PROBLEM_SOLUTION_REPLY, - reply_delete_self_perm = perm.PERM_DELETE_PROBLEM_SOLUTION_REPLY_SELF - ) }} - {% if not sid %} - {{ paginator.render(page, pcount) }} - {% endif %} - {% if drcount == 0 %} - {{ nothing.render('No solutions so far...') }} - {% endif %} -
    -
    - {% if sid %} - - {% endif %} -
    -
    - {% set owner_udoc = udict[pdoc.owner] %} - {% include "partials/problem_sidebar.html" %} -
    -
    -{% endblock %} +{% extends "layout/basic.html" %} +{% import "components/comments_solution.html" as comments with context %} +{% block content %} +
    +
    +
    +
    +

    {{ _('{0} solutions').format(pscount) }}

    +
    +
    + {{ comments.render( + view = 'solution', + docs = psdocs, + udict = udict, + comment_ref = 'psid', + reply_ref = 'psrid', + comment_placeholder = 'Write Your Solution', + comment_post_op = 'submit', + comment_edit_op = 'edit_solution', + comment_post_text = 'Share', + reply_post_op = 'reply', + reply_edit_op = 'edit_reply', + comment_delete_op = 'delete_solution', + reply_delete_op = 'delete_reply', + comment_post_perm = perm.PERM_CREATE_PROBLEM_SOLUTION, + comment_edit_perm = perm.PERM_NEVER, + comment_edit_self_perm = perm.PERM_EDIT_PROBLEM_SOLUTION_SELF, + comment_delete_perm = perm.PERM_DELETE_PROBLEM_SOLUTION, + comment_delete_self_perm = perm.PERM_DELETE_PROBLEM_SOLUTION_SELF, + reply_post_perm = perm.PERM_REPLY_PROBLEM_SOLUTION, + reply_edit_perm = perm.PERM_NEVER, + reply_edit_self_perm = perm.PERM_EDIT_PROBLEM_SOLUTION_REPLY_SELF, + reply_delete_perm = perm.PERM_DELETE_PROBLEM_SOLUTION_REPLY, + reply_delete_self_perm = perm.PERM_DELETE_PROBLEM_SOLUTION_REPLY_SELF + ) }} + {% if not sid %} + {{ paginator.render(page, pcount) }} + {% endif %} + {% if drcount == 0 %} + {{ nothing.render('No solutions so far...') }} + {% endif %} +
    +
    + {% if sid %} + + {% endif %} +
    +
    + {% set owner_udoc = udict[pdoc.owner] %} + {% include "partials/problem_sidebar.html" %} +
    +
    +{% endblock %} diff --git a/packages/ui-default/templates/problem_statistics.html b/packages/ui-default/templates/problem_statistics.html index cdac061e8d..d15ba3de1f 100644 --- a/packages/ui-default/templates/problem_statistics.html +++ b/packages/ui-default/templates/problem_statistics.html @@ -1,96 +1,96 @@ -{% import "components/user.html" as user with context %} -{% import "components/problem.html" as problem with context %} -{% import "components/nothing.html" as nothing with context %} -{% extends "layout/basic.html" %} -{% block content %} -{{ set(UiContext, 'pdoc', pdoc) }} -
    -
    -
    -
    -

    {{ _('Statistics') }}

    -
    -
    -
    -
    -
    -
    -
    -
    -

    {{ _('Submission Statistics') }}

    -
    -
    - {{ _('Show') }}: - - - - -
    -
    -
    -
    - {% if not rsdocs|length %} - {{ nothing.render('Oh, there is no submission!') }} - {% else %} - - - - - - - - - - - - - - - - - - - - - - - {%- for rsdoc in rsdocs -%} - - - - - - - - - - {%- endfor -%} - -
    {{ _('Status') }}{{ _('Submit By') }}{{ _('Time') }}{{ _('Memory') }}{{ _('Language') }}{{ _('Code') }}{{ _('Submit At') }}
    -
    - - AC -
    -
    {{ user.render_inline(udict[rsdoc['uid']], badge=false) }}{% if rsdoc['time'] %}{% if [STATUS.STATUS_TIME_LIMIT_EXCEEDED, STATUS.STATUS_MEMORY_LIMIT_EXCEEDED, STATUS.STATUS_OUTPUT_LIMIT_EXCEEDED].includes(rsdoc['status']) %}≥{% endif %}{{ rsdoc.time|round|int }}ms{% else %}-{% endif %}{% if rsdoc['memory'] %}{% if [STATUS.STATUS_TIME_LIMIT_EXCEEDED, STATUS.STATUS_MEMORY_LIMIT_EXCEEDED, STATUS.STATUS_OUTPUT_LIMIT_EXCEEDED].includes(rsdoc['status']) %}≥{% endif %}{{ size(rsdoc.memory, 1024) }}{% else %}-{% endif %}{{ model.setting.langs[rsdoc['lang']].display }}{{ size(rsdoc.length) }}{{ datetimeSpan(rsdoc['_id'], false)|safe }}
    - {{ paginator.render(page, pcount, add_qs=('direction=' + direction + ('&sort=' + sort if sort else ''))) }} - {% endif %} -
    -
    -
    -
    - {% include "partials/problem_sidebar.html" %} -
    -
    - -{% endblock %} +{% import "components/user.html" as user with context %} +{% import "components/problem.html" as problem with context %} +{% import "components/nothing.html" as nothing with context %} +{% extends "layout/basic.html" %} +{% block content %} +{{ set(UiContext, 'pdoc', pdoc) }} +
    +
    +
    +
    +

    {{ _('Statistics') }}

    +
    +
    +
    +
    +
    +
    +
    +
    +

    {{ _('Submission Statistics') }}

    +
    +
    + {{ _('Show') }}: + + + + +
    +
    +
    +
    + {% if not rsdocs|length %} + {{ nothing.render('Oh, there is no submission!') }} + {% else %} + + + + + + + + + + + + + + + + + + + + + + + {%- for rsdoc in rsdocs -%} + + + + + + + + + + {%- endfor -%} + +
    {{ _('Status') }}{{ _('Submit By') }}{{ _('Time') }}{{ _('Memory') }}{{ _('Language') }}{{ _('Code') }}{{ _('Submit At') }}
    +
    + + AC +
    +
    {{ user.render_inline(udict[rsdoc['uid']], badge=false) }}{% if rsdoc['time'] %}{% if [STATUS.STATUS_TIME_LIMIT_EXCEEDED, STATUS.STATUS_MEMORY_LIMIT_EXCEEDED, STATUS.STATUS_OUTPUT_LIMIT_EXCEEDED].includes(rsdoc['status']) %}≥{% endif %}{{ rsdoc.time|round|int }}ms{% else %}-{% endif %}{% if rsdoc['memory'] %}{% if [STATUS.STATUS_TIME_LIMIT_EXCEEDED, STATUS.STATUS_MEMORY_LIMIT_EXCEEDED, STATUS.STATUS_OUTPUT_LIMIT_EXCEEDED].includes(rsdoc['status']) %}≥{% endif %}{{ size(rsdoc.memory, 1024) }}{% else %}-{% endif %}{{ model.setting.langs[rsdoc['lang']].display }}{{ size(rsdoc.length) }}{{ datetimeSpan(rsdoc['_id'], false)|safe }}
    + {{ paginator.render(page, pcount, add_qs=('direction=' + direction + ('&sort=' + sort if sort else ''))) }} + {% endif %} +
    +
    +
    +
    + {% include "partials/problem_sidebar.html" %} +
    +
    + +{% endblock %} diff --git a/packages/ui-default/templates/problem_submit.html b/packages/ui-default/templates/problem_submit.html index 3b94c8cf8f..2da9691d9e 100644 --- a/packages/ui-default/templates/problem_submit.html +++ b/packages/ui-default/templates/problem_submit.html @@ -1,40 +1,40 @@ -{% extends "layout/basic.html" %} -{% block content %} -{{ set(UiContext, 'pdoc', pdoc) }} -
    -
    -
    -
    -

    {{ _('Submit to Judge') }}

    -
    -
    -
    -
    - {{ form.form_select({ - label:'Code language', - options:langRange, - name:'lang', - value:handler.user.codeLang - }) }} -
    -
    - {{ form.form_textarea({label:'Code', columns:12, name:'code', extra_class:'monospace', autofocus:true, nospellcheck:true}) }} -
    -
    -

    {{ _('Or upload a file:') }}

    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    - {% include "partials/problem_sidebar.html" %} -
    -
    - -{% endblock %} +{% extends "layout/basic.html" %} +{% block content %} +{{ set(UiContext, 'pdoc', pdoc) }} +
    +
    +
    +
    +

    {{ _('Submit to Judge') }}

    +
    +
    +
    +
    + {{ form.form_select({ + label:'Code language', + options:langRange, + name:'lang', + value:handler.user.codeLang + }) }} +
    +
    + {{ form.form_textarea({label:'Code', columns:12, name:'code', extra_class:'monospace', autofocus:true, nospellcheck:true}) }} +
    +
    +

    {{ _('Or upload a file:') }}

    +
    +
    +
    +
    + +
    +
    +
    +
    +
    +
    + {% include "partials/problem_sidebar.html" %} +
    +
    + +{% endblock %} diff --git a/packages/ui-default/templates/record_detail_summary.html b/packages/ui-default/templates/record_detail_summary.html index e9c4fb29d1..98e216ea0d 100644 --- a/packages/ui-default/templates/record_detail_summary.html +++ b/packages/ui-default/templates/record_detail_summary.html @@ -1,19 +1,19 @@ -
    - {% if typeof(rdoc['score']) == 'number' %} -
    {{ _('Score') }}
    -
    {{ rdoc['score'] }}
    - {% endif %} - {% set _ge = rdoc['status'] == STATUS.STATUS_TIME_LIMIT_EXCEEDED or rdoc['status'] == STATUS.STATUS_MEMORY_LIMIT_EXCEEDED or rdoc['status'] == STATUS.STATUS_OUTPUT_LIMIT_EXCEEDED %} - {% if rdoc['time'] %} -
    {{ _('Total Time') }}
    -
    {% if _ge %}≥{% endif %}{{ rdoc.time|round(0) }}ms
    - {% endif %} - {% if rdoc.testCases.length %} -
    {{ _('Peak Time') }}
    -
    {% if _ge %}≥{% endif %}{{ (rdoc.testCases|sort(true, true, "time")|first)["time"]|round(0) }}ms
    - {% endif %} - {% if rdoc['memory'] %} -
    {{ _('Peak Memory') }}
    -
    {% if _ge %}≥{% endif %}{{ size(rdoc.memory, 1024) }}
    - {% endif %} -
    +
    + {% if typeof(rdoc['score']) == 'number' %} +
    {{ _('Score') }}
    +
    {{ rdoc['score'] }}
    + {% endif %} + {% set _ge = rdoc['status'] == STATUS.STATUS_TIME_LIMIT_EXCEEDED or rdoc['status'] == STATUS.STATUS_MEMORY_LIMIT_EXCEEDED or rdoc['status'] == STATUS.STATUS_OUTPUT_LIMIT_EXCEEDED %} + {% if rdoc['time'] %} +
    {{ _('Total Time') }}
    +
    {% if _ge %}≥{% endif %}{{ rdoc.time|round(0) }}ms
    + {% endif %} + {% if rdoc.testCases.length %} +
    {{ _('Peak Time') }}
    +
    {% if _ge %}≥{% endif %}{{ (rdoc.testCases|sort(true, true, "time")|first)["time"]|round(0) }}ms
    + {% endif %} + {% if rdoc['memory'] %} +
    {{ _('Peak Memory') }}
    +
    {% if _ge %}≥{% endif %}{{ size(rdoc.memory, 1024) }}
    + {% endif %} +
    diff --git a/packages/ui-default/templates/record_main_tr.html b/packages/ui-default/templates/record_main_tr.html index 18703e80f7..647b6bfc36 100644 --- a/packages/ui-default/templates/record_main_tr.html +++ b/packages/ui-default/templates/record_main_tr.html @@ -1,44 +1,44 @@ -{% import "components/record.html" as record with context %} -{% import "components/user.html" as user with context %} -{% import "components/problem.html" as problem with context %} -{% import "components/user.html" as user with context %} - - {% set _isPretest = rdoc.contest and rdoc.contest.toString() == '000000000000000000000000' %} - {{ record.render_status_td(rdoc, allDomain = allDomain) }} - - {% if handler.user.hasPerm(perm.PERM_REJUDGE) and not rdoc.files.hack and not _isPretest %} -
    - - | -
    - {% endif %} - {% if pdoc and rdoc.contest %} - {% if not rdoc.contest.attend and (handler.user.own(tdoc) or handler.user.hasPerm(perm.PERM_VIEW_CONTEST_HIDDEN_SCOREBOARD)) %} - {{ problem.render_problem_title(pdoc, show_tags=false, show_invisible_flag=false) }} - {% else %} - {{ problem.render_problem_title(pdoc, tdoc=tdoc, show_tags=false, show_invisible_flag=false) }} - {% endif %} - {% elif pdoc and (not pdoc.hidden or handler.user.hasPerm(perm.PERM_VIEW_PROBLEM_HIDDEN) or handler.user.own(pdoc)) %} - {{ problem.render_problem_title(pdoc, show_tags=false) }} - {% else %} - * - {% endif %} - {% if rdoc.files.hack %}({{ _('Hack') }}){% endif %} - {% if _isPretest %}({{ _('Pretest') }}){% endif %} - - - - {{ user.render_inline(udoc,badge=false,avatar=false) }} - - - {% if [STATUS.STATUS_TIME_LIMIT_EXCEEDED, STATUS.STATUS_MEMORY_LIMIT_EXCEEDED, STATUS.STATUS_OUTPUT_LIMIT_EXCEEDED].includes(rdoc['status']) %}≥{% endif %}{{ rdoc.time|round|int }}ms - {% if [STATUS.STATUS_TIME_LIMIT_EXCEEDED, STATUS.STATUS_MEMORY_LIMIT_EXCEEDED, STATUS.STATUS_OUTPUT_LIMIT_EXCEEDED].includes(rdoc['status']) %}≥{% endif %}{{ size(rdoc.memory, 1024) }} - {{ model.setting.langs[rdoc['lang']].display }} - {{ datetimeSpan(rdoc['_id'])|safe }} - +{% import "components/record.html" as record with context %} +{% import "components/user.html" as user with context %} +{% import "components/problem.html" as problem with context %} +{% import "components/user.html" as user with context %} + + {% set _isPretest = rdoc.contest and rdoc.contest.toString() == '000000000000000000000000' %} + {{ record.render_status_td(rdoc, allDomain = allDomain) }} + + {% if handler.user.hasPerm(perm.PERM_REJUDGE) and not rdoc.files.hack and not _isPretest %} +
    + + | +
    + {% endif %} + {% if pdoc and rdoc.contest %} + {% if not rdoc.contest.attend and (handler.user.own(tdoc) or handler.user.hasPerm(perm.PERM_VIEW_CONTEST_HIDDEN_SCOREBOARD)) %} + {{ problem.render_problem_title(pdoc, show_tags=false, show_invisible_flag=false) }} + {% else %} + {{ problem.render_problem_title(pdoc, tdoc=tdoc, show_tags=false, show_invisible_flag=false) }} + {% endif %} + {% elif pdoc and (not pdoc.hidden or handler.user.hasPerm(perm.PERM_VIEW_PROBLEM_HIDDEN) or handler.user.own(pdoc)) %} + {{ problem.render_problem_title(pdoc, show_tags=false) }} + {% else %} + * + {% endif %} + {% if rdoc.files.hack %}({{ _('Hack') }}){% endif %} + {% if _isPretest %}({{ _('Pretest') }}){% endif %} + + + + {{ user.render_inline(udoc,badge=false,avatar=false) }} + + + {% if [STATUS.STATUS_TIME_LIMIT_EXCEEDED, STATUS.STATUS_MEMORY_LIMIT_EXCEEDED, STATUS.STATUS_OUTPUT_LIMIT_EXCEEDED].includes(rdoc['status']) %}≥{% endif %}{{ rdoc.time|round|int }}ms + {% if [STATUS.STATUS_TIME_LIMIT_EXCEEDED, STATUS.STATUS_MEMORY_LIMIT_EXCEEDED, STATUS.STATUS_OUTPUT_LIMIT_EXCEEDED].includes(rdoc['status']) %}≥{% endif %}{{ size(rdoc.memory, 1024) }} + {{ model.setting.langs[rdoc['lang']].display }} + {{ datetimeSpan(rdoc['_id'])|safe }} + diff --git a/packages/ui-default/templates/status.html b/packages/ui-default/templates/status.html index 56b4bda1ef..df337aadda 100644 --- a/packages/ui-default/templates/status.html +++ b/packages/ui-default/templates/status.html @@ -1,75 +1,75 @@ -{% extends "layout/basic.html" %} -{% block content %} -
    -
    -
    -
    -
      -
    • -

      {{ _('Servers') }}

      -
      - - - - - - - - - - - - - - - - - - - - - {%- for doc in stats -%} - - - - - - - - - {%- endfor -%} - -
      {{ _('ID') }}{{ _('Current Status') }}{{ _('OS Info') }}{{ _('CPU Info') }}{{ _('Memory Info') }}{{ _('Handled requests') }}
      {{ doc._id.toHexString()|truncate(8,True,'') }}{% if doc.isOnline %}{{ doc.status }}{% else %}{{ datetimeSpan(doc.updateAt)|safe }}{% endif %}{{ doc.osinfo.distro }} {{ doc.osinfo.release }} {{ doc.osinfo.codename }} {{ doc.osinfo.arch }}{{ doc.cpu.manufacturer }} {{ doc.cpu.brand }}@{{ doc.cpu.speed }}GHz{{ size(doc.memory.used) }}/{{ size(doc.memory.total) }}{{ doc.reqCount }}
      -
      -
    • - {% if compilers|length %} -
    • -

      {{ _('Compiler Versions') }}

      -
      -
      - {% for line in compilers %} -

      {{ line.key|join(', ') }}

      -
      {{ line.message }}
      - {% endfor %} -
      -
      -
    • - {% endif %} -
    • -

      {{ _('Compile Commands') }}

      -
      -
      -
        - {%- for k, v in languages -%} -
      • {{ k }}
        {{ v }}
      • - {%- endfor -%} -
      -
      -
      -
    • -
    -
    -
    -
    -
    +{% extends "layout/basic.html" %} +{% block content %} +
    +
    +
    +
    +
      +
    • +

      {{ _('Servers') }}

      +
      + + + + + + + + + + + + + + + + + + + + + {%- for doc in stats -%} + + + + + + + + + {%- endfor -%} + +
      {{ _('ID') }}{{ _('Current Status') }}{{ _('OS Info') }}{{ _('CPU Info') }}{{ _('Memory Info') }}{{ _('Handled requests') }}
      {{ doc._id.toHexString()|truncate(8,True,'') }}{% if doc.isOnline %}{{ doc.status }}{% else %}{{ datetimeSpan(doc.updateAt)|safe }}{% endif %}{{ doc.osinfo.distro }} {{ doc.osinfo.release }} {{ doc.osinfo.codename }} {{ doc.osinfo.arch }}{{ doc.cpu.manufacturer }} {{ doc.cpu.brand }}@{{ doc.cpu.speed }}GHz{{ size(doc.memory.used) }}/{{ size(doc.memory.total) }}{{ doc.reqCount }}
      +
      +
    • + {% if compilers|length %} +
    • +

      {{ _('Compiler Versions') }}

      +
      +
      + {% for line in compilers %} +

      {{ line.key|join(', ') }}

      +
      {{ line.message }}
      + {% endfor %} +
      +
      +
    • + {% endif %} +
    • +

      {{ _('Compile Commands') }}

      +
      +
      +
        + {%- for k, v in languages -%} +
      • {{ k }}
        {{ v }}
      • + {%- endfor -%} +
      +
      +
      +
    • +
    +
    +
    +
    +
    {% endblock %} \ No newline at end of file diff --git a/packages/ui-default/templates/stu_class_list.html b/packages/ui-default/templates/stu_class_list.html index 546a3bca9a..391067af26 100644 --- a/packages/ui-default/templates/stu_class_list.html +++ b/packages/ui-default/templates/stu_class_list.html @@ -1,112 +1,112 @@ -{% extends "layout/basic.html" %} -{% block content %} -
    -
    -
    -
    -

    班级

    - {% if handler.user.hasPriv(PRIV.PRIV_ALL) %} -
    -
    - - -
    -
    - {% endif %} -
    -
    -

    总计{{ clsList.length }}个班级 (刷新时间:{{ datetimeSpan(cacheTime) | safe }})

    - {#
    排序规则:总计AC数 -> 班级用户数 -> 总计提交数 -> 班级名称字典序
    #} -
    -
    -
    -
    -
    - {% for clsItem in starStudents %} -
    -
    -
    -

    明星班级:{{ clsItem._id }}

    -
    -
    - - - - - - - - - {# - #} - - - - - - {%- for udoc in clsItem.students -%} - - - - {# - #} - - - - {%- endfor -%} - -
    序号用户名总计AC数总计提交数RP个人简介
    {{ loop.index }}{{ user.render_inline(udoc,classname=false,modbadge=false) }}{{ udoc.nAccept }}{{ udoc.nSubmit }}{{ udoc.rp | default(1500,true) | round(0) }}{{ udoc.bio|default('')|truncate(64, true)|markdownInline|safe }}
    -
    -
    -
    - {% endfor %} -
    -
    -
    -
    -
    -

    班级列表

    -
    -
    -
    - - - - - - - - - - - - - - - - - - {%- for item in clsList -%} - - - - - - - - - - - {%- endfor -%} - -
    序号班级用户数量总计AC数总计提交数平均RP活跃值排名权重
    {{ loop.index }} - - {{ item._id }} - - {{ item.stuNum }}{{ item.nAccept }}{{ item.nSubmit }}{{ item.rpAvg | round(0) }}{{ item.activity | round(0) }}{{ item.weight | round(0) }}
    -
    -
    -
    -
    -
    +{% extends "layout/basic.html" %} +{% block content %} +
    +
    +
    +
    +

    班级

    + {% if handler.user.hasPriv(PRIV.PRIV_ALL) %} +
    +
    + + +
    +
    + {% endif %} +
    +
    +

    总计{{ clsList.length }}个班级 (刷新时间:{{ datetimeSpan(cacheTime) | safe }})

    + {#
    排序规则:总计AC数 -> 班级用户数 -> 总计提交数 -> 班级名称字典序
    #} +
    +
    +
    +
    +
    + {% for clsItem in starStudents %} +
    +
    +
    +

    明星班级:{{ clsItem._id }}

    +
    +
    + + + + + + + + + {# + #} + + + + + + {%- for udoc in clsItem.students -%} + + + + {# + #} + + + + {%- endfor -%} + +
    序号用户名总计AC数总计提交数RP个人简介
    {{ loop.index }}{{ user.render_inline(udoc,classname=false,modbadge=false) }}{{ udoc.nAccept }}{{ udoc.nSubmit }}{{ udoc.rp | default(1500,true) | round(0) }}{{ udoc.bio|default('')|truncate(64, true)|markdownInline|safe }}
    +
    +
    +
    + {% endfor %} +
    +
    +
    +
    +
    +

    班级列表

    +
    +
    +
    + + + + + + + + + + + + + + + + + + {%- for item in clsList -%} + + + + + + + + + + + {%- endfor -%} + +
    序号班级用户数量总计AC数总计提交数平均RP活跃值排名权重
    {{ loop.index }} + + {{ item._id }} + + {{ item.stuNum }}{{ item.nAccept }}{{ item.nSubmit }}{{ item.rpAvg | round(0) }}{{ item.activity | round(0) }}{{ item.weight | round(0) }}
    +
    +
    +
    +
    +
    {% endblock %} \ No newline at end of file diff --git a/packages/ui-default/templates/stu_class_students.html b/packages/ui-default/templates/stu_class_students.html index 6bd7b9dea3..e34414c59c 100644 --- a/packages/ui-default/templates/stu_class_students.html +++ b/packages/ui-default/templates/stu_class_students.html @@ -1,73 +1,73 @@ -{% extends "layout/basic.html" %} -{% block content %} -
    -
    -
    -
    -

    班级:{{ className }}

    -
    -
    - 该班级下有{{ udocs.length }}个用户 -
    -
    -
    -
    -
    -
    -
    -
    -
    - {% if not udocs.length %} - {{ nothing.render('该班级还没有人加入哦!') }} - {% else %} - - - - - - - - - - - - - - - - - - - - - - - - - {%- for udoc in udocs -%} - - - - - - - - - - - {%- endfor -%} - -
    {{ _('Rank') }}{{ _('Stu_ID') }}{{ _('Username') }}{{ _('Gender') }}{{ _('RP') }}AC数量{{ _('last active at') }}{{ _('Bio') }}
    {{ loop.index }}{{ udoc['stuid'] }}{{ user.render_inline(udoc,classname=false) }}{{ model.builtin.USER_GENDER_ICONS[udoc.gender] }}{{ udoc.rp|default(1500)|round(0) }}{{ udoc['nAccept'] }} - {% if sdocs[udoc['_id']] %} - {{ datetimeSpan(sdocs[udoc['_id']])|safe }} - {% else %} - {{ datetimeSpan(udoc['loginat'])|safe }} - {% endif %} - {{ udoc.bio|default('')|truncate(64, true)|markdownInline|safe }}
    - {% endif %} -
    -
    -
    -
    -
    +{% extends "layout/basic.html" %} +{% block content %} +
    +
    +
    +
    +

    班级:{{ className }}

    +
    +
    + 该班级下有{{ udocs.length }}个用户 +
    +
    +
    +
    +
    +
    +
    +
    +
    + {% if not udocs.length %} + {{ nothing.render('该班级还没有人加入哦!') }} + {% else %} + + + + + + + + + + + + + + + + + + + + + + + + + {%- for udoc in udocs -%} + + + + + + + + + + + {%- endfor -%} + +
    {{ _('Rank') }}{{ _('Stu_ID') }}{{ _('Username') }}{{ _('Gender') }}{{ _('RP') }}AC数量{{ _('last active at') }}{{ _('Bio') }}
    {{ loop.index }}{{ udoc['stuid'] }}{{ user.render_inline(udoc,classname=false) }}{{ model.builtin.USER_GENDER_ICONS[udoc.gender] }}{{ udoc.rp|default(1500)|round(0) }}{{ udoc['nAccept'] }} + {% if sdocs[udoc['_id']] %} + {{ datetimeSpan(sdocs[udoc['_id']])|safe }} + {% else %} + {{ datetimeSpan(udoc['loginat'])|safe }} + {% endif %} + {{ udoc.bio|default('')|truncate(64, true)|markdownInline|safe }}
    + {% endif %} +
    +
    +
    +
    +
    {% endblock %} \ No newline at end of file diff --git a/packages/ui-default/templates/training_edit.html b/packages/ui-default/templates/training_edit.html index efeb84b452..690644ebcd 100644 --- a/packages/ui-default/templates/training_edit.html +++ b/packages/ui-default/templates/training_edit.html @@ -1,68 +1,68 @@ -{% extends "layout/basic.html" %} -{% block content %} -
    -
    -
    -
    -
    -
    -
    - -
    -
    - -
    -
    -
    - -
    -
    - -
    -
    - -
    -
    - {% if page_name == 'training_edit' %} - - {% if handler.user.own(tdoc) or handler.user.hasPerm(perm.PERM_EDIT_TRAINING) %} - - {% endif %} - {% else %} - - {% endif %} - -
    -
    -
    -
    -
    -
    - {% include 'components/md_hint.html' %} -
    -
    -{% endblock %} +{% extends "layout/basic.html" %} +{% block content %} +
    +
    +
    +
    +
    +
    +
    + +
    +
    + +
    +
    +
    + +
    +
    + +
    +
    + +
    +
    + {% if page_name == 'training_edit' %} + + {% if handler.user.own(tdoc) or handler.user.hasPerm(perm.PERM_EDIT_TRAINING) %} + + {% endif %} + {% else %} + + {% endif %} + +
    +
    +
    +
    +
    +
    + {% include 'components/md_hint.html' %} +
    +
    +{% endblock %} diff --git a/packages/ui-default/templates/training_files.html b/packages/ui-default/templates/training_files.html index 2d181c33c3..04fb7b639a 100644 --- a/packages/ui-default/templates/training_files.html +++ b/packages/ui-default/templates/training_files.html @@ -1,64 +1,64 @@ -{% extends "layout/basic.html" %} -{% block content %} -{{ set(UiContext, 'tdoc', tdoc) }} -
    -
    -
    -
    -

    {{ _('Files') }}

    -
    - -
    -
    - {{ noscript_note.render() }} - {% include "partials/files.html" %} -
    - -
    -
    -
    -
    -
    -
    - -
    -
    -
    - {% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %} -
    {{ _('Status') }}
    {% if tsdoc['enroll'] %}{{ _('Completed' if tsdoc['done'] else 'In Progress') }}{% else %}{{ _('Not Enrolled') }}{% endif %}
    - {% endif %} -
    {{ _('Enrollees') }}
    {{ tdoc.attend|default(0) }}
    -
    {{ _('Created By') }}
    -
    {{ user.render_inline(udoc, badge=false) }}
    -
    -
    -
    -
    -
    -{% endblock %} +{% extends "layout/basic.html" %} +{% block content %} +{{ set(UiContext, 'tdoc', tdoc) }} +
    +
    +
    +
    +

    {{ _('Files') }}

    +
    + +
    +
    + {{ noscript_note.render() }} + {% include "partials/files.html" %} +
    + +
    +
    +
    +
    +
    +
    + +
    +
    +
    + {% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %} +
    {{ _('Status') }}
    {% if tsdoc['enroll'] %}{{ _('Completed' if tsdoc['done'] else 'In Progress') }}{% else %}{{ _('Not Enrolled') }}{% endif %}
    + {% endif %} +
    {{ _('Enrollees') }}
    {{ tdoc.attend|default(0) }}
    +
    {{ _('Created By') }}
    +
    {{ user.render_inline(udoc, badge=false) }}
    +
    +
    +
    +
    +
    +{% endblock %} diff --git a/packages/ui-default/templates/user_changemail_mail.html b/packages/ui-default/templates/user_changemail_mail.html index 6a0c934835..f80d5318ad 100644 --- a/packages/ui-default/templates/user_changemail_mail.html +++ b/packages/ui-default/templates/user_changemail_mail.html @@ -1,6 +1,6 @@ -{% extends "layout/mail.html" %} -{% block title %}{{ _('Change Email') }}{% endblock %} -{% block content %} -

    {{ _('Hello, {0}! You can click following link to active your new email of your {1} account:').format(uname, handler.domain.ui.name|default(model.system.get('server.name'))) }}

    -

    {{ url_prefix }}{{ path }}

    -{% endblock %} +{% extends "layout/mail.html" %} +{% block title %}{{ _('Change Email') }}{% endblock %} +{% block content %} +

    {{ _('Hello, {0}! You can click following link to active your new email of your {1} account:').format(uname, handler.domain.ui.name|default(model.system.get('server.name'))) }}

    +

    {{ url_prefix }}{{ path }}

    +{% endblock %} diff --git a/packages/ui-default/templates/user_changemail_mail_sent.html b/packages/ui-default/templates/user_changemail_mail_sent.html index 6e95e4a155..2475cf394e 100644 --- a/packages/ui-default/templates/user_changemail_mail_sent.html +++ b/packages/ui-default/templates/user_changemail_mail_sent.html @@ -1,9 +1,9 @@ -{% extends "layout/immersive.html" %} -{% block content %} -
    -

    {{ _('New Email') }}

    -
    - {{ _('Confirmation mail has been sent to your new email.') }} -
    -
    -{% endblock %} +{% extends "layout/immersive.html" %} +{% block content %} +
    +

    {{ _('New Email') }}

    +
    + {{ _('Confirmation mail has been sent to your new email.') }} +
    +
    +{% endblock %} diff --git a/packages/ui-default/templates/user_delete_pending.html b/packages/ui-default/templates/user_delete_pending.html index 50e0c5d112..c76e9385b6 100644 --- a/packages/ui-default/templates/user_delete_pending.html +++ b/packages/ui-default/templates/user_delete_pending.html @@ -1,10 +1,10 @@ -{% extends "layout/immersive.html" %} -{% block content %} -
    -

    {{ _('Done') }}

    -
    - {{ _('Your account will be deleted in 7 days.') }} - {{ _('You can cancel this at user setting page.') }} -
    -
    -{% endblock %} +{% extends "layout/immersive.html" %} +{% block content %} +
    +

    {{ _('Done') }}

    +
    + {{ _('Your account will be deleted in 7 days.') }} + {{ _('You can cancel this at user setting page.') }} +
    +
    +{% endblock %} diff --git a/packages/ui-default/templates/user_logout.html b/packages/ui-default/templates/user_logout.html index e52c593b43..26eb756e2b 100644 --- a/packages/ui-default/templates/user_logout.html +++ b/packages/ui-default/templates/user_logout.html @@ -1,13 +1,13 @@ -{% extends "layout/immersive.html" %} -{% block content %} -
    -
    -

    {{ _('Logout') }}

    -
    -
    - -
    -
    -
    -
    -{% endblock %} +{% extends "layout/immersive.html" %} +{% block content %} +
    +
    +

    {{ _('Logout') }}

    +
    +
    + +
    +
    +
    +
    +{% endblock %} diff --git a/packages/ui-default/templates/user_lostpass.html b/packages/ui-default/templates/user_lostpass.html index 24b4ce75e1..c5bb2bfd7b 100644 --- a/packages/ui-default/templates/user_lostpass.html +++ b/packages/ui-default/templates/user_lostpass.html @@ -1,27 +1,27 @@ -{% extends "layout/immersive.html" %} -{% block content %} -
    -
    -

    {{ _('Lost Password') }}

    - {% if not model.system.get('smtp.user') %} -
    - {{ _('Relax and try to remember your password.') }} -
    - {% else %} -
    -
    - -
    -
    -
    - -
    -
    -
    - {% endif %} -
    -
    -{% endblock %} +{% extends "layout/immersive.html" %} +{% block content %} +
    +
    +

    {{ _('Lost Password') }}

    + {% if not model.system.get('smtp.user') %} +
    + {{ _('Relax and try to remember your password.') }} +
    + {% else %} +
    +
    + +
    +
    +
    + +
    +
    +
    + {% endif %} +
    +
    +{% endblock %} diff --git a/packages/ui-default/templates/user_lostpass_mail.html b/packages/ui-default/templates/user_lostpass_mail.html index 48ae4f0443..0a9ab14a68 100644 --- a/packages/ui-default/templates/user_lostpass_mail.html +++ b/packages/ui-default/templates/user_lostpass_mail.html @@ -1,6 +1,6 @@ -{% extends "layout/mail.html" %} -{% block title %}{{ _('Lost Password') }}{% endblock %} -{% block content %} -

    {{ _('Hello, {0}! You can click following link to reset the password of your {1} account:').format(uname, handler.domain.ui.name|default(model.system.get('server.name'))) }}

    -

    {{ url_prefix }}{{ url }}

    -{% endblock %} +{% extends "layout/mail.html" %} +{% block title %}{{ _('Lost Password') }}{% endblock %} +{% block content %} +

    {{ _('Hello, {0}! You can click following link to reset the password of your {1} account:').format(uname, handler.domain.ui.name|default(model.system.get('server.name'))) }}

    +

    {{ url_prefix }}{{ url }}

    +{% endblock %} diff --git a/packages/ui-default/templates/user_lostpass_mail_sent.html b/packages/ui-default/templates/user_lostpass_mail_sent.html index 4ec77f0d5a..bbeeb936e1 100644 --- a/packages/ui-default/templates/user_lostpass_mail_sent.html +++ b/packages/ui-default/templates/user_lostpass_mail_sent.html @@ -1,9 +1,9 @@ -{% extends "layout/immersive.html" %} -{% block content %} -
    -

    {{ _('Lost Password') }}

    -
    - {{ _('Password reset mail has been sent to your email.') }} -
    -
    -{% endblock %} +{% extends "layout/immersive.html" %} +{% block content %} +
    +

    {{ _('Lost Password') }}

    +
    + {{ _('Password reset mail has been sent to your email.') }} +
    +
    +{% endblock %} diff --git a/packages/ui-default/templates/user_lostpass_with_code.html b/packages/ui-default/templates/user_lostpass_with_code.html index 32182b7af8..9fb3a09402 100644 --- a/packages/ui-default/templates/user_lostpass_with_code.html +++ b/packages/ui-default/templates/user_lostpass_with_code.html @@ -1,29 +1,29 @@ -{% extends "layout/immersive.html" %} -{% block content %} -
    -

    {{ _('Lost Password') }}

    -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    -
    -{% endblock %} +{% extends "layout/immersive.html" %} +{% block content %} +
    +

    {{ _('Lost Password') }}

    +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    +
    +{% endblock %} diff --git a/packages/ui-default/templates/user_register.html b/packages/ui-default/templates/user_register.html index f25a9c52c4..b1c31d5c91 100644 --- a/packages/ui-default/templates/user_register.html +++ b/packages/ui-default/templates/user_register.html @@ -1,24 +1,24 @@ -{% extends "layout/immersive.html" %} -{% block content %} -
    -
    -

    {{ _('Sign Up') }}

    -

    外校同学请加入QQ群联系oj管理员说明用意,由管理员后台注册

    -
    -
    -
    - -
    -
    -
    - {{ captcha|safe }} - -
    -
    -
    -
    -
    -{% endblock %} +{% extends "layout/immersive.html" %} +{% block content %} +
    +
    +

    {{ _('Sign Up') }}

    +

    外校同学请加入QQ群联系oj管理员说明用意,由管理员后台注册

    +
    +
    +
    + +
    +
    +
    + {{ captcha|safe }} + +
    +
    +
    +
    +
    +{% endblock %} diff --git a/packages/ui-default/templates/user_register_mail.html b/packages/ui-default/templates/user_register_mail.html index 766c393686..c5052f1310 100644 --- a/packages/ui-default/templates/user_register_mail.html +++ b/packages/ui-default/templates/user_register_mail.html @@ -1,6 +1,6 @@ -{% extends "layout/mail.html" %} -{% block title %}{{ _('Sign Up') }}{% endblock %} -{% block content %} -

    {{ _('Hello! You can click following link to sign up your {0} account:').format(handler.domain.ui.name|default(model.system.get('server.name'))) }}

    -

    {{ url_prefix|safe }}{{ path|safe }}

    -{% endblock %} +{% extends "layout/mail.html" %} +{% block title %}{{ _('Sign Up') }}{% endblock %} +{% block content %} +

    {{ _('Hello! You can click following link to sign up your {0} account:').format(handler.domain.ui.name|default(model.system.get('server.name'))) }}

    +

    {{ url_prefix|safe }}{{ path|safe }}

    +{% endblock %} diff --git a/packages/ui-default/templates/user_register_mail_sent.html b/packages/ui-default/templates/user_register_mail_sent.html index f1bed300ae..1167c7c8f4 100644 --- a/packages/ui-default/templates/user_register_mail_sent.html +++ b/packages/ui-default/templates/user_register_mail_sent.html @@ -1,9 +1,9 @@ -{% extends "layout/immersive.html" %} -{% block content %} -
    -

    {{ _('Sign Up') }}

    -
    - {{ _('Sign up mail has been sent to your email.') }} -
    -
    -{% endblock %} +{% extends "layout/immersive.html" %} +{% block content %} +
    +

    {{ _('Sign Up') }}

    +
    + {{ _('Sign up mail has been sent to your email.') }} +
    +
    +{% endblock %} diff --git a/packages/ui-default/templates/user_sudo_redirect.html b/packages/ui-default/templates/user_sudo_redirect.html index 7a08ce69fe..71601b9ac0 100644 --- a/packages/ui-default/templates/user_sudo_redirect.html +++ b/packages/ui-default/templates/user_sudo_redirect.html @@ -1,18 +1,18 @@ -{% extends "layout/immersive.html" %} -{% block content %} -
    -
    -

    {{ _('Confirm Access') }}

    -
    - Redirecting, please wait... -
    -
    - {% for k, v in args %} - - {% endfor %} - -
    - -
    -
    -{% endblock %} +{% extends "layout/immersive.html" %} +{% block content %} +
    +
    +

    {{ _('Confirm Access') }}

    +
    + Redirecting, please wait... +
    +
    + {% for k, v in args %} + + {% endfor %} + +
    + +
    +
    +{% endblock %} diff --git a/packages/vjudge/src/proxy.ts b/packages/vjudge/src/proxy.ts index 938d0818b9..0dcc8332b6 100644 --- a/packages/vjudge/src/proxy.ts +++ b/packages/vjudge/src/proxy.ts @@ -1,6 +1,6 @@ -declare module 'superagent' { - interface Request { - proxy(url: string): this; - } -} -export default {}; +declare module 'superagent' { + interface Request { + proxy(url: string): this; + } +} +export default {}; diff --git a/test/entry.js b/test/entry.js index fd8b0530ee..475282d4fe 100644 --- a/test/entry.js +++ b/test/entry.js @@ -1,6 +1,6 @@ -process.env.CI = true; -const version = process.versions.node.split('.').map((i) => i.padStart(2, '0')); -version.pop(); -if (+version.join('.') < 18.08) throw new Error('Tests only available in NodeJS>=18.8'); -require('hydrooj/bin/hydrooj'); -require('./main'); +process.env.CI = true; +const version = process.versions.node.split('.').map((i) => i.padStart(2, '0')); +version.pop(); +if (+version.join('.') < 18.08) throw new Error('Tests only available in NodeJS>=18.8'); +require('hydrooj/bin/hydrooj'); +require('./main'); From 52bf4a7851c15c6c72cc0f3638f3356b399ab969 Mon Sep 17 00:00:00 2001 From: guke1024 <0124gj@gmail.com> Date: Thu, 12 Nov 2026 22:36:45 +0800 Subject: [PATCH 36/52] Fix legacy settings migration and add HGNU upgrade regression checks --- packages/hydrooj/src/model/setting.ts | 2 - .../hydrooj/src/script/hgnuRejudgeBatch.js | 2 +- packages/hydrooj/src/script/hgnuSubmitStd.js | 2 +- packages/hydrooj/src/settings.ts | 2 +- test/hgnu-regression.ts | 129 ++++++++++++++++++ 5 files changed, 132 insertions(+), 5 deletions(-) create mode 100644 test/hgnu-regression.ts diff --git a/packages/hydrooj/src/model/setting.ts b/packages/hydrooj/src/model/setting.ts index dba13591dd..4c6edef22c 100644 --- a/packages/hydrooj/src/model/setting.ts +++ b/packages/hydrooj/src/model/setting.ts @@ -47,8 +47,6 @@ export const SYSTEM_SETTINGS_BY_KEY: SettingDict = {}; export type SettingType = 'text' | 'yaml' | 'number' | 'float' | 'markdown' | 'password' | 'boolean' | 'textarea' | [string, string][] | Record | 'json'; -type Validator = (value: any) => boolean; - export const Setting = ( family: string, key: string, value: any = null, type: SettingType = 'text', name = '', desc = '', flag = 0, diff --git a/packages/hydrooj/src/script/hgnuRejudgeBatch.js b/packages/hydrooj/src/script/hgnuRejudgeBatch.js index 0877f40ae3..f10407e411 100644 --- a/packages/hydrooj/src/script/hgnuRejudgeBatch.js +++ b/packages/hydrooj/src/script/hgnuRejudgeBatch.js @@ -11,7 +11,7 @@ async function run(arg = {}, report = console.log) { const match = { domainId, status: 0 }; if (uid) match.uid = uid; const coll = db.collection('record'); - const total = await coll.count(match); + const total = await coll.countDocuments(match); const pids = await coll.aggregate([ { $match: match }, { $group: { _id: '$pid' } }, diff --git a/packages/hydrooj/src/script/hgnuSubmitStd.js b/packages/hydrooj/src/script/hgnuSubmitStd.js index d229b3552f..e6a4ba860f 100644 --- a/packages/hydrooj/src/script/hgnuSubmitStd.js +++ b/packages/hydrooj/src/script/hgnuSubmitStd.js @@ -17,7 +17,7 @@ const Schema = schemastery.default?.any ? schemastery.default : schemastery; const ProblemModel = require('../model/problem').default; const RecordModel = require('../model/record').default; const db = require('../service/db').default; -const { STATUS, STATUS_TEXTS } = require('@hydrooj/utils/lib/status'); +const { STATUS, STATUS_TEXTS } = require('@hydrooj/common'); const DOMAIN = 'system'; const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms)); diff --git a/packages/hydrooj/src/settings.ts b/packages/hydrooj/src/settings.ts index 7f6f170bf7..e994502967 100644 --- a/packages/hydrooj/src/settings.ts +++ b/packages/hydrooj/src/settings.ts @@ -103,7 +103,7 @@ export class SettingService extends Service { async _actualMigrate(schema: Schema) { const processNode = async (path: string[], node: Schema) => { for (const item of node.list || []) await processNode(path, item); // eslint-disable-line no-await-in-loop - for (const key in node.dict || {}) await processNode([...path, ...key], node.dict[key]); // eslint-disable-line no-await-in-loop + for (const key in node.dict || {}) await processNode([...path, key], node.dict[key]); // eslint-disable-line no-await-in-loop if (['string', 'number', 'boolean'].includes(node.type)) { const value = this.initialValues[path.join('.')]; const migrated = this.initialValues[`${path.join('.')}__migrated`]; diff --git a/test/hgnu-regression.ts b/test/hgnu-regression.ts new file mode 100644 index 0000000000..92977e9b3e --- /dev/null +++ b/test/hgnu-regression.ts @@ -0,0 +1,129 @@ +import assert from 'node:assert/strict'; +import { randomBytes } from 'node:crypto'; +import Schema from 'schemastery'; +import { STATUS } from '@hydrooj/common'; +import { getConfig, overrideConfig } from '../packages/hydrojudge/src/config'; +import { runFlow } from '../packages/hydrojudge/src/flow'; +import { RULES } from '../packages/hydrooj/src/model/contest'; +import StudentModel, { validateStudentInfo } from '../packages/hydrooj/src/model/stuinfo'; +import UserModel, { deleteUserCache } from '../packages/hydrooj/src/model/user'; +import db from '../packages/hydrooj/src/service/db'; +import { SettingService } from '../packages/hydrooj/src/settings'; + +// Run through `hydrooj cli execute` after bootstrapping an isolated test database. +// Never run fixture mutations against a production database. +export async function run() { + assert.match(db.db.databaseName, /(?:test|upgrade)/i); + const results: string[] = []; + const prefix = `hgnu_upgrade_${randomBytes(4).toString('hex')}`; + const uids = new Set(); + const create = async (suffix: string, stuid: string) => { + const uid = await StudentModel.createAccount(`${prefix}${suffix}@invalid.local`, `${prefix}${suffix}`, 'HGNU-Test-Password-2026', { + name: '测试', class: '测试2601', stuid, + }); + uids.add(uid); + return uid; + }; + try { + assert.throws(() => validateStudentInfo({ stuid: '220260001junk' })); + assert.throws(() => validateStudentInfo({ stuid: 'prefix2020310120000' })); + validateStudentInfo({ stuid: '29999998' }); + results.push('student-id anchors'); + + const uid = await create('a', '29999998'); + await UserModel.getByUname('system', `${prefix}a`); + await UserModel.getByEmail('system', `${prefix}a@invalid.local`); + await StudentModel.getStuInfoByStuId('29999998'); + await StudentModel.getClassList(); + await UserModel.setById(uid, { class: '测试2602', stuid: '29999997' } as any); + assert.equal(await StudentModel.getStuInfoByStuId('29999998'), null); + assert.equal((await StudentModel.getStuInfoByStuId('29999997'))._id, uid); + for (const user of await Promise.all([ + UserModel.getById('system', uid), + UserModel.getByUname('system', `${prefix}a`), + UserModel.getByEmail('system', `${prefix}a@invalid.local`), + ])) assert.equal(user.class, '测试2602'); + const users = await UserModel.getListForRender('system', [uid], false); + assert.equal(users[uid].name, '测试'); + assert.equal(users[uid].stuid, '29999997'); + assert.ok((await StudentModel.getClassList()).clsList.some((c) => c._id === '测试2602')); + results.push('student and user cache invalidation; render fields; class membership'); + + const race = await Promise.allSettled([create('b', '29999996'), create('c', '29999996')]); + assert.equal(race.filter((r) => r.status === 'fulfilled').length, 1); + assert.equal(await UserModel.coll.countDocuments({ uname: { $in: [`${prefix}b`, `${prefix}c`] } }), 1); + results.push('duplicate student-id race rolls back the losing account'); + + const originalCreate = StudentModel.create; + try { + StudentModel.create = async () => { throw new Error('fixture insertion failure'); }; + await assert.rejects(create('rollback', '29999995'), /fixture insertion failure/); + assert.equal(await UserModel.coll.countDocuments({ uname: `${prefix}rollback` }), 0); + } finally { + StudentModel.create = originalCreate; + } + results.push('failed student insertion rolls back account creation'); + + const user = await UserModel.getById('system', uid); + for (const [name, rule] of Object.entries(RULES)) { + for (const isExport of [false, true]) { + const tdoc: any = { domainId: 'system', pids: [1], beginAt: new Date(0), endAt: new Date(1), rule: name }; + const pdict: any = { 1: { title: 'A+B', docId: 1 } }; + const config = { isExport, showDisplayName: true }; + const header = await rule.scoreboardHeader(config, (s) => s, tdoc, pdict); + const row = await rule.scoreboardRow(config, (s) => s, tdoc, pdict, user, 1, { + uid, score: 100, penaltyScore: 80, time: 42, journal: [], detail: {}, display: {}, + } as any, {}); + assert.equal(header.length, row.length, `${name} export=${isExport}`); + assert.equal(row[1].value, '测试2602'); + if (name === 'homework') assert.equal(row[3].value, '100'); + } + } + results.push('all six scoreboard rules have aligned columns; homework keeps raw totals'); + + const oldConcurrency = getConfig('singleTaskParallelism'); + overrideConfig({ singleTaskParallelism: 1 } as any); + try { + for (const [type, expectedScore, expectedCalls] of [['sum', 100, 2], ['max', 100, 2], ['min', 0, 1]] as const) { + let calls = 0; + let result: any; + const ctx: any = { + config: { count: 2, subtasks: [{ id: 1, type, score: 100, cases: [{ id: 1 }, { id: 2 }] }] }, + meta: {}, next: () => {}, end: (value) => { result = value; }, + startChildSpan: () => ({ setAttributes() {}, [Symbol.dispose]() {} }), + }; + await runFlow(ctx, { + compile: async () => {}, + judgeCase: (c) => async () => { + calls++; + return { id: c.id, subtaskId: 1, status: c.id === 1 ? STATUS.STATUS_WRONG_ANSWER : STATUS.STATUS_ACCEPTED, + score: c.id === 1 ? 0 : 100, time: 1, memory: 1, message: '' }; + }, + }); + assert.equal(calls, expectedCalls, type); + assert.equal(result.score, expectedScore, type); + } + } finally { overrideConfig({ singleTaskParallelism: oldConcurrency } as any); } + results.push('sum/max continue after a wrong answer; min short-circuits'); + + const migrated: string[] = []; + const service: any = { + initialValues: { 'server.port': 8889 }, systemConfig: {}, + ctx: { db: { collection: () => ({ updateOne: async () => {} }) }, logger: { info() {} } }, + applyDelta: (source, key, value) => { migrated.push(`${key}=${value}`); return source; }, + saveConfig: async () => {}, + }; + await SettingService.prototype._actualMigrate.call(service, Schema.object({ server: Schema.object({ port: Schema.number() }) })); + assert.deepEqual(migrated, ['server.port=8889']); + results.push('legacy settings migrate using complete key names'); + } finally { + // Include accounts created before an assertion fails, scoped to this random run. + const created = await UserModel.coll.find({ uname: { $regex: `^${prefix}` } }).toArray(); + for (const user of created) { uids.add(user._id); deleteUserCache(user); } + await db.collection('stu.info').deleteMany({ _id: { $in: [...uids] } }); + await db.collection('domain.user').deleteMany({ uid: { $in: [...uids] } }); + await UserModel.coll.deleteMany({ _id: { $in: [...uids] }, uname: { $regex: `^${prefix}` } }); + (await import('../packages/hydrooj/src/model/stuinfo')).deleteStudentCache(); + } + return { passed: results, fixturesRemoved: true }; +} From 1e97b6651164c20bf27a794b1089a37d2086af36 Mon Sep 17 00:00:00 2001 From: guke1024 <0124gj@gmail.com> Date: Thu, 12 Nov 2026 22:40:07 +0800 Subject: [PATCH 37/52] Retain maintenance scripts and report student import failures accurately --- packages/hydrooj/src/entry/worker.ts | 10 +++++++--- packages/hydrooj/src/handler/manage.ts | 7 +++++++ packages/hydrooj/src/model/contest.ts | 2 +- .../ui-default/pages/manage_student_import.page.js | 11 ++++++----- packages/ui-default/templates/record_main_tr.html | 7 ++----- 5 files changed, 23 insertions(+), 14 deletions(-) diff --git a/packages/hydrooj/src/entry/worker.ts b/packages/hydrooj/src/entry/worker.ts index cc9abc3aff..6787b34864 100644 --- a/packages/hydrooj/src/entry/worker.ts +++ b/packages/hydrooj/src/entry/worker.ts @@ -60,12 +60,16 @@ export async function apply(ctx: Context) { resolve(c); }); }); - const loadDir = async (dir: string) => Promise.all((await fs.readdir(dir)).filter((i) => i.endsWith('.ts')) - .map((h) => ctx.loader.reloadPlugin(path.resolve(dir, h), ''))); + const loadDir = async (dir: string, includeJavaScript = false) => { + const entries = await fs.readdir(dir); + const files = entries.filter((i) => i.endsWith('.ts') + || (includeJavaScript && i.endsWith('.js') && !entries.includes(`${i.slice(0, -3)}.ts`))); + return Promise.all(files.map((h) => ctx.loader.reloadPlugin(path.resolve(dir, h), ''))); + }; await loadDir(path.resolve(__dirname, '..', 'handler')); await ctx.plugin(require('../service/migration').default); await addon(pending, fail, ctx); - await loadDir(path.resolve(__dirname, '..', 'script')); + await loadDir(path.resolve(__dirname, '..', 'script'), true); await ctx.parallel('app/started'); if (process.env.NODE_APP_INSTANCE === '0') { const staticDir = path.join(os.homedir(), '.hydro/static'); diff --git a/packages/hydrooj/src/handler/manage.ts b/packages/hydrooj/src/handler/manage.ts index 5408e75801..55bace59d5 100644 --- a/packages/hydrooj/src/handler/manage.ts +++ b/packages/hydrooj/src/handler/manage.ts @@ -321,6 +321,8 @@ class SystemStudentImportHandler extends SystemHandler { async post(domainId: string, students: string, draft: boolean) { const udocs = []; const messages: string[] = []; + let created = 0; + let errors = 0; const seenMail = new Set(); const seenName = new Set(); const seenId = new Set(); @@ -342,6 +344,7 @@ class SystemStudentImportHandler extends SystemHandler { udocs.push({ email, username, password, realname, classname, stuid }); } catch (e) { messages.push(`Line ${i + 1}: ${e.message} ${e.params || ''}`); + errors++; } } messages.push(`${udocs.length} students found.`); @@ -351,13 +354,17 @@ class SystemStudentImportHandler extends SystemHandler { await StudentModel.createAccount(item.email, item.username, item.password, { name: item.realname, class: item.classname, stuid: item.stuid, }); + created++; } catch (e) { messages.push(`${item.username}: ${e.message}`); + errors++; } } } this.response.body.users = udocs; this.response.body.messages = messages; + this.response.body.created = created; + this.response.body.errors = errors; } } /* eslint-enable no-await-in-loop */ diff --git a/packages/hydrooj/src/model/contest.ts b/packages/hydrooj/src/model/contest.ts index ae895fa589..9f0330a9dc 100644 --- a/packages/hydrooj/src/model/contest.ts +++ b/packages/hydrooj/src/model/contest.ts @@ -730,7 +730,7 @@ const homework = buildContestRule({ } else { columns.push({ type: 'problem', - value: String.fromCharCode(65 + i - 1), + value: getAlphabeticId(i - 1), raw: pid, }); } diff --git a/packages/ui-default/pages/manage_student_import.page.js b/packages/ui-default/pages/manage_student_import.page.js index 4aafd1898e..33025b13fb 100644 --- a/packages/ui-default/pages/manage_student_import.page.js +++ b/packages/ui-default/pages/manage_student_import.page.js @@ -10,12 +10,13 @@ const page = new NamedPage('manage_student_import', () => { students: $('[name="students"]').val(), draft, }); + $('[name="messages"]').text(res.messages.join('\n')); if (!draft) { - Notification.success(i18n('Created {0} users.', res.users.length)); - await delay(2000); - window.location.reload(); - } else { - $('[name="messages"]').text(res.messages.join('\n')); + Notification.success(i18n('Created {0} users.', res.created)); + if (!res.errors) { + await delay(2000); + window.location.reload(); + } } } catch (error) { Notification.error(error.message); diff --git a/packages/ui-default/templates/record_main_tr.html b/packages/ui-default/templates/record_main_tr.html index 647b6bfc36..3d28e23832 100644 --- a/packages/ui-default/templates/record_main_tr.html +++ b/packages/ui-default/templates/record_main_tr.html @@ -1,7 +1,6 @@ {% import "components/record.html" as record with context %} {% import "components/user.html" as user with context %} {% import "components/problem.html" as problem with context %} -{% import "components/user.html" as user with context %} {% set _isPretest = rdoc.contest and rdoc.contest.toString() == '000000000000000000000000' %} {{ record.render_status_td(rdoc, allDomain = allDomain) }} @@ -19,7 +18,7 @@ {% endif %} {% if pdoc and rdoc.contest %} - {% if not rdoc.contest.attend and (handler.user.own(tdoc) or handler.user.hasPerm(perm.PERM_VIEW_CONTEST_HIDDEN_SCOREBOARD)) %} + {% if tdoc and (handler.user.own(tdoc) or handler.user.hasPerm(perm.PERM_VIEW_CONTEST_HIDDEN_SCOREBOARD)) %} {{ problem.render_problem_title(pdoc, show_tags=false, show_invisible_flag=false) }} {% else %} {{ problem.render_problem_title(pdoc, tdoc=tdoc, show_tags=false, show_invisible_flag=false) }} @@ -33,9 +32,7 @@ {% if _isPretest %}({{ _('Pretest') }}){% endif %} - - {{ user.render_inline(udoc,badge=false,avatar=false) }} - + {{ user.render_inline(udoc,badge=false,avatar=false) }} {% if [STATUS.STATUS_TIME_LIMIT_EXCEEDED, STATUS.STATUS_MEMORY_LIMIT_EXCEEDED, STATUS.STATUS_OUTPUT_LIMIT_EXCEEDED].includes(rdoc['status']) %}≥{% endif %}{{ rdoc.time|round|int }}ms {% if [STATUS.STATUS_TIME_LIMIT_EXCEEDED, STATUS.STATUS_MEMORY_LIMIT_EXCEEDED, STATUS.STATUS_OUTPUT_LIMIT_EXCEEDED].includes(rdoc['status']) %}≥{% endif %}{{ size(rdoc.memory, 1024) }} From a64b7237f73cf6f6c26e44477f01560d7f56d91b Mon Sep 17 00:00:00 2001 From: guke1024 <0124gj@gmail.com> Date: Thu, 12 Nov 2026 22:43:40 +0800 Subject: [PATCH 38/52] Preserve HGNU profile badges and school footer credits --- .../ui-default/templates/components/user.html | 39 +++++++++++-------- .../ui-default/templates/partials/footer.html | 34 +++++++--------- 2 files changed, 36 insertions(+), 37 deletions(-) diff --git a/packages/ui-default/templates/components/user.html b/packages/ui-default/templates/components/user.html index b780a5aa11..b8aba117a8 100644 --- a/packages/ui-default/templates/components/user.html +++ b/packages/ui-default/templates/components/user.html @@ -1,21 +1,31 @@ -{% macro render_inline(udoc, avatar=true, badge=true, modbadge=true, levelbadge=true, classname=true) %} +{% macro render_inline(udoc, avatar=true, badge=true, modbadge=true, levelbadge=true, classname = true) %} {% if udoc %}
    - + {% if albumCollection %} +

    这篇公告的照片已按比赛整理浏览比赛相册 →

    + {% endif %}
    {{ ddoc['content']|markdownImages|safe }}
    diff --git a/packages/ui-default/templates/layout/html5.html b/packages/ui-default/templates/layout/html5.html index c959b59acc..67028d2c42 100644 --- a/packages/ui-default/templates/layout/html5.html +++ b/packages/ui-default/templates/layout/html5.html @@ -30,6 +30,12 @@ {% endblock %} {{ handler.renderTitle(page_name) }}
    ') - .text(value) - .attr('class', this.getItemClass(initialPosition)); - return $el; - } - - async animateOutItem(toPosition) { - const { $item } = this; - $item.attr('class', this.getItemClass(toPosition)); - await delay(ANIMATION_DURATION); - $item.remove(); - } - - async animateInItem() { - const { $item } = this; - $item.height(); // force reflow - $item.attr('class', this.getItemClass(POS_ORIGINAL)); - await delay(ANIMATION_DURATION); - } - - setValue(value) { - if (value === this.value) { - return; - } - let fromPosition; - if (parseFloat(value) > parseFloat(this.value)) { - fromPosition = POS_BELOW; - } else { - fromPosition = POS_ABOVE; - } - this.animateOutItem(-fromPosition); - this.value = value; - this.$item = this - .createItem(value, fromPosition) - .appendTo(this.$dom); - this.animateInItem(); - } - - getValue() { - return this.value; - } -} +import $ from 'jquery'; +import DOMAttachedObject from 'vj/components/DOMAttachedObject'; +import { delay } from 'vj/utils'; + +const ANIMATION_DURATION = 4000; + +const POS_ABOVE = -1; +const POS_ORIGINAL = 0; +const POS_BELOW = 1; + +const POS_CLASSNAME = { + [POS_ABOVE]: 'pos--above', + [POS_ORIGINAL]: '', + [POS_BELOW]: 'pos--below', +}; + +export default class Rotator extends DOMAttachedObject { + static DOMAttachKey = 'vjRotatorInstance'; + + getItemClass(pos) { + return `rotator__item ${POS_CLASSNAME[pos]}`; + } + + constructor($dom) { + super($dom); + $dom.addClass('rotator'); + this.value = $dom.text(); + this.$item = this + .createItem(this.value, POS_ORIGINAL) + .appendTo($dom.empty()); + } + + createItem(value, initialPosition) { + const $el = $('
    ') + .text(value) + .attr('class', this.getItemClass(initialPosition)); + return $el; + } + + async animateOutItem(toPosition) { + const { $item } = this; + $item.attr('class', this.getItemClass(toPosition)); + await delay(ANIMATION_DURATION); + $item.remove(); + } + + async animateInItem() { + const { $item } = this; + $item.height(); // force reflow + $item.attr('class', this.getItemClass(POS_ORIGINAL)); + await delay(ANIMATION_DURATION); + } + + setValue(value) { + if (value === this.value) { + return; + } + let fromPosition; + if (parseFloat(value) > parseFloat(this.value)) { + fromPosition = POS_BELOW; + } else { + fromPosition = POS_ABOVE; + } + this.animateOutItem(-fromPosition); + this.value = value; + this.$item = this + .createItem(value, fromPosition) + .appendTo(this.$dom); + this.animateInItem(); + } + + getValue() { + return this.value; + } +} diff --git a/packages/ui-default/components/rotator/rotator.page.styl b/packages/ui-default/components/rotator/rotator.page.styl index edb373cbb6..16eed05921 100644 --- a/packages/ui-default/components/rotator/rotator.page.styl +++ b/packages/ui-default/components/rotator/rotator.page.styl @@ -1,20 +1,20 @@ -.rotator - position: relative - height: 1em - -.rotator__item - position: absolute - left: 0 - top: 0 - width: 100% - height: 100% - transition: transform .2s, opacity .2s - transition-timing-function: ease-out-cubic - - &.pos--above - transform: translateY(-100%) - opacity: 0 - - &.pos--below - transform: translateY(100%) - opacity: 0 +.rotator + position: relative + height: 1em + +.rotator__item + position: absolute + left: 0 + top: 0 + width: 100% + height: 100% + transition: transform .2s, opacity .2s + transition-timing-function: ease-out-cubic + + &.pos--above + transform: translateY(-100%) + opacity: 0 + + &.pos--below + transform: translateY(100%) + opacity: 0 diff --git a/packages/ui-default/components/scratchpad/DataInput.page.styl b/packages/ui-default/components/scratchpad/DataInput.page.styl index 113cead5b5..410c8340e5 100644 --- a/packages/ui-default/components/scratchpad/DataInput.page.styl +++ b/packages/ui-default/components/scratchpad/DataInput.page.styl @@ -1,17 +1,17 @@ -.scratchpad__data-input - border: 0 - border-left: 3px solid #E0E0E0 - background: #F8F8F8 - padding: rem(8px 4px) - font-family: $code-font-family - font-size: rem($font-size-secondary) - outline: 0 - resize: none - color: #666 - height: 100% - width: 100% - transition: background-color .2s linear, border-color .2s linear - - &:focus - background: #FFF - border-color: lighten($primary-color, 70%) +.scratchpad__data-input + border: 0 + border-left: 3px solid #E0E0E0 + background: #F8F8F8 + padding: rem(8px 4px) + font-family: $code-font-family + font-size: rem($font-size-secondary) + outline: 0 + resize: none + color: #666 + height: 100% + width: 100% + transition: background-color .2s linear, border-color .2s linear + + &:focus + background: #FFF + border-color: lighten($primary-color, 70%) diff --git a/packages/ui-default/components/scratchpad/DataInputComponent.jsx b/packages/ui-default/components/scratchpad/DataInputComponent.jsx index 8fef6b7da6..247dea0501 100644 --- a/packages/ui-default/components/scratchpad/DataInputComponent.jsx +++ b/packages/ui-default/components/scratchpad/DataInputComponent.jsx @@ -1,46 +1,46 @@ -import PropTypes from 'prop-types'; - -export default function DataInputComponent(props) { - const { - html, - title, - value, - onChange, - className, - ...rest - } = props; - return ( -
    - {html ? ( -
    - {/* eslint-disable-next-line react/no-danger */} -
    -        
    - ) : ( - -
    - `)); - } else { - if ($(e).next()[0]?.tagName !== 'UL') { - cnt--; - return; - } - $(e).html($(e).html().replace(info, '')); - $(e).next('ul').children().each((j, ele) => { - $(ele).after(tpl` - - `); - $(ele).remove(); - }); - } - } - }); - - let cacheKey = `${UserContext._id}/${UiContext.pdoc.domainId}/${UiContext.pdoc.docId}`; - if (UiContext.tdoc?._id && UiContext.tdoc.rule !== 'homework') cacheKey += `@${UiContext.tdoc._id}`; - - let setUpdate; - function ProblemNavigation() { - [, setUpdate] = React.useState(0); - return
    - {pids.map((i) => - {i} - {ans[i] && } - )} -
    ; - } - - const db = await openDB; - async function saveAns() { - await db.put('solutions', { - id: `${cacheKey}#objective`, - value: JSON.stringify(ans), - }); - } - async function clearAns() { - await db.delete('solutions', `${cacheKey}#objective`); - window.location.reload(); - } - async function loadAns() { - const saved = await db.get('solutions', `${cacheKey}#objective`); - if (typeof saved?.value !== 'string') return; - const isValidOption = (v) => v.length === 1 && v.charCodeAt(0) >= 65 && v.charCodeAt(0) <= 90; - Object.assign(ans, JSON.parse(saved?.value || '{}')); - for (const [id, val] of Object.entries(ans)) { - if (Array.isArray(val)) { - for (const v of val) { - if (isValidOption(v)) $(`.objective_${id} input[value="${v}"]`).prop('checked', true); - } - } else if (val) { - $(`.objective_${id} input[type=text], .objective_${id} textarea`).val(val.toString()); - if (isValidOption(val)) $(`.objective_${id}.radiobox [value="${val}"]`).prop('checked', true); - } - } - setUpdate?.((v) => v + 1); - } - - if (cnt) { - await loadAns(); - $('.problem-content .typo').append(document.getElementsByClassName('nav__item--round').length - ? `` - : ``); - $('.objective-input[type!=checkbox]').on('input', (e: JQuery.TriggeredEvent) => { - ans[e.target.name] = e.target.value; - saveAns(); - }); - $('input.objective-input[type=checkbox]').on('input', (e: JQuery.TriggeredEvent) => { - if (e.target.checked) { - ans[e.target.name] ||= []; - ans[e.target.name].push(e.target.value); - ans[e.target.name] = [...new Set(ans[e.target.name])].sort((a: string, b: string) => a.charCodeAt(0) - b.charCodeAt(0)); - } else { - ans[e.target.name] = ans[e.target.name].filter((v) => v !== e.target.value); - } - saveAns(); - }); - $('input[type="submit"]').on('click', (e) => { - e.preventDefault(); - request - .post(UiContext.postSubmitUrl, { - lang: '_', - code: yaml.dump(ans), - }) - .then((res) => { - window.location.href = res.url; - }) - .catch((err) => { - Notification.error(err.message); - }); - }); - $('.section--problem-sidebar ol.menu').prepend(tpl(
  • - - {i18n('Clear answers')} - -
  • )); - $(document).on('click', '#clearAnswers', async () => { - const result = await new ConfirmDialog({ - $body: tpl.typoMsg('All changes will be lost. Are you sure to clear all answers?'), - }).open(); - if (result === 'yes') await clearAns(); - }); - } - const ele = document.createElement('div'); - $('.section--problem-sidebar ol.menu').prepend(ele); - createRoot(ele).render(); - $('.non-scratchpad--hide').hide(); - $('.scratchpad--hide').hide(); - $('.outer-loader-container').hide(); - } - - $(document).on('click', '[name="problem-sidebar__open-scratchpad"]', (ev) => { - enterScratchpadMode(); - ev.preventDefault(); - }); - $(document).on('click', '[name="problem-sidebar__quit-scratchpad"]', (ev) => { - leaveScratchpadMode(); - ev.preventDefault(); - }); - - $(document).on('click', '[data-lang]', (ev) => { - ev.preventDefault(); - const url = new URL(window.location.href); - url.searchParams.set('lang', ev.currentTarget.dataset.lang); - $('[data-lang]').removeClass('tab--active'); - pjax.request({ url: url.toString() }); - $(ev.currentTarget).addClass('tab--active'); - }); - $(document).on('click', '[name="show_tags"]', (ev) => { - $(ev.currentTarget).hide(); - $('span.tags').css('display', 'inline-block'); - }); - $('[name="problem-sidebar__download"]').on('click', handleClickDownloadProblem); - if (UiContext.pdoc.config?.type === 'objective') { - loadObjective(); - $(document).on('vjContentNew', loadObjective); - } -}); - -export default page; +import $ from 'jquery'; +import yaml from 'js-yaml'; +import React from 'react'; +import { createRoot } from 'react-dom/client'; +import { ConfirmDialog } from 'vj/components/dialog'; +import Notification from 'vj/components/notification'; +import { downloadProblemSet } from 'vj/components/zipDownloader'; +import { NamedPage } from 'vj/misc/Page'; +import { + delay, i18n, loadReactRedux, pjax, request, tpl, +} from 'vj/utils'; +import { openDB } from 'vj/utils/db'; + +class ProblemPageExtender { + isExtended = false; + inProgress = false; + $content = $('.problem-content-container'); + $contentBound = this.$content.closest('.section'); + $scratchpadContainer = $('.scratchpad-container'); + + async extend() { + if (this.inProgress) return; + if (this.isExtended) return; + this.inProgress = true; + + const bound = this.$contentBound + .get(0) + .getBoundingClientRect(); + + // @ts-ignore + this.$content.transition({ opacity: 0 }, { duration: 100 }); + await delay(100); + + $('body').addClass('header--collapsed mode--scratchpad'); + await this.$scratchpadContainer + .css({ + left: bound.left, + top: bound.top, + width: bound.width, + height: bound.height, + }) + .show() + .transition({ + // @ts-ignore + left: 0, + top: 0, + width: '100%', + height: '100%', + }, { + duration: 500, + easing: 'easeOutCubic', + }) + .promise(); + + $('.main > .row').hide(); + $('.footer').hide(); + $(window).scrollTop(0); + window.document.body.style.overflow = 'hidden'; + + this.inProgress = false; + this.isExtended = true; + } + + async collapse() { + if (this.inProgress) return; + if (!this.isExtended) return; + this.inProgress = true; + + $(window).scrollTop(0); + $('.main > .row').show(); + $('.footer').show(); + + const bound = this.$contentBound + .get(0) + .getBoundingClientRect(); + + $('body').removeClass('header--collapsed mode--scratchpad'); + + await this.$scratchpadContainer + .transition({ + // @ts-ignore + left: bound.left, + top: bound.top, + width: bound.width, + height: bound.height, + }, { + duration: 500, + easing: 'easeOutCubic', + }) + .promise(); + + this.$scratchpadContainer.hide(); + // @ts-ignore + this.$content.transition({ opacity: 1 }, { duration: 100 }); + window.document.body.style.overflow = 'scroll'; + + this.inProgress = false; + this.isExtended = false; + } + + toggle() { + if (this.isExtended) this.collapse(); + else this.extend(); + } +} + +const page = new NamedPage(['problem_detail', 'contest_detail_problem', 'homework_detail_problem'], async () => { + let reactLoaded = false; + let renderReact = null; + let unmountReact = null; + const extender = new ProblemPageExtender(); + + async function handleClickDownloadProblem() { + await downloadProblemSet([UiContext.problemNumId], UiContext.pdoc.title); + } + + async function scratchpadFadeIn() { + // @ts-ignore + await $('#scratchpad') + .transition( + { opacity: 1 }, + { duration: 200, easing: 'easeOutCubic' }, + ) + .promise(); + } + + async function scratchpadFadeOut() { + // @ts-ignore + await $('#scratchpad') + .transition( + { opacity: 0 }, + { duration: 200, easing: 'easeOutCubic' }, + ) + .promise(); + } + + async function loadReact() { + if (reactLoaded) return; + $('.loader-container').show(); + + const { default: WebSocket } = await import('../components/socket'); + const { default: ScratchpadApp } = await import('../components/scratchpad'); + const { default: ScratchpadReducer } = await import('../components/scratchpad/reducers'); + const { Provider, store } = await loadReactRedux(ScratchpadReducer); + + // @ts-ignore + window.store = store; + const sock = new WebSocket(UiContext.ws_prefix + UiContext.pretestConnUrl); + sock.onmessage = (message) => { + const msg = JSON.parse(message.data); + store.dispatch({ + type: 'SCRATCHPAD_RECORDS_PUSH', + payload: msg, + }); + }; + + renderReact = () => { + const root = createRoot($('#scratchpad').get(0)); + root.render( + + + , + ); + unmountReact = () => root.unmount(); + }; + reactLoaded = true; + $('.loader-container').hide(); + } + + let progress = false; + + async function enterScratchpadMode() { + if (progress) return; + progress = true; + await extender.extend(); + await loadReact(); + renderReact(); + await scratchpadFadeIn(); + progress = false; + } + + async function leaveScratchpadMode() { + if (progress) return; + progress = true; + await scratchpadFadeOut(); + $('.problem-content-container').append($('.problem-content')); + await extender.collapse(); + unmountReact(); + progress = false; + } + + async function loadObjective() { + $('.outer-loader-container').show(); + const ans = {}; + const pids = []; + let cnt = 0; + const reg = /{{ (input|select|multiselect|textarea)\(\d+(-\d+)?\) }}/g; + $('.problem-content .typo').children().each((i, e) => { + if (e.tagName === 'PRE' && !e.children[0].className.includes('#input')) return; + const questions = []; + let q; + while (q = reg.exec(e.innerText)) questions.push(q); // eslint-disable-line no-cond-assign + for (const [info, type] of questions) { + cnt++; + const id = info.replace(/{{ (input|select|multiselect|textarea)\((\d+(-\d+)?)\) }}/, '$2'); + pids.push(id); + if (type === 'input') { + $(e).html($(e).html().replace(info, tpl` +
    + +
    + `)); + } else if (type === 'textarea') { + $(e).html($(e).html().replace(info, tpl` +
    + +
    + `)); + } else { + if ($(e).next()[0]?.tagName !== 'UL') { + cnt--; + return; + } + $(e).html($(e).html().replace(info, '')); + $(e).next('ul').children().each((j, ele) => { + $(ele).after(tpl` + + `); + $(ele).remove(); + }); + } + } + }); + + let cacheKey = `${UserContext._id}/${UiContext.pdoc.domainId}/${UiContext.pdoc.docId}`; + if (UiContext.tdoc?._id && UiContext.tdoc.rule !== 'homework') cacheKey += `@${UiContext.tdoc._id}`; + + let setUpdate; + function ProblemNavigation() { + [, setUpdate] = React.useState(0); + return
    + {pids.map((i) => + {i} + {ans[i] && } + )} +
    ; + } + + const db = await openDB; + async function saveAns() { + await db.put('solutions', { + id: `${cacheKey}#objective`, + value: JSON.stringify(ans), + }); + } + async function clearAns() { + await db.delete('solutions', `${cacheKey}#objective`); + window.location.reload(); + } + async function loadAns() { + const saved = await db.get('solutions', `${cacheKey}#objective`); + if (typeof saved?.value !== 'string') return; + const isValidOption = (v) => v.length === 1 && v.charCodeAt(0) >= 65 && v.charCodeAt(0) <= 90; + Object.assign(ans, JSON.parse(saved?.value || '{}')); + for (const [id, val] of Object.entries(ans)) { + if (Array.isArray(val)) { + for (const v of val) { + if (isValidOption(v)) $(`.objective_${id} input[value="${v}"]`).prop('checked', true); + } + } else if (val) { + $(`.objective_${id} input[type=text], .objective_${id} textarea`).val(val.toString()); + if (isValidOption(val)) $(`.objective_${id}.radiobox [value="${val}"]`).prop('checked', true); + } + } + setUpdate?.((v) => v + 1); + } + + if (cnt) { + await loadAns(); + $('.problem-content .typo').append(document.getElementsByClassName('nav__item--round').length + ? `` + : ``); + $('.objective-input[type!=checkbox]').on('input', (e: JQuery.TriggeredEvent) => { + ans[e.target.name] = e.target.value; + saveAns(); + }); + $('input.objective-input[type=checkbox]').on('input', (e: JQuery.TriggeredEvent) => { + if (e.target.checked) { + ans[e.target.name] ||= []; + ans[e.target.name].push(e.target.value); + ans[e.target.name] = [...new Set(ans[e.target.name])].sort((a: string, b: string) => a.charCodeAt(0) - b.charCodeAt(0)); + } else { + ans[e.target.name] = ans[e.target.name].filter((v) => v !== e.target.value); + } + saveAns(); + }); + $('input[type="submit"]').on('click', (e) => { + e.preventDefault(); + request + .post(UiContext.postSubmitUrl, { + lang: '_', + code: yaml.dump(ans), + }) + .then((res) => { + window.location.href = res.url; + }) + .catch((err) => { + Notification.error(err.message); + }); + }); + $('.section--problem-sidebar ol.menu').prepend(tpl(
  • + + {i18n('Clear answers')} + +
  • )); + $(document).on('click', '#clearAnswers', async () => { + const result = await new ConfirmDialog({ + $body: tpl.typoMsg('All changes will be lost. Are you sure to clear all answers?'), + }).open(); + if (result === 'yes') await clearAns(); + }); + } + const ele = document.createElement('div'); + $('.section--problem-sidebar ol.menu').prepend(ele); + createRoot(ele).render(); + $('.non-scratchpad--hide').hide(); + $('.scratchpad--hide').hide(); + $('.outer-loader-container').hide(); + } + + $(document).on('click', '[name="problem-sidebar__open-scratchpad"]', (ev) => { + enterScratchpadMode(); + ev.preventDefault(); + }); + $(document).on('click', '[name="problem-sidebar__quit-scratchpad"]', (ev) => { + leaveScratchpadMode(); + ev.preventDefault(); + }); + + $(document).on('click', '[data-lang]', (ev) => { + ev.preventDefault(); + const url = new URL(window.location.href); + url.searchParams.set('lang', ev.currentTarget.dataset.lang); + $('[data-lang]').removeClass('tab--active'); + pjax.request({ url: url.toString() }); + $(ev.currentTarget).addClass('tab--active'); + }); + $(document).on('click', '[name="show_tags"]', (ev) => { + $(ev.currentTarget).hide(); + $('span.tags').css('display', 'inline-block'); + }); + $('[name="problem-sidebar__download"]').on('click', handleClickDownloadProblem); + if (UiContext.pdoc.config?.type === 'objective') { + loadObjective(); + $(document).on('vjContentNew', loadObjective); + } +}); + +export default page; diff --git a/packages/ui-default/pages/problem_edit.page.js b/packages/ui-default/pages/problem_edit.page.js index 5bd6fec1af..531608615f 100644 --- a/packages/ui-default/pages/problem_edit.page.js +++ b/packages/ui-default/pages/problem_edit.page.js @@ -1,305 +1,305 @@ -import $ from 'jquery'; -import _ from 'lodash'; -import { ConfirmDialog } from 'vj/components/dialog'; -import Dropdown from 'vj/components/dropdown/Dropdown'; -import Editor from 'vj/components/editor/index'; -import Notification from 'vj/components/notification'; -import uploadFiles from 'vj/components/upload'; -import download from 'vj/components/zipDownloader'; -import { NamedPage } from 'vj/misc/Page'; -import { - i18n, pjax, request, slideDown, slideUp, tpl, -} from 'vj/utils'; - -const categories = {}; -const dirtyCategories = []; -const selections = []; -const tags = []; - -function setDomSelected($dom, selected) { - if (selected) $dom.addClass('selected'); - else $dom.removeClass('selected'); -} - -async function updateSelection() { - for (const { type, category, subcategory } of dirtyCategories) { - let item = categories[category]; - const isSelected = item.select || _.some(item.children, (c) => c.select); - setDomSelected(item.$tag, isSelected); - if (isSelected) selections.push(category); - else _.pull(selections, category); - if (type === 'subcategory') { - item = categories[category].children[subcategory]; - setDomSelected(item.$tag, item.select); - const selectionName = subcategory; - if (item.select) selections.push(selectionName); - else _.pull(selections, selectionName); - } - } - const requestCategoryTags = _.uniq(selections - .filter((s) => s.indexOf(',') !== -1) - .map((s) => s.split(',')[0])); - // drop the category if its subcategory is selected - const requestTags = _.uniq(_.pullAll(selections, requestCategoryTags)); - dirtyCategories.length = 0; - const $txt = $('[name="tag"]'); - $txt.val([...requestTags, ...tags].join(', ')); -} - -function findCategory(name) { - const keys = Object.keys(categories); - if (keys.includes(name)) return [name, null]; - for (const category of keys) { - const subkeys = Object.keys(categories[category].children); - if (subkeys.includes(name)) return [category, name]; - } - return [null, null]; -} - -function parseCategorySelection() { - const $txt = $('[name="tag"]'); - tags.length = 0; - for (const name of $txt.val().split(',').map((i) => i.trim())) { - if (!name) return; - const [category, subcategory] = findCategory(name); - if (!category) tags.push(name); - else if (!subcategory) { - categories[category].select = true; - dirtyCategories.push({ type: 'category', category }); - } else { - categories[category].children[subcategory].select = true; - dirtyCategories.push({ type: 'subcategory', subcategory, category }); - } - } - updateSelection(); -} - -function buildCategoryFilter() { - const $container = $('[data-widget-cf-container]'); - if (!$container) return; - $container.attr('class', 'widget--category-filter row small-up-3 medium-up-2'); - for (const category of $container.children('li').get()) { - const $category = $(category) - .attr('class', 'widget--category-filter__category column'); - const $categoryTag = $category - .find('.section__title a') - .remove() - .attr('class', 'widget--category-filter__tag'); - const categoryText = $categoryTag.text(); - const $drop = $category - .children('.chip-list') - .remove() - .attr('class', 'widget--category-filter__drop'); - const treeItem = { - select: false, - $tag: $categoryTag, - children: {}, - }; - categories[categoryText] = treeItem; - $category.empty().append($categoryTag); - if ($drop.length > 0) { - const $subCategoryTags = $drop - .children('li') - .attr('class', 'widget--category-filter__subcategory') - .find('a') - .attr('class', 'widget--category-filter__tag') - .attr('data-category', categoryText); - for (const subCategoryTag of $subCategoryTags.get()) { - const $tag = $(subCategoryTag); - treeItem.children[$tag.text()] = { select: false, $tag }; - } - Dropdown.getOrConstruct($categoryTag, { - target: $drop[0], - position: 'left center', - }); - } - } - $(document).on('click', '.widget--category-filter__tag', (ev) => { - if (ev.shiftKey || ev.metaKey || ev.ctrlKey) return; - const tag = $(ev.currentTarget).text(); - const category = $(ev.currentTarget).attr('data-category'); - const treeItem = category ? categories[category].children[tag] : categories[tag]; - // the effect should be cancelSelect if it is shown as selected when clicking - const shouldSelect = treeItem.$tag.hasClass('selected') ? false : !treeItem.select; - treeItem.select = shouldSelect; - dirtyCategories.push(category - ? { type: 'subcategory', subcategory: tag, category } - : { type: 'category', category: tag }); - if (!category && !shouldSelect) { - // de-select children - _.forEach(treeItem.children, (treeSubItem, subcategory) => { - if (treeSubItem.select) { - treeSubItem.select = false; - dirtyCategories.push({ type: 'subcategory', subcategory, category: tag }); - } - }); - } - updateSelection(); - ev.preventDefault(); - }); -} - -async function handleSection(ev, sidebar, type) { - const $section = $(ev.currentTarget).closest(`.section--problem-sidebar-${sidebar}`); - if ($section.is(`.${type}d, .animating`)) return; - $section.addClass('animating'); - const $detail = $section.find(`.section--problem-sidebar-${sidebar}__detail`); - if (type === 'expand') { - await slideDown($detail, 300, { opacity: 0 }, { opacity: 1 }); - } else { - await slideUp($detail, 300, { opacity: 1 }, { opacity: 0 }); - } - $section.addClass(type === 'expand' ? 'expanded' : 'collapsed'); - $section.removeClass(type === 'expand' ? 'collapsed' : 'expanded'); - $section.removeClass('animating'); -} - -export default new NamedPage(['problem_create', 'problem_edit'], () => { - let confirmed = false; - $(document).on('click', '[name="operation"]', (ev) => { - ev.preventDefault(); - if (confirmed) { - return request.post('.', { operation: 'delete' }).then((res) => { - window.location.href = res.url; - }).catch((e) => { - Notification.error(e.message); - }); - } - const message = 'Confirm deleting this problem? Its files, submissions, discussions and solutions will be deleted as well.'; - return new ConfirmDialog({ - $body: tpl` -
    -

    ${i18n(message)}

    -
    `, - }).open().then((action) => { - if (action !== 'yes') return; - confirmed = true; - ev.target.click(); - }); - }); - $(document).on('change', '[name="tag"]', parseCategorySelection); - buildCategoryFilter(); - parseCategorySelection(); - - async function handleClickUpload() { - const input = document.createElement('input'); - input.type = 'file'; - input.multiple = true; - input.click(); - await new Promise((resolve) => { input.onchange = resolve; }); - await uploadFiles('./files', input.files, { - type: 'additional_file', - sidebar: true, - pjax: true, - }); - } - - async function handleClickRename(ev) { - const file = [$(ev.currentTarget).parent().parent().attr('data-filename')]; - // eslint-disable-next-line no-alert - const newName = prompt(i18n('Enter a new name for the file: ')); - if (!newName) return; - try { - await request.post('./files', { - operation: 'rename_files', - files: file, - newNames: [newName], - type: 'additional_file', - }); - Notification.success(i18n('File have been renamed.')); - await pjax.request({ url: './files?d=additional_file&sidebar=true', push: false }); - } catch (error) { - Notification.error(error.message); - } - } - - async function handleClickRemove(ev) { - const file = [$(ev.currentTarget).parent().parent().attr('data-filename')]; - const action = await new ConfirmDialog({ - $body: tpl.typoMsg(i18n('Confirm to delete the file?')), - }).open(); - if (action !== 'yes') return; - try { - await request.post('./files', { - operation: 'delete_files', - files: file, - type: 'additional_file', - }); - Notification.success(i18n('File have been deleted.')); - await pjax.request({ url: './files?d=additional_file&sidebar=true', push: false }); - } catch (error) { - Notification.error(error.message); - } - } - - async function handleClickDownloadAll() { - const files = $('.additional_file-table tr').map(function () { return $(this).attr('data-filename'); }).get(); - const { links, pdoc } = await request.post('./files', { operation: 'get_links', files, type: 'additional_file' }); - const targets = []; - for (const filename of Object.keys(links)) targets.push({ filename, url: links[filename] }); - await download(`${pdoc.docId} ${pdoc.title}.zip`, targets); - } - - const $main = $('textarea[data-editor]'); - const $field = $('textarea[data-markdown-upload]'); - let content = $field.val(); - let isObject = false; - let activeTab = $('[data-lang]').first().attr('data-lang'); - try { - content = JSON.parse(content); - isObject = !(content instanceof Array); - if (!isObject) content = JSON.stringify(content); - } catch (e) { } - if (!isObject) content = { [activeTab]: content }; - function getContent(lang) { - let c = ''; - if (content[lang]) c = content[lang]; - else { - const list = Object.keys(content).filter((l) => l.startsWith(lang)); - if (list.length) c = content[list[0]]; - } - if (typeof c !== 'string') c = JSON.stringify(c); - return c; - } - $main.val(getContent(activeTab)); - function onChange(val) { - try { - val = JSON.parse(val); - if (!(val instanceof Array)) val = JSON.stringify(val); - } catch { } - const empty = /^\s*$/g.test(val); - if (empty) delete content[activeTab]; - else content[activeTab] = val; - if (!Object.keys(content).length) $field.text(''); - else $field.text(JSON.stringify(content)); - } - const editor = Editor.getOrConstruct($main, { onChange }); - $('[data-lang]').on('click', (ev) => { - $('[data-lang]').removeClass('tab--active'); - $(ev.currentTarget).addClass('tab--active'); - const lang = $(ev.currentTarget).attr('data-lang'); - activeTab = lang; - const val = getContent(lang); - editor.value(val); - }); - $('[type="submit"]').on('click', (ev) => { - if (!$('[name="title"]').val().toString().length) { - Notification.error(i18n('Title is required.')); - $('body').scrollTop(); - $('html, body').animate( - { scrollTop: 0 }, - 300, - () => $('[name="title"]').focus(), - ); - ev.preventDefault(); - } - }); - $(document).on('click', '[name="additional_file__upload"]', () => handleClickUpload()); - $(document).on('click', '[name="additional_file__rename"]', (ev) => handleClickRename(ev)); - $(document).on('click', '[name="additional_file__delete"]', (ev) => handleClickRemove(ev)); - $(document).on('click', '[name="additional_file__download"]', () => handleClickDownloadAll()); - $(document).on('click', '[name="additional_file__section__expand"]', (ev) => handleSection(ev, 'additional_file', 'expand')); - $(document).on('click', '[name="additional_file__section__collapse"]', (ev) => handleSection(ev, 'additional_file', 'collapse')); - $(document).on('click', '[name="tags__section__expand"]', (ev) => handleSection(ev, 'tags', 'expand')); - $(document).on('click', '[name="tags__section__collapse"]', (ev) => handleSection(ev, 'tags', 'collapse')); -}); +import $ from 'jquery'; +import _ from 'lodash'; +import { ConfirmDialog } from 'vj/components/dialog'; +import Dropdown from 'vj/components/dropdown/Dropdown'; +import Editor from 'vj/components/editor/index'; +import Notification from 'vj/components/notification'; +import uploadFiles from 'vj/components/upload'; +import download from 'vj/components/zipDownloader'; +import { NamedPage } from 'vj/misc/Page'; +import { + i18n, pjax, request, slideDown, slideUp, tpl, +} from 'vj/utils'; + +const categories = {}; +const dirtyCategories = []; +const selections = []; +const tags = []; + +function setDomSelected($dom, selected) { + if (selected) $dom.addClass('selected'); + else $dom.removeClass('selected'); +} + +async function updateSelection() { + for (const { type, category, subcategory } of dirtyCategories) { + let item = categories[category]; + const isSelected = item.select || _.some(item.children, (c) => c.select); + setDomSelected(item.$tag, isSelected); + if (isSelected) selections.push(category); + else _.pull(selections, category); + if (type === 'subcategory') { + item = categories[category].children[subcategory]; + setDomSelected(item.$tag, item.select); + const selectionName = subcategory; + if (item.select) selections.push(selectionName); + else _.pull(selections, selectionName); + } + } + const requestCategoryTags = _.uniq(selections + .filter((s) => s.indexOf(',') !== -1) + .map((s) => s.split(',')[0])); + // drop the category if its subcategory is selected + const requestTags = _.uniq(_.pullAll(selections, requestCategoryTags)); + dirtyCategories.length = 0; + const $txt = $('[name="tag"]'); + $txt.val([...requestTags, ...tags].join(', ')); +} + +function findCategory(name) { + const keys = Object.keys(categories); + if (keys.includes(name)) return [name, null]; + for (const category of keys) { + const subkeys = Object.keys(categories[category].children); + if (subkeys.includes(name)) return [category, name]; + } + return [null, null]; +} + +function parseCategorySelection() { + const $txt = $('[name="tag"]'); + tags.length = 0; + for (const name of $txt.val().split(',').map((i) => i.trim())) { + if (!name) return; + const [category, subcategory] = findCategory(name); + if (!category) tags.push(name); + else if (!subcategory) { + categories[category].select = true; + dirtyCategories.push({ type: 'category', category }); + } else { + categories[category].children[subcategory].select = true; + dirtyCategories.push({ type: 'subcategory', subcategory, category }); + } + } + updateSelection(); +} + +function buildCategoryFilter() { + const $container = $('[data-widget-cf-container]'); + if (!$container) return; + $container.attr('class', 'widget--category-filter row small-up-3 medium-up-2'); + for (const category of $container.children('li').get()) { + const $category = $(category) + .attr('class', 'widget--category-filter__category column'); + const $categoryTag = $category + .find('.section__title a') + .remove() + .attr('class', 'widget--category-filter__tag'); + const categoryText = $categoryTag.text(); + const $drop = $category + .children('.chip-list') + .remove() + .attr('class', 'widget--category-filter__drop'); + const treeItem = { + select: false, + $tag: $categoryTag, + children: {}, + }; + categories[categoryText] = treeItem; + $category.empty().append($categoryTag); + if ($drop.length > 0) { + const $subCategoryTags = $drop + .children('li') + .attr('class', 'widget--category-filter__subcategory') + .find('a') + .attr('class', 'widget--category-filter__tag') + .attr('data-category', categoryText); + for (const subCategoryTag of $subCategoryTags.get()) { + const $tag = $(subCategoryTag); + treeItem.children[$tag.text()] = { select: false, $tag }; + } + Dropdown.getOrConstruct($categoryTag, { + target: $drop[0], + position: 'left center', + }); + } + } + $(document).on('click', '.widget--category-filter__tag', (ev) => { + if (ev.shiftKey || ev.metaKey || ev.ctrlKey) return; + const tag = $(ev.currentTarget).text(); + const category = $(ev.currentTarget).attr('data-category'); + const treeItem = category ? categories[category].children[tag] : categories[tag]; + // the effect should be cancelSelect if it is shown as selected when clicking + const shouldSelect = treeItem.$tag.hasClass('selected') ? false : !treeItem.select; + treeItem.select = shouldSelect; + dirtyCategories.push(category + ? { type: 'subcategory', subcategory: tag, category } + : { type: 'category', category: tag }); + if (!category && !shouldSelect) { + // de-select children + _.forEach(treeItem.children, (treeSubItem, subcategory) => { + if (treeSubItem.select) { + treeSubItem.select = false; + dirtyCategories.push({ type: 'subcategory', subcategory, category: tag }); + } + }); + } + updateSelection(); + ev.preventDefault(); + }); +} + +async function handleSection(ev, sidebar, type) { + const $section = $(ev.currentTarget).closest(`.section--problem-sidebar-${sidebar}`); + if ($section.is(`.${type}d, .animating`)) return; + $section.addClass('animating'); + const $detail = $section.find(`.section--problem-sidebar-${sidebar}__detail`); + if (type === 'expand') { + await slideDown($detail, 300, { opacity: 0 }, { opacity: 1 }); + } else { + await slideUp($detail, 300, { opacity: 1 }, { opacity: 0 }); + } + $section.addClass(type === 'expand' ? 'expanded' : 'collapsed'); + $section.removeClass(type === 'expand' ? 'collapsed' : 'expanded'); + $section.removeClass('animating'); +} + +export default new NamedPage(['problem_create', 'problem_edit'], () => { + let confirmed = false; + $(document).on('click', '[name="operation"]', (ev) => { + ev.preventDefault(); + if (confirmed) { + return request.post('.', { operation: 'delete' }).then((res) => { + window.location.href = res.url; + }).catch((e) => { + Notification.error(e.message); + }); + } + const message = 'Confirm deleting this problem? Its files, submissions, discussions and solutions will be deleted as well.'; + return new ConfirmDialog({ + $body: tpl` +
    +

    ${i18n(message)}

    +
    `, + }).open().then((action) => { + if (action !== 'yes') return; + confirmed = true; + ev.target.click(); + }); + }); + $(document).on('change', '[name="tag"]', parseCategorySelection); + buildCategoryFilter(); + parseCategorySelection(); + + async function handleClickUpload() { + const input = document.createElement('input'); + input.type = 'file'; + input.multiple = true; + input.click(); + await new Promise((resolve) => { input.onchange = resolve; }); + await uploadFiles('./files', input.files, { + type: 'additional_file', + sidebar: true, + pjax: true, + }); + } + + async function handleClickRename(ev) { + const file = [$(ev.currentTarget).parent().parent().attr('data-filename')]; + // eslint-disable-next-line no-alert + const newName = prompt(i18n('Enter a new name for the file: ')); + if (!newName) return; + try { + await request.post('./files', { + operation: 'rename_files', + files: file, + newNames: [newName], + type: 'additional_file', + }); + Notification.success(i18n('File have been renamed.')); + await pjax.request({ url: './files?d=additional_file&sidebar=true', push: false }); + } catch (error) { + Notification.error(error.message); + } + } + + async function handleClickRemove(ev) { + const file = [$(ev.currentTarget).parent().parent().attr('data-filename')]; + const action = await new ConfirmDialog({ + $body: tpl.typoMsg(i18n('Confirm to delete the file?')), + }).open(); + if (action !== 'yes') return; + try { + await request.post('./files', { + operation: 'delete_files', + files: file, + type: 'additional_file', + }); + Notification.success(i18n('File have been deleted.')); + await pjax.request({ url: './files?d=additional_file&sidebar=true', push: false }); + } catch (error) { + Notification.error(error.message); + } + } + + async function handleClickDownloadAll() { + const files = $('.additional_file-table tr').map(function () { return $(this).attr('data-filename'); }).get(); + const { links, pdoc } = await request.post('./files', { operation: 'get_links', files, type: 'additional_file' }); + const targets = []; + for (const filename of Object.keys(links)) targets.push({ filename, url: links[filename] }); + await download(`${pdoc.docId} ${pdoc.title}.zip`, targets); + } + + const $main = $('textarea[data-editor]'); + const $field = $('textarea[data-markdown-upload]'); + let content = $field.val(); + let isObject = false; + let activeTab = $('[data-lang]').first().attr('data-lang'); + try { + content = JSON.parse(content); + isObject = !(content instanceof Array); + if (!isObject) content = JSON.stringify(content); + } catch (e) { } + if (!isObject) content = { [activeTab]: content }; + function getContent(lang) { + let c = ''; + if (content[lang]) c = content[lang]; + else { + const list = Object.keys(content).filter((l) => l.startsWith(lang)); + if (list.length) c = content[list[0]]; + } + if (typeof c !== 'string') c = JSON.stringify(c); + return c; + } + $main.val(getContent(activeTab)); + function onChange(val) { + try { + val = JSON.parse(val); + if (!(val instanceof Array)) val = JSON.stringify(val); + } catch { } + const empty = /^\s*$/g.test(val); + if (empty) delete content[activeTab]; + else content[activeTab] = val; + if (!Object.keys(content).length) $field.text(''); + else $field.text(JSON.stringify(content)); + } + const editor = Editor.getOrConstruct($main, { onChange }); + $('[data-lang]').on('click', (ev) => { + $('[data-lang]').removeClass('tab--active'); + $(ev.currentTarget).addClass('tab--active'); + const lang = $(ev.currentTarget).attr('data-lang'); + activeTab = lang; + const val = getContent(lang); + editor.value(val); + }); + $('[type="submit"]').on('click', (ev) => { + if (!$('[name="title"]').val().toString().length) { + Notification.error(i18n('Title is required.')); + $('body').scrollTop(); + $('html, body').animate( + { scrollTop: 0 }, + 300, + () => $('[name="title"]').focus(), + ); + ev.preventDefault(); + } + }); + $(document).on('click', '[name="additional_file__upload"]', () => handleClickUpload()); + $(document).on('click', '[name="additional_file__rename"]', (ev) => handleClickRename(ev)); + $(document).on('click', '[name="additional_file__delete"]', (ev) => handleClickRemove(ev)); + $(document).on('click', '[name="additional_file__download"]', () => handleClickDownloadAll()); + $(document).on('click', '[name="additional_file__section__expand"]', (ev) => handleSection(ev, 'additional_file', 'expand')); + $(document).on('click', '[name="additional_file__section__collapse"]', (ev) => handleSection(ev, 'additional_file', 'collapse')); + $(document).on('click', '[name="tags__section__expand"]', (ev) => handleSection(ev, 'tags', 'expand')); + $(document).on('click', '[name="tags__section__collapse"]', (ev) => handleSection(ev, 'tags', 'collapse')); +}); diff --git a/packages/ui-default/pages/problem_edit.page.styl b/packages/ui-default/pages/problem_edit.page.styl index ba0a7d6ab7..7072f20e09 100644 --- a/packages/ui-default/pages/problem_edit.page.styl +++ b/packages/ui-default/pages/problem_edit.page.styl @@ -1,10 +1,10 @@ -.page--problem_edit,.page--problem_create - .problem-sidebar-additional_file - height: 270px - overflow-y: auto - - .col--size - width: 80px - .col--operation - width: 60px +.page--problem_edit,.page--problem_create + .problem-sidebar-additional_file + height: 270px + overflow-y: auto + + .col--size + width: 80px + .col--operation + width: 60px text-align: center \ No newline at end of file diff --git a/packages/ui-default/pages/problem_files.page.styl b/packages/ui-default/pages/problem_files.page.styl index a2020f82f1..912f475cdf 100644 --- a/packages/ui-default/pages/problem_files.page.styl +++ b/packages/ui-default/pages/problem_files.page.styl @@ -1,17 +1,17 @@ -.page--problem_files - .col--checkbox - width: 60px - - .col--size - width: 120px - - .col--operation - width: 60px - text-align: center - - .rename-confirm-table - x-overflow: auto - - .col--origin, .col--new - width: 50% +.page--problem_files + .col--checkbox + width: 60px + + .col--size + width: 120px + + .col--operation + width: 60px + text-align: center + + .rename-confirm-table + x-overflow: auto + + .col--origin, .col--new + width: 50% text-align: center \ No newline at end of file diff --git a/packages/ui-default/pages/problem_files.page.tsx b/packages/ui-default/pages/problem_files.page.tsx index 93682098ef..cea7382add 100644 --- a/packages/ui-default/pages/problem_files.page.tsx +++ b/packages/ui-default/pages/problem_files.page.tsx @@ -1,401 +1,401 @@ -import { STATUS } from '@hydrooj/utils/lib/status'; -import $ from 'jquery'; -import { map } from 'lodash'; -import React from 'react'; -import ReactDOM from 'react-dom/client'; -import FileSelectAutoComplete from 'vj/components/autocomplete/FileSelectAutoComplete'; -import { ActionDialog, ConfirmDialog, InfoDialog } from 'vj/components/dialog/index'; -import createHint from 'vj/components/hint'; -import Notification from 'vj/components/notification'; -import { previewFile } from 'vj/components/preview/preview.page'; -import uploadFiles from 'vj/components/upload'; -import download from 'vj/components/zipDownloader'; -import { NamedPage } from 'vj/misc/Page'; -import { - i18n, pjax, request, tpl, -} from 'vj/utils'; - -async function downloadProblemFilesAsArchive(type, files) { - const { links, pdoc } = await request.post('', { operation: 'get_links', files, type }); - const targets = []; - for (const filename of Object.keys(links)) targets.push({ filename, url: links[filename] }); - await download(`${pdoc.docId} ${pdoc.title}.zip`, targets); -} - -const page = new NamedPage('problem_files', () => { - function ensureAndGetSelectedFiles(type) { - const files = map( - $(`.problem-files-${type} tbody [data-checkbox-group="${type}"]:checked`), - (ch) => $(ch).closest('tr').attr('data-filename'), - ); - if (files.length === 0) { - Notification.error(i18n('Please select at least one file to perform this operation.')); - return null; - } - return files; - } - - async function handleClickUpload(type, files?) { - if (!files) { - const input = document.createElement('input'); - input.type = 'file'; - input.multiple = true; - input.click(); - await new Promise((resolve) => { input.onchange = resolve; }); - files = input.files; - } - if (!files.length) { - Notification.warn(i18n('No file selected.')); - return; - } - await uploadFiles('', files, { type, pjax: true }); - } - - async function handleClickDownloadSelected(type) { - const selectedFiles = ensureAndGetSelectedFiles(type); - if (selectedFiles === null) return; - await downloadProblemFilesAsArchive(type, selectedFiles); - } - - async function handleClickRename(ev, type) { - const file = [$(ev.currentTarget).parent().parent().attr('data-filename')]; - // eslint-disable-next-line no-alert - const newName = prompt(i18n('Enter a new name for the file: ')); - if (!newName) return; - try { - await request.post('./files', { - operation: 'rename_files', - files: file, - newNames: [newName], - type, - }); - Notification.success(i18n('File have been renamed.')); - await pjax.request({ push: false }); - } catch (error) { - Notification.error(error.message); - } - } - - let prism = null; - const load = import('../components/highlighter/prismjs'); - load.then(({ default: p }) => { - prism = p.Prism; - }).catch(() => { }); - - async function handleClickRenameSelected(type) { - const selectedFiles = ensureAndGetSelectedFiles(type); - if (!selectedFiles?.length) return; - let onActionButton = (_: string) => false; - - function Rename(props) { - const [original, setOriginal] = React.useState(''); - const [replace, setReplace] = React.useState(''); - const [prefix, setPrefix] = React.useState(''); - const [suffix, setSuffix] = React.useState(''); - const [regexValid, setRegexValid] = React.useState(true); - const [wantNext, setWantNext] = React.useState(false); - const [preview, setPreview] = React.useState(false); - const [highlight, setHighlight] = React.useState(null); - const [newNames, setNewNames] = React.useState(props.names); - - React.useEffect(() => { - let s: string | RegExp = original; - setRegexValid(true); - setHighlight(null); - if (original.length > 2 && original.startsWith('/')) { - const availableFlags = ['g', 'i']; - const flags = []; - let copy = original.substring(1); - while (availableFlags.includes(copy[copy.length - 1])) { - flags.push(copy[copy.length - 1]); - copy = copy.substring(0, copy.length - 1); - } - if (copy.endsWith('/')) { - copy = copy.substring(0, copy.length - 1); - flags.reverse(); - if (prism) setHighlight(`/${prism.highlight(copy, prism.languages.regex, 'RegExp')}/${flags.join('')}`); - try { - s = new RegExp(copy, flags.join('')); - setRegexValid(true); - } catch (e) { - setRegexValid(false); - } - } - } - setNewNames(selectedFiles.map((file) => { - if (s) file = file.replace(s, replace); - return prefix + file + suffix; - })); - }, [original, replace, prefix, suffix]); - - onActionButton = (action) => { - if (action === 'ok') { - if (!preview) { - if (!regexValid) return false; - if (!original && !prefix && !suffix) { - setWantNext(true); - return false; - } - setPreview(true); - return false; - } - request.post('', { - operation: 'rename_files', - files: selectedFiles, - newNames, - type, - }).then(() => { - Notification.success(i18n('Selected files have been renamed.')); - pjax.request({ push: false }); - }).catch((error) => { - Notification.error(error.message); - }); - return true; - } - if (preview) { - setPreview(false); - return false; - } - return true; - }; - - const style = { fontFamily: 'var(--code-font-family)' }; - - return
    - {!preview ? <> -
    -
    -

    {i18n('Batch replacement')}

    - - -
    -
    -

    {i18n('Add prefix/suffix')}

    - - -
    -
    -
    -
    -

    {!regexValid ? i18n('Invalid RegExp') : wantNext ? i18n('No changes to make.') : i18n('RegExp supported, quote with "/"')}

    -
    -
    - :
    -

    {i18n('Are you sure to rename the following file?')}

    -
      - {original &&
    • Replace {original} with {replace}
    • } - {prefix &&
    • Add {prefix} as prefix
    • } - {suffix &&
    • Add {suffix} as suffix
    • } -
    - - - - - - - - - - - - - {selectedFiles.map((file, index) => - - - )} - -
    {i18n('Original filename(s)')}{i18n('New filename(s)')}
    {file}{newNames[index]}
    -
    } -
    ; - } - - const promise = new ActionDialog({ - $body: tpl`
    `, - width: '600px', - onDispatch(action) { - return onActionButton(action); - }, - }).open(); - const root = ReactDOM.createRoot(document.getElementById('rename_dialog')); - root.render(); - await promise; - root.unmount(); - } - - async function handleClickRemove(ev, type) { - const file = [$(ev.currentTarget).parent().parent().attr('data-filename')]; - const action = await new ConfirmDialog({ - $body: tpl.typoMsg(i18n('Confirm to delete the file?')), - }).open(); - if (action !== 'yes') return; - try { - await request.post('./files', { - operation: 'delete_files', - files: file, - type, - }); - Notification.success(i18n('File have been deleted.')); - await pjax.request({ push: false }); - } catch (error) { - Notification.error(error.message); - } - } - - async function handleClickRemoveSelected(type) { - const selectedFiles = ensureAndGetSelectedFiles(type); - if (selectedFiles === null) return; - const action = await new ConfirmDialog({ - $body: tpl.typoMsg(i18n('Confirm to delete the selected files?')), - }).open(); - if (action !== 'yes') return; - try { - await request.post('', { - operation: 'delete_files', - files: selectedFiles, - type, - }); - Notification.success(i18n('Selected files have been deleted.')); - await pjax.request({ push: false }); - } catch (error) { - Notification.error(error.message); - } - } - - function handleDragOver(type: string, ev: JQuery.DragOverEvent) { - ev.preventDefault(); - // TODO display a drag-drop allowed hint - } - - function handleDrop(type: string, e: JQuery.DropEvent) { - e.preventDefault(); - if (!$('[name="upload_testdata"]').length) { - Notification.error(i18n("You don't have permission to upload file.")); - return; - } - const ev = e.originalEvent; - const files = []; - if (ev.dataTransfer.items) { - for (let i = 0; i < ev.dataTransfer.items.length; i++) { - if (ev.dataTransfer.items[i].kind === 'file') { - const file = ev.dataTransfer.items[i].getAsFile(); - files.push(file); - } - } - } else { - for (let i = 0; i < ev.dataTransfer.files.length; i++) { - files.push(ev.dataTransfer.files[i]); - } - } - handleClickUpload(type, files); - } - - async function handleGenerateTestdata(ev) { - ev.preventDefault(); - const gen = $('[name=gen]').val(); - const std = $('[name=std]').val(); - if (!gen) { - Notification.error(i18n('Please input the generator.')); - return; - } - if (!std) { - Notification.error(i18n('Please input the standard program.')); - return; - } - try { - const res = await request.post('', { - operation: 'generate_testdata', - gen, - std, - }); - if (res.error) Notification.error(res.error); - else { - Notification.success(i18n('Generating...')); - const dialog = new InfoDialog({ - $body: tpl` -
    - -
    `, - width: `${window.innerWidth - 200}px`, - height: `${window.innerHeight - 100}px`, - }); - const callback = (data: MessageEvent) => { - if (data.data.status === STATUS.STATUS_ACCEPTED) { - dialog.close(); - Notification.success('Testdata generated successfully.'); - } - }; - window.addEventListener('message', callback, false); - await dialog.open(); - window.removeEventListener('message', callback, false); - await pjax.request({ push: false }); - } - } catch (error) { - Notification.error([error.message, ...error.params].join(' ')); - } - } - - if (UiContext.pdoc) { - FileSelectAutoComplete.getOrConstruct($('[name=gen]'), { data: UiContext.pdoc.data }); - FileSelectAutoComplete.getOrConstruct($('[name=std]'), { data: UiContext.pdoc.data }); - $('[name="generate_testdata"]').on('click', handleGenerateTestdata); - } - - if ($('[name="upload_testdata"]').length) { - $(document).on('click', '[name="upload_testdata"]', () => handleClickUpload('testdata')); - $(document).on('click', '[name="upload_file"]', () => handleClickUpload('additional_file')); - $(document).on('click', '[name="create_testdata"]', () => previewFile(undefined, 'testdata')); - $(document).on('click', '[name="create_file"]', () => previewFile(undefined, 'additional_file')); - $(document).on('click', '[name="testdata__rename"]', (ev) => handleClickRename(ev, 'testdata')); - $(document).on('click', '[name="additional_file__rename"]', (ev) => handleClickRename(ev, 'additional_file')); - $(document).on('click', '[name="rename_selected_testdata"]', () => handleClickRenameSelected('testdata')); - $(document).on('click', '[name="rename_selected_file"]', () => handleClickRenameSelected('additional_file')); - $(document).on('click', '[name="testdata__delete"]', (ev) => handleClickRemove(ev, 'testdata')); - $(document).on('click', '[name="additional_file__delete"]', (ev) => handleClickRemove(ev, 'additional_file')); - $(document).on('click', '[name="remove_selected_testdata"]', () => handleClickRemoveSelected('testdata')); - $(document).on('click', '[name="remove_selected_file"]', () => handleClickRemoveSelected('additional_file')); - } - $(document).on('dragover', '.problem-files-testdata', (ev) => handleDragOver('testdata', ev)); - $(document).on('dragover', '.problem-files-additional_file', (ev) => handleDragOver('additional_file', ev)); - $(document).on('drop', '.problem-files-testdata', (ev) => handleDrop('testdata', ev)); - $(document).on('drop', '.problem-files-additional_file', (ev) => handleDrop('additional_file', ev)); - $(document).on('click', '[name="download_selected_testdata"]', () => handleClickDownloadSelected('testdata')); - $(document).on('click', '[name="download_selected_file"]', () => handleClickDownloadSelected('additional_file')); - $(document).on('vjContentNew', (e) => { - createHint('Hint::icon::testdata', $(e.target).find('[name="create_testdata"]').get(0)?.parentNode?.parentNode?.children?.[0]); - }); - createHint('Hint::icon::testdata', $(document).find('[name="create_testdata"]').get(0)?.parentNode?.parentNode?.children?.[0]); -}); - -export default page; +import { STATUS } from '@hydrooj/utils/lib/status'; +import $ from 'jquery'; +import { map } from 'lodash'; +import React from 'react'; +import ReactDOM from 'react-dom/client'; +import FileSelectAutoComplete from 'vj/components/autocomplete/FileSelectAutoComplete'; +import { ActionDialog, ConfirmDialog, InfoDialog } from 'vj/components/dialog/index'; +import createHint from 'vj/components/hint'; +import Notification from 'vj/components/notification'; +import { previewFile } from 'vj/components/preview/preview.page'; +import uploadFiles from 'vj/components/upload'; +import download from 'vj/components/zipDownloader'; +import { NamedPage } from 'vj/misc/Page'; +import { + i18n, pjax, request, tpl, +} from 'vj/utils'; + +async function downloadProblemFilesAsArchive(type, files) { + const { links, pdoc } = await request.post('', { operation: 'get_links', files, type }); + const targets = []; + for (const filename of Object.keys(links)) targets.push({ filename, url: links[filename] }); + await download(`${pdoc.docId} ${pdoc.title}.zip`, targets); +} + +const page = new NamedPage('problem_files', () => { + function ensureAndGetSelectedFiles(type) { + const files = map( + $(`.problem-files-${type} tbody [data-checkbox-group="${type}"]:checked`), + (ch) => $(ch).closest('tr').attr('data-filename'), + ); + if (files.length === 0) { + Notification.error(i18n('Please select at least one file to perform this operation.')); + return null; + } + return files; + } + + async function handleClickUpload(type, files?) { + if (!files) { + const input = document.createElement('input'); + input.type = 'file'; + input.multiple = true; + input.click(); + await new Promise((resolve) => { input.onchange = resolve; }); + files = input.files; + } + if (!files.length) { + Notification.warn(i18n('No file selected.')); + return; + } + await uploadFiles('', files, { type, pjax: true }); + } + + async function handleClickDownloadSelected(type) { + const selectedFiles = ensureAndGetSelectedFiles(type); + if (selectedFiles === null) return; + await downloadProblemFilesAsArchive(type, selectedFiles); + } + + async function handleClickRename(ev, type) { + const file = [$(ev.currentTarget).parent().parent().attr('data-filename')]; + // eslint-disable-next-line no-alert + const newName = prompt(i18n('Enter a new name for the file: ')); + if (!newName) return; + try { + await request.post('./files', { + operation: 'rename_files', + files: file, + newNames: [newName], + type, + }); + Notification.success(i18n('File have been renamed.')); + await pjax.request({ push: false }); + } catch (error) { + Notification.error(error.message); + } + } + + let prism = null; + const load = import('../components/highlighter/prismjs'); + load.then(({ default: p }) => { + prism = p.Prism; + }).catch(() => { }); + + async function handleClickRenameSelected(type) { + const selectedFiles = ensureAndGetSelectedFiles(type); + if (!selectedFiles?.length) return; + let onActionButton = (_: string) => false; + + function Rename(props) { + const [original, setOriginal] = React.useState(''); + const [replace, setReplace] = React.useState(''); + const [prefix, setPrefix] = React.useState(''); + const [suffix, setSuffix] = React.useState(''); + const [regexValid, setRegexValid] = React.useState(true); + const [wantNext, setWantNext] = React.useState(false); + const [preview, setPreview] = React.useState(false); + const [highlight, setHighlight] = React.useState(null); + const [newNames, setNewNames] = React.useState(props.names); + + React.useEffect(() => { + let s: string | RegExp = original; + setRegexValid(true); + setHighlight(null); + if (original.length > 2 && original.startsWith('/')) { + const availableFlags = ['g', 'i']; + const flags = []; + let copy = original.substring(1); + while (availableFlags.includes(copy[copy.length - 1])) { + flags.push(copy[copy.length - 1]); + copy = copy.substring(0, copy.length - 1); + } + if (copy.endsWith('/')) { + copy = copy.substring(0, copy.length - 1); + flags.reverse(); + if (prism) setHighlight(`/${prism.highlight(copy, prism.languages.regex, 'RegExp')}/${flags.join('')}`); + try { + s = new RegExp(copy, flags.join('')); + setRegexValid(true); + } catch (e) { + setRegexValid(false); + } + } + } + setNewNames(selectedFiles.map((file) => { + if (s) file = file.replace(s, replace); + return prefix + file + suffix; + })); + }, [original, replace, prefix, suffix]); + + onActionButton = (action) => { + if (action === 'ok') { + if (!preview) { + if (!regexValid) return false; + if (!original && !prefix && !suffix) { + setWantNext(true); + return false; + } + setPreview(true); + return false; + } + request.post('', { + operation: 'rename_files', + files: selectedFiles, + newNames, + type, + }).then(() => { + Notification.success(i18n('Selected files have been renamed.')); + pjax.request({ push: false }); + }).catch((error) => { + Notification.error(error.message); + }); + return true; + } + if (preview) { + setPreview(false); + return false; + } + return true; + }; + + const style = { fontFamily: 'var(--code-font-family)' }; + + return
    + {!preview ? <> +
    +
    +

    {i18n('Batch replacement')}

    + + +
    +
    +

    {i18n('Add prefix/suffix')}

    + + +
    +
    +
    +
    +

    {!regexValid ? i18n('Invalid RegExp') : wantNext ? i18n('No changes to make.') : i18n('RegExp supported, quote with "/"')}

    +
    +
    + :
    +

    {i18n('Are you sure to rename the following file?')}

    +
      + {original &&
    • Replace {original} with {replace}
    • } + {prefix &&
    • Add {prefix} as prefix
    • } + {suffix &&
    • Add {suffix} as suffix
    • } +
    + + + + + + + + + + + + + {selectedFiles.map((file, index) => + + + )} + +
    {i18n('Original filename(s)')}{i18n('New filename(s)')}
    {file}{newNames[index]}
    +
    } +
    ; + } + + const promise = new ActionDialog({ + $body: tpl`
    `, + width: '600px', + onDispatch(action) { + return onActionButton(action); + }, + }).open(); + const root = ReactDOM.createRoot(document.getElementById('rename_dialog')); + root.render(); + await promise; + root.unmount(); + } + + async function handleClickRemove(ev, type) { + const file = [$(ev.currentTarget).parent().parent().attr('data-filename')]; + const action = await new ConfirmDialog({ + $body: tpl.typoMsg(i18n('Confirm to delete the file?')), + }).open(); + if (action !== 'yes') return; + try { + await request.post('./files', { + operation: 'delete_files', + files: file, + type, + }); + Notification.success(i18n('File have been deleted.')); + await pjax.request({ push: false }); + } catch (error) { + Notification.error(error.message); + } + } + + async function handleClickRemoveSelected(type) { + const selectedFiles = ensureAndGetSelectedFiles(type); + if (selectedFiles === null) return; + const action = await new ConfirmDialog({ + $body: tpl.typoMsg(i18n('Confirm to delete the selected files?')), + }).open(); + if (action !== 'yes') return; + try { + await request.post('', { + operation: 'delete_files', + files: selectedFiles, + type, + }); + Notification.success(i18n('Selected files have been deleted.')); + await pjax.request({ push: false }); + } catch (error) { + Notification.error(error.message); + } + } + + function handleDragOver(type: string, ev: JQuery.DragOverEvent) { + ev.preventDefault(); + // TODO display a drag-drop allowed hint + } + + function handleDrop(type: string, e: JQuery.DropEvent) { + e.preventDefault(); + if (!$('[name="upload_testdata"]').length) { + Notification.error(i18n("You don't have permission to upload file.")); + return; + } + const ev = e.originalEvent; + const files = []; + if (ev.dataTransfer.items) { + for (let i = 0; i < ev.dataTransfer.items.length; i++) { + if (ev.dataTransfer.items[i].kind === 'file') { + const file = ev.dataTransfer.items[i].getAsFile(); + files.push(file); + } + } + } else { + for (let i = 0; i < ev.dataTransfer.files.length; i++) { + files.push(ev.dataTransfer.files[i]); + } + } + handleClickUpload(type, files); + } + + async function handleGenerateTestdata(ev) { + ev.preventDefault(); + const gen = $('[name=gen]').val(); + const std = $('[name=std]').val(); + if (!gen) { + Notification.error(i18n('Please input the generator.')); + return; + } + if (!std) { + Notification.error(i18n('Please input the standard program.')); + return; + } + try { + const res = await request.post('', { + operation: 'generate_testdata', + gen, + std, + }); + if (res.error) Notification.error(res.error); + else { + Notification.success(i18n('Generating...')); + const dialog = new InfoDialog({ + $body: tpl` +
    + +
    `, + width: `${window.innerWidth - 200}px`, + height: `${window.innerHeight - 100}px`, + }); + const callback = (data: MessageEvent) => { + if (data.data.status === STATUS.STATUS_ACCEPTED) { + dialog.close(); + Notification.success('Testdata generated successfully.'); + } + }; + window.addEventListener('message', callback, false); + await dialog.open(); + window.removeEventListener('message', callback, false); + await pjax.request({ push: false }); + } + } catch (error) { + Notification.error([error.message, ...error.params].join(' ')); + } + } + + if (UiContext.pdoc) { + FileSelectAutoComplete.getOrConstruct($('[name=gen]'), { data: UiContext.pdoc.data }); + FileSelectAutoComplete.getOrConstruct($('[name=std]'), { data: UiContext.pdoc.data }); + $('[name="generate_testdata"]').on('click', handleGenerateTestdata); + } + + if ($('[name="upload_testdata"]').length) { + $(document).on('click', '[name="upload_testdata"]', () => handleClickUpload('testdata')); + $(document).on('click', '[name="upload_file"]', () => handleClickUpload('additional_file')); + $(document).on('click', '[name="create_testdata"]', () => previewFile(undefined, 'testdata')); + $(document).on('click', '[name="create_file"]', () => previewFile(undefined, 'additional_file')); + $(document).on('click', '[name="testdata__rename"]', (ev) => handleClickRename(ev, 'testdata')); + $(document).on('click', '[name="additional_file__rename"]', (ev) => handleClickRename(ev, 'additional_file')); + $(document).on('click', '[name="rename_selected_testdata"]', () => handleClickRenameSelected('testdata')); + $(document).on('click', '[name="rename_selected_file"]', () => handleClickRenameSelected('additional_file')); + $(document).on('click', '[name="testdata__delete"]', (ev) => handleClickRemove(ev, 'testdata')); + $(document).on('click', '[name="additional_file__delete"]', (ev) => handleClickRemove(ev, 'additional_file')); + $(document).on('click', '[name="remove_selected_testdata"]', () => handleClickRemoveSelected('testdata')); + $(document).on('click', '[name="remove_selected_file"]', () => handleClickRemoveSelected('additional_file')); + } + $(document).on('dragover', '.problem-files-testdata', (ev) => handleDragOver('testdata', ev)); + $(document).on('dragover', '.problem-files-additional_file', (ev) => handleDragOver('additional_file', ev)); + $(document).on('drop', '.problem-files-testdata', (ev) => handleDrop('testdata', ev)); + $(document).on('drop', '.problem-files-additional_file', (ev) => handleDrop('additional_file', ev)); + $(document).on('click', '[name="download_selected_testdata"]', () => handleClickDownloadSelected('testdata')); + $(document).on('click', '[name="download_selected_file"]', () => handleClickDownloadSelected('additional_file')); + $(document).on('vjContentNew', (e) => { + createHint('Hint::icon::testdata', $(e.target).find('[name="create_testdata"]').get(0)?.parentNode?.parentNode?.children?.[0]); + }); + createHint('Hint::icon::testdata', $(document).find('[name="create_testdata"]').get(0)?.parentNode?.parentNode?.children?.[0]); +}); + +export default page; diff --git a/packages/ui-default/pages/problem_main.page.styl b/packages/ui-default/pages/problem_main.page.styl index 9b4a4c8873..7bd69dbee6 100644 --- a/packages/ui-default/pages/problem_main.page.styl +++ b/packages/ui-default/pages/problem_main.page.styl @@ -1,220 +1,220 @@ -.page--problem_main -.page--problem_category - .col--checkbox - width: rem(61px) - - .col--pid - width: rem(81px) - - .col--status - width: rem(140px) - position: relative - border-right: 1px solid $table-border-color - - .col--difficulty - width: rem(70px) - text-align: center - - &[lang="en"] - .col--difficulty - width: rem(95px) - - .col--ac-tried - width: rem(100px) - text-align: center - border-left: 1px solid $table-border-color - - +mobile() - .col--status, - .col--tried, - .col--difficulty - display: none - - .col--ac - border-left: 1px solid $table-border-color - - -.widget--category-filter - &__category - margin-bottom: rem(6px) - - &__drop - position: relative - font-size: rem($font-size-small) - width: rem(230px) - padding: rem(10px) - margin-right: rem(10px) - background: $menu-drop-bg-color - box-shadow: $menu-drop-shadow - - &:before - content: '' - display: block - position: absolute - width: 0 - height: 0 - border: rem($menu-drop-triangle-size) solid transparent - border-top-color: #FFF - border-left-color: #FFF - box-shadow: $menu-drop-triangle-shadow - transform: rotate(135deg) - transform-origin: 0 0 - pointer-events: none - left: 100% - top: 50% - margin-left: rem(floor($menu-drop-triangle-size * 1.414)) - - &__subcategory - margin: rem(2px) - display: inline-block - - &__tag - display: inline-block - padding: rem(5px 6px) - - &:hover - color: #FFF - background: $primary-color - text-decoration: none - - &.selected - color: #FFF - background: $secondary-color - -.drop-target-attached-right .widget--category-filter__drop - margin-right: 0 - margin-left: rem(10px) - - &:before - transform-origin: 100% 0 - transform: rotate(-45deg) - left: auto - right: 100% - margin-left: 0 - margin-right: 0 - margin-top: rem(floor($menu-drop-triangle-size * -1.414)) - - -.display-mode .display-mode-hide, -.edit-mode .edit-mode-hide, -.hide-problem-tag .notag--hide, -.tag--hide - display: none - -.hide-problem-tag .tag--hide - display: block - -.toggle-tag - float: right - -.data-table > tbody > tr - height: 40.15px - -.data-table > thead > tr - height: 54.9px - -.search-container - padding-bottom: 0 - - .title - margin-bottom: rem(5px) - - .dialog-button - font-size: rem($font-size-secondary) - display: inline-block - padding: rem(5px 6px) - margin-bottom: rem(5px) - -.search-tag__item - display: inline-block - padding: rem(5px 6px) - font-size: rem($font-size-secondary) - margin-bottom: rem(5px) - - &:hover - color: #555; - background: #f4f4f4; - text-decoration: none - - &.selected - color: #FFF - background: $primary-color !important - - &.hide - display: none - opacity: 0 - -.category-filter__header - [data-category-container].list - overflow-x: auto - - .list - .list__item - padding: 12px 12px - cursor: pointer - margin: 0px 10px - background: #eeeff3 - min-width: 90px - text-align: center - position: relative - - &.selected - background: $primary-color - color: #FFF - font-weight: bold - - .list__item::first - margin-left: 0px - -.category-filter__body - margin: 12px 10px 0 10px - background: #f7f7f7 - max-height: rem(400px) - overflow-y: auto - - .subcategory-container - &.hide - display: none - opacity: 0 - - & h2 - font-size: rem($font-size) - font-weight: bold - margin-bottom: 16px - - .divider - border-bottom: 1px solid #e5e5e5 - margin: rem(16px) 0 - - .search-tag__item - background: #eaeaea; - -.search - width: 100% - position: relative - display: flex - -.search > input - width: 100% - border: 1px solid #cccccc - border-right: none - padding: 5px - height: 36px - outline: none - color: #000000 - -.search > button - width: 40px - height: 36px - border: 1px solid #00B4CC - background: #00B4CC - text-align: center - color: #fff - cursor: pointer - font-size: 20px - -.search > div - position: absolute - right: 50px - top: 8px +.page--problem_main +.page--problem_category + .col--checkbox + width: rem(61px) + + .col--pid + width: rem(81px) + + .col--status + width: rem(140px) + position: relative + border-right: 1px solid $table-border-color + + .col--difficulty + width: rem(70px) + text-align: center + + &[lang="en"] + .col--difficulty + width: rem(95px) + + .col--ac-tried + width: rem(100px) + text-align: center + border-left: 1px solid $table-border-color + + +mobile() + .col--status, + .col--tried, + .col--difficulty + display: none + + .col--ac + border-left: 1px solid $table-border-color + + +.widget--category-filter + &__category + margin-bottom: rem(6px) + + &__drop + position: relative + font-size: rem($font-size-small) + width: rem(230px) + padding: rem(10px) + margin-right: rem(10px) + background: $menu-drop-bg-color + box-shadow: $menu-drop-shadow + + &:before + content: '' + display: block + position: absolute + width: 0 + height: 0 + border: rem($menu-drop-triangle-size) solid transparent + border-top-color: #FFF + border-left-color: #FFF + box-shadow: $menu-drop-triangle-shadow + transform: rotate(135deg) + transform-origin: 0 0 + pointer-events: none + left: 100% + top: 50% + margin-left: rem(floor($menu-drop-triangle-size * 1.414)) + + &__subcategory + margin: rem(2px) + display: inline-block + + &__tag + display: inline-block + padding: rem(5px 6px) + + &:hover + color: #FFF + background: $primary-color + text-decoration: none + + &.selected + color: #FFF + background: $secondary-color + +.drop-target-attached-right .widget--category-filter__drop + margin-right: 0 + margin-left: rem(10px) + + &:before + transform-origin: 100% 0 + transform: rotate(-45deg) + left: auto + right: 100% + margin-left: 0 + margin-right: 0 + margin-top: rem(floor($menu-drop-triangle-size * -1.414)) + + +.display-mode .display-mode-hide, +.edit-mode .edit-mode-hide, +.hide-problem-tag .notag--hide, +.tag--hide + display: none + +.hide-problem-tag .tag--hide + display: block + +.toggle-tag + float: right + +.data-table > tbody > tr + height: 40.15px + +.data-table > thead > tr + height: 54.9px + +.search-container + padding-bottom: 0 + + .title + margin-bottom: rem(5px) + + .dialog-button + font-size: rem($font-size-secondary) + display: inline-block + padding: rem(5px 6px) + margin-bottom: rem(5px) + +.search-tag__item + display: inline-block + padding: rem(5px 6px) + font-size: rem($font-size-secondary) + margin-bottom: rem(5px) + + &:hover + color: #555; + background: #f4f4f4; + text-decoration: none + + &.selected + color: #FFF + background: $primary-color !important + + &.hide + display: none + opacity: 0 + +.category-filter__header + [data-category-container].list + overflow-x: auto + + .list + .list__item + padding: 12px 12px + cursor: pointer + margin: 0px 10px + background: #eeeff3 + min-width: 90px + text-align: center + position: relative + + &.selected + background: $primary-color + color: #FFF + font-weight: bold + + .list__item::first + margin-left: 0px + +.category-filter__body + margin: 12px 10px 0 10px + background: #f7f7f7 + max-height: rem(400px) + overflow-y: auto + + .subcategory-container + &.hide + display: none + opacity: 0 + + & h2 + font-size: rem($font-size) + font-weight: bold + margin-bottom: 16px + + .divider + border-bottom: 1px solid #e5e5e5 + margin: rem(16px) 0 + + .search-tag__item + background: #eaeaea; + +.search + width: 100% + position: relative + display: flex + +.search > input + width: 100% + border: 1px solid #cccccc + border-right: none + padding: 5px + height: 36px + outline: none + color: #000000 + +.search > button + width: 40px + height: 36px + border: 1px solid #00B4CC + background: #00B4CC + text-align: center + color: #fff + cursor: pointer + font-size: 20px + +.search > div + position: absolute + right: 50px + top: 8px font-size: rem(17px) \ No newline at end of file diff --git a/packages/ui-default/pages/problem_main.page.ts b/packages/ui-default/pages/problem_main.page.ts index 249cd5b375..6cbdeae2d1 100644 --- a/packages/ui-default/pages/problem_main.page.ts +++ b/packages/ui-default/pages/problem_main.page.ts @@ -1,348 +1,348 @@ -import parser, { SearchParserResult } from '@hydrooj/utils/lib/search'; -import $ from 'jquery'; -import _ from 'lodash'; -import DomainSelectAutoComplete from 'vj/components/autocomplete/DomainSelectAutoComplete'; -import { ActionDialog, ConfirmDialog, Dialog } from 'vj/components/dialog'; -import Dropdown from 'vj/components/dropdown/Dropdown'; -import createHint from 'vj/components/hint'; -import Notification from 'vj/components/notification'; -import { downloadProblemSet } from 'vj/components/zipDownloader'; -import { NamedPage } from 'vj/misc/Page'; -import { - delay, i18n, pjax, request, tpl, -} from 'vj/utils'; - -const list = []; -const filterTags = {}; -const pinned: Record = { category: [], difficulty: [] }; -const selections = { category: {}, difficulty: {} }; -const selectedTags: Record = { category: [], difficulty: [] }; - -function setDomSelected($dom, selected, icon?) { - if (selected) { - $dom.addClass('selected'); - if (icon) $dom.append(icon); - } else { - $dom.removeClass('selected'); - if (icon) $dom.find('span').remove(); - } -} - -const parserOptions = { - keywords: ['category', 'difficulty'], - offsets: true, - alwaysArray: true, - tokenize: true, -}; - -function writeSelectionToInput() { - const currentValue = $('[name="q"]').val() as string; - const parsedCurrentValue = parser.parse(currentValue, parserOptions) as SearchParserResult; - const q = parser.stringify({ - ...parsedCurrentValue, - category: selectedTags.category, - difficulty: selectedTags.difficulty, - text: parsedCurrentValue.text, - }, parserOptions); - $('[name="q"]').val(q); -} - -function updateSelection() { - selectedTags.category = _.uniq(selectedTags.category); - for (const type in selections) { - for (const selection in selections[type]) { - const item = selections[type][selection]; - const shouldSelect = selectedTags[type].includes(selection); - const isSelected = (item.$tag || item.$legacy).hasClass('selected'); - let childSelected = false; - for (const subcategory in item.children) { - const childShouldSelect = selectedTags[type].includes(subcategory); - const childIsSelected = item.children[subcategory].$tag.hasClass('selected'); - childSelected ||= childShouldSelect; - if (childIsSelected !== childShouldSelect) setDomSelected(item.children[subcategory].$tag, childShouldSelect); - } - if (item.$legacy) setDomSelected(item.$legacy, (shouldSelect || childSelected)); - if (isSelected !== shouldSelect) { - if (pinned[type].includes(selection)) { - setDomSelected(item.$tag, shouldSelect, ''); - } else { - if (item.$tag) setDomSelected(item.$tag, shouldSelect, ''); - for (const $element of item.$phantom) { - if (shouldSelect) $($element).removeClass('hide'); - else $($element).addClass('hide'); - } - } - } - } - } -} - -function loadQuery() { - const q = $('[name="q"]').val().toString(); - const url = new URL(window.location.href); - if (!q) url.searchParams.delete('q'); - else url.searchParams.set('q', q); - url.searchParams.delete('page'); - pjax.request({ url: url.toString() }); -} - -function handleTagSelected(ev) { - if (ev.shiftKey || ev.metaKey || ev.ctrlKey) return; - let [type, selection] = ['category', $(ev.currentTarget).text()]; - if ($(ev.currentTarget).attr('data-selection')) [type, selection] = $(ev.currentTarget).attr('data-selection').split(':'); - const category = $(ev.currentTarget).attr('data-category'); - const filterType = $(ev.currentTarget).attr('data-filter'); - const treeItem = category ? selections[type][category].children[selection] : selections[type][selection]; - const shouldSelect = !(treeItem.$tag || treeItem.$legacy).hasClass('selected'); - if (shouldSelect) { - if (filterType) selectedTags[type] = _.without(selectedTags[type], ...filterTags[filterType]); - selectedTags[type].push(selection); - } else selectedTags[type] = _.without(selectedTags[type], selection, ...(category ? [] : Object.keys(treeItem.children))); - updateSelection(); - writeSelectionToInput(); - loadQuery(); - ev.preventDefault(); -} - -function buildLegacyCategoryFilter() { - const $container = $('[data-widget-cf-container]'); - if (!$container) return; - $container.attr('class', 'widget--category-filter row small-up-3 medium-up-2'); - for (const category of $container.children('li').get()) { - const $category = $(category) - .attr('class', 'widget--category-filter__category column'); - const $categoryTag = $category - .find('.section__title a') - .remove() - .attr('class', 'widget--category-filter__tag'); - const categoryText = $categoryTag.text(); - const $drop = $category - .children('.chip-list') - .remove() - .attr('class', 'widget--category-filter__drop'); - if (selections.category[categoryText]) { - selections.category[categoryText].$legacy = $categoryTag; - } else { - selections.category[categoryText] = { - $legacy: $categoryTag, - $tag: null, - children: {}, - $phantom: [], - }; - } - $category.empty().append($categoryTag); - if ($drop.length > 0) { - $categoryTag.text(`${$categoryTag.text()}`); - const $subCategoryTags = $drop - .children('li') - .attr('class', 'widget--category-filter__subcategory') - .find('a') - .attr('class', 'widget--category-filter__tag') - .attr('data-category', categoryText); - for (const subCategoryTag of $subCategoryTags.get()) { - const $tag = $(subCategoryTag); - selections.category[categoryText].children[$tag.text()] = { - $tag, - }; - } - Dropdown.getOrConstruct($categoryTag, { - target: $drop[0], - position: 'left center', - }); - } - } - list.push(...Object.keys(selections.category)); - list.push(..._.flatMap(Object.values(selections.category), (c: any) => Object.keys(c.children))); - $(document).on('click', '.widget--category-filter__tag', (ev) => handleTagSelected(ev)); -} - -function parseCategorySelection() { - const parsed = parser.parse($('[name="q"]').val() as string || '', parserOptions) as SearchParserResult; - selectedTags.category = _.uniq(parsed.category || []); - selectedTags.difficulty = _.uniq(parsed.difficulty || []); -} - -function ensureAndGetSelectedPids() { - const pids = _.map( - $('tbody [data-checkbox-group="problem"]:checked'), - (ch) => $(ch).closest('tr').attr('data-pid'), - ); - if (pids.length === 0) { - Notification.error(i18n('Please select at least one problem to perform this operation.')); - return null; - } - return pids; -} - -async function handleOperation(operation) { - const pids = ensureAndGetSelectedPids(); - if (pids === null) return; - const payload: any = {}; - if (operation === 'delete') { - const action = await new ConfirmDialog({ - $body: tpl.typoMsg(i18n('Confirm to delete the selected problems?')), - }).open(); - if (action !== 'yes') return; - } else if (operation === 'copy') { - $(tpl` - - `).appendTo(document.body); - const domainSelector: any = DomainSelectAutoComplete.getOrConstruct($('.dialog__body--problem-copy [name="target"]')); - const copyDialog = await new ActionDialog({ - $body: $('.dialog__body--problem-copy > div'), - onDispatch(action) { - if (action === 'ok' && domainSelector.value() === null) { - domainSelector.focus(); - return false; - } - return true; - }, - }).open(); - if (copyDialog !== 'ok') return; - const target = $('[name="target"]').val(); - if (!target) return; - payload.target = target; - } - try { - await request.post('', { operation, pids, ...payload }); - Notification.success(i18n(`Selected problems have been ${operation === 'copy' ? 'copie' : operation}d.`)); - await delay(2000); - loadQuery(); - } catch (error) { - Notification.error(error.message); - } -} - -function hideTags(target) { - for (const i of $(target).find('.problem__tag').get()) { - if (list.includes(i.children[0].innerHTML)) $(i).addClass('notag--hide'); - } -} - -const categoryDialog: any = new Dialog({ - $body: $('.dialog--category-filter > div'), - cancelByClickingBack: true, - cancelByEsc: true, -}); - -categoryDialog.clear = function () { - const $dataCategoryContainer = this.$dom.find('[data-category-container]'); - $dataCategoryContainer.children().addClass('hide'); - const first = $dataCategoryContainer.children().first(); - setDomSelected(first, true); - this.$dom.find('[data-subcategory-container]').addClass('hide'); - this.$dom.find(`[data-subcategory-container="${first.attr('data-category')}"]`).removeClass('hide'); - return this; -}; - -function buildSearchContainer() { - $('[data-pinned-container] [data-selection]').each((_index, _element) => { - const [type, selection] = $(_element).attr('data-selection').split(':'); - const filterType = $(_element).attr('data-filter'); - pinned[type].push(selection); - if (filterType) { - filterTags[filterType] ||= []; - filterTags[filterType].push(selection); - } - selections[type][selection] = { - $tag: $(_element), - children: {}, - }; - }); - - categoryDialog.$dom.find('.subcategory__all .search-tag__item').each((_index, _element) => { - const [, subcategory] = $(_element).attr('data-selection').split(':'); - selections.category[subcategory] = { - $tag: $(_element), - children: {}, - $phantom: [ - ...categoryDialog.$dom.find(`.subcategory__selected .search-tag__item[data-selection="category:${subcategory}"]`).get(), - ...$(`.subcategory-container__selected .search-tag__item[data-selection="category:${subcategory}"]`).get(), - ], - }; - }); - - $(document).on('click', '[data-category-container] [data-category]', (ev) => { - $('[data-category-container] [data-category]').removeClass('selected'); - $(ev.currentTarget).addClass('selected'); - $('[data-subcategory-container]').addClass('hide'); - $(`[data-subcategory-container="${$(ev.currentTarget).attr('data-category')}"]`).removeClass('hide'); - }); - - $(document).on('click', '.search-tag__item', (ev) => handleTagSelected(ev)); -} - -async function handleDownload(ev) { - let name = 'Export'; - // eslint-disable-next-line no-alert - if (ev.shiftKey) name = prompt(i18n('Filename'), name); - const pids = ensureAndGetSelectedPids(); - if (pids) await downloadProblemSet(pids, name); -} - -function processElement(ele) { - hideTags(ele); - createHint('Hint::icon::difficulty', $(ele).find('th.col--difficulty')); -} - -const page = new NamedPage(['problem_main'], () => { - const $body = $('body'); - $body.addClass('display-mode'); - $('.section.display-mode').removeClass('display-mode'); - - buildSearchContainer(); - buildLegacyCategoryFilter(); - parseCategorySelection(); - updateSelection(); - $(document).on('click', '[name="leave-edit-mode"]', () => { - $body.removeClass('edit-mode').addClass('display-mode'); - }); - $(document).on('click', '[name="enter-edit-mode"]', () => { - $body.removeClass('display-mode').addClass('edit-mode'); - }); - for (const op of ['delete', 'hide', 'unhide', 'copy']) { - $(document).on('click', `[name="${op}_selected_problems"]`, () => handleOperation(op)); - } - $(document).on('click', '[name="download_selected_problems"]', handleDownload); - - $(document).on('click', '.toggle-tag', () => { - $('.section__table-container').children().toggleClass('hide-problem-tag'); - }); - function inputChanged() { - parseCategorySelection(); - updateSelection(); - loadQuery(); - } - $('#search').on('click', (ev) => { - ev.preventDefault(); - inputChanged(); - }); - $('#searchForm').on('submit', inputChanged); - $('#searchForm').find('input').on('input', _.debounce(inputChanged, 500)); - $('.dialog-button').on('click', (ev) => { - categoryDialog.clear().open(); - ev.preventDefault(); - }); - $(document).on('click', 'a.pager__item', (ev) => { - ev.preventDefault(); - pjax.request(ev.currentTarget.getAttribute('href')).then(() => window.scrollTo(0, 0)); - }); - $(document).on('vjContentNew', (e) => processElement(e.target)); - processElement(document); -}); - -export default page; +import parser, { SearchParserResult } from '@hydrooj/utils/lib/search'; +import $ from 'jquery'; +import _ from 'lodash'; +import DomainSelectAutoComplete from 'vj/components/autocomplete/DomainSelectAutoComplete'; +import { ActionDialog, ConfirmDialog, Dialog } from 'vj/components/dialog'; +import Dropdown from 'vj/components/dropdown/Dropdown'; +import createHint from 'vj/components/hint'; +import Notification from 'vj/components/notification'; +import { downloadProblemSet } from 'vj/components/zipDownloader'; +import { NamedPage } from 'vj/misc/Page'; +import { + delay, i18n, pjax, request, tpl, +} from 'vj/utils'; + +const list = []; +const filterTags = {}; +const pinned: Record = { category: [], difficulty: [] }; +const selections = { category: {}, difficulty: {} }; +const selectedTags: Record = { category: [], difficulty: [] }; + +function setDomSelected($dom, selected, icon?) { + if (selected) { + $dom.addClass('selected'); + if (icon) $dom.append(icon); + } else { + $dom.removeClass('selected'); + if (icon) $dom.find('span').remove(); + } +} + +const parserOptions = { + keywords: ['category', 'difficulty'], + offsets: true, + alwaysArray: true, + tokenize: true, +}; + +function writeSelectionToInput() { + const currentValue = $('[name="q"]').val() as string; + const parsedCurrentValue = parser.parse(currentValue, parserOptions) as SearchParserResult; + const q = parser.stringify({ + ...parsedCurrentValue, + category: selectedTags.category, + difficulty: selectedTags.difficulty, + text: parsedCurrentValue.text, + }, parserOptions); + $('[name="q"]').val(q); +} + +function updateSelection() { + selectedTags.category = _.uniq(selectedTags.category); + for (const type in selections) { + for (const selection in selections[type]) { + const item = selections[type][selection]; + const shouldSelect = selectedTags[type].includes(selection); + const isSelected = (item.$tag || item.$legacy).hasClass('selected'); + let childSelected = false; + for (const subcategory in item.children) { + const childShouldSelect = selectedTags[type].includes(subcategory); + const childIsSelected = item.children[subcategory].$tag.hasClass('selected'); + childSelected ||= childShouldSelect; + if (childIsSelected !== childShouldSelect) setDomSelected(item.children[subcategory].$tag, childShouldSelect); + } + if (item.$legacy) setDomSelected(item.$legacy, (shouldSelect || childSelected)); + if (isSelected !== shouldSelect) { + if (pinned[type].includes(selection)) { + setDomSelected(item.$tag, shouldSelect, ''); + } else { + if (item.$tag) setDomSelected(item.$tag, shouldSelect, ''); + for (const $element of item.$phantom) { + if (shouldSelect) $($element).removeClass('hide'); + else $($element).addClass('hide'); + } + } + } + } + } +} + +function loadQuery() { + const q = $('[name="q"]').val().toString(); + const url = new URL(window.location.href); + if (!q) url.searchParams.delete('q'); + else url.searchParams.set('q', q); + url.searchParams.delete('page'); + pjax.request({ url: url.toString() }); +} + +function handleTagSelected(ev) { + if (ev.shiftKey || ev.metaKey || ev.ctrlKey) return; + let [type, selection] = ['category', $(ev.currentTarget).text()]; + if ($(ev.currentTarget).attr('data-selection')) [type, selection] = $(ev.currentTarget).attr('data-selection').split(':'); + const category = $(ev.currentTarget).attr('data-category'); + const filterType = $(ev.currentTarget).attr('data-filter'); + const treeItem = category ? selections[type][category].children[selection] : selections[type][selection]; + const shouldSelect = !(treeItem.$tag || treeItem.$legacy).hasClass('selected'); + if (shouldSelect) { + if (filterType) selectedTags[type] = _.without(selectedTags[type], ...filterTags[filterType]); + selectedTags[type].push(selection); + } else selectedTags[type] = _.without(selectedTags[type], selection, ...(category ? [] : Object.keys(treeItem.children))); + updateSelection(); + writeSelectionToInput(); + loadQuery(); + ev.preventDefault(); +} + +function buildLegacyCategoryFilter() { + const $container = $('[data-widget-cf-container]'); + if (!$container) return; + $container.attr('class', 'widget--category-filter row small-up-3 medium-up-2'); + for (const category of $container.children('li').get()) { + const $category = $(category) + .attr('class', 'widget--category-filter__category column'); + const $categoryTag = $category + .find('.section__title a') + .remove() + .attr('class', 'widget--category-filter__tag'); + const categoryText = $categoryTag.text(); + const $drop = $category + .children('.chip-list') + .remove() + .attr('class', 'widget--category-filter__drop'); + if (selections.category[categoryText]) { + selections.category[categoryText].$legacy = $categoryTag; + } else { + selections.category[categoryText] = { + $legacy: $categoryTag, + $tag: null, + children: {}, + $phantom: [], + }; + } + $category.empty().append($categoryTag); + if ($drop.length > 0) { + $categoryTag.text(`${$categoryTag.text()}`); + const $subCategoryTags = $drop + .children('li') + .attr('class', 'widget--category-filter__subcategory') + .find('a') + .attr('class', 'widget--category-filter__tag') + .attr('data-category', categoryText); + for (const subCategoryTag of $subCategoryTags.get()) { + const $tag = $(subCategoryTag); + selections.category[categoryText].children[$tag.text()] = { + $tag, + }; + } + Dropdown.getOrConstruct($categoryTag, { + target: $drop[0], + position: 'left center', + }); + } + } + list.push(...Object.keys(selections.category)); + list.push(..._.flatMap(Object.values(selections.category), (c: any) => Object.keys(c.children))); + $(document).on('click', '.widget--category-filter__tag', (ev) => handleTagSelected(ev)); +} + +function parseCategorySelection() { + const parsed = parser.parse($('[name="q"]').val() as string || '', parserOptions) as SearchParserResult; + selectedTags.category = _.uniq(parsed.category || []); + selectedTags.difficulty = _.uniq(parsed.difficulty || []); +} + +function ensureAndGetSelectedPids() { + const pids = _.map( + $('tbody [data-checkbox-group="problem"]:checked'), + (ch) => $(ch).closest('tr').attr('data-pid'), + ); + if (pids.length === 0) { + Notification.error(i18n('Please select at least one problem to perform this operation.')); + return null; + } + return pids; +} + +async function handleOperation(operation) { + const pids = ensureAndGetSelectedPids(); + if (pids === null) return; + const payload: any = {}; + if (operation === 'delete') { + const action = await new ConfirmDialog({ + $body: tpl.typoMsg(i18n('Confirm to delete the selected problems?')), + }).open(); + if (action !== 'yes') return; + } else if (operation === 'copy') { + $(tpl` + + `).appendTo(document.body); + const domainSelector: any = DomainSelectAutoComplete.getOrConstruct($('.dialog__body--problem-copy [name="target"]')); + const copyDialog = await new ActionDialog({ + $body: $('.dialog__body--problem-copy > div'), + onDispatch(action) { + if (action === 'ok' && domainSelector.value() === null) { + domainSelector.focus(); + return false; + } + return true; + }, + }).open(); + if (copyDialog !== 'ok') return; + const target = $('[name="target"]').val(); + if (!target) return; + payload.target = target; + } + try { + await request.post('', { operation, pids, ...payload }); + Notification.success(i18n(`Selected problems have been ${operation === 'copy' ? 'copie' : operation}d.`)); + await delay(2000); + loadQuery(); + } catch (error) { + Notification.error(error.message); + } +} + +function hideTags(target) { + for (const i of $(target).find('.problem__tag').get()) { + if (list.includes(i.children[0].innerHTML)) $(i).addClass('notag--hide'); + } +} + +const categoryDialog: any = new Dialog({ + $body: $('.dialog--category-filter > div'), + cancelByClickingBack: true, + cancelByEsc: true, +}); + +categoryDialog.clear = function () { + const $dataCategoryContainer = this.$dom.find('[data-category-container]'); + $dataCategoryContainer.children().addClass('hide'); + const first = $dataCategoryContainer.children().first(); + setDomSelected(first, true); + this.$dom.find('[data-subcategory-container]').addClass('hide'); + this.$dom.find(`[data-subcategory-container="${first.attr('data-category')}"]`).removeClass('hide'); + return this; +}; + +function buildSearchContainer() { + $('[data-pinned-container] [data-selection]').each((_index, _element) => { + const [type, selection] = $(_element).attr('data-selection').split(':'); + const filterType = $(_element).attr('data-filter'); + pinned[type].push(selection); + if (filterType) { + filterTags[filterType] ||= []; + filterTags[filterType].push(selection); + } + selections[type][selection] = { + $tag: $(_element), + children: {}, + }; + }); + + categoryDialog.$dom.find('.subcategory__all .search-tag__item').each((_index, _element) => { + const [, subcategory] = $(_element).attr('data-selection').split(':'); + selections.category[subcategory] = { + $tag: $(_element), + children: {}, + $phantom: [ + ...categoryDialog.$dom.find(`.subcategory__selected .search-tag__item[data-selection="category:${subcategory}"]`).get(), + ...$(`.subcategory-container__selected .search-tag__item[data-selection="category:${subcategory}"]`).get(), + ], + }; + }); + + $(document).on('click', '[data-category-container] [data-category]', (ev) => { + $('[data-category-container] [data-category]').removeClass('selected'); + $(ev.currentTarget).addClass('selected'); + $('[data-subcategory-container]').addClass('hide'); + $(`[data-subcategory-container="${$(ev.currentTarget).attr('data-category')}"]`).removeClass('hide'); + }); + + $(document).on('click', '.search-tag__item', (ev) => handleTagSelected(ev)); +} + +async function handleDownload(ev) { + let name = 'Export'; + // eslint-disable-next-line no-alert + if (ev.shiftKey) name = prompt(i18n('Filename'), name); + const pids = ensureAndGetSelectedPids(); + if (pids) await downloadProblemSet(pids, name); +} + +function processElement(ele) { + hideTags(ele); + createHint('Hint::icon::difficulty', $(ele).find('th.col--difficulty')); +} + +const page = new NamedPage(['problem_main'], () => { + const $body = $('body'); + $body.addClass('display-mode'); + $('.section.display-mode').removeClass('display-mode'); + + buildSearchContainer(); + buildLegacyCategoryFilter(); + parseCategorySelection(); + updateSelection(); + $(document).on('click', '[name="leave-edit-mode"]', () => { + $body.removeClass('edit-mode').addClass('display-mode'); + }); + $(document).on('click', '[name="enter-edit-mode"]', () => { + $body.removeClass('display-mode').addClass('edit-mode'); + }); + for (const op of ['delete', 'hide', 'unhide', 'copy']) { + $(document).on('click', `[name="${op}_selected_problems"]`, () => handleOperation(op)); + } + $(document).on('click', '[name="download_selected_problems"]', handleDownload); + + $(document).on('click', '.toggle-tag', () => { + $('.section__table-container').children().toggleClass('hide-problem-tag'); + }); + function inputChanged() { + parseCategorySelection(); + updateSelection(); + loadQuery(); + } + $('#search').on('click', (ev) => { + ev.preventDefault(); + inputChanged(); + }); + $('#searchForm').on('submit', inputChanged); + $('#searchForm').find('input').on('input', _.debounce(inputChanged, 500)); + $('.dialog-button').on('click', (ev) => { + categoryDialog.clear().open(); + ev.preventDefault(); + }); + $(document).on('click', 'a.pager__item', (ev) => { + ev.preventDefault(); + pjax.request(ev.currentTarget.getAttribute('href')).then(() => window.scrollTo(0, 0)); + }); + $(document).on('vjContentNew', (e) => processElement(e.target)); + processElement(document); +}); + +export default page; diff --git a/packages/ui-default/pages/problem_sidebar.page.ts b/packages/ui-default/pages/problem_sidebar.page.ts index c564b78cca..d0f7e88790 100644 --- a/packages/ui-default/pages/problem_sidebar.page.ts +++ b/packages/ui-default/pages/problem_sidebar.page.ts @@ -1,68 +1,68 @@ -import $ from 'jquery'; -import DomainSelectAutoComplete from 'vj/components/autocomplete/DomainSelectAutoComplete'; -import { ActionDialog, ConfirmDialog } from 'vj/components/dialog'; -import Notification from 'vj/components/notification'; -import { NamedPage } from 'vj/misc/Page'; -import { i18n, request, tpl } from 'vj/utils'; - -const page = new NamedPage([ - 'problem_create', 'problem_edit', 'problem_solution', 'problem_submit', - 'problem_files', 'problem_detail', 'discussion_node', 'discussion_detail', -], () => { - $(document).on('click', '[name="problem-sidebar__show-category"]', (ev) => { - $(ev.currentTarget).hide(); - $('[name="problem-sidebar__categories"]').show(); - }); - $(document).on('click', '[name="problem-sidebar__rejudge"]', (ev) => { - ev.preventDefault(); - new ConfirmDialog({ - $body: tpl.typoMsg(i18n('Confirm rejudge this problem?')), - }).open().then((action) => { - if (action !== 'yes') return; - $(ev.currentTarget).closest('form').trigger('submit'); - }); - }); - $(document).on('click', '[name="problem-sidebar__copy"]', () => { - $(tpl``).appendTo(document.body); - const domainSelector = DomainSelectAutoComplete.getOrConstruct($('.dialog__body--problem-copy [name="target"]')) as any; - new ActionDialog({ - $body: $('.dialog__body--problem-copy > div'), - onDispatch(action) { - if (action === 'ok' && domainSelector.value() === null) { - domainSelector.focus(); - return false; - } - return true; - }, - }).open().then(async (action) => { - if (action !== 'ok') return; - const target = $('[name="target"]').val(); - if (!target) return; - try { - const res = await request.post('', { - operation: 'copy', - target, - }); - window.location.href = res.url; - } catch (error) { - Notification.error(error.message); - } - }); - }); -}); - -export default page; +import $ from 'jquery'; +import DomainSelectAutoComplete from 'vj/components/autocomplete/DomainSelectAutoComplete'; +import { ActionDialog, ConfirmDialog } from 'vj/components/dialog'; +import Notification from 'vj/components/notification'; +import { NamedPage } from 'vj/misc/Page'; +import { i18n, request, tpl } from 'vj/utils'; + +const page = new NamedPage([ + 'problem_create', 'problem_edit', 'problem_solution', 'problem_submit', + 'problem_files', 'problem_detail', 'discussion_node', 'discussion_detail', +], () => { + $(document).on('click', '[name="problem-sidebar__show-category"]', (ev) => { + $(ev.currentTarget).hide(); + $('[name="problem-sidebar__categories"]').show(); + }); + $(document).on('click', '[name="problem-sidebar__rejudge"]', (ev) => { + ev.preventDefault(); + new ConfirmDialog({ + $body: tpl.typoMsg(i18n('Confirm rejudge this problem?')), + }).open().then((action) => { + if (action !== 'yes') return; + $(ev.currentTarget).closest('form').trigger('submit'); + }); + }); + $(document).on('click', '[name="problem-sidebar__copy"]', () => { + $(tpl``).appendTo(document.body); + const domainSelector = DomainSelectAutoComplete.getOrConstruct($('.dialog__body--problem-copy [name="target"]')) as any; + new ActionDialog({ + $body: $('.dialog__body--problem-copy > div'), + onDispatch(action) { + if (action === 'ok' && domainSelector.value() === null) { + domainSelector.focus(); + return false; + } + return true; + }, + }).open().then(async (action) => { + if (action !== 'ok') return; + const target = $('[name="target"]').val(); + if (!target) return; + try { + const res = await request.post('', { + operation: 'copy', + target, + }); + window.location.href = res.url; + } catch (error) { + Notification.error(error.message); + } + }); + }); +}); + +export default page; diff --git a/packages/ui-default/pages/problem_statistics.page.styl b/packages/ui-default/pages/problem_statistics.page.styl index 5f897d632a..86e95d9d14 100644 --- a/packages/ui-default/pages/problem_statistics.page.styl +++ b/packages/ui-default/pages/problem_statistics.page.styl @@ -1,14 +1,14 @@ -.page--problem_statistics - .col--status - width: rem(80px) - - .col--submit-at - width: rem(160px) - text-align: center - - .col--time, .col--memory, .col--lang, .col--code - width: rem(85px) - text-align: center - - .col--status, .col--submit-by, .col--code +.page--problem_statistics + .col--status + width: rem(80px) + + .col--submit-at + width: rem(160px) + text-align: center + + .col--time, .col--memory, .col--lang, .col--code + width: rem(85px) + text-align: center + + .col--status, .col--submit-by, .col--code border-right: 1px solid $table-border-color \ No newline at end of file diff --git a/packages/ui-default/pages/problem_statistics.page.ts b/packages/ui-default/pages/problem_statistics.page.ts index 2f6a10f72c..b333227ed2 100644 --- a/packages/ui-default/pages/problem_statistics.page.ts +++ b/packages/ui-default/pages/problem_statistics.page.ts @@ -1,69 +1,69 @@ -import { getScoreColor } from '@hydrooj/utils/lib/status'; -import $ from 'jquery'; -import { NamedPage } from 'vj/misc/Page'; -import { getAvailableLangs, tpl } from 'vj/utils'; - -const page = new NamedPage('problem_statistics', () => { - async function initChart() { - if (!Object.keys(UiContext.pdoc.stats || {}).length) { - $('#submission-status-placeholder').parent().hide(); - return; - } - const echarts = await import('echarts'); - const $status = document.getElementById('submission-status-placeholder'); - const statusChart = echarts.init($status); - statusChart.setOption({ - tooltip: { trigger: 'item' }, - series: [ - { - name: 'Submissions', - type: 'pie', - radius: '70%', - label: { show: false }, - labelLine: { show: false }, - data: [ - { value: UiContext.pdoc.stats.TLE, name: 'TLE' }, - { value: UiContext.pdoc.stats.AC, name: 'AC' }, - { value: UiContext.pdoc.stats.MLE, name: 'MLE' }, - { value: UiContext.pdoc.stats.WA, name: 'WA' }, - { value: UiContext.pdoc.stats.RE, name: 'RE' }, - { value: UiContext.pdoc.stats.CE, name: 'CE' }, - ], - }, - ], - }); - const $score = document.getElementById('submission-score-placeholder'); - const x = Array.from({ length: 101 }, (v, i) => i).filter((i) => UiContext.pdoc.stats[`s${i}`]); - const scoreChart = echarts.init($score); - scoreChart.setOption({ - tooltip: { trigger: 'item' }, - xAxis: { data: x }, - yAxis: {}, - series: [{ - data: x.map((i) => ({ - value: UiContext.pdoc.stats[`s${i}`], - itemStyle: { color: getScoreColor(i) }, - })), - type: 'bar', - }], - }); - - window.onresize = function () { - statusChart.resize(); - scoreChart.resize(); - }; - if (UiContext.pdoc.config?.type === 'objective') $($status).hide(); - } - - const availableLangs = getAvailableLangs(UiContext.pdoc.config.langs); - Object.keys(availableLangs).map( - (i) => ($('select[name="lang"]').append(tpl``))); - const lang = new URL(window.location.href).searchParams.get('lang'); - if (lang) $('select[name="lang"]').val(lang); - initChart(); - $('[name="filter-form"] select').on('change', () => { - $('[name="filter-form"]').trigger('submit'); - }); -}); - -export default page; +import { getScoreColor } from '@hydrooj/utils/lib/status'; +import $ from 'jquery'; +import { NamedPage } from 'vj/misc/Page'; +import { getAvailableLangs, tpl } from 'vj/utils'; + +const page = new NamedPage('problem_statistics', () => { + async function initChart() { + if (!Object.keys(UiContext.pdoc.stats || {}).length) { + $('#submission-status-placeholder').parent().hide(); + return; + } + const echarts = await import('echarts'); + const $status = document.getElementById('submission-status-placeholder'); + const statusChart = echarts.init($status); + statusChart.setOption({ + tooltip: { trigger: 'item' }, + series: [ + { + name: 'Submissions', + type: 'pie', + radius: '70%', + label: { show: false }, + labelLine: { show: false }, + data: [ + { value: UiContext.pdoc.stats.TLE, name: 'TLE' }, + { value: UiContext.pdoc.stats.AC, name: 'AC' }, + { value: UiContext.pdoc.stats.MLE, name: 'MLE' }, + { value: UiContext.pdoc.stats.WA, name: 'WA' }, + { value: UiContext.pdoc.stats.RE, name: 'RE' }, + { value: UiContext.pdoc.stats.CE, name: 'CE' }, + ], + }, + ], + }); + const $score = document.getElementById('submission-score-placeholder'); + const x = Array.from({ length: 101 }, (v, i) => i).filter((i) => UiContext.pdoc.stats[`s${i}`]); + const scoreChart = echarts.init($score); + scoreChart.setOption({ + tooltip: { trigger: 'item' }, + xAxis: { data: x }, + yAxis: {}, + series: [{ + data: x.map((i) => ({ + value: UiContext.pdoc.stats[`s${i}`], + itemStyle: { color: getScoreColor(i) }, + })), + type: 'bar', + }], + }); + + window.onresize = function () { + statusChart.resize(); + scoreChart.resize(); + }; + if (UiContext.pdoc.config?.type === 'objective') $($status).hide(); + } + + const availableLangs = getAvailableLangs(UiContext.pdoc.config.langs); + Object.keys(availableLangs).map( + (i) => ($('select[name="lang"]').append(tpl``))); + const lang = new URL(window.location.href).searchParams.get('lang'); + if (lang) $('select[name="lang"]').val(lang); + initChart(); + $('[name="filter-form"] select').on('change', () => { + $('[name="filter-form"]').trigger('submit'); + }); +}); + +export default page; diff --git a/packages/ui-default/pages/problem_submit.page.styl b/packages/ui-default/pages/problem_submit.page.styl index cb47c4c126..28c1a37343 100644 --- a/packages/ui-default/pages/problem_submit.page.styl +++ b/packages/ui-default/pages/problem_submit.page.styl @@ -1,12 +1,12 @@ -.page--problem_submit - .col--status - width: rem(150px) - - .col--submit-at - width: rem(160px) - text-align: center - - +mobile() - .col--memory, - .col--time - display: none +.page--problem_submit + .col--status + width: rem(150px) + + .col--submit-at + width: rem(160px) + text-align: center + + +mobile() + .col--memory, + .col--time + display: none diff --git a/packages/ui-default/pages/problem_submit.page.tsx b/packages/ui-default/pages/problem_submit.page.tsx index 7548af5ab6..b6b6b850e2 100644 --- a/packages/ui-default/pages/problem_submit.page.tsx +++ b/packages/ui-default/pages/problem_submit.page.tsx @@ -1,55 +1,55 @@ -import $ from 'jquery'; -import React from 'react'; -import ReactDOM from 'react-dom/client'; -import { renderLanguageSelect } from 'vj/components/languageselect'; -import { NamedPage } from 'vj/misc/Page'; -import { getAvailableLangs, i18n, tpl } from 'vj/utils'; - -const page = new NamedPage(['problem_submit', 'contest_detail_problem_submit', 'homework_detail_problem_submit'], async () => { - const { config } = UiContext.pdoc; - if (config.type === 'submit_answer') { - $('[name="lang"]').val('_'); - return; - } - const availableLangs = getAvailableLangs(config.langs); - const mainLangs = {}; - const preferences = [UserContext.codeLang || '']; - for (const key in availableLangs) { - if (config.langs && !config.langs.filter((i) => i === key || i.startsWith(`${key}.`)).length) continue; - if (window.LANGS[key].pretest === preferences[0]) preferences.push(key); - if (!key.includes('.')) mainLangs[key] = window.LANGS[key].display; - else { - const a = key.split('.')[0]; - mainLangs[a] = window.LANGS[a].display; - } - } - for (const key in availableLangs) { - if (config.langs && !config.langs.filter((i) => i === key || i.startsWith(`${key}.`)).length) continue; - if (window.LANGS[key].pretest?.split('.')[0] === preferences[0].split('.')[0]) preferences.push(key); - } - - renderLanguageSelect( - document.getElementById('codelang-selector'), - '[name="lang"]', - availableLangs, - mainLangs, - preferences, - ); - - if (localStorage.getItem('submit-hint') === 'dismiss') return; - $(tpl`
    `).prependTo('[name="submit_section"]'); - const root = ReactDOM.createRoot(document.querySelector('[name="hint"]')); - function ignore() { - root.unmount(); - localStorage.setItem('submit-hint', 'dismiss'); - } - - root.render(
    -

    {i18n('This page is only for pasting code from other sources.')}

    -

    {i18n("To get a better editing experience, with code highlighting and test runs, \ -please go back to the problem detail page and use 'Open Scratchpad' button.")}

    - root.unmount()}>{i18n('Dismiss')} / {i18n("Don't show again")} -
    ); -}); - -export default page; +import $ from 'jquery'; +import React from 'react'; +import ReactDOM from 'react-dom/client'; +import { renderLanguageSelect } from 'vj/components/languageselect'; +import { NamedPage } from 'vj/misc/Page'; +import { getAvailableLangs, i18n, tpl } from 'vj/utils'; + +const page = new NamedPage(['problem_submit', 'contest_detail_problem_submit', 'homework_detail_problem_submit'], async () => { + const { config } = UiContext.pdoc; + if (config.type === 'submit_answer') { + $('[name="lang"]').val('_'); + return; + } + const availableLangs = getAvailableLangs(config.langs); + const mainLangs = {}; + const preferences = [UserContext.codeLang || '']; + for (const key in availableLangs) { + if (config.langs && !config.langs.filter((i) => i === key || i.startsWith(`${key}.`)).length) continue; + if (window.LANGS[key].pretest === preferences[0]) preferences.push(key); + if (!key.includes('.')) mainLangs[key] = window.LANGS[key].display; + else { + const a = key.split('.')[0]; + mainLangs[a] = window.LANGS[a].display; + } + } + for (const key in availableLangs) { + if (config.langs && !config.langs.filter((i) => i === key || i.startsWith(`${key}.`)).length) continue; + if (window.LANGS[key].pretest?.split('.')[0] === preferences[0].split('.')[0]) preferences.push(key); + } + + renderLanguageSelect( + document.getElementById('codelang-selector'), + '[name="lang"]', + availableLangs, + mainLangs, + preferences, + ); + + if (localStorage.getItem('submit-hint') === 'dismiss') return; + $(tpl`
    `).prependTo('[name="submit_section"]'); + const root = ReactDOM.createRoot(document.querySelector('[name="hint"]')); + function ignore() { + root.unmount(); + localStorage.setItem('submit-hint', 'dismiss'); + } + + root.render(
    +

    {i18n('This page is only for pasting code from other sources.')}

    +

    {i18n("To get a better editing experience, with code highlighting and test runs, \ +please go back to the problem detail page and use 'Open Scratchpad' button.")}

    + root.unmount()}>{i18n('Dismiss')} / {i18n("Don't show again")} +
    ); +}); + +export default page; diff --git a/packages/ui-default/pages/ranking.page.styl b/packages/ui-default/pages/ranking.page.styl index 1fba732a7d..8c5e04e052 100644 --- a/packages/ui-default/pages/ranking.page.styl +++ b/packages/ui-default/pages/ranking.page.styl @@ -1,37 +1,37 @@ -.page--ranking, .page--homepage - .col--rank - width: rem(65px) - position: relative - - .col--user - width: rem(300px) - - .col--rp - width: rem(60px) - text-align: right - - .col--detail - width: rem(50px) - text-align: center - - &[lang="en"] - .col--detail - width: rem(75px) - - .col--ac - width: rem(50px) - text-align: center - - &[lang="en"] - .col--ac - width: rem(70px) - - .col--bio - display: block; - - td.col--bio - height: 36px !important; - - +mobile() - .col--bio, .col--detail - display: none +.page--ranking, .page--homepage + .col--rank + width: rem(65px) + position: relative + + .col--user + width: rem(300px) + + .col--rp + width: rem(60px) + text-align: right + + .col--detail + width: rem(50px) + text-align: center + + &[lang="en"] + .col--detail + width: rem(75px) + + .col--ac + width: rem(50px) + text-align: center + + &[lang="en"] + .col--ac + width: rem(70px) + + .col--bio + display: block; + + td.col--bio + height: 36px !important; + + +mobile() + .col--bio, .col--detail + display: none diff --git a/packages/ui-default/pages/record_detail.page.styl b/packages/ui-default/pages/record_detail.page.styl index ecbf1c6784..62b61b92fc 100644 --- a/packages/ui-default/pages/record_detail.page.styl +++ b/packages/ui-default/pages/record_detail.page.styl @@ -1,30 +1,30 @@ -.page--record_detail - - .compiler-text - padding: rem(20px 0) - font-size: rem($font-size-small) - &:empty - display: none - - .col--case - width: rem(70px) - - .col--memory, .col--time - width: rem(120px) - - .col--case, .col--status - border-right: 1px solid $table-border-color - - .subtask - background-color: #fff !important - height: rem(30px) - td - padding-top: 0 - padding-bottom: 0 - - +mobile() - .col--time - width: rem(70px) - - .col--memory - width: rem(100px) +.page--record_detail + + .compiler-text + padding: rem(20px 0) + font-size: rem($font-size-small) + &:empty + display: none + + .col--case + width: rem(70px) + + .col--memory, .col--time + width: rem(120px) + + .col--case, .col--status + border-right: 1px solid $table-border-color + + .subtask + background-color: #fff !important + height: rem(30px) + td + padding-top: 0 + padding-bottom: 0 + + +mobile() + .col--time + width: rem(70px) + + .col--memory + width: rem(100px) diff --git a/packages/ui-default/pages/record_detail.page.tsx b/packages/ui-default/pages/record_detail.page.tsx index 933b14787f..654d31a891 100644 --- a/packages/ui-default/pages/record_detail.page.tsx +++ b/packages/ui-default/pages/record_detail.page.tsx @@ -1,33 +1,33 @@ -import $ from 'jquery'; -import React from 'react'; -import { InfoDialog } from 'vj/components/dialog'; -import { NamedPage } from 'vj/misc/Page'; -import { tpl } from 'vj/utils'; - -export default new NamedPage('record_detail', async () => { - if (!UiContext.socketUrl) return; - const [{ default: WebSocket }, { DiffDOM }] = await Promise.all([ - import('../components/socket'), - import('diff-dom'), - ]); - - const sock = new WebSocket(UiContext.ws_prefix + UiContext.socketUrl, false, true); - const dd = new DiffDOM(); - sock.onmessage = (_, data) => { - const msg = JSON.parse(data); - const newStatus = $(msg.status_html); - const oldStatus = $('#status'); - dd.apply(oldStatus[0], dd.diff(oldStatus[0], newStatus[0])); - const newSummary = $(msg.summary_html); - const oldSummary = $('#summary'); - dd.apply(oldSummary[0], dd.diff(oldSummary[0], newSummary[0])); - if (typeof msg.status === 'number' && window.parent) window.parent.postMessage({ status: msg.status }); - }; - $(document).on('click', '.subtask-case', function () { - const data = $(this).find('.message').text(); - if (!data?.trim()) return; - new InfoDialog({ - $body: tpl(
    {data}
    ), - }).open(); - }); -}); +import $ from 'jquery'; +import React from 'react'; +import { InfoDialog } from 'vj/components/dialog'; +import { NamedPage } from 'vj/misc/Page'; +import { tpl } from 'vj/utils'; + +export default new NamedPage('record_detail', async () => { + if (!UiContext.socketUrl) return; + const [{ default: WebSocket }, { DiffDOM }] = await Promise.all([ + import('../components/socket'), + import('diff-dom'), + ]); + + const sock = new WebSocket(UiContext.ws_prefix + UiContext.socketUrl, false, true); + const dd = new DiffDOM(); + sock.onmessage = (_, data) => { + const msg = JSON.parse(data); + const newStatus = $(msg.status_html); + const oldStatus = $('#status'); + dd.apply(oldStatus[0], dd.diff(oldStatus[0], newStatus[0])); + const newSummary = $(msg.summary_html); + const oldSummary = $('#summary'); + dd.apply(oldSummary[0], dd.diff(oldSummary[0], newSummary[0])); + if (typeof msg.status === 'number' && window.parent) window.parent.postMessage({ status: msg.status }); + }; + $(document).on('click', '.subtask-case', function () { + const data = $(this).find('.message').text(); + if (!data?.trim()) return; + new InfoDialog({ + $body: tpl(
    {data}
    ), + }).open(); + }); +}); diff --git a/packages/ui-default/pages/record_main.page.styl b/packages/ui-default/pages/record_main.page.styl index db3fe79014..1ab41a21bf 100644 --- a/packages/ui-default/pages/record_main.page.styl +++ b/packages/ui-default/pages/record_main.page.styl @@ -1,55 +1,55 @@ -.page--record_main - .col--status - width: rem(170px) - position: relative - - .col--submit-at - width: rem(115px) - text-align: center - - &.nojs .col--submit-at - width: rem(160px) - - .col--submit-by - width: rem(200px) - text-align: right - - .col--time, .col--memory, .col--lang - width: rem(95px) - text-align: center - - .col--status, .col--submit-by, .col--lang - border-right: 1px solid $table-border-color - - .col--status__text - position: relative - z-index: 2 - - .col--status__progress-container - position: absolute - left: 0 - top: 0 - width: 100% - height: 100% - z-index: 1 - - .col--status__progress - position: absolute - left: 0 - top: 0 - height: 100% - background: #fff6d1 - - +tablet() - .col--time, - .col--memory, - .col--lang - display: none - - +mobile() - .col--submit-by, - .col--submit-at, - .col--time, - .col--memory, - .col--lang - display: none +.page--record_main + .col--status + width: rem(170px) + position: relative + + .col--submit-at + width: rem(115px) + text-align: center + + &.nojs .col--submit-at + width: rem(160px) + + .col--submit-by + width: rem(200px) + text-align: right + + .col--time, .col--memory, .col--lang + width: rem(95px) + text-align: center + + .col--status, .col--submit-by, .col--lang + border-right: 1px solid $table-border-color + + .col--status__text + position: relative + z-index: 2 + + .col--status__progress-container + position: absolute + left: 0 + top: 0 + width: 100% + height: 100% + z-index: 1 + + .col--status__progress + position: absolute + left: 0 + top: 0 + height: 100% + background: #fff6d1 + + +tablet() + .col--time, + .col--memory, + .col--lang + display: none + + +mobile() + .col--submit-by, + .col--submit-at, + .col--time, + .col--memory, + .col--lang + display: none diff --git a/packages/ui-default/pages/record_main.page.ts b/packages/ui-default/pages/record_main.page.ts index 024516a20b..2c164cd88f 100644 --- a/packages/ui-default/pages/record_main.page.ts +++ b/packages/ui-default/pages/record_main.page.ts @@ -1,56 +1,56 @@ -import $ from 'jquery'; -import ProblemSelectAutoComplete from 'vj/components/autocomplete/ProblemSelectAutoComplete'; -import UserSelectAutoComplete from 'vj/components/autocomplete/UserSelectAutoComplete'; -import Notification from 'vj/components/notification'; -import { NamedPage } from 'vj/misc/Page'; -import { getAvailableLangs, request, tpl } from 'vj/utils'; - -const page = new NamedPage('record_main', async () => { - const [{ default: WebSocket }, { DiffDOM }] = await Promise.all([ - import('../components/socket'), - import('diff-dom'), - ]); - - const sock = new WebSocket(UiContext.ws_prefix + UiContext.socketUrl, false, true); - const dd = new DiffDOM(); - - sock.onopen = () => sock.send(JSON.stringify({ rids: UiContext.rids })); - sock.onmessage = (_, data) => { - const msg = JSON.parse(data); - const $newTr = $(msg.html); - const $oldTr = $(`.record_main__table tr[data-rid="${$newTr.attr('data-rid')}"]`); - if ($oldTr.length) { - $oldTr.trigger('vjContentRemove'); - dd.apply($oldTr[0], dd.diff($oldTr[0], $newTr[0])); - $oldTr.trigger('vjContentNew'); - } else { - if (+new URLSearchParams(window.location.search).get('page') > 1 - || new URLSearchParams(window.location.search).get('nopush')) return; - $('.record_main__table tbody').prepend($newTr); - $('.record_main__table tbody tr:last').remove(); - $newTr.trigger('vjContentNew'); - } - }; - UserSelectAutoComplete.getOrConstruct($('[name="uidOrName"]'), { - clearDefaultValue: false, - }); - ProblemSelectAutoComplete.getOrConstruct($('[name="pid"]'), { - clearDefaultValue: false, - }); - const langs = UiContext.domain.langs?.split(',').map((i) => i.trim()).filter((i) => i); - const availableLangs = getAvailableLangs(langs?.length ? langs : undefined); - Object.keys(availableLangs).map( - (i) => ($('select[name="lang"]').append(tpl``))); - const lang = new URL(window.location.href).searchParams.get('lang'); - if (lang) $('select[name="lang"]').val(lang); - - for (const operation of ['rejudge', 'cancel']) { - $(document).on('click', `[name="operation"][value="${operation}"]`, (ev) => { - ev.preventDefault(); - const action = $(ev.target).closest('form').attr('action'); - request.post(action, { operation }).catch((e) => Notification.error(e)); - }); - } -}); - -export default page; +import $ from 'jquery'; +import ProblemSelectAutoComplete from 'vj/components/autocomplete/ProblemSelectAutoComplete'; +import UserSelectAutoComplete from 'vj/components/autocomplete/UserSelectAutoComplete'; +import Notification from 'vj/components/notification'; +import { NamedPage } from 'vj/misc/Page'; +import { getAvailableLangs, request, tpl } from 'vj/utils'; + +const page = new NamedPage('record_main', async () => { + const [{ default: WebSocket }, { DiffDOM }] = await Promise.all([ + import('../components/socket'), + import('diff-dom'), + ]); + + const sock = new WebSocket(UiContext.ws_prefix + UiContext.socketUrl, false, true); + const dd = new DiffDOM(); + + sock.onopen = () => sock.send(JSON.stringify({ rids: UiContext.rids })); + sock.onmessage = (_, data) => { + const msg = JSON.parse(data); + const $newTr = $(msg.html); + const $oldTr = $(`.record_main__table tr[data-rid="${$newTr.attr('data-rid')}"]`); + if ($oldTr.length) { + $oldTr.trigger('vjContentRemove'); + dd.apply($oldTr[0], dd.diff($oldTr[0], $newTr[0])); + $oldTr.trigger('vjContentNew'); + } else { + if (+new URLSearchParams(window.location.search).get('page') > 1 + || new URLSearchParams(window.location.search).get('nopush')) return; + $('.record_main__table tbody').prepend($newTr); + $('.record_main__table tbody tr:last').remove(); + $newTr.trigger('vjContentNew'); + } + }; + UserSelectAutoComplete.getOrConstruct($('[name="uidOrName"]'), { + clearDefaultValue: false, + }); + ProblemSelectAutoComplete.getOrConstruct($('[name="pid"]'), { + clearDefaultValue: false, + }); + const langs = UiContext.domain.langs?.split(',').map((i) => i.trim()).filter((i) => i); + const availableLangs = getAvailableLangs(langs?.length ? langs : undefined); + Object.keys(availableLangs).map( + (i) => ($('select[name="lang"]').append(tpl``))); + const lang = new URL(window.location.href).searchParams.get('lang'); + if (lang) $('select[name="lang"]').val(lang); + + for (const operation of ['rejudge', 'cancel']) { + $(document).on('click', `[name="operation"][value="${operation}"]`, (ev) => { + ev.preventDefault(); + const action = $(ev.target).closest('form').attr('action'); + request.post(action, { operation }).catch((e) => Notification.error(e)); + }); + } +}); + +export default page; diff --git a/packages/ui-default/pages/setting.page.tsx b/packages/ui-default/pages/setting.page.tsx index 73a9c285fd..e42cdd47fd 100644 --- a/packages/ui-default/pages/setting.page.tsx +++ b/packages/ui-default/pages/setting.page.tsx @@ -1,29 +1,29 @@ -import yaml from 'js-yaml'; -import Schema from 'schemastery'; -import Notification from 'vj/components/notification'; -import { NamedPage } from 'vj/misc/Page'; -import { request } from 'vj/utils'; - -const page = new NamedPage('manage_config', async () => { - const schema = new Schema(UiContext.schema); - setInterval(() => { - try { - const v = yaml.load($('#config').val().toString()); - schema(v); - $('#info').text(''); - } catch (e) { - console.debug(e); - $('#info').text(e.message); - } - }, 1000); - $('#submit').on('click', () => { - const value = $('#config').val(); - request.post('', { value }).then(() => { - Notification.success('保存成功'); - }).catch((e) => { - Notification.error('保存失败:', e.message); - }); - }); -}); - -export default page; +import yaml from 'js-yaml'; +import Schema from 'schemastery'; +import Notification from 'vj/components/notification'; +import { NamedPage } from 'vj/misc/Page'; +import { request } from 'vj/utils'; + +const page = new NamedPage('manage_config', async () => { + const schema = new Schema(UiContext.schema); + setInterval(() => { + try { + const v = yaml.load($('#config').val().toString()); + schema(v); + $('#info').text(''); + } catch (e) { + console.debug(e); + $('#info').text(e.message); + } + }, 1000); + $('#submit').on('click', () => { + const value = $('#config').val(); + request.post('', { value }).then(() => { + Notification.success('保存成功'); + }).catch((e) => { + Notification.error('保存失败:', e.message); + }); + }); +}); + +export default page; diff --git a/packages/ui-default/pages/status.page.styl b/packages/ui-default/pages/status.page.styl index e519c4106f..7c307bf452 100644 --- a/packages/ui-default/pages/status.page.styl +++ b/packages/ui-default/pages/status.page.styl @@ -1,20 +1,20 @@ -.page--status - .col--id - width: 100px - - .col--os - width: 200px - - .col--status - width: 130px - - .col--memory - width: 150px - - .col--request - width: 130px - - +mobile() - .col--os - .col--cpu +.page--status + .col--id + width: 100px + + .col--os + width: 200px + + .col--status + width: 130px + + .col--memory + width: 150px + + .col--request + width: 130px + + +mobile() + .col--os + .col--cpu display: none \ No newline at end of file diff --git a/packages/ui-default/pages/stu_class_list.page.styl b/packages/ui-default/pages/stu_class_list.page.styl index 63b706192a..9c2f5adb96 100644 --- a/packages/ui-default/pages/stu_class_list.page.styl +++ b/packages/ui-default/pages/stu_class_list.page.styl @@ -1,38 +1,38 @@ -.page--stu_class_list - .stu-classlist td - height: rem(50px) - font-size: 14px - - .stu-classlist>tr:nth-child(-n+3) .col--rank - height: rem(80px) - font-size: 26px - font-weight: 200 - - .col--rank - width: rem(100px) - position: relative - - .col--classname - min-width: rem(200px) - text-align: left - - .col--stunum, .col--ac, .col--submit, .col--rpavg, .col--rpsum, .col--activity, .col--weight - min-width: rem(100px) - text-align: right - - .col--user-rank - width: rem(60px) - - .col--user-ac, .col--user-ac, .col--user-submit, .col--user-rp - width: rem(60px) - text-align: right - - .col--user-bio - min-width: rem(400px) - - .col--user - width: rem(160px) - - +mobile() - .col--rpavg, .col--rpsum, .col--weight, .col--rpavg, .col--submit, .stu-starclass +.page--stu_class_list + .stu-classlist td + height: rem(50px) + font-size: 14px + + .stu-classlist>tr:nth-child(-n+3) .col--rank + height: rem(80px) + font-size: 26px + font-weight: 200 + + .col--rank + width: rem(100px) + position: relative + + .col--classname + min-width: rem(200px) + text-align: left + + .col--stunum, .col--ac, .col--submit, .col--rpavg, .col--rpsum, .col--activity, .col--weight + min-width: rem(100px) + text-align: right + + .col--user-rank + width: rem(60px) + + .col--user-ac, .col--user-ac, .col--user-submit, .col--user-rp + width: rem(60px) + text-align: right + + .col--user-bio + min-width: rem(400px) + + .col--user + width: rem(160px) + + +mobile() + .col--rpavg, .col--rpsum, .col--weight, .col--rpavg, .col--submit, .stu-starclass display: none \ No newline at end of file diff --git a/packages/ui-default/pages/stu_class_students.page.styl b/packages/ui-default/pages/stu_class_students.page.styl index 0748e2d7f0..64ae87ab36 100644 --- a/packages/ui-default/pages/stu_class_students.page.styl +++ b/packages/ui-default/pages/stu_class_students.page.styl @@ -1,36 +1,36 @@ -.page--stu_class_students - .col--rank - width: rem(80px) - position: relative - - .col--stuid - width: rem(150px) - text-align: left - - .col--user - width: rem(200px) - text-align: left - - .col--gender - width: rem(80px) - text-align: left - - .col--rp - width: rem(80px) - text-align: right - - .col--ac - width: rem(100px) - text-align: right - - .col--lastactive - width: rem(120px) - text-align: right - - .col--bio - height: 36px !important - display: block - - +mobile() - .col--bio, .col--stuid, .col--lastactive, .col--gender +.page--stu_class_students + .col--rank + width: rem(80px) + position: relative + + .col--stuid + width: rem(150px) + text-align: left + + .col--user + width: rem(200px) + text-align: left + + .col--gender + width: rem(80px) + text-align: left + + .col--rp + width: rem(80px) + text-align: right + + .col--ac + width: rem(100px) + text-align: right + + .col--lastactive + width: rem(120px) + text-align: right + + .col--bio + height: 36px !important + display: block + + +mobile() + .col--bio, .col--stuid, .col--lastactive, .col--gender display: none \ No newline at end of file diff --git a/packages/ui-default/pages/training_detail.page.styl b/packages/ui-default/pages/training_detail.page.styl index 8a7d88ba87..dc0cbeb90f 100644 --- a/packages/ui-default/pages/training_detail.page.styl +++ b/packages/ui-default/pages/training_detail.page.styl @@ -1,48 +1,48 @@ -.page--training_detail - .col--status - width: rem(150px) - position: relative - - &.col--status--sm - width: rem(84px) - - .col--tried, .col--ac, .col--difficulty - width: rem(70px) - text-align: center - - .col--status - border-right: 1px solid $table-border-color - - .col--tried, .col--difficulty - border-left: 1px solid $table-border-color - - +mobile() - .col--status, - .col--tried, - .col--difficulty - display: none - - .col--ac - border-left: 1px solid $table-border-color - - .training__section - &.invalid - .training__problems - opacity: 0.6 - - &.collapsed .collapsed--hidden, - &.expanded .expanded--hidden - display: none - - &.collapsed .training__section__detail - display: none - - #menu-item-training_detail ul - max-height: calc(85vh - 345px) - overflow-y: auto - overflow-x: hidden - - .enroll_user_menu - max-height: 85vh - overflow-y: auto - overflow-x: hidden +.page--training_detail + .col--status + width: rem(150px) + position: relative + + &.col--status--sm + width: rem(84px) + + .col--tried, .col--ac, .col--difficulty + width: rem(70px) + text-align: center + + .col--status + border-right: 1px solid $table-border-color + + .col--tried, .col--difficulty + border-left: 1px solid $table-border-color + + +mobile() + .col--status, + .col--tried, + .col--difficulty + display: none + + .col--ac + border-left: 1px solid $table-border-color + + .training__section + &.invalid + .training__problems + opacity: 0.6 + + &.collapsed .collapsed--hidden, + &.expanded .expanded--hidden + display: none + + &.collapsed .training__section__detail + display: none + + #menu-item-training_detail ul + max-height: calc(85vh - 345px) + overflow-y: auto + overflow-x: hidden + + .enroll_user_menu + max-height: 85vh + overflow-y: auto + overflow-x: hidden diff --git a/packages/ui-default/pages/training_detail.page.ts b/packages/ui-default/pages/training_detail.page.ts index ea8ca62b13..7d7f07e5eb 100644 --- a/packages/ui-default/pages/training_detail.page.ts +++ b/packages/ui-default/pages/training_detail.page.ts @@ -1,85 +1,85 @@ -import $ from 'jquery'; -import _ from 'lodash'; -import { NamedPage } from 'vj/misc/Page'; -import pjax from 'vj/utils/pjax'; -import { slideDown, slideUp } from 'vj/utils/slide'; - -type SectionAction = 'expand' | 'collapse'; -type SectionState = 'expanded' | 'collapsed'; - -function action2state(action: SectionAction): SectionState { - return action === 'expand' ? 'expanded' : 'collapsed'; -} - -async function setSectionState($section: JQuery, state: SectionState) { - if ($section.is(`.${state}, .animating`)) return; - $section.addClass('animating'); - const $detail = $section.find('.training__section__detail'); - if (state === 'expanded') { - await slideDown($detail, 300, { opacity: 0 }, { opacity: 1 }); - } else { - await slideUp($detail, 300, { opacity: 1 }, { opacity: 0 }); - } - $section.addClass(state); - $section.removeClass(state === 'expanded' ? 'collapsed' : 'expanded'); - $section.removeClass('animating'); -} - -async function handleSection(ev: JQuery.ClickEvent, type: SectionAction) { - const $section = $(ev.currentTarget).closest('.training__section'); - await setSectionState($section, action2state(type)); -} - -function searchUser() { - const val = $('input[name=uid]').val().toString().toLowerCase(); - const group = $('select[name=group]').val().toString().toLowerCase(); - $('.enroll_user_menu_item').each((i, e) => { - const $item = $(e); - const $username = $item.data('uname').toString().toLowerCase(); - const $displayName = $item.data('displayname')?.toString().toLowerCase(); - const $uid = $item.data('uid').toString(); - $item.toggle((($displayName?.includes(val) || $username.includes(val)) && (group === 'all' || group.split(',').includes($uid))) || $uid === val); - }); -} - -function selectUser(ev) { - ev.preventDefault(); - if ($('.enroll_user_menu_item:visible').length === 1) { - $('.enroll_user_menu_item:visible').first().find('a')[0].click(); - } -} - -function handleChooseUser(ev) { - ev.preventDefault(); - $('.enroll_user_menu_item .active').removeClass('active'); - $(ev.currentTarget).addClass('active'); - pjax.request({ url: ev.currentTarget.href }); -} - -async function handleSidebarClick(ev: JQuery.ClickEvent) { - const id = $(ev.currentTarget).attr('href'); - const $section = $(id).closest('.training__section'); - await setSectionState($section, 'expanded'); -} - -async function handleHashChange() { - const id = window.location.hash; - if (id.startsWith('#node-')) { - const $section = $(id).closest('.training__section'); - await setSectionState($section, 'expanded'); - } -} - -const page = new NamedPage('training_detail', () => { - $('.search__input').on('input', _.debounce(searchUser, 500)); - $('select[name=group]').on('change', searchUser); - $('#searchForm').on('submit', selectUser); - $(document).on('click', '[name="training__section__expand"]', (ev) => handleSection(ev, 'expand')); - $(document).on('click', '[name="training__section__collapse"]', (ev) => handleSection(ev, 'collapse')); - $(document).on('click', '.enroll_user_menu_item > a', (ev) => handleChooseUser(ev)); - $(document).on('click', '#menu-item-training_detail > ul > li > a', (ev) => handleSidebarClick(ev)); - window.addEventListener('hashchange', handleHashChange); - $(handleHashChange); -}); - -export default page; +import $ from 'jquery'; +import _ from 'lodash'; +import { NamedPage } from 'vj/misc/Page'; +import pjax from 'vj/utils/pjax'; +import { slideDown, slideUp } from 'vj/utils/slide'; + +type SectionAction = 'expand' | 'collapse'; +type SectionState = 'expanded' | 'collapsed'; + +function action2state(action: SectionAction): SectionState { + return action === 'expand' ? 'expanded' : 'collapsed'; +} + +async function setSectionState($section: JQuery, state: SectionState) { + if ($section.is(`.${state}, .animating`)) return; + $section.addClass('animating'); + const $detail = $section.find('.training__section__detail'); + if (state === 'expanded') { + await slideDown($detail, 300, { opacity: 0 }, { opacity: 1 }); + } else { + await slideUp($detail, 300, { opacity: 1 }, { opacity: 0 }); + } + $section.addClass(state); + $section.removeClass(state === 'expanded' ? 'collapsed' : 'expanded'); + $section.removeClass('animating'); +} + +async function handleSection(ev: JQuery.ClickEvent, type: SectionAction) { + const $section = $(ev.currentTarget).closest('.training__section'); + await setSectionState($section, action2state(type)); +} + +function searchUser() { + const val = $('input[name=uid]').val().toString().toLowerCase(); + const group = $('select[name=group]').val().toString().toLowerCase(); + $('.enroll_user_menu_item').each((i, e) => { + const $item = $(e); + const $username = $item.data('uname').toString().toLowerCase(); + const $displayName = $item.data('displayname')?.toString().toLowerCase(); + const $uid = $item.data('uid').toString(); + $item.toggle((($displayName?.includes(val) || $username.includes(val)) && (group === 'all' || group.split(',').includes($uid))) || $uid === val); + }); +} + +function selectUser(ev) { + ev.preventDefault(); + if ($('.enroll_user_menu_item:visible').length === 1) { + $('.enroll_user_menu_item:visible').first().find('a')[0].click(); + } +} + +function handleChooseUser(ev) { + ev.preventDefault(); + $('.enroll_user_menu_item .active').removeClass('active'); + $(ev.currentTarget).addClass('active'); + pjax.request({ url: ev.currentTarget.href }); +} + +async function handleSidebarClick(ev: JQuery.ClickEvent) { + const id = $(ev.currentTarget).attr('href'); + const $section = $(id).closest('.training__section'); + await setSectionState($section, 'expanded'); +} + +async function handleHashChange() { + const id = window.location.hash; + if (id.startsWith('#node-')) { + const $section = $(id).closest('.training__section'); + await setSectionState($section, 'expanded'); + } +} + +const page = new NamedPage('training_detail', () => { + $('.search__input').on('input', _.debounce(searchUser, 500)); + $('select[name=group]').on('change', searchUser); + $('#searchForm').on('submit', selectUser); + $(document).on('click', '[name="training__section__expand"]', (ev) => handleSection(ev, 'expand')); + $(document).on('click', '[name="training__section__collapse"]', (ev) => handleSection(ev, 'collapse')); + $(document).on('click', '.enroll_user_menu_item > a', (ev) => handleChooseUser(ev)); + $(document).on('click', '#menu-item-training_detail > ul > li > a', (ev) => handleSidebarClick(ev)); + window.addEventListener('hashchange', handleHashChange); + $(handleHashChange); +}); + +export default page; diff --git a/packages/ui-default/pages/training_edit.page.ts b/packages/ui-default/pages/training_edit.page.ts index e5fc7760b1..e392a36471 100644 --- a/packages/ui-default/pages/training_edit.page.ts +++ b/packages/ui-default/pages/training_edit.page.ts @@ -1,24 +1,24 @@ -import $ from 'jquery'; -import { ConfirmDialog } from 'vj/components/dialog'; -import { NamedPage } from 'vj/misc/Page'; -import { i18n, request, tpl } from 'vj/utils'; - -export default new NamedPage('training_edit', () => { - let confirmed = false; - $(document).on('click', '[name="operation"]', (ev) => { - ev.preventDefault(); - if (confirmed) { - return request.post('.', { operation: 'delete' }).then((res) => { - window.location.href = res.url; - }); - } - const message = 'Confirm deleting this training? Its files and status will be deleted as well.'; - return new ConfirmDialog({ - $body: tpl.typoMsg(i18n(message)), - }).open().then((action) => { - if (action !== 'yes') return; - confirmed = true; - ev.target.click(); - }); - }); -}); +import $ from 'jquery'; +import { ConfirmDialog } from 'vj/components/dialog'; +import { NamedPage } from 'vj/misc/Page'; +import { i18n, request, tpl } from 'vj/utils'; + +export default new NamedPage('training_edit', () => { + let confirmed = false; + $(document).on('click', '[name="operation"]', (ev) => { + ev.preventDefault(); + if (confirmed) { + return request.post('.', { operation: 'delete' }).then((res) => { + window.location.href = res.url; + }); + } + const message = 'Confirm deleting this training? Its files and status will be deleted as well.'; + return new ConfirmDialog({ + $body: tpl.typoMsg(i18n(message)), + }).open().then((action) => { + if (action !== 'yes') return; + confirmed = true; + ev.target.click(); + }); + }); +}); diff --git a/packages/ui-default/pages/training_main.page.styl b/packages/ui-default/pages/training_main.page.styl index f92f62145a..4a0b06f78c 100644 --- a/packages/ui-default/pages/training_main.page.styl +++ b/packages/ui-default/pages/training_main.page.styl @@ -1,48 +1,48 @@ -.page--training_main - .training__title - line-height: 1.2 - margin-bottom: 0.4em - font-size: rem($font-size-title) - - .training__intro - color: lighten($text-1-color, 20%) - font-size: rem($font-size-secondary) - margin: 1em 0 - - .training__item - padding-left: rem(5px) - - .training__participants - width: rem(80px) - - .training__progress - line-height: rem(17px) - vertical-align: top - - .training__progress-bar - display: inline-block - width: rem(100px) - height: rem(5px) - position: relative - background: #EEE - margin: rem(6px 0) - line-height: 1 - vertical-align: top - - .training__progress-track - position: absolute - left: 0 - top: 0 - height: 100% - width: 0% - background-color: green - - .secondary.training__list - .training__item - margin-bottom: rem(15px) - .training__title - font-size: rem($font-size) - - &.my - .training-status--icon - font-size: rem($font-size-icon * 1.2) +.page--training_main + .training__title + line-height: 1.2 + margin-bottom: 0.4em + font-size: rem($font-size-title) + + .training__intro + color: lighten($text-1-color, 20%) + font-size: rem($font-size-secondary) + margin: 1em 0 + + .training__item + padding-left: rem(5px) + + .training__participants + width: rem(80px) + + .training__progress + line-height: rem(17px) + vertical-align: top + + .training__progress-bar + display: inline-block + width: rem(100px) + height: rem(5px) + position: relative + background: #EEE + margin: rem(6px 0) + line-height: 1 + vertical-align: top + + .training__progress-track + position: absolute + left: 0 + top: 0 + height: 100% + width: 0% + background-color: green + + .secondary.training__list + .training__item + margin-bottom: rem(15px) + .training__title + font-size: rem($font-size) + + &.my + .training-status--icon + font-size: rem($font-size-icon * 1.2) diff --git a/packages/ui-default/pages/user_detail.page.styl b/packages/ui-default/pages/user_detail.page.styl index b37ec25c3e..545a4c2f33 100644 --- a/packages/ui-default/pages/user_detail.page.styl +++ b/packages/ui-default/pages/user_detail.page.styl @@ -1,97 +1,97 @@ -@import '~vj/components/tab/var.inc.styl' - -.page--user_detail - - .profile-header - position: relative - background-position: center center - background-size: cover - min-height: rem(270px) - padding-bottom: rem($tab-item-height + $tab-item-shadow-size + 20px) - - +mobile() - padding-bottom: rem($tab-item-height-mobile) - - .profile-header__content - position: relative - padding: rem($section-gap-v) rem($section-gap-h) 0 - - .media__left - padding-right: rem(30px) - - +mobile() - .media, .media__left, .media__body - display: block - - .media__left - text-align: center - - img - display: inline-block - - .media__body - margin-top: rem(20px) - - .profile-header__contact-bar - position: absolute - right: rem($section-gap-h + 5px) - top: rem($section-gap-v + 20px) - color: #FFF - text-align: right - - +below(rupture.hd-cutoff) - position: relative - right: 0 - top: 0 - text-align: left - margin: rem(15px 0) - - .profile-header__contact-item - vertical-align: top - color: rgba(#FFF, 0.8) - margin-left: rem(10px) - - +below(rupture.hd-cutoff) - margin-left: 0 - margin-right: rem(15px) - - &:hover - color: rgba(#FFF, 1) - text-decoration: none - - &.badge--su - background-color: rgba(#FFF, 0.8) !important - color: rgba(#000, 0.8) !important - - &.badge--mod - background-color: rgba(#FFF, 0.8) !important - color: rgba(#000, 0.8) !important - - .profile-header__main - h1 - line-height: 40px - color: #FFF - - p - line-height: 30px - color: #FFF - - small - color: rgba(#FFF, 0.8) - - .profile-content - position: relative - z-index: 2 - margin-top: rem(-($tab-item-height + $tab-item-shadow-size)) - - +mobile() - margin-top: rem(-($tab-item-height-mobile)) - - .section__tabs - padding-top: rem($tab-item-height + $tab-item-shadow-size) - - +mobile() - padding-top: rem($tab-item-height-mobile) - #rating-placeholder - width: auto +@import '~vj/components/tab/var.inc.styl' + +.page--user_detail + + .profile-header + position: relative + background-position: center center + background-size: cover + min-height: rem(270px) + padding-bottom: rem($tab-item-height + $tab-item-shadow-size + 20px) + + +mobile() + padding-bottom: rem($tab-item-height-mobile) + + .profile-header__content + position: relative + padding: rem($section-gap-v) rem($section-gap-h) 0 + + .media__left + padding-right: rem(30px) + + +mobile() + .media, .media__left, .media__body + display: block + + .media__left + text-align: center + + img + display: inline-block + + .media__body + margin-top: rem(20px) + + .profile-header__contact-bar + position: absolute + right: rem($section-gap-h + 5px) + top: rem($section-gap-v + 20px) + color: #FFF + text-align: right + + +below(rupture.hd-cutoff) + position: relative + right: 0 + top: 0 + text-align: left + margin: rem(15px 0) + + .profile-header__contact-item + vertical-align: top + color: rgba(#FFF, 0.8) + margin-left: rem(10px) + + +below(rupture.hd-cutoff) + margin-left: 0 + margin-right: rem(15px) + + &:hover + color: rgba(#FFF, 1) + text-decoration: none + + &.badge--su + background-color: rgba(#FFF, 0.8) !important + color: rgba(#000, 0.8) !important + + &.badge--mod + background-color: rgba(#FFF, 0.8) !important + color: rgba(#000, 0.8) !important + + .profile-header__main + h1 + line-height: 40px + color: #FFF + + p + line-height: 30px + color: #FFF + + small + color: rgba(#FFF, 0.8) + + .profile-content + position: relative + z-index: 2 + margin-top: rem(-($tab-item-height + $tab-item-shadow-size)) + + +mobile() + margin-top: rem(-($tab-item-height-mobile)) + + .section__tabs + padding-top: rem($tab-item-height + $tab-item-shadow-size) + + +mobile() + padding-top: rem($tab-item-height-mobile) + #rating-placeholder + width: auto height: 600px \ No newline at end of file diff --git a/packages/ui-default/pages/user_sudo.page.ts b/packages/ui-default/pages/user_sudo.page.ts index bbde8dbe79..1e6ad6ccd7 100644 --- a/packages/ui-default/pages/user_sudo.page.ts +++ b/packages/ui-default/pages/user_sudo.page.ts @@ -1,25 +1,25 @@ -import $ from 'jquery'; -import { NamedPage } from 'vj/misc/Page'; - -function sudoSwitch(type, init = false) { - $('.sudo-div').each((i, e) => { - $(e).toggle($(e).data('sudo') === type); - }); - $('.sudo-switch').each((i, e) => { - $(e).toggle($(e).data('sudo') !== type); - }); - if (type === 'authn') { - $('.confirm-div input[name=confirm]').prop({ type: '', disabled: true }).hide(); - $('.confirm-div input[name=webauthn_verify]').prop({ type: 'submit', disabled: false }).show(); - if (!init) $('.confirm-div input[name=webauthn_verify]').trigger('click'); - } else { - $('.confirm-div input[name=webauthn_verify]').prop({ type: '', disabled: true }).hide(); - $('.confirm-div input[name=confirm]').prop({ type: 'submit', disabled: false }).show(); - } - $('.sudo-div:visible input:visible').first().trigger('focus'); -} - -export default new NamedPage('user_sudo', () => { - sudoSwitch($($('.sudo-div')[0]).data('sudo'), true); - $('.sudo-switch').on('click', (ev) => sudoSwitch($(ev.currentTarget).data('sudo'))); -}); +import $ from 'jquery'; +import { NamedPage } from 'vj/misc/Page'; + +function sudoSwitch(type, init = false) { + $('.sudo-div').each((i, e) => { + $(e).toggle($(e).data('sudo') === type); + }); + $('.sudo-switch').each((i, e) => { + $(e).toggle($(e).data('sudo') !== type); + }); + if (type === 'authn') { + $('.confirm-div input[name=confirm]').prop({ type: '', disabled: true }).hide(); + $('.confirm-div input[name=webauthn_verify]').prop({ type: 'submit', disabled: false }).show(); + if (!init) $('.confirm-div input[name=webauthn_verify]').trigger('click'); + } else { + $('.confirm-div input[name=webauthn_verify]').prop({ type: '', disabled: true }).hide(); + $('.confirm-div input[name=confirm]').prop({ type: 'submit', disabled: false }).show(); + } + $('.sudo-div:visible input:visible').first().trigger('focus'); +} + +export default new NamedPage('user_sudo', () => { + sudoSwitch($($('.sudo-div')[0]).data('sudo'), true); + $('.sudo-switch').on('click', (ev) => sudoSwitch($(ev.currentTarget).data('sudo'))); +}); diff --git a/packages/ui-default/pages/user_verify.page.ts b/packages/ui-default/pages/user_verify.page.ts index 4f032b4adc..944be42be0 100644 --- a/packages/ui-default/pages/user_verify.page.ts +++ b/packages/ui-default/pages/user_verify.page.ts @@ -1,121 +1,121 @@ -import { startAuthentication } from '@simplewebauthn/browser'; -import $ from 'jquery'; -import { ActionDialog } from 'vj/components/dialog'; -import Notification from 'vj/components/notification'; -import { AutoloadPage } from 'vj/misc/Page'; -import { - api, gql, i18n, request, tpl, -} from 'vj/utils'; - -async function verifywebauthn($form) { - if (!window.isSecureContext || !('credentials' in navigator)) { - Notification.error(i18n('Your browser does not support WebAuthn or you are not in secure context.')); - return null; - } - let uname = ''; - if ($form['uname']) uname = $form['uname'].value; - const authnInfo = await request.get('/user/webauthn', uname ? { uname } : undefined); - if (!authnInfo.authOptions) { - Notification.error(i18n('Failed to fetch registration data.')); - return null; - } - Notification.info(i18n('Please follow the instructions on your device to complete the verification.')); - const result = await startAuthentication(authnInfo.authOptions) - .catch((e) => { - Notification.error(i18n('Failed to get credential: {0}', e)); - return null; - }); - if (!result) return null; - try { - const authn = await request.post('/user/webauthn', { - result, - }); - if (!authn.error) return authnInfo.authOptions.challenge; - } catch (err) { - Notification.error(err.message); - console.error(err); - } - return null; -} - -async function chooseAction(authn?: boolean) { - return await new ActionDialog({ - $body: tpl` -
    -

    ${i18n('Two Factor Authentication')}

    -

    ${i18n('Your account has two factor authentication enabled. Please choose an authenticator to verify.')}

    -
    - -
    -
    - - -
    -
    - `, - $action: [], - canCancel: false, - onDispatch(action) { - if (action === 'tfa' && $('[name="tfa_code"]').val() === '') { - $('[name="tfa_code"]').focus(); - return false; - } - return true; - }, - }).open(); -} - -export default new AutoloadPage('user_verify', () => { - $(document).on('click', '[name="login_submit"]', async (ev) => { - ev.preventDefault(); - const form = ev.currentTarget.form; - const uname = $(form).find('[name="uname"]').val() as string; - const info = await api(gql` - uname: user(uname:${uname}){ - tfa authn - } - mail: user(mail:${uname}){ - tfa authn - } - `, ['data']); - if (!info.uname && !info.mail) { - Notification.error(i18n('User not found.')); - return; - } - const { authn, tfa } = info.uname || info.mail; - if (authn || tfa) { - const handleKeyDown = (event) => { - if (event.key === 'Enter') { - const code = $('[name="tfa_code"]').val() as string; - if (code) $('[data-action="tfa"]').trigger('click'); - else $('[data-action]').trigger('click'); - } - }; - $(document).on('keydown', handleKeyDown); - let action = (authn && tfa) ? await chooseAction(true) : ''; - action ||= tfa ? await chooseAction(false) : 'webauthn'; - $(document).off('keydown', handleKeyDown); - if (action === 'webauthn') { - const challenge = await verifywebauthn(form); - if (challenge) form['authnChallenge'].value = challenge; - else return; - } else if (action === 'tfa') form['tfa'].value = $('[name="tfa_code"]').val() as string; - else return; - } - form.submit(); - }); - $(document).on('click', '[name=webauthn_verify]', async (ev) => { - ev.preventDefault(); - const $form = ev.currentTarget.form; - if (!$form) return; - const challenge = await verifywebauthn($form); - if (challenge) { - $form['authnChallenge'].value = challenge; - $form.submit(); - } - }); -}); +import { startAuthentication } from '@simplewebauthn/browser'; +import $ from 'jquery'; +import { ActionDialog } from 'vj/components/dialog'; +import Notification from 'vj/components/notification'; +import { AutoloadPage } from 'vj/misc/Page'; +import { + api, gql, i18n, request, tpl, +} from 'vj/utils'; + +async function verifywebauthn($form) { + if (!window.isSecureContext || !('credentials' in navigator)) { + Notification.error(i18n('Your browser does not support WebAuthn or you are not in secure context.')); + return null; + } + let uname = ''; + if ($form['uname']) uname = $form['uname'].value; + const authnInfo = await request.get('/user/webauthn', uname ? { uname } : undefined); + if (!authnInfo.authOptions) { + Notification.error(i18n('Failed to fetch registration data.')); + return null; + } + Notification.info(i18n('Please follow the instructions on your device to complete the verification.')); + const result = await startAuthentication(authnInfo.authOptions) + .catch((e) => { + Notification.error(i18n('Failed to get credential: {0}', e)); + return null; + }); + if (!result) return null; + try { + const authn = await request.post('/user/webauthn', { + result, + }); + if (!authn.error) return authnInfo.authOptions.challenge; + } catch (err) { + Notification.error(err.message); + console.error(err); + } + return null; +} + +async function chooseAction(authn?: boolean) { + return await new ActionDialog({ + $body: tpl` +
    +

    ${i18n('Two Factor Authentication')}

    +

    ${i18n('Your account has two factor authentication enabled. Please choose an authenticator to verify.')}

    +
    + +
    +
    + + +
    +
    + `, + $action: [], + canCancel: false, + onDispatch(action) { + if (action === 'tfa' && $('[name="tfa_code"]').val() === '') { + $('[name="tfa_code"]').focus(); + return false; + } + return true; + }, + }).open(); +} + +export default new AutoloadPage('user_verify', () => { + $(document).on('click', '[name="login_submit"]', async (ev) => { + ev.preventDefault(); + const form = ev.currentTarget.form; + const uname = $(form).find('[name="uname"]').val() as string; + const info = await api(gql` + uname: user(uname:${uname}){ + tfa authn + } + mail: user(mail:${uname}){ + tfa authn + } + `, ['data']); + if (!info.uname && !info.mail) { + Notification.error(i18n('User not found.')); + return; + } + const { authn, tfa } = info.uname || info.mail; + if (authn || tfa) { + const handleKeyDown = (event) => { + if (event.key === 'Enter') { + const code = $('[name="tfa_code"]').val() as string; + if (code) $('[data-action="tfa"]').trigger('click'); + else $('[data-action]').trigger('click'); + } + }; + $(document).on('keydown', handleKeyDown); + let action = (authn && tfa) ? await chooseAction(true) : ''; + action ||= tfa ? await chooseAction(false) : 'webauthn'; + $(document).off('keydown', handleKeyDown); + if (action === 'webauthn') { + const challenge = await verifywebauthn(form); + if (challenge) form['authnChallenge'].value = challenge; + else return; + } else if (action === 'tfa') form['tfa'].value = $('[name="tfa_code"]').val() as string; + else return; + } + form.submit(); + }); + $(document).on('click', '[name=webauthn_verify]', async (ev) => { + ev.preventDefault(); + const $form = ev.currentTarget.form; + if (!$form) return; + const challenge = await verifywebauthn($form); + if (challenge) { + $form['authnChallenge'].value = challenge; + $form.submit(); + } + }); +}); diff --git a/packages/ui-default/polyfill.ts b/packages/ui-default/polyfill.ts index f498b7eb68..13197090df 100644 --- a/packages/ui-default/polyfill.ts +++ b/packages/ui-default/polyfill.ts @@ -1,88 +1,88 @@ -import 'core-js/stable'; -import 'matchmedia-polyfill'; - -import browserUpdate from 'browser-update'; - -browserUpdate({ - required: { - e: -10, f: -10, o: -3, s: -1, c: -10, - }, - insecure: true, - api: 2022.03, -}); - -// monaco-editor requires this polyfill -if (window.MediaQueryList && !MediaQueryList.prototype.addEventListener) { - MediaQueryList.prototype.addEventListener = (k, listener) => { - MediaQueryList.prototype.addListener(listener); - }; -} -if (typeof window['WeakRef'] === 'undefined') { - // @ts-ignore - window.WeakRef = (function (wm) { - function WeakRef(target) { - wm.set(this, target); - } - WeakRef.prototype.deref = function () { - return wm.get(this); - }; - return WeakRef; - }(new WeakMap())); -} -if (!(window.matchMedia('all').addListener || window.matchMedia('all').addEventListener)) { - const localMatchMedia = window.matchMedia; - const hasMediaQueries = localMatchMedia('only all').matches; - let isListening = false; - let timeoutID; - const queries = []; - const handleChange = function () { - clearTimeout(timeoutID); - timeoutID = setTimeout(() => { - for (let i = 0, il = queries.length; i < il; i++) { - const { mql } = queries[i]; - const listeners = queries[i].listeners || []; - const { matches } = localMatchMedia(mql.media); - if (matches !== mql.matches) { - mql.matches = matches; - for (let j = 0, jl = listeners.length; j < jl; j++) { - listeners[j].call(window, mql); - } - } - } - }, 30); - }; - window.matchMedia = function (media) { - const mql = localMatchMedia(media); - const listeners = []; - let index = 0; - if (!mql.addListener) { - mql.addListener = function (listener) { - if (!hasMediaQueries) return; - if (!isListening) { - isListening = true; - window.addEventListener('resize', handleChange, true); - } - if (index === 0) { - index = queries.push({ - mql, - listeners, - }); - } - listeners.push(listener); - }; - mql.removeListener = function (listener) { - for (let i = 0, il = listeners.length; i < il; i++) { - if (listeners[i] === listener) { - listeners.splice(i, 1); - i--; - } - } - }; - } - if (!mql.addEventListener) { - mql.addEventListener = (k, listener) => mql.addListener(listener); - mql.removeEventListener = (k, listener) => mql.removeListener(listener); - } - return mql; - }; -} +import 'core-js/stable'; +import 'matchmedia-polyfill'; + +import browserUpdate from 'browser-update'; + +browserUpdate({ + required: { + e: -10, f: -10, o: -3, s: -1, c: -10, + }, + insecure: true, + api: 2022.03, +}); + +// monaco-editor requires this polyfill +if (window.MediaQueryList && !MediaQueryList.prototype.addEventListener) { + MediaQueryList.prototype.addEventListener = (k, listener) => { + MediaQueryList.prototype.addListener(listener); + }; +} +if (typeof window['WeakRef'] === 'undefined') { + // @ts-ignore + window.WeakRef = (function (wm) { + function WeakRef(target) { + wm.set(this, target); + } + WeakRef.prototype.deref = function () { + return wm.get(this); + }; + return WeakRef; + }(new WeakMap())); +} +if (!(window.matchMedia('all').addListener || window.matchMedia('all').addEventListener)) { + const localMatchMedia = window.matchMedia; + const hasMediaQueries = localMatchMedia('only all').matches; + let isListening = false; + let timeoutID; + const queries = []; + const handleChange = function () { + clearTimeout(timeoutID); + timeoutID = setTimeout(() => { + for (let i = 0, il = queries.length; i < il; i++) { + const { mql } = queries[i]; + const listeners = queries[i].listeners || []; + const { matches } = localMatchMedia(mql.media); + if (matches !== mql.matches) { + mql.matches = matches; + for (let j = 0, jl = listeners.length; j < jl; j++) { + listeners[j].call(window, mql); + } + } + } + }, 30); + }; + window.matchMedia = function (media) { + const mql = localMatchMedia(media); + const listeners = []; + let index = 0; + if (!mql.addListener) { + mql.addListener = function (listener) { + if (!hasMediaQueries) return; + if (!isListening) { + isListening = true; + window.addEventListener('resize', handleChange, true); + } + if (index === 0) { + index = queries.push({ + mql, + listeners, + }); + } + listeners.push(listener); + }; + mql.removeListener = function (listener) { + for (let i = 0, il = listeners.length; i < il; i++) { + if (listeners[i] === listener) { + listeners.splice(i, 1); + i--; + } + } + }; + } + if (!mql.addEventListener) { + mql.addEventListener = (k, listener) => mql.addListener(listener); + mql.removeEventListener = (k, listener) => mql.removeListener(listener); + } + return mql; + }; +} diff --git a/packages/ui-default/postcss.config.js b/packages/ui-default/postcss.config.js index a47ef4f952..7d9a0286e5 100644 --- a/packages/ui-default/postcss.config.js +++ b/packages/ui-default/postcss.config.js @@ -1,5 +1,5 @@ -module.exports = { - plugins: { - autoprefixer: {}, - }, -}; +module.exports = { + plugins: { + autoprefixer: {}, + }, +}; diff --git a/packages/ui-default/service-worker.ts b/packages/ui-default/service-worker.ts index 511b5748a6..4b7dc5d7b0 100644 --- a/packages/ui-default/service-worker.ts +++ b/packages/ui-default/service-worker.ts @@ -1,257 +1,257 @@ -/* eslint-disable no-restricted-globals */ -/// -/// -export { }; // make it a module so that declare self works -declare const self: ServiceWorkerGlobalScope; - -const map = new Map(); - -function createStream(port) { - return new ReadableStream({ - start(controller) { - port.onmessage = ({ data }) => { - if (data === 'end') return controller.close(); - if (data === 'abort') return controller.error('Aborted the download'); - return controller.enqueue(data); - }; - }, - cancel(reason) { - console.log('user aborted', reason); - port.postMessage({ abort: true }); - }, - }); -} - -self.onmessage = (event) => { - if (event.data === 'ping') return; - const data = event.data; - const downloadUrl = data.url || `${self.registration.scope + Math.random()}/${typeof data === 'string' ? data : data.filename}`; - const port = event.ports[0]; - const metadata = new Array(3); // [stream, data, port] - metadata[1] = data; - metadata[2] = port; - if (event.data.readableStream) { - metadata[0] = event.data.readableStream; - } else if (event.data.transferringReadable) { - port.onmessage = (evt) => { - port.onmessage = null; - metadata[0] = evt.data.readableStream; - }; - } else metadata[0] = createStream(port); - map.set(downloadUrl, metadata); - port.postMessage({ download: downloadUrl }); -}; - -function streamsaver(event: FetchEvent) { - const hijacke = map.get(event.request.url); - const [stream, data, port] = hijacke; - map.delete(event.request.url); - const responseHeaders = new Headers({ - 'Content-Type': 'application/octet-stream; charset=utf-8', - 'Content-Security-Policy': "default-src 'none'", - 'X-Content-Security-Policy': "default-src 'none'", - 'X-WebKit-CSP': "default-src 'none'", - 'X-XSS-Protection': '1; mode=block', - }); - const headers = new Headers(data.headers || {}); - if (headers.has('Content-Length')) { - responseHeaders.set('Content-Length', headers.get('Content-Length')); - } - if (headers.has('Content-Disposition')) { - responseHeaders.set('Content-Disposition', headers.get('Content-Disposition')); - } - if (data.size) { - console.warn('Depricated'); - responseHeaders.set('Content-Length', data.size); - } - let fileName = typeof data === 'string' ? data : data.filename; - if (fileName) { - console.warn('Depricated'); - fileName = encodeURIComponent(fileName).replace(/['()]/g, escape).replace(/\*/g, '%2A'); - responseHeaders.set('Content-Disposition', `attachment; filename*=UTF-8''${fileName}`); - } - event.respondWith(new Response(stream, { headers: responseHeaders })); - port.postMessage({ debug: 'Download started' }); -} - -// TODO not working -self.addEventListener('notificationclick', (event) => { - console.log('On notification click: ', event.notification.tag); - event.notification.close(); - if (!event.notification.tag.startsWith('message-')) return; - event.waitUntil(self.clients.matchAll({ type: 'window' }).then((clientList) => { - for (const client of clientList) { - if (client.url === '/home/messages' && 'focus' in client) return client.focus(); - } - if (self.clients.openWindow) self.clients.openWindow('/home/messages'); - return null; - })); -}); - -const PRECACHE = `precache-${process.env.VERSION}`; -const DO_NOT_PRECACHE = ['.worker.js', 'fonts', 'i.monaco']; - -function shouldCachePath(path: string) { - if (!path.split('?')[0].split('/').pop()) return false; - if (!path.split('?')[0].split('/').pop().includes('.')) return false; - if (process.env.NODE_ENV !== 'production' && (path.includes('.hot-update.') || path.includes('?version='))) return false; - return true; -} -function shouldCache(request: Request) { - if (!shouldCachePath(request.url)) return false; - // For files download, a response is formatted as string - if (request.headers.get('Pragma') === 'no-cache') return false; - return ['get', 'head', 'options'].includes(request.method.toLowerCase()); -} -function shouldPreCache(name: string) { - if (!shouldCachePath(name)) return false; - if (DO_NOT_PRECACHE.filter((i) => name.includes(i)).length) return false; - return true; -} - -interface ServiceWorkerConfig { - /** enabled hosts */ - hosts: string[]; - /** service domains */ - domains: string[]; - preload?: string; -} -let config: ServiceWorkerConfig = null; - -function initConfig() { - config = JSON.parse(new URLSearchParams(location.search).get('config')); - config.hosts ||= []; - if (!config.domains?.length) config.domains = [location.host]; - console.log('Config:', config); -} - -self.addEventListener('install', (event) => event.waitUntil((async () => { - initConfig(); - if (process.env.NODE_ENV === 'production' && config?.preload) { - const [cache, manifest] = await Promise.all([ - caches.open(PRECACHE), - fetch('/manifest.json').then((res) => res.json()), - ]); - const files = Object.values(manifest).filter(shouldPreCache) - .map((i: string) => new URL(i, config.preload).toString()); - await cache.addAll(files); // NOTE: CORS header - } - self.skipWaiting(); -})())); - -self.addEventListener('activate', (event) => { - initConfig(); - event.waitUntil(self.clients.claim()); - const valid = [PRECACHE]; - caches.keys().then((names) => names - .filter((name) => name.startsWith('precache-')) - .filter((name) => !valid.includes(name)) - .map((p) => caches.delete(p))); -}); - -async function get(request: Request) { - const isResource = shouldCache(request); - for (const target of config.domains || []) { - const source = new URL(request.url); - source.host = target; - try { - console.log('From ', source.toString()); - const r = await fetch(source, { - method: request.method, - credentials: isResource ? 'same-origin' : 'include', - headers: request.headers, - body: request.body, - redirect: request.redirect, - keepalive: request.keepalive, - referrer: request.referrer, - referrerPolicy: request.referrerPolicy, - signal: request.signal, - }); - if (r.ok) { - console.log('Load success from ', source.toString()); - return r; - } - } catch (error) { - console.warn(source.toString(), ' Load fail ', error); - } - } - return fetch(request); -} - -function transformUrl(url: string) { - const urlObject = new URL(url); - if (urlObject.pathname.startsWith('/fs/')) urlObject.search = ''; - return urlObject.toString(); -} - -async function cachedRespond(request: Request) { - const url = transformUrl(request.url); - const cachedResponse = await caches.match(url); - if (cachedResponse) return cachedResponse; - console.log(`Caching ${url}`); - const [cache, response] = await Promise.all([ - caches.open(PRECACHE), - get(request), - ]); - if (response.ok) { - cache.put(url, response.clone()); - return response; - } - return fetch(request); -} - -self.addEventListener('fetch', (event: FetchEvent) => { - if (event.request.url.endsWith('/ping')) { - event.respondWith(new Response('pong')); - return; - } - if (map.get(event.request.url)) { - streamsaver(event); - return; - } - if (!['get', 'post', 'head'].includes(event.request.method.toLowerCase())) return; - if (!config) return; // Don't do anything when not initialized - const url = new URL(event.request.url); - const rewritable = config.domains.length > 1 - && config.domains.includes(url.hostname) && url.origin === location.origin; - // Only handle whitelisted origins; - if (!config.hosts.some((i) => event.request.url.startsWith(i))) return; - - if (shouldCache(event.request)) { - event.respondWith((async () => { - if (rewritable) { - const targets = config.domains.map((i) => { - const t = new URL(event.request.url); - t.host = i; - return transformUrl(t.toString()); - }); - const results = await Promise.all(targets.map((i) => caches.match(i))); - return results.find((i) => i) || cachedRespond(event.request); - } - const transformedUrl = transformUrl(event.request.url); - const cachedResponse = await caches.match(transformedUrl); - if (cachedResponse) return cachedResponse; - console.log(`Caching ${transformedUrl}`); - const [cache, response] = await Promise.all([ - caches.open(PRECACHE), - fetch(url, { - method: event.request.method, - headers: event.request.headers, - redirect: event.request.redirect, - keepalive: event.request.keepalive, - referrer: event.request.referrer, - referrerPolicy: event.request.referrerPolicy, - signal: event.request.signal, - }), // Fetch from url to prevent opaque response - ]); - if (response.ok) { - cache.put(transformedUrl, response.clone()); - return response; - } - console.log(`Failed to cache ${transformedUrl}`, response); - // If response fails, re-fetch the original request to prevent - // errors caused by different headers and do not cache them - return fetch(event.request); - })()); - } else if (rewritable) event.respondWith(get(event.request)); -}); +/* eslint-disable no-restricted-globals */ +/// +/// +export { }; // make it a module so that declare self works +declare const self: ServiceWorkerGlobalScope; + +const map = new Map(); + +function createStream(port) { + return new ReadableStream({ + start(controller) { + port.onmessage = ({ data }) => { + if (data === 'end') return controller.close(); + if (data === 'abort') return controller.error('Aborted the download'); + return controller.enqueue(data); + }; + }, + cancel(reason) { + console.log('user aborted', reason); + port.postMessage({ abort: true }); + }, + }); +} + +self.onmessage = (event) => { + if (event.data === 'ping') return; + const data = event.data; + const downloadUrl = data.url || `${self.registration.scope + Math.random()}/${typeof data === 'string' ? data : data.filename}`; + const port = event.ports[0]; + const metadata = new Array(3); // [stream, data, port] + metadata[1] = data; + metadata[2] = port; + if (event.data.readableStream) { + metadata[0] = event.data.readableStream; + } else if (event.data.transferringReadable) { + port.onmessage = (evt) => { + port.onmessage = null; + metadata[0] = evt.data.readableStream; + }; + } else metadata[0] = createStream(port); + map.set(downloadUrl, metadata); + port.postMessage({ download: downloadUrl }); +}; + +function streamsaver(event: FetchEvent) { + const hijacke = map.get(event.request.url); + const [stream, data, port] = hijacke; + map.delete(event.request.url); + const responseHeaders = new Headers({ + 'Content-Type': 'application/octet-stream; charset=utf-8', + 'Content-Security-Policy': "default-src 'none'", + 'X-Content-Security-Policy': "default-src 'none'", + 'X-WebKit-CSP': "default-src 'none'", + 'X-XSS-Protection': '1; mode=block', + }); + const headers = new Headers(data.headers || {}); + if (headers.has('Content-Length')) { + responseHeaders.set('Content-Length', headers.get('Content-Length')); + } + if (headers.has('Content-Disposition')) { + responseHeaders.set('Content-Disposition', headers.get('Content-Disposition')); + } + if (data.size) { + console.warn('Depricated'); + responseHeaders.set('Content-Length', data.size); + } + let fileName = typeof data === 'string' ? data : data.filename; + if (fileName) { + console.warn('Depricated'); + fileName = encodeURIComponent(fileName).replace(/['()]/g, escape).replace(/\*/g, '%2A'); + responseHeaders.set('Content-Disposition', `attachment; filename*=UTF-8''${fileName}`); + } + event.respondWith(new Response(stream, { headers: responseHeaders })); + port.postMessage({ debug: 'Download started' }); +} + +// TODO not working +self.addEventListener('notificationclick', (event) => { + console.log('On notification click: ', event.notification.tag); + event.notification.close(); + if (!event.notification.tag.startsWith('message-')) return; + event.waitUntil(self.clients.matchAll({ type: 'window' }).then((clientList) => { + for (const client of clientList) { + if (client.url === '/home/messages' && 'focus' in client) return client.focus(); + } + if (self.clients.openWindow) self.clients.openWindow('/home/messages'); + return null; + })); +}); + +const PRECACHE = `precache-${process.env.VERSION}`; +const DO_NOT_PRECACHE = ['.worker.js', 'fonts', 'i.monaco']; + +function shouldCachePath(path: string) { + if (!path.split('?')[0].split('/').pop()) return false; + if (!path.split('?')[0].split('/').pop().includes('.')) return false; + if (process.env.NODE_ENV !== 'production' && (path.includes('.hot-update.') || path.includes('?version='))) return false; + return true; +} +function shouldCache(request: Request) { + if (!shouldCachePath(request.url)) return false; + // For files download, a response is formatted as string + if (request.headers.get('Pragma') === 'no-cache') return false; + return ['get', 'head', 'options'].includes(request.method.toLowerCase()); +} +function shouldPreCache(name: string) { + if (!shouldCachePath(name)) return false; + if (DO_NOT_PRECACHE.filter((i) => name.includes(i)).length) return false; + return true; +} + +interface ServiceWorkerConfig { + /** enabled hosts */ + hosts: string[]; + /** service domains */ + domains: string[]; + preload?: string; +} +let config: ServiceWorkerConfig = null; + +function initConfig() { + config = JSON.parse(new URLSearchParams(location.search).get('config')); + config.hosts ||= []; + if (!config.domains?.length) config.domains = [location.host]; + console.log('Config:', config); +} + +self.addEventListener('install', (event) => event.waitUntil((async () => { + initConfig(); + if (process.env.NODE_ENV === 'production' && config?.preload) { + const [cache, manifest] = await Promise.all([ + caches.open(PRECACHE), + fetch('/manifest.json').then((res) => res.json()), + ]); + const files = Object.values(manifest).filter(shouldPreCache) + .map((i: string) => new URL(i, config.preload).toString()); + await cache.addAll(files); // NOTE: CORS header + } + self.skipWaiting(); +})())); + +self.addEventListener('activate', (event) => { + initConfig(); + event.waitUntil(self.clients.claim()); + const valid = [PRECACHE]; + caches.keys().then((names) => names + .filter((name) => name.startsWith('precache-')) + .filter((name) => !valid.includes(name)) + .map((p) => caches.delete(p))); +}); + +async function get(request: Request) { + const isResource = shouldCache(request); + for (const target of config.domains || []) { + const source = new URL(request.url); + source.host = target; + try { + console.log('From ', source.toString()); + const r = await fetch(source, { + method: request.method, + credentials: isResource ? 'same-origin' : 'include', + headers: request.headers, + body: request.body, + redirect: request.redirect, + keepalive: request.keepalive, + referrer: request.referrer, + referrerPolicy: request.referrerPolicy, + signal: request.signal, + }); + if (r.ok) { + console.log('Load success from ', source.toString()); + return r; + } + } catch (error) { + console.warn(source.toString(), ' Load fail ', error); + } + } + return fetch(request); +} + +function transformUrl(url: string) { + const urlObject = new URL(url); + if (urlObject.pathname.startsWith('/fs/')) urlObject.search = ''; + return urlObject.toString(); +} + +async function cachedRespond(request: Request) { + const url = transformUrl(request.url); + const cachedResponse = await caches.match(url); + if (cachedResponse) return cachedResponse; + console.log(`Caching ${url}`); + const [cache, response] = await Promise.all([ + caches.open(PRECACHE), + get(request), + ]); + if (response.ok) { + cache.put(url, response.clone()); + return response; + } + return fetch(request); +} + +self.addEventListener('fetch', (event: FetchEvent) => { + if (event.request.url.endsWith('/ping')) { + event.respondWith(new Response('pong')); + return; + } + if (map.get(event.request.url)) { + streamsaver(event); + return; + } + if (!['get', 'post', 'head'].includes(event.request.method.toLowerCase())) return; + if (!config) return; // Don't do anything when not initialized + const url = new URL(event.request.url); + const rewritable = config.domains.length > 1 + && config.domains.includes(url.hostname) && url.origin === location.origin; + // Only handle whitelisted origins; + if (!config.hosts.some((i) => event.request.url.startsWith(i))) return; + + if (shouldCache(event.request)) { + event.respondWith((async () => { + if (rewritable) { + const targets = config.domains.map((i) => { + const t = new URL(event.request.url); + t.host = i; + return transformUrl(t.toString()); + }); + const results = await Promise.all(targets.map((i) => caches.match(i))); + return results.find((i) => i) || cachedRespond(event.request); + } + const transformedUrl = transformUrl(event.request.url); + const cachedResponse = await caches.match(transformedUrl); + if (cachedResponse) return cachedResponse; + console.log(`Caching ${transformedUrl}`); + const [cache, response] = await Promise.all([ + caches.open(PRECACHE), + fetch(url, { + method: event.request.method, + headers: event.request.headers, + redirect: event.request.redirect, + keepalive: event.request.keepalive, + referrer: event.request.referrer, + referrerPolicy: event.request.referrerPolicy, + signal: event.request.signal, + }), // Fetch from url to prevent opaque response + ]); + if (response.ok) { + cache.put(transformedUrl, response.clone()); + return response; + } + console.log(`Failed to cache ${transformedUrl}`, response); + // If response fails, re-fetch the original request to prevent + // errors caused by different headers and do not cache them + return fetch(event.request); + })()); + } else if (rewritable) event.respondWith(get(event.request)); +}); diff --git a/packages/ui-default/setting.yaml b/packages/ui-default/setting.yaml index 58fb242a79..70f08eb577 100644 --- a/packages/ui-default/setting.yaml +++ b/packages/ui-default/setting.yaml @@ -1,181 +1,181 @@ -fontFamily: - type: - Open Sans: Open Sans - Seravek: Seravek - Segoe UI: Segoe UI - Verdana: Verdana - PingFang SC: PingFang SC - Hiragino Sans GB: Hiragino Sans GB - Microsoft Yahei: Microsoft Yahei - WenQuanYi Micro Hei: WenQuanYi Micro Hei - sans: sans - XiaoLai SC: 小赖 SC - family: setting_display - category: preference - value: Open Sans -codeFontFamily: - type: - monaco: Monaco - Source Code Pro: Source Code Pro - Consolas: Consolas - Lucida Console: Lucida Console - Fira Code: Fira Code - Roboto Mono: Roboto Mono - Inconsolata: Inconsolata - Hack: Hack - Jetbrains Mono: Jetbrains Mono - DM Mono: DM Mono - Ubuntu Mono: Ubuntu Mono - PT Mono: PT Mono - SF Mono: SF Mono - family: setting_display - category: preference - value: Source Code Pro -footer_extra_html: - type: textarea - name: footer_extra_html - desc: Footer Extra HTML - default: '' -nav_logo_dark: - type: text - name: nav_logo_dark - desc: Nav Logo Dark - default: /components/navigation/nav-logo-small_dark.png -preferredEditorType: - type: - sv: Split View - monaco: Monaco Editor - family: markdown - category: preference - value: sv -monacoTheme: - type: - vs-dark: VS Dark - vs-light: VS Light - category: preference - value: vs-light - family: markdown -theme: - type: - light: Light - dark: Dark - category: preference - value: light - family: setting_display -showInvisibleChar: - type: boolean - family: highlight - desc: show invisible characters when formatting code - category: preference -formatCode: - type: boolean - family: highlight - desc: Auto format code - category: preference - value: true -preload: - type: text - default: '' -domainNavigation: - type: boolean - family: setting_display - desc: Show Domain Navigation - value: true -about: - type: markdown - name: about - desc: About - value: | - # about 关于 {{ name }} - [{{ name }}](https://hydro.js.org) 致力于为用户提供安全、完善、开放的在线评测及题目交流等服务。 - - # contact 联系我们 - [联系我们](https://hydro.js.org/#%E8%81%94%E7%B3%BB%E6%88%91%E4%BB%AC) - - # privacy 隐私政策 - #### 1. 收集的信息 - 我们收集信息是为了向所有用户提供更好的服务。我们有两种信息收集方式: - - - 您向我们提供信息。在您注册 {{ name }} 帐户时,我们会要求您提供个人信息,例如您的电子邮件地址、QQ号码等。 - - 我们在您使用服务的过程中获取信息。我们会收集关于您使用的服务以及使用方式的信息,例如您在何时使用了我们服务。 - - #### 2. 如何使用收集到的信息 - 我们利用从所有服务中收集的信息来提供、维护、保护和改进这些服务,同时开发新的服务并保护 {{ name }} 以及用户的隐私。 - 当我们要将信息用于本隐私权政策未载明的其它用途时,则会事先征求您的同意。 - - #### 3. 访问和更新您的个人信息 - 无论您在何时使用我们的服务,我们都力求让您能够访问自己的个人信息。如果这些信息有误,我们会努力通过各种方式让您快速更新信息或删除信息。 - 在更新您的个人信息时,我们可能会要求您先验证自己的身份,然后再处理您的请求。 - 我们力求对服务进行完善的维护,以保护信息免遭意外或恶意的破坏。因此,当您从我们的服务中删除信息后, - 我们可能不会立即从在用的服务器中删除这些信息的残留副本,也可能不会从备份系统中删除相应的信息。 - - # tos 服务条款 - #### 0. 欢迎使用 {{ name }} - 注册 {{ name }} 帐户和/或使用 {{ name }} 提供的服务(包括网页提供的在线服务和题目评测的非在线服务等),即表示您已同意本条款。 - 请您务必审慎阅读,充分理解条款各项内容。 - - #### 1. 使用服务 - 您必须遵守各项服务中提供的所有政策(包括但不限于讨论和题解的版规)。 - 请勿滥用我们的服务。如,请勿干扰我们的服务,或尝试使用除我们提供的界面和指示以外的方法访问这些服务, - 或使用我们服务中出现的缺陷干扰其他网站或设施的正常运行。您仅能在法律允许的范围内使用我们的服务。 - 您在使用我们服务时须遵守我们服务器所在地的法律法规,不得利用我们服务从事违法违规行为,包括但不限于: - - - 发布、传送、传播、储存危害国家安全统一、破坏社会稳定、违反公序良俗、侮辱、诽谤、淫秽、暴力以及任何违反国家法律法规的内容; - - 发布、传送、传播、储存侵害他人知识产权、商业秘密等合法权利的内容; - - 恶意虚构事实、隐瞒真相以误导、欺骗他人; - - 发布、传送、传播广告信息及垃圾信息; - - 其他法律法规禁止的行为。 - - 如果您违反了约定,相关国家相关机关或机构可能会对您提起诉讼、进行行政处罚或采取其他制裁措施,{{ name }} 将给于协助。 - 造成损害的,您应依法予以赔偿,{{ name }} 不承担任何责任。 - 如果 {{ name }} 发现或收到他人举报您发布的信息违反约定,{{ name }} 有权进行独立判断并采取技术手段予以删除、屏蔽或断开链接。 - 同时,{{ name }} 有权视用户的行为性质,采取包括但不限于暂停或终止服务,限制、冻结或终止账户使用,追究法律责任等措施。 - - #### 2. 版权 - 使用我们的服务并不代表您拥有我们的服务或您所访问的内容的任何知识产权。网站上的所有材料(包括但不限于题目内容、用户界面、Wiki)版权均受保护, - 归 {{ name }} 所有。除非另有说明,本网站上的材料和服务仅用于个人和非商业用途,未经 {{ name }} 书面许可, - 不得复制、修改、创建衍生作品、传播、出版、公开演示、公开展示和分发从本网站获得的任何信息、文件、产品或服务。 - - #### 3. 您在我们服务中发布的内容 - 我们的某些服务允许您提交内容。您保留对该内容持有的任何知识产权的所有权。 - 当您上传内容或通过其他方式向我们的服务提交内容时,您授予 {{ name }} 使用、持有、存储、复制、修改、创建衍生作品、传播、出版、公开演示、公开展示和分发此内容等权利。 - 您在此许可中授予的权限,仅能用于运营、宣传和改进我们的服务,以及开发新的服务。该项许可在您停止使用我们的服务后依然有效。 - 某些服务可能会向您提供一些方法,用于访问和删除您提供给该服务的内容。对于您提交至我们服务的任何内容,请确保您拥有向我们授予此许可的必要权利。 - 我们有权在未通知您的情况下删除我们认为侵犯了知识产权或违反了相关法律法规的内容。 - - #### 4. 对于发布题目的附加条款 - 您可以在 {{ name }} 上创建新题目。您上传到 {{ name }} 的题目,除了适用于本协议第三条(即“您在我们服务中发布的内容”)条款, - 还包含以下附加条款(若有冲突的条款,以附加条款中的优先): - - - 您上传到 {{ name }} 上的题目版权为 {{ name }} 和您共同拥有,我们会在相关页面或在对其进行分发、传播等操作时标明版权所有者。 - - {{ name }} 尊重他人知识产权和合法权益,请您在上传题目前确保拥有题目内容(包括但不限于题目描述、数据、图片等) - 的著作权及信息网络传播权或者已经取得上述全部权利人的许可并不存在任何著作权纠纷。{{ name }} 有权在不通知的情况下删除被认为侵权的题目。 - - 您可以申请将自己上传的优质题目合并到题库主干。我们的管理员会对您创建的题目的内容(包括但不限于评测数据等对用户不可见的信息) - 进行人工审核和适当修改以确认其符合国家基本法律法规。出于质量的考虑,我们也可能会拒绝您完全合法的合并到题库主干的请求。 - - 我们会维护服务的稳定,并对数据(包括您递交的题目)进行定期的备份,并尽量在关闭服务前通知您, - 但我们仍然不对任何题目(包括主干和非主干)提供永久存储或保留的承诺,出于安全的考虑推荐您自行保留题目的内容。 - - 您有权决定 {{ name }} 是否公开您上传的题目的数据。 - 公开题目数据意味着 {{ name }} 上的用户均有权利获取到您递交的题目的所有评测数据,但相关版权协议仍然生效。 - - #### 5. 隐私保护 - [隐私声明](#privacy) 介绍了您在使用我们的服务时,我们会如何处理您的个人数据和保护您的隐私。 - 使用我们的服务即表示您同意 {{ name }} 可以按照我们的隐私权政策使用您的个人数据。 - - #### 6. 修改和终止服务 - 我们始终在不断更改和改进我们的服务。我们可能会增加或删除功能,也可能暂停或彻底停止某项服务。 - 您可以随时停止使用我们的服务,尽管我们对此表示非常遗憾。{{ name }} 也可能随时停止向您提供服务,或随时对我们的服务增加或设置新的限制。 - - #### 7. 保证和免责声明 - 我们对服务内容、服务的具体功能,或其可靠性、可用性或满足您需要的能力不作任何承诺。我们的服务是按照现有技术和条件所能达到的现状提供的。 - 我们会尽最大努力向您提供服务,确保服务的连贯性和安全性。 - 但我们不能随时预见和防范法律、技术以及其他风险,包括但不限于不可抗力、病毒、木马、黑客攻击、系统不稳定、 - 第三方服务瑕疵、政府行为等原因可能导致的服务中断、数据丢失以及其他的损失和风险。 - - #### 8. 关于本条款 - 我们可以修改上述条款或任何适用于某项服务的附加条款,您应当定期查阅本条款。 - 所有修改的适用不具有追溯力,且会在公布十四天或更长时间后方始生效。 - 但是,对服务新功能的特别修改或由于法律原因所作的修改将立即生效。 - 如果您不同意服务的修改条款,应停止使用服务。 - - #### 9. 其他 - 如果您对这个协议或我们的服务有意见或建议,可与我们联系,我们会给予您必要的帮助。 +fontFamily: + type: + Open Sans: Open Sans + Seravek: Seravek + Segoe UI: Segoe UI + Verdana: Verdana + PingFang SC: PingFang SC + Hiragino Sans GB: Hiragino Sans GB + Microsoft Yahei: Microsoft Yahei + WenQuanYi Micro Hei: WenQuanYi Micro Hei + sans: sans + XiaoLai SC: 小赖 SC + family: setting_display + category: preference + value: Open Sans +codeFontFamily: + type: + monaco: Monaco + Source Code Pro: Source Code Pro + Consolas: Consolas + Lucida Console: Lucida Console + Fira Code: Fira Code + Roboto Mono: Roboto Mono + Inconsolata: Inconsolata + Hack: Hack + Jetbrains Mono: Jetbrains Mono + DM Mono: DM Mono + Ubuntu Mono: Ubuntu Mono + PT Mono: PT Mono + SF Mono: SF Mono + family: setting_display + category: preference + value: Source Code Pro +footer_extra_html: + type: textarea + name: footer_extra_html + desc: Footer Extra HTML + default: '' +nav_logo_dark: + type: text + name: nav_logo_dark + desc: Nav Logo Dark + default: /components/navigation/nav-logo-small_dark.png +preferredEditorType: + type: + sv: Split View + monaco: Monaco Editor + family: markdown + category: preference + value: sv +monacoTheme: + type: + vs-dark: VS Dark + vs-light: VS Light + category: preference + value: vs-light + family: markdown +theme: + type: + light: Light + dark: Dark + category: preference + value: light + family: setting_display +showInvisibleChar: + type: boolean + family: highlight + desc: show invisible characters when formatting code + category: preference +formatCode: + type: boolean + family: highlight + desc: Auto format code + category: preference + value: true +preload: + type: text + default: '' +domainNavigation: + type: boolean + family: setting_display + desc: Show Domain Navigation + value: true +about: + type: markdown + name: about + desc: About + value: | + # about 关于 {{ name }} + [{{ name }}](https://hydro.js.org) 致力于为用户提供安全、完善、开放的在线评测及题目交流等服务。 + + # contact 联系我们 + [联系我们](https://hydro.js.org/#%E8%81%94%E7%B3%BB%E6%88%91%E4%BB%AC) + + # privacy 隐私政策 + #### 1. 收集的信息 + 我们收集信息是为了向所有用户提供更好的服务。我们有两种信息收集方式: + + - 您向我们提供信息。在您注册 {{ name }} 帐户时,我们会要求您提供个人信息,例如您的电子邮件地址、QQ号码等。 + - 我们在您使用服务的过程中获取信息。我们会收集关于您使用的服务以及使用方式的信息,例如您在何时使用了我们服务。 + + #### 2. 如何使用收集到的信息 + 我们利用从所有服务中收集的信息来提供、维护、保护和改进这些服务,同时开发新的服务并保护 {{ name }} 以及用户的隐私。 + 当我们要将信息用于本隐私权政策未载明的其它用途时,则会事先征求您的同意。 + + #### 3. 访问和更新您的个人信息 + 无论您在何时使用我们的服务,我们都力求让您能够访问自己的个人信息。如果这些信息有误,我们会努力通过各种方式让您快速更新信息或删除信息。 + 在更新您的个人信息时,我们可能会要求您先验证自己的身份,然后再处理您的请求。 + 我们力求对服务进行完善的维护,以保护信息免遭意外或恶意的破坏。因此,当您从我们的服务中删除信息后, + 我们可能不会立即从在用的服务器中删除这些信息的残留副本,也可能不会从备份系统中删除相应的信息。 + + # tos 服务条款 + #### 0. 欢迎使用 {{ name }} + 注册 {{ name }} 帐户和/或使用 {{ name }} 提供的服务(包括网页提供的在线服务和题目评测的非在线服务等),即表示您已同意本条款。 + 请您务必审慎阅读,充分理解条款各项内容。 + + #### 1. 使用服务 + 您必须遵守各项服务中提供的所有政策(包括但不限于讨论和题解的版规)。 + 请勿滥用我们的服务。如,请勿干扰我们的服务,或尝试使用除我们提供的界面和指示以外的方法访问这些服务, + 或使用我们服务中出现的缺陷干扰其他网站或设施的正常运行。您仅能在法律允许的范围内使用我们的服务。 + 您在使用我们服务时须遵守我们服务器所在地的法律法规,不得利用我们服务从事违法违规行为,包括但不限于: + + - 发布、传送、传播、储存危害国家安全统一、破坏社会稳定、违反公序良俗、侮辱、诽谤、淫秽、暴力以及任何违反国家法律法规的内容; + - 发布、传送、传播、储存侵害他人知识产权、商业秘密等合法权利的内容; + - 恶意虚构事实、隐瞒真相以误导、欺骗他人; + - 发布、传送、传播广告信息及垃圾信息; + - 其他法律法规禁止的行为。 + + 如果您违反了约定,相关国家相关机关或机构可能会对您提起诉讼、进行行政处罚或采取其他制裁措施,{{ name }} 将给于协助。 + 造成损害的,您应依法予以赔偿,{{ name }} 不承担任何责任。 + 如果 {{ name }} 发现或收到他人举报您发布的信息违反约定,{{ name }} 有权进行独立判断并采取技术手段予以删除、屏蔽或断开链接。 + 同时,{{ name }} 有权视用户的行为性质,采取包括但不限于暂停或终止服务,限制、冻结或终止账户使用,追究法律责任等措施。 + + #### 2. 版权 + 使用我们的服务并不代表您拥有我们的服务或您所访问的内容的任何知识产权。网站上的所有材料(包括但不限于题目内容、用户界面、Wiki)版权均受保护, + 归 {{ name }} 所有。除非另有说明,本网站上的材料和服务仅用于个人和非商业用途,未经 {{ name }} 书面许可, + 不得复制、修改、创建衍生作品、传播、出版、公开演示、公开展示和分发从本网站获得的任何信息、文件、产品或服务。 + + #### 3. 您在我们服务中发布的内容 + 我们的某些服务允许您提交内容。您保留对该内容持有的任何知识产权的所有权。 + 当您上传内容或通过其他方式向我们的服务提交内容时,您授予 {{ name }} 使用、持有、存储、复制、修改、创建衍生作品、传播、出版、公开演示、公开展示和分发此内容等权利。 + 您在此许可中授予的权限,仅能用于运营、宣传和改进我们的服务,以及开发新的服务。该项许可在您停止使用我们的服务后依然有效。 + 某些服务可能会向您提供一些方法,用于访问和删除您提供给该服务的内容。对于您提交至我们服务的任何内容,请确保您拥有向我们授予此许可的必要权利。 + 我们有权在未通知您的情况下删除我们认为侵犯了知识产权或违反了相关法律法规的内容。 + + #### 4. 对于发布题目的附加条款 + 您可以在 {{ name }} 上创建新题目。您上传到 {{ name }} 的题目,除了适用于本协议第三条(即“您在我们服务中发布的内容”)条款, + 还包含以下附加条款(若有冲突的条款,以附加条款中的优先): + + - 您上传到 {{ name }} 上的题目版权为 {{ name }} 和您共同拥有,我们会在相关页面或在对其进行分发、传播等操作时标明版权所有者。 + - {{ name }} 尊重他人知识产权和合法权益,请您在上传题目前确保拥有题目内容(包括但不限于题目描述、数据、图片等) + 的著作权及信息网络传播权或者已经取得上述全部权利人的许可并不存在任何著作权纠纷。{{ name }} 有权在不通知的情况下删除被认为侵权的题目。 + - 您可以申请将自己上传的优质题目合并到题库主干。我们的管理员会对您创建的题目的内容(包括但不限于评测数据等对用户不可见的信息) + 进行人工审核和适当修改以确认其符合国家基本法律法规。出于质量的考虑,我们也可能会拒绝您完全合法的合并到题库主干的请求。 + - 我们会维护服务的稳定,并对数据(包括您递交的题目)进行定期的备份,并尽量在关闭服务前通知您, + 但我们仍然不对任何题目(包括主干和非主干)提供永久存储或保留的承诺,出于安全的考虑推荐您自行保留题目的内容。 + - 您有权决定 {{ name }} 是否公开您上传的题目的数据。 + 公开题目数据意味着 {{ name }} 上的用户均有权利获取到您递交的题目的所有评测数据,但相关版权协议仍然生效。 + + #### 5. 隐私保护 + [隐私声明](#privacy) 介绍了您在使用我们的服务时,我们会如何处理您的个人数据和保护您的隐私。 + 使用我们的服务即表示您同意 {{ name }} 可以按照我们的隐私权政策使用您的个人数据。 + + #### 6. 修改和终止服务 + 我们始终在不断更改和改进我们的服务。我们可能会增加或删除功能,也可能暂停或彻底停止某项服务。 + 您可以随时停止使用我们的服务,尽管我们对此表示非常遗憾。{{ name }} 也可能随时停止向您提供服务,或随时对我们的服务增加或设置新的限制。 + + #### 7. 保证和免责声明 + 我们对服务内容、服务的具体功能,或其可靠性、可用性或满足您需要的能力不作任何承诺。我们的服务是按照现有技术和条件所能达到的现状提供的。 + 我们会尽最大努力向您提供服务,确保服务的连贯性和安全性。 + 但我们不能随时预见和防范法律、技术以及其他风险,包括但不限于不可抗力、病毒、木马、黑客攻击、系统不稳定、 + 第三方服务瑕疵、政府行为等原因可能导致的服务中断、数据丢失以及其他的损失和风险。 + + #### 8. 关于本条款 + 我们可以修改上述条款或任何适用于某项服务的附加条款,您应当定期查阅本条款。 + 所有修改的适用不具有追溯力,且会在公布十四天或更长时间后方始生效。 + 但是,对服务新功能的特别修改或由于法律原因所作的修改将立即生效。 + 如果您不同意服务的修改条款,应停止使用服务。 + + #### 9. 其他 + 如果您对这个协议或我们的服务有意见或建议,可与我们联系,我们会给予您必要的帮助。 diff --git a/packages/ui-default/static/robots.txt b/packages/ui-default/static/robots.txt index 7cf4d17c4e..14534206ca 100644 --- a/packages/ui-default/static/robots.txt +++ b/packages/ui-default/static/robots.txt @@ -1,21 +1,21 @@ -User-agent: * -Disallow: /problem/ -Disallow: /d/*/problem/ -Disallow: /record -Disallow: /record/ -Disallow: /d/*/record -Disallow: /d/*/record/ -Disallow: /manage/ -Disallow: /domain/ -Disallow: /d/*/domain/ -Disallow: /home/ -Disallow: /d/*/home/ -Disallow: /d/*/user/ -Disallow: /p/*/submit -Disallow: /d/*/p/*/submit -Disallow: /p/*/files -Disallow: /d/*/p/*/files -Disallow: /p/*/edit -Disallow: /d/*/p/*/edit -Disallow: /p/*/file/ -Disallow: /d/*/p/*/file/ +User-agent: * +Disallow: /problem/ +Disallow: /d/*/problem/ +Disallow: /record +Disallow: /record/ +Disallow: /d/*/record +Disallow: /d/*/record/ +Disallow: /manage/ +Disallow: /domain/ +Disallow: /d/*/domain/ +Disallow: /home/ +Disallow: /d/*/home/ +Disallow: /d/*/user/ +Disallow: /p/*/submit +Disallow: /d/*/p/*/submit +Disallow: /p/*/files +Disallow: /d/*/p/*/files +Disallow: /p/*/edit +Disallow: /d/*/p/*/edit +Disallow: /p/*/file/ +Disallow: /d/*/p/*/file/ diff --git a/packages/ui-default/templates/about.html b/packages/ui-default/templates/about.html index 33c861c6ca..29ee8457b1 100644 --- a/packages/ui-default/templates/about.html +++ b/packages/ui-default/templates/about.html @@ -1,14 +1,14 @@ -{% extends "layout/wiki_base.html" %} -{% block wiki_content %} -{% set name = handler.domain.ui.name|default(model.system.get('server.name')) %} -{%- for section in sections -%} -
    -
    -

    {{ section.title }}

    -
    -
    - {{ section.content|markdown|safe }} -
    -
    -{%- endfor -%} +{% extends "layout/wiki_base.html" %} +{% block wiki_content %} +{% set name = handler.domain.ui.name|default(model.system.get('server.name')) %} +{%- for section in sections -%} +
    +
    +

    {{ section.title }}

    +
    +
    + {{ section.content|markdown|safe }} +
    +
    +{%- endfor -%} {% endblock %} \ No newline at end of file diff --git a/packages/ui-default/templates/api.html b/packages/ui-default/templates/api.html index 82129faeb6..bf5b49ac1b 100644 --- a/packages/ui-default/templates/api.html +++ b/packages/ui-default/templates/api.html @@ -1,10 +1,10 @@ -{% extends "layout/basic.html" %} -{% block content %} -
    - - -{% endblock %} +{% extends "layout/basic.html" %} +{% block content %} +
    + + +{% endblock %} diff --git a/packages/ui-default/templates/bsod.html b/packages/ui-default/templates/bsod.html index c24033e83c..f2e64a3738 100644 --- a/packages/ui-default/templates/bsod.html +++ b/packages/ui-default/templates/bsod.html @@ -1,34 +1,34 @@ - - - - Hydro System Error - - - - -
    -
    -#include <string.h>
    -int main() {
    -  char answer[42];
    -  strcpy(answer, "undefined will tell you the answer to life the universe and everything,");
    -  strcpy(answer, "but first of all, she is very sorry that Hydro meets some issues now.");
    -  strcpy(answer, "please wait patiently, or contact undefined impatiently about this error.");
    -  return 0;
    -}
    -/*
    -{{ error.message }}
    -{{ error.stack }}
    -*/
    -
    -
    - + + + + Hydro System Error + + + + +
    +
    +#include <string.h>
    +int main() {
    +  char answer[42];
    +  strcpy(answer, "undefined will tell you the answer to life the universe and everything,");
    +  strcpy(answer, "but first of all, she is very sorry that Hydro meets some issues now.");
    +  strcpy(answer, "please wait patiently, or contact undefined impatiently about this error.");
    +  return 0;
    +}
    +/*
    +{{ error.message }}
    +{{ error.stack }}
    +*/
    +
    +
    + \ No newline at end of file diff --git a/packages/ui-default/templates/components/comments_discussion.html b/packages/ui-default/templates/components/comments_discussion.html index 5c5d2e501a..19557423f8 100644 --- a/packages/ui-default/templates/components/comments_discussion.html +++ b/packages/ui-default/templates/components/comments_discussion.html @@ -1,165 +1,165 @@ -{% import "components/user.html" as user with context %} - -{% macro action(tooltip, operation, type, data, icon) %} - - - -{% endmacro %} - -{% macro render( - view, docs, udict, - comment_ref, - reply_ref, - comment_post_perm, - comment_edit_self_perm, - comment_delete_perm, - comment_delete_self_perm, - reply_post_perm, - reply_edit_self_perm, - reply_delete_perm, - reply_delete_self_perm, - comment_placeholder = 'Write Your Comment', - comment_post_op = 'reply', - comment_edit_op = 'edit_reply', - comment_post_text = 'Comment', - comment_edit_text = 'Update', - reply_post_op = 'tail_reply', - reply_post_text = 'Reply', - reply_edit_op = 'edit_tail_reply', - reply_edit_text = 'Update', - comment_delete_op = 'delete_reply', - reply_delete_op = 'delete_tail_reply', - reactions = {}, - ddoc = {} -) %} -
      -{% if handler.user.hasPerm(comment_post_perm) %} -
    • -
      -
      - -
      -
      - {% if ddoc.lock %} - - {% else %} -
      -
      -
      - -
      -
      - - -
      - -
      -
      -
      - -
      -
      -
        -
      • -
        -
        - -
        -
        -
        -
        -
        -
      • -
      - {% endif %} -
      -
      -
    • -{% endif %} -{%- for doc in docs -%} - {% set udoc = udict[doc.owner] %} -
    • -
      -
      - -
      -
      -
      -
      - {{ user.render_inline(udoc, avatar=false) }} - @ {{ datetimeSpan(doc['_id'])|safe }} - {% if doc.edited %} - - {% endif %} -
      -
      - {% if handler.user.hasPerm(reply_post_perm) %} - {{ action(_('Reply'), 'reply', 'comment', {operation: reply_post_op, drid: doc._id}, 'reply') }} - {% endif %} - {% if handler.user.hasPerm(comment_edit_self_perm) and handler.user.own(doc) %} - {{ action(_('Edit'), 'edit', 'comment', {operation: comment_edit_op, drid: doc._id}, 'edit') }} - {% endif %} - {% if (handler.user.hasPerm(comment_delete_self_perm) and handler.user.own(doc)) or handler.user.hasPerm(comment_delete_perm) %} - {{ action(_('Delete'), 'delete', 'comment', {operation: comment_delete_op, drid: doc._id}, 'delete') }} - {% endif %} - {% if (handler.user.hasPerm(perm.PERM_ADD_REACTION)) %} - {{ action('', 'react', 'comment', {operation: 'reaction', nodeType: 'drid', id: doc._id}, 'emoji') }} - {% endif %} -
      -
      -
      - {{ doc['content']|markdown|safe }} -
      - {% for e in Object.entries(doc.react or {})|sort(true, false, 1)|selectattr(1) %} -
      {{ e[0] }} {{ e[1] }}
      - {% endfor %} -
      -
      -
      -
        - {%- for rdoc in doc['reply'] -%} - {% set udoc = udict[rdoc.owner] %} -
      • -
        -
        - -
        -
        -
        -
        - {{ user.render_inline(udoc, avatar=false) }} - @ {{ datetimeSpan(rdoc._id)|safe }} - {% if rdoc.edited %} - - {% endif %} -
        -
        - {% if handler.user.hasPerm(reply_post_perm) %} - {{ action(_('Reply'), 'reply', 'reply', {}, 'reply') }} - {% endif %} - {% if handler.user.own(rdoc) and handler.user.hasPerm(reply_edit_self_perm) %} - {{ action(_('Edit'), 'edit', 'reply', {operation: reply_edit_op, drid: doc._id, drrid: rdoc._id}, 'edit') }} - {% endif %} - {% if (handler.user.own(rdoc) and handler.user.hasPerm(reply_delete_self_perm)) or handler.user.hasPerm(reply_delete_perm) %} - {{ action(_('Delete'), 'delete', 'reply', {operation: reply_delete_op, drid: doc._id, drrid: rdoc._id}, 'delete') }} - {% endif %} -
        -
        -
        - {{ rdoc.content|markdown|safe }} -
        -
        -
        -
        -
      • - {%- endfor -%} -
      -
      -
      -
    • -{%- endfor -%} -
    -{% endmacro %} +{% import "components/user.html" as user with context %} + +{% macro action(tooltip, operation, type, data, icon) %} + + + +{% endmacro %} + +{% macro render( + view, docs, udict, + comment_ref, + reply_ref, + comment_post_perm, + comment_edit_self_perm, + comment_delete_perm, + comment_delete_self_perm, + reply_post_perm, + reply_edit_self_perm, + reply_delete_perm, + reply_delete_self_perm, + comment_placeholder = 'Write Your Comment', + comment_post_op = 'reply', + comment_edit_op = 'edit_reply', + comment_post_text = 'Comment', + comment_edit_text = 'Update', + reply_post_op = 'tail_reply', + reply_post_text = 'Reply', + reply_edit_op = 'edit_tail_reply', + reply_edit_text = 'Update', + comment_delete_op = 'delete_reply', + reply_delete_op = 'delete_tail_reply', + reactions = {}, + ddoc = {} +) %} +
      +{% if handler.user.hasPerm(comment_post_perm) %} +
    • +
      +
      + +
      +
      + {% if ddoc.lock %} + + {% else %} +
      +
      +
      + +
      +
      + + +
      + +
      +
      +
      + +
      +
      +
        +
      • +
        +
        + +
        +
        +
        +
        +
        +
      • +
      + {% endif %} +
      +
      +
    • +{% endif %} +{%- for doc in docs -%} + {% set udoc = udict[doc.owner] %} +
    • +
      +
      + +
      +
      +
      +
      + {{ user.render_inline(udoc, avatar=false) }} + @ {{ datetimeSpan(doc['_id'])|safe }} + {% if doc.edited %} + + {% endif %} +
      +
      + {% if handler.user.hasPerm(reply_post_perm) %} + {{ action(_('Reply'), 'reply', 'comment', {operation: reply_post_op, drid: doc._id}, 'reply') }} + {% endif %} + {% if handler.user.hasPerm(comment_edit_self_perm) and handler.user.own(doc) %} + {{ action(_('Edit'), 'edit', 'comment', {operation: comment_edit_op, drid: doc._id}, 'edit') }} + {% endif %} + {% if (handler.user.hasPerm(comment_delete_self_perm) and handler.user.own(doc)) or handler.user.hasPerm(comment_delete_perm) %} + {{ action(_('Delete'), 'delete', 'comment', {operation: comment_delete_op, drid: doc._id}, 'delete') }} + {% endif %} + {% if (handler.user.hasPerm(perm.PERM_ADD_REACTION)) %} + {{ action('', 'react', 'comment', {operation: 'reaction', nodeType: 'drid', id: doc._id}, 'emoji') }} + {% endif %} +
      +
      +
      + {{ doc['content']|markdown|safe }} +
      + {% for e in Object.entries(doc.react or {})|sort(true, false, 1)|selectattr(1) %} +
      {{ e[0] }} {{ e[1] }}
      + {% endfor %} +
      +
      +
      +
        + {%- for rdoc in doc['reply'] -%} + {% set udoc = udict[rdoc.owner] %} +
      • +
        +
        + +
        +
        +
        +
        + {{ user.render_inline(udoc, avatar=false) }} + @ {{ datetimeSpan(rdoc._id)|safe }} + {% if rdoc.edited %} + + {% endif %} +
        +
        + {% if handler.user.hasPerm(reply_post_perm) %} + {{ action(_('Reply'), 'reply', 'reply', {}, 'reply') }} + {% endif %} + {% if handler.user.own(rdoc) and handler.user.hasPerm(reply_edit_self_perm) %} + {{ action(_('Edit'), 'edit', 'reply', {operation: reply_edit_op, drid: doc._id, drrid: rdoc._id}, 'edit') }} + {% endif %} + {% if (handler.user.own(rdoc) and handler.user.hasPerm(reply_delete_self_perm)) or handler.user.hasPerm(reply_delete_perm) %} + {{ action(_('Delete'), 'delete', 'reply', {operation: reply_delete_op, drid: doc._id, drrid: rdoc._id}, 'delete') }} + {% endif %} +
        +
        +
        + {{ rdoc.content|markdown|safe }} +
        +
        +
        +
        +
      • + {%- endfor -%} +
      +
      +
      +
    • +{%- endfor -%} +
    +{% endmacro %} diff --git a/packages/ui-default/templates/components/comments_solution.html b/packages/ui-default/templates/components/comments_solution.html index aa0d4203d8..7592dfe0bc 100644 --- a/packages/ui-default/templates/components/comments_solution.html +++ b/packages/ui-default/templates/components/comments_solution.html @@ -1,171 +1,171 @@ -{% import "components/user.html" as user with context %} -{% macro reply(mode_create, udoc, doc = {}, rdoc = {}) %} - -{% endmacro %} - -{% macro render( - view, docs, udict, - comment_ref, - reply_ref, - comment_post_perm, - comment_edit_perm, - comment_edit_self_perm, - comment_delete_perm, - comment_delete_self_perm, - reply_post_perm, - reply_edit_perm, - reply_edit_self_perm, - reply_delete_perm, - reply_delete_self_perm, - comment_placeholder = 'Write Your Comment', - comment_post_op = 'reply', - comment_edit_op = 'edit_reply', - comment_post_text = 'Comment', - comment_edit_text = 'Update', - reply_post_op = 'tail_reply', - reply_post_text = 'Reply', - reply_edit_op = 'edit_tail_reply', - reply_edit_text = 'Update', - comment_delete_op = 'delete_reply', - reply_delete_op = 'delete_tail_reply' -) %} -
      -{% if handler.user.hasPerm(comment_post_perm) %} -
    • -
      -
      -
      -
      0
      -
      -
      -
      -
      -
      - {{ user.render_inline(handler.user) }} -
      -
      -
      -
      -
      - -
      -
      - - -
      - -
      -
      -
      - -
      -
      -
        -
      • -
        -
        -
        -
        - {{ user.render_inline(handler.user, badge=false) }} -
        -
        -
        -
        -
        -
      • -
      -
      -
      -
    • -{% endif %} -{%- for doc in docs -%} - {% set udoc = udict[doc.owner] %} -
    • -
      -
      -
      - {% if handler.user.hasPerm(perm.PERM_VOTE_PROBLEM_SOLUTION) %} -
      {{ doc.vote }}
      -
      - - - -
      - {% else %} -
      {{ doc.vote }}
      - {% endif %} -
      -
      -
      -
      -
      - {{ user.render_inline(udoc) }} @ {{ datetimeSpan(doc._id)|safe }} -
      -
      - {% if pdoc %} - - - - {% endif %} - {% if handler.user.hasPerm(reply_post_perm) %} - - {% endif %} - {% if (handler.user.hasPerm(comment_edit_self_perm) and handler.user.own(doc)) or handler.user.hasPerm(comment_edit_perm) %} - - {% endif %} - {% if (handler.user.hasPerm(comment_delete_self_perm) and handler.user.own(doc)) or handler.user.hasPerm(comment_delete_perm) %} - - {% endif %} -
      -
      -
      - {{ doc['content']|markdown|safe }} -
      -
      -
        - {%- for rdoc in doc['reply'] -%} - {% set udoc = udict[rdoc['owner']] %} -
      • -
        -
        -
        -
        - {{ user.render_inline(udoc, badge=false) }} @ {{ datetimeSpan(rdoc['_id'])|safe }} -
        -
        - {% if handler.user.hasPerm(reply_post_perm) %} - - {% endif %} - {% if (handler.user.hasPerm(reply_edit_self_perm) and handler.user.own(doc)) or handler.user.hasPerm(reply_edit_perm) %} - - {% endif %} - {% if (handler.user.hasPerm(reply_delete_self_perm) and handler.user.own(doc)) or handler.user.hasPerm(reply_delete_perm) %} - - {% endif %} -
        -
        -
        - {{ rdoc['content']|markdown|safe }} -
        -
        -
        -
        -
      • - {%- endfor -%} -
      -
      -
      -
    • -{%- endfor -%} -
    -{% endmacro %} +{% import "components/user.html" as user with context %} +{% macro reply(mode_create, udoc, doc = {}, rdoc = {}) %} + +{% endmacro %} + +{% macro render( + view, docs, udict, + comment_ref, + reply_ref, + comment_post_perm, + comment_edit_perm, + comment_edit_self_perm, + comment_delete_perm, + comment_delete_self_perm, + reply_post_perm, + reply_edit_perm, + reply_edit_self_perm, + reply_delete_perm, + reply_delete_self_perm, + comment_placeholder = 'Write Your Comment', + comment_post_op = 'reply', + comment_edit_op = 'edit_reply', + comment_post_text = 'Comment', + comment_edit_text = 'Update', + reply_post_op = 'tail_reply', + reply_post_text = 'Reply', + reply_edit_op = 'edit_tail_reply', + reply_edit_text = 'Update', + comment_delete_op = 'delete_reply', + reply_delete_op = 'delete_tail_reply' +) %} +
      +{% if handler.user.hasPerm(comment_post_perm) %} +
    • +
      +
      +
      +
      0
      +
      +
      +
      +
      +
      + {{ user.render_inline(handler.user) }} +
      +
      +
      +
      +
      + +
      +
      + + +
      + +
      +
      +
      + +
      +
      +
        +
      • +
        +
        +
        +
        + {{ user.render_inline(handler.user, badge=false) }} +
        +
        +
        +
        +
        +
      • +
      +
      +
      +
    • +{% endif %} +{%- for doc in docs -%} + {% set udoc = udict[doc.owner] %} +
    • +
      +
      +
      + {% if handler.user.hasPerm(perm.PERM_VOTE_PROBLEM_SOLUTION) %} +
      {{ doc.vote }}
      +
      + + + +
      + {% else %} +
      {{ doc.vote }}
      + {% endif %} +
      +
      +
      +
      +
      + {{ user.render_inline(udoc) }} @ {{ datetimeSpan(doc._id)|safe }} +
      +
      + {% if pdoc %} + + + + {% endif %} + {% if handler.user.hasPerm(reply_post_perm) %} + + {% endif %} + {% if (handler.user.hasPerm(comment_edit_self_perm) and handler.user.own(doc)) or handler.user.hasPerm(comment_edit_perm) %} + + {% endif %} + {% if (handler.user.hasPerm(comment_delete_self_perm) and handler.user.own(doc)) or handler.user.hasPerm(comment_delete_perm) %} + + {% endif %} +
      +
      +
      + {{ doc['content']|markdown|safe }} +
      +
      +
        + {%- for rdoc in doc['reply'] -%} + {% set udoc = udict[rdoc['owner']] %} +
      • +
        +
        +
        +
        + {{ user.render_inline(udoc, badge=false) }} @ {{ datetimeSpan(rdoc['_id'])|safe }} +
        +
        + {% if handler.user.hasPerm(reply_post_perm) %} + + {% endif %} + {% if (handler.user.hasPerm(reply_edit_self_perm) and handler.user.own(doc)) or handler.user.hasPerm(reply_edit_perm) %} + + {% endif %} + {% if (handler.user.hasPerm(reply_delete_self_perm) and handler.user.own(doc)) or handler.user.hasPerm(reply_delete_perm) %} + + {% endif %} +
        +
        +
        + {{ rdoc['content']|markdown|safe }} +
        +
        +
        +
        +
      • + {%- endfor -%} +
      +
      +
      +
    • +{%- endfor -%} +
    +{% endmacro %} diff --git a/packages/ui-default/templates/components/contest.html b/packages/ui-default/templates/components/contest.html index d8c8a19d47..cc9f1efb62 100644 --- a/packages/ui-default/templates/components/contest.html +++ b/packages/ui-default/templates/components/contest.html @@ -1,12 +1,12 @@ -{% import "components/user.html" as user with context %} -{% macro render_time(tdoc_time) %} -{{ datetimeSpan(tdoc_time, false, 'YYYY-M-D H:mm')|safe }} -{% endmacro %} - -{% macro render_duration(tdoc) %} -{{ tdoc.duration|round(1) if tdoc.duration else ((tdoc.endAt.getTime() - tdoc.beginAt.getTime()) /1000 / 3600)|round(1) }} -{% endmacro %} - -{% macro render_clarification_subject(tdoc, pdict, subject) %} -{% if subject == 0 %}{{ _('General Issue') }}{% elif subject == -1 %}{{ _('Technical Issue') }}{% else %}{{ String.fromCharCode(65 + tdoc.pids.indexOf(subject)) + 1 }}. {{ pdict[subject].title }}{% endif %} +{% import "components/user.html" as user with context %} +{% macro render_time(tdoc_time) %} +{{ datetimeSpan(tdoc_time, false, 'YYYY-M-D H:mm')|safe }} +{% endmacro %} + +{% macro render_duration(tdoc) %} +{{ tdoc.duration|round(1) if tdoc.duration else ((tdoc.endAt.getTime() - tdoc.beginAt.getTime()) /1000 / 3600)|round(1) }} +{% endmacro %} + +{% macro render_clarification_subject(tdoc, pdict, subject) %} +{% if subject == 0 %}{{ _('General Issue') }}{% elif subject == -1 %}{{ _('Technical Issue') }}{% else %}{{ String.fromCharCode(65 + tdoc.pids.indexOf(subject)) + 1 }}. {{ pdict[subject].title }}{% endif %} {% endmacro %} \ No newline at end of file diff --git a/packages/ui-default/templates/components/form.html b/packages/ui-default/templates/components/form.html index a1a65b8a45..0d81c9ea92 100644 --- a/packages/ui-default/templates/components/form.html +++ b/packages/ui-default/templates/components/form.html @@ -1,213 +1,213 @@ -{% macro form_begin(args) %} -{% set label = args.label %} -{% set columns = args.columns %} -{% set last_column = args.last_column|default(true) %} -{% set required = args.required or false %} -{% set hotkeys = args.hotkeys or none %} -{% set row = args.row|default(true) %} -{% set no_label = args.no_label or false %} -{% set label_wrap = args.label_wrap|default(true) %} -{% if row %} -
    -{% endif %} -
    - {% if not no_label %} - - {% endif %} - {% endif %} -{% endmacro %} - -{% macro form_end(args) %} -{% set help_text = args.help_text or none %} -{% set row = args.row|default(true) %} -{% set no_label = args.no_label or false %} -{% set label_wrap = args.label_wrap|default(true) %} - {% if not no_label and label_wrap %} - - {% endif %} - {% if help_text %} -

    {{ _(help_text)|safe }}

    - {% endif %} -
    -{% if row %} -
    -{% endif %} -{% endmacro %} - -{% macro form_attr(form_class, args) %} -{% set disabled = args.disabled or false %} -{% set required = args.required or false %} -{% set autofocus = args.autofocus or false %} -{% set noAutocomplete = args.noAutocomplete or false %} -{% set extra_style = args.extra_style or false %} -{% set extra_class = args.extra_class %} -{% set extra_attr = args.extra_attr %} -{% set date = args.date or false %} -{% set time = args.time or false %} -{% set datetime = args.datetime or false %} - class="{{ form_class }}{% if extra_class %} {{ extra_class }}{% endif %}" - {% if disabled %}disabled{% endif %} - {% if required %}required{% endif %} - {% if autofocus %}autofocus data-autofocus{% endif %} - {% if noAutocomplete %}autocomplete="off"{% endif %} - {% if datetime %}data-pick-datetime{% endif %} - {% if date %}data-pick-date{% endif %} - {% if time %}data-pick-time{% endif %} - {% if extra_attr %}{{ extra_attr }}{% endif %} - {% if extra_style %}style="{{extra_style}}"{% endif %} -{% endmacro %} - -{% macro container_attr(container_class, args) %} -{% set extra_class = args.extra_class or none %} - class="{{ container_class }}{% if extra_class %} {{ extra_class }}{% endif %}" -{% endmacro %} - -{% macro select(args) %} -
    - -
    -{% endmacro %} - -{% macro form_select(args) %} -{{ form_begin({columns:5}|assign(args)) }} -{{ select(args) }} -{{ form_end(args) }} -{% endmacro %} - -{% macro radio(args) %} -
    -{%- for k, v in options -%} - -{%- endfor -%} -
    -{% endmacro %} - -{% macro form_radio(args) %} -{{ form_begin({columns:5, label_wrap:false}|assign(args)) }} -{{ radio(args) }} -{{ form_end({label_warp:false}|assign(args)) }} -{% endmacro %} - -{% macro image_radio(args) %} -
    -{%- for k, v in options -%} - -{%- endfor -%} -
    -{% endmacro %} - -{% macro form_image_radio(args) %} -{{ form_begin({columns:8, label_warp:false}|assign(args)) }} -{{ image_radio(args) }} -{{ form_end({label_warp:false}|assign(args)) }} -{% endmacro %} - -{% macro text(args) %} -
    - -
    -{% endmacro %} - -{% macro form_text(args) %} -{{ form_begin({columns:5}|assign(args)) }} -{{ text(args) }} -{{ form_end(args) }} -{% endmacro %} - -{% macro textarea(args) %} -{% set markdown = args.markdown or false %} -{% set nospellcheck = args.nospellcheck or false %} -
    - -
    -{% endmacro %} - -{% macro form_textarea(args) %} -{{ form_begin({columns:10}|assign(args)) }} -{{ textarea(args) }} -{{ form_end(args) }} -{% endmacro %} - -{% macro checkbox(args) %} -
    - -
    -{% endmacro %} - -{% macro form_checkbox(args) %} -{{ form_begin({columns:5}|assign(args)) }} -{{ checkbox(args) }} -{{ form_end(args) }} -{% endmacro %} +{% macro form_begin(args) %} +{% set label = args.label %} +{% set columns = args.columns %} +{% set last_column = args.last_column|default(true) %} +{% set required = args.required or false %} +{% set hotkeys = args.hotkeys or none %} +{% set row = args.row|default(true) %} +{% set no_label = args.no_label or false %} +{% set label_wrap = args.label_wrap|default(true) %} +{% if row %} +
    +{% endif %} +
    + {% if not no_label %} + + {% endif %} + {% endif %} +{% endmacro %} + +{% macro form_end(args) %} +{% set help_text = args.help_text or none %} +{% set row = args.row|default(true) %} +{% set no_label = args.no_label or false %} +{% set label_wrap = args.label_wrap|default(true) %} + {% if not no_label and label_wrap %} + + {% endif %} + {% if help_text %} +

    {{ _(help_text)|safe }}

    + {% endif %} +
    +{% if row %} +
    +{% endif %} +{% endmacro %} + +{% macro form_attr(form_class, args) %} +{% set disabled = args.disabled or false %} +{% set required = args.required or false %} +{% set autofocus = args.autofocus or false %} +{% set noAutocomplete = args.noAutocomplete or false %} +{% set extra_style = args.extra_style or false %} +{% set extra_class = args.extra_class %} +{% set extra_attr = args.extra_attr %} +{% set date = args.date or false %} +{% set time = args.time or false %} +{% set datetime = args.datetime or false %} + class="{{ form_class }}{% if extra_class %} {{ extra_class }}{% endif %}" + {% if disabled %}disabled{% endif %} + {% if required %}required{% endif %} + {% if autofocus %}autofocus data-autofocus{% endif %} + {% if noAutocomplete %}autocomplete="off"{% endif %} + {% if datetime %}data-pick-datetime{% endif %} + {% if date %}data-pick-date{% endif %} + {% if time %}data-pick-time{% endif %} + {% if extra_attr %}{{ extra_attr }}{% endif %} + {% if extra_style %}style="{{extra_style}}"{% endif %} +{% endmacro %} + +{% macro container_attr(container_class, args) %} +{% set extra_class = args.extra_class or none %} + class="{{ container_class }}{% if extra_class %} {{ extra_class }}{% endif %}" +{% endmacro %} + +{% macro select(args) %} +
    + +
    +{% endmacro %} + +{% macro form_select(args) %} +{{ form_begin({columns:5}|assign(args)) }} +{{ select(args) }} +{{ form_end(args) }} +{% endmacro %} + +{% macro radio(args) %} +
    +{%- for k, v in options -%} + +{%- endfor -%} +
    +{% endmacro %} + +{% macro form_radio(args) %} +{{ form_begin({columns:5, label_wrap:false}|assign(args)) }} +{{ radio(args) }} +{{ form_end({label_warp:false}|assign(args)) }} +{% endmacro %} + +{% macro image_radio(args) %} +
    +{%- for k, v in options -%} + +{%- endfor -%} +
    +{% endmacro %} + +{% macro form_image_radio(args) %} +{{ form_begin({columns:8, label_warp:false}|assign(args)) }} +{{ image_radio(args) }} +{{ form_end({label_warp:false}|assign(args)) }} +{% endmacro %} + +{% macro text(args) %} +
    + +
    +{% endmacro %} + +{% macro form_text(args) %} +{{ form_begin({columns:5}|assign(args)) }} +{{ text(args) }} +{{ form_end(args) }} +{% endmacro %} + +{% macro textarea(args) %} +{% set markdown = args.markdown or false %} +{% set nospellcheck = args.nospellcheck or false %} +
    + +
    +{% endmacro %} + +{% macro form_textarea(args) %} +{{ form_begin({columns:10}|assign(args)) }} +{{ textarea(args) }} +{{ form_end(args) }} +{% endmacro %} + +{% macro checkbox(args) %} +
    + +
    +{% endmacro %} + +{% macro form_checkbox(args) %} +{{ form_begin({columns:5}|assign(args)) }} +{{ checkbox(args) }} +{{ form_end(args) }} +{% endmacro %} diff --git a/packages/ui-default/templates/components/home.html b/packages/ui-default/templates/components/home.html index cb58e67016..afc5283fd1 100644 --- a/packages/ui-default/templates/components/home.html +++ b/packages/ui-default/templates/components/home.html @@ -1,20 +1,20 @@ -{% import "components/sidemenu.html" as sidemenu with context %} -{% macro render_sidebar() %} -
    - -
    -{% endmacro %} +{% import "components/sidemenu.html" as sidemenu with context %} +{% macro render_sidebar() %} +
    + +
    +{% endmacro %} diff --git a/packages/ui-default/templates/components/homework.html b/packages/ui-default/templates/components/homework.html index 8a168f845d..05b9b23138 100644 --- a/packages/ui-default/templates/components/homework.html +++ b/packages/ui-default/templates/components/homework.html @@ -1,8 +1,8 @@ -{% import "components/user.html" as user with context %} -{% macro render_time(tdoc_time) %} -{{ datetimeSpan(tdoc_time, false, 'YYYY-M-D H:mm')|safe }} -{% endmacro %} - -{% macro render_extension(tdoc) %} -{{ ((tdoc['endAt'].getTime() - tdoc['penaltySince'].getTime())/ 1000 / 3600)|round(1) }} -{% endmacro %} +{% import "components/user.html" as user with context %} +{% macro render_time(tdoc_time) %} +{{ datetimeSpan(tdoc_time, false, 'YYYY-M-D H:mm')|safe }} +{% endmacro %} + +{% macro render_extension(tdoc) %} +{{ ((tdoc['endAt'].getTime() - tdoc['penaltySince'].getTime())/ 1000 / 3600)|round(1) }} +{% endmacro %} diff --git a/packages/ui-default/templates/components/md_hint.html b/packages/ui-default/templates/components/md_hint.html index a3859a56b2..fb84c8429b 100644 --- a/packages/ui-default/templates/components/md_hint.html +++ b/packages/ui-default/templates/components/md_hint.html @@ -1,39 +1,39 @@ -
    -
    -
    -
    {{ _('Inline codes') }}
    -
    `std::cout()`
    -
    {{ _('Code blocks') }}
    -
    ```c++
    -int main() {
    -  return 0;
    -}
    -```
    -
    {{ _('Inline formulas') }}
    -
    $E=mc^2$
    -
    {{ _('Formula blocks') }}
    -
    $$E=mc^2$$
    -
    {{ _('Links') }}
    -
    [{{ _('Text') }}](https://...)
    -
    {{ _('Highlight') }}
    -
    =={{ _('Text') }}==
    -
    {{ _('Images') }}
    -
    ![{{ _('Description') }}](https://...)
    -
    {{ _('Images With Size') }}
    -
    ![{{ _('Description') }}](url =100x100)
    -
    {{ _('Footnote') }}
    -
    Here is a ref[^1].
    -
    -[^1]: And the footnote.
    -
    {{ _('Videos') }}
    -
    @[video](https://.../a.mp4)
    -
    {{ _('Mention')}}
    -
    @[](/user/uid)
    -
    -

    {{ _('Learn More') }}

    - -
    -
    +
    +
    +
    +
    {{ _('Inline codes') }}
    +
    `std::cout()`
    +
    {{ _('Code blocks') }}
    +
    ```c++
    +int main() {
    +  return 0;
    +}
    +```
    +
    {{ _('Inline formulas') }}
    +
    $E=mc^2$
    +
    {{ _('Formula blocks') }}
    +
    $$E=mc^2$$
    +
    {{ _('Links') }}
    +
    [{{ _('Text') }}](https://...)
    +
    {{ _('Highlight') }}
    +
    =={{ _('Text') }}==
    +
    {{ _('Images') }}
    +
    ![{{ _('Description') }}](https://...)
    +
    {{ _('Images With Size') }}
    +
    ![{{ _('Description') }}](url =100x100)
    +
    {{ _('Footnote') }}
    +
    Here is a ref[^1].
    +
    +[^1]: And the footnote.
    +
    {{ _('Videos') }}
    +
    @[video](https://.../a.mp4)
    +
    {{ _('Mention')}}
    +
    @[](/user/uid)
    +
    +

    {{ _('Learn More') }}

    + +
    +
    diff --git a/packages/ui-default/templates/components/noscript_note.html b/packages/ui-default/templates/components/noscript_note.html index 514cc556f6..b493c23af5 100644 --- a/packages/ui-default/templates/components/noscript_note.html +++ b/packages/ui-default/templates/components/noscript_note.html @@ -1,15 +1,15 @@ -{% macro render() %} -{% if not isIE(handler.request.headers['user-agent']) and not handler.session.legacy %} - -{% else %} -
    -
    -

    {{ _('This page needs JavaScript to work.') }}

    -
    -
    -{% endif %} -{% endmacro %} +{% macro render() %} +{% if not isIE(handler.request.headers['user-agent']) and not handler.session.legacy %} + +{% else %} +
    +
    +

    {{ _('This page needs JavaScript to work.') }}

    +
    +
    +{% endif %} +{% endmacro %} diff --git a/packages/ui-default/templates/components/nothing.html b/packages/ui-default/templates/components/nothing.html index 27ab520d16..248ba5a50a 100644 --- a/packages/ui-default/templates/components/nothing.html +++ b/packages/ui-default/templates/components/nothing.html @@ -1,6 +1,6 @@ -{% macro render(text, compact=false, args=[]) %} -
    -
    - {{ _(text).format(args) }} -
    -{% endmacro %} +{% macro render(text, compact=false, args=[]) %} +
    +
    + {{ _(text).format(args) }} +
    +{% endmacro %} diff --git a/packages/ui-default/templates/components/paginator.html b/packages/ui-default/templates/components/paginator.html index 561dd77110..3d7173d153 100644 --- a/packages/ui-default/templates/components/paginator.html +++ b/packages/ui-default/templates/components/paginator.html @@ -1,25 +1,25 @@ -{% macro render(page, num_pages, add_qs='', position='bottom') %} -{% if num_pages > 0 %} - -{% endif %} -{% endmacro %} +{% macro render(page, num_pages, add_qs='', position='bottom') %} +{% if num_pages > 0 %} + +{% endif %} +{% endmacro %} diff --git a/packages/ui-default/templates/components/problem.html b/packages/ui-default/templates/components/problem.html index c5d4602fa7..3a7485f9f2 100644 --- a/packages/ui-default/templates/components/problem.html +++ b/packages/ui-default/templates/components/problem.html @@ -1,35 +1,35 @@ -{% macro render_problem_title(pdoc, tdoc=none, show_tags=true, show_invisible_flag=true, invalid=false, inline=false, small=false, alphabetic=false) %} -{%- if not invalid -%} - {% set _linkArgs = { pid:pdoc.pid|default(pdoc.docId) } %} - {% if tdoc %}{{ set(_linkArgs, 'query', {tid:tdoc.docId}) }}{% endif %} - {% if pdoc.domainId !== handler.args.domainId %}{{ set(_linkArgs, 'domainId', pdoc.domainId) }}{% endif %} - -{%- endif -%} -{%- if pdoc.domainId !== handler.args.domainId -%}{{ pdoc.domainId }}#{%- endif -%} -{%- if tdoc and alphabetic -%} - {{ String.fromCharCode(65 + tdoc.pids.indexOf(pdoc.docId)) if tdoc.pids.includes(pdoc.docId) else '#' }} -{%- else -%} - {{ pdoc.pid or ('P'+pdoc.docId if pdoc.domainId === handler.args.domainId else pdoc.docId) }} -{%- endif -%} -{%- if not small -%}  {{ pdoc.title }}{%- endif -%} -{%- if not invalid -%} - -{%- endif -%} -{%- if pdoc.hidden and show_invisible_flag -%} - ({{ _('Hidden') }}) -{%- endif -%} -{%- if show_tags -%}{{ render_problem_tags(pdoc, inline=inline) }}{%- endif -%} -{% endmacro %} - -{% macro render_problem_tags(pdoc, show_none_label=false, inline=false) %} -{%- if pdoc.tag|length > 0 %} - {%- if not inline %}
      {% endif -%} - {%- for tag in pdoc['tag'] %} - {% set _w = '"' if tag.includes(' ') else '' %} -
    • {{ tag }}
    • - {%- endfor -%} - {%- if not inline %}
    {% endif -%} -{%- else -%} - {%- if show_none_label -%}{{ _('(None)') }}{%- endif -%} -{%- endif -%} -{% endmacro %} +{% macro render_problem_title(pdoc, tdoc=none, show_tags=true, show_invisible_flag=true, invalid=false, inline=false, small=false, alphabetic=false) %} +{%- if not invalid -%} + {% set _linkArgs = { pid:pdoc.pid|default(pdoc.docId) } %} + {% if tdoc %}{{ set(_linkArgs, 'query', {tid:tdoc.docId}) }}{% endif %} + {% if pdoc.domainId !== handler.args.domainId %}{{ set(_linkArgs, 'domainId', pdoc.domainId) }}{% endif %} + +{%- endif -%} +{%- if pdoc.domainId !== handler.args.domainId -%}{{ pdoc.domainId }}#{%- endif -%} +{%- if tdoc and alphabetic -%} + {{ String.fromCharCode(65 + tdoc.pids.indexOf(pdoc.docId)) if tdoc.pids.includes(pdoc.docId) else '#' }} +{%- else -%} + {{ pdoc.pid or ('P'+pdoc.docId if pdoc.domainId === handler.args.domainId else pdoc.docId) }} +{%- endif -%} +{%- if not small -%}  {{ pdoc.title }}{%- endif -%} +{%- if not invalid -%} + +{%- endif -%} +{%- if pdoc.hidden and show_invisible_flag -%} + ({{ _('Hidden') }}) +{%- endif -%} +{%- if show_tags -%}{{ render_problem_tags(pdoc, inline=inline) }}{%- endif -%} +{% endmacro %} + +{% macro render_problem_tags(pdoc, show_none_label=false, inline=false) %} +{%- if pdoc.tag|length > 0 %} + {%- if not inline %}
      {% endif -%} + {%- for tag in pdoc['tag'] %} + {% set _w = '"' if tag.includes(' ') else '' %} +
    • {{ tag }}
    • + {%- endfor -%} + {%- if not inline %}
    {% endif -%} +{%- else -%} + {%- if show_none_label -%}{{ _('(None)') }}{%- endif -%} +{%- endif -%} +{% endmacro %} diff --git a/packages/ui-default/templates/components/record.html b/packages/ui-default/templates/components/record.html index bcf615cfc0..3f709a600f 100644 --- a/packages/ui-default/templates/components/record.html +++ b/packages/ui-default/templates/components/record.html @@ -1,21 +1,21 @@ -{% macro render_status_td(rdoc, rid_key='_id', class='', allDomain=false, short=false, displayScore) %} - - - {% if rdoc.status == STATUS.STATUS_JUDGING %} -
    -
    -
    - {% endif %} - -{% endmacro %} +{% macro render_status_td(rdoc, rid_key='_id', class='', allDomain=false, short=false, displayScore) %} + + + {% if rdoc.status == STATUS.STATUS_JUDGING %} +
    +
    +
    + {% endif %} + +{% endmacro %} diff --git a/packages/ui-default/templates/components/sidemenu.html b/packages/ui-default/templates/components/sidemenu.html index 7ea8542f4b..fac971a6bf 100644 --- a/packages/ui-default/templates/components/sidemenu.html +++ b/packages/ui-default/templates/components/sidemenu.html @@ -1,11 +1,11 @@ -{% macro render_item(icon_name, page_name, args={}, label=none, menu_item=none) %} -{% set target_url = url(page_name, args) if page_name else '#' %} - -{% endmacro %} +{% macro render_item(icon_name, page_name, args={}, label=none, menu_item=none) %} +{% set target_url = url(page_name, args) if page_name else '#' %} + +{% endmacro %} diff --git a/packages/ui-default/templates/components/user.html b/packages/ui-default/templates/components/user.html index 83d149e06c..2f47f9b3b4 100644 --- a/packages/ui-default/templates/components/user.html +++ b/packages/ui-default/templates/components/user.html @@ -1,60 +1,60 @@ -{% macro render_inline(udoc, avatar=true, badge=true, modbadge=true, levelbadge=true, classname = true) %} -{% if udoc %} - -{% else %} - -{% endif %} -{% endmacro %} +{% macro render_inline(udoc, avatar=true, badge=true, modbadge=true, levelbadge=true, classname = true) %} +{% if udoc %} + +{% else %} + +{% endif %} +{% endmacro %} diff --git a/packages/ui-default/templates/contest_balloon.html b/packages/ui-default/templates/contest_balloon.html index 771b44e587..875cda274c 100644 --- a/packages/ui-default/templates/contest_balloon.html +++ b/packages/ui-default/templates/contest_balloon.html @@ -1,48 +1,48 @@ -{% import "components/nothing.html" as nothing with context %} -{% extends "layout/basic.html" %} -{% block content %} -{{ set(UiContext, 'tdoc', tdoc) }} -
    -
    -
    -
    -

    {{ _('Balloon Status') }}

    -
    - -
    -
    - {{ noscript_note.render() }} -
    - {% if not tdoc.balloon|length %} - {{ nothing.render('Please set the balloon color for each problem first.') }} - {% else %} - - - - - - - - - - - - - - - - - - - - {% include "partials/contest_balloon.html" %} -
    {{ _('Status') }}{{ _('#') }}{{ _('Problem') }}{{ _('Submit By') }}{{ _('Send By') }}{{ _('Awards') }}
    - {% endif %} -
    -
    -
    -
    - {% include 'partials/contest_sidebar_management.html' %} -
    -
    -{% endblock %} +{% import "components/nothing.html" as nothing with context %} +{% extends "layout/basic.html" %} +{% block content %} +{{ set(UiContext, 'tdoc', tdoc) }} +
    +
    +
    +
    +

    {{ _('Balloon Status') }}

    +
    + +
    +
    + {{ noscript_note.render() }} +
    + {% if not tdoc.balloon|length %} + {{ nothing.render('Please set the balloon color for each problem first.') }} + {% else %} + + + + + + + + + + + + + + + + + + + + {% include "partials/contest_balloon.html" %} +
    {{ _('Status') }}{{ _('#') }}{{ _('Problem') }}{{ _('Submit By') }}{{ _('Send By') }}{{ _('Awards') }}
    + {% endif %} +
    +
    +
    +
    + {% include 'partials/contest_sidebar_management.html' %} +
    +
    +{% endblock %} diff --git a/packages/ui-default/templates/contest_detail.html b/packages/ui-default/templates/contest_detail.html index cc73defb25..bde2a4d89e 100644 --- a/packages/ui-default/templates/contest_detail.html +++ b/packages/ui-default/templates/contest_detail.html @@ -1,50 +1,50 @@ -{% extends "layout/basic.html" %} -{% import "components/contest.html" as contest with context %} -{% import "components/record.html" as record with context %} -{% import "components/problem.html" as problem with context %} -{% block content %} -{{ set(UiContext, 'tdoc', tdoc) }} -{{ set(UiContext, 'tsdoc', tsdoc) }} -
    -
    -
    -
    -

    {{ tdoc.title }}

    -
    -
    - {{ _(model.contest.statusText(tdoc, tsdoc)) }} - {{ _(model.contest.RULES[tdoc.rule].TEXT) }} - {{ _('Start at') }}: {{ contest.render_time(tsdoc.startAt or tdoc.beginAt) }} - {{ contest.render_duration(tdoc) }} {{ _('hour(s)') }} - {{ _('Host') }}: {{ user.render_inline(udict[tdoc.owner], badge=false) }} - {{ tdoc['attend']|default(0) }} - {% if tsdoc.attend %} - {{ _('Attended') }} - {% endif %} -
    -
    -
    -
    - {{ tdoc['content']|markdown|safe }} - {% if tdoc.duration %} -
    -

    {{ _('The contest is a flexible time contest. You need to complete the contest within a specified time after you attended.') }}

    -
    - {% endif %} -
    -
    - {% if tdoc.files.length %} -
    -
    -

    {{ _('Files') }}

    -
    - {% include "partials/files.html" %} -
    - {% endif %} -
    -
    - {% set owner_udoc = udict[tdoc.owner] %} - {% include "partials/contest_sidebar.html" %} -
    -
    -{% endblock %} +{% extends "layout/basic.html" %} +{% import "components/contest.html" as contest with context %} +{% import "components/record.html" as record with context %} +{% import "components/problem.html" as problem with context %} +{% block content %} +{{ set(UiContext, 'tdoc', tdoc) }} +{{ set(UiContext, 'tsdoc', tsdoc) }} +
    +
    +
    +
    +

    {{ tdoc.title }}

    +
    +
    + {{ _(model.contest.statusText(tdoc, tsdoc)) }} + {{ _(model.contest.RULES[tdoc.rule].TEXT) }} + {{ _('Start at') }}: {{ contest.render_time(tsdoc.startAt or tdoc.beginAt) }} + {{ contest.render_duration(tdoc) }} {{ _('hour(s)') }} + {{ _('Host') }}: {{ user.render_inline(udict[tdoc.owner], badge=false) }} + {{ tdoc['attend']|default(0) }} + {% if tsdoc.attend %} + {{ _('Attended') }} + {% endif %} +
    +
    +
    +
    + {{ tdoc['content']|markdown|safe }} + {% if tdoc.duration %} +
    +

    {{ _('The contest is a flexible time contest. You need to complete the contest within a specified time after you attended.') }}

    +
    + {% endif %} +
    +
    + {% if tdoc.files.length %} +
    +
    +

    {{ _('Files') }}

    +
    + {% include "partials/files.html" %} +
    + {% endif %} +
    +
    + {% set owner_udoc = udict[tdoc.owner] %} + {% include "partials/contest_sidebar.html" %} +
    +
    +{% endblock %} diff --git a/packages/ui-default/templates/contest_edit.html b/packages/ui-default/templates/contest_edit.html index ebf3a17604..5f5f5d7ff7 100644 --- a/packages/ui-default/templates/contest_edit.html +++ b/packages/ui-default/templates/contest_edit.html @@ -1,218 +1,218 @@ -{% extends "layout/basic.html" %} -{% block content %} -
    -
    -
    -
    -
    -

    {{ _('Basic Info') }}

    -
    -
    -
    - {{ form.form_select({ - columns:3, - label:'Rule', - name:'rule', - options:rules, - value:tdoc['rule']|default(''), - row:false - }) }} - {{ form.form_text({ - columns:9, - label:'Title', - name:'title', - placeholder:_('title'), - value:tdoc.title|default(''), - autofocus:true, - row:false - }) }} -
    -
    - {{ form.form_text({ - columns:3, - label:'Begin Date', - name:'beginAtDate', - placeholder:'YYYY-mm-dd', - value:beginAt.format('YYYY-M-D'), - date:true, - row:false - }) }} - {{ form.form_text({ - columns:3, - label:'Begin Time', - name:'beginAtTime', - placeholder:'HH:MM', - value:beginAt.format('H:mm'), - time:true, - row:false - }) }} - {{ form.form_text({ - columns:2, - label:'Duration (hours)', - name:'duration', - value:duration|default('3'), - row:false - }) }} - {{ form.form_text({ - columns:4, - label:'End Time', - name:'endAt', - placeholder:'YYYY-mm-dd HH:MM', - value:beginAt.add(duration, 'hours').format('YYYY-M-D HH:mm'), - disabled:true, - row:false - }) }} -
    - {{ form.form_text({ - columns:12, - label:'Problems', - name:'pids', - value:pids, - placeholder:_("Seperated with ','"), - row:true - }) }} - {{ form.form_textarea({ - columns:null, - label:'Description', - name:'content', - value:tdoc['content']|default(''), - markdown:true - }) }} -
    -
    -

    {{ _('Permission Control') }}

    -
    -
    - {{ form.form_text({ - columns:12, - label:'Contest Maintainer', - name:'maintainer', - help_text:_('Allow to maintain this {0}').format(_('contest')), - value:tdoc.maintainer|default('') - }) }} -
    - {{ form.form_select({ - columns:3, - label:'Permission Control', - name:'permission', - options:{ - 'public': _('Public'), - 'invite': _('Require Invitation Code'), - 'assign': _('Assign User or Group') - }, - value: ("public" if not tdoc._code else "invite") if not tdoc.assign|length else "assign", - disabled:true, - row:false - }) }} -
    - {{ form.form_text({ - columns:9, - label:'Assign', - name:'assign', - placeholder:_('Group / UID'), - value:tdoc.assign|default(''), - disabled:true, - row:false - }) }} -
    -
    - {{ form.form_text({ - columns:9, - label:'Invitation Code', - name:'code', - placeholder:_('(leave blank if none)'), - value:tdoc._code|default(''), - disabled:true, - row:false - }) }} -
    -
    -
    -
    -

    {{ _('Contest Settings') }}

    -
    -
    -
    - {{ form.form_checkbox({ - columns:2, - label:'Rated', - name:'rated', - placeholder:_('Is rated'), - value:tdoc.rated|default(true), - row:false - }) }} - {{ form.form_checkbox({ - columns:3, - label:'Auto hide-and show', - name:'autoHide', - placeholder:_('Auto hide problems during the contest'), - value:handler.user.hasPerm(perm.PERM_EDIT_PROBLEM) and (tdoc.autoHide|default(true)), - disabled:not handler.user.hasPerm(perm.PERM_EDIT_PROBLEM), - row:false - }) }} - {{ form.form_checkbox({ - columns:3, - label:'Allow View Code', - name:'allowViewCode', - placeholder:_('Allow user view others code after contest'), - value:tdoc.allowViewCode|default(true), - row:false - }) }} - - -
    -
    -
    - {% if page_name == 'contest_edit' %} - - - {% if handler.user.own(tdoc) or handler.user.hasPerm(perm.PERM_EDIT_CONTEST) %} - - {% endif %} - {% else %} - - {% endif %} - -
    -
    - -
    -
    -
    -
    - {% include 'components/md_hint.html' %} -
    -
    -{% endblock %} +{% extends "layout/basic.html" %} +{% block content %} +
    +
    +
    +
    +
    +

    {{ _('Basic Info') }}

    +
    +
    +
    + {{ form.form_select({ + columns:3, + label:'Rule', + name:'rule', + options:rules, + value:tdoc['rule']|default(''), + row:false + }) }} + {{ form.form_text({ + columns:9, + label:'Title', + name:'title', + placeholder:_('title'), + value:tdoc.title|default(''), + autofocus:true, + row:false + }) }} +
    +
    + {{ form.form_text({ + columns:3, + label:'Begin Date', + name:'beginAtDate', + placeholder:'YYYY-mm-dd', + value:beginAt.format('YYYY-M-D'), + date:true, + row:false + }) }} + {{ form.form_text({ + columns:3, + label:'Begin Time', + name:'beginAtTime', + placeholder:'HH:MM', + value:beginAt.format('H:mm'), + time:true, + row:false + }) }} + {{ form.form_text({ + columns:2, + label:'Duration (hours)', + name:'duration', + value:duration|default('3'), + row:false + }) }} + {{ form.form_text({ + columns:4, + label:'End Time', + name:'endAt', + placeholder:'YYYY-mm-dd HH:MM', + value:beginAt.add(duration, 'hours').format('YYYY-M-D HH:mm'), + disabled:true, + row:false + }) }} +
    + {{ form.form_text({ + columns:12, + label:'Problems', + name:'pids', + value:pids, + placeholder:_("Seperated with ','"), + row:true + }) }} + {{ form.form_textarea({ + columns:null, + label:'Description', + name:'content', + value:tdoc['content']|default(''), + markdown:true + }) }} +
    +
    +

    {{ _('Permission Control') }}

    +
    +
    + {{ form.form_text({ + columns:12, + label:'Contest Maintainer', + name:'maintainer', + help_text:_('Allow to maintain this {0}').format(_('contest')), + value:tdoc.maintainer|default('') + }) }} +
    + {{ form.form_select({ + columns:3, + label:'Permission Control', + name:'permission', + options:{ + 'public': _('Public'), + 'invite': _('Require Invitation Code'), + 'assign': _('Assign User or Group') + }, + value: ("public" if not tdoc._code else "invite") if not tdoc.assign|length else "assign", + disabled:true, + row:false + }) }} +
    + {{ form.form_text({ + columns:9, + label:'Assign', + name:'assign', + placeholder:_('Group / UID'), + value:tdoc.assign|default(''), + disabled:true, + row:false + }) }} +
    +
    + {{ form.form_text({ + columns:9, + label:'Invitation Code', + name:'code', + placeholder:_('(leave blank if none)'), + value:tdoc._code|default(''), + disabled:true, + row:false + }) }} +
    +
    +
    +
    +

    {{ _('Contest Settings') }}

    +
    +
    +
    + {{ form.form_checkbox({ + columns:2, + label:'Rated', + name:'rated', + placeholder:_('Is rated'), + value:tdoc.rated|default(true), + row:false + }) }} + {{ form.form_checkbox({ + columns:3, + label:'Auto hide-and show', + name:'autoHide', + placeholder:_('Auto hide problems during the contest'), + value:handler.user.hasPerm(perm.PERM_EDIT_PROBLEM) and (tdoc.autoHide|default(true)), + disabled:not handler.user.hasPerm(perm.PERM_EDIT_PROBLEM), + row:false + }) }} + {{ form.form_checkbox({ + columns:3, + label:'Allow View Code', + name:'allowViewCode', + placeholder:_('Allow user view others code after contest'), + value:tdoc.allowViewCode|default(true), + row:false + }) }} + + +
    +
    +
    + {% if page_name == 'contest_edit' %} + + + {% if handler.user.own(tdoc) or handler.user.hasPerm(perm.PERM_EDIT_CONTEST) %} + + {% endif %} + {% else %} + + {% endif %} + +
    +
    + +
    +
    +
    +
    + {% include 'components/md_hint.html' %} +
    +
    +{% endblock %} diff --git a/packages/ui-default/templates/contest_main.html b/packages/ui-default/templates/contest_main.html index ee73ff80d1..401b45cd35 100644 --- a/packages/ui-default/templates/contest_main.html +++ b/packages/ui-default/templates/contest_main.html @@ -1,146 +1,146 @@ -{% extends "layout/basic.html" %} -{% import "components/contest.html" as contest with context %} -{% macro render_important_contest(view, title, tdoc) %} -
    -
    -
    -
    -
    -

    {{ _(title) }}

    -
    -

    {{ tdoc.title }}

    -
      -
    • - - {{ _('Rule') }}: {{ _(model.contest.RULES[tdoc['rule']].TEXT) }} -
    • -
    • - - {{ _('Start at') }}: {{ contest.render_time(tsdoc.startAt or tdoc.beginAt) }} -
    • -
    • - - {{ _('Duration') }}: {{ contest.render_duration(tdoc) }} {{ _('hour(s)') }} -
    • -
    • - - {{ _('Partic.') }}: {{ tdoc['attend']|default(0) }} -
    • -
    -
    -
    -
    -
    - {{ _('View Details') }} -
    - {% if tsdict[tdoc.docId].attend %} -

    {{ _('Attended') }}

    - {% else %} -

    {{ _('Not Attended') }}

    - {% endif %} -
    -
    -
    -
    -
    -{% endmacro %} -{% block content %} -
    -
    - {%- for tdoc in tdocs -%} - {% if model.contest.isOngoing(tdoc, tsdoc) %} - {{ render_important_contest('live', 'Live...', tdoc) }} - {% elif model.contest.isUpcoming(tdoc) %} - {{ render_important_contest('ready', 'Ready (☆▽☆)', tdoc) }} - {% endif %} - {%- endfor -%} -
    -
    -

    {{ _('All Contests') if not rule else _('All {0} Contests').format(_(model.contest.RULES[rule].TEXT)) }}

    -
    -
    - {{ _('Show') }}: - - - -
    -
    -
    -
    - {% if not tdocs.length %} - {{ nothing.render('There are no contests...') }} - {% else %} -
      - {%- for tdoc in tdocs -%} -
    1. -
      -
      -
      -
      {{ datetimeSpan(tdoc['beginAt'], false, 'D')|safe }}
      -
      {{ datetimeSpan(tdoc['beginAt'], false, 'YYYY-M')|safe }}
      -
      -
      -
      -

      {{ tdoc.title }}

      -
        -
      • - {{ _(model.contest.RULES[tdoc.rule].TEXT) }} -
      • - {% if tdoc.rated %} -
      • Rated
      • - {% endif %} -
      • - {{ contest.render_duration(tdoc) }} {{ _('hour(s)') }} -
      • -
      • - {{ tdoc['attend']|default(0) }} -
      • - {% if tsdict[tdoc.docId].attend %} -
      • - {{ _('Attended') }} -
      • - {% endif %} -
      -
      -
      -
    2. - {%- endfor -%} -
    - {{ paginator.render(page, tpcount, add_qs=qs) }} - {% endif %} -
    -
    -
    -
    - {% if handler.user.hasPerm(perm.PERM_CREATE_CONTEST) %} -
    -
    -

    - {{ _('Create Contest') }} -

    -
    - -
    - {% endif %} -
    -
    -{% endblock %} +{% extends "layout/basic.html" %} +{% import "components/contest.html" as contest with context %} +{% macro render_important_contest(view, title, tdoc) %} +
    +
    +
    +
    +
    +

    {{ _(title) }}

    +
    +

    {{ tdoc.title }}

    +
      +
    • + + {{ _('Rule') }}: {{ _(model.contest.RULES[tdoc['rule']].TEXT) }} +
    • +
    • + + {{ _('Start at') }}: {{ contest.render_time(tsdoc.startAt or tdoc.beginAt) }} +
    • +
    • + + {{ _('Duration') }}: {{ contest.render_duration(tdoc) }} {{ _('hour(s)') }} +
    • +
    • + + {{ _('Partic.') }}: {{ tdoc['attend']|default(0) }} +
    • +
    +
    +
    +
    +
    + {{ _('View Details') }} +
    + {% if tsdict[tdoc.docId].attend %} +

    {{ _('Attended') }}

    + {% else %} +

    {{ _('Not Attended') }}

    + {% endif %} +
    +
    +
    +
    +
    +{% endmacro %} +{% block content %} +
    +
    + {%- for tdoc in tdocs -%} + {% if model.contest.isOngoing(tdoc, tsdoc) %} + {{ render_important_contest('live', 'Live...', tdoc) }} + {% elif model.contest.isUpcoming(tdoc) %} + {{ render_important_contest('ready', 'Ready (☆▽☆)', tdoc) }} + {% endif %} + {%- endfor -%} +
    +
    +

    {{ _('All Contests') if not rule else _('All {0} Contests').format(_(model.contest.RULES[rule].TEXT)) }}

    +
    +
    + {{ _('Show') }}: + + + +
    +
    +
    +
    + {% if not tdocs.length %} + {{ nothing.render('There are no contests...') }} + {% else %} +
      + {%- for tdoc in tdocs -%} +
    1. +
      +
      +
      +
      {{ datetimeSpan(tdoc['beginAt'], false, 'D')|safe }}
      +
      {{ datetimeSpan(tdoc['beginAt'], false, 'YYYY-M')|safe }}
      +
      +
      +
      +

      {{ tdoc.title }}

      +
        +
      • + {{ _(model.contest.RULES[tdoc.rule].TEXT) }} +
      • + {% if tdoc.rated %} +
      • Rated
      • + {% endif %} +
      • + {{ contest.render_duration(tdoc) }} {{ _('hour(s)') }} +
      • +
      • + {{ tdoc['attend']|default(0) }} +
      • + {% if tsdict[tdoc.docId].attend %} +
      • + {{ _('Attended') }} +
      • + {% endif %} +
      +
      +
      +
    2. + {%- endfor -%} +
    + {{ paginator.render(page, tpcount, add_qs=qs) }} + {% endif %} +
    +
    +
    +
    + {% if handler.user.hasPerm(perm.PERM_CREATE_CONTEST) %} +
    +
    +

    + {{ _('Create Contest') }} +

    +
    + +
    + {% endif %} +
    +
    +{% endblock %} diff --git a/packages/ui-default/templates/contest_manage.html b/packages/ui-default/templates/contest_manage.html index 829a7bad96..acac3293c1 100644 --- a/packages/ui-default/templates/contest_manage.html +++ b/packages/ui-default/templates/contest_manage.html @@ -1,152 +1,152 @@ -{% extends "layout/basic.html" %} -{% import "components/contest.html" as contest with context %} -{% import "components/problem.html" as problem with context %} -{% block content %} -
    -
    -
    -
    -
    -
    - - - - - - - - - - - - - {%- for pid in tdoc.pids -%} - - - - - {%- endfor -%} - -
    {{ _('Problem') }}{{ _('Score') }}
    - - {{ problem.render_problem_title(pdict[pid], tdoc=tdoc, invalid=true, alphabetic=true) }} - - - {{ tdoc.score[pid]|default(100) }} -
    -
    -
    -
    -
    -
    -
    -

    {{ _('Files') }}

    -
    - -
    -
    - {{ noscript_note.render() }} - {% include "partials/files.html" %} -
    - -
    -
    -
    -
    -
    -
    -

    {{ _('Contest Clarifications') }}

    - -
    -
    - {% if not tcdocs.length %} - {{ nothing.render('Oh, there is no clarification!') }} - {% else %} -
      - {% for doc in tcdocs %} -
    • -
      -
      -
      -
      - {{_('Subject') }}: {{ contest.render_clarification_subject(tdoc,pdict,doc.subject) }} | {% if doc.owner == 0 %}{{ _('Jury') }}{% else %}{{ user.render_inline(udict[doc.owner], badge=false) }}{% endif %} @ {{ datetimeSpan(doc._id)|safe }} -
      - {% if doc.owner %} - - {% endif %} -
      -
      - {{ doc['content']|markdown|safe }} -
      -
      -
      -
        - {%- for rdoc in doc['reply'] -%} -
      • -
        -
                
        -
        -
        -
        - {{ _('Jury') }} -
        -
        -
        - {{ rdoc['content']|markdown|safe }} -
        -
        -
        -
      • - {%- endfor -%} -
      -
    • - {% endfor %} -
    - {% endif %} -
    -
    -
    -

    {{ _('Send Broadcast Message') }}

    -
    -
    -
    -
    - - -
    -
    - -
    -
    - -
    -
    - -
    -
    -
    -
    -
    -
    -
    - {% include 'partials/contest_sidebar_management.html' %} -
    -
    -{% endblock %} +{% extends "layout/basic.html" %} +{% import "components/contest.html" as contest with context %} +{% import "components/problem.html" as problem with context %} +{% block content %} +
    +
    +
    +
    +
    +
    + + + + + + + + + + + + + {%- for pid in tdoc.pids -%} + + + + + {%- endfor -%} + +
    {{ _('Problem') }}{{ _('Score') }}
    + + {{ problem.render_problem_title(pdict[pid], tdoc=tdoc, invalid=true, alphabetic=true) }} + + + {{ tdoc.score[pid]|default(100) }} +
    +
    +
    +
    +
    +
    +
    +

    {{ _('Files') }}

    +
    + +
    +
    + {{ noscript_note.render() }} + {% include "partials/files.html" %} +
    + +
    +
    +
    +
    +
    +
    +

    {{ _('Contest Clarifications') }}

    + +
    +
    + {% if not tcdocs.length %} + {{ nothing.render('Oh, there is no clarification!') }} + {% else %} +
      + {% for doc in tcdocs %} +
    • +
      +
      +
      +
      + {{_('Subject') }}: {{ contest.render_clarification_subject(tdoc,pdict,doc.subject) }} | {% if doc.owner == 0 %}{{ _('Jury') }}{% else %}{{ user.render_inline(udict[doc.owner], badge=false) }}{% endif %} @ {{ datetimeSpan(doc._id)|safe }} +
      + {% if doc.owner %} + + {% endif %} +
      +
      + {{ doc['content']|markdown|safe }} +
      +
      +
      +
        + {%- for rdoc in doc['reply'] -%} +
      • +
        +
                
        +
        +
        +
        + {{ _('Jury') }} +
        +
        +
        + {{ rdoc['content']|markdown|safe }} +
        +
        +
        +
      • + {%- endfor -%} +
      +
    • + {% endfor %} +
    + {% endif %} +
    +
    +
    +

    {{ _('Send Broadcast Message') }}

    +
    +
    + +
    + + +
    +
    + +
    +
    + +
    +
    + +
    +
    +
    +
    +
    +
    +
    + {% include 'partials/contest_sidebar_management.html' %} +
    +
    +{% endblock %} diff --git a/packages/ui-default/templates/contest_problemlist.html b/packages/ui-default/templates/contest_problemlist.html index d50f078387..b5e1a441c1 100644 --- a/packages/ui-default/templates/contest_problemlist.html +++ b/packages/ui-default/templates/contest_problemlist.html @@ -1,194 +1,194 @@ -{% extends "layout/basic.html" %} -{% import "components/contest.html" as contest with context %} -{% import "components/record.html" as record with context %} -{% import "components/problem.html" as problem with context %} -{% block content %} -{{ set(UiContext, 'tdoc', tdoc) }} -{{ set(UiContext, 'tsdoc', tsdoc) }} -
    -
    -
    -
    -

    {{ _('Problems') }}

    -
    -
    - - - {% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %} - - - {% endif %} - {% if showScore %} - - {% endif %} - - - - - {% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %} - - - {% endif %} - {% if showScore %} - - {% endif %} - - - - - {%- for pid in tdoc.pids -%} - - {% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %} - {% if psdict[pid] and psdict[pid].rid %} - {% set rdoc = rdict[psdict[pid].rid] %} - {% if model.contest.canShowSelfRecord.call(handler, tdoc) %} - {% set displayScore = ((tdoc.score[pid]|default(100)) * (psdict[pid].score|default(0)) / 100) if showScore else (psdict[pid].penaltyScore|default(psdict[pid].score)) %} - {{ record.render_status_td(rdoc, displayScore=displayScore) }} - {% else %} - - {% endif %} - - {% else %} - - - {% endif %} - {% endif %} - {% if showScore %} - - {% endif %} - - - {%- endfor -%} - -
    {{ _('Status') }}{{ _('Last Submit At') }}{{ _('Score') }}{{ _('Problem') }}
    {{ _('Submitted') }}{{ datetimeSpan(rdoc._id)|safe }}{{ _('No Submissions') }}-{{ tdoc.score[pid]|default(100) }} - {{ problem.render_problem_title(pdict[pid], tdoc, alphabetic=true) }} -
    -
    -
    -
    -
    -

    {{ _('Submissions') }}

    -
    -
    - {% if not canViewRecord %} - {{ nothing.render('According to the contest rules, you cannot view your submission details at current.') }} - {% elif not rdocs.length %} - {{ nothing.render('Oh, there is no submission!') }} - {% else %} - - - - - - - - - - - - - - - - - - - - - - - {%- for rdoc in rdocs -%} - {% set udoc = udict[rdoc['uid']] %} - {% set pdoc = pdict[rdoc['pid']] %} - {% include 'record_main_tr.html' %} - {%- endfor -%} - -
    {{ _('Status') }}{{ _('Problem') }}{{ _('Submit By') }}{{ _('Time') }}{{ _('Memory') }}{{ _('Language') }}{{ _('Submit At') }}
    - {% endif %} -
    -
    -
    -
    -

    {{ _('Contest Clarifications') }}

    -
    -
    - {% if not tcdocs.length %} - {{ nothing.render('Oh, there is no clarification!') }} - {% else %} -
      - {% for doc in tcdocs %} -
    • -
      -
      -
      -
      - {{_('Subject') }}: {{ contest.render_clarification_subject(tdoc,pdict,doc.subject) }} | {% if doc.owner == 0 %}{{ _('Jury') }}{% else %}{{ user.render_inline(udict[doc.owner], badge=false) }}{% endif %} @ {{ datetimeSpan(doc._id)|safe }} -
      -
      -
      - {{ doc['content']|markdown|safe }} -
      -
      -
      -
        - {%- for rdoc in doc['reply'] -%} -
      • -
        -
                
        -
        -
        -
        - {{ _('Jury') }} @ {{ datetimeSpan(rdoc['_id'])|safe }} -
        -
        -
        - {{ rdoc['content']|markdown|safe }} -
        -
        -
        -
      • - {%- endfor -%} -
      -
    • - {% endfor %} -
    - {% endif %} -
    - {% if tsdoc.attend %} -
    -

    {{ _('Send Clarification Request') }}

    -
    -
    - - -
    -
    - -
    -
    - -
    -
    - -
    - {% endif %} -
    -
    -
    - {% set owner_udoc = udict[tdoc.owner] %} - {% include "partials/contest_sidebar.html" %} -
    -
    +{% extends "layout/basic.html" %} +{% import "components/contest.html" as contest with context %} +{% import "components/record.html" as record with context %} +{% import "components/problem.html" as problem with context %} +{% block content %} +{{ set(UiContext, 'tdoc', tdoc) }} +{{ set(UiContext, 'tsdoc', tsdoc) }} +
    +
    +
    +
    +

    {{ _('Problems') }}

    +
    +
    + + + {% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %} + + + {% endif %} + {% if showScore %} + + {% endif %} + + + + + {% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %} + + + {% endif %} + {% if showScore %} + + {% endif %} + + + + + {%- for pid in tdoc.pids -%} + + {% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %} + {% if psdict[pid] and psdict[pid].rid %} + {% set rdoc = rdict[psdict[pid].rid] %} + {% if model.contest.canShowSelfRecord.call(handler, tdoc) %} + {% set displayScore = ((tdoc.score[pid]|default(100)) * (psdict[pid].score|default(0)) / 100) if showScore else (psdict[pid].penaltyScore|default(psdict[pid].score)) %} + {{ record.render_status_td(rdoc, displayScore=displayScore) }} + {% else %} + + {% endif %} + + {% else %} + + + {% endif %} + {% endif %} + {% if showScore %} + + {% endif %} + + + {%- endfor -%} + +
    {{ _('Status') }}{{ _('Last Submit At') }}{{ _('Score') }}{{ _('Problem') }}
    {{ _('Submitted') }}{{ datetimeSpan(rdoc._id)|safe }}{{ _('No Submissions') }}-{{ tdoc.score[pid]|default(100) }} + {{ problem.render_problem_title(pdict[pid], tdoc, alphabetic=true) }} +
    +
    +
    +
    +
    +

    {{ _('Submissions') }}

    +
    +
    + {% if not canViewRecord %} + {{ nothing.render('According to the contest rules, you cannot view your submission details at current.') }} + {% elif not rdocs.length %} + {{ nothing.render('Oh, there is no submission!') }} + {% else %} + + + + + + + + + + + + + + + + + + + + + + + {%- for rdoc in rdocs -%} + {% set udoc = udict[rdoc['uid']] %} + {% set pdoc = pdict[rdoc['pid']] %} + {% include 'record_main_tr.html' %} + {%- endfor -%} + +
    {{ _('Status') }}{{ _('Problem') }}{{ _('Submit By') }}{{ _('Time') }}{{ _('Memory') }}{{ _('Language') }}{{ _('Submit At') }}
    + {% endif %} +
    +
    +
    +
    +

    {{ _('Contest Clarifications') }}

    +
    +
    + {% if not tcdocs.length %} + {{ nothing.render('Oh, there is no clarification!') }} + {% else %} +
      + {% for doc in tcdocs %} +
    • +
      +
      +
      +
      + {{_('Subject') }}: {{ contest.render_clarification_subject(tdoc,pdict,doc.subject) }} | {% if doc.owner == 0 %}{{ _('Jury') }}{% else %}{{ user.render_inline(udict[doc.owner], badge=false) }}{% endif %} @ {{ datetimeSpan(doc._id)|safe }} +
      +
      +
      + {{ doc['content']|markdown|safe }} +
      +
      +
      +
        + {%- for rdoc in doc['reply'] -%} +
      • +
        +
                
        +
        +
        +
        + {{ _('Jury') }} @ {{ datetimeSpan(rdoc['_id'])|safe }} +
        +
        +
        + {{ rdoc['content']|markdown|safe }} +
        +
        +
        +
      • + {%- endfor -%} +
      +
    • + {% endfor %} +
    + {% endif %} +
    + {% if tsdoc.attend %} +
    +

    {{ _('Send Clarification Request') }}

    +
    +
    + + +
    +
    + +
    +
    + +
    +
    + +
    + {% endif %} +
    +
    +
    + {% set owner_udoc = udict[tdoc.owner] %} + {% include "partials/contest_sidebar.html" %} +
    +
    {% endblock %} \ No newline at end of file diff --git a/packages/ui-default/templates/contest_scoreboard.html b/packages/ui-default/templates/contest_scoreboard.html index 0753b12a1b..7554114f7e 100644 --- a/packages/ui-default/templates/contest_scoreboard.html +++ b/packages/ui-default/templates/contest_scoreboard.html @@ -1,38 +1,38 @@ -{% import "components/paginator.html" as paginator with context %} -{% extends "layout/basic.html" %} -{{ set(UiContext, 'tdoc', tdoc) }} -{{ set(UiContext, 'tsdoc', tsdoc) }} -{% set type = 'homework' if tdoc.rule == 'homework' else 'contest' %} - -{% block content %} -
    -
    -
    - {%- for ext in ['HTML','CSV','Ghost'] -%} - - {{ _('Export as {0}').format(ext) }} - - {%- endfor -%} - {% if model.contest.isDone(tdoc) and tdoc.lockAt and handler.user.own(tdoc) and not tdoc.unlocked %} - - - - - {% endif %} -
    - -
    -
    - {% include "partials/scoreboard.html" %} -
    -
    -{% endblock %} +{% import "components/paginator.html" as paginator with context %} +{% extends "layout/basic.html" %} +{{ set(UiContext, 'tdoc', tdoc) }} +{{ set(UiContext, 'tsdoc', tsdoc) }} +{% set type = 'homework' if tdoc.rule == 'homework' else 'contest' %} + +{% block content %} +
    +
    +
    + {%- for ext in ['HTML','CSV','Ghost'] -%} + + {{ _('Export as {0}').format(ext) }} + + {%- endfor -%} + {% if model.contest.isDone(tdoc) and tdoc.lockAt and handler.user.own(tdoc) and not tdoc.unlocked %} +
    + + +
    + {% endif %} +
    + +
    +
    + {% include "partials/scoreboard.html" %} +
    +
    +{% endblock %} diff --git a/packages/ui-default/templates/contest_scoreboard_download_html.html b/packages/ui-default/templates/contest_scoreboard_download_html.html index 0c0be5696d..c8742d5713 100644 --- a/packages/ui-default/templates/contest_scoreboard_download_html.html +++ b/packages/ui-default/templates/contest_scoreboard_download_html.html @@ -1,71 +1,71 @@ - - -

    {{ tdoc.title }}

    -Exported from {{ model.system.get('server.url') }} - - - - {%- for column in rows[0] -%} - - {%- endfor -%} - - - - {%- for row in rows -%}{% if loop.index0 %} - - {%- for column in row -%} - - {%- endfor -%} - - {% endif %}{%- endfor -%} - -
    - {% if column.type == 'problem_detail' %} - {{ column.value }} - {% else %} - {{ column.value }} - {% endif %} -
    - {% if column.type == 'record' and column.raw %} - - {{ column.value|string|nl2br|safe }} - - {% elif column.type == 'records' %} - {%- for record in column.raw -%} - {% if loop.index0 %}/{% endif %} - {% if record.raw %} - - {{ record.value|string|nl2br|safe }} - - {% else %} - {{ record.value|string|nl2br|safe }} - {% endif %} - {%- endfor -%} - {% else %} - {{ column.value|string|nl2br|safe }} - {% endif %} -
    + + +

    {{ tdoc.title }}

    +Exported from {{ model.system.get('server.url') }} + + + + {%- for column in rows[0] -%} + + {%- endfor -%} + + + + {%- for row in rows -%}{% if loop.index0 %} + + {%- for column in row -%} + + {%- endfor -%} + + {% endif %}{%- endfor -%} + +
    + {% if column.type == 'problem_detail' %} + {{ column.value }} + {% else %} + {{ column.value }} + {% endif %} +
    + {% if column.type == 'record' and column.raw %} + + {{ column.value|string|nl2br|safe }} + + {% elif column.type == 'records' %} + {%- for record in column.raw -%} + {% if loop.index0 %}/{% endif %} + {% if record.raw %} + + {{ record.value|string|nl2br|safe }} + + {% else %} + {{ record.value|string|nl2br|safe }} + {% endif %} + {%- endfor -%} + {% else %} + {{ column.value|string|nl2br|safe }} + {% endif %} +
    diff --git a/packages/ui-default/templates/contest_user.html b/packages/ui-default/templates/contest_user.html index a538adbc1b..d59300c7db 100644 --- a/packages/ui-default/templates/contest_user.html +++ b/packages/ui-default/templates/contest_user.html @@ -1,47 +1,47 @@ -{% extends "layout/basic.html" %} -{% import "components/contest.html" as contest with context %} -{% import "components/record.html" as record with context %} -{% import "components/problem.html" as problem with context %} -{% block content %} -{{ set(UiContext, 'tdoc', tdoc) }} -
    -
    -
    -
    -

    {{ _('Attendee Manage') }}

    -
    - -
    -
    - {{ noscript_note.render() }} -
    - - - - - - - - - - - - - - - - - - - {% include "partials/contest_user.html" %} -
    {{ _('User ID') }}{{ _('Username') }}{{ _('Begin Time') }} - {{ _('End Time') }}{{ _('Rank') }}{{ _('Actions') }}
    -
    -
    -
    -
    - {% set owner_udoc = udict[tdoc.owner] %} - {% include "partials/contest_sidebar_management.html" %} -
    -
    -{% endblock %} +{% extends "layout/basic.html" %} +{% import "components/contest.html" as contest with context %} +{% import "components/record.html" as record with context %} +{% import "components/problem.html" as problem with context %} +{% block content %} +{{ set(UiContext, 'tdoc', tdoc) }} +
    +
    +
    +
    +

    {{ _('Attendee Manage') }}

    +
    + +
    +
    + {{ noscript_note.render() }} +
    + + + + + + + + + + + + + + + + + + + {% include "partials/contest_user.html" %} +
    {{ _('User ID') }}{{ _('Username') }}{{ _('Begin Time') }} + {{ _('End Time') }}{{ _('Rank') }}{{ _('Actions') }}
    +
    +
    +
    +
    + {% set owner_udoc = udict[tdoc.owner] %} + {% include "partials/contest_sidebar_management.html" %} +
    +
    +{% endblock %} diff --git a/packages/ui-default/templates/courses_main.html b/packages/ui-default/templates/courses_main.html index 2ced93c26a..c43852f84f 100644 --- a/packages/ui-default/templates/courses_main.html +++ b/packages/ui-default/templates/courses_main.html @@ -1,61 +1,61 @@ -{% extends "layout/basic.html" %} -{% import "components/nothing.html" as nothing with context %} -{% block content %} -
    -
    -
    -
    -

    课程

    -
    -
    - 总计{{ domains.length | d(0) }}个课程 -
    -
    -
    -
    -
    -
    -
    -
    - {% if not domains.length %} - {{ nothing.render('没有课程。') }} - {% else %} -
    - {% set course_cols = 3 %} - {% set class_name = 'medium-' + (12 / course_cols) %} - {% for item in domains %} -
    -
    -
    -

    {{ item.name }}

    -
    -
    -

    创建者:{{ user.render_inline(uDocs[item.owner],false,false,false) }}

    -

    加入人数:{{ item.users }}

    - -
    -
    -
    - {% if loop.index % course_cols and loop.last %} - {% for i in range(0, course_cols - (loop.index % course_cols)) -%} -
    - {%- endfor %} - {% endif %} - {% if loop.index % course_cols === 0 or loop.last %} -
    - {% if not loop.last %} -
    -
    - {% endif %} - {% endif %} - {% endfor %} - {% endif %} -
    -
    -
    -
    +{% extends "layout/basic.html" %} +{% import "components/nothing.html" as nothing with context %} +{% block content %} +
    +
    +
    +
    +

    课程

    +
    +
    + 总计{{ domains.length | d(0) }}个课程 +
    +
    +
    +
    +
    +
    +
    +
    + {% if not domains.length %} + {{ nothing.render('没有课程。') }} + {% else %} +
    + {% set course_cols = 3 %} + {% set class_name = 'medium-' + (12 / course_cols) %} + {% for item in domains %} +
    +
    +
    +

    {{ item.name }}

    +
    +
    +

    创建者:{{ user.render_inline(uDocs[item.owner],false,false,false) }}

    +

    加入人数:{{ item.users }}

    + +
    +
    +
    + {% if loop.index % course_cols and loop.last %} + {% for i in range(0, course_cols - (loop.index % course_cols)) -%} +
    + {%- endfor %} + {% endif %} + {% if loop.index % course_cols === 0 or loop.last %} +
    + {% if not loop.last %} +
    +
    + {% endif %} + {% endif %} + {% endfor %} + {% endif %} +
    +
    +
    +
    {% endblock %} \ No newline at end of file diff --git a/packages/ui-default/templates/discussion_create.html b/packages/ui-default/templates/discussion_create.html index a594f8ca92..450cdc3120 100644 --- a/packages/ui-default/templates/discussion_create.html +++ b/packages/ui-default/templates/discussion_create.html @@ -1,28 +1,28 @@ -{% extends "layout/basic.html" %} -{% block content %} -
    -
    -
    -
    -

    {{ _('Create Discussion in {0}').format(vnode.title) }}

    -
    -
    -
    - {% include "partials/discussion_edit_form.html" %} -
    - - -
    -
    -
    -
    -
    -
    - {% include 'components/md_hint.html' %} -
    -
    -{% endblock %} +{% extends "layout/basic.html" %} +{% block content %} +
    +
    +
    +
    +

    {{ _('Create Discussion in {0}').format(vnode.title) }}

    +
    +
    +
    + {% include "partials/discussion_edit_form.html" %} +
    + + +
    +
    +
    +
    +
    +
    + {% include 'components/md_hint.html' %} +
    +
    +{% endblock %} diff --git a/packages/ui-default/templates/discussion_detail.html b/packages/ui-default/templates/discussion_detail.html index fbf25e8fc2..53b994a3f9 100644 --- a/packages/ui-default/templates/discussion_detail.html +++ b/packages/ui-default/templates/discussion_detail.html @@ -1,149 +1,149 @@ -{% extends "layout/basic.html" %} -{% import "components/comments_discussion.html" as comments with context %} -{% block content %} -
    -
    -
    -
    - -
    - {{ ddoc['content']|markdown|safe }} -
    -
    - -
    - -
    -
    - {% set udoc = udict[ddoc.owner] %} -
    - -
    - -
    -
    - -
    -
    - {% if vnode.type == model.document.TYPE_PROBLEM %} - {% set pdoc = vnode %} - {% set owner_udoc = udict[vnode.owner] %} - {% include "partials/problem_sidebar.html" %} - {% endif %} -
    -
    -{% endblock %} +{% extends "layout/basic.html" %} +{% import "components/comments_discussion.html" as comments with context %} +{% block content %} +
    +
    +
    +
    + +
    + {{ ddoc['content']|markdown|safe }} +
    +
    + +
    + +
    +
    + {% set udoc = udict[ddoc.owner] %} +
    + +
    + +
    +
    + +
    +
    + {% if vnode.type == model.document.TYPE_PROBLEM %} + {% set pdoc = vnode %} + {% set owner_udoc = udict[vnode.owner] %} + {% include "partials/problem_sidebar.html" %} + {% endif %} +
    +
    +{% endblock %} diff --git a/packages/ui-default/templates/discussion_edit.html b/packages/ui-default/templates/discussion_edit.html index f1141f19aa..40cafc311d 100644 --- a/packages/ui-default/templates/discussion_edit.html +++ b/packages/ui-default/templates/discussion_edit.html @@ -1,30 +1,30 @@ -{% extends "layout/basic.html" %} -{% block content %} -
    -
    -
    -
    -
    - {% include "partials/discussion_edit_form.html" %} -
    - - {% if handler.user.own(ddoc) or handler.user.hasPerm(perm.PERM_DELETE_DISCUSSION) %} - - {% endif %} - -
    -
    -
    -
    -
    -
    - {% include 'components/md_hint.html' %} -
    -
    -{% endblock %} +{% extends "layout/basic.html" %} +{% block content %} +
    +
    +
    +
    +
    + {% include "partials/discussion_edit_form.html" %} +
    + + {% if handler.user.own(ddoc) or handler.user.hasPerm(perm.PERM_DELETE_DISCUSSION) %} + + {% endif %} + +
    +
    +
    +
    +
    +
    + {% include 'components/md_hint.html' %} +
    +
    +{% endblock %} diff --git a/packages/ui-default/templates/discussion_main_or_node.html b/packages/ui-default/templates/discussion_main_or_node.html index f9ac8fb6f0..b5128410a5 100644 --- a/packages/ui-default/templates/discussion_main_or_node.html +++ b/packages/ui-default/templates/discussion_main_or_node.html @@ -1,55 +1,55 @@ -{% extends "layout/basic.html" %} -{% block content %} -
    -
    -
    - {% include "partials/discussion_list.html" %} -
    -
    -
    - {% if vnode.type == model.document.TYPE_PROBLEM %} - {% set pdoc = vnode %} - {% set owner_udoc = udict[vnode.owner] %} - {% include "partials/problem_sidebar.html" %} - {% elif vnode.type == model.document.TYPE_CONTEST %} - {% set tdoc = vnode %} - {%- if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) -%} - {% set tsdoc = { attend: tdoc.attend } %} - {%- endif -%} - {% set owner_udoc = udict[vnode.owner] %} - {% include "partials/contest_sidebar.html" %} - {% else %} -
    - {% if vnode.pic %}
    {% endif %} -
    -

    {{ vnode['title'] or _('Create Discussion') }}

    -
    -
    - {% if vnode._id %} - {% if handler.user.hasPerm(perm.PERM_CREATE_DISCUSSION) %} -

    {{ _('Create a Discussion') }}

    - {% else %} - {% if not handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %} -

    {{ _('Login to Create a Discussion') }}

    - {% else %} -

    {{ _('No Permission to Create a Discussion') }}

    - {% endif %} - {% endif %} - {% else %} -

    {{ _('Select a node to create discussion.') }}

    - {% endif %} -
    -
    - {% endif %} -
    -
    -

    公告

    -
    -
    - 普通用户仅可查看公告。 -
    -
    - -
    -
    -{% endblock %} +{% extends "layout/basic.html" %} +{% block content %} +
    +
    +
    + {% include "partials/discussion_list.html" %} +
    +
    +
    + {% if vnode.type == model.document.TYPE_PROBLEM %} + {% set pdoc = vnode %} + {% set owner_udoc = udict[vnode.owner] %} + {% include "partials/problem_sidebar.html" %} + {% elif vnode.type == model.document.TYPE_CONTEST %} + {% set tdoc = vnode %} + {%- if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) -%} + {% set tsdoc = { attend: tdoc.attend } %} + {%- endif -%} + {% set owner_udoc = udict[vnode.owner] %} + {% include "partials/contest_sidebar.html" %} + {% else %} +
    + {% if vnode.pic %}
    {% endif %} +
    +

    {{ vnode['title'] or _('Create Discussion') }}

    +
    +
    + {% if vnode._id %} + {% if handler.user.hasPerm(perm.PERM_CREATE_DISCUSSION) %} +

    {{ _('Create a Discussion') }}

    + {% else %} + {% if not handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %} +

    {{ _('Login to Create a Discussion') }}

    + {% else %} +

    {{ _('No Permission to Create a Discussion') }}

    + {% endif %} + {% endif %} + {% else %} +

    {{ _('Select a node to create discussion.') }}

    + {% endif %} +
    +
    + {% endif %} +
    +
    +

    公告

    +
    +
    + 普通用户仅可查看公告。 +
    +
    + +
    +
    +{% endblock %} diff --git a/packages/ui-default/templates/domain_base.html b/packages/ui-default/templates/domain_base.html index 44aa601a55..5a5844858f 100644 --- a/packages/ui-default/templates/domain_base.html +++ b/packages/ui-default/templates/domain_base.html @@ -1,26 +1,26 @@ -{% extends "layout/basic.html" %} -{% block content %} -
    -
    - {% block domain_content %}{% endblock %} -
    -
    -
    - -
    -
    -
    -{% endblock %} +{% extends "layout/basic.html" %} +{% block content %} +
    +
    + {% block domain_content %}{% endblock %} +
    +
    +
    + +
    +
    +
    +{% endblock %} diff --git a/packages/ui-default/templates/domain_create.html b/packages/ui-default/templates/domain_create.html index d4a0275593..5b12264fa0 100644 --- a/packages/ui-default/templates/domain_create.html +++ b/packages/ui-default/templates/domain_create.html @@ -1,55 +1,55 @@ -{% extends "layout/basic.html" %} -{% block content %} -
    -
    -
    -
    -

    {{ _('Create Domain') }}

    -
    -
    -
    -

    {{ _('A domain ID cannot be changed after creation. It is supposed to be:') }}

    -
      -
    • {{ _('Unique') }}
    • -
    • {{ _('At least 4 characters') }}
    • -
    • {{ _('Not wrapped with space') }}
    • -
    • {{ _('Not started with a number') }}
    • -
    • {{ _('Only A-Z, a-z, 0-9 and _ are accepted') }}
    • -
    -
    -
    - {{ form.form_text({ - label:'ID', - name:'id', - autofocus:true, - required:true - }) }} - {{ form.form_text({ - label:'Name', - name:'name', - required:true - }) }} - {{ form.form_textarea({ - label:'Bulletin', - name:'bulletin', - markdown:true, - required:true - }) }} - -
    - - -
    -
    -
    -
    -
    -
    +{% extends "layout/basic.html" %} +{% block content %} +
    +
    +
    +
    +

    {{ _('Create Domain') }}

    +
    +
    +
    +

    {{ _('A domain ID cannot be changed after creation. It is supposed to be:') }}

    +
      +
    • {{ _('Unique') }}
    • +
    • {{ _('At least 4 characters') }}
    • +
    • {{ _('Not wrapped with space') }}
    • +
    • {{ _('Not started with a number') }}
    • +
    • {{ _('Only A-Z, a-z, 0-9 and _ are accepted') }}
    • +
    +
    +
    + {{ form.form_text({ + label:'ID', + name:'id', + autofocus:true, + required:true + }) }} + {{ form.form_text({ + label:'Name', + name:'name', + required:true + }) }} + {{ form.form_textarea({ + label:'Bulletin', + name:'bulletin', + markdown:true, + required:true + }) }} + +
    + + +
    +
    +
    +
    +
    +
    {% endblock %} \ No newline at end of file diff --git a/packages/ui-default/templates/domain_dashboard.html b/packages/ui-default/templates/domain_dashboard.html index 3c4dc0bbdb..b7ace193e9 100644 --- a/packages/ui-default/templates/domain_dashboard.html +++ b/packages/ui-default/templates/domain_dashboard.html @@ -1,45 +1,45 @@ -{% import "components/user.html" as user %} -{% extends "domain_base.html" %} -{% block domain_content %} -{% if domain.bulletin %} -
    -
    - {{ domain.bulletin|markdown|safe }} -
    -
    -{% endif %} -
    -
    -

    {{ _('Information') }}

    -
    -
    - - -
    -
    -
    -
    -
    -
    {{ _('Avatar') }}
    -
    {{ _('Name') }}
    {{ domain.name }}
    -
    {{ _('Owner') }}
    {{ user.render_inline(owner) }}
    -
    -
    -
    -{% if handler.user._id == owner._id %} -
    -
    -

    {{ _('Delete Domain') }}

    -
    -
    -
    - - -
    -
    -
    -
    -
    -
    -{% endif %} -{% endblock %} +{% import "components/user.html" as user %} +{% extends "domain_base.html" %} +{% block domain_content %} +{% if domain.bulletin %} +
    +
    + {{ domain.bulletin|markdown|safe }} +
    +
    +{% endif %} +
    +
    +

    {{ _('Information') }}

    +
    +
    + + +
    +
    +
    +
    +
    +
    {{ _('Avatar') }}
    +
    {{ _('Name') }}
    {{ domain.name }}
    +
    {{ _('Owner') }}
    {{ user.render_inline(owner) }}
    +
    +
    +
    +{% if handler.user._id == owner._id %} +
    +
    +

    {{ _('Delete Domain') }}

    +
    +
    +
    + + +
    +
    +
    +
    +
    +
    +{% endif %} +{% endblock %} diff --git a/packages/ui-default/templates/domain_edit.html b/packages/ui-default/templates/domain_edit.html index b312beb5f0..7518510a90 100644 --- a/packages/ui-default/templates/domain_edit.html +++ b/packages/ui-default/templates/domain_edit.html @@ -1,6 +1,6 @@ -{% extends "domain_base.html" %} -{% block domain_content %} -
    - {% include "partials/setting.html" %} -
    -{% endblock %} +{% extends "domain_base.html" %} +{% block domain_content %} +
    + {% include "partials/setting.html" %} +
    +{% endblock %} diff --git a/packages/ui-default/templates/domain_group.html b/packages/ui-default/templates/domain_group.html index 661138deff..091d43da9e 100644 --- a/packages/ui-default/templates/domain_group.html +++ b/packages/ui-default/templates/domain_group.html @@ -1,49 +1,49 @@ -{% extends "domain_base.html" %} -{% block domain_content %} -
    -
    -

    {{ _('{0}: Groups').format(domain.name) }}

    -
    - -
    -
    - {{ noscript_note.render() }} -
    - - - - - - - - - - - - - - - {%- for gdoc in groups -%} - - - - - - {%- endfor -%} - -
    - - {{ _('Group Name') }}{{ _('Users') }}
    - - {{ gdoc.name }}
    -
    -
    - - -
    -
    -{% endblock %} +{% extends "domain_base.html" %} +{% block domain_content %} +
    +
    +

    {{ _('{0}: Groups').format(domain.name) }}

    +
    + +
    +
    + {{ noscript_note.render() }} +
    + + + + + + + + + + + + + + + {%- for gdoc in groups -%} + + + + + + {%- endfor -%} + +
    + + {{ _('Group Name') }}{{ _('Users') }}
    + + {{ gdoc.name }}
    +
    +
    + + +
    +
    +{% endblock %} diff --git a/packages/ui-default/templates/domain_join.html b/packages/ui-default/templates/domain_join.html index 91f4e686e2..0d252b724b 100644 --- a/packages/ui-default/templates/domain_join.html +++ b/packages/ui-default/templates/domain_join.html @@ -1,33 +1,33 @@ -{% extends "layout/basic.html" %} -{% block content %} -
    -
    -
    -
    -

    - {{ _('Join {0}').format(handler.domain['name']) }} -

    -
    -
    -

    {{ _('By clicking the button, you will become a member of the domain {0}.').format(handler.domain['name']) }}

    -
    -
    -
    - {% if joinSettings['method'] == model.domain.JOIN_METHOD_CODE %} - {{ form.form_text({ - columns:None, - label:'Invitation Code', - name:'code', - required:true, - help_text:'You need to enter the invitation code to join the domain.', - value:code, - autofocus:true - }) }} - {% endif %} - -
    -
    -
    -
    -
    +{% extends "layout/basic.html" %} +{% block content %} +
    +
    +
    +
    +

    + {{ _('Join {0}').format(handler.domain['name']) }} +

    +
    +
    +

    {{ _('By clicking the button, you will become a member of the domain {0}.').format(handler.domain['name']) }}

    +
    +
    +
    + {% if joinSettings['method'] == model.domain.JOIN_METHOD_CODE %} + {{ form.form_text({ + columns:None, + label:'Invitation Code', + name:'code', + required:true, + help_text:'You need to enter the invitation code to join the domain.', + value:code, + autofocus:true + }) }} + {% endif %} + +
    +
    +
    +
    +
    {% endblock %} \ No newline at end of file diff --git a/packages/ui-default/templates/domain_join_applications.html b/packages/ui-default/templates/domain_join_applications.html index d2b7197dae..1ec346a46e 100644 --- a/packages/ui-default/templates/domain_join_applications.html +++ b/packages/ui-default/templates/domain_join_applications.html @@ -1,69 +1,69 @@ -{% extends "domain_base.html" %} -{% block domain_content %} -{% if joinSettings %} -
    -
    -

    {{ _('Information') }}

    -
    -
    -

    {{ _('User can join this domain by visiting the following URL') }}:

    -
    {{ url_prefix|safe }}d/{{ handler.args.domainId }}/domain/join
    - {% if joinSettings['method'] == model.domain.JOIN_METHOD_CODE %} -

    {{ _('Or, with automatically filled invitation code') }}:

    -
    {{ url_prefix|safe }}d/{{ handler.args.domainId }}/domain/join?code={{ joinSettings.code|urlencode }}
    - {% endif %} - {% if joinSettings.expire %} -
    -
    - {{ (_('The link will be expired at {0}').format(datetimeSpan(joinSettings.expire, relative=false)))|safe }} -
    - {% endif %} -
    -
    -{% endif %} -
    -
    -

    {{ _('Settings') }}

    -
    - {% if rolesWithText.length == 1 %} -
    -
    -

    {{ _("The 'default' role applies to ALL REGISTERED USER.")|safe }}

    -

    {{ _("You may want to create a new role in 'Manage Role' page.")|safe }}

    -
    -
    - {% endif %} -
    -
    - {{ form.form_select({ - options:model.domain.JOIN_METHOD_RANGE, - label:'Method', - name:'method', - value:joinSettings['method']|default(model.domain.JOIN_METHOD_NONE) - }) }} - {{ form.form_select({ - options:rolesWithText, - label:'Role Assignment', - name:'role', - help_text:'The role to assign when user joining the domain.', - value:joinSettings['role']|default('') - }) }} - {{ form.form_select({ - options:expirations, - label:'Expire', - name:'expire', - help_text:'User will no longer be allowed to join the domain after expiration.' - }) }} - {{ form.form_text({ - label:'Invitation Code', - name:'invitationCode', - help_text:'The invitation code to enter to successfully join the domain. You can only use letters and numbers in the code and it should not be longer than 64 characters.', - value:joinSettings['code']|default('') - }) }} - -
    -
    -
    +{% extends "domain_base.html" %} +{% block domain_content %} +{% if joinSettings %} +
    +
    +

    {{ _('Information') }}

    +
    +
    +

    {{ _('User can join this domain by visiting the following URL') }}:

    +
    {{ url_prefix|safe }}d/{{ handler.args.domainId }}/domain/join
    + {% if joinSettings['method'] == model.domain.JOIN_METHOD_CODE %} +

    {{ _('Or, with automatically filled invitation code') }}:

    +
    {{ url_prefix|safe }}d/{{ handler.args.domainId }}/domain/join?code={{ joinSettings.code|urlencode }}
    + {% endif %} + {% if joinSettings.expire %} +
    +
    + {{ (_('The link will be expired at {0}').format(datetimeSpan(joinSettings.expire, relative=false)))|safe }} +
    + {% endif %} +
    +
    +{% endif %} +
    +
    +

    {{ _('Settings') }}

    +
    + {% if rolesWithText.length == 1 %} +
    +
    +

    {{ _("The 'default' role applies to ALL REGISTERED USER.")|safe }}

    +

    {{ _("You may want to create a new role in 'Manage Role' page.")|safe }}

    +
    +
    + {% endif %} +
    +
    + {{ form.form_select({ + options:model.domain.JOIN_METHOD_RANGE, + label:'Method', + name:'method', + value:joinSettings['method']|default(model.domain.JOIN_METHOD_NONE) + }) }} + {{ form.form_select({ + options:rolesWithText, + label:'Role Assignment', + name:'role', + help_text:'The role to assign when user joining the domain.', + value:joinSettings['role']|default('') + }) }} + {{ form.form_select({ + options:expirations, + label:'Expire', + name:'expire', + help_text:'User will no longer be allowed to join the domain after expiration.' + }) }} + {{ form.form_text({ + label:'Invitation Code', + name:'invitationCode', + help_text:'The invitation code to enter to successfully join the domain. You can only use letters and numbers in the code and it should not be longer than 64 characters.', + value:joinSettings['code']|default('') + }) }} + +
    +
    +
    {% endblock %} \ No newline at end of file diff --git a/packages/ui-default/templates/domain_permission.html b/packages/ui-default/templates/domain_permission.html index 91dec04c19..b42cc3855e 100644 --- a/packages/ui-default/templates/domain_permission.html +++ b/packages/ui-default/templates/domain_permission.html @@ -1,74 +1,74 @@ -{% extends "domain_base.html" %} -{% block domain_content %} -
    -
    -
    -

    {{ _('{0}: Permissions').format(domain.name) }}

    -
    - {% if roles.length == 3 %} -
    -
    -

    {{ _("The 'default' role applies to ALL REGISTERED USER.")|safe }}

    -

    {{ _("You may want to create a new role in 'Manage Role' page.")|safe }}

    -
    -
    - {% endif %} -
    - - - - {%- for role in roles -%} - - {%- endfor -%} - - - - - {%- for role in roles -%} - - {%- endfor -%} - - - {%- for family, perms in PERMS_BY_FAMILY -%} - - - {%- for perm in perms -%} - - - {%- for role in roles -%} - - {%- endfor -%} - - {%- endfor -%} - - {%- endfor -%} - - - - - {%- for role in roles -%} - - {%- endfor -%} - - -
    {{ _('Permissions') }}{{ role._id }}
    {{ _(family) }}
    {{ _(perm.desc) }} - -
    placeholder
    placeholder - -
    -
    -
    - - -
    -
    -
    -{% endblock %} +{% extends "domain_base.html" %} +{% block domain_content %} +
    +
    +
    +

    {{ _('{0}: Permissions').format(domain.name) }}

    +
    + {% if roles.length == 3 %} +
    +
    +

    {{ _("The 'default' role applies to ALL REGISTERED USER.")|safe }}

    +

    {{ _("You may want to create a new role in 'Manage Role' page.")|safe }}

    +
    +
    + {% endif %} +
    + + + + {%- for role in roles -%} + + {%- endfor -%} + + + + + {%- for role in roles -%} + + {%- endfor -%} + + + {%- for family, perms in PERMS_BY_FAMILY -%} + + + {%- for perm in perms -%} + + + {%- for role in roles -%} + + {%- endfor -%} + + {%- endfor -%} + + {%- endfor -%} + + + + + {%- for role in roles -%} + + {%- endfor -%} + + +
    {{ _('Permissions') }}{{ role._id }}
    {{ _(family) }}
    {{ _(perm.desc) }} + +
    placeholder
    placeholder + +
    +
    +
    + + +
    +
    +
    +{% endblock %} diff --git a/packages/ui-default/templates/domain_role.html b/packages/ui-default/templates/domain_role.html index 62a08d0852..b362e68a64 100644 --- a/packages/ui-default/templates/domain_role.html +++ b/packages/ui-default/templates/domain_role.html @@ -1,71 +1,71 @@ -{% extends "domain_base.html" %} -{% block domain_content %} - -
    -
    -

    {{ _('{0}: Roles').format(domain.name) }}

    -
    - -
    -
    - {{ noscript_note.render() }} -
    - - - - - - - - - - - - - - - {%- for role in roles -%} - {% set isBuiltin = role._id in ['default', 'guest', 'root'] %} - - - - - - {%- endfor -%} - -
    - - {{ _('Role') }}{{ _('Users') }}
    - - - {{ _('Built-in') if isBuiltin else _('User-defined role') }}: {{ role._id }} - - {{ role.count|default('--') }} -
    -
    -
    - -
    -
    -{% endblock %} +{% extends "domain_base.html" %} +{% block domain_content %} + +
    +
    +

    {{ _('{0}: Roles').format(domain.name) }}

    +
    + +
    +
    + {{ noscript_note.render() }} +
    + + + + + + + + + + + + + + + {%- for role in roles -%} + {% set isBuiltin = role._id in ['default', 'guest', 'root'] %} + + + + + + {%- endfor -%} + +
    + + {{ _('Role') }}{{ _('Users') }}
    + + + {{ _('Built-in') if isBuiltin else _('User-defined role') }}: {{ role._id }} + + {{ role.count|default('--') }} +
    +
    +
    + +
    +
    +{% endblock %} diff --git a/packages/ui-default/templates/domain_user.html b/packages/ui-default/templates/domain_user.html index e3b72d7ae6..ca9ca0df7d 100644 --- a/packages/ui-default/templates/domain_user.html +++ b/packages/ui-default/templates/domain_user.html @@ -1,113 +1,113 @@ -{% extends "domain_base.html" %} -{% block domain_content %} -{% set _rolesSelect = roles.filter(eval("(i) => i._id !== 'guest'")).map(eval('(role) => [role._id, role._id]')) %} -{% set _rolesSelectWithoutDefault = _rolesSelect.filter(eval("(i) => i[0] !== 'default'")) %} - - -
    -
    -

    {{ _('{0}: Users').format(domain.name) }}

    -
    - -
    -
    - {{ noscript_note.render() }} -
    - - - - - - - - - - - - - - - - - {%- for role in roles -%} - {%- for rudoc in rudocs[role._id] -%} - {% set is_disabled=(rudoc._id == handler.user._id) %} - - - - - - - {%- endfor -%} - {%- endfor -%} - -
    - - {{ _('User ID') }}{{ _('Username') }}{{ _('Role') }}
    - - - {{ rudoc._id }} - - {{ user.render_inline(udict[rudoc._id], badge=false) }} - - {{ form.select({ - options:_rolesSelect, - name:'role', - value:rudoc.role, - extra_class:'compact', - disabled:is_disabled - }) }} -
    -
    -
    - - -
    -
    -{% endblock %} +{% extends "domain_base.html" %} +{% block domain_content %} +{% set _rolesSelect = roles.filter(eval("(i) => i._id !== 'guest'")).map(eval('(role) => [role._id, role._id]')) %} +{% set _rolesSelectWithoutDefault = _rolesSelect.filter(eval("(i) => i[0] !== 'default'")) %} + + +
    +
    +

    {{ _('{0}: Users').format(domain.name) }}

    +
    + +
    +
    + {{ noscript_note.render() }} +
    + + + + + + + + + + + + + + + + + {%- for role in roles -%} + {%- for rudoc in rudocs[role._id] -%} + {% set is_disabled=(rudoc._id == handler.user._id) %} + + + + + + + {%- endfor -%} + {%- endfor -%} + +
    + + {{ _('User ID') }}{{ _('Username') }}{{ _('Role') }}
    + + + {{ rudoc._id }} + + {{ user.render_inline(udict[rudoc._id], badge=false) }} + + {{ form.select({ + options:_rolesSelect, + name:'role', + value:rudoc.role, + extra_class:'compact', + disabled:is_disabled + }) }} +
    +
    +
    + + +
    +
    +{% endblock %} diff --git a/packages/ui-default/templates/error.html b/packages/ui-default/templates/error.html index eb08d0900a..3257769683 100644 --- a/packages/ui-default/templates/error.html +++ b/packages/ui-default/templates/error.html @@ -1,25 +1,25 @@ -{% extends "layout/basic.html" %} -{% block content %} -
    -
    -
    -
    -
    -

    {{ _('Oops!') }}

    -

    {{ _(error.message).formatFromArray(error.params) }}

    -

    {{ _('Technical Information') }}:

    -

    {{ _('Type') }}: {{ error.name }}

    -

    {{ _('Arguments') }}: -

      - {%- for param in error.params -%} - {% if instanceof(param, UserFacingError) %} -
    1. {{ _(param.message).formatFromArray(param.params)}}
    2. - {% else %} -
    3. {{ param }}
    4. - {% endif %} - {%- endfor -%} -
    -

    -
    -
    -{% endblock %} +{% extends "layout/basic.html" %} +{% block content %} +
    +
    +
    +
    +
    +

    {{ _('Oops!') }}

    +

    {{ _(error.message).formatFromArray(error.params) }}

    +

    {{ _('Technical Information') }}:

    +

    {{ _('Type') }}: {{ error.name }}

    +

    {{ _('Arguments') }}: +

      + {%- for param in error.params -%} + {% if instanceof(param, UserFacingError) %} +
    1. {{ _(param.message).formatFromArray(param.params)}}
    2. + {% else %} +
    3. {{ param }}
    4. + {% endif %} + {%- endfor -%} +
    +

    +
    +
    +{% endblock %} diff --git a/packages/ui-default/templates/home_domain.html b/packages/ui-default/templates/home_domain.html index 2242f53230..9540a78e22 100644 --- a/packages/ui-default/templates/home_domain.html +++ b/packages/ui-default/templates/home_domain.html @@ -1,62 +1,62 @@ -{% extends "layout/home_base.html" %} -{% block home_content %} -
    -
    -

    {{ _('My Domains') }}

    -
    - {% if handler.user.hasPriv(model.builtin.PRIV.PRIV_CREATE_DOMAIN) %} - {{ _('Create Domain') }} - {% endif %} - {{ _("What's domain?") }} -
    -
    -
    - - - - - - - - - - - - - - - - - {%- for ddoc in ddocs -%} - - - - - - - {%- endfor -%} - -
     {{ _('Name') }} ({{ _('ID') }}){{ _('My Role') }}{{ _('Action') }}
    - - -
    - - {% set _show = handler.user.pinnedDomains.includes(ddoc._id) %} - - -
    - {{ ddoc['name'] }} ({{ ddoc['_id'] }}) -
    - {{ dudict[ddoc._id].role|default('default') }} - - {{ _('Visit') }} - {% if canManage[ddoc['_id']] %} - · {{ _('Manage') }} - {% endif %} -
    -
    -
    +{% extends "layout/home_base.html" %} +{% block home_content %} +
    +
    +

    {{ _('My Domains') }}

    +
    + {% if handler.user.hasPriv(model.builtin.PRIV.PRIV_CREATE_DOMAIN) %} + {{ _('Create Domain') }} + {% endif %} + {{ _("What's domain?") }} +
    +
    +
    + + + + + + + + + + + + + + + + + {%- for ddoc in ddocs -%} + + + + + + + {%- endfor -%} + +
     {{ _('Name') }} ({{ _('ID') }}){{ _('My Role') }}{{ _('Action') }}
    + + +
    + + {% set _show = handler.user.pinnedDomains.includes(ddoc._id) %} + + +
    + {{ ddoc['name'] }} ({{ ddoc['_id'] }}) +
    + {{ dudict[ddoc._id].role|default('default') }} + + {{ _('Visit') }} + {% if canManage[ddoc['_id']] %} + · {{ _('Manage') }} + {% endif %} +
    +
    +
    {% endblock %} \ No newline at end of file diff --git a/packages/ui-default/templates/home_files.html b/packages/ui-default/templates/home_files.html index de0f3b5149..be2a0e881e 100644 --- a/packages/ui-default/templates/home_files.html +++ b/packages/ui-default/templates/home_files.html @@ -1,16 +1,16 @@ -{% extends "layout/home_base.html" %} -{% block home_content %} -
    -
    -

    {{ _('Files') }}

    -
    - -
    -
    - {{ noscript_note.render() }} - {% include "partials/files.html" %} -
    - -
    -
    +{% extends "layout/home_base.html" %} +{% block home_content %} +
    +
    +

    {{ _('Files') }}

    +
    + +
    +
    + {{ noscript_note.render() }} + {% include "partials/files.html" %} +
    + +
    +
    {% endblock %} \ No newline at end of file diff --git a/packages/ui-default/templates/home_messages.html b/packages/ui-default/templates/home_messages.html index 86ff50fdf7..fd70abdd16 100644 --- a/packages/ui-default/templates/home_messages.html +++ b/packages/ui-default/templates/home_messages.html @@ -1,9 +1,9 @@ -{% extends "layout/home_base.html" %} -{% block home_content %} -
    -
    - {{ noscript_note.render() }} -
    -
    -
    -{% endblock %} +{% extends "layout/home_base.html" %} +{% block home_content %} +
    +
    + {{ noscript_note.render() }} +
    +
    +
    +{% endblock %} diff --git a/packages/ui-default/templates/home_security.html b/packages/ui-default/templates/home_security.html index 406f933f53..3233b6837b 100644 --- a/packages/ui-default/templates/home_security.html +++ b/packages/ui-default/templates/home_security.html @@ -1,199 +1,199 @@ -{% extends "layout/home_base.html" %} -{% block home_content %} -
    -
    - {% if handler.user.mail.endsWith('.local') %} -
    -
    -
    -
    {{ _("You haven't set an email.")}}
    -
    -
    -
    - {% endif %} -
    -
    -
    -

    {{ _('Change Email') }}

    -
    -
    -
    - {{ form.form_text({ - type:'password', - label:"SuperUser's Password" if sudoUid else 'Current Password', - columns:10, - name:'password', - required:true - }) }} - {{ form.form_text({ - type:'text', - label:'Current Email', - columns:10, - name:'currentEmail', - value:handler.user.mail, - disabled:true - }) }} - {{ form.form_text({ - type:'text', - label:'New Email', - columns:10, - name:'mail', - required:true - }) }} -
    - - -
    -
    -
    -
    -
    -
    -
    -
    -

    {{ _('Change Password') }}

    -
    -
    -
    - {{ form.form_text({ - type:'password', - label:"SuperUser's Password" if sudoUid else 'Current Password', - columns:10, - name:'current', - required:true - }) }} - {{ form.form_text({ - type:'password', - label:'New Password', - columns:10, - name:'password', - required:true - }) }} - {{ form.form_text({ - type:'password', - label:'Repeat Password', - columns:10, - name:'verifyPassword', - required:true - }) }} -
    - - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    {{ _('Authenticators') }}

    -
    - -
    -
    -
    -
      - {%- if handler.user.tfa -%} -
    • -
      -
      - -
      -
      -

      {{ _('Authenticator') }}: {{ _('Two Factor Authentication') }}

      -
      -
      -
      - - -
      -
      -
      -
    • - {%- endif -%} - {%- for authenticator in authenticators -%} -
    • -
      -
      - -
      -
      -

      {{ _('Authenticator') }}: {{ authenticator.name }} ({{ authenticator.credentialID.buffer.toString('base64')|truncate(6, end='') }})

      -

      {{ _('Type') }}: {{ authenticator.fmt }}

      -

      {{ _('Device Type') }}: {{ authenticator.credentialDeviceType }}

      -

      {{ _('Registered at') }}: {{ datetimeSpan(authenticator.regat)|safe }}

      -
      -
      -
      - - - -
      -
      -
      -
    • - {%- endfor -%} -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    {{ _('Active Sessions') }}

    -
    -
    -
      - {%- for session in sessions -%} -
    • -
      -
      - -
      -
      -

      {{ _('Last Update At') }}: {{ datetimeSpan(session.updateAt)|safe }}

      - {% if session.createHost %} -

      {{ _('Hostname') }}: {{ session.createHost }}

      - {% endif %} -

      {{ _('Location') }}: {{ _(session.updateGeoip.display) }} ({{ session.updateIp }})

      -

      {{ _('Operating System') }}: {{ session.updateUa.os }}

      -

      {{ _('Browser') }}: {{ session.updateUa.name }} {{ session.updateUa.version }}

      - {% if session.isCurrent %} -

      {{ _('This is the current session') }}

      - {% endif %} -
      - {% if not session.isCurrent %} -
      -
      - - - -
      -
      - {% endif %} -
      -
    • - {%- endfor -%} -
    -
    -
    -
    - - -
    - {% if geoipProvider %} -
    -

    IP geo-location data is provided by {{ geoipProvider|safe }}.

    -
    - {% endif %} -
    -
    -
    -
    -
    -{% endblock %} +{% extends "layout/home_base.html" %} +{% block home_content %} +
    +
    + {% if handler.user.mail.endsWith('.local') %} +
    +
    +
    +
    {{ _("You haven't set an email.")}}
    +
    +
    +
    + {% endif %} +
    +
    +
    +

    {{ _('Change Email') }}

    +
    +
    +
    + {{ form.form_text({ + type:'password', + label:"SuperUser's Password" if sudoUid else 'Current Password', + columns:10, + name:'password', + required:true + }) }} + {{ form.form_text({ + type:'text', + label:'Current Email', + columns:10, + name:'currentEmail', + value:handler.user.mail, + disabled:true + }) }} + {{ form.form_text({ + type:'text', + label:'New Email', + columns:10, + name:'mail', + required:true + }) }} +
    + + +
    +
    +
    +
    +
    +
    +
    +
    +

    {{ _('Change Password') }}

    +
    +
    +
    + {{ form.form_text({ + type:'password', + label:"SuperUser's Password" if sudoUid else 'Current Password', + columns:10, + name:'current', + required:true + }) }} + {{ form.form_text({ + type:'password', + label:'New Password', + columns:10, + name:'password', + required:true + }) }} + {{ form.form_text({ + type:'password', + label:'Repeat Password', + columns:10, + name:'verifyPassword', + required:true + }) }} +
    + + +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +

    {{ _('Authenticators') }}

    +
    + +
    +
    +
    +
      + {%- if handler.user.tfa -%} +
    • +
      +
      + +
      +
      +

      {{ _('Authenticator') }}: {{ _('Two Factor Authentication') }}

      +
      +
      +
      + + +
      +
      +
      +
    • + {%- endif -%} + {%- for authenticator in authenticators -%} +
    • +
      +
      + +
      +
      +

      {{ _('Authenticator') }}: {{ authenticator.name }} ({{ authenticator.credentialID.buffer.toString('base64')|truncate(6, end='') }})

      +

      {{ _('Type') }}: {{ authenticator.fmt }}

      +

      {{ _('Device Type') }}: {{ authenticator.credentialDeviceType }}

      +

      {{ _('Registered at') }}: {{ datetimeSpan(authenticator.regat)|safe }}

      +
      +
      +
      + + + +
      +
      +
      +
    • + {%- endfor -%} +
    +
    +
    +
    +
    +
    +
    +
    +
    +

    {{ _('Active Sessions') }}

    +
    +
    +
      + {%- for session in sessions -%} +
    • +
      +
      + +
      +
      +

      {{ _('Last Update At') }}: {{ datetimeSpan(session.updateAt)|safe }}

      + {% if session.createHost %} +

      {{ _('Hostname') }}: {{ session.createHost }}

      + {% endif %} +

      {{ _('Location') }}: {{ _(session.updateGeoip.display) }} ({{ session.updateIp }})

      +

      {{ _('Operating System') }}: {{ session.updateUa.os }}

      +

      {{ _('Browser') }}: {{ session.updateUa.name }} {{ session.updateUa.version }}

      + {% if session.isCurrent %} +

      {{ _('This is the current session') }}

      + {% endif %} +
      + {% if not session.isCurrent %} +
      +
      + + + +
      +
      + {% endif %} +
      +
    • + {%- endfor -%} +
    +
    +
    +
    + + +
    + {% if geoipProvider %} +
    +

    IP geo-location data is provided by {{ geoipProvider|safe }}.

    +
    + {% endif %} +
    +
    +
    +
    +
    +{% endblock %} diff --git a/packages/ui-default/templates/home_settings.html b/packages/ui-default/templates/home_settings.html index d468ae6e07..7d13b9be30 100644 --- a/packages/ui-default/templates/home_settings.html +++ b/packages/ui-default/templates/home_settings.html @@ -1,21 +1,21 @@ -{% extends "layout/home_base.html" %} -{% block home_content %} -{% if category == "account" %} -
    -
    -

    {{ _('Avatar') }}

    -
    -
    -

    {{ _('You can also upload your avatar to Gravatar and it will be automatically updated here.')|safe }}

    -
    -
    - {{ current.uname }} -
    - -
    -
    -{% endif %} -
    - {% include "partials/setting.html" %} -
    -{% endblock %} +{% extends "layout/home_base.html" %} +{% block home_content %} +{% if category == "account" %} +
    +
    +

    {{ _('Avatar') }}

    +
    +
    +

    {{ _('You can also upload your avatar to Gravatar and it will be automatically updated here.')|safe }}

    +
    +
    + {{ current.uname }} +
    + +
    +
    +{% endif %} +
    + {% include "partials/setting.html" %} +
    +{% endblock %} diff --git a/packages/ui-default/templates/homework_detail.html b/packages/ui-default/templates/homework_detail.html index 735d32c8f1..8359f9a43e 100644 --- a/packages/ui-default/templates/homework_detail.html +++ b/packages/ui-default/templates/homework_detail.html @@ -1,80 +1,80 @@ -{% extends "layout/basic.html" %} -{% import "components/record.html" as record with context %} -{% import "components/problem.html" as problem with context %} -{% block content %} -
    -
    -
    -
    -

    {{ _('Homework Introduction') }}

    -
    -
    - {{ tdoc['content']|markdown|safe }} -
    -
    -
    -
    -

    {{ _('Problem') }}

    -
    - {% if pdict %} -
    - - - {% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %} - - - {% endif %} - - - - - {% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %} - - - {% endif %} - - - - - {% set isAdmin = handler.user.own(tdoc) or handler.user.hasPerm(perm.PERM_VIEW_HOMEWORK_HIDDEN_SCOREBOARD) %} - {% set ntdoc = model.contest.isDone(tdoc) or (tsdoc.attend and not model.contest.isNotStarted(tdoc)) %} - {%- for pid in tdoc.pids -%} - - {% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %} - {% if psdict[pid] and psdict[pid].rid %} - {% set rdoc = rdict[psdict[pid].rid] %} - {% if model.contest.canShowSelfRecord.call(handler, tdoc) %} - {{ record.render_status_td(rdoc) }} - {% else %} - - {% endif %} - - {% else %} - - - {% endif %} - {% endif %} - - - {%- endfor -%} - -
    {{ _('Status') }}{{ _('Last Submit At') }}{{ _('Problem') }}
    {{ _('Submitted') }}{{ datetimeSpan(rdoc._id)|safe }}{{ _('No Submissions') }}- - {% if isAdmin and not ntdoc %} - {{ problem.render_problem_title(pdict[pid], show_invisible_flag=false, show_tags=false) }} - {% else %} - {{ problem.render_problem_title(pdict[pid], tdoc=tdoc, show_invisible_flag=false, show_tags=false) }} - {% endif %} -
    -
    - {% elif tsdoc.attend %} - {{ nothing.render('This homework is not open and you cannot view problems.') }} - {% else %} - {{ nothing.render('Please claim the assignment to see the problems.') }} - {% endif %} -
    -
    -
    - {% include "partials/homework_sidebar.html" %} -
    -
    +{% extends "layout/basic.html" %} +{% import "components/record.html" as record with context %} +{% import "components/problem.html" as problem with context %} +{% block content %} +
    +
    +
    +
    +

    {{ _('Homework Introduction') }}

    +
    +
    + {{ tdoc['content']|markdown|safe }} +
    +
    +
    +
    +

    {{ _('Problem') }}

    +
    + {% if pdict %} +
    + + + {% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %} + + + {% endif %} + + + + + {% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %} + + + {% endif %} + + + + + {% set isAdmin = handler.user.own(tdoc) or handler.user.hasPerm(perm.PERM_VIEW_HOMEWORK_HIDDEN_SCOREBOARD) %} + {% set ntdoc = model.contest.isDone(tdoc) or (tsdoc.attend and not model.contest.isNotStarted(tdoc)) %} + {%- for pid in tdoc.pids -%} + + {% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %} + {% if psdict[pid] and psdict[pid].rid %} + {% set rdoc = rdict[psdict[pid].rid] %} + {% if model.contest.canShowSelfRecord.call(handler, tdoc) %} + {{ record.render_status_td(rdoc) }} + {% else %} + + {% endif %} + + {% else %} + + + {% endif %} + {% endif %} + + + {%- endfor -%} + +
    {{ _('Status') }}{{ _('Last Submit At') }}{{ _('Problem') }}
    {{ _('Submitted') }}{{ datetimeSpan(rdoc._id)|safe }}{{ _('No Submissions') }}- + {% if isAdmin and not ntdoc %} + {{ problem.render_problem_title(pdict[pid], show_invisible_flag=false, show_tags=false) }} + {% else %} + {{ problem.render_problem_title(pdict[pid], tdoc=tdoc, show_invisible_flag=false, show_tags=false) }} + {% endif %} +
    +
    + {% elif tsdoc.attend %} + {{ nothing.render('This homework is not open and you cannot view problems.') }} + {% else %} + {{ nothing.render('Please claim the assignment to see the problems.') }} + {% endif %} +
    +
    +
    + {% include "partials/homework_sidebar.html" %} +
    +
    {% endblock %} \ No newline at end of file diff --git a/packages/ui-default/templates/homework_edit.html b/packages/ui-default/templates/homework_edit.html index 18400259eb..66f3b7576f 100644 --- a/packages/ui-default/templates/homework_edit.html +++ b/packages/ui-default/templates/homework_edit.html @@ -1,130 +1,130 @@ -{% extends "layout/basic.html" %} -{% block content %} -
    -
    -
    -
    -
    - {{ form.form_text({ - columns:12, - label:'Title', - name:'title', - placeholder:_('title'), - value:tdoc['title']|default(''), - autofocus:true - }) }} -
    - {{ form.form_text({ - columns:3, - label:'Begin Date', - name:'beginAtDate', - placeholder:'YYYY-mm-dd', - value:dateBeginText, - date:true, - row:false - }) }} - {{ form.form_text({ - columns:2, - label:'Begin Time', - name:'beginAtTime', - placeholder:'HH:MM', - value:timeBeginText, - time:true, - row:false - }) }} - {{ form.form_text({ - columns:3, - label:'End Date', - name:'penaltySinceDate', - placeholder:'YYYY-mm-dd', - value:datePenaltyText, - date:true, - row:false - }) }} - {{ form.form_text({ - columns:2, - label:'End Time', - name:'penaltySinceTime', - placeholder:'HH:MM', - value:timePenaltyText, - time:true, - row:false - }) }} - {{ form.form_text({ - row:false, - last_column:true, - columns:2, - label:'Extension (days)', - name:'extensionDays', - value:extensionDays|default(0) - }) }} -
    -
    - {{ form.form_text({ - row:false, - columns:6, - label:'Assign', - name:'assign', - placeholder:_('Group / UID'), - value:tdoc.assign|default('') - }) }} - {{ form.form_text({ - row:false, - last_column:true, - columns:6, - label:'Homework Maintainer', - name:'maintainer', - help_text:_('Allow to maintain this {0}').format(_('homework')), - value:tdoc.maintainer|default('') - }) }} -
    -
    - -
    - {{ form.form_text({ - columns:null, - label:'Problems', - name:'pids', - value:pids - }) }} - {{ form.form_textarea({ - columns:null, - label:'Content', - name:'content', - value:tdoc['content']|default('[^_^]:若需要写内容请删除该注释,若不需要写内容无需删除该注释,会自动不显示'), - markdown:true - }) }} -
    - {% if page_name == 'homework_edit' %} - - - {% if handler.user.own(tdoc) or handler.user.hasPerm(perm.PERM_EDIT_HOMEWORK) %} - - {% endif %} - {% else %} - - {% endif %} - -
    -
    -
    -
    -
    -
    - {% include 'components/md_hint.html' %} -
    -
    +{% extends "layout/basic.html" %} +{% block content %} +
    +
    +
    +
    +
    + {{ form.form_text({ + columns:12, + label:'Title', + name:'title', + placeholder:_('title'), + value:tdoc['title']|default(''), + autofocus:true + }) }} +
    + {{ form.form_text({ + columns:3, + label:'Begin Date', + name:'beginAtDate', + placeholder:'YYYY-mm-dd', + value:dateBeginText, + date:true, + row:false + }) }} + {{ form.form_text({ + columns:2, + label:'Begin Time', + name:'beginAtTime', + placeholder:'HH:MM', + value:timeBeginText, + time:true, + row:false + }) }} + {{ form.form_text({ + columns:3, + label:'End Date', + name:'penaltySinceDate', + placeholder:'YYYY-mm-dd', + value:datePenaltyText, + date:true, + row:false + }) }} + {{ form.form_text({ + columns:2, + label:'End Time', + name:'penaltySinceTime', + placeholder:'HH:MM', + value:timePenaltyText, + time:true, + row:false + }) }} + {{ form.form_text({ + row:false, + last_column:true, + columns:2, + label:'Extension (days)', + name:'extensionDays', + value:extensionDays|default(0) + }) }} +
    +
    + {{ form.form_text({ + row:false, + columns:6, + label:'Assign', + name:'assign', + placeholder:_('Group / UID'), + value:tdoc.assign|default('') + }) }} + {{ form.form_text({ + row:false, + last_column:true, + columns:6, + label:'Homework Maintainer', + name:'maintainer', + help_text:_('Allow to maintain this {0}').format(_('homework')), + value:tdoc.maintainer|default('') + }) }} +
    +
    + +
    + {{ form.form_text({ + columns:null, + label:'Problems', + name:'pids', + value:pids + }) }} + {{ form.form_textarea({ + columns:null, + label:'Content', + name:'content', + value:tdoc['content']|default('[^_^]:若需要写内容请删除该注释,若不需要写内容无需删除该注释,会自动不显示'), + markdown:true + }) }} +
    + {% if page_name == 'homework_edit' %} + + + {% if handler.user.own(tdoc) or handler.user.hasPerm(perm.PERM_EDIT_HOMEWORK) %} + + {% endif %} + {% else %} + + {% endif %} + +
    +
    +
    +
    +
    +
    + {% include 'components/md_hint.html' %} +
    +
    {% endblock %} \ No newline at end of file diff --git a/packages/ui-default/templates/homework_files.html b/packages/ui-default/templates/homework_files.html index d51bf0ac7c..431e032f51 100644 --- a/packages/ui-default/templates/homework_files.html +++ b/packages/ui-default/templates/homework_files.html @@ -1,24 +1,24 @@ -{% extends "layout/basic.html" %} -{% block content %} -{{ set(UiContext, 'tdoc', tdoc) }} -
    -
    -
    -
    -

    {{ _('Files') }}

    -
    - -
    -
    - {{ noscript_note.render() }} - {% include "partials/files.html" %} -
    - -
    -
    -
    -
    - {% include "partials/homework_sidebar.html" %} -
    -
    -{% endblock %} +{% extends "layout/basic.html" %} +{% block content %} +{{ set(UiContext, 'tdoc', tdoc) }} +
    +
    +
    +
    +

    {{ _('Files') }}

    +
    + +
    +
    + {{ noscript_note.render() }} + {% include "partials/files.html" %} +
    + +
    +
    +
    +
    + {% include "partials/homework_sidebar.html" %} +
    +
    +{% endblock %} diff --git a/packages/ui-default/templates/homework_main.html b/packages/ui-default/templates/homework_main.html index 8d2789644a..4f008d157b 100644 --- a/packages/ui-default/templates/homework_main.html +++ b/packages/ui-default/templates/homework_main.html @@ -1,78 +1,78 @@ -{% extends "layout/basic.html" %} -{% block content %} -{{ set(UiContext, 'docs', calendar) }} -
    -
    -
    -
    -

    {{ _('All Homeworks') }}

    -
    - - {{ _('View') }}: - - - {% if groups.length %} -
    - {{ _('Show') }}: - - -
    - {% endif %} - {% if handler.user.hasPerm(perm.PERM_CREATE_HOMEWORK) %} - {{ _('Create Homework') }} - {% endif %} -
    -
    -
    - {% if not tdocs.length %} - {{ nothing.render('There is no homework so far ╰(*°▽°*)╯') }} - {% else %} -
      - {%- for tdoc in tdocs -%} -
    1. -
      -
      -
      -
      {{ datetimeSpan(tdoc['penaltySince'], false, 'D')|safe }}
      -
      {{ datetimeSpan(tdoc['penaltySince'], false, 'YYYY-M')|safe }}
      -
      -
      -
      -

      {{ tdoc.title }}

      -
        -
      • {{ _('Status') }}: {{ _(model.contest.statusText(tdoc)) }}
      • -
      • {{ _('Open Since') }}: {{ datetimeSpan(tdoc['beginAt'])|safe }}
      • -
      • - {% if model.contest.isExtended(tdoc) or model.contest.isDone(tdoc) %} - {{ _('Hard Deadline') }}: {{ datetimeSpan(tdoc['endAt'])|safe }} - {% else %} - {{ _('Deadline') }}: {{ datetimeSpan(tdoc['penaltySince'])|safe }} - {% endif %} -
      • -
      -
      -
      -
    2. - {%- endfor -%} -
    - {{ paginator.render(page, tpcount, add_qs=qs) }} -
    - {% endif %} -
    -
    -
    -
    +{% extends "layout/basic.html" %} +{% block content %} +{{ set(UiContext, 'docs', calendar) }} +
    +
    +
    +
    +

    {{ _('All Homeworks') }}

    +
    + + {{ _('View') }}: + + + {% if groups.length %} +
    + {{ _('Show') }}: + + +
    + {% endif %} + {% if handler.user.hasPerm(perm.PERM_CREATE_HOMEWORK) %} + {{ _('Create Homework') }} + {% endif %} +
    +
    +
    + {% if not tdocs.length %} + {{ nothing.render('There is no homework so far ╰(*°▽°*)╯') }} + {% else %} +
      + {%- for tdoc in tdocs -%} +
    1. +
      +
      +
      +
      {{ datetimeSpan(tdoc['penaltySince'], false, 'D')|safe }}
      +
      {{ datetimeSpan(tdoc['penaltySince'], false, 'YYYY-M')|safe }}
      +
      +
      +
      +

      {{ tdoc.title }}

      +
        +
      • {{ _('Status') }}: {{ _(model.contest.statusText(tdoc)) }}
      • +
      • {{ _('Open Since') }}: {{ datetimeSpan(tdoc['beginAt'])|safe }}
      • +
      • + {% if model.contest.isExtended(tdoc) or model.contest.isDone(tdoc) %} + {{ _('Hard Deadline') }}: {{ datetimeSpan(tdoc['endAt'])|safe }} + {% else %} + {{ _('Deadline') }}: {{ datetimeSpan(tdoc['penaltySince'])|safe }} + {% endif %} +
      • +
      +
      +
      +
    2. + {%- endfor -%} +
    + {{ paginator.render(page, tpcount, add_qs=qs) }} +
    + {% endif %} +
    +
    +
    +
    {% endblock %} \ No newline at end of file diff --git a/packages/ui-default/templates/layout/basic.html b/packages/ui-default/templates/layout/basic.html index b0341c810e..b19318a8ce 100644 --- a/packages/ui-default/templates/layout/basic.html +++ b/packages/ui-default/templates/layout/basic.html @@ -1,25 +1,25 @@ -{% set layout_name = "basic" %} -{% extends "layout/html5.html" %} -{% block body %} -{% if UserContext %}{% include "partials/nav.html" %}{% endif %} -
    - {% if handler.session.legacy and not handler.session.nohint %} -
    -

    - {{ _('You are currently in legacy mode. Some additional features will be unavailable. We strongly recommend switching to standard mode on a modern browser.') }} - {{ _('Standard mode') }} {{ _('Hidden') }} -

    -
    - {% endif %} -
    - {% if UserContext %}{% include "partials/header_mobile.html" %}{% endif %} -
    - {% for item in ui.getNodes('Notification').concat(notification or []) %}{% if item.checker(handler) %} -
    {{ _(item.name).format(item.args.args or [])|nl2br|safe }}
    - {% endif %}{% endfor %} - {% block content %}{% endblock %} -
    - {% include "partials/footer.html" %} -
    -{% if UserContext and not handler.user._id %}{% include "partials/login_dialog.html" %}{% endif %} -{% endblock %} +{% set layout_name = "basic" %} +{% extends "layout/html5.html" %} +{% block body %} +{% if UserContext %}{% include "partials/nav.html" %}{% endif %} +
    + {% if handler.session.legacy and not handler.session.nohint %} +
    +

    + {{ _('You are currently in legacy mode. Some additional features will be unavailable. We strongly recommend switching to standard mode on a modern browser.') }} + {{ _('Standard mode') }} {{ _('Hidden') }} +

    +
    + {% endif %} +
    + {% if UserContext %}{% include "partials/header_mobile.html" %}{% endif %} +
    + {% for item in ui.getNodes('Notification').concat(notification or []) %}{% if item.checker(handler) %} +
    {{ _(item.name).format(item.args.args or [])|nl2br|safe }}
    + {% endif %}{% endfor %} + {% block content %}{% endblock %} +
    + {% include "partials/footer.html" %} +
    +{% if UserContext and not handler.user._id %}{% include "partials/login_dialog.html" %}{% endif %} +{% endblock %} diff --git a/packages/ui-default/templates/layout/home_base.html b/packages/ui-default/templates/layout/home_base.html index cf77fc5a48..73b8dd5d81 100644 --- a/packages/ui-default/templates/layout/home_base.html +++ b/packages/ui-default/templates/layout/home_base.html @@ -1,13 +1,13 @@ -{% import "components/home.html" as home with context %} -{% extends "layout/basic.html" %} -{% block content %} -
    -
    - {% block home_content %}{% endblock %} -
    -
    - {{ home.render_sidebar() }} - {% block home_sidebar %}{% endblock %} -
    -
    -{% endblock %} +{% import "components/home.html" as home with context %} +{% extends "layout/basic.html" %} +{% block content %} +
    +
    + {% block home_content %}{% endblock %} +
    +
    + {{ home.render_sidebar() }} + {% block home_sidebar %}{% endblock %} +
    +
    +{% endblock %} diff --git a/packages/ui-default/templates/layout/html5.html b/packages/ui-default/templates/layout/html5.html index 1b4d56692d..5c7efbc9c5 100644 --- a/packages/ui-default/templates/layout/html5.html +++ b/packages/ui-default/templates/layout/html5.html @@ -1,76 +1,76 @@ -{% import "components/form.html" as form with context %} -{% import "components/sidemenu.html" as sidemenu with context %} -{% import "components/paginator.html" as paginator with context %} -{% import "components/nothing.html" as nothing with context %} -{% import "components/noscript_note.html" as noscript_note with context %} -{% import "components/user.html" as user with context %} - - - - - - - - - - - - - - {% if handler.context.request.url %}{% endif %} - - {% block ogp %} - - - - - {% endblock %} - {{ handler.renderTitle(page_name) }} - - {% if process.env.DEV %} - - - {% else %} - - {% endif %} - {% if not isIE(handler.request.headers['user-agent']) and not handler.session.legacy %} - - {% endif %} - {% set UiContext = Object.create(UiContext) %} - {% set UserContext = Object.create(UserContext) %} - - - - {% if not isIE(handler.request.headers['user-agent']) and not handler.session.legacy %} - - - - {% endif %} - {% block body %}{% endblock %} - {% block script %}{% endblock %} - {% if not isIE(handler.request.headers['user-agent']) and not handler.session.legacy %} - - {% endif %} - +{% import "components/form.html" as form with context %} +{% import "components/sidemenu.html" as sidemenu with context %} +{% import "components/paginator.html" as paginator with context %} +{% import "components/nothing.html" as nothing with context %} +{% import "components/noscript_note.html" as noscript_note with context %} +{% import "components/user.html" as user with context %} + + + + + + + + + + + + + + {% if handler.context.request.url %}{% endif %} + + {% block ogp %} + + + + + {% endblock %} + {{ handler.renderTitle(page_name) }} + + {% if process.env.DEV %} + + + {% else %} + + {% endif %} + {% if not isIE(handler.request.headers['user-agent']) and not handler.session.legacy %} + + {% endif %} + {% set UiContext = Object.create(UiContext) %} + {% set UserContext = Object.create(UserContext) %} + + + + {% if not isIE(handler.request.headers['user-agent']) and not handler.session.legacy %} + + + + {% endif %} + {% block body %}{% endblock %} + {% block script %}{% endblock %} + {% if not isIE(handler.request.headers['user-agent']) and not handler.session.legacy %} + + {% endif %} + \ No newline at end of file diff --git a/packages/ui-default/templates/layout/immersive.html b/packages/ui-default/templates/layout/immersive.html index 7d7aa702d1..8483ba0dab 100644 --- a/packages/ui-default/templates/layout/immersive.html +++ b/packages/ui-default/templates/layout/immersive.html @@ -1,22 +1,22 @@ -{% set layout_name = "immersive" %} -{% set no_path_section = true %} -{% extends "layout/html5.html" %} -{% block body %} - -{% include "partials/nav.html" %} - -
    -
    - {% include "partials/header_mobile.html" %} - -
    - {% block content %}{% endblock %} -
    - -{% set show_topics = false %} -{% include "partials/footer.html" %} -
    - -{% include "partials/login_dialog.html" %} - -{% endblock %} +{% set layout_name = "immersive" %} +{% set no_path_section = true %} +{% extends "layout/html5.html" %} +{% block body %} + +{% include "partials/nav.html" %} + +
    +
    + {% include "partials/header_mobile.html" %} + +
    + {% block content %}{% endblock %} +
    + +{% set show_topics = false %} +{% include "partials/footer.html" %} +
    + +{% include "partials/login_dialog.html" %} + +{% endblock %} diff --git a/packages/ui-default/templates/layout/mail.html b/packages/ui-default/templates/layout/mail.html index ee3ebacb14..c725fc737a 100644 --- a/packages/ui-default/templates/layout/mail.html +++ b/packages/ui-default/templates/layout/mail.html @@ -1,31 +1,31 @@ -{% set layout_name = "mail" %} - -
    -
    -
    {% block title %}{% endblock %} - {{ handler.domain.ui.name|default(model.system.get('server.name')) }}
    -
    -{% block content %}{% endblock %} -
    - -
    -
    - +{% set layout_name = "mail" %} + +
    +
    +
    {% block title %}{% endblock %} - {{ handler.domain.ui.name|default(model.system.get('server.name')) }}
    +
    +{% block content %}{% endblock %} +
    + +
    +
    + diff --git a/packages/ui-default/templates/layout/simple.html b/packages/ui-default/templates/layout/simple.html index a9ac9511bb..2e8b5e536d 100644 --- a/packages/ui-default/templates/layout/simple.html +++ b/packages/ui-default/templates/layout/simple.html @@ -1,4 +1,4 @@ -{% set layout_name = "basic" %} -{% extends "layout/html5.html" %} -{% block body %} -{% endblock %} +{% set layout_name = "basic" %} +{% extends "layout/html5.html" %} +{% block body %} +{% endblock %} diff --git a/packages/ui-default/templates/layout/wiki_base.html b/packages/ui-default/templates/layout/wiki_base.html index 910590f39b..339ca548eb 100644 --- a/packages/ui-default/templates/layout/wiki_base.html +++ b/packages/ui-default/templates/layout/wiki_base.html @@ -1,16 +1,16 @@ -{% extends "layout/basic.html" %} -{% block content %} -
    -
    - {% block wiki_content %}{% endblock %} -
    -
    -
    - -
    -
    -
    +{% extends "layout/basic.html" %} +{% block content %} +
    +
    + {% block wiki_content %}{% endblock %} +
    +
    +
    + +
    +
    +
    {% endblock %} \ No newline at end of file diff --git a/packages/ui-default/templates/main.html b/packages/ui-default/templates/main.html index 65bbf35487..9e0da76fc6 100644 --- a/packages/ui-default/templates/main.html +++ b/packages/ui-default/templates/main.html @@ -1,22 +1,22 @@ -{% set page_name = "homepage" %} -{% extends "layout/basic.html" %} -{% import "components/contest.html" as contest with context %} -{% import "components/problem.html" as problem with context %} -{% import "components/user.html" as user with context %} -{% block content %} -
    - {% for column in contents %} -
    - {% for s in column.sections %} - {% if templateExists("partials/homepage/" + s[0] + ".html") %} - {% set payload = s[1] %} - {% include "partials/homepage/" + s[0] + ".html" %} - {% else %} - {% set payload = _("Template {0} not found.").format(s[0]) %} - {% include "partials/homepage/error.html" %} - {% endif %} - {% endfor %} -
    - {% endfor %} -
    -{% endblock %} +{% set page_name = "homepage" %} +{% extends "layout/basic.html" %} +{% import "components/contest.html" as contest with context %} +{% import "components/problem.html" as problem with context %} +{% import "components/user.html" as user with context %} +{% block content %} +
    + {% for column in contents %} +
    + {% for s in column.sections %} + {% if templateExists("partials/homepage/" + s[0] + ".html") %} + {% set payload = s[1] %} + {% include "partials/homepage/" + s[0] + ".html" %} + {% else %} + {% set payload = _("Template {0} not found.").format(s[0]) %} + {% include "partials/homepage/error.html" %} + {% endif %} + {% endfor %} +
    + {% endfor %} +
    +{% endblock %} diff --git a/packages/ui-default/templates/manage_base.html b/packages/ui-default/templates/manage_base.html index 8434cb9561..305e3695bb 100644 --- a/packages/ui-default/templates/manage_base.html +++ b/packages/ui-default/templates/manage_base.html @@ -1,24 +1,24 @@ -{% extends "layout/basic.html" %} -{% block content %} -
    -
    - {% block manage_content %}{% endblock %} -
    -
    -
    - -
    -
    -
    -{% endblock %} +{% extends "layout/basic.html" %} +{% block content %} +
    +
    + {% block manage_content %}{% endblock %} +
    +
    +
    + +
    +
    +
    +{% endblock %} diff --git a/packages/ui-default/templates/manage_config.html b/packages/ui-default/templates/manage_config.html index d25d41eac7..2638848602 100644 --- a/packages/ui-default/templates/manage_config.html +++ b/packages/ui-default/templates/manage_config.html @@ -1,24 +1,24 @@ -{% extends "manage_base.html" %} -{% block manage_content %} -{{ set(UiContext, 'schema', schema) }} -
    -
    -
    -
    - -
    
    -      
    -
    -
    -
    - -
    -
    -
    -
    -{% endblock %} +{% extends "manage_base.html" %} +{% block manage_content %} +{{ set(UiContext, 'schema', schema) }} +
    +
    +
    +
    + +
    
    +      
    +
    +
    +
    + +
    +
    +
    +
    +{% endblock %} diff --git a/packages/ui-default/templates/manage_dashboard.html b/packages/ui-default/templates/manage_dashboard.html index 32695f66ae..ee8ccc90d9 100644 --- a/packages/ui-default/templates/manage_dashboard.html +++ b/packages/ui-default/templates/manage_dashboard.html @@ -1,27 +1,27 @@ -{% import "components/user.html" as user %} -{% extends "manage_base.html" %} -{% block manage_content %} -
    -
    -

    {{ _('Messages') }}

    -
    -
    -
    -
    -
    -

    {{ _('Information') }}

    -
    -
    - - -
    -
    -
    -
    -
    -
    {{ _('Avatar') }}
    -
    {{ _('Name') }}
    {{ domain.name }}
    -
    -
    -
    -{% endblock %} +{% import "components/user.html" as user %} +{% extends "manage_base.html" %} +{% block manage_content %} +
    +
    +

    {{ _('Messages') }}

    +
    +
    +
    +
    +
    +

    {{ _('Information') }}

    +
    +
    + + +
    +
    +
    +
    +
    +
    {{ _('Avatar') }}
    +
    {{ _('Name') }}
    {{ domain.name }}
    +
    +
    +
    +{% endblock %} diff --git a/packages/ui-default/templates/manage_script.html b/packages/ui-default/templates/manage_script.html index ec6636ccfe..0025f38474 100644 --- a/packages/ui-default/templates/manage_script.html +++ b/packages/ui-default/templates/manage_script.html @@ -1,56 +1,56 @@ -{% extends "manage_base.html" %} -{% block manage_content %} - -
    -
    -

    {{ _('Scripts') }}

    - -
    -
    - {{ noscript_note.render() }} - - - - - - - - - - - - - - - {%- for id, script in scripts -%} - {% if not script.hidden %} - - - - - - {% endif %} - {%- endfor -%} - -
    {{ _('ID') }}{{ _('Description') }}{{ _('Action') }}
    {{ id }}{{ _(script.description|default(_('None'))) }} - {{ _('Run') }} -
    -
    -
    -{% endblock %} +{% extends "manage_base.html" %} +{% block manage_content %} + +
    +
    +

    {{ _('Scripts') }}

    + +
    +
    + {{ noscript_note.render() }} + + + + + + + + + + + + + + + {%- for id, script in scripts -%} + {% if not script.hidden %} + + + + + + {% endif %} + {%- endfor -%} + +
    {{ _('ID') }}{{ _('Description') }}{{ _('Action') }}
    {{ id }}{{ _(script.description|default(_('None'))) }} + {{ _('Run') }} +
    +
    +
    +{% endblock %} diff --git a/packages/ui-default/templates/manage_setting.html b/packages/ui-default/templates/manage_setting.html index 0147a7b649..fe0395d849 100644 --- a/packages/ui-default/templates/manage_setting.html +++ b/packages/ui-default/templates/manage_setting.html @@ -1,6 +1,6 @@ -{% extends "manage_base.html" %} -{% block manage_content %} -
    - {% include "partials/setting.html" %} -
    -{% endblock %} +{% extends "manage_base.html" %} +{% block manage_content %} +
    + {% include "partials/setting.html" %} +
    +{% endblock %} diff --git a/packages/ui-default/templates/manage_student_import.html b/packages/ui-default/templates/manage_student_import.html index 43561955a3..b82c36047c 100644 --- a/packages/ui-default/templates/manage_student_import.html +++ b/packages/ui-default/templates/manage_student_import.html @@ -1,27 +1,27 @@ -{% import "components/user.html" as user %} -{% extends "manage_base.html" %} -{% block manage_content %} -
    -
    -

    学生导入

    -
    -
    -

    输入学生信息,格式例如:123@abc.com,abc,123456,张三,计科2001,2020310000000,信息用英文逗号隔开,每个学生占一行

    -
    -
    -
    -
    - {{ noscript_note.render() }} -

    - {{ form.form_textarea({ - columns:null, - name:'students', - nospellcheck: true - }) }} -
    - - -
    -
    -
    -{% endblock %} +{% import "components/user.html" as user %} +{% extends "manage_base.html" %} +{% block manage_content %} +
    +
    +

    学生导入

    +
    +
    +

    输入学生信息,格式例如:123@abc.com,abc,123456,张三,计科2001,2020310000000,信息用英文逗号隔开,每个学生占一行

    +
    +
    +
    +
    + {{ noscript_note.render() }} +

    + {{ form.form_textarea({ + columns:null, + name:'students', + nospellcheck: true + }) }} +
    + + +
    +
    +
    +{% endblock %} diff --git a/packages/ui-default/templates/manage_user_import.html b/packages/ui-default/templates/manage_user_import.html index e163562b46..1db0781289 100644 --- a/packages/ui-default/templates/manage_user_import.html +++ b/packages/ui-default/templates/manage_user_import.html @@ -1,23 +1,23 @@ -{% import "components/user.html" as user %} -{% extends "manage_base.html" %} -{% block manage_content %} -
    -
    -

    {{ _('Import User') }}

    -
    -
    - {{ noscript_note.render() }} -

    - {{ form.form_textarea({ - columns:null, - label:'Users', - name:'users', - nospellcheck: true - }) }} -
    - - -
    -
    -
    -{% endblock %} +{% import "components/user.html" as user %} +{% extends "manage_base.html" %} +{% block manage_content %} +
    +
    +

    {{ _('Import User') }}

    +
    +
    + {{ noscript_note.render() }} +

    + {{ form.form_textarea({ + columns:null, + label:'Users', + name:'users', + nospellcheck: true + }) }} +
    + + +
    +
    +
    +{% endblock %} diff --git a/packages/ui-default/templates/manage_user_priv.html b/packages/ui-default/templates/manage_user_priv.html index 062cdadcd4..6ee164c61d 100644 --- a/packages/ui-default/templates/manage_user_priv.html +++ b/packages/ui-default/templates/manage_user_priv.html @@ -1,76 +1,76 @@ -{% extends "manage_base.html" %} -{% block manage_content %} - -
    -
    -

    {{ _('User Privilege') }}

    -
    - -
    -
    - {{ noscript_note.render() }} -
    - - - - - - - - - - - - - - - - - {% include "partials/manage_user_priv.html" %} -
    {{ _('User ID') }}{{ _('Username') }}{{ _('Privilege') }} - {{ _('Value') }}{{ _('Actions') }}
    -
    -
    -{% endblock %} +{% extends "manage_base.html" %} +{% block manage_content %} + +
    +
    +

    {{ _('User Privilege') }}

    +
    + +
    +
    + {{ noscript_note.render() }} +
    + + + + + + + + + + + + + + + + + {% include "partials/manage_user_priv.html" %} +
    {{ _('User ID') }}{{ _('Username') }}{{ _('Privilege') }} + {{ _('Value') }}{{ _('Actions') }}
    +
    +
    +{% endblock %} diff --git a/packages/ui-default/templates/partials/category.html b/packages/ui-default/templates/partials/category.html index 27196b4cfe..3f6185d8c5 100644 --- a/packages/ui-default/templates/partials/category.html +++ b/packages/ui-default/templates/partials/category.html @@ -1,19 +1,19 @@ -
      - {% set _categories = (handler.domain.problemCategories or model.system.get('problem.categories'))|parseYaml %} - {%- for category, sub_categories in _categories -%} -
    • -

      - {{ category }} -

      - {% if sub_categories | length > 0 %} -
        - {%- for sub_category in sub_categories -%} -
      1. - {{ sub_category }} -
      2. - {%- endfor -%} -
      - {% endif %} -
    • - {%- endfor -%} +
        + {% set _categories = (handler.domain.problemCategories or model.system.get('problem.categories'))|parseYaml %} + {%- for category, sub_categories in _categories -%} +
      • +

        + {{ category }} +

        + {% if sub_categories | length > 0 %} +
          + {%- for sub_category in sub_categories -%} +
        1. + {{ sub_category }} +
        2. + {%- endfor -%} +
        + {% endif %} +
      • + {%- endfor -%}
      \ No newline at end of file diff --git a/packages/ui-default/templates/partials/contest.html b/packages/ui-default/templates/partials/contest.html index 9321ad95af..460fb4697e 100644 --- a/packages/ui-default/templates/partials/contest.html +++ b/packages/ui-default/templates/partials/contest.html @@ -1,3 +1,3 @@ - - {{ tdoc.title }} + + {{ tdoc.title }} \ No newline at end of file diff --git a/packages/ui-default/templates/partials/contest_balloon.html b/packages/ui-default/templates/partials/contest_balloon.html index 23e44b43c2..228e566344 100644 --- a/packages/ui-default/templates/partials/contest_balloon.html +++ b/packages/ui-default/templates/partials/contest_balloon.html @@ -1,37 +1,37 @@ -{% import "components/user.html" as user with context %} -{% import "components/contest.html" as contest with context %} - - {%- for bdoc in bdocs -%} - - {% if bdoc.sent %} - - - {{ _('Sent') }} - - {% else %} - - - {{ _('Waiting') }} - - {% endif %} - {{ bdoc._id.toHexString()|truncate(8,true,'') }} - - {% if not bdoc.sent %} -
      - - -
      - {% endif %} - {{ String.fromCharCode(65+tdoc.pids.indexOf(bdoc.pid)) }}  ({{ tdoc.balloon[bdoc.pid].name }}) - - {{ user.render_inline(udict[bdoc.uid], badge=false) }} - - {% if bdoc.sent %}{{ user.render_inline(udict[bdoc.sent], avatar=false, badge=false) }}{% else %}-{% endif %} - - {% if bdoc.first %}{{ _('First of Problem') }}{% endif %} - - {%- endfor -%} +{% import "components/user.html" as user with context %} +{% import "components/contest.html" as contest with context %} + + {%- for bdoc in bdocs -%} + + {% if bdoc.sent %} + + + {{ _('Sent') }} + + {% else %} + + + {{ _('Waiting') }} + + {% endif %} + {{ bdoc._id.toHexString()|truncate(8,true,'') }} + + {% if not bdoc.sent %} +
      + + +
      + {% endif %} + {{ String.fromCharCode(65+tdoc.pids.indexOf(bdoc.pid)) }}  ({{ tdoc.balloon[bdoc.pid].name }}) + + {{ user.render_inline(udict[bdoc.uid], badge=false) }} + + {% if bdoc.sent %}{{ user.render_inline(udict[bdoc.sent], avatar=false, badge=false) }}{% else %}-{% endif %} + + {% if bdoc.first %}{{ _('First of Problem') }}{% endif %} + + {%- endfor -%} \ No newline at end of file diff --git a/packages/ui-default/templates/partials/contest_sidebar.html b/packages/ui-default/templates/partials/contest_sidebar.html index a6449f2dbc..a0cad693eb 100644 --- a/packages/ui-default/templates/partials/contest_sidebar.html +++ b/packages/ui-default/templates/partials/contest_sidebar.html @@ -1,112 +1,112 @@ -{% import "components/user.html" as user with context %} -{% import "components/contest.html" as contest with context %} -
      -{% if page_name != 'contest_detail' %} - -
      -

      {{ tdoc.title }}

      -
      - {% if tsdoc.attend %} - {{ _('Attended') }} - {% else %} - {{ _('Not Attended') }} - {% endif %} -
      -
      -
      -{% endif %} -
      - -
      -
      -
      -
      {{ _('Status') }}
      -
      - {{ _(model.contest.statusText(tdoc, tsdoc)) }} - {% if tsdoc.attend %} - ({{ _('Attended') }}) - {% endif %} -
      -
      {{ _('Rule') }}
      {{ _(model.contest.RULES[tdoc.rule].TEXT) }}
      -
      {{ _('Problem') }}
      {{ tdoc.pids.length }}
      -
      {{ _('Start at') }}
      {{ contest.render_time(tsdoc.startAt or tdoc.beginAt) }}
      -
      {{ _('End at') }}
      {{ contest.render_time(tsdoc.endAt or tdoc.endAt) }}
      -
      {{ _('Duration') }}
      {{ contest.render_duration(tdoc) }} {{ _('hour(s)') }}
      -
      {{ _('Host') }}
      {{ user.render_inline(owner_udoc, badge=false) }}
      -
      {{ _('Partic.') }}
      {{ tdoc['attend']|default(0) }}
      -
      -
      -
      +{% import "components/user.html" as user with context %} +{% import "components/contest.html" as contest with context %} +
      +{% if page_name != 'contest_detail' %} + +
      +

      {{ tdoc.title }}

      +
      + {% if tsdoc.attend %} + {{ _('Attended') }} + {% else %} + {{ _('Not Attended') }} + {% endif %} +
      +
      +
      +{% endif %} +
      + +
      +
      +
      +
      {{ _('Status') }}
      +
      + {{ _(model.contest.statusText(tdoc, tsdoc)) }} + {% if tsdoc.attend %} + ({{ _('Attended') }}) + {% endif %} +
      +
      {{ _('Rule') }}
      {{ _(model.contest.RULES[tdoc.rule].TEXT) }}
      +
      {{ _('Problem') }}
      {{ tdoc.pids.length }}
      +
      {{ _('Start at') }}
      {{ contest.render_time(tsdoc.startAt or tdoc.beginAt) }}
      +
      {{ _('End at') }}
      {{ contest.render_time(tsdoc.endAt or tdoc.endAt) }}
      +
      {{ _('Duration') }}
      {{ contest.render_duration(tdoc) }} {{ _('hour(s)') }}
      +
      {{ _('Host') }}
      {{ user.render_inline(owner_udoc, badge=false) }}
      +
      {{ _('Partic.') }}
      {{ tdoc['attend']|default(0) }}
      +
      +
      +
      diff --git a/packages/ui-default/templates/partials/contest_sidebar_management.html b/packages/ui-default/templates/partials/contest_sidebar_management.html index 1114449f35..6ec0ec2e48 100644 --- a/packages/ui-default/templates/partials/contest_sidebar_management.html +++ b/packages/ui-default/templates/partials/contest_sidebar_management.html @@ -1,53 +1,53 @@ -{% import "components/user.html" as user with context %} -{% import "components/contest.html" as contest with context %} -
      - -
      -

      {{ tdoc.title }}

      -
      -
      - -
      -
      -
      {{ _('Status') }}
      -
      - {{ _(model.contest.statusText(tdoc, tsdoc)) }} - {% if tsdoc.attend %} - ({{ _('Attended') }}) - {% endif %} -
      -
      {{ _('Rule') }}
      {{ model.contest.RULES[tdoc.rule].TEXT }}
      -
      {{ _('Problem') }}
      {{ tdoc.pids.length }}
      -
      {{ _('Start at') }}
      {{ contest.render_time(tsdoc.startAt or tdoc.beginAt) }}
      -
      {{ _('End at') }}
      {{ contest.render_time(tsdoc.endAt or tdoc.endAt) }}
      -
      {{ _('Duration') }}
      {{ contest.render_duration(tdoc) }} {{ _('hour(s)') }}
      -
      {{ _('Host') }}
      {{ user.render_inline(owner_udoc, badge=false) }}
      -
      {{ _('Partic.') }}
      {{ tdoc['attend']|default(0) }}
      -
      -
      -
      +{% import "components/user.html" as user with context %} +{% import "components/contest.html" as contest with context %} +
      + +
      +

      {{ tdoc.title }}

      +
      +
      + +
      +
      +
      {{ _('Status') }}
      +
      + {{ _(model.contest.statusText(tdoc, tsdoc)) }} + {% if tsdoc.attend %} + ({{ _('Attended') }}) + {% endif %} +
      +
      {{ _('Rule') }}
      {{ model.contest.RULES[tdoc.rule].TEXT }}
      +
      {{ _('Problem') }}
      {{ tdoc.pids.length }}
      +
      {{ _('Start at') }}
      {{ contest.render_time(tsdoc.startAt or tdoc.beginAt) }}
      +
      {{ _('End at') }}
      {{ contest.render_time(tsdoc.endAt or tdoc.endAt) }}
      +
      {{ _('Duration') }}
      {{ contest.render_duration(tdoc) }} {{ _('hour(s)') }}
      +
      {{ _('Host') }}
      {{ user.render_inline(owner_udoc, badge=false) }}
      +
      {{ _('Partic.') }}
      {{ tdoc['attend']|default(0) }}
      +
      +
      +
      diff --git a/packages/ui-default/templates/partials/contest_user.html b/packages/ui-default/templates/partials/contest_user.html index 210233ac17..6003f0a928 100644 --- a/packages/ui-default/templates/partials/contest_user.html +++ b/packages/ui-default/templates/partials/contest_user.html @@ -1,16 +1,16 @@ -{% import "components/user.html" as user with context %} -{% import "components/contest.html" as contest with context %} - - {%- for tsdoc in tsdocs -%} - - {{ tsdoc.uid }} - {{ user.render_inline(udict[tsdoc.uid], badge=false) }} - {{ contest.render_time(tsdoc.startAt or tdoc.beginAt) }} - {{ contest.render_time(tsdoc.endAt or tdoc.endAt) }} - {{ _('UnRank') if tsdoc.unrank else _('Rank') }} - - {{ _('Rank') if tsdoc.unrank else _('UnRank') }} - - - {%- endfor -%} - +{% import "components/user.html" as user with context %} +{% import "components/contest.html" as contest with context %} + + {%- for tsdoc in tsdocs -%} + + {{ tsdoc.uid }} + {{ user.render_inline(udict[tsdoc.uid], badge=false) }} + {{ contest.render_time(tsdoc.startAt or tdoc.beginAt) }} + {{ contest.render_time(tsdoc.endAt or tdoc.endAt) }} + {{ _('UnRank') if tsdoc.unrank else _('Rank') }} + + {{ _('Rank') if tsdoc.unrank else _('UnRank') }} + + + {%- endfor -%} + diff --git a/packages/ui-default/templates/partials/discussion_edit_form.html b/packages/ui-default/templates/partials/discussion_edit_form.html index 741f361af0..1d7129c7f1 100644 --- a/packages/ui-default/templates/partials/discussion_edit_form.html +++ b/packages/ui-default/templates/partials/discussion_edit_form.html @@ -1,45 +1,45 @@ -{% import "components/form.html" as form with context %} -
      -
      - -
      -
      - -
      -
      - -
      -
      -{{ form.form_textarea({ - columns:12, - label:'Content', - name:'content', - value:ddoc.content|default(''), - hotkeys:'ctrl+enter:submit', - markdown:true, - required:true, - extra_style:'height: 500px', - extra_textarea_class:'auto-resize' - }) }} +{% import "components/form.html" as form with context %} +
      +
      + +
      +
      + +
      +
      + +
      +
      +{{ form.form_textarea({ + columns:12, + label:'Content', + name:'content', + value:ddoc.content|default(''), + hotkeys:'ctrl+enter:submit', + markdown:true, + required:true, + extra_style:'height: 500px', + extra_textarea_class:'auto-resize' + }) }} diff --git a/packages/ui-default/templates/partials/discussion_list.html b/packages/ui-default/templates/partials/discussion_list.html index de2e70ba8f..f56b2868ad 100644 --- a/packages/ui-default/templates/partials/discussion_list.html +++ b/packages/ui-default/templates/partials/discussion_list.html @@ -1,50 +1,50 @@ -{% import "components/nothing.html" as nothing with context %} -{% import "components/user.html" as user with context %} -{% import "components/paginator.html" as paginator with context %} -{% if not ddocs.length %} - {{ nothing.render('No discussion yet...') }} -{% else %} -
        - {%- for ddoc in ddocs -%} -
      1. -
        -
        -
        -
        {{ ddoc.views }}
        -
        {{ _('查看') }}
        -
        -
        -
        -

        {{ ddoc['title'] }}

        - -
        -
        -
      2. - {%- endfor -%} -
      - {% if page != undefined and dpcount != undefined %} - {{ paginator.render(page, dpcount) }} - {% endif %} -{% endif %} +{% import "components/nothing.html" as nothing with context %} +{% import "components/user.html" as user with context %} +{% import "components/paginator.html" as paginator with context %} +{% if not ddocs.length %} + {{ nothing.render('No discussion yet...') }} +{% else %} +
        + {%- for ddoc in ddocs -%} +
      1. +
        +
        +
        +
        {{ ddoc.views }}
        +
        {{ _('查看') }}
        +
        +
        +
        +

        {{ ddoc['title'] }}

        + +
        +
        +
      2. + {%- endfor -%} +
      + {% if page != undefined and dpcount != undefined %} + {{ paginator.render(page, dpcount) }} + {% endif %} +{% endif %} diff --git a/packages/ui-default/templates/partials/discussion_list_main.html b/packages/ui-default/templates/partials/discussion_list_main.html index 1e9cbd471c..7fafa64b34 100644 --- a/packages/ui-default/templates/partials/discussion_list_main.html +++ b/packages/ui-default/templates/partials/discussion_list_main.html @@ -1,17 +1,17 @@ -{% import "components/nothing.html" as nothing with context %} -{% import "components/user.html" as user with context %} -{% import "components/paginator.html" as paginator with context %} -{% if not ddocs.length %} - {{ nothing.render('no discussion yet...') }} -{% else %} - {%- set ddoc = ddocs[0] -%} -
      -

      - {{ ddoc['title'] }} - {{ user.render_inline(udict[ddoc.owner], avatar=false, badge=false, classname=false) }}@{{ datetimeSpan(ddoc.updateAt)|safe }} {{ ddoc.views }}次查看 -

      -
      - {% if page != undefined and dpcount != undefined %} - {{ paginator.render(page, dpcount) }} - {% endif %} -{% endif %} +{% import "components/nothing.html" as nothing with context %} +{% import "components/user.html" as user with context %} +{% import "components/paginator.html" as paginator with context %} +{% if not ddocs.length %} + {{ nothing.render('no discussion yet...') }} +{% else %} + {%- set ddoc = ddocs[0] -%} +
      +

      + {{ ddoc['title'] }} + {{ user.render_inline(udict[ddoc.owner], avatar=false, badge=false, classname=false) }}@{{ datetimeSpan(ddoc.updateAt)|safe }} {{ ddoc.views }}次查看 +

      +
      + {% if page != undefined and dpcount != undefined %} + {{ paginator.render(page, dpcount) }} + {% endif %} +{% endif %} diff --git a/packages/ui-default/templates/partials/discussion_nodes_widget.html b/packages/ui-default/templates/partials/discussion_nodes_widget.html index 0e40c458aa..d54418adb6 100644 --- a/packages/ui-default/templates/partials/discussion_nodes_widget.html +++ b/packages/ui-default/templates/partials/discussion_nodes_widget.html @@ -1,17 +1,17 @@ -
      -
      -

      {{ _('Discussion Nodes') }}

      -
      -
        - {%- for category, nodes in vnodes|groupby('content') -%} -
      • -

        {{ category }}

        -
          - {%- for node in nodes -%} -
        1. {{ node.docId }}
        2. - {%- endfor -%} -
        -
      • - {%- endfor -%} -
      +
      +
      +

      {{ _('Discussion Nodes') }}

      +
      +
        + {%- for category, nodes in vnodes|groupby('content') -%} +
      • +

        {{ category }}

        +
          + {%- for node in nodes -%} +
        1. {{ node.docId }}
        2. + {%- endfor -%} +
        +
      • + {%- endfor -%} +
      \ No newline at end of file diff --git a/packages/ui-default/templates/partials/files.html b/packages/ui-default/templates/partials/files.html index 0cc6cdc09d..6ab4195baf 100644 --- a/packages/ui-default/templates/partials/files.html +++ b/packages/ui-default/templates/partials/files.html @@ -1,44 +1,44 @@ -{% import "components/nothing.html" as nothing with context %} -
      - {% if files.length %} - - - - - - - - - - - - - - - - {%- for file in files -%} - - - - - - - {%- endfor -%} - -
      - - {{ _('Filename') }}{{ _('Size') }}
      - - - {{ file.name }} - {{ size(file.size) }} - -
      - {% else %} - {{ nothing.render('There are no files currently.') }} - {% endif %} +{% import "components/nothing.html" as nothing with context %} +
      + {% if files.length %} + + + + + + + + + + + + + + + + {%- for file in files -%} + + + + + + + {%- endfor -%} + +
      + + {{ _('Filename') }}{{ _('Size') }}
      + + + {{ file.name }} + {{ size(file.size) }} + +
      + {% else %} + {{ nothing.render('There are no files currently.') }} + {% endif %}
      \ No newline at end of file diff --git a/packages/ui-default/templates/partials/footer.html b/packages/ui-default/templates/partials/footer.html index 4c144253cd..3d6617c786 100644 --- a/packages/ui-default/templates/partials/footer.html +++ b/packages/ui-default/templates/partials/footer.html @@ -1,90 +1,90 @@ - + diff --git a/packages/ui-default/templates/partials/hamburger.html b/packages/ui-default/templates/partials/hamburger.html index d7ad263c21..adec5970fa 100644 --- a/packages/ui-default/templates/partials/hamburger.html +++ b/packages/ui-default/templates/partials/hamburger.html @@ -1,7 +1,7 @@ - + diff --git a/packages/ui-default/templates/partials/header_mobile.html b/packages/ui-default/templates/partials/header_mobile.html index 978adc355d..607bb9262e 100644 --- a/packages/ui-default/templates/partials/header_mobile.html +++ b/packages/ui-default/templates/partials/header_mobile.html @@ -1,12 +1,12 @@ -
      -
      -
      - - - -
      -
      - {% include "partials/hamburger.html" %} -
      -
      -
      +
      +
      +
      + + + +
      +
      + {% include "partials/hamburger.html" %} +
      +
      +
      diff --git a/packages/ui-default/templates/partials/homepage/bulletin.html b/packages/ui-default/templates/partials/homepage/bulletin.html index 767e2c13b9..954d5b7047 100644 --- a/packages/ui-default/templates/partials/homepage/bulletin.html +++ b/packages/ui-default/templates/partials/homepage/bulletin.html @@ -1,7 +1,7 @@ -{% if domain.bulletin %} -
      -
      - {{ domain.bulletin|markdown|safe }} -
      -
      +{% if domain.bulletin %} +
      +
      + {{ domain.bulletin|markdown|safe }} +
      +
      {% endif %} \ No newline at end of file diff --git a/packages/ui-default/templates/partials/homepage/contest.html b/packages/ui-default/templates/partials/homepage/contest.html index 6330e77392..e58ed68dd3 100644 --- a/packages/ui-default/templates/partials/homepage/contest.html +++ b/packages/ui-default/templates/partials/homepage/contest.html @@ -1,48 +1,48 @@ -{% set tdocs = payload[0] %} -{% set tsdict = payload[1] %} -{% if tdocs.length %} -
      -
      -

      {{ _('Contest') }}

      -
      -
        - {%- for tdoc in tdocs -%} -
      1. -
        -
        -
        -
        {{ datetimeSpan(tdoc['beginAt'], false, 'D')|safe }}
        -
        {{ datetimeSpan(tdoc['beginAt'], false, 'YYYY-M')|safe }}
        -
        -
        -
        -

        {{ tdoc.title }}

        -
          -
        • - {{ _(model.contest.RULES[tdoc.rule].TEXT) }} -
        • - {% if tdoc.rated %} -
        • Rated
        • - {% endif %} -
        • - {{ contest.render_duration(tdoc) }} {{ _('hour(s)') }} -
        • -
        • - {{ tdoc['attend']|default(0) }} -
        • - {% if tsdict[tdoc.docId]['attend'] == 1 %} -
        • - {{ _('Attended') }} -
        • - {% endif %} -
        -
        -
        -
      2. - {%- endfor -%} -
      - -
      +{% set tdocs = payload[0] %} +{% set tsdict = payload[1] %} +{% if tdocs.length %} +
      +
      +

      {{ _('Contest') }}

      +
      +
        + {%- for tdoc in tdocs -%} +
      1. +
        +
        +
        +
        {{ datetimeSpan(tdoc['beginAt'], false, 'D')|safe }}
        +
        {{ datetimeSpan(tdoc['beginAt'], false, 'YYYY-M')|safe }}
        +
        +
        +
        +

        {{ tdoc.title }}

        +
          +
        • + {{ _(model.contest.RULES[tdoc.rule].TEXT) }} +
        • + {% if tdoc.rated %} +
        • Rated
        • + {% endif %} +
        • + {{ contest.render_duration(tdoc) }} {{ _('hour(s)') }} +
        • +
        • + {{ tdoc['attend']|default(0) }} +
        • + {% if tsdict[tdoc.docId]['attend'] == 1 %} +
        • + {{ _('Attended') }} +
        • + {% endif %} +
        +
        +
        +
      2. + {%- endfor -%} +
      + +
      {% endif %} \ No newline at end of file diff --git a/packages/ui-default/templates/partials/homepage/discussion.html b/packages/ui-default/templates/partials/homepage/discussion.html index afe4b28f54..a5a2514479 100644 --- a/packages/ui-default/templates/partials/homepage/discussion.html +++ b/packages/ui-default/templates/partials/homepage/discussion.html @@ -1,13 +1,13 @@ -{% set ddocs = payload[0] %} -{% set vndict = payload[1] %} -{% if ddocs.length %} -
      -
      -

      {{ _('Recent Discussion') }}

      -
      - {% include "partials/discussion_list_main.html" %} - -
      +{% set ddocs = payload[0] %} +{% set vndict = payload[1] %} +{% if ddocs.length %} +
      +
      +

      {{ _('Recent Discussion') }}

      +
      + {% include "partials/discussion_list_main.html" %} + +
      {% endif %} \ No newline at end of file diff --git a/packages/ui-default/templates/partials/homepage/discussion_nodes.html b/packages/ui-default/templates/partials/homepage/discussion_nodes.html index d022fe9684..20dc8ad9f4 100644 --- a/packages/ui-default/templates/partials/homepage/discussion_nodes.html +++ b/packages/ui-default/templates/partials/homepage/discussion_nodes.html @@ -1,4 +1,4 @@ -{% if handler.user.hasPerm(perm.PERM_VIEW_DISCUSSION) %} - {% set vnodes = payload %} - {% include 'partials/discussion_nodes_widget.html' %} +{% if handler.user.hasPerm(perm.PERM_VIEW_DISCUSSION) %} + {% set vnodes = payload %} + {% include 'partials/discussion_nodes_widget.html' %} {% endif %} \ No newline at end of file diff --git a/packages/ui-default/templates/partials/homepage/error.html b/packages/ui-default/templates/partials/homepage/error.html index 11db406ecf..76c61a0231 100644 --- a/packages/ui-default/templates/partials/homepage/error.html +++ b/packages/ui-default/templates/partials/homepage/error.html @@ -1,5 +1,5 @@ -
      -
      - {{ payload }} -
      +
      +
      + {{ payload }} +
      \ No newline at end of file diff --git a/packages/ui-default/templates/partials/homepage/hgnu_tool.html b/packages/ui-default/templates/partials/homepage/hgnu_tool.html new file mode 100644 index 0000000000..1c44ebcab8 --- /dev/null +++ b/packages/ui-default/templates/partials/homepage/hgnu_tool.html @@ -0,0 +1,13 @@ + \ No newline at end of file diff --git a/packages/ui-default/templates/partials/homepage/hitokoto.html b/packages/ui-default/templates/partials/homepage/hitokoto.html index 7e17978b4b..fb815965ff 100644 --- a/packages/ui-default/templates/partials/homepage/hitokoto.html +++ b/packages/ui-default/templates/partials/homepage/hitokoto.html @@ -1,6 +1,6 @@ -
      -
      -

      {{ _('Hitokoto') }}

      -
      -
      -
      +
      +
      +

      {{ _('Hitokoto') }}

      +
      +
      +
      diff --git a/packages/ui-default/templates/partials/homepage/homework.html b/packages/ui-default/templates/partials/homepage/homework.html index ee1cd0cf53..31b4d9d76f 100644 --- a/packages/ui-default/templates/partials/homepage/homework.html +++ b/packages/ui-default/templates/partials/homepage/homework.html @@ -1,45 +1,45 @@ -{% set htdocs = payload[0] %} -{% set htsdict = payload[1] %} -{% if htdocs.length %} -
      -
      -

      {{ _('Homework') }}

      -
      -
        - {%- for tdoc in htdocs -%} -
      1. -
        -
        -
        -
        {{ datetimeSpan(tdoc['penaltySince'], false, 'D')|safe }}
        -
        {{ datetimeSpan(tdoc['penaltySince'], false, 'YYYY-M')|safe }}
        -
        -
        -
        -

        {{ tdoc['title'] }}

        -
          -
        • {{ _('Status') }}: {{ _(model.contest.statusText(tdoc)) }}
        • -
        • {{ _('Open Since') }}: {{ datetimeSpan(tdoc['beginAt'])|safe }}
        • -
        • - {% if model.contest.isExtended(tdoc) or model.contest.isDone(tdoc) %} - {{ _('Hard Deadline') }}: {{ datetimeSpan(tdoc['endAt'])|safe }} - {% else %} - {{ _('Deadline') }}: {{ datetimeSpan(tdoc['penaltySince'])|safe }} - {% endif %} -
        • - {% if htsdict[tdoc['docId']]['attend'] == 1 %} -
        • - {{ _('Claimed') }} -
        • - {% endif %} -
        -
        -
        -
      2. - {%- endfor -%} -
      - -
      +{% set htdocs = payload[0] %} +{% set htsdict = payload[1] %} +{% if htdocs.length %} +
      +
      +

      {{ _('Homework') }}

      +
      +
        + {%- for tdoc in htdocs -%} +
      1. +
        +
        +
        +
        {{ datetimeSpan(tdoc['penaltySince'], false, 'D')|safe }}
        +
        {{ datetimeSpan(tdoc['penaltySince'], false, 'YYYY-M')|safe }}
        +
        +
        +
        +

        {{ tdoc['title'] }}

        +
          +
        • {{ _('Status') }}: {{ _(model.contest.statusText(tdoc)) }}
        • +
        • {{ _('Open Since') }}: {{ datetimeSpan(tdoc['beginAt'])|safe }}
        • +
        • + {% if model.contest.isExtended(tdoc) or model.contest.isDone(tdoc) %} + {{ _('Hard Deadline') }}: {{ datetimeSpan(tdoc['endAt'])|safe }} + {% else %} + {{ _('Deadline') }}: {{ datetimeSpan(tdoc['penaltySince'])|safe }} + {% endif %} +
        • + {% if htsdict[tdoc['docId']]['attend'] == 1 %} +
        • + {{ _('Claimed') }} +
        • + {% endif %} +
        +
        +
        +
      2. + {%- endfor -%} +
      + +
      {% endif %} \ No newline at end of file diff --git a/packages/ui-default/templates/partials/homepage/problem_search.html b/packages/ui-default/templates/partials/homepage/problem_search.html index b7fa0398b7..03b9db12d4 100644 --- a/packages/ui-default/templates/partials/homepage/problem_search.html +++ b/packages/ui-default/templates/partials/homepage/problem_search.html @@ -1,13 +1,13 @@ -
      -
      -

      {{ _('Search') }}

      -
      -
      -
      - - -
      -
      +
      +
      +

      {{ _('Search') }}

      +
      +
      +
      + + +
      +
      \ No newline at end of file diff --git a/packages/ui-default/templates/partials/homepage/ranking.html b/packages/ui-default/templates/partials/homepage/ranking.html index 8c94cd9033..40ceee6eb9 100644 --- a/packages/ui-default/templates/partials/homepage/ranking.html +++ b/packages/ui-default/templates/partials/homepage/ranking.html @@ -1,40 +1,40 @@ -{% if payload.length %} -
      -
      -

      {{ _('Ranking') }}

      -
      -
      -
      - - - - - - - - - - - - - - - - {%- for uid in payload -%} - {% set udoc = udict[uid] %} - - - - - - - {%- endfor -%} - -
      {{ _('Rank') }}{{ _('Username') }}{{ _('RP') }}{{ _('Accept') }}
      {{ loop.index }}{{ user.render_inline(udoc, levelbadge=false) }}{{ udoc.rp|default(0)|round(0) }}{{ udoc.nAccept }}
      -
      -
      - -
      +{% if payload.length %} +
      +
      +

      {{ _('Ranking') }}

      +
      +
      +
      + + + + + + + + + + + + + + + + {%- for uid in payload -%} + {% set udoc = udict[uid] %} + + + + + + + {%- endfor -%} + +
      {{ _('Rank') }}{{ _('Username') }}{{ _('RP') }}{{ _('Accept') }}
      {{ loop.index }}{{ user.render_inline(udoc, levelbadge=false) }}{{ udoc.rp|default(0)|round(0) }}{{ udoc.nAccept }}
      +
      +
      + +
      {% endif %} \ No newline at end of file diff --git a/packages/ui-default/templates/partials/homepage/recent_problems.html b/packages/ui-default/templates/partials/homepage/recent_problems.html index d17fd7b13d..c84f4adbb6 100644 --- a/packages/ui-default/templates/partials/homepage/recent_problems.html +++ b/packages/ui-default/templates/partials/homepage/recent_problems.html @@ -1,17 +1,17 @@ -{% set pdocs = payload[0] %} -{% set psdict = payload[1] %} -{% if pdocs.length %} -
      -
      -

      {{ _('Recent Problems') }}

      -
      -
      - {%- for pdoc in pdocs -%} -

      - {{ problem.render_problem_title(pdoc, show_tags=false, show_invisible_flag=false) }} - {{ datetimeSpan(pdoc._id)|safe }} -

      - {%- endfor -%} -
      -
      +{% set pdocs = payload[0] %} +{% set psdict = payload[1] %} +{% if pdocs.length %} +
      +
      +

      {{ _('Recent Problems') }}

      +
      +
      + {%- for pdoc in pdocs -%} +

      + {{ problem.render_problem_title(pdoc, show_tags=false, show_invisible_flag=false) }} + {{ datetimeSpan(pdoc._id)|safe }} +

      + {%- endfor -%} +
      +
      {% endif %} \ No newline at end of file diff --git a/packages/ui-default/templates/partials/homepage/starred_problems.html b/packages/ui-default/templates/partials/homepage/starred_problems.html index 9636c0a502..28a9c9aea3 100644 --- a/packages/ui-default/templates/partials/homepage/starred_problems.html +++ b/packages/ui-default/templates/partials/homepage/starred_problems.html @@ -1,22 +1,22 @@ -{% set pdocs = payload[0] %} -{% set psdict = payload[1] %} -{% if pdocs.length %} -
      -
      -

      {{ _('Starred Problems') }}

      -
      -
      - {%- for pdoc in pdocs -%} -
      - - - -
      - {{ problem.render_problem_title(pdoc, show_tags=false, show_invisible_flag=false) }}
      - {%- endfor -%} -
      -
      +{% set pdocs = payload[0] %} +{% set psdict = payload[1] %} +{% if pdocs.length %} +
      +
      +

      {{ _('Starred Problems') }}

      +
      +
      + {%- for pdoc in pdocs -%} +
      + + + +
      + {{ problem.render_problem_title(pdoc, show_tags=false, show_invisible_flag=false) }}
      + {%- endfor -%} +
      +
      {% endif %} \ No newline at end of file diff --git a/packages/ui-default/templates/partials/homepage/suggestion.html b/packages/ui-default/templates/partials/homepage/suggestion.html index 0c426cd5bd..88dba392cb 100644 --- a/packages/ui-default/templates/partials/homepage/suggestion.html +++ b/packages/ui-default/templates/partials/homepage/suggestion.html @@ -1,34 +1,34 @@ -
      -
      -

      {{ _('Recommended') }}

      -
      -
      -
      +
      +
      +

      {{ _('Recommended') }}

      +
      +
      +
      diff --git a/packages/ui-default/templates/partials/homepage/training.html b/packages/ui-default/templates/partials/homepage/training.html index 4594582954..9e82e394c0 100644 --- a/packages/ui-default/templates/partials/homepage/training.html +++ b/packages/ui-default/templates/partials/homepage/training.html @@ -1,50 +1,50 @@ -{% set tdocs = payload[0] %} -{% set tsdict = payload[1] %} -{% if tdocs.length %} -
      -
      -

      {{ _('Training') }}

      -
      -
        - {%- for tdoc in tdocs -%} -
      1. -
        -
        -
        -
        {{ tdoc.attend|default(0) }}
        -
        {{ _('Enrolled') }}
        -
        -
        -
        -

        {{ tdoc.title }}

        -
        -

        {{ tdoc['content'] }}

        -
        -
          -
        • - {{ _('{0} sections').format(tdoc['dag']|length) }}, {{ _('{0} problems').format(model.training.getPids(tdoc.dag)|length) }} -
        • -
        • - {% if tsdict[tdoc.docId]['enroll'] %} - {% if not tsdict[tdoc.docId]['done'] %} - - {{ _('Completed') }} {{ (100 * tsdict[tdoc.docId]['donePids']|length / model.training.getPids(tdoc.dag)|length)|round|int }}% - {% else %} - - {{ _('Completed') }} 100% - {% endif %} - {% elif handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %} - {{ _('Not Enrolled') }} - {% endif %} -
        • -
        -
        -
        -
      2. - {%- endfor -%} -
      - -
      +{% set tdocs = payload[0] %} +{% set tsdict = payload[1] %} +{% if tdocs.length %} +
      +
      +

      {{ _('Training') }}

      +
      +
        + {%- for tdoc in tdocs -%} +
      1. +
        +
        +
        +
        {{ tdoc.attend|default(0) }}
        +
        {{ _('Enrolled') }}
        +
        +
        +
        +

        {{ tdoc.title }}

        +
        +

        {{ tdoc['content'] }}

        +
        +
          +
        • + {{ _('{0} sections').format(tdoc['dag']|length) }}, {{ _('{0} problems').format(model.training.getPids(tdoc.dag)|length) }} +
        • +
        • + {% if tsdict[tdoc.docId]['enroll'] %} + {% if not tsdict[tdoc.docId]['done'] %} + + {{ _('Completed') }} {{ (100 * tsdict[tdoc.docId]['donePids']|length / model.training.getPids(tdoc.dag)|length)|round|int }}% + {% else %} + + {{ _('Completed') }} 100% + {% endif %} + {% elif handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %} + {{ _('Not Enrolled') }} + {% endif %} +
        • +
        +
        +
        +
      2. + {%- endfor -%} +
      + +
      {% endif %} \ No newline at end of file diff --git a/packages/ui-default/templates/partials/homework.html b/packages/ui-default/templates/partials/homework.html index 8dde242cd8..1c71122ba7 100644 --- a/packages/ui-default/templates/partials/homework.html +++ b/packages/ui-default/templates/partials/homework.html @@ -1,3 +1,3 @@ - - {{ tdoc.title }} + + {{ tdoc.title }} \ No newline at end of file diff --git a/packages/ui-default/templates/partials/homework_default_penalty_rules.yaml b/packages/ui-default/templates/partials/homework_default_penalty_rules.yaml index 79d4bcf4f3..734d4ecd40 100644 --- a/packages/ui-default/templates/partials/homework_default_penalty_rules.yaml +++ b/packages/ui-default/templates/partials/homework_default_penalty_rules.yaml @@ -1,3 +1,3 @@ -# Format: -# hours: coefficient -1: 0 +# Format: +# hours: coefficient +1: 0 diff --git a/packages/ui-default/templates/partials/homework_sidebar.html b/packages/ui-default/templates/partials/homework_sidebar.html index bf55b7b62f..758d47ee0f 100644 --- a/packages/ui-default/templates/partials/homework_sidebar.html +++ b/packages/ui-default/templates/partials/homework_sidebar.html @@ -1,89 +1,89 @@ -{% import "components/user.html" as user with context %} -{% import "components/homework.html" as homework with context %} -
      -{% if page_name != 'homework_detail' %} - -
      -

      {{ tdoc['title'] }}

      -
      - {% if tsdoc.attend %} - {{ _('Claimed') }} - {% else %} - {{ _('Not Claimed') }} - {% endif %} -
      -
      -
      -{% endif %} -
      - -
      -
      -
      -
      {{ _('Status') }}
      {{ _(model.contest.statusText(tdoc)) }}
      -
      {{ _('Problem') }}
      {{ tdoc['pids']|length }}
      -
      {{ _('Open Since') }}
      {{ homework.render_time(tdoc['beginAt']) }}
      -
      {{ _('Deadline') }}
      {{ homework.render_time(tdoc['penaltySince']) }}
      -
      {{ _('Can be Extended For') }}
      {{ homework.render_extension(tdoc) }} {{ _('hour(s)') }}
      -
      -
      +{% import "components/user.html" as user with context %} +{% import "components/homework.html" as homework with context %} +
      +{% if page_name != 'homework_detail' %} + +
      +

      {{ tdoc['title'] }}

      +
      + {% if tsdoc.attend %} + {{ _('Claimed') }} + {% else %} + {{ _('Not Claimed') }} + {% endif %} +
      +
      +
      +{% endif %} +
      + +
      +
      +
      +
      {{ _('Status') }}
      {{ _(model.contest.statusText(tdoc)) }}
      +
      {{ _('Problem') }}
      {{ tdoc['pids']|length }}
      +
      {{ _('Open Since') }}
      {{ homework.render_time(tdoc['beginAt']) }}
      +
      {{ _('Deadline') }}
      {{ homework.render_time(tdoc['penaltySince']) }}
      +
      {{ _('Can be Extended For') }}
      {{ homework.render_extension(tdoc) }} {{ _('hour(s)') }}
      +
      +
      \ No newline at end of file diff --git a/packages/ui-default/templates/partials/login_dialog.html b/packages/ui-default/templates/partials/login_dialog.html index 5d5be1461e..13cdfc334c 100644 --- a/packages/ui-default/templates/partials/login_dialog.html +++ b/packages/ui-default/templates/partials/login_dialog.html @@ -1,56 +1,56 @@ - + diff --git a/packages/ui-default/templates/partials/manage_user_priv.html b/packages/ui-default/templates/partials/manage_user_priv.html index f4611b1587..a24f77b2f6 100644 --- a/packages/ui-default/templates/partials/manage_user_priv.html +++ b/packages/ui-default/templates/partials/manage_user_priv.html @@ -1,78 +1,78 @@ -{% import "components/user.html" as user with context %} - -{% macro show_priv(upriv) %} -{%- if upriv == 0 -%} - PRIV_NONE -{%- elif upriv == -1 -%} - PRIV_ALL -{%- else -%} - {%- for name, priv in Priv -%} - {%- if priv|bitand(upriv) and not priv|bitand(defaultPriv) -%} -

      +{{ name }}

      - {%- elif priv|bitand(defaultPriv) and not priv|bitand(upriv) -%} -

      -{{ name }}

      - {%- endif -%} - {%- endfor -%} -{%- endif -%} -{% endmacro %} - - - - - # - - - Default Privilege - - - {%- for name, priv in Priv -%} - {%- if defaultPriv|bitand(priv) -%} - {{ name }}
      - {%- endif -%} - {%- endfor -%} - - - {{ defaultPriv }} - - - {{ _('Edit') }} - - - {%- for priv, gudocs in udocs|groupby('priv') -%} - {%- if gudocs|length > 50 -%} - - -
      - {%- for udoc in gudocs -%} - [{{udoc._id}}]{{ user.render_inline(udoc, avatar=false, badge=false) }} - {{ _('Edit') }}    - {%- endfor -%} - - - {{ priv }}
      - {{ show_priv(priv) }} - - - {%- else -%} - {%- for udoc in gudocs -%} - - - {{ udoc._id }} - - - {{ user.render_inline(udoc, badge=false) }} - - - {{ show_priv(udoc.priv) }} - - - {{ udoc.priv }} - - - {{ _('Edit') }} - - - {%- endfor -%} - {%- endif -%} - {%- endfor -%} - +{% import "components/user.html" as user with context %} + +{% macro show_priv(upriv) %} +{%- if upriv == 0 -%} + PRIV_NONE +{%- elif upriv == -1 -%} + PRIV_ALL +{%- else -%} + {%- for name, priv in Priv -%} + {%- if priv|bitand(upriv) and not priv|bitand(defaultPriv) -%} +

      +{{ name }}

      + {%- elif priv|bitand(defaultPriv) and not priv|bitand(upriv) -%} +

      -{{ name }}

      + {%- endif -%} + {%- endfor -%} +{%- endif -%} +{% endmacro %} + + + + + # + + + Default Privilege + + + {%- for name, priv in Priv -%} + {%- if defaultPriv|bitand(priv) -%} + {{ name }}
      + {%- endif -%} + {%- endfor -%} + + + {{ defaultPriv }} + + + {{ _('Edit') }} + + + {%- for priv, gudocs in udocs|groupby('priv') -%} + {%- if gudocs|length > 50 -%} + + +
      + {%- for udoc in gudocs -%} + [{{udoc._id}}]{{ user.render_inline(udoc, avatar=false, badge=false) }} + {{ _('Edit') }}    + {%- endfor -%} + + + {{ priv }}
      + {{ show_priv(priv) }} + + + {%- else -%} + {%- for udoc in gudocs -%} + + + {{ udoc._id }} + + + {{ user.render_inline(udoc, badge=false) }} + + + {{ show_priv(udoc.priv) }} + + + {{ udoc.priv }} + + + {{ _('Edit') }} + + + {%- endfor -%} + {%- endif -%} + {%- endfor -%} + diff --git a/packages/ui-default/templates/partials/nav.html b/packages/ui-default/templates/partials/nav.html index 0b666ea339..6c271bbde9 100644 --- a/packages/ui-default/templates/partials/nav.html +++ b/packages/ui-default/templates/partials/nav.html @@ -1,132 +1,132 @@ -{%- macro nav_item(item) -%} - -{%- endmacro -%} - - - +{%- macro nav_item(item) -%} + +{%- endmacro -%} + + + diff --git a/packages/ui-default/templates/partials/problem-sidebar-information.html b/packages/ui-default/templates/partials/problem-sidebar-information.html index 42c5d28a69..72f34f4528 100644 --- a/packages/ui-default/templates/partials/problem-sidebar-information.html +++ b/packages/ui-default/templates/partials/problem-sidebar-information.html @@ -1,25 +1,25 @@ -{% import "components/record.html" as record with context %} -{% import "components/problem.html" as problem with context %} -{% import "components/user.html" as user with context %} -
      -
      -
      {{ _('ID') }}
      -
      {{ pdoc.docId }}
      -
      {{ _('Time') }}
      -
      {{ pdoc.config.timeMax if pdoc.config.timeMax == pdoc.config.timeMin else pdoc.config.timeMin+'~'+pdoc.config.timeMax }}ms
      -
      {{ _('Memory') }}
      -
      {{ pdoc.config.memoryMax if pdoc.config.memoryMax == pdoc.config.memoryMin else pdoc.config.memoryMin+'~'+pdoc.config.memoryMax }}MiB
      -
      {{ _('Difficulty') }}
      -
      {{ pdoc['difficulty'] or lib.difficulty(pdoc.nSubmit, pdoc.nAccept) or _('(None)') }}
      -
      {{ _('Tags') }}
      -
      - {{ problem.render_problem_tags(pdoc, true) }} -
      -
      {{ _('# Submissions') }}
      -
      {{ pdoc.nSubmit }}
      -
      {{ _('Accepted') }}
      -
      {{ pdoc.nAccept }}
      -
      {{ _('Uploaded By') }}
      -
      {{ user.render_inline(owner_udoc, badge=false) }}
      -
      +{% import "components/record.html" as record with context %} +{% import "components/problem.html" as problem with context %} +{% import "components/user.html" as user with context %} +
      +
      +
      {{ _('ID') }}
      +
      {{ pdoc.docId }}
      +
      {{ _('Time') }}
      +
      {{ pdoc.config.timeMax if pdoc.config.timeMax == pdoc.config.timeMin else pdoc.config.timeMin+'~'+pdoc.config.timeMax }}ms
      +
      {{ _('Memory') }}
      +
      {{ pdoc.config.memoryMax if pdoc.config.memoryMax == pdoc.config.memoryMin else pdoc.config.memoryMin+'~'+pdoc.config.memoryMax }}MiB
      +
      {{ _('Difficulty') }}
      +
      {{ pdoc['difficulty'] or lib.difficulty(pdoc.nSubmit, pdoc.nAccept) or _('(None)') }}
      +
      {{ _('Tags') }}
      +
      + {{ problem.render_problem_tags(pdoc, true) }} +
      +
      {{ _('# Submissions') }}
      +
      {{ pdoc.nSubmit }}
      +
      {{ _('Accepted') }}
      +
      {{ pdoc.nAccept }}
      +
      {{ _('Uploaded By') }}
      +
      {{ user.render_inline(owner_udoc, badge=false) }}
      +
      \ No newline at end of file diff --git a/packages/ui-default/templates/partials/problem.html b/packages/ui-default/templates/partials/problem.html index c7599f75c3..078fc2d460 100644 --- a/packages/ui-default/templates/partials/problem.html +++ b/packages/ui-default/templates/partials/problem.html @@ -1,2 +1,2 @@ -{% import "components/problem.html" as problem with context %} +{% import "components/problem.html" as problem with context %} {{ problem.render_problem_title(pdoc, inline=true) }} \ No newline at end of file diff --git a/packages/ui-default/templates/partials/problem_category_dialog.html b/packages/ui-default/templates/partials/problem_category_dialog.html index 2b297a7b8a..bea91ffb39 100644 --- a/packages/ui-default/templates/partials/problem_category_dialog.html +++ b/packages/ui-default/templates/partials/problem_category_dialog.html @@ -1,43 +1,43 @@ -{% set _categories = (handler.domain.problemCategories or model.system.get('problem.categories'))|parseYaml %} -
    +
    From d76d0590aa23e686195dc01a3ae699e356c61b63 Mon Sep 17 00:00:00 2001 From: guke1024 <0124gj@gmail.com> Date: Sun, 4 Aug 2024 23:02:07 +0800 Subject: [PATCH 27/52] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dhduoj=E4=BB=A5=E5=8F=8A?= =?UTF-8?q?=E8=AE=AD=E7=BB=83=E5=A7=93=E5=90=8D=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui-default/templates/training_detail.html | 4 ++-- packages/vjudge/src/providers/hduoj.ts | 15 +++++++++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/packages/ui-default/templates/training_detail.html b/packages/ui-default/templates/training_detail.html index 34d1f88611..945d8315ee 100644 --- a/packages/ui-default/templates/training_detail.html +++ b/packages/ui-default/templates/training_detail.html @@ -23,8 +23,8 @@