You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
179 lines
8.1 KiB
HTML
179 lines
8.1 KiB
HTML
{% import "components/user.html" as user with context %}
|
|
{% import "components/problem.html" as problem with context %}
|
|
<div class="section side section--problem-sidebar">
|
|
{% if page_name != 'problem_detail' and page_name != 'contest_detail_problem' %}
|
|
<div class="section__header">
|
|
<h1 class="section__title">{{ pdoc['title'] }}</h1>
|
|
</div>
|
|
{% endif %}
|
|
<div>
|
|
<ol class="menu">
|
|
{% if page_name == 'discussion_node' or page_name == 'discussion_detail' %}
|
|
{% if handler.hasPerm(perm.PERM_CREATE_DISCUSSION) %}
|
|
<li class="menu__item"><a class="menu__link highlight" href="/discuss/problem/{{ pdoc._id }}/create">
|
|
<span class="icon icon-add"></span> {{ _('Create a Discussion') }}
|
|
</a></li>
|
|
{% else %}
|
|
{% if not handler.hasPerm(perm.PERM_LOGGEDIN) %}
|
|
<li class="menu__item"><a class="menu__link" href="javascript:showSignInDialog();">
|
|
<span class="icon icon-add"></span> {{ _('Login to Create a Discussion') }}</a></li>
|
|
{% else %}
|
|
<li class="menu__item"><a class="menu__link disabled" href="javascript:;">
|
|
<span class="icon icon-add"></span> {{ _('No Permission to Create a Discussion') }}</a></li>
|
|
{% endif %}
|
|
{% endif %}
|
|
<li class="menu__seperator"></li>
|
|
{% endif %}
|
|
{% if page_name == 'problem_detail' %}
|
|
{% if handler.hasPerm(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>
|
|
<li class="menu__item non-scratchpad--hide"><a class="menu__link" name="problem-sidebar__quit-scratchpad" href="javascript:;" data-global-hotkey="alt+q">
|
|
<span class="icon icon-enlarge"></span> {{ _('Quit Scratchpad') }} (Alt+Q)
|
|
</a></li>
|
|
{% endif %}
|
|
{% else %}
|
|
<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.hasPerm(perm.PERM_SUBMIT_PROBLEM) %}
|
|
<li class="menu__item scratchpad--hide"><a class="menu__link{% if page_name == 'problem_submit' %} active{% endif %}" href="/p/{{ pdoc.pid }}/submit">
|
|
<span class="icon icon-send"></span> {{ _('Submit') }}
|
|
</a></li>
|
|
{% elif not handler.hasPerm(perm.PERM_LOGGEDIN) %}
|
|
<li class="menu__item scratchpad--hide"><a class="menu__link{% if page_name == 'problem_submit' %} active{% endif %}" href="javascript:showSignInDialog();">
|
|
<span class="icon icon-send"></span> {{ _('Login to Submit') }}
|
|
</a></li>
|
|
{% else %}
|
|
<li class="menu__item scratchpad--hide"><a class="menu__link disabled{% if page_name == 'problem_submit' %} active{% endif %}" href="javascript:;">
|
|
<span class="icon icon-send"></span> {{ _('No Permission to Submit') }}
|
|
</a></li>
|
|
{% endif %}
|
|
{% if handler.hasPerm(perm.PERM_VIEW_DISCUSSION) or handler.hasPerm(perm.PERM_VIEW_PROBLEM_SOLUTION) %}
|
|
<li class="menu__seperator"></li>
|
|
{% endif %}
|
|
{% if handler.hasPerm(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="/discuss/problem/{{ pdoc._id }}">
|
|
<span class="icon icon-comment--text"></span> {{ _('Discussions') }}
|
|
</a></li>
|
|
{% endif %}
|
|
{% if handler.hasPerm(perm.PERM_VIEW_PROBLEM_SOLUTION) %}
|
|
<li class="menu__item"><a class="menu__link{% if page_name == 'problem_solution' %} active{% endif %}" href="/p/{{ pdoc.pid }}/solution">
|
|
<span class="icon icon-comment--text"></span> {{ _('Solutions') }}
|
|
</a></li>
|
|
{% endif %}
|
|
{% if page_name == 'problem_detail' and handler.hasPerm(perm.PERM_LOGGEDIN) %}
|
|
<li class="menu__seperator"></li>
|
|
<li class="menu__item"><a class="menu__link" name="problem-sidebar__copy-to" href="javascript:;">
|
|
<span class="icon icon-copy"></span> {{ _('Copy Problem') }}
|
|
</a></li>
|
|
{% endif %}
|
|
{% if user._id == pdoc.owner or handler.hasPerm(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="/p/{{ pdoc.pid }}/edit">
|
|
<span class="icon icon-edit"></span> {{ _('Edit') }}
|
|
</a></li>
|
|
<li class="menu__item"><a class="menu__link{% if page_name == 'problem_settings' %} active{% endif %}" href="/p/{{ pdoc.pid }}/settings">
|
|
<span class="icon icon-wrench"></span> {{ _('Settings') }}
|
|
</a></li>
|
|
{% endif %}
|
|
</ol>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="section side">
|
|
<div class="section__header">
|
|
<h1 class="section__title">{{ _('Information') }}</h1>
|
|
</div>
|
|
<div class="section__body typo">
|
|
<dl class="large horizontal">
|
|
<dt>{{ _('ID') }}</dt>
|
|
<dd>{{ pdoc['pid'] }}</dd>
|
|
{% if page_name != 'discussion_node' and page_name != 'discussion_detail' %}
|
|
{% if handler.hasPerm(perm.PERM_LOGGEDIN) %}
|
|
<dt>{{ _('Submission') }}</dt>
|
|
<dd>
|
|
{% if pdoc.psdoc['status'] %}
|
|
<span class="icon record-status--icon {{ model.builtin.STATUS_CODES[pdoc['psdoc']['status']] }}"></span>
|
|
<a href="/r/{{ pdoc['psdoc']['rid'] }}" class="record-status--text {{ model.builtin.STATUS_CODES[pdoc['psdoc']['status']] }}">
|
|
{{ model.builtin.STATUS_TEXTS[pdoc['psdoc']['status']] }}
|
|
</a>
|
|
{% else %}
|
|
{{ _('(None)') }}
|
|
{% endif %}
|
|
</dd>
|
|
{% endif %}
|
|
{% endif %}
|
|
<dt>{{ _('Difficulty') }}</dt>
|
|
<dd>{{ pdoc['difficulty'] or _('(None)') }}</dd>
|
|
<dt>{{ _('Category') }}</dt>
|
|
<dd>
|
|
{% if pdoc['category'] %}
|
|
<span class="hasjs--hide" name="problem-sidebar__categories">
|
|
{% for category in pdoc['category'] %}
|
|
<a href="/p?category={{ category }}">{{ category }}</a>
|
|
{% if loop.index < pdoc['category']|length %}
|
|
{% if category in vj4.model.builtin.PROBLEM_CATEGORIES %}
|
|
{{ _('problem-category-delim') }}
|
|
{% else %}
|
|
{{ _('problem-subcategory-delim') }}
|
|
{% endif %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
</span>
|
|
<span class="nojs--hide">
|
|
<a href="javascript:;" name="problem-sidebar__show-category">{{ _('page.problem_detail.sidebar.show_category') }}</a>
|
|
</span>
|
|
{% else %}
|
|
{{ _('(None)') }}
|
|
{% endif %}
|
|
</dd>
|
|
<dt>{{ _('Tags') }}</dt>
|
|
<dd>
|
|
{{ problem.render_problem_tags(pdoc, true) }}
|
|
</dd>
|
|
<dt>{{ _('# Submissions') }}</dt>
|
|
<dd><a href="/r?pid={{ pdoc['_id'] }}">{{ pdoc.nSubmit }}</a></dd>
|
|
{% if page_name != 'discussion_node' and page_name != 'discussion_detail' %}
|
|
{% if handler.hasPerm(perm.PERM_LOGGEDIN) %}
|
|
<dt>{{ _('# My Submissions') }}</dt>
|
|
<dd><a href="/r?pid={{ pdoc['_id'] }}&uid_or_name={{ handler.user['_id'] }}">{{ pdoc['psdoc'].nSubmit|default(0) }}</a></dd>
|
|
{% endif %}
|
|
{% endif %}
|
|
<dt>{{ _('Accepted') }}</dt>
|
|
<dd>{{ pdoc.nAccept }}</dd>
|
|
<dt>{{ _('Accepted Ratio') }}</dt>
|
|
<dd>{% if pdoc.nSubmit > 0 %}{{ (100 * pdoc.nAccept / pdoc.nSubmit)|round|int }}%{% else %}{{ _('?') }}{% endif %}</dd>
|
|
{% if pdoc['num_be_copied'] %}
|
|
<dt>{{ _('Be Copied') }}</dt>
|
|
<dd>{{ pdoc['num_be_copied'] }}</dd>
|
|
{% endif %}
|
|
<dt>{{ _('Uploaded By') }}</dt>
|
|
<dd>{{ user.render_inline(owner_udoc, badge=false) }}</dd>
|
|
</dl>
|
|
</div>
|
|
</div>
|
|
{% if page_name == 'problem_detail' and (tdocs or ctdocs) %}
|
|
<div class="section side">
|
|
<div class="section__header">
|
|
<h1 class="section__title">{{ _('Related') }}</h1>
|
|
</div>
|
|
<div class="section__body typo">
|
|
{% if tdocs %}
|
|
<p>{{ _('In following training plans') }}: </p>
|
|
{% for tdoc in tdocs %}
|
|
<p><a href="/t/{{ tdoc._id }}">{{ tdoc.title }}</a></p>
|
|
{% endfor %}
|
|
{% endif %}
|
|
{% if ctdocs %}
|
|
<p>{{ _('In following contests') }}: </p>
|
|
{% for tdoc in ctdocs %}
|
|
<p><a href="/c/{{ tdoc._id }}">{{ tdoc.title }}</a></p>
|
|
{% endfor %}
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
{% endif %}
|