Merge branch 'LQDJudge:master' into master

This commit is contained in:
pcthuoc 2024-06-22 16:38:36 +07:00 committed by GitHub
commit ff9b86ea13
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2370 changed files with 30872 additions and 13914 deletions

View file

@ -6,36 +6,38 @@
window.big_input = (window.valid_files.length > 100);
</script>
<script type="text/javascript" src="{{ static('jquery-ui.min.js') }}"></script>
<script type="text/javascript" src="{{ static('libs/featherlight/featherlight.min.js') }}"></script>
<script type="text/javascript" src="{{ static('fine-uploader/jquery.fine-uploader.js') }}"></script>
<script type="text/javascript">
$(function () {
$("#problem-data-zipfile_fine_uploader").fineUploader({
request: {
endpoint: "{{url('problem_zip_upload', problem.code)}}",
params: {
'csrfmiddlewaretoken': '{{ csrf_token }}'
if (!window.PAGE_FROM_BACK_BUTTON_CACHE) {
$("#problem-data-zipfile_fine_uploader").fineUploader({
request: {
endpoint: "{{url('problem_zip_upload', problem.code)}}",
params: {
'csrfmiddlewaretoken': '{{ csrf_token }}'
}
},
chunking: {
enabled: true,
partSize: 40000000,
},
resume: {
enabled: true
},
validation: {
allowedExtensions: ['zip'],
},
}).on('complete', function (event, id, name, responseJSON) {
console.log(responseJSON);
if (!responseJSON.success) {
alert('Fail to upload: ' + responseJSON.error);
}
},
chunking: {
enabled: true,
partSize: 40000000,
},
resume: {
enabled: true
},
validation: {
allowedExtensions: ['zip'],
},
}).on('complete', function (event, id, name, responseJSON) {
console.log(responseJSON);
if (!responseJSON.success) {
alert('Fail to upload: ' + responseJSON.error);
}
else {
$('#submit-button').click();
}
});;
else {
$('#submit-button').click();
}
});
toggle_custom();
}
function update_select2() {
$('tbody:not(.extra-row-body) .type-column select').select2({
@ -133,11 +135,11 @@
}).change();
}
(function toggle_custom() {
function toggle_custom() {
let $checker = $('#id_problem-data-checker')
let $custom_checker = $('#id_problem-data-custom_checker');
let $validator = $('#id_problem-data-custom_validator');
let $validator = $('#id_problem-data-custom_checker_cpp');
let $interactive = $('#id_problem-data-interactive_judge');
let $sig_handler = $('#id_problem-data-signature_handler');
let $sig_header = $('#id_problem-data-signature_header');
@ -165,17 +167,17 @@
$checker.change(function () {
$tr_checker.toggle($checker.val() == 'custom').change();
$tr_validator.toggle($checker.val() == 'customval' || $checker.val() == 'testlib').change();
$tr_validator.toggle($checker.val() == 'customcpp' || $checker.val() == 'testlib').change();
$tr_interactive.toggle($checker.val() == 'interact').change();
$sample.toggle(['custom', 'customval', 'interact'].includes($checker.val())).change();
$sample.toggle(['custom', 'customcpp', 'interact'].includes($checker.val())).change();
}).change();
$ioi_signature.change(function() {
$tr_sig_header.toggle($ioi_signature.is(':checked')).change();
$tr_sig_handler.toggle($ioi_signature.is(':checked')).change();
}).change();
})();
};
checker_precision($('#id_problem-data-checker'));

View file

@ -27,7 +27,9 @@
<p>Authors: {{ link_users(authors) }}</p>
{% endif %}
{% endwith %}
{{ solution.content|markdown|reference|str|safe }}
{% cache 86400 'solution_content' solution.id %}
{{ solution.content|markdown(lazy_load=True)|reference|str|safe }}
{% endcache %}
</div>
<hr>
{% include "actionbar/list.html" %}
@ -36,8 +38,5 @@
{% endblock %}
{% block bodyend %}
{% if REQUIRE_JAX %}
{% include "mathjax-load.html" %}
{% endif %}
{% include "comments/math.html" %}
{% endblock %}

View file

@ -7,7 +7,7 @@
{% endblock %}
{% block middle_content %}
<div class="tabs tabs-no-flex" style="width: 90%;margin-left: auto;margin-right: auto;">
<div class="tabs tabs-no-flex">
<ul>
<li class="{{'active' if feed_type=='for_you'}}">
<a href="{{url('problem_feed')}}">{{_('FOR YOU')}}</a>
@ -27,5 +27,5 @@
<li><a href="{{url('admin:judge_volunteerproblemvote_changelist')}}">{{_('View your votes')}}</a></li>
</ul>
{% endif %}
{% include "problem/feed/problems.html" %}
{% include "problem/feed/items.html" %}
{% endblock %}

View file

@ -12,10 +12,10 @@
<i class="unsolved-problem-color fa fa-minus-circle"></i>
{% endif %}
</h3>
{% with authors=problem.authors.all() %}
{% with authors=problem.get_authors() %}
{% if authors %}
<div class="problem-feed-info-entry">
<i class="fa fa-pencil-square-o fa-fw"></i>
<i class="far fa-pen-to-square"></i>
<span class="pi-value">{{ link_users(authors) }}</span>
</div>
{% endif %}
@ -30,7 +30,7 @@
{% endif %}
<div class="blog-description">
<div class='content-description'>
{% cache 86400 'problem_html' problem.id MATH_ENGINE LANGUAGE_CODE %}
{% cache 86400 'problem_html' problem.id LANGUAGE_CODE %}
{{ problem.description|markdown(lazy_load=True)|reference|str|safe }}
{% endcache %}
{% if problem.pdf_description %}

View file

@ -1,9 +1,9 @@
{% if not show_contest_mode %}
<div class="left-sidebar">
{{ make_tab_item('feed', 'fa fa-pagelines', url('problem_feed'), _('Feed')) }}
{{ make_tab_item('feed', 'far fa-lightbulb', url('problem_feed'), _('Feed')) }}
{{ make_tab_item('list', 'fa fa-list', url('problem_list'), _('List')) }}
{% if request.user.is_superuser %}
{{ make_tab_item('admin', 'fa fa-edit', url('admin:judge_problem_changelist'), _('Admin')) }}
{{ make_tab_item('admin', 'fa fa-edit', url('admin:judge_problem_changelist'), _('Admin'), force_new_page=True) }}
{% endif %}
</div>
{% endif %}

View file

@ -86,12 +86,17 @@
}
$category.select2().css({'visibility': 'visible'}).change(clean_submit);
$('#types').select2({multiple: 1, placeholder: '{{ _('Filter by type...') }}'})
.css({'visibility': 'visible'});
$('#search-org').select2({multiple: 1, placeholder: '{{ _('Groups') }}...'})
.css({'visibility': 'visible'});
$('#search-author').select2({multiple: 1, placeholder: '{{ _('Authors') }}...'})
.css({'visibility': 'visible'});
$('#types').select2({multiple: 1, placeholder: '{{ _('Filter by type...') }}'});
$('#search-org').select2({multiple: 1, placeholder: '{{ _('Groups') }}...'});
$('#search-author').select2({
multiple: 1,
placeholder: '{{ _('Authors') }}...',
ajax: {
url: '{{ url('problem_authors_select2_ajax') }}',
delay: 250,
cache: true,
}
});
// This is incredibly nasty to do but it's needed because otherwise the select2 steals the focus
$search.keypress(function (e) {
@ -108,7 +113,7 @@
$('#go').click(clean_submit);
$('input#full_text, input#hide_solved, input#show_types, input#have_editorial, input#show_solved_only').click(function () {
$('input#full_text, input#hide_solved, input#show_types, input#have_editorial, input#show_solved_only, input#show_editorial').click(function () {
prep_form();
($('<form>').attr('action', window.location.pathname + '?' + form_serialize())
.append($('<input>').attr('type', 'hidden').attr('name', 'csrfmiddlewaretoken')
@ -149,8 +154,7 @@
$(".edit-btn").on('click', function() {
var pid = $(this).attr('pid');
$('#volunteer-types-' + pid).css({'width': '100%'});
$('#volunteer-types-' + pid).select2({multiple: 1, placeholder: '{{ _('Add types...') }}'})
.css({'visibility': 'visible'});
$('#volunteer-types-' + pid).select2({multiple: 1, placeholder: '{{ _('Add types...') }}'});
$('#form-' + pid).show();
$('#submit-' + pid).show();

View file

@ -59,6 +59,21 @@
placeholder: '{{ _('Leave empty to not filter by result') }}'
});
$('#by-contest-filter').select2({
multiple: true,
placeholder: '{{ _('Leave empty to not filter by contest') }}',
ajax: {
url: "{{url('contest_select2')}}",
data: function(params) {
return {
term: params.term,
problem_id: {{problem.id}}
};
},
delay: 250,
}
});
$('#rescore-all').click(function (e) {
e.preventDefault();
if (confirm(this.dataset.warning)) {
@ -157,10 +172,14 @@
{% endfor %}
</select>
</div>
{% if in_contest %}
<label for="in-contest" name="in_contest">{{ _('In current contest') }}:</label>
<input type="checkbox" name="in_contest">
{% endif %}
<div class="control-group">
<label for="by-contest-filter">{{ _('Filter by contest:') }}</label>
<select id="by-contest-filter" name="contest" multiple>
{% if current_contest %}
<option selected value="{{current_contest.id}}">{{ current_contest }}</option>
{% endif %}
</select>
</div>
</form>
</div>
<div class="pane">

View file

@ -1,4 +1 @@
{{ preview_data|markdown|reference|str|safe }}
{% if REQUIRE_JAX %}
<div data-config="{{ static('mathjax3_config.js') }}" class="require-mathjax-support"></div>
{% endif %}
{{ preview_data|markdown|reference|str|safe }}

View file

@ -1,4 +1,7 @@
{% extends "common-content.html" %}
{% set has_hidden_subtasks = request.in_contest_mode and request.participation.contest.format.has_hidden_subtasks %}
{% block content_media %}
{% include "comments/media-css.html" %}
<style>
@ -62,11 +65,17 @@
e.preventDefault();
if (!$('#raw_problem').attr('src')) {
$('#raw_problem').attr('src', '{{problem.code}}/raw')
$('#raw_problem').on('load', function() {
renderKatex(frames['raw_problem'].document);
setTimeout(() => {
frames['raw_problem'].print();
}, 500);
});
}
while(!$('.math-loaded', frames['raw_problem'].document).length){
await new Promise(r => setTimeout(r, 200));
else {
frames['raw_problem'].print();
return;
}
frames['raw_problem'].print();
});
$('#clarification_header').on('click', function() {
$('#clarification_header_container').hide();
@ -86,7 +95,7 @@
{% block title_row %}
<div class="problem-title">
{% if request.user.is_authenticated %}
{% if request.user.is_authenticated and not has_hidden_subtasks %}
{% if problem.id in completed_problem_ids %}
<a href="{{ url('user_submissions', problem.code, request.user.username) }}">
{% if problem.is_public or request.in_contest_mode %}
@ -109,15 +118,10 @@
{% if problem.is_organization_private %}
<span class="organization-tags">
{% for org in problem.organizations.all() %}
<span class="organization-tag">
<a href="{{ org.get_absolute_url() }}">
<i class="fa fa-lock"></i> {{ org.name }}
</a>
</span>
{% include "organization/tag.html" %}
{% endfor %}
</span>
{% endif %}
<span class="spacer"></span>
{% if has_render %}
<a href="{{ url('problem_pdf', problem.code) }}" class="view-pdf" target="_blank">
@ -127,7 +131,7 @@
<a id="pdf_button" class="view-pdf" href='#'>
{% endif %}
<span class="pdf-icon">
<span class="fa fa-file-pdf-o pdf-icon-logo"></span>
<span class="fa fa-file-pdf pdf-icon-logo"></span>
<span class="pdf-icon-bar"></span>
</span>
{{ _('View as PDF') }}
@ -135,11 +139,17 @@
</div>
{% endblock %}
{% block info_float %}
{% if request.user.is_authenticated and request.in_contest_mode and submission_limit %}
{% if submissions_left > 0 %}
<a href="{{ url('problem_submit', problem.code) }}" class="unselectable button full btn-green small">
{{ _('Submit solution') }}
<a href="{{ url('problem_submit', problem.code) }}">
<button class="btn-green btn btn-primary btn-block btn-round">
<span>{{ _('Submit') }}</span>
<div class="icon icon-round d-flex align-items-center justify-content-center">
<i class="fa fa-paper-plane"></i>
</div>
</button>
</a>
<div class="submissions-left">
{% trans trimmed counter=submissions_left %}
@ -149,116 +159,138 @@
{% endtrans %}
</div>
{% else %}
<a class="unselectable button full disabled small">{{ _('Submit solution') }}</a>
<button class="btn btn-disabled btn-block btn-round">
<span>{{ _('Submit') }}</span>
<div class="icon icon-round d-flex align-items-center justify-content-center">
<i class="fa fa-paper-plane"></i>
</div>
</button>
<div class="no-submissions-left submissions-left">{{ _('0 submissions left') }}</div>
{% endif %}
{% else %}
<a href="{{ url('problem_submit', problem.code) }}" class="unselectable button full btn-green small">
{{ _('Submit solution') }}
<a href="{{ url('problem_submit', problem.code) }}">
<button class="btn-green btn btn-primary btn-block btn-round">
<span>{{ _('Submit') }}</span>
<div class="icon icon-round d-flex align-items-center justify-content-center">
<i class="fa fa-paper-plane"></i>
</div>
</button>
</a>
{% endif %}
<hr style="padding-bottom: 0.3em">
{% if request.user.is_authenticated and has_submissions %}
<div>
<a href="{{ url('user_submissions', problem.code, request.user.username) }}">{{ _('My submissions') }}</a>
<div class="link-row">
<a href="{{url('user_submissions', problem.code, request.user.username) }}">
<i class="fa fa-address-book"></i><span> {{ _('My submissions') }}</span>
</a>
</div>
{% endif %}
<div><a href="{{ url('chronological_submissions', problem.code) }}">{{ _('All submissions') }}</a></div>
<div><a href="{{ url('ranked_submissions', problem.code) }}">{{ _('Best submissions') }}</a></div>
{% if editorial and editorial.is_public and
not (request.user.is_authenticated and request.in_contest_mode) %}
<hr>
<div><a href="{{ url('problem_editorial', problem.code) }}">{{ _('Read editorial') }}</a></div>
{% endif %}
{% if can_edit_problem %}
<hr>
<div>
<a href="{{ url('problem_ticket_list', problem.code) }}">{{ _('Manage tickets') }}
{% if num_open_tickets %}<span class="badge">{{ num_open_tickets }}</span>{% endif %}
<div class="link-row">
<a href="{{ url('chronological_submissions', problem.code) }}">
<i class="fa fa-rectangle-list"></i><span> {{ _('All submissions') }}</span>
</a>
</div>
<div><a href="{{ url('admin:judge_problem_change', problem.id) }}">{{ _('Edit problem') }}</a></div>
{% if not problem.is_manually_managed %}
<div><a href="{{ url('problem_data', problem.code) }}">{{ _('Edit test data') }}</a></div>
<div class="link-row">
<a href="{{ url('ranked_submissions', problem.code) }}">
<i class="fa fa-list-check"></i><span> {{ _('Best submissions') }}</span>
</a>
</div>
{% if editorial and editorial.is_public and not (request.user.is_authenticated and request.in_contest_mode) %}
<hr>
<div class="link-row">
<a href="{{ url('problem_editorial', problem.code) }}">
<i class="fa fa-newspaper"></i><span> {{ _('Read editorial') }}</span>
</a>
</div>
{% endif %}
{% elif request.user.is_authenticated and has_tickets %}
<hr>
<div>
<a href="{{ url('problem_ticket_list', problem.code) }}">{{ _('My tickets') }}
{% if num_open_tickets %}<span class="badge">{{ num_open_tickets }}</span>{% endif %}
</a>
</div>
{% endif %}
{% if problem.is_subs_manageable_by(request.user) %}
<div>
<a href="{{ url('problem_manage_submissions', problem.code) }}">{{ _('Manage submissions') }}</a>
</div>
{% endif %}
{% if perms.judge.clone_problem %}
<div>
<a href="{{ url('problem_clone', problem.code) }}">{{ _('Clone problem') }}</a>
</div>
{% endif %}
<hr style="padding-top: 0.3em">
<div class="problem-info-entry">
<i class="fa fa-check fa-fw"></i><span class="pi-name">{{ _('Points:') }}</span>
<span class="pi-value">
{% if contest_problem %}
{{ contest_problem.points }}{% if contest_problem.partial %} {{ _('(partial)') }}{% endif %}
{% else %}
{{ problem.points|floatformat }}{% if problem.partial %} {{ _('(partial)') }}{% endif %}
{% if can_edit_problem %}
<hr>
<div class="link-row">
<a href="{{ url('problem_ticket_list', problem.code) }}">
<i class="fa fa-clipboard-list"></i><span> {{ _('Manage tickets') }}
{% if num_open_tickets %}<span class="badge">{{ num_open_tickets }}</span>{% endif %}
</span>
</a>
</div>
<div class="link-row">
<a href="{{ url('admin:judge_problem_change', problem.id) }}">
<i class="fa fa-edit"></i><span> {{ _('Edit problem') }}</span>
</a>
</div>
{% if not problem.is_manually_managed %}
<div class="link-row">
<a href="{{ url('problem_data', problem.code) }}">
<i class="fa fa-database"></i><span> {{ _('Edit test data') }}</span>
</a>
</div>
{% endif %}
</span>
</div>
<div class="problem-info-entry">
<i class="fa fa-clock-o fa-fw"></i><span class="pi-name">{{ _('Time limit:') }}</span>
<span class="pi-value">{{ problem.time_limit }}s</span>
</div>
<div class="problem-lang-limits">
{% for name, limit in problem.language_time_limit %}
<div class="lang-limit">
<span class="lang-name">{{ name }}</span>
<span class="lang-tl">{{ limit }}s</span>
{% elif request.user.is_authenticated and has_tickets %}
<hr>
<div class="link-row">
<a href="{{ url('problem_ticket_list', problem.code) }}">
<i class="fa fa-inbox"></i><span> {{ _('My tickets') }}
{% if num_open_tickets %}<span class="badge">{{ num_open_tickets }}</span>{% endif %}
</span>
</a>
</div>
{% endfor %}
</div>
<div class="problem-info-entry">
<i class="fa fa-server fa-fw"></i><span class="pi-name">{{ _('Memory limit:') }}</span>
<span class="pi-value">{{ problem.memory_limit|kbsimpleformat }}</span>
</div>
<div class="problem-lang-limits">
{% for name, limit in problem.language_memory_limit %}
<div class="lang-limit">
<span class="lang-name">{{ name }}</span>
<span class="lang-ml">{{ limit|kbsimpleformat }}</span>
{% endif %}
{% if problem.is_subs_manageable_by(request.user) %}
<div class="link-row">
<a href="{{ url('problem_manage_submissions', problem.code) }}">
<i class="fas fa-table"></i><span> {{ _('Manage submissions') }}</span>
</a>
</div>
{% endfor %}
</div>
<div class="problem-info-entry">
<i class="fa fa-file-o fa-fw"></i><span class="pi-name">{{ _('Input:') }}</span>
<span class="pi-value">
{{ fileio_input or _('stdin') }}
</span>
</div>
<div class="problem-info-entry">
<i class="fa fa-file fa-fw"></i><span class="pi-name">{{ _('Output:') }}</span>
<span class="pi-value">{{ fileio_output or _('stdout') }}</span>
</div>
{% endif %}
<hr style="padding-top: 0.7em">
{% if perms.judge.clone_problem %}
<div class="link-row">
<a href="{{ url('problem_clone', problem.code) }}">
<i class="fas fa-clone"></i><span> {{ _('Clone problem') }}</span>
</a>
</div>
{% endif %}
{% cache 86400 'problem_authors' problem.id LANGUAGE_CODE %}
{% with authors=problem.authors.all() %}
{% if problem.language_time_limit or problem.language_memory_limit %}
<hr style="padding-top: 0.3em">
{% endif %}
{% if problem.language_time_limit %}
<div class="problem-info-entry">
<i class="fa fa-clock"></i><span class="pi-name"> {{ _('Time limit:') }}</span>
</div>
<div class="problem-lang-limits">
{% for name, limit in problem.language_time_limit %}
<div class="lang-limit">
<span class="lang-name">{{ name }}</span>
<span class="lang-tl">{{ limit }}s</span>
</div>
{% endfor %}
</div>
{% endif %}
{% if problem.language_memory_limit %}
<div class="problem-info-entry">
<i class="fa fa-server"></i><span class="pi-name"> {{ _('Memory limit:') }}</span>
</div>
<div class="problem-lang-limits">
{% for name, limit in problem.language_memory_limit %}
<div class="lang-limit">
<span class="lang-name">{{ name }}</span>
<span class="lang-ml">{{ limit|kbsimpleformat }}</span>
</div>
{% endfor %}
</div>
{% endif%}
<hr style="padding-top: 0.7em">
{% with authors=problem.get_authors() %}
{% if authors %}
<div class="problem-info-entry">
<i class="fa fa-pencil-square-o fa-fw"></i><span
class="pi-name">{% trans trimmed count=authors|length %}
<i class="far fa-pen-to-square"></i><span
class="pi-name"> {% trans trimmed count=authors|length %}
Author:
{% pluralize count %}
Authors:
@ -267,68 +299,67 @@
</div>
{% endif %}
{% endwith %}
{% endcache %}
{% if not contest_problem or not contest_problem.contest.hide_problem_tags %}
<div id="problem-types">
{% with types=problem.types_list %}
<div class="toggle closed unselectable">
<i class="fa fa-chevron-right fa-fw"></i>{% trans trimmed count=problem.types_list|length %}
Problem type
{% pluralize count %}
Problem types
{% endtrans %}
</div>
<div style="display:none" class="toggled">{{ problem.types_list|join(", ") }}</div>
{% endwith %}
</div>
{% endif %}
{% if show_languages %}
<div id="allowed-langs">
<div class="toggle open unselectable">
<i class="fa fa-chevron-right fa-fw"></i>{{ _('Allowed languages') }}
</div>
<div class="toggled">
{% with usable=problem.usable_common_names, langs=problem.languages_list() %}
{% for lang in langs %}
{%- if lang in usable -%}
{{ lang }}
{%- else -%}
<s title="{{ _('No %(lang)s judge online', lang=lang) }}">{{ lang }}</s>
{%- endif -%}
{% if not loop.last %}, {% endif -%}
{% endfor %}
{% if not contest_problem or not contest_problem.contest.hide_problem_tags %}
<div id="problem-types">
{% with types=problem.types_list %}
<div class="toggle closed unselectable">
<i class="fa fa-chevron-right"></i> {% trans trimmed count=problem.types_list|length %}
Problem type
{% pluralize count %}
Problem types
{% endtrans %}
</div>
<div style="display:none" class="toggled">{{ problem.types_list|join(", ") }}</div>
{% endwith %}
</div>
</div>
{% endif %}
{% if problem.is_editable_by(request.user) %}
<div id="available-judges">
<div class="toggle closed" id="judge-toggle">
<i class="fa fa-chevron-right fa-fw"></i><span
class="pi-name">{% trans trimmed count=available_judges|length %}
Judge
{% pluralize count %}
Judges
{% endtrans %}
</span>
</div>
<div class="pi-value judges-value toggled" style="display: none;">
{% if available_judges %}
{% if perms.judge.change_judge %}
{% for judge in available_judges %}
<a href="{{ url('admin:judge_judge_change', judge.id) }}">{{ judge.name }}</a>
{%- if not loop.last %}, {% endif %}
{% endif %}
{% if show_languages %}
<div id="allowed-langs">
<div class="toggle open unselectable">
<i class="fa fa-chevron-right"></i> {{ _('Allowed languages') }}
</div>
<div class="toggled">
{% with usable=problem.usable_common_names, langs=problem.languages_list() %}
{% for lang in langs %}
{%- if lang in usable -%}
{{ lang }}
{%- else -%}
<s title="{{ _('No %(lang)s judge online', lang=lang) }}">{{ lang }}</s>
{%- endif -%}
{% if not loop.last %}, {% endif -%}
{% endfor %}
{% else %}
{{ available_judges|join(", ") }}
{% endif %}
{% else %}
<i class="red">{{ _('none available') }}</i>
{% endif %}
{% endwith %}
</div>
</div>
</div>
{% endif %}
{% endif %}
{% if problem.is_editable_by(request.user) %}
<div id="available-judges">
<div class="toggle closed" id="judge-toggle">
<i class="fa fa-chevron-right"></i><span
class="pi-name"> {% trans trimmed count=available_judges|length %}
Judge
{% pluralize count %}
Judges
{% endtrans %}
</span>
</div>
<div class="pi-value judges-value toggled" style="display: none;">
{% if available_judges %}
{% if perms.judge.change_judge %}
{% for judge in available_judges %}
<a href="{{ url('admin:judge_judge_change', judge.id) }}">{{ judge.name }}</a>
{%- if not loop.last %}, {% endif %}
{% endfor %}
{% else %}
{{ available_judges|join(", ") }}
{% endif %}
{% else %}
<i class="red">{{ _('none available') }}</i>
{% endif %}
</div>
</div>
{% endif %}
{% endblock %}
{% block description %}
@ -342,8 +373,42 @@
</a>
</div>
{% endif %}
<div class = "new-problem-info d-flex-problem">
<span class="info-block">
<i class="fa fa-check"></i><span class="pi-name"> {{ _('Points:') }}</span>
<span class="new-pi-value">
{% if contest_problem %}
{{ contest_problem.points }} {% if contest_problem.partial %}(p){% endif %}
{% else %}
{{ problem.points|floatformat }} {% if problem.partial %}(p){% endif %}
{% endif %}
</span>
</span>
{% cache 86400 'problem_html' problem.id MATH_ENGINE LANGUAGE_CODE %}
<span class="info-block">
<i class="fa fa-clock"></i><span class="pi-name"> {{ _('Time limit:') }}</span>
<span class="new-pi-value">{{ problem.time_limit }}s</span>
</span>
<span class="info-block">
<i class="fa fa-server"></i><span class="pi-name"> {{ _('Memory limit:') }}</span>
<span class="new-pi-value">{{ problem.memory_limit|kbsimpleformat }}</span>
</span>
<span class="info-block">
<i class="fa fa-file"></i><span class="pi-name"> {{ _('Input:') }}</span>
<span class="new-pi-value">
{{ fileio_input or _('stdin') }}
</span>
</span>
<span>
<i class="fa fa-file"></i><span class="pi-name"> {{ _('Output:') }}</span>
<span class="new-pi-value">{{ fileio_output or _('stdout') }}</span>
</span>
</div>
{% cache 86400 'problem_html' problem.id LANGUAGE_CODE %}
{{ description|markdown(lazy_load=True)|reference|str|safe }}
{% endcache %}

View file

@ -92,16 +92,7 @@
<div class="content-description printing">
{{ description|markdown|reference|absolutify(url)|str|safe }}
</div>
<script type="text/javascript" src="{{ static('mathjax3_config.js') }}"></script>
<script type="text/javascript" src="mathjax3_config.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js?config=TeX-AMS_HTML"></script>
<script type="text/javascript">
MathJax.Hub.Register.StartupHook("End", function () {
if (typeof window.callPhantom === 'function')
window.callPhantom({'action': 'snapshot'});
document.body.classList.add('math-loaded');
});
</script>
<script src="{{ static('katex_config.js') }}"></script>
{% include "katex-load.html" %}
</body>
</html>

View file

@ -47,11 +47,11 @@
</div>
{% endif %}
<div class="filter-form-group">
<label class="bold-text margin-label" for="type"><i class="non-italics">{{ _('Author') }}</i></label>
<label class="bold-text margin-label" for="search-author"><i class="non-italics">{{ _('Author') }}</i></label>
<select id="search-author" name="authors" multiple>
{% for author in all_authors %}
<option value="{{ author.id }}"{% if author.id in author_query %} selected{% endif %}>
{{ author.user__username }}
{% for author in author_query %}
<option value="{{ author.id }}" selected>
{{ author.username }}
</option>
{% endfor %}
</select>
@ -84,8 +84,10 @@
</select>
</div>
{% if point_values %}
<div style="margin-top: 5px;" class="bold-text margin-label" class="form-label">{{ _('Point range') }}</div>
<div id="point-slider"></div>
<div class="filter-form-group">
<div class="bold-text margin-label" class="form-label">{{ _('Point range') }}</div>
<div id="point-slider"></div>
</div>
{% endif %}
<input id="point-start" type="hidden" name="point_start" {% if point_start and point_start != point_values.min %}value="{{ point_start }}"{% else %}disabled{% endif %}>
<input id="point-end" type="hidden" name="point_end" {% if point_end and point_end != point_values.max %}value="{{ point_end }}"{% else %}disabled{% endif %}>

View file

@ -12,7 +12,6 @@
});
});
</script>
<script type="text/javascript" src="{{ static('libs/featherlight/featherlight.min.js') }}"></script>
<script type="text/javascript">
</script>
{% endblock %}

View file

@ -32,7 +32,31 @@
}
{% endif %}
}
{% if request.in_contest and next_valid_submit_time and not (submission_limit and submissions_left <= 0) %}
$(function () {
const $submitButton = $("#submit-button");
$submitButton.prop('disabled', true);
const nextValidDate = new Date("{{next_valid_submit_time}}");
function updateCountdown() {
var now = new Date();
var timeUntilNextValid = nextValidDate - now;
if (timeUntilNextValid > 0) {
var seconds = Math.floor(timeUntilNextValid / 1000);
$("#countdown-timer").text("{{_("Wait")}} " + seconds + "s");
setTimeout(updateCountdown, 1000);
} else {
$("#countdown-timer").text("");
$submitButton.prop('disabled', false);
}
}
updateCountdown();
});
{% endif %}
</script>
{% compress js %}
<script type="text/javascript">
$(function () {
@ -228,8 +252,9 @@
{{ form.source_file }}
<div class="submit-bar">
{{ form.judge }}
<input type="submit" value="{{ _('Submit!') }}" class="button small"
{% if request.in_contest and submission_limit and not submissions_left %}disabled{% endif %}>
<input id="submit-button" type="submit" value="{{ _('Submit!') }}" class="button small"
{% if request.in_contest and submission_limit and submissions_left <= 0 %}disabled{% endif %}>
<span id="countdown-timer"></span>
</div>
{% endif %}
</form>

View file

@ -1,20 +1,5 @@
{% extends "base.html" %}
{% block body %}
<div class="source-wrap">
<table>
<tr>
<td class="source-ln">
<div>
{% for line in raw_source.split('\n') %}
<a href="#line-{{ loop.index }}" name="line-{{ loop.index }}">
<pre>{{ loop.index }}</pre>
</a>
{% endfor %}
</div>
</td>
<td class="source-code">{{ highlighted_source }}</td>
</tr>
</table>
</div>
{{ highlighted_source }}</td>
{% endblock %}