mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
priv (unstable)
This commit is contained in:
1 parent
554698189c
commit
e092efca20
63 files changed
+706
-397
No files matched your search
@@ -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,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',
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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 %}
|
||||
|
||||
@@ -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') }}
|
||||
|
||||
@@ -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 %}
|
||||
|
||||
Reference in new issue
Block a user