priv (unstable)

This commit is contained in:
undefined committed 2020-06-29 13:33:44 +08:00
1 parent 554698189c
commit e092efca20
63 files changed
+706 -397

No files matched your search

@@ -28,15 +28,15 @@
{% macro reply_operations(doc, rdoc) %}
<div class="dczcomments__operations nojs--hide">
{% if handler.hasPerm(reply_post_perm) %}
{% if handler.user.hasPerm(reply_post_perm) %}
<a href="javascript:;" data-tooltip="{{ _('Reply') }}" name="dczcomments__op-reply-reply"><span class="icon icon-reply"></span></a>
{% endif %}
{% if doc.owner == handler.state.user._id or handler.hasPerm(reply_edit_perm) %}
{% if doc.owner == handler.state.user._id or handler.user.hasPerm(reply_edit_perm) %}
<a href="javascript:;" data-tooltip="{{ _('Edit') }}" name="dczcomments__op-edit-reply"
data-form="{{ {operation: reply_edit_op, drid: doc._id, drrid: rdoc._id}|json }}"
><span class="icon icon-edit"></span></a>
{% endif %}
{% if doc.owner == handler.state.user._id or handler.hasPerm(reply_delete_perm) %}
{% if doc.owner == handler.state.user._id or handler.user.hasPerm(reply_delete_perm) %}
<a href="javascript:;" data-tooltip="{{ _('Delete') }}" name="dczcomments__op-delete-reply"
data-form="{{ {operation: reply_delete_op, drid: doc._id, drrid: rdoc._id}|json }}"
><span class="icon icon-delete"></span></a>
@@ -71,7 +71,7 @@
reply_delete_op = 'delete_tail_reply'
) %}
<ul class="dczcomments__list view--discussion">
{% if handler.hasPerm(comment_post_perm) %}
{% if handler.user.hasPerm(comment_post_perm) %}
<li class="dczcomments__item">
<div class="media">
<div class="media__left top">
@@ -116,17 +116,17 @@
@ {{ datetimeSpan(doc['_id'])|safe }}
</div>
<div class="dczcomments__operations nojs--hide">
{% if handler.hasPerm(reply_post_perm) %}
{% if handler.user.hasPerm(reply_post_perm) %}
<a href="javascript:;" data-tooltip="{{ _('Reply') }}" name="dczcomments__op-reply-comment"
data-form="{{ {operation: reply_post_op, drid: doc._id}|json }}"
><span class="icon icon-reply"></span></a>
{% endif %}
{% if doc.owner == handler.state.user._id or handler.hasPerm(comment_edit_perm) %}
{% if doc.owner == handler.state.user._id or handler.user.hasPerm(comment_edit_perm) %}
<a href="javascript:;" data-tooltip="{{ _('Edit') }}" name="dczcomments__op-edit-comment"
data-form="{{ {operation: comment_edit_op, drid: doc._id}|json }}"
><span class="icon icon-edit"></span></a>
{% endif %}
{% if doc.owner == handler.state.user._id or handler.hasPerm(comment_delete_perm) %}
{% if doc.owner == handler.state.user._id or handler.user.hasPerm(comment_delete_perm) %}
<a href="javascript:;" data-tooltip="{{ _('Delete') }}" name="dczcomments__op-delete-comment"
data-form="{{ {operation: comment_delete_op, drid: doc._id}|json }}"
><span class="icon icon-delete"></span></a>
+8 -8
View File
@@ -30,7 +30,7 @@
reply_delete_op = 'delete_tail_reply'
) %}
<ul class="dczcomments__list view--solution">
{% if handler.hasPerm(comment_post_perm) %}
{% if handler.user.hasPerm(comment_post_perm) %}
<li class="dczcomments__item">
<div class="media">
<div class="media__left top">
@@ -85,7 +85,7 @@
<div class="media">
<div class="media__left top">
<div class="vote vote--discussion">
{% if handler.hasPerm(perm.PERM_VOTE_PROBLEM_SOLUTION) %}
{% if handler.user.hasPerm(perm.PERM_VOTE_PROBLEM_SOLUTION) %}
<div class="vote-number rotator--enabled">{{ doc.vote }}</div>
<div class="vote-op clearfix">
<form method="post">
@@ -113,17 +113,17 @@
@ {{ datetimeSpan(doc._id)|safe }}
</div>
<div class="dczcomments__operations nojs--hide">
{% if handler.hasPerm(reply_post_perm) %}
{% if handler.user.hasPerm(reply_post_perm) %}
<a href="javascript:;" data-tooltip="{{ _('Reply') }}" name="dczcomments__op-reply-comment"
data-form="{{ {operation: reply_post_op, psrid: doc._id}|json }}"
><span class="icon icon-reply"></span></a>
{% endif %}
{% if doc.owner == handler.state.user._id or handler.hasPerm(comment_edit_perm) %}
{% if doc.owner == handler.state.user._id or handler.user.hasPerm(comment_edit_perm) %}
<a href="javascript:;" data-tooltip="{{ _('Edit') }}" name="dczcomments__op-edit-comment"
data-form="{{ {operation: comment_edit_op, psrid: doc._id}|json }}"
><span class="icon icon-edit"></span></a>
{% endif %}
{% if doc.owner == handler.state.user._id or handler.hasPerm(comment_delete_perm) %}
{% if doc.owner == handler.state.user._id or handler.user.hasPerm(comment_delete_perm) %}
<a href="javascript:;" data-tooltip="{{ _('Delete') }}" name="dczcomments__op-delete-comment"
data-form="{{ {operation: comment_delete_op, psrid: doc._id}|json }}"
><span class="icon icon-delete"></span></a>
@@ -145,15 +145,15 @@
{{ user.render_inline(udoc, badge=false) }} @ {{ datetimeSpan(rdoc['_id'])|safe }}
</div>
<div class="dczcomments__operations nojs--hide">
{% if handler.hasPerm(reply_post_perm) %}
{% if handler.user.hasPerm(reply_post_perm) %}
<a href="javascript:;" data-tooltip="{{ _('Reply') }}" name="dczcomments__op-reply-reply"><span class="icon icon-reply"></span></a>
{% endif %}
{% if doc.owner == handler.state.user._id or handler.hasPerm(reply_edit_perm) %}
{% if doc.owner == handler.state.user._id or handler.user.hasPerm(reply_edit_perm) %}
<a href="javascript:;" data-tooltip="{{ _('Edit') }}" name="dczcomments__op-edit-reply"
data-form="{{ {operation: reply_edit_op, psid: doc._id, psrid: rdoc._id}|json }}"
><span class="icon icon-edit"></span></a>
{% endif %}
{% if doc.owner == handler.state.user._id or handler.hasPerm(reply_delete_perm) %}
{% if doc.owner == handler.state.user._id or handler.user.hasPerm(reply_delete_perm) %}
<a href="javascript:;" data-tooltip="{{ _('Delete') }}" name="dczcomments__op-delete-reply"
data-form="{{ {operation: reply_delete_op, psid: doc._id, psrid: rdoc._id}|json }}"
><span class="icon icon-delete"></span></a>
+2 -5
View File
@@ -1,4 +1,4 @@
{% macro render_problem_title(pdoc, tdoc=none, show_tags=true, show_invisible_flag=true, rp=none, invalid=false) %}
{% macro render_problem_title(pdoc, tdoc=none, show_tags=true, show_invisible_flag=true, invalid=false) %}
{%- if not invalid %}
<a
{%- if tdoc and tdoc.docType == model.document.TYPE_CONTEST %}
@@ -17,9 +17,6 @@
{%- if pdoc['hidden'] and show_invisible_flag %}
<span class="text-orange">({{ _('Hidden') }})</span>
{%- endif %}
{%- if not rp is none %}
<span class="problem__rp-tag">RP+{{ rp|round|int }}</span>
{%- endif %}
{%- if show_tags %}
{{ render_problem_tags(pdoc) }}
{%- endif %}
@@ -29,7 +26,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="/p/category/{{ tag }}">{{ tag }}</a></li>
<li class="problem__tag"><a class="problem__tag-link" href="{{ url('problem_category', category=tag) }}">{{ tag }}</a></li>
{%- endfor %}
</ul>
{%- else %}
+1 -1
View File
@@ -6,7 +6,7 @@
{{ model.builtin.STATUS_TEXTS[rdoc['status']] }}
</a>
</div>
{% if rdoc['status'] == status.STATUS_JUDGING %}
{% if rdoc['status'] == STATUS.STATUS_JUDGING %}
<div class="col--status__progress-container">
<div class="col--status__progress" style="width: {{ rdoc['progress']|default(50)|int }}%"></div>
</div>
+3 -3
View File
@@ -24,7 +24,7 @@
<div class="section__body no-padding">
<table class="data-table">
<colgroup>
{% if handler.hasPerm(perm.PERM_LOGGEDIN) %}
{% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
<col class="col--status">
<col class="col--submit-at">
{% endif %}
@@ -32,7 +32,7 @@
</colgroup>
<thead>
<tr>
{% if handler.hasPerm(perm.PERM_LOGGEDIN) %}
{% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
<th class="col--status record-status--border">{{ _('Status') }}</th>
<th class="col--submit-at">{{ _('Last Submit At') }}</th>
{% endif %}
@@ -42,7 +42,7 @@
<tbody>
{% for pid in tdoc.pids %}
<tr>
{% if handler.hasPerm(perm.PERM_LOGGEDIN) %}
{% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
{% if psdict[pid] and psdict[pid].rid %}
{% set rdoc = rdict[psdict[pid].rid] %}
{% if handler.canShowRecord(tdoc) %}
+1 -1
View File
@@ -115,7 +115,7 @@
</div>
</div>
<div class="medium-3 columns">
{% if handler.hasPerm(perm.PERM_CREATE_CONTEST) %}
{% if handler.user.hasPerm(perm.PERM_CREATE_CONTEST) %}
<div class="section side">
<div class="section__header">
<h1 class="section__title">
+6 -6
View File
@@ -29,7 +29,7 @@
</div>
</div>
<ul class="section__footer supplementary dot list">
{% if ddoc.owner == handler.user._id or handler.hasPerm(perm.PERM_EDIT_DISCUSSION) %}
{% if ddoc.owner == handler.user._id or handler.user.hasPerm(perm.PERM_EDIT_DISCUSSION) %}
<li>
<a href="{{ url('discussion_edit', did=ddoc.docId) }}"><span class="icon icon-edit"></span> {{ _('Edit') }}</a>
</li>
@@ -37,7 +37,7 @@
<li>
{{ _('{0} views').format(ddoc['views']) }}
</li>
{% if handler.hasPerm(perm.PERM_LOGGEDIN) %}
{% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
<li><form class="form--inline" method="post">
<input type="hidden" name="operation" value="{% if not dsdoc['star'] %}star{% else %}unstar{% endif %}">
<input type="hidden" name="csrfToken" value="{{ handler.csrfToken }}">
@@ -64,11 +64,11 @@
comment_ref = 'drid',
reply_ref = 'drrid',
comment_post_perm = perm.PERM_REPLY_DISCUSSION,
comment_edit_perm = perm.PERM_LOGGEDIN if ddoc.owner == handler.user._id else perm.PERM_EDIT_DISCUSSION_REPLY,
comment_delete_perm = perm.PERM_LOGGEDIN if ddoc.owner == handler.user._id else perm.PERM_DELETE_DISCUSSION_REPLY,
comment_edit_perm = perm.PERM_NONE if ddoc.owner == handler.user._id else perm.PERM_EDIT_DISCUSSION_REPLY,
comment_delete_perm = perm.PERM_NONE if ddoc.owner == handler.user._id else perm.PERM_DELETE_DISCUSSION_REPLY,
reply_post_perm = perm.PERM_REPLY_DISCUSSION,
reply_edit_perm = perm.PERM_LOGGEDIN if ddoc.owner == handler.user._id else perm.PERM_EDIT_DISCUSSION_REPLY,
reply_delete_perm = perm.PERM_LOGGEDIN if ddoc.owner == handler.user._id else perm.PERM_DELETE_DISCUSSION_REPLY
reply_edit_perm = perm.PERM_NONE if ddoc.owner == handler.user._id else perm.PERM_EDIT_DISCUSSION_REPLY,
reply_delete_perm = perm.PERM_NONE if ddoc.owner == handler.user._id else perm.PERM_DELETE_DISCUSSION_REPLY
) }}
{{ 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 ddoc.owner == handler.user._id or handler.hasPerm(perm.PERM_DELETE_DISCUSSION) %}
{% if ddoc.owner == handler.user._id or handler.user.hasPerm(perm.PERM_DELETE_DISCUSSION) %}
<button name="operation" value="delete" type="submit" class="rounded button">
{{ _('Delete') }}
</button>
+2 -2
View File
@@ -23,10 +23,10 @@
</div>
<div class="section__body">
{% if vnode %}
{% if handler.hasPerm(perm.PERM_CREATE_DISCUSSION) %}
{% if handler.user.hasPerm(perm.PERM_CREATE_DISCUSSION) %}
<p><a href="{{ url('discussion_create', type=model.discussion.typeDisplay[vnode.type], name=vnode.id) }}" class="expanded primary button">{{ _('Create a Discussion') }}</a></p>
{% else %}
{% if not handler.hasPerm(perm.PERM_LOGGEDIN) %}
{% if not handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
<p><a href="javascript:showSignInDialog();" class="expanded primary button">{{ _('Login to Create a Discussion') }}</a></p>
{% else %}
<p><a href="javascript:;" class="disabled expanded primary button">{{ _('No Permission to Create a Discussion') }}</a></p>
+3 -3
View File
@@ -23,7 +23,7 @@
<div class="section__body no-padding">
<table class="data-table">
<colgroup>
{% if handler.hasPerm(perm.PERM_LOGGEDIN) %}
{% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
<col class="col--status">
<col class="col--submit-at">
{% endif %}
@@ -31,7 +31,7 @@
</colgroup>
<thead>
<tr>
{% if handler.hasPerm(perm.PERM_LOGGEDIN) %}
{% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
<th class="col--status record-status--border">{{ _('Status') }}</th>
<th class="col--submit-at">{{ _('Last Submit At') }}</th>
{% endif %}
@@ -41,7 +41,7 @@
<tbody>
{% for pid in tdoc['pids'] %}
<tr>
{% if handler.hasPerm(perm.PERM_LOGGEDIN) %}
{% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
{% if psdict[pid] and psdict[pid]['rid'] %}
{% set rdoc = rdict[psdict[pid]['rid']] %}
{% if handler.canShowRecord(tdoc) %}
+1 -1
View File
@@ -18,7 +18,7 @@
<option value="list">{{ _('List View') }}</option>
</select>
</span>
{% if handler.hasPerm(perm.PERM_CREATE_HOMEWORK) %}
{% if handler.user.hasPerm(perm.PERM_CREATE_HOMEWORK) %}
<a class="compact button" href="{{ url('homework_create') }}">{{ _('Create Homework') }}</a>
{% endif %}
</div>
+2 -2
View File
@@ -135,7 +135,7 @@
<span class="icon training-status--icon done"></span>
<span class="training-status--text done">{{ _('Completed') }} 100%</span>
{% endif %}
{% elif handler.hasPerm(perm.PERM_LOGGEDIN) %}
{% elif handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
<span class="icon training-status--icon outside"></span> <span class="training-status--text outside">{{ _('Not Enrolled') }}</span>
{% endif %}
</li>
@@ -157,7 +157,7 @@
{% endif %}
</div>
<div class="large-3 columns">
{% if handler.hasPerm(perm.PERM_VIEW_DISCUSSION) %}
{% if handler.user.hasPerm(perm.PERM_VIEW_DISCUSSION) %}
{% include 'partials/discussion_nodes_widget.html' %}
{% endif %}
<div class="section side">
+4 -4
View File
@@ -24,7 +24,7 @@
{% endif %}
{% if not attended and not model.contest.isDone(tdoc) %}
<li class="menu__item">
{% if handler.hasPerm(perm.PERM_ATTEND_CONTEST) and handler.hasPerm(perm.PERM_LOGGEDIN) %}
{% if handler.user.hasPerm(perm.PERM_ATTEND_CONTEST) and handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
<form action="{{ url('contest_detail', tid=tdoc.docId) }}" method="POST">
<input type="hidden" name="operation" value="attend">
<input type="hidden" name="csrfToken" value="{{ handler.csrfToken }}">
@@ -32,7 +32,7 @@
<span class="icon icon-add"></span> {{ _('Attend Contest') }}
</button>
</form>
{% elif not handler.hasPerm(perm.PERM_LOGGEDIN) %}
{% elif not handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
<a class="menu__link" href="javascript:showSignInDialog()">
<span class="icon icon-add"></span> {{ _('Login to Attend Contest') }}
</a>
@@ -52,12 +52,12 @@
<span class="icon icon-statistics"></span> {{ _('Scoreboard (Hidden)') }}
</a></li>
{% endif %}
{% if user._id == tdoc.owner or handler.hasPerm(perm.PERM_EDIT_CONTEST) %}
{% if user._id == tdoc.owner or handler.user.hasPerm(perm.PERM_EDIT_CONTEST) %}
<li class="menu__item"><a class="menu__link" href="{{ url('contest_edit', tid=tdoc.docId) }}">
<span class="icon icon-edit"></span> {{ _('Edit Contest') }}
</a></li>
{% endif %}
{% if handler.hasPerm(perm.PERM_READ_RECORD_CODE) %}
{% if handler.user.hasPerm(perm.PERM_READ_RECORD_CODE) %}
<li class="menu__item"><a class="menu__link" href="{{ url('contest_code', tid=tdoc.docId) }}">
<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.hasPerm(perm.PERM_HIGHLIGHT_DISCUSSION) %}
{% if ddoc.highlight or handler.user.hasPerm(perm.PERM_HIGHLIGHT_DISCUSSION) %}
{{ form.form_checkbox({
label:'Highlight',
name:'highlight',
+4 -4
View File
@@ -24,7 +24,7 @@
{% endif %}
{% if not attended and not model.contest.isDone(tdoc) %}
<li class="menu__item">
{% if handler.hasPerm(perm.PERM_ATTEND_HOMEWORK) and handler.hasPerm(perm.PERM_LOGGEDIN) %}
{% if handler.user.hasPerm(perm.PERM_ATTEND_HOMEWORK) and handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
<form action="{{ url('homework_detail', tid=tdoc.docId) }}" method="POST">
<input type="hidden" name="operation" value="attend">
<input type="hidden" name="csrfToken" value="{{ handler.csrfToken }}">
@@ -32,7 +32,7 @@
<span class="icon icon-add"></span> {{ _('Claim Homework') }}
</button>
</form>
{% elif not handler.hasPerm(perm.PERM_LOGGEDIN) %}
{% elif not handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
<a class="menu__link" href="javascript:showSignInDialog()">
<span class="icon icon-add"></span> {{ _('Login to Claim Homework') }}
</a>
@@ -52,12 +52,12 @@
<span class="icon icon-statistics"></span> {{ _('Scoreboard (Hidden)') }}
</a></li>
{% endif %}
{% if tdoc.owner == handler.user._id or handler.hasPerm(perm.PERM_EDIT_HOMEWORK) %}
{% if tdoc.owner == handler.user._id or handler.user.hasPerm(perm.PERM_EDIT_HOMEWORK) %}
<li class="menu__item"><a class="menu__link" href="{{ url('homework_edit', tid=tdoc.docId) }}">
<span class="icon icon-edit"></span> {{ _('Edit Homework') }}
</a></li>
{% endif %}
{% if handler.hasPerm(perm.PERM_READ_RECORD_CODE) %}
{% if handler.user.hasPerm(perm.PERM_READ_RECORD_CODE) %}
<li class="menu__item"><a class="menu__link" href="{{ url('homework_code', tid=tdoc.docId) }}">
<span class="icon icon-download"></span> {{ _('Export All Code') }}
</a></li>
+1 -1
View File
@@ -17,7 +17,7 @@
{% endfor %}
</ol>
<ol class="nav__list nav__list--secondary clearfix">
{% if not handler.hasPerm(perm.PERM_LOGGEDIN) %}
{% if not handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
<li class="nav__list-item"><a href="{{ url('user_login') }}" class="nav__item" name="nav_login">{{ _('Login') }}</a></li>
<li class="nav__list-item"><a href="{{ url('user_register') }}" class="nav__item--round">{{ _('Sign Up') }}</a></li>
{% else %}
+3 -3
View File
@@ -8,7 +8,7 @@
{% else %}
<table class="data-table">
<colgroup>
{% if handler.hasPerm(perm.PERM_LOGGEDIN) %}
{% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
<col class="col--status">
{% endif %}
<col class="col--name">
@@ -18,7 +18,7 @@
</colgroup>
<thead>
<tr>
{% if handler.hasPerm(perm.PERM_LOGGEDIN) %}
{% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
<th class="col--status record-status--border">{{ _('Status') }}</th>
{% endif %}
<th class="col--name">{{ _('Problem') }}</th>
@@ -31,7 +31,7 @@
{% for pdoc in pdocs %}
{% set psdoc = psdict[pdoc['docId']] %}
<tr>
{% if handler.hasPerm(perm.PERM_LOGGEDIN) %}
{% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
{% if psdoc['rid'] %}
{{ record.render_status_td(psdoc, rid_key='rid') }}
{% else %}
@@ -28,7 +28,7 @@
<span class="icon icon-send"></span> {{ _('Open in Problem Set') }}
</a></li>
{% endif %}
{% if pdoc.owner == handler.user._id or handler.hasPerm(perm.PERM_EDIT_PROBLEM) %}
{% if pdoc.owner == handler.user._id or handler.user.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="{{ url('problem_edit', pid=pdoc.pid) }}">
<span class="icon icon-edit"></span> {{ _('Edit') }}
@@ -28,7 +28,7 @@
<span class="icon icon-send"></span> {{ _('Open in Problem Set') }}
</a></li>
{% endif %}
{% if pdoc.owner == handler.user._id or handler.hasPerm(perm.PERM_EDIT_PROBLEM) %}
{% if pdoc.owner == handler.user._id or handler.user.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="{{ url('problem_edit', pid=pdoc.pid) }}">
<span class="icon icon-edit"></span> {{ _('Edit') }}
+11 -11
View File
@@ -9,12 +9,12 @@
<div>
<ol class="menu">
{% if page_name == 'discussion_node' or page_name == 'discussion_detail' %}
{% if handler.hasPerm(perm.PERM_CREATE_DISCUSSION) %}
{% if handler.user.hasPerm(perm.PERM_CREATE_DISCUSSION) %}
<li class="menu__item"><a class="menu__link highlight" href="{{ url('discussion_create', type='problem', name=pdoc.docId) }}">
<span class="icon icon-add"></span> {{ _('Create a Discussion') }}
</a></li>
{% else %}
{% if not handler.hasPerm(perm.PERM_LOGGEDIN) %}
{% if not handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
<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 %}
@@ -25,7 +25,7 @@
<li class="menu__seperator"></li>
{% endif %}
{% if page_name == 'problem_detail' %}
{% if handler.hasPerm(perm.PERM_SUBMIT_PROBLEM) %}
{% if handler.user.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>
@@ -38,11 +38,11 @@
<span class="icon icon-flag"></span> {{ _('View Problem') }}
</a></li>
{% endif %}
{% if handler.hasPerm(perm.PERM_SUBMIT_PROBLEM) %}
{% if handler.user.hasPerm(perm.PERM_SUBMIT_PROBLEM) %}
<li class="menu__item scratchpad--hide"><a class="menu__link{% if page_name == 'problem_submit' %} active{% endif %}" href="{{ url('problem_submit', pid=pdoc.pid) }}">
<span class="icon icon-send"></span> {{ _('Submit') }}
</a></li>
{% elif not handler.hasPerm(perm.PERM_LOGGEDIN) %}
{% elif not handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
<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>
@@ -51,20 +51,20 @@
<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) %}
{% if handler.user.hasPerm(perm.PERM_VIEW_DISCUSSION) or handler.user.hasPerm(perm.PERM_VIEW_PROBLEM_SOLUTION) %}
<li class="menu__seperator"></li>
{% endif %}
{% if handler.hasPerm(perm.PERM_VIEW_DISCUSSION) %}
{% if handler.user.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="{{ url('discussion_node', type='problem', name=pdoc.docId) }}">
<span class="icon icon-comment--text"></span> {{ _('Discussions') }}
</a></li>
{% endif %}
{% if handler.hasPerm(perm.PERM_VIEW_PROBLEM_SOLUTION) %}
{% if handler.user.hasPerm(perm.PERM_VIEW_PROBLEM_SOLUTION) %}
<li class="menu__item"><a class="menu__link{% if page_name == 'problem_solution' %} active{% endif %}" href="{{ url('problem_solution', pid=pdoc.pid) }}">
<span class="icon icon-comment--text"></span> {{ _('Solutions') }}
</a></li>
{% endif %}
{% if user._id == pdoc.owner or handler.hasPerm(perm.PERM_EDIT_PROBLEM) %}
{% if user._id == pdoc.owner or handler.user.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="{{ url('problem_edit', pid=pdoc.pid) }}">
<span class="icon icon-edit"></span> {{ _('Edit') }}
@@ -86,7 +86,7 @@
<dt>{{ _('ID') }}</dt>
<dd>{{ pdoc.docId }}</dd>
{% if page_name != 'discussion_node' and page_name != 'discussion_detail' %}
{% if handler.hasPerm(perm.PERM_LOGGEDIN) %}
{% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
<dt>{{ _('Submission') }}</dt>
<dd>
{% if pdoc.psdoc.status %}
@@ -127,7 +127,7 @@
<dt>{{ _('# Submissions') }}</dt>
<dd><a href="{{ url('record_main', query={pid:pdoc.docId}) }}">{{ pdoc.nSubmit }}</a></dd>
{% if page_name != 'discussion_node' and page_name != 'discussion_detail' %}
{% if handler.hasPerm(perm.PERM_LOGGEDIN) %}
{% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
<dt>{{ _('# My Submissions') }}</dt>
<dd><a href="{{ url('record_main', query={pid:pdoc.docId, uidOrName:handler.user._id}) }}">{{ pdoc['psdoc'].nSubmit|default(0) }}</a></dd>
{% endif %}
+1 -1
View File
@@ -59,7 +59,7 @@
</div>
</form>
</div>
{% if handler.hasPerm(perm.PERM_CREATE_PROBLEM) %}
{% if handler.user.hasPerm(perm.PERM_CREATE_PROBLEM) %}
<div class="section side">
<div class="section__header">
<h1 class="section__title">{{ _('Create Problem') }}</h1>
+1 -1
View File
@@ -9,7 +9,7 @@
<div class="section__body">
<iframe src="{{ url('problem_upload', pid=pdoc.pid) }}" frameborder="0" style="width: 100%; height: 100px;"></iframe>
<p class="help-text">{{ _('Hint') }}: <a href="{{ url('wiki', page='help', anchor='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 (pdoc.owner == handler.user._id or handler.hasPerm(perm.PERM_READ_PROBLEM_DATA)) %}
{% if pdoc and (pdoc.owner == handler.user._id or handler.user.hasPerm(perm.PERM_READ_PROBLEM_DATA)) %}
<p><a href="{{ url('problem_data', pid=pdoc.pid) }}" class="expanded button">{{ _('Download Dataset') }}</a></p>
{% endif %}
</div>
+3 -3
View File
@@ -9,7 +9,7 @@
<div class="row">
<div class="medium-9 columns">
{% if showStatus %}
{% include 'record_detail_status.html' %}
{% include 'record_detail_STATUS.html' %}
{% endif %}
{% if rdoc['code'] %}
<div class="section">
@@ -44,7 +44,7 @@
<div class="section__header">
<h1 class="section__title">{{ _('Information') }}</h1>
</div>
{% if handler.hasPerm(perm.PERM_REJUDGE) %}
{% if handler.user.hasPerm(perm.PERM_REJUDGE) %}
<div class="section__body no-padding">
<ol class="menu">
<li class="menu__item">
@@ -86,7 +86,7 @@
<a href="{{ url('contest_detail', tid=tdoc.docId) }}">{{ tdoc.title }}</a>
</dd>
{% endif %}
{% if pdoc and (handler.user._id == pdoc.owner or handler.hasPerm(perm.PERM_READ_PROBLEM_DATA)) %}
{% if pdoc and (handler.user._id == pdoc.owner or handler.user.hasPerm(perm.PERM_READ_PROBLEM_DATA)) %}
<dt>{{ _('Problem Data') }}</dt>
<dd><a href="{{ url('problem_data', pid=pdoc.pid) }}"><span class="icon icon-download"></span> {{ _('Download') }}</a></dd>
{% endif %}
+2 -2
View File
@@ -48,8 +48,8 @@
<span>{{ rcdoc['judgeText'] }}</span>
<a class="tool-button" href="{{ url('wiki', page='help', anchor='status') }}"><span class="icon icon-help"></span></a>
</td>
<td class="col--time">{% if rcdoc['status'] == status.STATUS_TIME_LIMIT_EXCEEDED or rcdoc['status'] == status.STATUS_MEMORY_LIMIT_EXCEEDED or rcdoc['status'] == status.STATUS_OUTPUT_LIMIT_EXCEEDED %}&ge;{% endif %}{{ rcdoc.time }}ms</td>
<td class="col--memory">{% if rcdoc['status'] == status.STATUS_TIME_LIMIT_EXCEEDED or rcdoc['status'] == status.STATUS_MEMORY_LIMIT_EXCEEDED or rcdoc['status'] == status.STATUS_OUTPUT_LIMIT_EXCEEDED %}&ge;{% endif %}{{ size(rcdoc.memory, 1024) }}</td>
<td class="col--time">{% if rcdoc['status'] == STATUS.STATUS_TIME_LIMIT_EXCEEDED or rcdoc['status'] == STATUS.STATUS_MEMORY_LIMIT_EXCEEDED or rcdoc['status'] == STATUS.STATUS_OUTPUT_LIMIT_EXCEEDED %}&ge;{% endif %}{{ rcdoc.time }}ms</td>
<td class="col--memory">{% if rcdoc['status'] == STATUS.STATUS_TIME_LIMIT_EXCEEDED or rcdoc['status'] == STATUS.STATUS_MEMORY_LIMIT_EXCEEDED or rcdoc['status'] == STATUS.STATUS_OUTPUT_LIMIT_EXCEEDED %}&ge;{% endif %}{{ size(rcdoc.memory, 1024) }}</td>
</tr>
{% endfor %}
</tbody>
+2 -2
View File
@@ -4,7 +4,7 @@
<dd>{{ rdoc['score'] }}</dd>
{% endif %}
<dt>{{ _('Total Time') }}</dt>
<dd>{% if rdoc['status'] == status.STATUS_TIME_LIMIT_EXCEEDED or rdoc['status'] == status.STATUS_MEMORY_LIMIT_EXCEEDED or rdoc['status'] == status.STATUS_OUTPUT_LIMIT_EXCEEDED %}&ge;{% endif %}{{ rdoc.time }}ms</dd>
<dd>{% if rdoc['status'] == STATUS.STATUS_TIME_LIMIT_EXCEEDED or rdoc['status'] == STATUS.STATUS_MEMORY_LIMIT_EXCEEDED or rdoc['status'] == STATUS.STATUS_OUTPUT_LIMIT_EXCEEDED %}&ge;{% endif %}{{ rdoc.time }}ms</dd>
<dt>{{ _('Peak Memory') }}</dt>
<dd>{% if rdoc['status'] == status.STATUS_TIME_LIMIT_EXCEEDED or rdoc['status'] == status.STATUS_MEMORY_LIMIT_EXCEEDED or rdoc['status'] == status.STATUS_OUTPUT_LIMIT_EXCEEDED %}&ge;{% endif %}{{ size(rdoc.memory, 1024) }}</dd>
<dd>{% if rdoc['status'] == STATUS.STATUS_TIME_LIMIT_EXCEEDED or rdoc['status'] == STATUS.STATUS_MEMORY_LIMIT_EXCEEDED or rdoc['status'] == STATUS.STATUS_OUTPUT_LIMIT_EXCEEDED %}&ge;{% endif %}{{ size(rdoc.memory, 1024) }}</dd>
</dl>
+1 -1
View File
@@ -82,7 +82,7 @@
{% endfor %}
</tbody>
</table>
{% if handler.hasPerm(perm.PERM_VIEW_JUDGE_STATISTICS) %}
{% if handler.user.hasPerm(perm.PERM_VIEW_JUDGE_STATISTICS) %}
<ul class="pager">
<li>
<a class="pager__item next link" href="?start={{ rdocs[-1]['_id'] }}&{{ query_string }}">{{ _('pager_next') }}</a>
+4 -4
View File
@@ -3,7 +3,7 @@
<tr data-rid="{{ rdoc['_id'] }}">
{{ record.render_status_td(rdoc) }}
<td class="col--problem col--problem-name">
{% if handler.hasPerm(perm.PERM_REJUDGE) %}
{% if handler.user.hasPerm(perm.PERM_REJUDGE) %}
<form class="form--inline" method="post" action="{{ url('record_rejudge', rid=rdoc._id) }}">
<input type="hidden" name="csrfToken" value="{{ handler.csrfToken }}">
<button type="submit" class="link text-maroon lighter">
@@ -12,7 +12,7 @@
</button> |
</form>
{% endif %}
{% if pdoc and (not pdoc.hidden or handler.hasPerm(perm.PERM_VIEW_PROBLEM_HIDDEN)) %}
{% if pdoc and (not pdoc.hidden or handler.user.hasPerm(perm.PERM_VIEW_PROBLEM_HIDDEN)) %}
{{ problem.render_problem_title(pdoc, show_tags=false) }}
{% else %}
*
@@ -23,8 +23,8 @@
{{ udoc['uname'] }}
</a>
</td>
<td class="col--time">{% if rdoc['status'] == status.STATUS_TIME_LIMIT_EXCEEDED or rdoc['status'] == status.STATUS_MEMORY_LIMIT_EXCEEDED or rdoc['status'] == status.STATUS_OUTPUT_LIMIT_EXCEEDED %}&ge;{% endif %}{{ rdoc.time }}ms</td>
<td class="col--memory">{% if rdoc['status'] == status.STATUS_TIME_LIMIT_EXCEEDED or rdoc['status'] == status.STATUS_MEMORY_LIMIT_EXCEEDED or rdoc['status'] == status.STATUS_OUTPUT_LIMIT_EXCEEDED %}&ge;{% endif %}{{ size(rdoc.memory, 1024) }}</td>
<td class="col--time">{% if rdoc['status'] == STATUS.STATUS_TIME_LIMIT_EXCEEDED or rdoc['status'] == STATUS.STATUS_MEMORY_LIMIT_EXCEEDED or rdoc['status'] == STATUS.STATUS_OUTPUT_LIMIT_EXCEEDED %}&ge;{% endif %}{{ rdoc.time }}ms</td>
<td class="col--memory">{% if rdoc['status'] == STATUS.STATUS_TIME_LIMIT_EXCEEDED or rdoc['status'] == STATUS.STATUS_MEMORY_LIMIT_EXCEEDED or rdoc['status'] == STATUS.STATUS_OUTPUT_LIMIT_EXCEEDED %}&ge;{% endif %}{{ size(rdoc.memory, 1024) }}</td>
<td class="col--lang">{{ model.builtin.LANG_TEXTS[rdoc['lang']] }}</td>
<td class="col--submit-at">{{ datetimeSpan(rdoc['_id'])|safe }}</td>
</tr>
+7 -7
View File
@@ -79,7 +79,7 @@
<div class="section__body no-padding training__problems">
<table class="data-table">
<colgroup>
{% if handler.hasPerm(perm.PERM_LOGGEDIN) %}
{% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
<col class="col--status">
{% endif %}
<col class="col--name">
@@ -89,7 +89,7 @@
</colgroup>
<thead>
<tr>
{% if handler.hasPerm(perm.PERM_LOGGEDIN) %}
{% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
<th class="col--status record-status--border">{{ _('Status') }}</th>
{% endif %}
<th class="col--name">{{ _('Problem') }}</th>
@@ -104,7 +104,7 @@
{% set pdoc=pdict[pid] %}
{% set psdoc=psdict[pid] %}
<tr>
{% if handler.hasPerm(perm.PERM_LOGGEDIN) %}
{% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
{% if psdoc['rid'] %}
{{ record.render_status_td(psdoc, rid_key='rid') }}
{% else %}
@@ -112,7 +112,7 @@
{% endif %}
{% endif %}
<td class="col--name col--problem-name">
{% if handler.hasPerm(perm.PERM_LOGGEDIN) %}
{% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
<form class="form--inline" action="{{ url('problem_main') }}" method="post">
<input type="hidden" name="pid" value="{{ pdoc.docId }}">
<input type="hidden" name="operation" value="{% if not psdoc['star'] %}star{% else %}unstar{% endif %}">
@@ -160,7 +160,7 @@
<div class="section side">
<div>
<ol class="menu">
{% if not tsdoc['enroll'] and handler.hasPerm(perm.PERM_LOGGEDIN) %}
{% if not tsdoc['enroll'] and handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
<li class="menu__item">
<form action="" method="POST">
<input type="hidden" name="operation" value="enroll">
@@ -171,7 +171,7 @@
</form>
</li>
{% endif %}
{% if tdoc.owner == user._id or handler.hasPerm(perm.PERM_EDIT_TRAINING) %}
{% if tdoc.owner == user._id or handler.user.hasPerm(perm.PERM_EDIT_TRAINING) %}
<li class="menu__item"><a class="menu__link" href="{{ url('training_edit', tid=tdoc.docId) }}">
<span class="icon icon-edit"></span> {{ _('Edit') }}
</a></li>
@@ -184,7 +184,7 @@
</div>
<div class="section__body typo">
<dl class="large horizontal">
{% if handler.hasPerm(perm.PERM_LOGGEDIN) %}
{% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
<dt>{{ _('Status') }}</dt><dd>{% if tsdoc['enroll'] %}{{ _('Completed' if tsdoc['done'] else 'In Progress') }}{% else %}{{ _('Not Enrolled') }}{% endif %}</dd>
{% endif %}
{% if tsdoc['enroll'] %}
+3 -3
View File
@@ -37,7 +37,7 @@
<span class="icon training-status--icon done"></span>
<span class="training-status--text done">{{ _('Completed') }} 100%</span>
{% endif %}
{% elif handler.hasPerm(perm.PERM_LOGGEDIN) %}
{% elif handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
<span class="icon training-status--icon outside"></span> <span class="training-status--text outside">{{ _('Not Enrolled') }}</span>
{% endif %}
</li>
@@ -52,7 +52,7 @@
</div>
</div>
<div class="large-3 columns">
{% if handler.hasPerm(perm.PERM_LOGGEDIN) %}
{% if handler.user.hasPriv(PRIV.PRIV_USER_PROFILE) %}
<div class="section side">
<div class="section__header">
<h1 class="section__title">{{ _('Enrolled') }}</h1>
@@ -76,7 +76,7 @@
</div>
</div>
{% endif %}
{% if handler.hasPerm(perm.PERM_CREATE_TRAINING) %}
{% if handler.user.hasPerm(perm.PERM_CREATE_TRAINING) %}
<div class="section side">
<div class="section__header">
<h1 class="section__title">{{ _('Create Training Plan') }}</h1>
+1 -1
View File
@@ -62,7 +62,7 @@
{{ model.builtin.USER_GENDER_ICONS[udoc.gender] }}
</span>
{% endif %}
{% if handler.hasPerm(perm.PERM_MOD_BADGE) %}
{% if handler.user.hasPerm(perm.PERM_MOD_BADGE) %}
<span
class="profile-header__contact-item user-profile-badge badge--mod"
data-tooltip="{{ _('{0} is a moderator of this domain.').format(_('She' if udoc.gender == 1 else 'He')) }}"