diff --git a/packages/hydrooj/locales/en.yaml b/packages/hydrooj/locales/en.yaml index e4dd559b9..af974dcc2 100644 --- a/packages/hydrooj/locales/en.yaml +++ b/packages/hydrooj/locales/en.yaml @@ -42,11 +42,13 @@ homework_main: Homework homework_scoreboard: Scoreboard judge_playground: Judge Playground main: Home +manage_config: System Configurations manage_dashboard: System manage_module: Module Management manage_script: Scripts manage_setting: System Settings manage_user_import: Import Users +manage_user_priv: User Privilege manage: System Manage no_translation_warn:
This part of content is under translation.
page.problem_detail.sidebar.show_category: Click to Show diff --git a/packages/hydrooj/src/handler/discussion.ts b/packages/hydrooj/src/handler/discussion.ts index 213ecbfd4..5c6188667 100644 --- a/packages/hydrooj/src/handler/discussion.ts +++ b/packages/hydrooj/src/handler/discussion.ts @@ -322,7 +322,10 @@ class DiscussionDetailHandler extends DiscussionHandler { @param('drrid', Types.ObjectId) async postDeleteTailReply(domainId: string, drid: ObjectId, drrid: ObjectId) { const deleteBy = this.user.own(this.drrdoc) ? 'self' : 'Admin'; - if (!this.user.own(this.drrdoc)) this.checkPerm(PERM.PERM_DELETE_DISCUSSION_REPLY); + if (!(this.user.own(this.drrdoc) + && this.user.hasPerm(PERM.PERM_DELETE_DISCUSSION_REPLY_SELF))) { + this.checkPerm(PERM.PERM_DELETE_DISCUSSION_REPLY); + } const msg = JSON.stringify({ message: 'Admin {0} delete your discussion tail reply {1} in "{2}"({3:link}).', params: [ diff --git a/packages/ui-default/common/variables.inc.styl b/packages/ui-default/common/variables.inc.styl index da06edd25..8adb3ef3b 100644 --- a/packages/ui-default/common/variables.inc.styl +++ b/packages/ui-default/common/variables.inc.styl @@ -40,8 +40,9 @@ $font-size-icon = 16px $font-size-title = 20px // components -$section-gap-v = 25px +$section-gap-v = 15px $section-gap-h = $grid-padding +$section-list-v = 25px $section-margin = 30px $section-shadow = rem(0 6px 22px) rgba(#AFC2C9, 0.5) $section-bg-color = $content-bg-color diff --git a/packages/ui-default/components/hint.page.styl b/packages/ui-default/components/hint.page.styl new file mode 100644 index 000000000..52ed2ff19 --- /dev/null +++ b/packages/ui-default/components/hint.page.styl @@ -0,0 +1,9 @@ +.hint + font-size: $font-size-small + position: relative + top: $nav-item-height + z-index: 99 + left: 0 + width: 100% + color: #e58900 + background: #fff0e3; \ No newline at end of file diff --git a/packages/ui-default/index.ts b/packages/ui-default/index.ts index ebb263926..80c9a3968 100644 --- a/packages/ui-default/index.ts +++ b/packages/ui-default/index.ts @@ -59,8 +59,10 @@ class LegacyModeHandler extends Handler { noCheckPermView = true; @param('legacy', Types.Boolean) - async get(domainId: string, legacy = false) { + @param('nohint', Types.Boolean) + async get(domainId: string, legacy = false, nohint = false) { this.session.legacy = legacy; + this.session.nohint = nohint; this.back(); } } diff --git a/packages/ui-default/locales/zh.yaml b/packages/ui-default/locales/zh.yaml index 85976ff1b..431c0a26b 100644 --- a/packages/ui-default/locales/zh.yaml +++ b/packages/ui-default/locales/zh.yaml @@ -484,6 +484,7 @@ Learn More: 了解更多 Leave blank to use numeric pid.: 留空来使用数字题号。 Leave empty for default: 留空以使用默认 Ledo: 乐多 +Legacy mode: 兼容模式 Light: 亮色 Limit user to finish contest within N hours: 限制用户在N小时内完成比赛 Limitations: 限制 @@ -817,6 +818,7 @@ Sorry, there are no users in this domain.: 对不起,此域中没有用户。 Sorry: 对不起 Sort by: 排序 Source type: 来源类型 +Standard mode: 标准模式 Star Topic: 收藏讨论 Star: 收藏 Starred Users: 关注用户 @@ -1005,6 +1007,7 @@ With this feature, you can copy problems that you can view from a domain to some Write Your Comment: 发表您的评论 Write Your Solution: 发表您的题解 Year: 年 +You are currently in legacy mode. Some additional features will be unavailable. We strongly recommend switching to standard mode on a modern browser.: 您当前处于兼容模式。某些功能在此模式下不可用。我们强烈建议在现代浏览器上切换为标准模式以获得更好的体验。 You are not allowed to join the domain. The link is either invalid or expired.: 您无法加入该域,链接无效或已过期。 You can also upload your avatar to Gravatar and it will be automatically updated here.: 你也可以将头像上传到 Gravatar,本站的头像将自动更新。 You can create your own training plans and share them with others.: 您可以创建您自己的训练计划并且与他人分享。 diff --git a/packages/ui-default/misc/section.styl b/packages/ui-default/misc/section.styl index 7beccbade..df522ae3f 100644 --- a/packages/ui-default/misc/section.styl +++ b/packages/ui-default/misc/section.styl @@ -33,6 +33,12 @@ padding: rem($section-gap-v) rem($section-gap-h) 0 position: relative + &:last-child + padding-bottom: rem($section-gap-v) + + +.section__body.no-padding:last-child + padding-top: rem($section-gap-v) !important + .section__body padding: 0.7em rem($section-gap-h) @@ -92,7 +98,7 @@ h3.section__title color: $section-toolbtn-color-hover .section__list__item - padding: rem($section-gap-v $section-gap-h) + padding: rem($section-list-v $section-gap-h) border-bottom: 1px solid $table-border-color &:last-child diff --git a/packages/ui-default/pages/problem_edit.page.js b/packages/ui-default/pages/problem_edit.page.js index 857b2b252..bf7f94456 100644 --- a/packages/ui-default/pages/problem_edit.page.js +++ b/packages/ui-default/pages/problem_edit.page.js @@ -221,7 +221,7 @@ export default new NamedPage(['problem_create', 'problem_edit'], (pagename) => { } async function handleClickDownloadAll() { - const files = $('.additionalfile-table tr').map(function () { return $(this).attr('data-filename'); }).get(); + 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] }); diff --git a/packages/ui-default/pages/problem_main.page.ts b/packages/ui-default/pages/problem_main.page.ts index 123f1b936..8e08cb772 100644 --- a/packages/ui-default/pages/problem_main.page.ts +++ b/packages/ui-default/pages/problem_main.page.ts @@ -234,7 +234,7 @@ function hideTags(target) { } const categoryDialog: any = new Dialog({ - $body: $('.dialog--category-filter'), + $body: $('.dialog--category-filter > div'), cancelByClickingBack: true, cancelByEsc: true, }); diff --git a/packages/ui-default/templates/components/comments_discussion.html b/packages/ui-default/templates/components/comments_discussion.html index eb7d06d0a..f3c166d5c 100644 --- a/packages/ui-default/templates/components/comments_discussion.html +++ b/packages/ui-default/templates/components/comments_discussion.html @@ -14,12 +14,10 @@ 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, @@ -101,7 +99,7 @@ {% 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)) or handler.user.hasPerm(comment_edit_perm) %} + {% 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) %} @@ -142,10 +140,10 @@ {% if handler.user.hasPerm(reply_post_perm) %} {{ action(_('Reply'), 'reply', 'reply', {}, 'reply') }} {% endif %} - {% if handler.user.own(doc) or handler.user.hasPerm(reply_edit_perm) %} + {% 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(doc) or handler.user.hasPerm(reply_delete_perm) %} + {% 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 %} diff --git a/packages/ui-default/templates/discussion_detail.html b/packages/ui-default/templates/discussion_detail.html index 65fa83fa5..d2c548d13 100644 --- a/packages/ui-default/templates/discussion_detail.html +++ b/packages/ui-default/templates/discussion_detail.html @@ -91,13 +91,11 @@ reply_edit_op = 'edit_tail_reply', reply_delete_op = 'delete_tail_reply', comment_post_perm = perm.PERM_REPLY_DISCUSSION, - comment_edit_perm = perm.PERM_NEVER, comment_delete_perm = perm.PERM_DELETE_DISCUSSION_REPLY_SELF_DISCUSSION if handler.user.own(ddoc) else perm.PERM_DELETE_DISCUSSION_REPLY, comment_edit_self_perm = perm.PERM_EDIT_DISCUSSION_REPLY_SELF, comment_delete_self_perm = perm.PERM_DELETE_DISCUSSION_REPLY_SELF, reply_post_perm = perm.PERM_REPLY_DISCUSSION, - reply_edit_perm = perm.PERM_NEVER, - reply_delete_perm = perm.PERM_DELETE_DISCUSSION_REPLY_SELF_DISCUSSION if handler.user.own(ddoc) else perm.PERM_DELETE_DISCUSSION_REPLY, + reply_delete_perm = perm.PERM_DELETE_DISCUSSION_REPLY, reply_edit_self_perm = perm.PERM_EDIT_DISCUSSION_REPLY_SELF, reply_delete_self_perm = perm.PERM_DELETE_DISCUSSION_REPLY_SELF, reactions = reactions, diff --git a/packages/ui-default/templates/layout/basic.html b/packages/ui-default/templates/layout/basic.html index c9c022c37..b0341c810 100644 --- a/packages/ui-default/templates/layout/basic.html +++ b/packages/ui-default/templates/layout/basic.html @@ -3,6 +3,14 @@ {% 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 %}
diff --git a/packages/ui-default/templates/partials/problem_category_dialog.html b/packages/ui-default/templates/partials/problem_category_dialog.html index accebdce6..2b297a7b8 100644 --- a/packages/ui-default/templates/partials/problem_category_dialog.html +++ b/packages/ui-default/templates/partials/problem_category_dialog.html @@ -1,41 +1,43 @@ {% set _categories = (handler.domain.problemCategories or model.system.get('problem.categories'))|parseYaml %} -
-
-
+ \ No newline at end of file