core: pass pdoc with UiContext

This commit is contained in:
undefined committed 2021-05-17 12:29:40 +08:00
1 parent ec83da1080
commit 19e14fc90f
7 files changed
+23 -26

No files matched your search

@@ -27,7 +27,11 @@
</label>
</td>
<td class="col--name">
<a href="{{ url('problem_file_download', {pid: pdoc.docId, filename: file.name, query:{type:'testdata'} }) }}">{{ file.name }}</a>
{% if handler.user.own(pdoc) or handler.user.hasPriv(PRIV.PRIV_READ_PROBLEM_DATA) or handler.user.hasPerm(perm.PERM_READ_PROBLEM_DATA) %}
<a href="{{ url('problem_file_download', {pid: pdoc.docId, filename: file.name, query:{type:'testdata'} }) }}">{{ file.name }}</a>
{% else %}
<p>{{ file.name }}</p>
{% endif %}
</td>
<td class="col--size">{{ size(file.size) }}</td>
</tr>
@@ -35,10 +39,6 @@
</tbody>
</table>
{% else %}
{% if handler.user.own(pdoc) or handler.user.hasPriv(PRIV.PRIV_READ_PROBLEM_DATA) 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 %}
{{ nothing.render('No testdata at current.') }}
{% endif %}
</div>
@@ -105,7 +105,7 @@
</ol>
</div>
</div>
{% if page_name != 'problem_detail' %}
{% if page_name != 'problem_detail' and page_name != 'homework_detail_problem' %}
<div class="section side">
<div class="section__header">
<h1 class="section__title">{{ _('Information') }}</h1>
@@ -9,7 +9,8 @@
postPretestUrl: url('problem_pretest', pid=pdoc.docId),
pretestConnUrl: "/conn/pretest?pid=" + pdoc.pid|default(pdoc.docId) + "&domainId=" + handler.domainId,
codeLang: handler.user.codeLang,
codeTemplate: handler.user.codeTemplate
codeTemplate: handler.user.codeTemplate,
pdoc: pdoc
}) }}
{% if tdoc %}
{{ set(UiContext, 'postSubmitUrl', url('contest_detail_problem_submit' if tdoc.docType == model.document.TYPE_CONTEST else 'homework_detail_problem_submit', pid=pdoc.docId, tid=tdoc.docId)) }}