core: use rdoc.source & pdoc.reference

This commit is contained in:
undefined committed 2021-10-24 18:28:35 +08:00
1 parent 465a80d617
commit 4aa689b508
24 files changed
+250 -250

No files matched your search

@@ -24,12 +24,18 @@
background: #F0F0F0;
}
</style>
<h2>{{ tdoc.title }}</h2>
Exported from <a href="{{ model.system.get('server.url') }}">{{ model.system.get('server.url') }}</a>
<table>
<thead>
<tr>
{%- for column in rows[0] -%}
<th class="col--{{ column['type'] }}">
{{ column['value'] }}
{% if column.type == 'problem_detail' %}
<a href="{{ model.system.get('server.url') }}{{ url(type + '_detail_problem', tid=tdoc.docId, pid=column.raw).substr(1,9999) }}">{{ column.value }}</a>
{% else %}
{{ column.value }}
{% endif %}
</th>
{%- endfor -%}
</tr>
@@ -39,7 +45,24 @@
<tr>
{%- for column in row -%}
<td>
{{ column['value'] }}
{% if column.type == 'record' and column.raw %}
<a href="{{ model.system.get('server.url') }}{{ url('record_detail', rid=column.raw).substr(1,9999) }}">
<span style="font-weight:bold;color:{{ utils.status.getScoreColor(column.score|default(column.value)) }}">{{ column.value|replaceBr|safe }}</span>
</a>
{% elif column.type == 'records' %}
{%- for record in column.raw -%}
{% if loop.index0 %}/{% endif %}
{% if record.raw %}
<a href="{{ model.system.get('server.url') }}{{ url('record_detail', rid=record.raw).substr(1,9999) }}">
<span style="font-weight:bold;color:{{ utils.status.getScoreColor(record.score|default(record.value)) }}">{{ record.value|replaceBr|safe }}</span>
</a>
{% else %}
{{ record.value|replaceBr|safe }}
{% endif %}
{%- endfor -%}
{% else %}
{{ column.value|replaceBr|safe }}
{% endif %}
</td>
{%- endfor -%}
</tr>
@@ -1,6 +1,10 @@
{% import "components/nothing.html" as nothing with context %}
<div class="section__body no-padding problem-files-testdata" data-fragment-id="problem-files-testdata">
{% if testdata.length %}
{% if reference %}
<blockquote class="note">
<p>{{ _('This is a copy of another problem.') }}</p>
</blockquote>
{% elif testdata.length %}
<table class="data-table">
<colgroup>
<col class="col--checkbox">
@@ -24,8 +24,7 @@
<span class="icon icon-send"></span> {{ _('Submit') }}
</a></li>
{% elif model.contest.isDone(tdoc) %}
{% set _docId = pdoc.docId.toString() %}
<li class="menu__item scratchpad--hide"><a class="menu__link" href="{{ url('problem_detail', pid=_docId.split(':')[1], domainId=_docId.split(':')[0]) if _docId.includes(':') else url('problem_detail', pid=pdoc.docId) }}">
<li class="menu__item scratchpad--hide"><a class="menu__link" href="{{ url('problem_detail', pid=pdoc.docId) }}">
<span class="icon icon-send"></span> {{ _('Open in Problem Set') }}
</a></li>
{% endif %}
@@ -24,8 +24,7 @@
<span class="icon icon-send"></span> {{ _('Submit') }}
</a></li>
{% elif model.contest.isDone(tdoc) %}
{% set _docId = pdoc.docId.toString() %}
<li class="menu__item scratchpad--hide"><a class="menu__link" href="{{ url('problem_detail', pid=_docId.split(':')[1], domainId=_docId.split(':')[0]) if _docId.includes(':') else url('problem_detail', pid=pdoc.docId) }}">
<li class="menu__item scratchpad--hide"><a class="menu__link" href="{{ url('problem_detail', pid=pdoc.docId) }}">
<span class="icon icon-send"></span> {{ _('Open in Problem Set') }}
</a></li>
{% endif %}
@@ -76,7 +76,7 @@
<h1 class="section__title">{{ pdoc.title }}</h1>
</div>
<div class="section__body typo">
{% if not pdoc.data.length %}
{% if not pdoc.data.length and not pdoc.reference %}
<blockquote class="warn">
<p>{{ _('No testdata at current.') }}</p>
</blockquote>
@@ -6,7 +6,7 @@
<div class="section__header">
<h1 class="section__title">{{ _('Testdata') }}</h1>
<div class="section__tools">
{% if handler.user.own(pdoc, perm.PERM_EDIT_PROBLEM_SELF) or handler.user.hasPerm(perm.PERM_EDIT_PROBLEM) %}
{% if not reference and (handler.user.own(pdoc, perm.PERM_EDIT_PROBLEM_SELF) or handler.user.hasPerm(perm.PERM_EDIT_PROBLEM)) %}
<button class="primary rounded button" name="create_testdata">{{ _('Create File') }}</button>
<button class="primary rounded button" name="upload_testdata">{{ _('Upload File') }}</button>
{% endif %}
@@ -14,7 +14,7 @@
</div>
{{ noscript_note.render() }}
{% include "partials/problem_files-testdata.html" %}
{% if handler.user.own(pdoc) or handler.user.hasPerm(perm.PERM_READ_PROBLEM_DATA) or handler.user.hasPriv(PRIV.PRIV_READ_PROBLEM_DATA) %}
{% if not reference and (handler.user.own(pdoc) or handler.user.hasPerm(perm.PERM_READ_PROBLEM_DATA) or handler.user.hasPriv(PRIV.PRIV_READ_PROBLEM_DATA)) %}
<div class="section__body">
<button class="rounded button" name="download_selected_testdata">{{ _('Download Selected') }}</button>
{% if handler.user.own(pdoc, perm.PERM_EDIT_PROBLEM_SELF) or handler.user.hasPerm(perm.PERM_EDIT_PROBLEM) %}
@@ -92,7 +92,7 @@
<tbody>
{%- for rdoc in rdocs -%}
{% set udoc = udict[rdoc['uid']] %}
{% set pdoc = pdict[rdoc['pid']] or pdict[rdoc.pdomain + ':' + rdoc.pid] %}
{% set pdoc = pdict[rdoc['pid']] %}
{% include 'record_main_tr.html' %}
{%- endfor -%}
</tbody>