NDOJ/templates/submission/status.html

177 lines
4.9 KiB
HTML
Raw Permalink 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 %}
2023-01-27 23:11:10 +00:00
<style>
.line {
position: relative;
}
2022-08-19 03:47:41 +00:00
2023-01-27 23:11:10 +00:00
.highlighter {
position: absolute;
width: 9999px;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
2022-08-19 03:47:41 +00:00
2023-01-27 23:11:10 +00:00
a:active .line .highlighter {
background: rgba(255, 212, 0, 0.48);
}
2022-08-19 03:47:41 +00:00
2023-01-27 23:11:10 +00:00
.copy-clipboard {
margin-top: 0;
}
2022-08-19 03:47:41 +00:00
2023-01-27 23:11:10 +00:00
.testcases-table tbody:last-child {
border-bottom: none;
}
2022-08-19 04:26:30 +00:00
2023-01-27 23:11:10 +00:00
.toggle {
cursor: pointer;
font-weight: 400;
}
2022-08-19 04:26:30 +00:00
2023-01-27 23:11:10 +00:00
#source-header {
font-size: 1.54em;
margin-bottom: 1em;
}
2022-08-23 04:30:41 +00:00
2023-01-27 23:11:10 +00:00
.case-icons i {
font-size: large;
font-weight: bolder;
cursor: pointer;
}
@media(max-width: 799px) {
.source-ln {
display: none;
}
.source-code {
-webkit-text-size-adjust: none;
padding-left: 0;
}
.source-wrap {
padding: 0.7em;
}
}
</style>
2022-08-19 03:47:41 +00:00
{% endblock %}
{% block content_js_media %}
2023-01-27 23:11:10 +00:00
<script type="text/javascript" src="{{ static('event.js') }}"></script>
<script type="text/javascript">
function setup_icons() {
$(".case-icons i").each(function() {
$(this).on("click", function() {
var id = "tr#" + $(this).attr("id").split("-")[1];
$(id).click();
$([document.documentElement, document.body]).animate({
scrollTop: $(id).offset().top - 50
}, 800);
2022-08-23 04:34:22 +00:00
});
2023-01-27 23:11:10 +00:00
});
}
$(function() {
setup_icons();
});
</script>
{% if not submission.is_graded and last_msg %}
<script type="text/javascript">$(function () {
var blocked = false, request = false;
var list = $('#test-cases');
2020-01-21 06:35:58 +00:00
2023-01-27 23:11:10 +00:00
function update() {
if (blocked) {
request = true;
return;
}
request = false;
blocked = true;
$.ajax({
url: '{{ url('submission_testcases_query') }}',
data: {id: '{{ submission.id }}'}
}).done(function (data) {
data = $(data);
list.find(".open").each(function() {
var id = $(this).attr("id");
data.find("#" + id).removeClass("closed").addClass("open");
data.find("#" + id + "-output").show();
});
list.empty().html(data).find('.toggle').each(function () {
register_toggle($(this));
});
setup_icons();
setTimeout(function () {
blocked = false;
if (request)
update();
}, 500);
}).fail(function (data) {
console.log('Failed to update testcases!');
});
2020-01-21 06:35:58 +00:00
2023-01-27 23:11:10 +00:00
if ($(window).scrollTop() + $(window).height() > $(document).height() - 100)
$("html, body").animate({scrollTop: $(document).height()}, 0);
}
2020-01-21 06:35:58 +00:00
2023-01-27 23:11:10 +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 %}
2020-01-21 06:35:58 +00:00
{% endblock %}
{% block body %}
2023-01-27 23:11:10 +00:00
<div style="clear: both"></div>
<br>
<div style="width: fit-content;">
{% if request.profile == submission.user or perms.judge.resubmit_other %}
<div class="link-row"><a href="{{ url('problem_submit', submission.problem.code, submission.id) }}">
<i class="fa fa-upload"></i>{{ _('Resubmit') }}</a></div>
{% endif %}
{% if perms.judge.rejudge_submission %}
<div class="link-row">
<form action="{{ url('submission_rejudge') }}" method="post">
{% csrf_token %}
<a href="#" onclick="parentNode.submit()">
<i class="fa fa-rotate-right"></i>{{ _('Rejudge') }}</a>
<input type="hidden" name="id" value="{{ submission.id }}">
<input type="hidden" name="path" value="{{ url('submission_status', submission.id) }}">
</form>
</div>
{% endif %}
</div>
2023-01-27 23:11:10 +00:00
<br>
<h3 id="source-header" class="toggle closed"><i class="fa fa-chevron-right fa-fw"></i>{{_('Source code')}}</h3>
2024-01-19 01:46:41 +00:00
<div class="toggled" style="display: none; margin-bottom: 1em">
{{ highlighted_source }}
2023-01-27 23:11:10 +00:00
</div>
2020-01-21 06:35:58 +00:00
2023-01-27 23:11:10 +00:00
<div id="test-cases">{% include "submission/status-testcases.html" %}</div>
{% if not submission.is_graded %}
{% if perms.judge.abort_any_submission %}
<div id="abort-button">
<br>
<hr>
<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>
2020-01-21 06:35:58 +00:00
{% endif %}
2023-01-27 23:11:10 +00:00
{% endif %}
2020-01-21 06:35:58 +00:00
{% endblock %}