From e5e68b56bf222358ce441369e544fea5a2787a4b Mon Sep 17 00:00:00 2001 From: Jack Ren Date: Fri, 27 Mar 2020 19:59:19 +0800 Subject: [PATCH] Passcode (CTF Flag) Function (#549) --- vj4/handler/problem.py | 6 ++++-- vj4/locale/zh_CN.yaml | 4 +++- vj4/model/adaptor/problem.py | 3 ++- vj4/ui/components/scratchpad/ScratchpadToolbarContainer.js | 4 ++-- vj4/ui/templates/partials/problem_sidebar_normal.html | 4 ++++ vj4/ui/templates/problem_settings.html | 1 + 6 files changed, 16 insertions(+), 6 deletions(-) diff --git a/vj4/handler/problem.py b/vj4/handler/problem.py index e67030b8e..2d533201c 100644 --- a/vj4/handler/problem.py +++ b/vj4/handler/problem.py @@ -707,7 +707,8 @@ def split_tags(self, s): @base.sanitize async def post(self, *, pid: document.convert_doc_id, hidden: bool=False, category: str, tag: str, - difficulty_setting: int, difficulty_admin: str=''): + difficulty_setting: int, difficulty_admin: str='', + ac_msg: str=''): pdoc = await problem.get(self.domain_id, pid) if not self.own(pdoc, builtin.PERM_EDIT_PROBLEM_SELF): self.check_perm(builtin.PERM_EDIT_PROBLEM) @@ -728,7 +729,8 @@ async def post(self, *, pid: document.convert_doc_id, hidden: bool=False, difficulty_admin = None await problem.edit(self.domain_id, pdoc['doc_id'], hidden=hidden, category=category, tag=tag, - difficulty_setting=difficulty_setting, difficulty_admin=difficulty_admin) + difficulty_setting=difficulty_setting, difficulty_admin=difficulty_admin, + ac_msg=ac_msg) await job.difficulty.update_problem(self.domain_id, pdoc['doc_id']) self.json_or_redirect(self.reverse_url('problem_detail', pid=pid)) diff --git a/vj4/locale/zh_CN.yaml b/vj4/locale/zh_CN.yaml index e0be368c5..e86f1d863 100644 --- a/vj4/locale/zh_CN.yaml +++ b/vj4/locale/zh_CN.yaml @@ -590,6 +590,7 @@ Created By: 创建人 Judged By: 评测机 Categories: 分类 Tags: 标签 +AC Message: 通过消息 problem-category-delim: '|' problem-subcategory-delim: 、 Download Dataset: 下载数据集 @@ -790,4 +791,5 @@ Copy Problem To: 将题目复制到 What's this?: 这是什么? About test data: 关于测试数据 With this feature, you can copy problems that you can view from a domain to some other domain. Their title, content, tags and categories will be copied. However, their test data are not copied directly.: 您可以通过这个功能将某域下您能查看的题目复制到其它域中,题目的标题、描述、标签与分类将被复制过来。但是测试数据不会被直接复制。 -Instead of copying the test data directly, the test data of the copied problems will be linked to the test data of the source problems (called the source test data). Thus, the copied problems can observe the changes in the source test data. The permissions of the test data of the copied problems follow the source test data, e.g., you still might not download them but the judges can. By uploading some new test data, the link will be broken and the new test data will be used.: 虽然测试数据不会被复制,但是系统会将题目的测试数据链接到原题。因此在原题的数据被改动的时候,复制后的题目的数据也会同时改动。链接后的测试数据的权限以原题为准,比如您可能依旧无法下载数据,但是评测机可以。在题目设置页面中可以通过上传新的测试数据的方式,这个数据链接会被删除,以后将使用您的新测试数据。 \ No newline at end of file +Instead of copying the test data directly, the test data of the copied problems will be linked to the test data of the source problems (called the source test data). Thus, the copied problems can observe the changes in the source test data. The permissions of the test data of the copied problems follow the source test data, e.g., you still might not download them but the judges can. By uploading some new test data, the link will be broken and the new test data will be used.: 虽然测试数据不会被复制,但是系统会将题目的测试数据链接到原题。因此在原题的数据被改动的时候,复制后的题目的数据也会同时改动。链接后的测试数据的权限以原题为准,比如您可能依旧无法下载数据,但是评测机可以。在题目设置页面中可以通过上传新的测试数据的方式,这个数据链接会被删除,以后将使用您的新测试数据。 +This message will be presented to those whose submissions are accepted.: 这条消息将会被展示给通过此题的用户。 \ No newline at end of file diff --git a/vj4/model/adaptor/problem.py b/vj4/model/adaptor/problem.py index f37f37997..6c6f556cd 100644 --- a/vj4/model/adaptor/problem.py +++ b/vj4/model/adaptor/problem.py @@ -58,7 +58,8 @@ async def copy(pdoc, dest_domain_id: str, owner_uid: int, pid = await add(domain_id=dest_domain_id, owner_uid=owner_uid, title=pdoc['title'], content=pdoc['content'], pid=pid, hidden=hidden, category=pdoc['category'], - data=data, tag=pdoc.get('tag', [])) + data=data, tag=pdoc.get('tag', []), + ac_msg=pdoc.get('ac_msg', '')) await document.inc(src_domain_id, document.TYPE_PROBLEM, src_pid, 'num_be_copied', 1) return pid diff --git a/vj4/ui/components/scratchpad/ScratchpadToolbarContainer.js b/vj4/ui/components/scratchpad/ScratchpadToolbarContainer.js index bfe7b67df..ed604b1aa 100644 --- a/vj4/ui/components/scratchpad/ScratchpadToolbarContainer.js +++ b/vj4/ui/components/scratchpad/ScratchpadToolbarContainer.js @@ -94,7 +94,7 @@ export default class ScratchpadToolbarContainer extends React.PureComponent { {' '} {i18n('Run Pretest')} {' '} -(F9) + (F9)