core: add maintainer field for doc (#101)

This commit is contained in:
undefined committed 2021-05-01 12:14:11 +08:00
1 parent 7bde6a922c
commit da32c79f21
24 files changed
+85 -74

No files matched your search

@@ -86,12 +86,12 @@
data-form="{{ {operation: reply_post_op, drid: doc._id}|json }}"
><span class="icon icon-reply"></span></a>
{% endif %}
{% if (handler.user.hasPerm(comment_edit_self_perm) and doc.owner == handler.user._id) or handler.user.hasPerm(comment_edit_perm) %}
{% if (handler.user.hasPerm(comment_edit_self_perm) and handler.user.own(doc)) 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 (handler.user.hasPerm(comment_delete_self_perm) and doc.owner == handler.user._id) or handler.user.hasPerm(comment_delete_perm) %}
{% if (handler.user.hasPerm(comment_delete_self_perm) and handler.user.own(doc)) 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>
@@ -120,12 +120,12 @@
{% 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.user._id or handler.user.hasPerm(reply_edit_perm) %}
{% if handler.user.own(doc) 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.user._id or handler.user.hasPerm(reply_delete_perm) %}
{% if handler.user.own(doc) 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>
@@ -118,12 +118,12 @@
data-form="{{ {operation: reply_post_op, psid: doc._id}|json }}"
><span class="icon icon-reply"></span></a>
{% endif %}
{% if (handler.user.hasPerm(comment_edit_self_perm) and doc.owner == handler.user._id) or handler.user.hasPerm(comment_edit_perm) %}
{% if (handler.user.hasPerm(comment_edit_self_perm) and handler.user.own(doc)) or handler.user.hasPerm(comment_edit_perm) %}
<a href="javascript:;" data-tooltip="{{ _('Edit') }}" name="dczcomments__op-edit-comment"
data-form="{{ {operation: comment_edit_op, psid: doc._id}|json }}"
><span class="icon icon-edit"></span></a>
{% endif %}
{% if (handler.user.hasPerm(comment_delete_self_perm) and doc.owner == handler.user._id) or handler.user.hasPerm(comment_delete_perm) %}
{% if (handler.user.hasPerm(comment_delete_self_perm) and handler.user.own(doc)) or handler.user.hasPerm(comment_delete_perm) %}
<a href="javascript:;" data-tooltip="{{ _('Delete') }}" name="dczcomments__op-delete-comment"
data-form="{{ {operation: comment_delete_op, psid: doc._id}|json }}"
><span class="icon icon-delete"></span></a>
@@ -148,12 +148,12 @@
{% 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 (handler.user.hasPerm(reply_edit_self_perm) and doc.owner == handler.user._id) or handler.user.hasPerm(reply_edit_perm) %}
{% if (handler.user.hasPerm(reply_edit_self_perm) and handler.user.own(doc)) 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 (handler.user.hasPerm(reply_delete_self_perm) and doc.owner == handler.user._id) or handler.user.hasPerm(reply_delete_perm) %}
{% if (handler.user.hasPerm(reply_delete_self_perm) and handler.user.own(doc)) 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>
@@ -79,7 +79,7 @@
<button type="submit" class="rounded primary button">
{{ _('Update') }}
</button>
{% if tdoc.owner == handler.user._id or handler.user.hasPerm(perm.PERM_EDIT_CONTEST) %}
{% if handler.user.own(tdoc) or handler.user.hasPerm(perm.PERM_EDIT_CONTEST) %}
<button name="operation" value="delete" type="submit" class="rounded button">
{{ _('Delete') }}
</button>
@@ -29,7 +29,7 @@
</div>
</div>
<ul class="section__footer supplementary dot list">
{% if handler.user.hasPerm(perm.PERM_EDIT_DISCUSSION) or (ddoc.owner == handler.user._id and handler.user.hasPerm(perm.PERM_EDIT_DISCUSSION_SELF)) %}
{% if handler.user.hasPerm(perm.PERM_EDIT_DISCUSSION) or (handler.user.own(ddoc) and handler.user.hasPerm(perm.PERM_EDIT_DISCUSSION_SELF)) %}
<li>
<a href="{{ url('discussion_edit', did=ddoc.docId) }}"><span class="icon icon-edit"></span> {{ _('Edit') }}</a>
</li>
@@ -71,12 +71,12 @@
reply_delete_op = 'delete_tail_reply',
comment_post_perm = perm.PERM_REPLY_DISCUSSION,
comment_edit_perm = perm.PERM_NEVER,
comment_delete_perm = perm.PERM_DELETE_DISCUSSION_REPLY_SELF_DISCUSSION if ddoc.owner == handler.user._id else perm.PERM_DELETE_DISCUSSION_REPLY,
comment_delete_perm = perm.PERM_DELETE_DISCUSSION_REPLY_SELF_DISCUSSION if handler.user.own(ddoc) else perm.PERM_DELETE_DISCUSSION_REPLY,
comment_edit_self_perm = perm.PERM_EDIT_DISCUSSION_REPLY_SELF,
comment_delete_self_perm = perm.PERM_DELETE_DISCUSSION_REPLY_SELF,
reply_post_perm = perm.PERM_REPLY_DISCUSSION,
reply_edit_perm = perm.PERM_NEVER,
reply_delete_perm = perm.PERM_DELETE_DISCUSSION_REPLY_SELF_DISCUSSION if ddoc.owner == handler.user._id else perm.PERM_DELETE_DISCUSSION_REPLY,
reply_delete_perm = perm.PERM_DELETE_DISCUSSION_REPLY_SELF_DISCUSSION if handler.user.own(ddoc) else perm.PERM_DELETE_DISCUSSION_REPLY,
reply_edit_self_perm = perm.PERM_EDIT_DISCUSSION_REPLY_SELF,
reply_delete_self_perm = perm.PERM_DELETE_DISCUSSION_REPLY_SELF
) }}
@@ -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.user.hasPerm(perm.PERM_DELETE_DISCUSSION) %}
{% if handler.user.own(ddoc) or handler.user.hasPerm(perm.PERM_DELETE_DISCUSSION) %}
<button name="operation" value="delete" type="submit" class="rounded button">
{{ _('Delete') }}
</button>
@@ -85,7 +85,7 @@
<button type="submit" class="rounded primary button">
{{ _('Update') }}
</button>
{% if tdoc.owner == handler.user._id or handler.user.hasPerm(perm.PERM_EDIT_HOMEWORK) %}
{% if handler.user.own(tdoc) or handler.user.hasPerm(perm.PERM_EDIT_HOMEWORK) %}
<button name="operation" value="delete" type="submit" class="rounded button">
{{ _('Delete') }}
</button>
@@ -52,7 +52,7 @@
<span class="icon icon-statistics"></span> {{ _('Scoreboard (Hidden)') }}
</a></li>
{% endif %}
{% if user._id == tdoc.owner or handler.user.hasPerm(perm.PERM_EDIT_CONTEST) %}
{% if handler.user.own(tdoc) 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>
@@ -52,7 +52,7 @@
<span class="icon icon-statistics"></span> {{ _('Scoreboard (Hidden)') }}
</a></li>
{% endif %}
{% if tdoc.owner == handler.user._id or handler.user.hasPerm(perm.PERM_EDIT_HOMEWORK) %}
{% if handler.user.own(tdoc) 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>
@@ -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.user.hasPerm(perm.PERM_EDIT_PROBLEM) %}
{% if handler.user.own(pdoc) 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|default(pdoc.docId)) }}">
<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.user.hasPerm(perm.PERM_EDIT_PROBLEM) %}
{% if handler.user.own(pdoc) 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|default(pdoc.docId)) }}">
<span class="icon icon-edit"></span> {{ _('Edit') }}
@@ -78,13 +78,13 @@
<li class="menu__item"><a class="menu__link{% if page_name == 'problem_files' %} active{% endif %}" href="{{ url('problem_files', pid=pdoc.pid|default(pdoc.docId)) }}">
<span class="icon icon-file"></span> {{ _('Files') }}
</a></li>
{% if (handler.user._id == pdoc.owner and handler.user.hasPerm(perm.PERM_EDIT_PROBLEM_SELF)) or handler.user.hasPerm(perm.PERM_EDIT_PROBLEM) %}
{% if (handler.user.own(pdoc) and handler.user.hasPerm(perm.PERM_EDIT_PROBLEM_SELF)) 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|default(pdoc.docId)) }}">
<span class="icon icon-edit"></span> {{ _('Edit') }}
</a></li>
{% endif %}
{% if page_name == 'problem_detail' and (handler.user._id == pdoc.owner or handler.user.hasPerm(perm.PERM_READ_PROBLEM_DATA)) %}
{% if page_name == 'problem_detail' and (handler.user.own(pdoc) or handler.user.hasPerm(perm.PERM_READ_PROBLEM_DATA)) %}
<div style="display: none" class="dialog__body--send-to">
<div>
<div class="row"><div class="columns">
@@ -68,7 +68,7 @@
<button type="submit" class="rounded primary button">
{{ _('Update') }}
</button>
{% if pdoc.owner == handler.user._id or handler.user.hasPerm(perm.PERM_EDIT_PROBLEM) %}
{% if handler.user.own(pdoc) or handler.user.hasPerm(perm.PERM_EDIT_PROBLEM) %}
<button name="operation" value="delete" type="submit" class="rounded button">
{{ _('Delete') }}
</button>
@@ -6,7 +6,7 @@
<div class="section__header">
<h1 class="section__title">{{ _('Testdata') }}</h1>
<div class="section__tools">
{% if handler.user._id == pdoc.owner or handler.user.hasPerm(perm.PERM_EDIT_PROBLEM) %}
{% if handler.user.own(pdoc) or handler.user.hasPerm(perm.PERM_EDIT_PROBLEM) %}
<button class="primary rounded button" name="upload_testdata">{{ _('Add File') }}</button>
{% endif %}
</div>
@@ -48,14 +48,14 @@
</tbody>
</table>
{% else %}
{% if handler.user._id == pdoc.owner or handler.user.hasPerm(perm.PERM_READ_PROBLEM_DATA) %}
{% if handler.user.own(pdoc) or handler.user.hasPerm(perm.PERM_READ_PROBLEM_DATA) %}
{{ nothing.render('No testdata at current.') }}
{% else %}
{{ nothing.render("You don't have permission to read testdata.")}}
{% endif %}
{% endif %}
</div>
{% if handler.user._id == pdoc.owner or handler.user.hasPerm(perm.PERM_EDIT_PROBLEM) %}
{% if handler.user.own(pdoc) or handler.user.hasPerm(perm.PERM_EDIT_PROBLEM) %}
{% if testdata.length %}
<div class="section__body">
<button class="rounded button" name="download_selected_testdata">{{ _('Download Selected') }}</button>
@@ -70,7 +70,7 @@
<div class="section__header">
<h1 class="section__title">{{ _('Additional Files') }}</h1>
<div class="section__tools">
{% if handler.user._id == pdoc.owner or handler.user.hasPerm(perm.PERM_EDIT_PROBLEM) %}
{% if handler.user.own(pdoc) or handler.user.hasPerm(perm.PERM_EDIT_PROBLEM) %}
<button class="primary rounded button" name="upload_file">{{ _('Add File') }}</button>
{% endif %}
</div>
@@ -117,7 +117,7 @@
{% if additional_file.length %}
<div class="section__body">
<button class="rounded button" name="download_selected_file">{{ _('Download Selected') }}</button>
{% if handler.user._id == pdoc.owner or handler.user.hasPerm(perm.PERM_EDIT_PROBLEM) %}
{% if handler.user.own(pdoc) or handler.user.hasPerm(perm.PERM_EDIT_PROBLEM) %}
<button class="rounded button" name="remove_selected_file">{{ _('Remove Selected') }}</button>
{% endif %}
</div>
@@ -171,7 +171,7 @@
</form>
</li>
{% endif %}
{% if tdoc.owner == user._id or handler.user.hasPerm(perm.PERM_EDIT_TRAINING) %}
{% if handler.user.own(tdoc) 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>
@@ -38,7 +38,7 @@
<button type="submit" class="rounded primary button">
{{ _('Update') }}
</button>
{% if tdoc.owner == handler.user._id or handler.user.hasPerm(perm.PERM_EDIT_TRAINING) %}
{% if handler.user.own(tdoc) or handler.user.hasPerm(perm.PERM_EDIT_TRAINING) %}
<button name="operation" value="delete" type="submit" class="rounded button">
{{ _('Delete') }}
</button>