NDOJ/templates/submission/status.html

146 lines
5 KiB
HTML
Raw Normal View History

2020-01-21 06:35:58 +00:00
{% extends "submission/info-base.html" %}
2022-08-19 03:47:41 +00:00
{% block media %}
<style>
.line {
position: relative;
}
.highlighter {
position: absolute;
width: 9999px;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
a:active .line .highlighter {
background: rgba(255, 212, 0, 0.48);
}
.copy-clipboard {
margin-top: 0;
}
.testcases-table tbody:last-child {
border-bottom: none;
}
2022-08-19 04:26:30 +00:00
.toggle {
cursor: pointer;
font-weight: 400;
}
#source-header {
font-size: 1.54em;
margin-bottom: 1em;
}
2022-08-19 03:47:41 +00:00
</style>
{% endblock %}
{% block content_js_media %}
2020-01-21 06:35:58 +00:00
<script type="text/javascript" src="{{ static('event.js') }}"></script>
{% if not submission.is_graded and last_msg %}
<script type="text/javascript">$(function () {
var blocked = false, request = false;
var list = $('#test-cases');
function update() {
if (blocked) {
request = true;
return;
}
request = false;
blocked = true;
$.ajax({
url: '{{ url('submission_testcases_query') }}',
data: {id: '{{ submission.id }}'}
}).done(function (data) {
list.empty().html(data).find('.toggle').each(function () {
register_toggle($(this));
});
setTimeout(function () {
blocked = false;
if (request)
update();
}, 500);
}).fail(function (data) {
console.log('Failed to update testcases!');
});
if ($(window).scrollTop() + $(window).height() > $(document).height() - 100)
$("html, body").animate({scrollTop: $(document).height()}, 0);
}
2022-08-19 04:26:30 +00:00
register_toggle($('#source-header'));
2020-01-21 06:35:58 +00:00
var receiver = new EventReceiver(
"{{ EVENT_DAEMON_LOCATION }}", "{{ EVENT_DAEMON_POLL_LOCATION }}",
['sub_{{ submission.id_secret }}'], {{ last_msg }}, function (message) {
switch (message.type) {
case 'internal-error':
case 'grading-end':
case 'compile-error':
$('#abort-button').remove();
$('#grading-label').remove();
case 'test-case':
case 'grading-begin':
case 'processing':
update();
}
}
)
});
</script>
{% endif %}
{% endblock %}
{% block body %}
2022-07-05 06:03:15 +00:00
<div style="clear: both"></div>
2020-01-21 06:35:58 +00:00
<br>
{% if request.user == submission.user.user or perms.judge.resubmit_other %}
<div><a href="{{ url('problem_submit', submission.problem.code, submission.id) }}">{{ _('Resubmit') }}</a></div>
{% endif %}
{% if perms.judge.rejudge_submission %}
<div>
<form action="{{ url('submission_rejudge') }}" method="post">
{% csrf_token %}
<a href="#" onclick="parentNode.submit()">{{ _('Rejudge') }}</a>
<input type="hidden" name="id" value="{{ submission.id }}">
<input type="hidden" name="path" value="{{ url('submission_status', submission.id) }}">
</form>
</div>
{% endif %}
<br>
2022-08-19 04:26:30 +00:00
<h3 id="source-header" class="toggle closed"><i class="fa fa-chevron-right fa-fw"></i>{{_('Source code')}}</h3>
<div class="source-wrap toggled" style="display: none; margin-bottom: 1em">
2022-08-19 03:47:41 +00:00
<table style="width: 100%">
<tr>
<td class="source-ln" style="width: 0">
<div>
{% for line in raw_source.split('\n') %}
<a href="#line-{{ loop.index }}" name="line-{{ loop.index }}">
<pre class="line">{{ loop.index }}</pre>
</a>
{% endfor %}
</div>
</td>
<td class="source-code">{{ highlighted_source }}</td>
</tr>
</table>
</div>
2020-01-21 06:35:58 +00:00
<div id="test-cases">{% include "submission/status-testcases.html" %}</div>
{% if not submission.is_graded %}
2020-12-01 23:18:17 +00:00
{% if perms.judge.abort_any_submission %}
2020-01-21 06:35:58 +00:00
<div id="abort-button">
<br>
<hr>
2020-01-21 06:35:58 +00:00
<br>
<form action="{{ url('submission_abort', submission.id) }}" method="post">
{% csrf_token %}
<input style="float:left" type="submit" value="{{ _('Abort') }}" class="button">
<br><br>
</form>
</div>
{% endif %}
{% endif %}
{% endblock %}