mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
重构框架,增加比赛功能
This commit is contained in:
1 parent
0e590ebe0d
commit
9bf3343a64
54 files changed
+1196
-868
No files matched your search
@@ -18,12 +18,12 @@
|
||||
<div>
|
||||
<ol class="menu">
|
||||
{% if page_name == 'discussion_node' %}
|
||||
{% if handler.has_perm(perm.PERM_CREATE_DISCUSSION) %}
|
||||
{% if handler.hasPerm(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>
|
||||
{% else %}
|
||||
{% if not handler.has_perm(perm.PERM_LOGGEDIN) %}
|
||||
{% 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 %}
|
||||
@@ -40,7 +40,7 @@
|
||||
{% endif %}
|
||||
{% if not attended and not handler.is_done(tdoc) %}
|
||||
<li class="menu__item">
|
||||
{% if handler.has_perm(perm.PERM_ATTEND_CONTEST) and handler.has_perm(perm.PERM_LOGGEDIN) %}
|
||||
{% if handler.hasPerm(perm.PERM_ATTEND_CONTEST) and handler.hasPerm(perm.PERM_LOGGEDIN) %}
|
||||
<form action="/t/{{ tdoc._id }}" method="POST">
|
||||
<input type="hidden" name="operation" value="attend">
|
||||
<input type="hidden" name="csrf_token" value="{{ handler.csrf_token }}">
|
||||
@@ -48,7 +48,7 @@
|
||||
<span class="icon icon-add"></span> {{ _('Attend Contest') }}
|
||||
</button>
|
||||
</form>
|
||||
{% elif not handler.has_perm(perm.PERM_LOGGEDIN) %}
|
||||
{% elif not handler.hasPerm(perm.PERM_LOGGEDIN) %}
|
||||
<a class="menu__link" href="javascript:showSignInDialog()">
|
||||
<span class="icon icon-add"></span> {{ _('Login to Attend Contest') }}
|
||||
</a>
|
||||
@@ -68,12 +68,12 @@
|
||||
<span class="icon icon-statistics"></span> {{ _('Scoreboard (Hidden)') }}
|
||||
</a></li>
|
||||
{% endif %}
|
||||
{% if handler.own(tdoc, perm.PERM_EDIT_CONTEST_SELF) or handler.has_perm(perm.PERM_EDIT_CONTEST) %}
|
||||
{% if handler.own(tdoc, perm.PERM_EDIT_CONTEST_SELF) or handler.hasPerm(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(perm.PERM_READ_RECORD_CODE) %}
|
||||
{% if handler.hasPerm(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,5 +1,5 @@
|
||||
{% import "components/form.html" as form with context %}
|
||||
{% if ddoc['highlight'] or handler.has_perm(perm.PERM_HIGHLIGHT_DISCUSSION) %}
|
||||
{% if ddoc['highlight'] or handler.hasPerm(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) }}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
{% endif %}
|
||||
{% if not attended and not handler.is_done(tdoc) %}
|
||||
<li class="menu__item">
|
||||
{% if handler.has_perm(perm.PERM_ATTEND_HOMEWORK) and handler.has_perm(perm.PERM_LOGGEDIN) %}
|
||||
{% if handler.hasPerm(perm.PERM_ATTEND_HOMEWORK) and handler.hasPerm(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 }}">
|
||||
@@ -32,7 +32,7 @@
|
||||
<span class="icon icon-add"></span> {{ _('Claim Homework') }}
|
||||
</button>
|
||||
</form>
|
||||
{% elif not handler.has_perm(perm.PERM_LOGGEDIN) %}
|
||||
{% elif not handler.hasPerm(perm.PERM_LOGGEDIN) %}
|
||||
<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 handler.own(tdoc, perm.PERM_EDIT_HOMEWORK_SELF) or handler.has_perm(perm.PERM_EDIT_HOMEWORK) %}
|
||||
{% if handler.own(tdoc, perm.PERM_EDIT_HOMEWORK_SELF) or handler.hasPerm(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(perm.PERM_READ_RECORD_CODE) %}
|
||||
{% if handler.hasPerm(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>
|
||||
|
||||
@@ -11,27 +11,27 @@
|
||||
<ol class="nav__list nav__list--main clearfix">
|
||||
<li class="nav__list-item"><a href="/" class="nav__logo"> </a></li>
|
||||
{{ nav_item('/', 'domain_main', 'domain_main') }}
|
||||
{% if handler.has_perm(perm.PERM_VIEW_PROBLEM) %}
|
||||
{% if handler.hasPerm(perm.PERM_VIEW_PROBLEM) %}
|
||||
{{ nav_item('/p', 'problem_main', 'problem') }}
|
||||
{% endif %}
|
||||
{% if handler.has_perm(perm.PERM_VIEW_TRAINING) %}
|
||||
{% if handler.hasPerm(perm.PERM_VIEW_TRAINING) %}
|
||||
{{ nav_item('/t', 'training_main', 'training') }}
|
||||
{% endif %}
|
||||
{% if handler.has_perm(perm.PERM_VIEW_DISCUSSION) %}
|
||||
{% if handler.hasPerm(perm.PERM_VIEW_DISCUSSION) %}
|
||||
{{ nav_item('/d', 'discussion_main', 'discussion') }}
|
||||
{% endif %}
|
||||
{% if handler.has_perm(perm.PERM_VIEW_CONTEST) %}
|
||||
{% if handler.hasPerm(perm.PERM_VIEW_CONTEST) %}
|
||||
{{ nav_item('/c', 'contest_main', 'contest') }}
|
||||
{% endif %}
|
||||
{% if handler.has_perm(perm.PERM_VIEW_HOMEWORK) %}
|
||||
{% if handler.hasPerm(perm.PERM_VIEW_HOMEWORK) %}
|
||||
{{ nav_item('/h', 'homework_main', 'homework') }}
|
||||
{% endif %}
|
||||
{% if handler.has_perm(perm.PERM_EDIT_DESCRIPTION) or handler.has_perm(perm.PERM_EDIT_PERM) %}
|
||||
{% if handler.hasPerm(perm.PERM_EDIT_DESCRIPTION) or handler.hasPerm(perm.PERM_EDIT_PERM) %}
|
||||
{{ 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) %}
|
||||
{% if not handler.hasPerm(perm.PERM_LOGGEDIN) %}
|
||||
<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 %}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
{% else %}
|
||||
<table class="data-table">
|
||||
<colgroup>
|
||||
{% if handler.has_perm(perm.PERM_LOGGEDIN) %}
|
||||
{% if handler.hasPerm(perm.PERM_LOGGEDIN) %}
|
||||
<col class="col--status">
|
||||
{% endif %}
|
||||
<col class="col--name">
|
||||
@@ -18,7 +18,7 @@
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
{% if handler.has_perm(perm.PERM_LOGGEDIN) %}
|
||||
{% if handler.hasPerm(perm.PERM_LOGGEDIN) %}
|
||||
<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['_id']] %}
|
||||
<tr>
|
||||
{% if handler.has_perm(perm.PERM_LOGGEDIN) %}
|
||||
{% if handler.hasPerm(perm.PERM_LOGGEDIN) %}
|
||||
{% 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 handler.own(pdoc, perm.PERM_EDIT_PROBLEM_SELF) or handler.has_perm(perm.PERM_EDIT_PROBLEM) %}
|
||||
{% if handler.own(pdoc, perm.PERM_EDIT_PROBLEM_SELF) 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') }}
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
<span class="icon icon-send"></span> {{ _('Open in Problem Set') }}
|
||||
</a></li>
|
||||
{% endif %}
|
||||
{% if handler.own(pdoc, perm.PERM_EDIT_PROBLEM_SELF) or handler.has_perm(perm.PERM_EDIT_PROBLEM) %}
|
||||
{% if handler.own(pdoc, perm.PERM_EDIT_PROBLEM_SELF) 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') }}
|
||||
|
||||
@@ -9,12 +9,12 @@
|
||||
<div>
|
||||
<ol class="menu">
|
||||
{% if page_name == 'discussion_node' or page_name == 'discussion_detail' %}
|
||||
{% if handler.has_perm(perm.PERM_CREATE_DISCUSSION) %}
|
||||
{% if handler.hasPerm(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>
|
||||
{% else %}
|
||||
{% if not handler.has_perm(perm.PERM_LOGGEDIN) %}
|
||||
{% 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 %}
|
||||
@@ -25,7 +25,7 @@
|
||||
<li class="menu__seperator"></li>
|
||||
{% endif %}
|
||||
{% if page_name == 'problem_detail' %}
|
||||
{% if handler.has_perm(perm.PERM_SUBMIT_PROBLEM) %}
|
||||
{% 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>
|
||||
@@ -38,11 +38,11 @@
|
||||
<span class="icon icon-flag"></span> {{ _('View Problem') }}
|
||||
</a></li>
|
||||
{% endif %}
|
||||
{% if handler.has_perm(perm.PERM_SUBMIT_PROBLEM) %}
|
||||
{% 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.has_perm(perm.PERM_LOGGEDIN) %}
|
||||
{% 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>
|
||||
@@ -51,26 +51,26 @@
|
||||
<span class="icon icon-send"></span> {{ _('No Permission to Submit') }}
|
||||
</a></li>
|
||||
{% endif %}
|
||||
{% if handler.has_perm(perm.PERM_VIEW_DISCUSSION) or handler.has_perm(perm.PERM_VIEW_PROBLEM_SOLUTION) %}
|
||||
{% if handler.hasPerm(perm.PERM_VIEW_DISCUSSION) or handler.hasPerm(perm.PERM_VIEW_PROBLEM_SOLUTION) %}
|
||||
<li class="menu__seperator"></li>
|
||||
{% endif %}
|
||||
{% if handler.has_perm(perm.PERM_VIEW_DISCUSSION) %}
|
||||
{% 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="{{ 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(perm.PERM_VIEW_PROBLEM_SOLUTION) %}
|
||||
{% 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.has_perm(perm.PERM_LOGGEDIN) %}
|
||||
{% 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.has_perm(perm.PERM_EDIT_PROBLEM) %}
|
||||
{% 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') }}
|
||||
@@ -94,7 +94,7 @@
|
||||
<dd>{{ pdoc['_id'] }}</dd>
|
||||
{% endif %}
|
||||
{% if page_name != 'discussion_node' and page_name != 'discussion_detail' %}
|
||||
{% if handler.has_perm(perm.PERM_LOGGEDIN) %}
|
||||
{% if handler.hasPerm(perm.PERM_LOGGEDIN) %}
|
||||
<dt>{{ _('Submission') }}</dt>
|
||||
<dd>
|
||||
{% if pdoc['psdoc']['status'] %}
|
||||
@@ -139,7 +139,7 @@
|
||||
<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.has_perm(perm.PERM_LOGGEDIN) %}
|
||||
{% 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 %}
|
||||
|
||||
Reference in new issue
Block a user