template: problem_detail

This commit is contained in:
masnn committed 2020-04-03 22:37:30 +08:00
1 parent 2e23d05a59
commit ffa193b5dd
43 files changed
+265 -242

No files matched your search

+1 -1
View File
@@ -34,7 +34,7 @@
<div class="media__left top">
{% if not mode_create %}
<div class="vote vote--discussion">
{% if handler.has_perm(vj4.model.builtin.PERM_VOTE_PROBLEM_SOLUTION) %}
{% if handler.has_perm(perm.PERM_VOTE_PROBLEM_SOLUTION) %}
<div class="vote-number rotator--enabled">{{ doc['vote'] }}</div>
<div class="vote-op clearfix">
<form method="post">
+2 -2
View File
@@ -2,7 +2,7 @@
{%- if not invalid %}
<a
{%- if tdoc is none %}
href="{{ reverse_url('problem_detail', domain_id=pdoc['domain_id'], pid=pdoc['_id']) }}"
href="/p/{{ pdoc.pid }}"
{%- elif tdoc['doc_type'] == vj4.model.document.TYPE_CONTEST %}
href="{{ reverse_url('contest_detail_problem', domain_id=pdoc['domain_id'], pid=pdoc['_id'], tid=tdoc['doc_id']) }}"
{%- elif tdoc['doc_type'] == vj4.model.document.TYPE_HOMEWORK %}
@@ -29,7 +29,7 @@
{%- if pdoc['tag']|length > 0 %}
<ul class="problem__tags">
{%- for tag in pdoc['tag'] %}
<li class="problem__tag"><a class="problem__tag-link" href="{{ reverse_url('problem_category', category=tag) }}">{{ tag }}</a></li>
<li class="problem__tag"><a class="problem__tag-link" href="/p?category={{ tag }}">{{ tag }}</a></li>
{%- endfor %}
</ul>
{%- else %}
+1 -1
View File
@@ -18,7 +18,7 @@
</a>
{% if badge %}
<a class="user-profile-badge v-center badge--lv{{ dudoc['level']|default(0) }}" href="{{ reverse_url('user_detail', uid=udoc['_id']|default(0)) }}" title="LV {{ dudoc['level']|default(0) }}: Top {{ vj4.model.builtin.LEVELS[dudoc['level']|default(0)]|default('N/A') }}%">LV {{ dudoc['level']|default(0) }}</a>
{% if modbadge and handler.dudoc_has_perm(udoc, dudoc, vj4.model.builtin.PERM_MOD_BADGE) %}
{% if modbadge and handler.dudoc_has_perm(udoc, dudoc, perm.PERM_MOD_BADGE) %}
<span class="user-profile-badge v-center badge--mod" title="Moderator">MOD</span>
{% endif %}
{% endif %}
+1 -1
View File
@@ -115,7 +115,7 @@
</div>
</div>
<div class="medium-3 columns">
{% if handler.has_perm(vj4.model.builtin.PERM_CREATE_CONTEST) %}
{% if handler.has_perm(perm.PERM_CREATE_CONTEST) %}
<div class="section side">
<div class="section__header">
<h1 class="section__title">
+11 -11
View File
@@ -29,7 +29,7 @@
</div>
</div>
<ul class="section__footer supplementary dot list">
{% if handler.own(ddoc, vj4.model.builtin.PERM_EDIT_DISCUSSION_SELF) or handler.has_perm(vj4.model.builtin.PERM_EDIT_DISCUSSION) %}
{% if handler.own(ddoc, perm.PERM_EDIT_DISCUSSION_SELF) or handler.has_perm(perm.PERM_EDIT_DISCUSSION) %}
<li>
<a href="{{ reverse_url('discussion_edit', did=ddoc['doc_id']) }}"><span class="icon icon-edit"></span> {{ _('Edit') }}</a>
</li>
@@ -63,16 +63,16 @@
udict = udict,
comment_ref = 'drid',
reply_ref = 'drrid',
comment_post_perm = vj4.model.builtin.PERM_REPLY_DISCUSSION,
comment_edit_perm = vj4.model.builtin.PERM_NONE if handler.own(ddoc, vj4.model.builtin.PERM_EDIT_DISCUSSION_REPLY_SELF_DISCUSSION) else vj4.model.builtin.PERM_EDIT_DISCUSSION_REPLY,
comment_edit_self_perm = vj4.model.builtin.PERM_EDIT_DISCUSSION_REPLY_SELF,
comment_delete_perm = vj4.model.builtin.PERM_NONE if handler.own(ddoc, vj4.model.builtin.PERM_DELETE_DISCUSSION_REPLY_SELF_DISCUSSION) else vj4.model.builtin.PERM_DELETE_DISCUSSION_REPLY,
comment_delete_self_perm = vj4.model.builtin.PERM_DELETE_DISCUSSION_REPLY_SELF,
reply_post_perm = vj4.model.builtin.PERM_REPLY_DISCUSSION,
reply_edit_perm = vj4.model.builtin.PERM_NONE if handler.own(ddoc, vj4.model.builtin.PERM_EDIT_DISCUSSION_REPLY_SELF_DISCUSSION) else vj4.model.builtin.PERM_EDIT_DISCUSSION_REPLY,
reply_edit_self_perm = vj4.model.builtin.PERM_EDIT_DISCUSSION_REPLY_SELF,
reply_delete_perm = vj4.model.builtin.PERM_NONE if handler.own(ddoc, vj4.model.builtin.PERM_DELETE_DISCUSSION_REPLY_SELF_DISCUSSION) else vj4.model.builtin.PERM_DELETE_DISCUSSION_REPLY,
reply_delete_self_perm = vj4.model.builtin.PERM_DELETE_DISCUSSION_REPLY_SELF
comment_post_perm = perm.PERM_REPLY_DISCUSSION,
comment_edit_perm = perm.PERM_NONE if handler.own(ddoc, perm.PERM_EDIT_DISCUSSION_REPLY_SELF_DISCUSSION) else perm.PERM_EDIT_DISCUSSION_REPLY,
comment_edit_self_perm = perm.PERM_EDIT_DISCUSSION_REPLY_SELF,
comment_delete_perm = perm.PERM_NONE if handler.own(ddoc, perm.PERM_DELETE_DISCUSSION_REPLY_SELF_DISCUSSION) else perm.PERM_DELETE_DISCUSSION_REPLY,
comment_delete_self_perm = perm.PERM_DELETE_DISCUSSION_REPLY_SELF,
reply_post_perm = perm.PERM_REPLY_DISCUSSION,
reply_edit_perm = perm.PERM_NONE if handler.own(ddoc, perm.PERM_EDIT_DISCUSSION_REPLY_SELF_DISCUSSION) else perm.PERM_EDIT_DISCUSSION_REPLY,
reply_edit_self_perm = perm.PERM_EDIT_DISCUSSION_REPLY_SELF,
reply_delete_perm = perm.PERM_NONE if handler.own(ddoc, perm.PERM_DELETE_DISCUSSION_REPLY_SELF_DISCUSSION) else perm.PERM_DELETE_DISCUSSION_REPLY,
reply_delete_self_perm = perm.PERM_DELETE_DISCUSSION_REPLY_SELF
) }}
{{ paginator.render(page, pcount) }}
{% if drcount == 0 %}
+1 -1
View File
@@ -11,7 +11,7 @@
<button name="operation" value="update" type="submit" class="rounded primary button">
{{ _('Update') }} (Ctrl+Enter)
</button>
{% if handler.own(ddoc, vj4.model.builtin.PERM_DELETE_DISCUSSION_SELF) or handler.has_perm(vj4.model.builtin.PERM_DELETE_DISCUSSION) %}
{% if handler.own(ddoc, perm.PERM_DELETE_DISCUSSION_SELF) or handler.has_perm(perm.PERM_DELETE_DISCUSSION) %}
<button name="operation" value="delete" type="submit" class="rounded button">
{{ _('Delete') }}
</button>
+1 -1
View File
@@ -23,7 +23,7 @@
</div>
<div class="section__body">
{% if vnode %}
{% if handler.has_perm(vj4.model.builtin.PERM_CREATE_DISCUSSION) %}
{% if handler.has_perm(perm.PERM_CREATE_DISCUSSION) %}
<p><a href="{{ reverse_url('discussion_create', doc_id=vnode['doc_id']) }}" class="expanded primary button">{{ _('Create a Discussion') }}</a></p>
{% else %}
{% if not handler.has_perm(perm.PERM_LOGGEDIN) %}
+2 -2
View File
@@ -13,7 +13,7 @@
</div>
<ol class="menu collapsed">
{{ sidemenu.render_item(null, 'domain_manage_dashboard') }}
{% if handler.has_perm(vj4.model.builtin.PERM_EDIT_DESCRIPTION) %}
{% if handler.has_perm(perm.PERM_EDIT_DESCRIPTION) %}
{{ sidemenu.render_item(null, 'domain_manage_edit') }}
{{ sidemenu.render_item(null, 'domain_manage_join_applications') }}
{{ sidemenu.render_item(null, 'domain_manage_discussion') }}
@@ -21,7 +21,7 @@
<!-- Ranking Settings -->
</ol>
</li>
{% if handler.has_perm(vj4.model.builtin.PERM_EDIT_PERM) %}
{% if handler.has_perm(perm.PERM_EDIT_PERM) %}
<li class="menu__item">
<div class="menu__link expandable">
<span class="icon icon-user"></span> {{ _('Access Control') }}
+1 -1
View File
@@ -164,7 +164,7 @@
{% endif %}
</div>
<div class="large-3 columns">
{% if handler.has_perm(vj4.model.builtin.PERM_VIEW_DISCUSSION) %}
{% if handler.has_perm(perm.PERM_VIEW_DISCUSSION) %}
{% include 'discussion_nodes_widget.html' %}
{% endif %}
{% if domain_id == vj4.model.builtin.DOMAIN_ID_SYSTEM %}
+1 -1
View File
@@ -21,7 +21,7 @@
{% endfor %}
</tr>
</thead>
{% for family, perms in vj4.model.builtin.PERMS_BY_FAMILY.items() %}
{% for family, perms in perm.PERMS_BY_FAMILY.items() %}
<tbody>
<tr>
<td class="col--family" colspan="{{ (roles|length)+1 }}">
+1
View File
@@ -1,4 +1,5 @@
{% set no_path_section = true %}
{% set page_name = "error" %}
{% extends "layout/basic.html" %}
{% block content %}
<div class="error__container clearfix">
+1 -1
View File
@@ -18,7 +18,7 @@
<option value="list">{{ _('List View') }}</option>
</select>
</span>
{% if handler.has_perm(vj4.model.builtin.PERM_CREATE_HOMEWORK) %}
{% if handler.has_perm(perm.PERM_CREATE_HOMEWORK) %}
<a class="compact button" href="{{ reverse_url('homework_create') }}">{{ _('Create Homework') }}</a>
{% endif %}
</div>
+2 -2
View File
@@ -28,8 +28,8 @@
<script>
var _htmlNode = document.documentElement;
_htmlNode.className = _htmlNode.className.replace(' nojs', ' hasjs');
var UiContext = {{ handler.ui_context|json|safe }};
var UserContext = {{ handler.user_context|json|safe }};
var UiContext = {{ handler.UIContext|json|safe }};
var UserContext = {{ handler.user|json|safe }};
</script>
</head>
<body>
+4 -4
View File
@@ -18,7 +18,7 @@
<div>
<ol class="menu">
{% if page_name == 'discussion_node' %}
{% if handler.has_perm(vj4.model.builtin.PERM_CREATE_DISCUSSION) %}
{% if handler.has_perm(perm.PERM_CREATE_DISCUSSION) %}
<li class="menu__item"><a class="menu__link highlight" href="{{ reverse_url('discussion_create_document_as_node', doc_type=tdoc['doc_type'], doc_id=tdoc['doc_id']) }}">
<span class="icon icon-add"></span> {{ _('Create a Discussion') }}
</a></li>
@@ -40,7 +40,7 @@
{% endif %}
{% if not attended and not handler.is_done(tdoc) %}
<li class="menu__item">
{% if handler.has_perm(vj4.model.builtin.PERM_ATTEND_CONTEST) and handler.has_perm(perm.PERM_LOGGEDIN) %}
{% if handler.has_perm(perm.PERM_ATTEND_CONTEST) and handler.has_perm(perm.PERM_LOGGEDIN) %}
<form action="{{ reverse_url('contest_detail', tid=tdoc['doc_id']) }}" method="POST">
<input type="hidden" name="operation" value="attend">
<input type="hidden" name="csrf_token" value="{{ handler.csrf_token }}">
@@ -68,12 +68,12 @@
<span class="icon icon-statistics"></span> {{ _('Scoreboard (Hidden)') }}
</a></li>
{% endif %}
{% if handler.own(tdoc, vj4.model.builtin.PERM_EDIT_CONTEST_SELF) or handler.has_perm(vj4.model.builtin.PERM_EDIT_CONTEST) %}
{% if handler.own(tdoc, perm.PERM_EDIT_CONTEST_SELF) or handler.has_perm(perm.PERM_EDIT_CONTEST) %}
<li class="menu__item"><a class="menu__link" href="{{ reverse_url('contest_edit', tid=tdoc['doc_id']) }}">
<span class="icon icon-edit"></span> {{ _('Edit Contest') }}
</a></li>
{% endif %}
{% if handler.has_perm(vj4.model.builtin.PERM_READ_RECORD_CODE) %}
{% if handler.has_perm(perm.PERM_READ_RECORD_CODE) %}
<li class="menu__item"><a class="menu__link" href="{{ reverse_url('contest_code', tid=tdoc['doc_id']) }}">
<span class="icon icon-download"></span> {{ _('Export All Code') }}
</a></li>
+1 -1
View File
@@ -1,5 +1,5 @@
{% import "components/form.html" as form with context %}
{% if ddoc['highlight'] or handler.has_perm(vj4.model.builtin.PERM_HIGHLIGHT_DISCUSSION) %}
{% if ddoc['highlight'] or handler.has_perm(perm.PERM_HIGHLIGHT_DISCUSSION) %}
{{ form.form_checkbox(label='Highlight', name='highlight', value=ddoc['highlight']|default(false)) }}
{% endif %}
{{ form.form_text(label='Title', name='title', value=ddoc['title']|default(''), autofocus=true, required=true) }}
+3 -3
View File
@@ -24,7 +24,7 @@
{% endif %}
{% if not attended and not handler.is_done(tdoc) %}
<li class="menu__item">
{% if handler.has_perm(vj4.model.builtin.PERM_ATTEND_HOMEWORK) and handler.has_perm(perm.PERM_LOGGEDIN) %}
{% if handler.has_perm(perm.PERM_ATTEND_HOMEWORK) and handler.has_perm(perm.PERM_LOGGEDIN) %}
<form action="{{ reverse_url('homework_detail', tid=tdoc['doc_id']) }}" method="POST">
<input type="hidden" name="operation" value="attend">
<input type="hidden" name="csrf_token" value="{{ handler.csrf_token }}">
@@ -52,12 +52,12 @@
<span class="icon icon-statistics"></span> {{ _('Scoreboard (Hidden)') }}
</a></li>
{% endif %}
{% if handler.own(tdoc, vj4.model.builtin.PERM_EDIT_HOMEWORK_SELF) or handler.has_perm(vj4.model.builtin.PERM_EDIT_HOMEWORK) %}
{% if handler.own(tdoc, perm.PERM_EDIT_HOMEWORK_SELF) or handler.has_perm(perm.PERM_EDIT_HOMEWORK) %}
<li class="menu__item"><a class="menu__link" href="{{ reverse_url('homework_edit', tid=tdoc['doc_id']) }}">
<span class="icon icon-edit"></span> {{ _('Edit Homework') }}
</a></li>
{% endif %}
{% if handler.has_perm(vj4.model.builtin.PERM_READ_RECORD_CODE) %}
{% if handler.has_perm(perm.PERM_READ_RECORD_CODE) %}
<li class="menu__item"><a class="menu__link" href="{{ reverse_url('homework_code', tid=tdoc['doc_id']) }}">
<span class="icon icon-download"></span> {{ _('Export All Code') }}
</a></li>
+4 -4
View File
@@ -2,13 +2,13 @@
<div class="dialog__content">
<div class="dialog--signin__bg">
<div class="dialog--signin__side">
<h1>{{ _('Don\'t have an account?') }}</h1>
<h1>{{ _("Don\'t have an account?") }}</h1>
<p>{{ _('By signing up a Vijos universal account, you can submit code and join discussions in all online judging services provided by us.') }}</p>
<div><a href="{{ reverse_url('user_register') }}" class="inverse rounded button">{{ _('Sign Up Now') }}</a></div>
<div><a href="/register" class="inverse rounded button">{{ _('Sign Up Now') }}</a></div>
</div>
</div>
<div class="dialog--signin__main">
<form action="{{ reverse_url('user_login') }}" method="post">
<form action="/login" method="post">
<div class="dialog--signin__close-container supplementary">
<a name="dialog--signin__close" href="javascript:;">{{ _('CLOSE') }}</a>
</div>
@@ -36,7 +36,7 @@
</div></div>
<div class="row"><div class="columns">
<div class="supplementary text-center">
<a href="{{ reverse_url('user_lostpass') }}">{{ _('Forgot password or username?') }}</a>
<a href="/lostpass">{{ _('Forgot password or username?') }}</a>
</div>
</div></div>
</form>
+19 -35
View File
@@ -1,6 +1,6 @@
{% macro nav_item(target_page_name, target_page_prefix) %}
{% macro nav_item(target_page_url, target_page_name, target_page_prefix) %}
<li class="nav__list-item">
<a href="{{ reverse_url(target_page_name) }}" class="nav__item{% if page_name.startsWith(target_page_prefix) %} nav--active{% endif %}">
<a href="{{ target_page_url }}" class="nav__item{% if page_name.startsWith(target_page_prefix) %} nav--active{% endif %}">
{{ _(target_page_name) }}
</a>
</li>
@@ -9,80 +9,64 @@
<nav class="nav slideout-menu" id="menu">
<div class="row"><div class="columns clearfix">
<ol class="nav__list nav__list--main clearfix">
<li class="nav__list-item"><a href="{{ reverse_url('domain_main', domain_id=vj4.model.builtin.DOMAIN_ID_SYSTEM) }}" class="nav__logo">&nbsp;</a></li>
{{ nav_item('domain_main', 'domain_main') }}
<li class="nav__list-item"><a href="/" class="nav__logo">&nbsp;</a></li>
{{ nav_item('/', 'domain_main', 'domain_main') }}
{% if handler.has_perm(perm.PERM_VIEW_PROBLEM) %}
{{ nav_item('problem_main', 'problem') }}
{{ nav_item('/p', 'problem_main', 'problem') }}
{% endif %}
{% if handler.has_perm(perm.PERM_VIEW_TRAINING) %}
{{ nav_item('training_main', 'training') }}
{{ nav_item('/t', 'training_main', 'training') }}
{% endif %}
{% if handler.has_perm(perm.PERM_VIEW_DISCUSSION) %}
{{ nav_item('discussion_main', 'discussion') }}
{{ nav_item('/d', 'discussion_main', 'discussion') }}
{% endif %}
{% if handler.has_perm(perm.PERM_VIEW_CONTEST) %}
{{ nav_item('contest_main', 'contest') }}
{{ nav_item('/c', 'contest_main', 'contest') }}
{% endif %}
{% if handler.has_perm(perm.PERM_VIEW_HOMEWORK) %}
{{ nav_item('homework_main', 'homework') }}
{{ nav_item('/h', 'homework_main', 'homework') }}
{% endif %}
{% if handler.has_perm(perm.PERM_EDIT_DESCRIPTION) or handler.has_perm(perm.PERM_EDIT_PERM) %}
{{ nav_item('domain_manage', 'domain_manage') }}
{{ nav_item('/d', 'domain_manage', 'domain_manage') }}
{% endif %}
</ol>
<ol class="nav__list nav__list--secondary clearfix">
{% if not handler.has_perm(perm.PERM_LOGGEDIN) %}
<li class="nav__list-item"><a href="{{ reverse_url('user_login') }}" class="nav__item" name="nav_login">{{ _('Login') }}</a></li>
<li class="nav__list-item"><a href="{{ reverse_url('user_register') }}" class="nav__item--round">{{ _('Sign Up') }}</a></li>
<li class="nav__list-item"><a href="/login" class="nav__item" name="nav_login">{{ _('Login') }}</a></li>
<li class="nav__list-item"><a href="/register" class="nav__item--round">{{ _('Sign Up') }}</a></li>
{% else %}
<li class="nav__list-item" data-dropdown-pos="bottom right" data-dropdown-target="#menu-nav-user" data-dropdown-trigger-desktop-only>
<a href="{{ reverse_url('user_detail', uid=handler.user['_id']) }}" class="nav__item">{{ handler.user.uname }} <span class="icon icon-expand_more nojs--hide"></span></a>
<a href="/user/{{ handler.user._id }}" class="nav__item">{{ handler.user.uname }} <span class="icon icon-expand_more nojs--hide"></span></a>
<ol class="dropdown-target menu" id="menu-nav-user">
<li class="menu__item">
<a href="{{ reverse_url('user_detail', uid=handler.user['_id']) }}" class="menu__link">
<a href="/user/{{ handler.user._id }}" class="menu__link">
<span class="icon icon-account--circle"></span> {{ _('My Profile') }}
</a>
</li>
<li class="menu__item">
<a href="{{ reverse_url('home_messages') }}" class="menu__link">
<a href="/home/messages" class="menu__link">
<span class="icon icon-comment--multiple"></span> {{ _('home_messages') }}
</a>
</li>
<li class="menu__seperator"></li>
<li class="menu__item">
<a href="{{ reverse_url('home_account') }}" class="menu__link">
<a href="/home/account" class="menu__link">
<span class="icon icon-wrench"></span> {{ _('home_account') }}
</a>
</li>
<li class="menu__item">
<a href="{{ reverse_url('home_domain_account') }}" class="menu__link">
<span class="icon icon-web"></span> @ {{ handler.domain['name'] }}
</a>
</li>
<li class="menu__item">
<a href="{{ reverse_url('home_preference') }}" class="menu__link">
<a href="/home/preference" class="menu__link">
<span class="icon icon-sliders"></span> {{ _('home_preference') }}
</a>
</li>
<li class="menu__item">
<a href="{{ reverse_url('home_security') }}" class="menu__link">
<a href="/home/security" class="menu__link">
<span class="icon icon-security"></span> {{ _('home_security') }}
</a>
</li>
<li class="menu__seperator"></li>
<li class="menu__item">
<a href="{{ reverse_url('home_file') }}" class="menu__link">
<span class="icon icon-file"></span> {{ _('My Files') }}
</a>
</li>
<li class="menu__item">
<a href="{{ reverse_url('home_domain') }}" class="menu__link">
<span class="icon icon-web"></span> {{ _('My Domains') }}
</a>
</li>
<li class="menu__seperator"></li>
<li class="menu__item">
<a href="{{ reverse_url('user_logout') }}" class="menu__link" name="nav_logout">
<a href="/logout" class="menu__link" name="nav_logout">
<span class="icon icon-logout"></span> {{ _('Logout') }}
</a>
</li>
+6 -6
View File
@@ -1,14 +1,14 @@
{% if tdoc %}
{% if tdoc['doc_type'] == vj4.model.document.TYPE_CONTEST %}
{% include "partials/problem_sidebar_contest.html" %}
{% with owner_udoc=udoc, owner_dudoc=dudoc %}
{% include "partials/contest_sidebar.html" %}
{% endwith %}
{% set owner_udoc=udoc %}
{% set owner_dudoc=dudoc %}
{% include "partials/contest_sidebar.html" %}
{% else %}
{% include "partials/problem_sidebar_homework.html" %}
{% with owner_udoc=udoc, owner_dudoc=dudoc %}
{% include "partials/homework_sidebar.html" %}
{% endwith %}
{% set owner_udoc=udoc %}
{% set owner_dudoc=dudoc %}
{% include "partials/homework_sidebar.html" %}
{% endif %}
{% else %}
{% include "partials/problem_sidebar_normal.html" %}
@@ -24,11 +24,11 @@
<span class="icon icon-send"></span> {{ _('Submit') }}
</a></li>
{% elif handler.is_done(tdoc) %}
<li class="menu__item scratchpad--hide"><a class="menu__link" href="{{ reverse_url('problem_detail', pid=pdoc['_id']) }}">
<li class="menu__item scratchpad--hide"><a class="menu__link" href="/p/{{ pdoc.pid }}">
<span class="icon icon-send"></span> {{ _('Open in Problem Set') }}
</a></li>
{% endif %}
{% if handler.own(pdoc, vj4.model.builtin.PERM_EDIT_PROBLEM_SELF) or handler.has_perm(vj4.model.builtin.PERM_EDIT_PROBLEM) %}
{% if handler.own(pdoc, perm.PERM_EDIT_PROBLEM_SELF) or handler.has_perm(perm.PERM_EDIT_PROBLEM) %}
<li class="menu__seperator"></li>
<li class="menu__item"><a class="menu__link{% if page_name == 'problem_edit' %} active{% endif %}" href="{{ reverse_url('problem_edit', pid=pdoc['_id']) }}">
<span class="icon icon-edit"></span> {{ _('Edit') }}
@@ -24,11 +24,11 @@
<span class="icon icon-send"></span> {{ _('Submit') }}
</a></li>
{% elif handler.is_done(tdoc) %}
<li class="menu__item scratchpad--hide"><a class="menu__link" href="{{ reverse_url('problem_detail', pid=pdoc['_id']) }}">
<li class="menu__item scratchpad--hide"><a class="menu__link" href="/p/{{ pdoc.pid }}">
<span class="icon icon-send"></span> {{ _('Open in Problem Set') }}
</a></li>
{% endif %}
{% if handler.own(pdoc, vj4.model.builtin.PERM_EDIT_PROBLEM_SELF) or handler.has_perm(vj4.model.builtin.PERM_EDIT_PROBLEM) %}
{% if handler.own(pdoc, perm.PERM_EDIT_PROBLEM_SELF) or handler.has_perm(perm.PERM_EDIT_PROBLEM) %}
<li class="menu__seperator"></li>
<li class="menu__item"><a class="menu__link{% if page_name == 'problem_edit' %} active{% endif %}" href="{{ reverse_url('problem_edit', pid=pdoc['_id']) }}">
<span class="icon icon-edit"></span> {{ _('Edit') }}
@@ -9,7 +9,7 @@
<div>
<ol class="menu">
{% if page_name == 'discussion_node' or page_name == 'discussion_detail' %}
{% if handler.has_perm(vj4.model.builtin.PERM_CREATE_DISCUSSION) %}
{% if handler.has_perm(perm.PERM_CREATE_DISCUSSION) %}
<li class="menu__item"><a class="menu__link highlight" href="{{ reverse_url('discussion_create_document_as_node', doc_type=pdoc['doc_type'], doc_id=pdoc['_id']) }}">
<span class="icon icon-add"></span> {{ _('Create a Discussion') }}
</a></li>
@@ -25,7 +25,7 @@
<li class="menu__seperator"></li>
{% endif %}
{% if page_name == 'problem_detail' %}
{% if handler.has_perm(vj4.model.builtin.PERM_SUBMIT_PROBLEM) %}
{% if handler.has_perm(perm.PERM_SUBMIT_PROBLEM) %}
<li class="menu__item scratchpad--hide"><a class="menu__link highlight" name="problem-sidebar__open-scratchpad" href="javascript:;" data-global-hotkey="alt+e">
<span class="icon icon-enlarge"></span> {{ _('Open Scratchpad') }} (Alt+E)
</a></li>
@@ -34,11 +34,11 @@
</a></li>
{% endif %}
{% else %}
<li class="menu__item"><a class="menu__link" href="{{ reverse_url('problem_detail', pid=pdoc['_id']) }}">
<li class="menu__item"><a class="menu__link" href="/p/{{ pdoc.pid }}">
<span class="icon icon-flag"></span> {{ _('View Problem') }}
</a></li>
{% endif %}
{% if handler.has_perm(vj4.model.builtin.PERM_SUBMIT_PROBLEM) %}
{% if handler.has_perm(perm.PERM_SUBMIT_PROBLEM) %}
<li class="menu__item scratchpad--hide"><a class="menu__link{% if page_name == 'problem_submit' %} active{% endif %}" href="{{ reverse_url('problem_submit', pid=pdoc['_id']) }}">
<span class="icon icon-send"></span> {{ _('Submit') }}
</a></li>
@@ -51,15 +51,15 @@
<span class="icon icon-send"></span> {{ _('No Permission to Submit') }}
</a></li>
{% endif %}
{% if handler.has_perm(vj4.model.builtin.PERM_VIEW_DISCUSSION) or handler.has_perm(vj4.model.builtin.PERM_VIEW_PROBLEM_SOLUTION) %}
{% if handler.has_perm(perm.PERM_VIEW_DISCUSSION) or handler.has_perm(perm.PERM_VIEW_PROBLEM_SOLUTION) %}
<li class="menu__seperator"></li>
{% endif %}
{% if handler.has_perm(vj4.model.builtin.PERM_VIEW_DISCUSSION) %}
{% if handler.has_perm(perm.PERM_VIEW_DISCUSSION) %}
<li class="menu__item"><a class="menu__link{% if page_name == 'discussion_node' or page_name == 'discussion_detail' %} active{% endif %}" href="{{ reverse_url('discussion_node_document_as_node', doc_type=pdoc['doc_type'], doc_id=pdoc['_id']) }}">
<span class="icon icon-comment--text"></span> {{ _('Discussions') }}
</a></li>
{% endif %}
{% if handler.has_perm(vj4.model.builtin.PERM_VIEW_PROBLEM_SOLUTION) %}
{% if handler.has_perm(perm.PERM_VIEW_PROBLEM_SOLUTION) %}
<li class="menu__item"><a class="menu__link{% if page_name == 'problem_solution' %} active{% endif %}" href="{{ reverse_url('problem_solution', pid=pdoc['_id']) }}">
<span class="icon icon-comment--text"></span> {{ _('Solutions') }}
</a></li>
@@ -70,7 +70,7 @@
<span class="icon icon-copy"></span> {{ _('Copy Problem') }}
</a></li>
{% endif %}
{% if handler.own(pdoc, vj4.model.builtin.PERM_EDIT_PROBLEM_SELF) or handler.has_perm(vj4.model.builtin.PERM_EDIT_PROBLEM) %}
{% if handler.user._id == pdoc.owner or handler.has_perm(perm.PERM_EDIT_PROBLEM) %}
<li class="menu__seperator"></li>
<li class="menu__item"><a class="menu__link{% if page_name == 'problem_edit' %} active{% endif %}" href="{{ reverse_url('problem_edit', pid=pdoc['_id']) }}">
<span class="icon icon-edit"></span> {{ _('Edit') }}
+14 -53
View File
@@ -1,43 +1,15 @@
{% set page_name = "problem_detail" %}
{% extends "layout/basic.html" %}
{% block content %}
<div style="display: none" class="dialog__body--copy-to">
<div>
<div class="row"><div class="columns">
<h1>{{ _('Copy Problem To') }}</h1>
</div></div>
<div class="row">
<div class="medium-12 columns">
<label>
{{ _('Destination Domain') }}
<input name="domain_id" placeholder="{{ _('Domain ID') }}" type="text" class="textbox" autocomplete="off" data-autofocus>
</label>
</div>
</div>
<div class="row">
<div class="medium-12 columns">
<label>
<label class="checkbox">
<input type="checkbox" name="numeric_pid" checked>{{ _('Numeric PID') }}
</label>
<label class="checkbox">
<input type="checkbox" name="hidden">{{ _('Hidden') }}
</label>
</label>
</div>
</div>
</div>
</div>
<script>
var Context = {{ {
'problemId': pdoc['_id'],
'socketUrl': '{}-conn'.format(reverse_url('problem_pretest', pid=pdoc['_id'])),
'postPretestUrl': reverse_url('problem_pretest', pid=pdoc['_id']),
'postSubmitUrl': reverse_url('problem_submit', pid=pdoc['_id']) if not tdoc else reverse_url('contest_detail_problem_submit' if tdoc['doc_type'] == vj4.model.document.TYPE_CONTEST else 'homework_detail_problem_submit', tid=tdoc['doc_id'], pid=pdoc['_id']),
'getSubmissionsUrl': reverse_url('problem_submit', pid=pdoc['_id']) if not tdoc else reverse_url('contest_detail_problem_submit' if tdoc['doc_type'] == vj4.model.document.TYPE_CONTEST else 'homework_detail_problem_submit', tid=tdoc['doc_id'], pid=pdoc['_id']),
'getRecordDetailUrl': reverse_url('record_detail', rid='{rid}'),
'code_lang': handler.get_setting('code_lang'),
'code_template': handler.get_code_template(),
}|json|safe }};
var Context = {
'problemId': "{{ pdoc.pid }}",
'postSubmitUrl': "/p/{{ pdoc.pid }}",
'getSubmissionsUrl': "/p/{{ pdoc.pid }}",
'getRecordDetailUrl': "/r/{{ rid }}",
'code_lang': "{{ handler.user.codeLang }}",
'code_template': "{{ handler.user.codeTemplate }}",
};
</script>
<div class="row">
<div class="medium-9 columns">
@@ -51,10 +23,9 @@
<blockquote class="warn">
<p>{{ _('No dataset at present.') }}</p>
</blockquote>
{% endif %}
{% if pdoc['data'] is mapping %}
{% elif pdoc.data.startsWith('from:') %}
<blockquote class="note">
<p>{{ _('Test data comes from') }} <a href="{{ reverse_url('problem_detail', domain_id=pdoc['data']['domain'], pid=pdoc['data']['pid']) }}" target="_blank">{{ pdoc['data']['domain'] }}/{{ pdoc['data']['pid'] }}</a></p>
<p>{{ _('Test data comes from') }} <a href="#" target="_blank">{{ pdoc.data.split(':')[1] }}</a></p>
</blockquote>
{% endif %}
{% if tdoc %}
@@ -64,27 +35,17 @@
<p>{{ _('You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.') }}</p>
</blockquote>
{% endif %}{# handler.is_done(tdoc) #}
{% else %}{# tdoc['doc_type'] == vj4.model.document.TYPE_CONTEST #}
{% if handler.is_homework_extended(tdoc) %}
<blockquote class="note">
<p>{{ _('The homework\'s deadline is due but in extension. You can still submit for this problem but your score will be penalized.') }}</p>
</blockquote>
{% elif handler.is_done(tdoc) %}{# handler.is_homework_extended(tdoc) #}
<blockquote class="note">
<p>{{ _('You cannot submit for this problem because the homework\'s deadline is due.') }}</p>
</blockquote>
{% endif %}{# handler.is_homework_extended(tdoc) #}
{% endif %}{# tdoc['doc_type'] == vj4.model.document.TYPE_CONTEST #}
{% endif %}{# tdoc #}
{{ pdoc['content']|markdown }}
{{ pdoc['content']|markdown|safe }}
</div>
</div></div>
</div>
</div>
<div class="medium-3 columns">
{% with owner_udoc=udoc, owner_dudoc=dudoc %}
{% set owner_udoc=udoc %}
{% set owner_dudoc=dudoc %}
{% include "partials/problem_sidebar.html" %}
{% endwith %}
</div>
</div>
<div class="scratchpad-container" style="display:none">
+7 -8
View File
@@ -28,13 +28,13 @@
{% for sub_categories in category %}
<li class="group-list__item">
<h2 class="section__title">
<a href="{{ reverse_url('problem_category', category=category|urlencode) }}">{{ category }}</a>
<a href="/p?category={{ category|urlencode }}">{{ category }}</a>
</h2>
{% if sub_categories | length > 0 %}
<ol class="chip-list">
{% for sub_category in sub_categories %}
<li class="chip-list__item">
<a class="typo-a" href="{{ reverse_url('problem_category', category=(category|urlencode + ',' + sub_category|urlencode)) }}">{{ sub_category }}</a>
<a class="typo-a" href="/p?category={{ category|urlencode + ',' + sub_category|urlencode }}">{{ sub_category }}</a>
</li>
{% endfor %}
</ol>
@@ -52,9 +52,8 @@
<div class="section__header">
<h1 class="section__title">{{ _('Search') }}</h1>
</div>
<form method="get" action="{{ reverse_url('problem_search') }}">
<form method="get" action="/problem/search">
<div class="section__body">
<!-- TODO: replace with form_builder -->
<label>
<input name="q" type="text" class="textbox" value="" placeholder="1001">
</label>
@@ -62,21 +61,21 @@
</div>
</form>
</div>
{% if handler.has_perm(vj4.model.builtin.PERM_CREATE_PROBLEM) %}
{% if handler.has_perm(perm.PERM_CREATE_PROBLEM) %}
<div class="section side">
<div class="section__header">
<h1 class="section__title">{{ _('Create Problem') }}</h1>
</div>
<ol class="menu">
<li class="menu__item">
<a href="{{ reverse_url('problem_create') }}" class="menu__link">
<a href="/problem/create" class="menu__link">
<span class="icon icon-add"></span>
{{ _('Create Problem') }}</a>
</li>
<li class="menu__item">
<a href="{{ reverse_url('problem_copy') }}" class="menu__link">
<a href="/problem/import" class="menu__link">
<span class="icon icon-copy"></span>
{{ _('Copy Problem') }}</a>
{{ _('Import Problem') }}</a>
</li>
</ol>
<div class="section__body">
+1 -1
View File
@@ -9,7 +9,7 @@
<div class="section__body">
<iframe src="{{ reverse_url('problem_upload', pid=pdoc['_id']) }}" frameborder="0" style="width: 100%; height: 100px;"></iframe>
<p class="help-text">{{ _('Hint') }}: <a href="{{ reverse_url('wiki_help') }}#upload">{{ _('Dataset Format') }}</a>, {{ _('An example of dataset') }}: <a href="https://github.com/vijos/jd4/blob/master/jd4/testdata/aplusb-legacy.zip?raw=true">{{ _('Download') }}</a></p>
{% if pdoc and (handler.own(pdoc, vj4.model.builtin.PERM_READ_PROBLEM_DATA_SELF) or handler.has_perm(vj4.model.builtin.PERM_READ_PROBLEM_DATA) or handler.has_priv(vj4.model.builtin.PRIV_READ_PROBLEM_DATA)) %}
{% if pdoc and (handler.own(pdoc, perm.PERM_READ_PROBLEM_DATA_SELF) or handler.has_perm(perm.PERM_READ_PROBLEM_DATA) or handler.has_priv(vj4.model.builtin.PRIV_READ_PROBLEM_DATA)) %}
<p><a href="{{ reverse_url('problem_data', pid=pdoc['_id']) }}" class="expanded button">{{ _('Download Dataset') }}</a></p>
{% endif %}
</div>
+10 -10
View File
@@ -22,16 +22,16 @@
reply_edit_op = 'edit_reply',
comment_delete_op = 'delete_solution',
reply_delete_op = 'delete_reply',
comment_post_perm = vj4.model.builtin.PERM_CREATE_PROBLEM_SOLUTION,
comment_edit_perm = vj4.model.builtin.PERM_EDIT_PROBLEM_SOLUTION,
comment_edit_self_perm = vj4.model.builtin.PERM_EDIT_PROBLEM_SOLUTION_SELF,
comment_delete_perm = vj4.model.builtin.PERM_DELETE_PROBLEM_SOLUTION,
comment_delete_self_perm = vj4.model.builtin.PERM_DELETE_PROBLEM_SOLUTION_SELF,
reply_post_perm = vj4.model.builtin.PERM_REPLY_PROBLEM_SOLUTION,
reply_edit_perm = vj4.model.builtin.PERM_EDIT_PROBLEM_SOLUTION_REPLY,
reply_edit_self_perm = vj4.model.builtin.PERM_EDIT_PROBLEM_SOLUTION_REPLY_SELF,
reply_delete_perm = vj4.model.builtin.PERM_DELETE_PROBLEM_SOLUTION_REPLY,
reply_delete_self_perm = vj4.model.builtin.PERM_DELETE_PROBLEM_SOLUTION_REPLY_SELF
comment_post_perm = perm.PERM_CREATE_PROBLEM_SOLUTION,
comment_edit_perm = perm.PERM_EDIT_PROBLEM_SOLUTION,
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_EDIT_PROBLEM_SOLUTION_REPLY,
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
) }}
{{ paginator.render(page, pcount) }}
{% if drcount == 0 %}
+2 -2
View File
@@ -27,7 +27,7 @@
<div class="section__header">
<h1 class="section__title">{{ _('Information') }}</h1>
</div>
{% if handler.has_perm(vj4.model.builtin.PERM_REJUDGE) %}
{% if handler.has_perm(perm.PERM_REJUDGE) %}
<div class="section__body no-padding">
<ol class="menu">
<li class="menu__item">
@@ -79,7 +79,7 @@
{% if rdoc['type'] == vj4.constant.record.TYPE_PRETEST and (handler.own(rdoc, priv=vj4.model.builtin.PRIV_READ_PRETEST_DATA_SELF, field='uid') or handler.has_priv(vj4.model.builtin.PRIV_READ_PRETEST_DATA)) %}
<dt>{{ _('Pretest Data') }}</dt>
<dd><a href="{{ reverse_url('record_pretest_data', rid=rdoc['_id']) }}"><span class="icon icon-download"></span> {{ _('Download') }}</a></dd>
{% elif rdoc['type'] == vj4.constant.record.TYPE_SUBMISSION and pdoc and (handler.own(pdoc, vj4.model.builtin.PERM_READ_PROBLEM_DATA_SELF) or handler.has_perm(vj4.model.builtin.PERM_READ_PROBLEM_DATA) or handler.has_priv(vj4.model.builtin.PRIV_READ_PROBLEM_DATA)) %}
{% elif rdoc['type'] == vj4.constant.record.TYPE_SUBMISSION and pdoc and (handler.own(pdoc, perm.PERM_READ_PROBLEM_DATA_SELF) or handler.has_perm(perm.PERM_READ_PROBLEM_DATA) or handler.has_priv(vj4.model.builtin.PRIV_READ_PROBLEM_DATA)) %}
<dt>{{ _('Problem Data') }}</dt>
<dd><a href="{{ reverse_url('problem_data', pid=pdoc['_id']) }}"><span class="icon icon-download"></span> {{ _('Download') }}</a></dd>
{% endif %}
+2 -2
View File
@@ -3,7 +3,7 @@
<tr data-rid="{{ rdoc['_id'] }}">
{{ record.render_status_td(rdoc) }}
<td class="col--problem col--problem-name">
{% if (rdoc['domain_id'] == handler.domain_id and handler.has_perm(vj4.model.builtin.PERM_REJUDGE)) or handler.has_priv(vj4.model.builtin.PRIV_REJUDGE) %}
{% if (rdoc['domain_id'] == handler.domain_id and handler.has_perm(perm.PERM_REJUDGE)) or handler.has_priv(vj4.model.builtin.PRIV_REJUDGE) %}
<form class="form--inline" method="post" action="{{ reverse_url('record_rejudge', rid=rdoc['_id']) }}">
<input type="hidden" name="csrf_token" value="{{ handler.csrf_token }}">
<button type="submit" class="link text-maroon lighter">
@@ -15,7 +15,7 @@
{% if rdoc['type'] == vj4.constant.record.TYPE_PRETEST %}
({{ _('Pretest') }})
{% endif %}
{% if pdoc and (not pdoc['hidden'] or (pdoc['domain_id'] == handler.domain_id and handler.has_perm(vj4.model.builtin.PERM_VIEW_PROBLEM_HIDDEN))) %}
{% if pdoc and (not pdoc['hidden'] or (pdoc['domain_id'] == handler.domain_id and handler.has_perm(perm.PERM_VIEW_PROBLEM_HIDDEN))) %}
{{ problem.render_problem_title(pdoc, show_tags=false) }}
{% else %}
*
+1 -1
View File
@@ -175,7 +175,7 @@
</form>
</li>
{% endif %}
{% if handler.own(tdoc, vj4.model.builtin.PERM_EDIT_TRAINING_SELF) or handler.has_perm(vj4.model.builtin.PERM_EDIT_TRAINING) %}
{% if handler.own(tdoc, perm.PERM_EDIT_TRAINING_SELF) or handler.has_perm(perm.PERM_EDIT_TRAINING) %}
<li class="menu__item"><a class="menu__link" href="{{ reverse_url('training_edit', tid=tdoc['doc_id']) }}">
<span class="icon icon-edit"></span> {{ _('Edit') }}
</a></li>
+1 -1
View File
@@ -76,7 +76,7 @@
</div>
</div>
{% endif %}
{% if handler.has_perm(vj4.model.builtin.PERM_CREATE_TRAINING) %}
{% if handler.has_perm(perm.PERM_CREATE_TRAINING) %}
<div class="section side">
<div class="section__header">
<h1 class="section__title">{{ _('Create Training Plan') }}</h1>
+2 -2
View File
@@ -66,7 +66,7 @@
{{ vj4.constant.model.USER_GENDER_ICONS[handler.get_udoc_setting(udoc, 'gender')] }}
</span>
{% endif %}
{% if handler.dudoc_has_perm(udoc, dudoc, vj4.model.builtin.PERM_MOD_BADGE) %}
{% if handler.dudoc_has_perm(udoc, dudoc, perm.PERM_MOD_BADGE) %}
<span
class="profile-header__contact-item user-profile-badge badge--mod"
data-tooltip="{{ _('{} is a moderator of this domain.').format(_('She' if handler.get_udoc_setting(udoc, 'gender') == 1 else 'He')) }}"
@@ -111,7 +111,7 @@
</div>
<div class="section__body">
{% for pdoc in pdocs %}
<p><a href="{{ reverse_url('problem_detail', pid=pdoc['_id']) }}">{{ pdoc['title'] }}</a></p>
<p><a href="/p/{{ pdoc.pid }}">{{ pdoc['title'] }}</a></p>
{% endfor %}
</div>
{% endif %}{# if pdocs #}
+1 -1
View File
@@ -28,7 +28,7 @@
</div></div>
<div class="row"><div class="columns">
<div class="text-center supplementary inverse">
<a href="{{ reverse_url('user_lostpass') }}">{{ _('Forgot password or username?') }}</a>
<a href="/lostpass">{{ _('Forgot password or username?') }}</a>
</div>
</div></div>
</form>
+1 -1
View File
@@ -192,7 +192,7 @@
<div class="section__body typo">
{{ _('no_translation_warn')|safe }}
<p>如果您无法登录,请仔细想想,是不是用户名记错了。比如,自己原本想要注册的用户名已经被注册,所以使用了一个带有前和/或后缀的用户名。</p>
<p>如果您确信您的账号被盗或者忘记了账号和/或密码,请及时<a href="{{ reverse_url('user_lostpass') }}">{{ _('Reset Password or Find Username') }}</a>。</p>
<p>如果您确信您的账号被盗或者忘记了账号和/或密码,请及时<a href="/lostpass">{{ _('Reset Password or Find Username') }}</a>。</p>
</div>
</div>
{% endblock %}