Reformat html files

This commit is contained in:
cuom1999 2023-01-27 17:11:10 -06:00
parent 9a208ca108
commit 52f1e77fe1
205 changed files with 11096 additions and 11086 deletions

View file

@ -1,42 +1,42 @@
{% extends "base.html" %}
{% block media %}
<style>
#problem-clone-panel {
position: relative;
margin: 5em auto auto -10em;
top: 40%;
left: 50%;
}
<style>
#problem-clone-panel {
position: relative;
margin: 5em auto auto -10em;
top: 40%;
left: 50%;
}
#problem-code-container {
margin: 0.5em 0;
}
#problem-code-container {
margin: 0.5em 0;
}
#id_code {
width: 100%;
}
#id_code {
width: 100%;
}
ul.errorlist {
list-style-type: none;
padding-left: 0;
text-align: center;
}
</style>
ul.errorlist {
list-style-type: none;
padding-left: 0;
text-align: center;
}
</style>
{% endblock %}
{% block body %}
<form id="problem-clone-panel" action="" method="post" class="form-area">
{% csrf_token %}
{% if form.errors %}
<div id="form-errors">
{{ form.code.errors }}
</div>
{% endif %}
<form id="problem-clone-panel" action="" method="post" class="form-area">
{% csrf_token %}
{% if form.errors %}
<div id="form-errors">
{{ form.code.errors }}
</div>
{% endif %}
<div><label class="inline-header grayed">{{ _('Enter a new code for the cloned problem:') }}</label></div>
<div id="problem-code-container"><span class="fullwidth">{{ form.code }}</span></div>
<hr>
<button style="float:right;" type="submit">{{ _('Clone!') }}</button>
</form>
<div><label class="inline-header grayed">{{ _('Enter a new code for the cloned problem:') }}</label></div>
<div id="problem-code-container"><span class="fullwidth">{{ form.code }}</span></div>
<hr>
<button style="float:right;" type="submit">{{ _('Clone!') }}</button>
</form>
{% endblock %}

File diff suppressed because it is too large Load diff

View file

@ -1,44 +1,44 @@
{% extends "common-content.html" %}
{% block content_js_media %}
{% include "comments/media-js.html" %}
{% include "actionbar/media-js.html" %}
{% include "comments/media-js.html" %}
{% include "actionbar/media-js.html" %}
{% endblock %}
{% block content_media %}
{% include "comments/media-css.html" %}
{% include "actionbar/media-css.html" %}
{% include "comments/media-css.html" %}
{% include "actionbar/media-css.html" %}
{% endblock %}
{% block header %}
<div style="float:right">
{% if perms.judge.change_problem %}
[<a href="{{ url('admin:judge_problem_change', problem.id) }}">{{ _('Edit') }}</a>]
{% endif %}
</div>
<div style="float:right">
{% if perms.judge.change_problem %}
[<a href="{{ url('admin:judge_problem_change', problem.id) }}">{{ _('Edit') }}</a>]
{% endif %}
</div>
{% endblock %}
{% block body %}
<div class="content-description">
{% if not has_solved_problem %}
<div class="alert alert-danger">{{ _('Remember to use this editorial <b>only</b> when stuck, and <b>not to copy-paste code from it</b>. Please be respectful to the problem author and editorialist. <br><br> <b>Submitting an official solution before solving the problem yourself is a bannable offence.</b>') }}</div>
{% endif %}
{% with authors=solution.authors.all() %}
{% if authors %}
<p>Authors: {{ link_users(authors) }}</p>
{% endif %}
{% endwith %}
{{ solution.content|markdown|reference|str|safe }}
</div>
<hr>
{% include "actionbar/list.html" %}
<br>
{% include "comments/list.html" %}
<div class="content-description">
{% if not has_solved_problem %}
<div class="alert alert-danger">{{ _('Remember to use this editorial <b>only</b> when stuck, and <b>not to copy-paste code from it</b>. Please be respectful to the problem author and editorialist. <br><br> <b>Submitting an official solution before solving the problem yourself is a bannable offence.</b>') }}</div>
{% endif %}
{% with authors=solution.authors.all() %}
{% if authors %}
<p>Authors: {{ link_users(authors) }}</p>
{% endif %}
{% endwith %}
{{ solution.content|markdown|reference|str|safe }}
</div>
<hr>
{% include "actionbar/list.html" %}
<br>
{% include "comments/list.html" %}
{% endblock %}
{% block bodyend %}
{% if REQUIRE_JAX %}
{% include "mathjax-load.html" %}
{% endif %}
{% include "comments/math.html" %}
{% if REQUIRE_JAX %}
{% include "mathjax-load.html" %}
{% endif %}
{% include "comments/math.html" %}
{% endblock %}

View file

@ -1,141 +1,141 @@
{% extends "problem/list-base.html" %}
{% block left_sidebar %}
{% include "problem/left-sidebar.html" %}
{% endblock %}
{% block middle_content %}
<div class="problem-feed-option">
<a href="{{url('problem_feed')}}" class="button small {{'btn-midnightblue' if feed_type=='for_you' else 'btn-gray'}}">
{{_('FOR YOU')}}
</a>
<a href="{{url('problem_feed_new')}}" class="button small {{'btn-midnightblue' if feed_type=='new' else 'btn-gray'}}">
{{_('NEW')}}
</a>
{% if request.user.has_perm('judge.suggest_problem_changes') %}
<a href="{{url('problem_feed_volunteer')}}" class="button small {{'btn-midnightblue' if feed_type=='volunteer' else 'btn-gray'}}">
{{_('VOLUNTEER')}}
</a>
{% endif %}
</div>
{% if request.user.has_perm('judge.suggest_problem_changes') and feed_type == 'volunteer' %}
<ul style="margin-bottom: 1em; margin-left: auto">
<li><a href="{{url('admin:judge_volunteerproblemvote_changelist')}}">{{_('View your votes')}}</a></li>
</ul>
{% endif %}
{% for problem in problems %}
<div class="blog-box">
<h3 class="problem-feed-name">
<a href="{{ url('problem_detail', problem.code) }}">
{{ problem.i18n_name }}
</a>
{% if problem.id in completed_problem_ids %}
<i class="solved-problem-color fa fa-check-circle"></i>
{% elif problem.id in attempted_problems %}
<i class="attempted-problem-color fa fa-minus-circle"></i>
{% else %}
<i class="unsolved-problem-color fa fa-minus-circle"></i>
{% endif %}
</h3>
{% with authors=problem.authors.all() %}
{% if authors %}
<div class="problem-feed-info-entry">
<i class="fa fa-pencil-square-o fa-fw"></i>
<span class="pi-value">{{ link_users(authors) }}</span>
</div>
{% endif %}
{% endwith %}
{% if show_types %}
<div class="problem-feed-types">
<i class="fa fa-tag"></i>
{% for type in problem.types_list %}
<span class="type-tag">{{ type }}</span>{% if not loop.last %}, {% endif %}
{% endfor %}, *{{problem.points | int}}
</div>
{% endif %}
<div class="blog-description">
<div class='content-description'>
{% cache 86400 'problem_html' problem.id MATH_ENGINE LANGUAGE_CODE %}
{{ problem.description|markdown(lazy_load=True)|reference|str|safe }}
{% endcache %}
{% if problem.pdf_description %}
<embed src="{{url('problem_pdf_description', problem.code)}}" width="100%" height="500" type="application/pdf" style="margin-top: 0.5em">
{% endif %}
</div>
{% set include_hr = True %}
{% set hide_actionbar_comment = True %}
{% set pagevote = problem.pagevote %}
{% set bookmark = problem.bookmark %}
{% set share_url = request.build_absolute_uri(problem.get_absolute_url()) %}
{% include "actionbar/list.html" %}
{% if feed_type=='volunteer' and request.user.has_perm('judge.suggest_problem_changes') %}
<br>
<a href="#" class="view-statement-src">{{ _('View source') }}</a>
<pre class="statement-src" style="display: none">{{ problem.description|str }}</pre>
<hr>
<center><h3>{{_('Volunteer form')}}</h3></center>
<br>
<button class="edit-btn" id="edit-{{problem.id}}" pid="{{problem.id}}" style="float: right">{{_('Edit')}}</button>
<form class="volunteer-form" id="form-{{problem.id}}" pid="{{problem.id}}" style="display: none;" method="POST">
<input type="submit" class="volunteer-submit-btn" id="submit-{{problem.id}}" pid="{{problem.id}}" pcode="{{problem.code}}" style="float: right" value="{{_('Submit')}}">
<table class="table">
<thead>
<tr>
<th>
</th>
<th>
{{_('Value')}}
</th>
</tr>
</thead>
<tbody>
<tr>
<td width="30%">
<label for="knowledge_point-{{problem.id}}"><i>{{ _('Knowledge point') }}</i></label>
</td>
<td>
<input id="knowledge_point-{{problem.id}}" type="number" class="point-input" required>
</td>
</tr>
<tr>
<td width="30%">
<label for="thinking_point-{{problem.id}}"><i>{{ _('Thinking point') }}</i></label>
</td>
<td>
<input id="thinking_point-{{problem.id}}" type="number" class="point-input" required>
</td>
</tr>
<tr>
<td width="30%">
<label for="types"><i>{{ _('Problem types') }}</i></label>
</td>
<td>
<select id="volunteer-types-{{problem.id}}" name="types" multiple>
{% for type in problem_types %}
<option value="{{ type.id }}"{% if type in problem.types.all() %} selected{% endif %}>
{{ type.full_name }}
</option>
{% endfor %}
</select>
</td>
</tr>
<tr>
<td width="30%">
<label for="feedback"><i>{{ _('Feedback') }}</i></label>
</td>
<td>
<textarea id="feedback-{{problem.id}}" rows="2" style="width: 100%" placeholder="{{_('Any additional note here')}}"></textarea>
</td>
</tr>
</tbody>
</table>
</form>
<center id="thank-{{problem.id}}" style="display: none; margin-top: 3em"></center>
{% endif %}
</div>
</div>
{% endfor %}
{% if page_obj.num_pages > 1 %}
<div style="margin-top:10px;">{% include "list-pages.html" %}</div>
{% endif %}
{% extends "problem/list-base.html" %}
{% block left_sidebar %}
{% include "problem/left-sidebar.html" %}
{% endblock %}
{% block middle_content %}
<div class="problem-feed-option">
<a href="{{url('problem_feed')}}" class="button small {{'btn-midnightblue' if feed_type=='for_you' else 'btn-gray'}}">
{{_('FOR YOU')}}
</a>
<a href="{{url('problem_feed_new')}}" class="button small {{'btn-midnightblue' if feed_type=='new' else 'btn-gray'}}">
{{_('NEW')}}
</a>
{% if request.user.has_perm('judge.suggest_problem_changes') %}
<a href="{{url('problem_feed_volunteer')}}" class="button small {{'btn-midnightblue' if feed_type=='volunteer' else 'btn-gray'}}">
{{_('VOLUNTEER')}}
</a>
{% endif %}
</div>
{% if request.user.has_perm('judge.suggest_problem_changes') and feed_type == 'volunteer' %}
<ul style="margin-bottom: 1em; margin-left: auto">
<li><a href="{{url('admin:judge_volunteerproblemvote_changelist')}}">{{_('View your votes')}}</a></li>
</ul>
{% endif %}
{% for problem in problems %}
<div class="blog-box">
<h3 class="problem-feed-name">
<a href="{{ url('problem_detail', problem.code) }}">
{{ problem.i18n_name }}
</a>
{% if problem.id in completed_problem_ids %}
<i class="solved-problem-color fa fa-check-circle"></i>
{% elif problem.id in attempted_problems %}
<i class="attempted-problem-color fa fa-minus-circle"></i>
{% else %}
<i class="unsolved-problem-color fa fa-minus-circle"></i>
{% endif %}
</h3>
{% with authors=problem.authors.all() %}
{% if authors %}
<div class="problem-feed-info-entry">
<i class="fa fa-pencil-square-o fa-fw"></i>
<span class="pi-value">{{ link_users(authors) }}</span>
</div>
{% endif %}
{% endwith %}
{% if show_types %}
<div class="problem-feed-types">
<i class="fa fa-tag"></i>
{% for type in problem.types_list %}
<span class="type-tag">{{ type }}</span>{% if not loop.last %}, {% endif %}
{% endfor %}, *{{problem.points | int}}
</div>
{% endif %}
<div class="blog-description">
<div class='content-description'>
{% cache 86400 'problem_html' problem.id MATH_ENGINE LANGUAGE_CODE %}
{{ problem.description|markdown(lazy_load=True)|reference|str|safe }}
{% endcache %}
{% if problem.pdf_description %}
<embed src="{{url('problem_pdf_description', problem.code)}}" width="100%" height="500" type="application/pdf" style="margin-top: 0.5em">
{% endif %}
</div>
{% set include_hr = True %}
{% set hide_actionbar_comment = True %}
{% set pagevote = problem.pagevote %}
{% set bookmark = problem.bookmark %}
{% set share_url = request.build_absolute_uri(problem.get_absolute_url()) %}
{% include "actionbar/list.html" %}
{% if feed_type=='volunteer' and request.user.has_perm('judge.suggest_problem_changes') %}
<br>
<a href="#" class="view-statement-src">{{ _('View source') }}</a>
<pre class="statement-src" style="display: none">{{ problem.description|str }}</pre>
<hr>
<center><h3>{{_('Volunteer form')}}</h3></center>
<br>
<button class="edit-btn" id="edit-{{problem.id}}" pid="{{problem.id}}" style="float: right">{{_('Edit')}}</button>
<form class="volunteer-form" id="form-{{problem.id}}" pid="{{problem.id}}" style="display: none;" method="POST">
<input type="submit" class="volunteer-submit-btn" id="submit-{{problem.id}}" pid="{{problem.id}}" pcode="{{problem.code}}" style="float: right" value="{{_('Submit')}}">
<table class="table">
<thead>
<tr>
<th>
</th>
<th>
{{_('Value')}}
</th>
</tr>
</thead>
<tbody>
<tr>
<td width="30%">
<label for="knowledge_point-{{problem.id}}"><i>{{ _('Knowledge point') }}</i></label>
</td>
<td>
<input id="knowledge_point-{{problem.id}}" type="number" class="point-input" required>
</td>
</tr>
<tr>
<td width="30%">
<label for="thinking_point-{{problem.id}}"><i>{{ _('Thinking point') }}</i></label>
</td>
<td>
<input id="thinking_point-{{problem.id}}" type="number" class="point-input" required>
</td>
</tr>
<tr>
<td width="30%">
<label for="types"><i>{{ _('Problem types') }}</i></label>
</td>
<td>
<select id="volunteer-types-{{problem.id}}" name="types" multiple>
{% for type in problem_types %}
<option value="{{ type.id }}"{% if type in problem.types.all() %} selected{% endif %}>
{{ type.full_name }}
</option>
{% endfor %}
</select>
</td>
</tr>
<tr>
<td width="30%">
<label for="feedback"><i>{{ _('Feedback') }}</i></label>
</td>
<td>
<textarea id="feedback-{{problem.id}}" rows="2" style="width: 100%" placeholder="{{_('Any additional note here')}}"></textarea>
</td>
</tr>
</tbody>
</table>
</form>
<center id="thank-{{problem.id}}" style="display: none; margin-top: 3em"></center>
{% endif %}
</div>
</div>
{% endfor %}
{% if page_obj.num_pages > 1 %}
<div style="margin-top:10px;">{% include "list-pages.html" %}</div>
{% endif %}
{% endblock %}

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('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')) }}
{% endif %}
</div>
{% if not show_contest_mode %}
<div class="left-sidebar">
{{ make_tab_item('feed', 'fa fa-pagelines', 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')) }}
{% endif %}
</div>
{% endif %}

View file

@ -1,261 +1,261 @@
{% extends "three-column-content.html" %}
{% block three_col_media %}
<link rel="stylesheet" href="{{ static('libs/nouislider.min.css') }}">
<noscript>
<style>
#category, #types {
visibility: visible;
}
</style>
</noscript>
{% if not show_contest_mode %}
<style>
#search-org, #search-author {
width: 100%;
}
#problem-table th {
padding: 0;
}
a.hot-problem-link:hover > .hot-problem-count {
visibility: visible;
}
ul.problem-list {
padding: 0 !important;
}
.volunteer-types {
width: 100%;
}
.point-input {
height: 2em;
padding-top: 4px;
}
@media(min-width: 800px) {
#content {
width: 99%;
margin-left: 0;
}
}
@media(max-width: 799px) {
#content {
width: 100%;
margin-left: 0;
}
}
</style>
{% else %}
<style>
@media(min-width: 800px) {
.middle-content {
max-width: 80%;
}
}
</style>
{% endif %}
{% include "actionbar/media-css.html" %}
{% endblock %}
{% block three_col_js %}
{% include "actionbar/media-js.html" %}
<script>
window.point_start = {{point_start}};
window.point_end = {{point_end}};
window.point_values = {{point_values|json|safe}};
</script>
{% compress js %}
<script src="{{ static('libs/nouislider.min.js') }}" type="text/javascript"></script>
<script>
$(function () {
var $form = $('form#filter-form');
var $search = $('#search');
var $category = $('#category');
function prep_form() {
$search.prop('disabled', !$search.val());
$category.prop('disabled', !$category.val());
}
function clear_point_interval() {
if ($('#search').val() !== "{{ search_query or '' }}") {
$('#point-start').remove();
$('#point-end').remove();
}
}
function clean_submit() {
prep_form();
clear_point_interval();
$form.submit();
}
function form_serialize() {
clear_point_interval();
return $form.serialize();
}
$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'});
// This is incredibly nasty to do but it's needed because otherwise the select2 steals the focus
$search.keypress(function (e) {
if (e.keyCode == 13)
$('#go').click();
});
$('#random').click(function (e) {
var action = $form.attr('action');
$form.attr('action', '{{ url('problem_random') }}').attr('target', '_blank').submit();
$form.attr('action', action).attr('target', '');
e.preventDefault();
});
$('#go').click(clean_submit);
$('input#full_text, input#hide_solved, input#show_types, input#show_editorial, input#have_editorial, input#show_solved_only').click(function () {
prep_form();
($('<form>').attr('action', window.location.pathname + '?' + form_serialize())
.append($('<input>').attr('type', 'hidden').attr('name', 'csrfmiddlewaretoken')
.attr('value', $.cookie('csrftoken')))
.attr('method', 'POST').appendTo($('body')).submit());
});
var intFormatter = {
to: function (value) {
return value;
},
from: function (value) {
return +value;
}
};
var $slider = $('#point-slider');
if ($slider.length) {
var $start = $('#point-start');
var $end = $('#point-end');
noUiSlider.create($slider[0], {
start: [point_start, point_end],
connect: true,
snap: true,
tooltips: [intFormatter, intFormatter],
range: point_values
}).on('change', function (values) {
var start = +values[0], end = +values[1];
$start.prop('disabled', start === point_values.min).val(start);
$end.prop('disabled', end === point_values.max).val(end);
});
}
{% if feed_type=='volunteer' and request.user.has_perm('judge.suggest_problem_changes') %}
$(".view-statement-src").on('click', function(e) {
e.preventDefault();
$(this).siblings('.statement-src').toggle();
});
$(".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'});
$('#form-' + pid).show();
$('#submit-' + pid).show();
$(this).hide();
});
let isChecking = false;
$(".volunteer-submit-btn").on('click', function(e) {
var pid = $(this).attr('pid');
var pcode = $(this).attr('pcode');
var $form = $('#form-' + pid);
if (!$form[0].checkValidity()) {
if (isChecking) return;
isChecking = true;
// The form won't actually submit;
$(this).click();
}
else {
isChecking = false;
}
if (isChecking) return;
e.preventDefault();
$('#volunteer-types-' + pid).select2({multiple: 1, placeholder: '{{ _('Add types...') }}'})
.css({'visibility': 'visible'});
$('#form-' + pid).hide();
$('#edit-' + pid).show();
$('#thank-' + pid).show();
$(this).hide();
var data = {
problem: pcode,
types: $('#volunteer-types-' + pid).val(),
knowledge_points: $('#knowledge_point-' + pid).val(),
thinking_points: $('#thinking_point-' + pid).val(),
feedback: $('#feedback-' + pid).val(),
};
$.post("{{url('volunteer_problem_vote')}}", data)
.fail(function() {
$('#thank-' + pid).html("{{_('Fail to vote!')}}");
})
.done(function() {
$('#thank-' + pid).html("{{_('Successful vote! Thank you!')}}");
});
});
{% endif %}
});
</script>
{% endcompress %}
{% if show_contest_mode %}
{% compress js %}
<script src="{{ static('libs/tablesorter.js') }}" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
$.tablesorter.addParser({
id: 'solvedsort',
is: function (s) {
return false;
},
format: function (s, table, cell, cellIndex) {
return $(cell).attr('solved');
},
type: 'numeric'
});
$('#problem-table').tablesorter({
headers: {
0: {
sorter: 'solvedsort'
}
},
textExtraction: function (node) {
node = $(node);
var text = node.text().replace(/^\s+|\s+$/g, '');
return (node.hasClass('p') ? text.replace(/p$/, '') : text);
}
});
window.register_contest_notification("{{url('contest_clarification_ajax', request.participation.contest.key)}}");
{% if show_contest_mode %}
$('.left-sidebar').hide();
{% endif %}
});
</script>
{% endcompress %}
{% endif %}
{% endblock %}
{% block left_sidebar %}
{% include "problem/left-sidebar.html" %}
{% endblock %}
{% block right_sidebar %}
{% if not show_contest_mode %}
<div id="content-right" class="problems right-sidebar">
{% include "problem/search-form.html" %}
{% include "problem/recent-attempt.html" %}
</div>
{% endif %}
{% extends "three-column-content.html" %}
{% block three_col_media %}
<link rel="stylesheet" href="{{ static('libs/nouislider.min.css') }}">
<noscript>
<style>
#category, #types {
visibility: visible;
}
</style>
</noscript>
{% if not show_contest_mode %}
<style>
#search-org, #search-author {
width: 100%;
}
#problem-table th {
padding: 0;
}
a.hot-problem-link:hover > .hot-problem-count {
visibility: visible;
}
ul.problem-list {
padding: 0 !important;
}
.volunteer-types {
width: 100%;
}
.point-input {
height: 2em;
padding-top: 4px;
}
@media(min-width: 800px) {
#content {
width: 99%;
margin-left: 0;
}
}
@media(max-width: 799px) {
#content {
width: 100%;
margin-left: 0;
}
}
</style>
{% else %}
<style>
@media(min-width: 800px) {
.middle-content {
max-width: 80%;
}
}
</style>
{% endif %}
{% include "actionbar/media-css.html" %}
{% endblock %}
{% block three_col_js %}
{% include "actionbar/media-js.html" %}
<script>
window.point_start = {{point_start}};
window.point_end = {{point_end}};
window.point_values = {{point_values|json|safe}};
</script>
{% compress js %}
<script src="{{ static('libs/nouislider.min.js') }}" type="text/javascript"></script>
<script>
$(function () {
var $form = $('form#filter-form');
var $search = $('#search');
var $category = $('#category');
function prep_form() {
$search.prop('disabled', !$search.val());
$category.prop('disabled', !$category.val());
}
function clear_point_interval() {
if ($('#search').val() !== "{{ search_query or '' }}") {
$('#point-start').remove();
$('#point-end').remove();
}
}
function clean_submit() {
prep_form();
clear_point_interval();
$form.submit();
}
function form_serialize() {
clear_point_interval();
return $form.serialize();
}
$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'});
// This is incredibly nasty to do but it's needed because otherwise the select2 steals the focus
$search.keypress(function (e) {
if (e.keyCode == 13)
$('#go').click();
});
$('#random').click(function (e) {
var action = $form.attr('action');
$form.attr('action', '{{ url('problem_random') }}').attr('target', '_blank').submit();
$form.attr('action', action).attr('target', '');
e.preventDefault();
});
$('#go').click(clean_submit);
$('input#full_text, input#hide_solved, input#show_types, input#show_editorial, input#have_editorial, input#show_solved_only').click(function () {
prep_form();
($('<form>').attr('action', window.location.pathname + '?' + form_serialize())
.append($('<input>').attr('type', 'hidden').attr('name', 'csrfmiddlewaretoken')
.attr('value', $.cookie('csrftoken')))
.attr('method', 'POST').appendTo($('body')).submit());
});
var intFormatter = {
to: function (value) {
return value;
},
from: function (value) {
return +value;
}
};
var $slider = $('#point-slider');
if ($slider.length) {
var $start = $('#point-start');
var $end = $('#point-end');
noUiSlider.create($slider[0], {
start: [point_start, point_end],
connect: true,
snap: true,
tooltips: [intFormatter, intFormatter],
range: point_values
}).on('change', function (values) {
var start = +values[0], end = +values[1];
$start.prop('disabled', start === point_values.min).val(start);
$end.prop('disabled', end === point_values.max).val(end);
});
}
{% if feed_type=='volunteer' and request.user.has_perm('judge.suggest_problem_changes') %}
$(".view-statement-src").on('click', function(e) {
e.preventDefault();
$(this).siblings('.statement-src').toggle();
});
$(".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'});
$('#form-' + pid).show();
$('#submit-' + pid).show();
$(this).hide();
});
let isChecking = false;
$(".volunteer-submit-btn").on('click', function(e) {
var pid = $(this).attr('pid');
var pcode = $(this).attr('pcode');
var $form = $('#form-' + pid);
if (!$form[0].checkValidity()) {
if (isChecking) return;
isChecking = true;
// The form won't actually submit;
$(this).click();
}
else {
isChecking = false;
}
if (isChecking) return;
e.preventDefault();
$('#volunteer-types-' + pid).select2({multiple: 1, placeholder: '{{ _('Add types...') }}'})
.css({'visibility': 'visible'});
$('#form-' + pid).hide();
$('#edit-' + pid).show();
$('#thank-' + pid).show();
$(this).hide();
var data = {
problem: pcode,
types: $('#volunteer-types-' + pid).val(),
knowledge_points: $('#knowledge_point-' + pid).val(),
thinking_points: $('#thinking_point-' + pid).val(),
feedback: $('#feedback-' + pid).val(),
};
$.post("{{url('volunteer_problem_vote')}}", data)
.fail(function() {
$('#thank-' + pid).html("{{_('Fail to vote!')}}");
})
.done(function() {
$('#thank-' + pid).html("{{_('Successful vote! Thank you!')}}");
});
});
{% endif %}
});
</script>
{% endcompress %}
{% if show_contest_mode %}
{% compress js %}
<script src="{{ static('libs/tablesorter.js') }}" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
$.tablesorter.addParser({
id: 'solvedsort',
is: function (s) {
return false;
},
format: function (s, table, cell, cellIndex) {
return $(cell).attr('solved');
},
type: 'numeric'
});
$('#problem-table').tablesorter({
headers: {
0: {
sorter: 'solvedsort'
}
},
textExtraction: function (node) {
node = $(node);
var text = node.text().replace(/^\s+|\s+$/g, '');
return (node.hasClass('p') ? text.replace(/p$/, '') : text);
}
});
window.register_contest_notification("{{url('contest_clarification_ajax', request.participation.contest.key)}}");
{% if show_contest_mode %}
$('.left-sidebar').hide();
{% endif %}
});
</script>
{% endcompress %}
{% endif %}
{% endblock %}
{% block left_sidebar %}
{% include "problem/left-sidebar.html" %}
{% endblock %}
{% block right_sidebar %}
{% if not show_contest_mode %}
<div id="content-right" class="problems right-sidebar">
{% include "problem/search-form.html" %}
{% include "problem/recent-attempt.html" %}
</div>
{% endif %}
{% endblock %}

View file

@ -1,180 +1,180 @@
{% extends "problem/list-base.html" %}
{% block left_sidebar %}
{% include "problem/left-sidebar.html" %}
{% include "problem/left-sidebar.html" %}
{% endblock %}
{% set has_hidden_subtasks = show_contest_mode and request.participation.contest.format.has_hidden_subtasks %}
{% block middle_content %}
<div id="content-left" class="problems">
<table id="problem-table" class="table striped">
<thead>
<tr>
{% if show_contest_mode %}
{% if request.user.is_authenticated and not has_hidden_subtasks %}
<th class="solved"><i class="fa fa-check"></i></th>
<div id="content-left" class="problems">
<table id="problem-table" class="table striped">
<thead>
<tr>
{% if show_contest_mode %}
{% if request.user.is_authenticated and not has_hidden_subtasks %}
<th class="solved"><i class="fa fa-check"></i></th>
{% endif %}
<th class="problem">{{ _('Problem') }}</th>
<th class="pcode">{{ _('Problem code') }}</th>
{% if show_types %}
<th>{{ _('Types') }}</th>
{% endif %}
<th class="points">{{ _('Points') }}</th>
{% if not has_hidden_subtasks %}
<th class="users">{{ _('Users') }}</th>
{% endif %}
{% else %}
{% if request.user.is_authenticated %}
<th class="solved">
<a href="{{ sort_links.solved }}"><i class="fa fa-check"></i>{{ sort_order.solved }}
</a>
</th>
{% endif %}
<th class="problem">
<a href="{{ sort_links.name }}">{{ _('Problem') }}{{ sort_order.name }}</a>
</th>
<th class="pcode">
<a href="{{ sort_links.code }}">{{ _('Problem code') }}</a>
</th>
<th class="category">
<a href="{{ sort_links.group }}">{{ _('Category') }}{{ sort_order.group }}</a>
</th>
{% if show_types %}
<th>
<a href="{{ sort_links.type }}">{{ _('Types') }}{{ sort_order.type }}</a>
</th>
{% endif %}
<th class="points">
<a href="{{ sort_links.points }}">{{ _('Points') }}{{ sort_order.points }}</a>
</th>
<th class="ac-rate">
<a href="{{ sort_links.ac_rate }}">{{ _('AC %%') }}{{ sort_order.ac_rate }}</a>
</th>
<th class="users">
<a href="{{ sort_links.user_count }}">{{ _('AC #') }}{{ sort_order.user_count }}</a>
</th>
{% if show_editorial %}
<th class="editorial">
{{_('Editorial')}}
</th>
{% endif %}
{% endif %}
</tr>
</thead>
<tbody>
{% for problem in object_list %}
<tr>
{% if request.user.is_authenticated and not has_hidden_subtasks %}
{% if problem.id in completed_problem_ids %}
<td solved="1">
<a href="{{ url('user_submissions', problem.code, request.user.username) }}">
{% if problem.is_public or show_contest_mode %}
<i class="solved-problem-color fa fa-check-circle"></i>
{% else %}
<i class="solved-problem-color fa fa-lock"></i>
{% endif %}
<th class="problem">{{ _('Problem') }}</th>
<th class="pcode">{{ _('Problem code') }}</th>
{% if show_types %}
<th>{{ _('Types') }}</th>
{% endif %}
<th class="points">{{ _('Points') }}</th>
{% if not has_hidden_subtasks %}
<th class="users">{{ _('Users') }}</th>
{% endif %}
{% else %}
{% if request.user.is_authenticated %}
<th class="solved">
<a href="{{ sort_links.solved }}"><i class="fa fa-check"></i>{{ sort_order.solved }}
</a>
</th>
{% endif %}
<th class="problem">
<a href="{{ sort_links.name }}">{{ _('Problem') }}{{ sort_order.name }}</a>
</th>
<th class="pcode">
<a href="{{ sort_links.code }}">{{ _('Problem code') }}</a>
</th>
<th class="category">
<a href="{{ sort_links.group }}">{{ _('Category') }}{{ sort_order.group }}</a>
</th>
{% if show_types %}
<th>
<a href="{{ sort_links.type }}">{{ _('Types') }}{{ sort_order.type }}</a>
</th>
{% endif %}
<th class="points">
<a href="{{ sort_links.points }}">{{ _('Points') }}{{ sort_order.points }}</a>
</th>
<th class="ac-rate">
<a href="{{ sort_links.ac_rate }}">{{ _('AC %%') }}{{ sort_order.ac_rate }}</a>
</th>
<th class="users">
<a href="{{ sort_links.user_count }}">{{ _('AC #') }}{{ sort_order.user_count }}</a>
</th>
{% if show_editorial %}
<th class="editorial">
{{_('Editorial')}}
</th>
{% endif %}
{% endif %}
</tr>
</thead>
<tbody>
{% for problem in object_list %}
<tr>
{% if request.user.is_authenticated and not has_hidden_subtasks %}
{% if problem.id in completed_problem_ids %}
<td solved="1">
<a href="{{ url('user_submissions', problem.code, request.user.username) }}">
{% if problem.is_public or show_contest_mode %}
<i class="solved-problem-color fa fa-check-circle"></i>
{% else %}
<i class="solved-problem-color fa fa-lock"></i>
{% endif %}
</a>
</td>
{% elif problem.id in attempted_problems %}
<td solved="0">
<a href="{{ url('user_submissions', problem.code, request.user.username) }}">
{% if problem.is_public or show_contest_mode %}
<i class="attempted-problem-color fa fa-minus-circle"></i>
{% else %}
<i class="attempted-problem-color fa fa-lock"></i>
{% endif %}
</a>
</td>
{% else %}
<td solved="-1">
{% if problem.is_public or show_contest_mode %}
<i class="unsolved-problem-color fa fa-minus-circle"></i>
{% else %}
<i class="unsolved-problem-color fa fa-lock"></i>
{% endif %}
</td>
{% endif %}
{% endif %}
<td class="problem">
<a href="{{ url('problem_detail', problem.code) }}">{{ problem.i18n_name }}</a>
</td>
<td class="pcode">
<a class="pcodecell" href="{{ url('problem_detail', problem.code) }}">{{ problem.code }}</a>
</td>
{% if not show_contest_mode %}
<td class="category">{{ problem.group.full_name }}</td>
{% endif %}
{% if show_types %}
<td class="types">
{% for type in problem.types_list %}
<span class="type-tag">{{ type }}</span>{% if not loop.last %}, {% endif %}
{% endfor %}
</td>
{% endif %}
<td class="p">{{ problem.points|floatformat }}{% if problem.partial %}p{% endif %}</td>
{% if not show_contest_mode %}
<td class="ac-rate">{{ problem.ac_rate|floatformat(0) }}%</td>
{% endif %}
{% if not has_hidden_subtasks %}
<td class="users">
<a href="{{ url('ranked_submissions', problem.code) }}">
{% if not show_contest_mode or not hide_contest_scoreboard %}
{{ problem.user_count }}
{% else %}
???
{% endif %}
</a>
</td>
</a>
</td>
{% elif problem.id in attempted_problems %}
<td solved="0">
<a href="{{ url('user_submissions', problem.code, request.user.username) }}">
{% if problem.is_public or show_contest_mode %}
<i class="attempted-problem-color fa fa-minus-circle"></i>
{% else %}
<i class="attempted-problem-color fa fa-lock"></i>
{% endif %}
</a>
</td>
{% else %}
<td solved="-1">
{% if problem.is_public or show_contest_mode %}
<i class="unsolved-problem-color fa fa-minus-circle"></i>
{% else %}
<i class="unsolved-problem-color fa fa-lock"></i>
{% endif %}
</td>
{% endif %}
{% endif %}
<td class="problem">
<a href="{{ url('problem_detail', problem.code) }}">{{ problem.i18n_name }}</a>
</td>
<td class="pcode">
<a class="pcodecell" href="{{ url('problem_detail', problem.code) }}">{{ problem.code }}</a>
</td>
{% if not show_contest_mode %}
<td class="category">{{ problem.group.full_name }}</td>
{% endif %}
{% if show_types %}
<td class="types">
{% for type in problem.types_list %}
<span class="type-tag">{{ type }}</span>{% if not loop.last %}, {% endif %}
{% endfor %}
</td>
{% endif %}
<td class="p">{{ problem.points|floatformat }}{% if problem.partial %}p{% endif %}</td>
{% if not show_contest_mode %}
<td class="ac-rate">{{ problem.ac_rate|floatformat(0) }}%</td>
{% endif %}
{% if not has_hidden_subtasks %}
<td class="users">
<a href="{{ url('ranked_submissions', problem.code) }}">
{% if not show_contest_mode or not hide_contest_scoreboard %}
{{ problem.user_count }}
{% else %}
???
{% endif %}
</a>
</td>
{% endif %}
{% if show_editorial%}
<td class="editorial">
{% if problem.has_public_editorial %}
<a href="{{ url('problem_editorial', problem.code) }}">{{ _('Editorial') }}</a>
{% endif %}
</td>
{% endif %}
</tr>
{% endfor %}
</tbody>
{% if show_editorial%}
<td class="editorial">
{% if problem.has_public_editorial %}
<a href="{{ url('problem_editorial', problem.code) }}">{{ _('Editorial') }}</a>
{% endif %}
</td>
{% endif %}
</tr>
{% endfor %}
</tbody>
</table>
{% if show_contest_mode and request.participation.contest.use_clarifications %}
<br><br>
{% if can_edit_contest %}
<div style="float: right; font-size: 1.2em">
<a href="{{url('new_contest_clarification', request.participation.contest.key)}}"><i class="fa fa-plus-circle" class="green"></i> <u>{{_('Add clarifications')}}</u></a>
</div>
{% endif %}
{% if has_clarifications %}
<div style="font-size: 1.2em; font-style: bold">
<i class="fa fa-question-circle"></i> {{_('Clarifications')}}</div>
<table class="table">
<tr>
<th>{{_('Problem')}}</th>
<th>{{_('Time')}}</th>
<th>{{_('Description')}}</th>
</tr>
{% for clarification in clarifications %}
<tr>
<td>
<a href="{{ url('problem_detail', clarification.problem.problem.code) }}"
class="problem">
{{ clarification.problem.problem.name }}
</a>
</td>
<td class="time">{{ relative_time(clarification.date) }}</td>
<td><p style="overflow-wrap: break-word; word-break: break-word">{{clarification.description}}</p></td>
</tr>
{% endfor %}
</table>
{% if show_contest_mode and request.participation.contest.use_clarifications %}
<br><br>
{% if can_edit_contest %}
<div style="float: right; font-size: 1.2em">
<a href="{{url('new_contest_clarification', request.participation.contest.key)}}"><i class="fa fa-plus-circle" class="green"></i> <u>{{_('Add clarifications')}}</u></a>
</div>
{% endif %}
{% if has_clarifications %}
<div style="font-size: 1.2em; font-style: bold">
<i class="fa fa-question-circle"></i> {{_('Clarifications')}}</div>
<table class="table">
<tr>
<th>{{_('Problem')}}</th>
<th>{{_('Time')}}</th>
<th>{{_('Description')}}</th>
</tr>
{% for clarification in clarifications %}
<tr>
<td>
<a href="{{ url('problem_detail', clarification.problem.problem.code) }}"
class="problem">
{{ clarification.problem.problem.name }}
</a>
</td>
<td class="time">{{ relative_time(clarification.date) }}</td>
<td><p style="overflow-wrap: break-word; word-break: break-word">{{clarification.description}}</p></td>
</tr>
{% endfor %}
</table>
{% else %}
<p style="font-style: italic; text-align: center">
{{ _('No clarifications have been made at this time.') }}</center>
</p>
{% endif %}
{% endif %}
</div>
{% if page_obj.num_pages > 1 %}
<div style="margin-top:10px;">{% include "list-pages.html" %}</div>
{% else %}
<p style="font-style: italic; text-align: center">
{{ _('No clarifications have been made at this time.') }}</center>
</p>
{% endif %}
{% endif %}
</div>
{% if page_obj.num_pages > 1 %}
<div style="margin-top:10px;">{% include "list-pages.html" %}</div>
{% endif %}
{% endblock %}

View file

@ -1,183 +1,183 @@
{% extends "base.html" %}
{% block media %}
<style>
.panes {
display: flex;
flex-wrap: wrap;
justify-content: center;
}
<style>
.panes {
display: flex;
flex-wrap: wrap;
justify-content: center;
}
.pane {
display: block;
max-width: 25em;
border: 1px #ccc solid;
border-radius: 5px;
padding: 10px;
margin: 10px;
}
.pane {
display: block;
max-width: 25em;
border: 1px #ccc solid;
border-radius: 5px;
padding: 10px;
margin: 10px;
}
.pane h3 {
display: block;
background: #3b3b3b;
padding: 5px 10px 10px;
margin: -10px -10px 10px;
border-radius: 5px 5px 0 0;
}
.pane h3 {
display: block;
background: #3b3b3b;
padding: 5px 10px 10px;
margin: -10px -10px 10px;
border-radius: 5px 5px 0 0;
}
.control-group {
margin: 1em 0;
}
.control-group {
margin: 1em 0;
}
.control-group:not(:first-of-type) {
border-top: 1px solid #ccc;
padding-top: 0.5em;
}
.control-group:not(:first-of-type) {
border-top: 1px solid #ccc;
padding-top: 0.5em;
}
.control-group label {
display: block;
margin-bottom: 0.5em;
}
.control-group label {
display: block;
margin-bottom: 0.5em;
}
.control-group select {
display: block;
width: 100%;
}
</style>
.control-group select {
display: block;
width: 100%;
}
</style>
{% endblock %}
{% block js_media %}
<script>
$(function () {
$('#by-lang-filter').select2({
multiple: true,
placeholder: '{{ _('Leave empty to not filter by language') }}'
});
<script>
$(function () {
$('#by-lang-filter').select2({
multiple: true,
placeholder: '{{ _('Leave empty to not filter by language') }}'
});
$('#by-result-filter').select2({
multiple: true,
placeholder: '{{ _('Leave empty to not filter by result') }}'
});
$('#by-result-filter').select2({
multiple: true,
placeholder: '{{ _('Leave empty to not filter by result') }}'
});
$('#rescore-all').click(function (e) {
e.preventDefault();
if (confirm(this.dataset.warning)) {
$(this).parents('form').submit();
}
});
$('#rescore-all').click(function (e) {
e.preventDefault();
if (confirm(this.dataset.warning)) {
$(this).parents('form').submit();
}
});
var $use_id = $('#by-range-check');
var $id_start = $('#by-range-start');
var $id_end = $('#by-range-end');
var actionClick = function (e) {
e.preventDefault();
if ($use_id.prop('checked')) {
var start = parseInt($id_start.val());
var end = parseInt($id_end.val());
if (!start || !end) {
alert("{{ _('Need valid values for both start and end IDs.') }}");
return;
} else if (start > end) {
alert("{{ _('End ID must be after start ID.') }}");
return;
}
}
var $use_id = $('#by-range-check');
var $id_start = $('#by-range-start');
var $id_end = $('#by-range-end');
var $form = $('#form-action');
var input = $("<input>")
.attr("type", "hidden")
.attr("name", "action").val(e.data.action);
$form.append(input);
var actionClick = function (e) {
e.preventDefault();
if ($use_id.prop('checked')) {
var start = parseInt($id_start.val());
var end = parseInt($id_end.val());
if (!start || !end) {
alert("{{ _('Need valid values for both start and end IDs.') }}");
return;
} else if (start > end) {
alert("{{ _('End ID must be after start ID.') }}");
return;
}
}
$.post('{{ url('problem_submissions_rejudge_preview', problem.code) }}', $form.serialize(), 'text')
.done(function (count) {
if (confirm("{{ _('You are about to {action} {count} submissions. Are you sure you want to do this?') }}"
.replace('{count}', count)
.replace('{action}', e.data.action))) {
$form.submit();
}
})
.fail(function () {
if (confirm("{{ _('You are about to {action} a few submissions. Are you sure you want to do this?') }}".replace('{action}', e.data.action))) {
$form.submit();
}
});
};
$('#rejudge-selected').on('click', {action: 'rejudge'}, actionClick);
$('#download-selected').on('click', {action: 'download'}, actionClick);
$use_id.change(function () {
$('#by-range-filter').find('input').prop('disabled', !this.checked);
});
var $form = $('#form-action');
var input = $("<input>")
.attr("type", "hidden")
.attr("name", "action").val(e.data.action);
$form.append(input);
$.post('{{ url('problem_submissions_rejudge_preview', problem.code) }}', $form.serialize(), 'text')
.done(function (count) {
if (confirm("{{ _('You are about to {action} {count} submissions. Are you sure you want to do this?') }}"
.replace('{count}', count)
.replace('{action}', e.data.action))) {
$form.submit();
}
})
.fail(function () {
if (confirm("{{ _('You are about to {action} a few submissions. Are you sure you want to do this?') }}".replace('{action}', e.data.action))) {
$form.submit();
}
});
</script>
};
$('#rejudge-selected').on('click', {action: 'rejudge'}, actionClick);
$('#download-selected').on('click', {action: 'download'}, actionClick);
$use_id.change(function () {
$('#by-range-filter').find('input').prop('disabled', !this.checked);
});
});
</script>
{% endblock %}
{% block body %}
{% include "messages.html" %}
{% include "messages.html" %}
<div class="panes">
{% if request.user.has_perm('judge.rejudge_submission_lot') %}
<div class="pane">
<h3 class="white">{{ _('Filter submissions') }}</h3>
<form action="{{ url('problem_submissions_action', problem.code) }}" method="post" id="form-action">
{% csrf_token %}
<div class="control-group">
<label><input id="by-range-check" type="checkbox" name="use_range" value="on">
{{ _('Filter by ID:') }}</label>
<table id="by-range-filter" class="table">
<tr>
<th><label for="by-range-start">{{ _('Starting ID:') }}</label></th>
<td><input id="by-range-start" name="start" type="number" disabled></td>
</tr>
<tr>
<th><label for="by-range-end">{{ _('Ending ID:') }}</label></th>
<td><input id="by-range-end" name="end" type="number" disabled></td>
</tr>
</table>
<p>{{ _('This range includes both endpoints.') }}</p>
</div>
<div class="control-group">
<label for="by-lang-filter">{{ _('Filter by language:') }}</label>
<select id="by-lang-filter" name="language" multiple>
{% for id, name in languages %}
<option value="{{ id }}">{{ name }}</option>
{% endfor %}
</select>
</div>
<div class="control-group">
<label for="by-result-filter">{{ _('Filter by result:') }}</label>
<select id="by-result-filter" name="result" multiple>
{% for name in results %}
<option>{{ name }}</option>
{% endfor %}
</select>
</div>
</form>
</div>
<div class="pane">
<h3> {{ _('Action') }} </h3>
<a id="rejudge-selected" class="unselectable button full" href="#">
{{ _('Rejudge selected submissions') }}
</a>
</br>
<div class="panes">
{% if request.user.has_perm('judge.rejudge_submission_lot') %}
<div class="pane">
<h3 class="white">{{ _('Filter submissions') }}</h3>
<form action="{{ url('problem_submissions_action', problem.code) }}" method="post" id="form-action">
{% csrf_token %}
<div class="control-group">
<label><input id="by-range-check" type="checkbox" name="use_range" value="on">
{{ _('Filter by ID:') }}</label>
<table id="by-range-filter" class="table">
<tr>
<th><label for="by-range-start">{{ _('Starting ID:') }}</label></th>
<td><input id="by-range-start" name="start" type="number" disabled></td>
</tr>
<tr>
<th><label for="by-range-end">{{ _('Ending ID:') }}</label></th>
<td><input id="by-range-end" name="end" type="number" disabled></td>
</tr>
</table>
<p>{{ _('This range includes both endpoints.') }}</p>
</div>
<div class="control-group">
<label for="by-lang-filter">{{ _('Filter by language:') }}</label>
<select id="by-lang-filter" name="language" multiple>
{% for id, name in languages %}
<option value="{{ id }}">{{ name }}</option>
{% endfor %}
</select>
</div>
<div class="control-group">
<label for="by-result-filter">{{ _('Filter by result:') }}</label>
<select id="by-result-filter" name="result" multiple>
{% for name in results %}
<option>{{ name }}</option>
{% endfor %}
</select>
</div>
</form>
</div>
<div class="pane">
<h3> {{ _('Action') }} </h3>
<a id="rejudge-selected" class="unselectable button full" href="#">
{{ _('Rejudge selected submissions') }}
</a>
</br>
<a id="download-selected" class="unselectable button full" href="#">
{{ _('Download selected submissions') }}
</a>
<br>
<form action="{{ url('problem_submissions_rescore_all', problem.code) }}" method="post">
{% csrf_token %}
<a id="rescore-all" class="unselectable button full" href="#"
data-warning="{{ _('Are you sure you want to rescore %(count)d submissions?', count=submission_count) }}">
{{ _('Rescore all submissions') }}
</a>
</form>
</div>
{% endif %}
</div>
<a id="download-selected" class="unselectable button full" href="#">
{{ _('Download selected submissions') }}
</a>
<br>
<form action="{{ url('problem_submissions_rescore_all', problem.code) }}" method="post">
{% csrf_token %}
<a id="rescore-all" class="unselectable button full" href="#"
data-warning="{{ _('Are you sure you want to rescore %(count)d submissions?', count=submission_count) }}">
{{ _('Rescore all submissions') }}
</a>
</form>
</div>
{% endif %}
</div>
{% endblock %}

View file

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

View file

@ -1,8 +1,8 @@
{% extends "tabs-base.html" %}
{% block tabs %}
{% if perms.judge.edit_all_problem or perms.judge.edit_public_problem or perms.judge.edit_own_problem %}
{{ make_tab('list', 'fa-list', url('problem_list'), _('List')) }}
{{ make_tab('admin', 'fa-edit', url('admin:judge_problem_changelist'), _('Admin')) }}
{% endif %}
{% if perms.judge.edit_all_problem or perms.judge.edit_public_problem or perms.judge.edit_own_problem %}
{{ make_tab('list', 'fa-list', url('problem_list'), _('List')) }}
{{ make_tab('admin', 'fa-edit', url('admin:judge_problem_changelist'), _('Admin')) }}
{% endif %}
{% endblock %}

View file

@ -1,424 +1,424 @@
{% extends "common-content.html" %}
{% block content_media %}
{% include "comments/media-css.html" %}
{% include "actionbar/media-css.html" %}
<style>
.title-state {
font-size: 2em;
float: left;
width: 1.1em;
display: block;
margin-top: 0.16em;
}
{% include "comments/media-css.html" %}
{% include "actionbar/media-css.html" %}
<style>
.title-state {
font-size: 2em;
float: left;
width: 1.1em;
display: block;
margin-top: 0.16em;
}
.info-float a {
vertical-align: middle;
}
.info-float a {
vertical-align: middle;
}
.clarifications-area h2 {
margin-bottom: 20px;
}
.clarifications-area h2 {
margin-bottom: 20px;
}
.problem-clarification .body {
display: inline-block;
padding-left: 3em;
}
.problem-clarification .body {
display: inline-block;
padding-left: 3em;
}
#content-right {
max-width: 12.5em;
min-width: 12.5em;
}
#content-right {
max-width: 12.5em;
min-width: 12.5em;
}
#problem-types, #allowed-langs, #available-judges {
padding-top: 1em;
}
#problem-types, #allowed-langs, #available-judges {
padding-top: 1em;
}
.problem-info-entry {
padding-top: 0.5em;
}
.problem-info-entry {
padding-top: 0.5em;
}
#raw_problem {
visibility: hidden;
width: 0;
height: 0;
}
#raw_problem {
visibility: hidden;
width: 0;
height: 0;
}
#comment-section {
display: none;
}
</style>
#comment-section {
display: none;
}
</style>
{% endblock %}
{% block content_js_media %}
{% include "comments/media-js.html" %}
{% include "actionbar/media-js.html" %}
{% if request.in_contest_mode %}
<script type="text/javascript">
window.register_contest_notification("{{url('contest_clarification_ajax', request.participation.contest.key)}}");
</script>
{% endif %}
{% include "comments/media-js.html" %}
{% include "actionbar/media-js.html" %}
{% if request.in_contest_mode %}
<script type="text/javascript">
$(function() {
$('#pdf_button').click(async function(e) {
e.preventDefault();
if (!$('#raw_problem').attr('src')) {
$('#raw_problem').attr('src', '{{problem.code}}/raw')
}
while(!$('.math-loaded', frames['raw_problem'].document).length){
await new Promise(r => setTimeout(r, 200));
}
frames['raw_problem'].print();
});
$('#clarification_header').on('click', function() {
$('#clarification_header_container').hide();
window.scrollTo(0, document.body.scrollHeight);
})
$('#comment-announcement').on('click', function() {
$('#comment-section').show();
$('#comment-announcement').hide();
})
if (window.location.href.includes('#comment')) {
$('#comment-announcement').click();
}
{% if not available_judges %}
$('#judge-toggle').click();
{% endif %}
});
window.register_contest_notification("{{url('contest_clarification_ajax', request.participation.contest.key)}}");
</script>
{% endif %}
<script type="text/javascript">
$(function() {
$('#pdf_button').click(async function(e) {
e.preventDefault();
if (!$('#raw_problem').attr('src')) {
$('#raw_problem').attr('src', '{{problem.code}}/raw')
}
while(!$('.math-loaded', frames['raw_problem'].document).length){
await new Promise(r => setTimeout(r, 200));
}
frames['raw_problem'].print();
});
$('#clarification_header').on('click', function() {
$('#clarification_header_container').hide();
window.scrollTo(0, document.body.scrollHeight);
})
$('#comment-announcement').on('click', function() {
$('#comment-section').show();
$('#comment-announcement').hide();
})
if (window.location.href.includes('#comment')) {
$('#comment-announcement').click();
}
{% if not available_judges %}
$('#judge-toggle').click();
{% endif %}
});
</script>
{% endblock %}
{% block title_row %}
<div class="problem-title">
{% if request.user.is_authenticated %}
{% 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 %}
<i class="solved-problem-color title-state fa fa-check-circle"></i>
{% else %}
<i class="solved-problem-color title-state fa fa-lock"></i>
{% endif %}
</a>
{% elif problem.id in attempted_problems %}
<a href="{{ url('user_submissions', problem.code, request.user.username) }}">
{% if problem.is_public or request.in_contest_mode %}
<i class="attempted-problem-color title-state fa fa-minus-circle"></i>
{% else %}
<i class="attempted-problem-color title-state fa fa-lock"></i>
{% endif %}
</a>
{% endif %}
{% endif %}
<h2 class="title-row" style="display: inline-block">{{ title }}</h2>
{% 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>
{% endfor %}
</span>
{% endif %}
<span class="spacer"></span>
{% if has_render %}
<a href="{{ url('problem_pdf', problem.code) }}" class="view-pdf" target="_blank">
{% elif problem.pdf_description %}
<a href="{{ url('problem_pdf_description', problem.code) }}" class="view-pdf" target="_blank">
{% else %}
<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="pdf-icon-bar"></span>
</span>
{{ _('View as PDF') }}
<div class="problem-title">
{% if request.user.is_authenticated %}
{% 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 %}
<i class="solved-problem-color title-state fa fa-check-circle"></i>
{% else %}
<i class="solved-problem-color title-state fa fa-lock"></i>
{% endif %}
</a>
</div>
{% elif problem.id in attempted_problems %}
<a href="{{ url('user_submissions', problem.code, request.user.username) }}">
{% if problem.is_public or request.in_contest_mode %}
<i class="attempted-problem-color title-state fa fa-minus-circle"></i>
{% else %}
<i class="attempted-problem-color title-state fa fa-lock"></i>
{% endif %}
</a>
{% endif %}
{% endif %}
<h2 class="title-row" style="display: inline-block">{{ title }}</h2>
{% 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>
{% endfor %}
</span>
{% endif %}
<span class="spacer"></span>
{% if has_render %}
<a href="{{ url('problem_pdf', problem.code) }}" class="view-pdf" target="_blank">
{% elif problem.pdf_description %}
<a href="{{ url('problem_pdf_description', problem.code) }}" class="view-pdf" target="_blank">
{% else %}
<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="pdf-icon-bar"></span>
</span>
{{ _('View as PDF') }}
</a>
</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>
<div class="submissions-left">
{% trans trimmed counter=submissions_left %}
{{ counter }} submission left
{% pluralize %}
{{ counter }} submissions left
{% endtrans %}
</div>
{% else %}
<a class="unselectable button full disabled small">{{ _('Submit solution') }}</a>
<div class="no-submissions-left submissions-left">{{ _('0 submissions left') }}</div>
{% endif %}
{% 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>
<div class="submissions-left">
{% trans trimmed counter=submissions_left %}
{{ counter }} submission left
{% pluralize %}
{{ counter }} submissions left
{% endtrans %}
</div>
{% else %}
<a href="{{ url('problem_submit', problem.code) }}" class="unselectable button full btn-green small">
{{ _('Submit solution') }}
</a>
<a class="unselectable button full disabled small">{{ _('Submit solution') }}</a>
<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>
{% endif %}
<hr style="padding-bottom: 0.3em">
<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>
{% if request.user.is_authenticated and has_submissions %}
<div>
<a href="{{ url('user_submissions', problem.code, request.user.username) }}">{{ _('My submissions') }}</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 %}
</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>
{% 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 %}
{% 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>
</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>
</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>
</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>
<hr style="padding-top: 0.7em">
{% cache 86400 'problem_authors' problem.id LANGUAGE_CODE %}
{% with authors=problem.authors.all() %}
{% 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 %}
Author:
{% pluralize count %}
Authors:
{% endtrans %}</span>
<div class="pi-value authors-value">{{ link_users(authors) }}</div>
</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 %}
</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>
{% 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 %}
{% 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 %}
{% endfor %}
{% else %}
{{ available_judges|join(", ") }}
{% 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 %}
{% endif %}
</span>
{% else %}
<i class="red">{{ _('none available') }}</i>
{% endif %}
</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>
</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>
</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>
<hr style="padding-top: 0.7em">
{% cache 86400 'problem_authors' problem.id LANGUAGE_CODE %}
{% with authors=problem.authors.all() %}
{% 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 %}
Author:
{% pluralize count %}
Authors:
{% endtrans %}</span>
<div class="pi-value authors-value">{{ link_users(authors) }}</div>
</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 %}
{% 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 %}
{% endfor %}
{% else %}
{{ available_judges|join(", ") }}
{% endif %}
{% else %}
<i class="red">{{ _('none available') }}</i>
{% endif %}
</div>
</div>
{% endif %}
</div>
{% endif %}
{% endblock %}
{% block description %}
{% if contest_problem and contest_problem.contest.use_clarifications and has_clarifications %}
<div id="clarification_header_container">
<i class="fa fa-question-circle"></i>
<a id="clarification_header">
{% trans trimmed length=clarifications|length %}
This problem has {{length}} clarification(s)
{% endtrans %}
</a>
</div>
{% if contest_problem and contest_problem.contest.use_clarifications and has_clarifications %}
<div id="clarification_header_container">
<i class="fa fa-question-circle"></i>
<a id="clarification_header">
{% trans trimmed length=clarifications|length %}
This problem has {{length}} clarification(s)
{% endtrans %}
</a>
</div>
{% endif %}
{% cache 86400 'problem_html' problem.id MATH_ENGINE LANGUAGE_CODE %}
{{ description|markdown(lazy_load=True)|reference|str|safe }}
{% endcache %}
{% if problem.pdf_description %}
<embed src="{{url('problem_pdf_description', problem.code)}}" width="100%" height="500" type="application/pdf">
{% endif %}
{% with license=problem.license %}
{% if license %}
<span class="license">
<a href="{{ url('license', license.key) }}">{{ license.display or license.name }}</a>
</span>
<div style="clear:both"></div>
{% endif %}
{% cache 86400 'problem_html' problem.id MATH_ENGINE LANGUAGE_CODE %}
{{ description|markdown(lazy_load=True)|reference|str|safe }}
{% endcache %}
{% if problem.pdf_description %}
<embed src="{{url('problem_pdf_description', problem.code)}}" width="100%" height="500" type="application/pdf">
{% endif %}
{% with license=problem.license %}
{% if license %}
<span class="license">
<a href="{{ url('license', license.key) }}">{{ license.display or license.name }}</a>
</span>
<div style="clear:both"></div>
{% endif %}
{% endwith %}
{% endwith %}
{% endblock %}
{% block post_description_end %}
{% if request.user.is_authenticated and not request.profile.mute %}
{%- if contest_problem and contest_problem.contest.use_clarifications and request.profile.current_contest.live -%}
<a href="{{ url('new_problem_ticket', problem.code) }}" class="clarify">
<i class="fa fa-flag" style="margin-right:0.5em"></i>
{{ _('Request clarification') }}
</a>
<div style="clear: both"></div>
{%- else -%}
{% set actionbar_report_url = url('new_problem_ticket', problem.code) %}
{% include "actionbar/list.html" %}
<br>
{%- endif -%}
{% endif %}
{% if not (contest_problem and contest_problem.contest.use_clarifications) %}
<div id="comment-announcement-container">
<div id="comment-announcement">
{% if has_comments %}
{{_('View comments')}} ({{comment_list.count()}})
{% else %}
{{_('Be the first to comment')}}
{% endif %}
</div>
</div>
{% endif %}
{% if request.user.is_authenticated and not request.profile.mute %}
{%- if contest_problem and contest_problem.contest.use_clarifications and request.profile.current_contest.live -%}
<a href="{{ url('new_problem_ticket', problem.code) }}" class="clarify">
<i class="fa fa-flag" style="margin-right:0.5em"></i>
{{ _('Request clarification') }}
</a>
<div style="clear: both"></div>
{%- else -%}
{% set actionbar_report_url = url('new_problem_ticket', problem.code) %}
{% include "actionbar/list.html" %}
<br>
{%- endif -%}
{% endif %}
{% if not (contest_problem and contest_problem.contest.use_clarifications) %}
<div id="comment-announcement-container">
<div id="comment-announcement">
{% if has_comments %}
{{_('View comments')}} ({{comment_list.count()}})
{% else %}
{{_('Be the first to comment')}}
{% endif %}
</div>
</div>
{% endif %}
{% endblock %}
{% block comments %}
{% if contest_problem and contest_problem.contest.use_clarifications %}
<div class="clarifications-area">
<h2><i class="fa fa-question-circle"></i> {{ _('Clarifications') }}</h2>
{% if has_clarifications %}
{% for clarification in clarifications %}
<div class="problem-clarification">
<div class="time">{{ relative_time(clarification.date) }}</div>
<span class="body">
{{ clarification.description|markdown|reference }}
</span>
</div>
{% endfor %}
{% else %}
<p class="no-comments-message">{{ _('No clarifications have been made at this time.') }}</p>
{% endif %}
</div>
{% else %}
<div id="comment-section">
{% include "comments/list.html" %}
</div>
{% endif %}
<iframe name="raw_problem" id="raw_problem"></iframe>
{% if contest_problem and contest_problem.contest.use_clarifications %}
<div class="clarifications-area">
<h2><i class="fa fa-question-circle"></i> {{ _('Clarifications') }}</h2>
{% if has_clarifications %}
{% for clarification in clarifications %}
<div class="problem-clarification">
<div class="time">{{ relative_time(clarification.date) }}</div>
<span class="body">
{{ clarification.description|markdown|reference }}
</span>
</div>
{% endfor %}
{% else %}
<p class="no-comments-message">{{ _('No clarifications have been made at this time.') }}</p>
{% endif %}
</div>
{% else %}
<div id="comment-section">
{% include "comments/list.html" %}
</div>
{% endif %}
<iframe name="raw_problem" id="raw_problem"></iframe>
{% endblock %}
{% block bodyend %}
{{ super() }}
{% include "comments/math.html" %}
{{ super() }}
{% include "comments/math.html" %}
{% endblock %}

View file

@ -1,107 +1,107 @@
<!DOCTYPE html>
<html>
<head>
<head>
<link rel="stylesheet" href="{{ static('style.css') }}">
<link rel="stylesheet" href="{{ static('pygment-github.css') }}" type="text/css">
<link rel="stylesheet" href="{{ static('markdown.css') }}">
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="pygment-github.css" type="text/css">
<link rel="stylesheet" href="markdown.css">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>
html {
background: white;
}
html {
background: white;
}
body {
overflow: hidden;
page-break-after: always;
background: white;
}
body {
overflow: hidden;
page-break-after: always;
background: white;
}
tr {
page-break-inside: avoid;
}
tr {
page-break-inside: avoid;
}
#info-table {
width: auto;
background: white;
}
#info-table {
width: auto;
background: white;
}
#info-table td {
text-align: left;
}
#info-table td {
text-align: left;
}
#info-table td.value {
min-width: 10em;
}
#info-table td.value {
min-width: 10em;
}
#info-table td.key {
font-weight: bold;
}
#info-table td.key {
font-weight: bold;
}
.lang-limit {
margin-left: 1.5em;
}
.lang-limit {
margin-left: 1.5em;
}
.lang-name:after {
content: ": ";
}
.lang-name:after {
content: ": ";
}
.problem-info-entry {
vertical-align: top;
float: center;
padding: 0.6em;
display: inline-block;
text-align: left;
}
.problem-info-entry {
vertical-align: top;
float: center;
padding: 0.6em;
display: inline-block;
text-align: left;
}
</style>
</head>
</head>
<body>
<h2 style="color:#393630; display: inline-block;">{{ problem_name }}</h2>
<hr>
<div align="center" style="position: relative;">
<div class="problem-info-entry">
<body>
<h2 style="color:#393630; display: inline-block;">{{ problem_name }}</h2>
<hr>
<div align="center" style="position: relative;">
<div class="problem-info-entry">
<b>{{ _('Input:') }}</b> {{ fileio_input or _('stdin') }}
</div>
<div class="problem-info-entry">
</div>
<div class="problem-info-entry">
<b>{{ _('Output:') }}</b> {{ fileio_output or _('stdout') }}
</div>
<div class="problem-info-entry">
</div>
<div class="problem-info-entry">
<b>{{ _('Time Limit:') }}</b> {{ problem.time_limit }}s
{% for name, limit in problem.language_time_limit %}
<div class="lang-limit">
<span class="lang-name">{{ name }}</span>
<span>{{ limit }}s</span>
</div>
<div class="lang-limit">
<span class="lang-name">{{ name }}</span>
<span>{{ limit }}s</span>
</div>
{% endfor %}
</div>
<div class="problem-info-entry">
</div>
<div class="problem-info-entry">
<b>{{ _('Memory Limit:') }}</b> {{ problem.memory_limit|kbsimpleformat}}
{% for name, limit in problem.language_memory_limit %}
<div class="lang-limit">
<span class="lang-name">{{ name }}</span>
<span>{{ limit|kbsimpleformat }}</span>
</div>
<div class="lang-limit">
<span class="lang-name">{{ name }}</span>
<span>{{ limit|kbsimpleformat }}</span>
</div>
{% endfor %}
</div>
</div>
<hr style="clear: both;">
<div class="content-description printing">
{{ description|markdown|reference|absolutify(url)|str|safe }}
</div>
</div>
<hr style="clear: both;">
<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 () {
<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'});
window.callPhantom({'action': 'snapshot'});
document.body.classList.add('math-loaded');
});
</script>
</body>
});
</script>
</body>
</html>

View file

@ -1,22 +1,22 @@
{% if last_attempted_problems%}
<div class="sidebox">
<h3>{{ _('Last unsolved') }} <i class="fa fa-bullseye"></i>
</h3>
<div class="sidebox-content" style="padding: 0; border: 0">
<table class="table feed-table">
<tbody>
{% for problem in last_attempted_problems %}
<tr>
<td>
<a href="{{ url('problem_detail', problem.code) }}">{{ problem.name }}</a>
</td>
<td>
<a href="{{ url('submission_status', problem.last_submission) }}">{{ problem.last_submission }}</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% if last_attempted_problems%}
<div class="sidebox">
<h3>{{ _('Last unsolved') }} <i class="fa fa-bullseye"></i>
</h3>
<div class="sidebox-content" style="padding: 0; border: 0">
<table class="table feed-table">
<tbody>
{% for problem in last_attempted_problems %}
<tr>
<td>
<a href="{{ url('problem_detail', problem.code) }}">{{ problem.name }}</a>
</td>
<td>
<a href="{{ url('submission_status', problem.last_submission) }}">{{ problem.last_submission }}</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% endif %}

View file

@ -1,106 +1,106 @@
<div class="sidebox">
<h3>{{ _('Problem search') }} <i class="fa fa-search"></i>
</h3>
<div class="sidebox-content">
<form id="filter-form" name="form" action="" method="get">
<div>
<input id="search" type="text" name="search" value="{{ search_query or '' }}"
placeholder="{{ _('Search problems...') }}">
</div>
{% if feed_type != 'volunteer' and request.user.is_authenticated %}
<div>
<input id="hide_solved" type="checkbox" name="hide_solved" value="1"
{% if hide_solved %}checked{% endif %}>
<label for="hide_solved">{{ _('Hide solved problems') }}</label>
</div>
{% endif %}
{% if feed_type == 'volunteer' and request.user.is_authenticated %}
<div>
<input id="show_solved_only" type="checkbox" name="show_solved_only" value="1"
{% if show_solved_only %}checked{% endif %}>
<label for="show_solved_only">{{ _('Show solved problems') }}</label>
</div>
{% endif %}
{% if feed_type != 'volunteer' %}
<div>
<input id="show_types" type="checkbox" name="show_types" value="1"
{% if show_types %} checked{% endif %}>
<label for="show_types">{{ _('Show problem types') }}</label>
</div>
{% endif %}
{% if has_show_editorial_option %}
<div>
<input id="show_editorial" type="checkbox" name="show_editorial" value="1"
{% if show_editorial %} checked{% endif %}>
<label for="show_editorial">{{ _('Show editorial') }}</label>
</div>
{% endif %}
{% if has_have_editorial_option %}
<div>
<input id="have_editorial" type="checkbox" name="have_editorial" value="1"
{% if have_editorial %} checked{% endif %}>
<label for="have_editorial">{{ _('Have editorial') }}</label>
</div>
{% endif %}
{% if organizations %}
<div class="filter-form-group">
<label for="type"><i>{{ _('Group') }}</i></label>
<select id="search-org" name="orgs" multiple>
{% for org in organizations %}
<option value="{{ org.id }}"{% if org.id in org_query %} selected{% endif %}>
{{ org.name }}
</option>
{% endfor %}
</select>
</div>
{% endif %}
<div class="filter-form-group">
<label for="type"><i>{{ _('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 }}
</option>
{% endfor %}
</select>
</div>
<div class="filter-form-group">
<label for="category"><i>{{ _('Category') }}</i></label>
<select id="category" name="category">
{% if category %}
<option value="" selected="selected">{{ _('All') }}</option>
{% else %}
<option value="">{{ _('All') }}</option>{% endif %}
<option disabled="disabled">---</option>
{% for group in categories %}
<option value="{{ group.id }}"{% if group.id == category %} selected{% endif %}>
{{ group.full_name }}
</option>
{% endfor %}
</select>
</div>
{% if show_types %}
<div class="filter-form-group">
<label for="type"><i>{{ _('Problem types') }}</i></label>
<select id="types" name="type" multiple>
{% for type in problem_types %}
<option value="{{ type.id }}"{% if type.id in selected_types %} selected{% endif %}>
{{ type.full_name }}
</option>
{% endfor %}
</select>
</div>
{% endif %}
{% if point_values %}
<div class="form-label">{{ _('Point range') }}</div>
<div id="point-slider"></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 %}>
<div class="form-submit-group">
<a id="go" class="button small btn-darkred">{{ _('Go') }}</a>
<a id="random" class="button small btn-darkred">{{ _('Random') }}</a>
</div>
</form>
</div>
<h3>{{ _('Problem search') }} <i class="fa fa-search"></i>
</h3>
<div class="sidebox-content">
<form id="filter-form" name="form" action="" method="get">
<div>
<input id="search" type="text" name="search" value="{{ search_query or '' }}"
placeholder="{{ _('Search problems...') }}">
</div>
{% if feed_type != 'volunteer' and request.user.is_authenticated %}
<div>
<input id="hide_solved" type="checkbox" name="hide_solved" value="1"
{% if hide_solved %}checked{% endif %}>
<label for="hide_solved">{{ _('Hide solved problems') }}</label>
</div>
{% endif %}
{% if feed_type == 'volunteer' and request.user.is_authenticated %}
<div>
<input id="show_solved_only" type="checkbox" name="show_solved_only" value="1"
{% if show_solved_only %}checked{% endif %}>
<label for="show_solved_only">{{ _('Show solved problems') }}</label>
</div>
{% endif %}
{% if feed_type != 'volunteer' %}
<div>
<input id="show_types" type="checkbox" name="show_types" value="1"
{% if show_types %} checked{% endif %}>
<label for="show_types">{{ _('Show problem types') }}</label>
</div>
{% endif %}
{% if has_show_editorial_option %}
<div>
<input id="show_editorial" type="checkbox" name="show_editorial" value="1"
{% if show_editorial %} checked{% endif %}>
<label for="show_editorial">{{ _('Show editorial') }}</label>
</div>
{% endif %}
{% if has_have_editorial_option %}
<div>
<input id="have_editorial" type="checkbox" name="have_editorial" value="1"
{% if have_editorial %} checked{% endif %}>
<label for="have_editorial">{{ _('Have editorial') }}</label>
</div>
{% endif %}
{% if organizations %}
<div class="filter-form-group">
<label for="type"><i>{{ _('Group') }}</i></label>
<select id="search-org" name="orgs" multiple>
{% for org in organizations %}
<option value="{{ org.id }}"{% if org.id in org_query %} selected{% endif %}>
{{ org.name }}
</option>
{% endfor %}
</select>
</div>
{% endif %}
<div class="filter-form-group">
<label for="type"><i>{{ _('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 }}
</option>
{% endfor %}
</select>
</div>
<div class="filter-form-group">
<label for="category"><i>{{ _('Category') }}</i></label>
<select id="category" name="category">
{% if category %}
<option value="" selected="selected">{{ _('All') }}</option>
{% else %}
<option value="">{{ _('All') }}</option>{% endif %}
<option disabled="disabled">---</option>
{% for group in categories %}
<option value="{{ group.id }}"{% if group.id == category %} selected{% endif %}>
{{ group.full_name }}
</option>
{% endfor %}
</select>
</div>
{% if show_types %}
<div class="filter-form-group">
<label for="type"><i>{{ _('Problem types') }}</i></label>
<select id="types" name="type" multiple>
{% for type in problem_types %}
<option value="{{ type.id }}"{% if type.id in selected_types %} selected{% endif %}>
{{ type.full_name }}
</option>
{% endfor %}
</select>
</div>
{% endif %}
{% if point_values %}
<div class="form-label">{{ _('Point range') }}</div>
<div id="point-slider"></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 %}>
<div class="form-submit-group">
<a id="go" class="button small btn-darkred">{{ _('Go') }}</a>
<a id="random" class="button small btn-darkred">{{ _('Random') }}</a>
</div>
</form>
</div>
</div>

View file

@ -1,100 +1,100 @@
{% extends "common-content.html" %}
{% block js_media %}
<script type="text/javascript">
$(function () {
$('a.sub-case-status').featherlight($('.partial-output-window'), {
afterOpen: function () {
var $parent = this.$currentTarget.parent();
var partial = $parent.attr('data-partial-output');
this.$instance.find('.partial-output-window').find('code').text(partial).end().show();
}
});
});
</script>
<script type="text/javascript" src="{{ static('libs/featherlight/featherlight.min.js') }}"></script>
<script type="text/javascript">
</script>
<script type="text/javascript">
$(function () {
$('a.sub-case-status').featherlight($('.partial-output-window'), {
afterOpen: function () {
var $parent = this.$currentTarget.parent();
var partial = $parent.attr('data-partial-output');
this.$instance.find('.partial-output-window').find('code').text(partial).end().show();
}
});
});
</script>
<script type="text/javascript" src="{{ static('libs/featherlight/featherlight.min.js') }}"></script>
<script type="text/javascript">
</script>
{% endblock %}
{% block media %}
<style>
#content-body {
overflow-x: auto;
padding-bottom: 0;
}
<style>
#content-body {
overflow-x: auto;
padding-bottom: 0;
}
.sub-id {
width: 4em;
min-width: 4em;
}
.sub-id {
width: 4em;
min-width: 4em;
}
.sub-username {
width: 5em;
}
.sub-username {
width: 5em;
}
.sub-result {
width: 3em;
}
.sub-result {
width: 3em;
}
.sub-language {
width: 6em;
}
.sub-language {
width: 6em;
}
.sub-date {
min-width: 8em;
}
.sub-date {
min-width: 8em;
}
.sub-case {
min-width: 3em;
}
.sub-case {
min-width: 3em;
}
.sub-case-status {
text-decoration: underline;
}
</style>
.sub-case-status {
text-decoration: underline;
}
</style>
{% endblock %}
{% block body %}
<table id="case-table" class="table">
<thead>
<tr>
<th class="sub-id">ID</th>
<th class="sub-username">Username</th>
<th class="sub-result">Result</th>
<th class="sub-language">Language</th>
<th class="sub-date">Date</th>
{% for case in range(num_cases) %}
<th class="sub-case">{{ loop.index }}</th>
{% endfor %}
</tr>
</thead>
<tbody>
{% for sub in submissions %}
<tr>
<td><a href="{{ url('submission_source', sub.id) }}">{{ sub.id }}</a></td>
<td>{{ link_user(sub.user) }}</td>
<td><span class="case-{{ sub.result }}">{{ sub.result }}</span></td>
<td>{{ sub.language.name }}</td>
<td><span class="time">{{ relative_time(sub.date) }}</span></td>
{% for case in sub.test_cases.all() %}
<td data-partial-output="{{ case.output }}">
{% if case.status == 'SC' %}
<span class="case-SC">---</span>
{% else %}
<a href="javascript:void(0);" class="sub-case-status case-{{ case.status }}">
{% if case.status == 'AC' %}
{{ case.time|floatformat(2) }}
{% else %}
{{ case.status }}
{% endif %}
</a>
{% endif %}
</td>
{% endfor %}
</tr>
<table id="case-table" class="table">
<thead>
<tr>
<th class="sub-id">ID</th>
<th class="sub-username">Username</th>
<th class="sub-result">Result</th>
<th class="sub-language">Language</th>
<th class="sub-date">Date</th>
{% for case in range(num_cases) %}
<th class="sub-case">{{ loop.index }}</th>
{% endfor %}
</tbody>
</table>
<div style="display: none" class="partial-output-window"><pre><code></code></pre></div>
</tr>
</thead>
<tbody>
{% for sub in submissions %}
<tr>
<td><a href="{{ url('submission_source', sub.id) }}">{{ sub.id }}</a></td>
<td>{{ link_user(sub.user) }}</td>
<td><span class="case-{{ sub.result }}">{{ sub.result }}</span></td>
<td>{{ sub.language.name }}</td>
<td><span class="time">{{ relative_time(sub.date) }}</span></td>
{% for case in sub.test_cases.all() %}
<td data-partial-output="{{ case.output }}">
{% if case.status == 'SC' %}
<span class="case-SC">---</span>
{% else %}
<a href="javascript:void(0);" class="sub-case-status case-{{ case.status }}">
{% if case.status == 'AC' %}
{{ case.time|floatformat(2) }}
{% else %}
{{ case.status }}
{% endif %}
</a>
{% endif %}
</td>
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>
<div style="display: none" class="partial-output-window"><pre><code></code></pre></div>
{% endblock %}

View file

@ -1,236 +1,236 @@
{% extends "base.html" %}
{% block js_media %}
<script type="text/javascript" src="{{ ACE_URL }}/ace.js"></script>
<script type="text/javascript" src="{{ static('jszip/jszip.min.js') }}"></script>
{{ form.media.js }}
{% compress js %}
<script type="text/javascript">
$(function () {
function format(state) {
if (!state.id) return state.text; // optgroup
return state.text;
}
<script type="text/javascript" src="{{ ACE_URL }}/ace.js"></script>
<script type="text/javascript" src="{{ static('jszip/jszip.min.js') }}"></script>
{{ form.media.js }}
{% compress js %}
<script type="text/javascript">
$(function () {
function format(state) {
if (!state.id) return state.text; // optgroup
return state.text;
}
window.previous_template = '';
window.previous_template = '';
function update_submit_area(code) {
window.previous_template = code;
$('textarea#id_source').val(code);
window.ace_source.getSession().setValue(code);
}
function update_submit_area(code) {
window.previous_template = code;
$('textarea#id_source').val(code);
window.ace_source.getSession().setValue(code);
}
function update_language_template() {
var source = $('textarea#id_source');
if (source.val() == window.previous_template.replace(/\r/g, '') || source.val() == '') {
var lang_id = $('#id_language').val();
var code = localStorage.getItem('submit:' + $('#id_language').val());
function update_language_template() {
var source = $('textarea#id_source');
if (source.val() == window.previous_template.replace(/\r/g, '') || source.val() == '') {
var lang_id = $('#id_language').val();
var code = localStorage.getItem('submit:' + $('#id_language').val());
if (code != null) {
update_submit_area(code);
} else {
$.get('{{ url('language_template_ajax') }}', {
id: lang_id,
problem: {{problem_id}}
}).done(function (template) {
update_submit_area(template);
});
}
}
}
if (code != null) {
update_submit_area(code);
} else {
$.get('{{ url('language_template_ajax') }}', {
id: lang_id,
problem: {{problem_id}}
}).done(function (template) {
update_submit_area(template);
});
}
}
}
function makeDisplayData(data) {
var site_data = data.attr('data-info');
var judge_data = data.attr('data-judge-info');
var display_data = site_data || judge_data;
return display_data;
}
function makeDisplayData(data) {
var site_data = data.attr('data-info');
var judge_data = data.attr('data-judge-info');
var display_data = site_data || judge_data;
return display_data;
}
function formatSelection(state) {
if (!state.id) return state.text; // optgroup
var data = makeDisplayData($("option[data-id=" + state.id + "]"));
return $('<span>').append($('<b>').text(state.text), ' (', data, ')');
}
function formatSelection(state) {
if (!state.id) return state.text; // optgroup
var data = makeDisplayData($("option[data-id=" + state.id + "]"));
return $('<span>').append($('<b>').text(state.text), ' (', data, ')');
}
// Terrible hack, adapted from https://github.com/select2/select2/issues/4436
$.fn.select2.amd.define('select2/data/customAdapter', ['select2/results', 'select2/utils'], function (Result, Utils) {
RefPresenter = function ($element, options, dataAdapter) {
RefPresenter.__super__.constructor.call(this, $element, options, dataAdapter);
};
Utils.Extend(RefPresenter, Result);
RefPresenter.prototype.bind = function (container, $container) {
container.on('results:focus', function (params) {
var data = makeDisplayData($("option[data-id=" + params.data.id + "]"));
$("#result-version-info").text(data);
});
RefPresenter.__super__.bind.call(this, container, $container);
};
return RefPresenter;
});
var customAdapter = $.fn.select2.amd.require('select2/data/customAdapter');
$("#id_language").select2({
templateResult: format,
templateSelection: formatSelection,
resultsAdapter: customAdapter
});
$('#id_language').on('select2:open', function (evt) {
var dropdown = $('.select2-dropdown');
if (!$('#result-version-info').length)
dropdown.append($("<span id=\"result-version-info\">"));
dropdown.attr('id', 'language-select2');
});
$('#id_judge').on('select2:open', function (evt) {
var dropdown = $('.select2-dropdown');
$('#result-version-info').remove();
dropdown.attr('id', 'judge-select2');
});
$('#id_language').change(function () {
var lang = $("#id_language").find("option:selected").attr('data-ace');
window.ace_source.getSession().setMode("ace/mode/" + lang);
update_language_template();
});
$('#ace_source').on('ace_load', function (e, editor) {
update_language_template();
editor.commands.addCommand({
name: 'save',
bindKey: {win: 'Ctrl-S', mac: 'Command-S'},
exec: function () {
localStorage.setItem('submit:' + $('#id_language').val(), editor.getSession().getValue());
}
});
editor.getSession().setUseWrapMode(true);
editor.setFontSize(14);
editor.setShowPrintMargin(false);
// editor.setPrintMarginColumn(100);
editor.focus();
});
// $(window).resize(function () {
// $('#ace_source').height(Math.max($(window).height() - 353, 100));
// }).resize();
$('#problem_submit').submit(function (event) {
if ($('#id_source').val().length > 65536) {
alert("{{ _('Your source code must contain at most 65536 characters.') }}");
event.preventDefault();
$('#problem_submit').find(':submit').attr('disabled', false);
}
});
function get_source_default(file) {
const reader = new FileReader();
reader.readAsText(file);
reader.onload = function (evt) {
var src = evt.target.result;
update_submit_area(src);
}
reader.onerror = function (evt) {
alert("Fail to upload file");
}
}
function get_source_scratch(file) {
JSZip.loadAsync(file).then(function($content) {
return $content.files["project.json"].async('text');
}).then(function (src) {
update_submit_area(src);
});
}
$('#file-upload').on('click change', function(e) {
var file = $(this)[0].files[0];
if (file) {
if (file.name.endsWith('sb3')) {
get_source_scratch(file);
}
else {
get_source_default(file);
}
}
})
// Terrible hack, adapted from https://github.com/select2/select2/issues/4436
$.fn.select2.amd.define('select2/data/customAdapter', ['select2/results', 'select2/utils'], function (Result, Utils) {
RefPresenter = function ($element, options, dataAdapter) {
RefPresenter.__super__.constructor.call(this, $element, options, dataAdapter);
};
Utils.Extend(RefPresenter, Result);
RefPresenter.prototype.bind = function (container, $container) {
container.on('results:focus', function (params) {
var data = makeDisplayData($("option[data-id=" + params.data.id + "]"));
$("#result-version-info").text(data);
});
</script>
{% endcompress %}
RefPresenter.__super__.bind.call(this, container, $container);
};
return RefPresenter;
});
var customAdapter = $.fn.select2.amd.require('select2/data/customAdapter');
$("#id_language").select2({
templateResult: format,
templateSelection: formatSelection,
resultsAdapter: customAdapter
});
$('#id_language').on('select2:open', function (evt) {
var dropdown = $('.select2-dropdown');
if (!$('#result-version-info').length)
dropdown.append($("<span id=\"result-version-info\">"));
dropdown.attr('id', 'language-select2');
});
$('#id_judge').on('select2:open', function (evt) {
var dropdown = $('.select2-dropdown');
$('#result-version-info').remove();
dropdown.attr('id', 'judge-select2');
});
$('#id_language').change(function () {
var lang = $("#id_language").find("option:selected").attr('data-ace');
window.ace_source.getSession().setMode("ace/mode/" + lang);
update_language_template();
});
$('#ace_source').on('ace_load', function (e, editor) {
update_language_template();
editor.commands.addCommand({
name: 'save',
bindKey: {win: 'Ctrl-S', mac: 'Command-S'},
exec: function () {
localStorage.setItem('submit:' + $('#id_language').val(), editor.getSession().getValue());
}
});
editor.getSession().setUseWrapMode(true);
editor.setFontSize(14);
editor.setShowPrintMargin(false);
// editor.setPrintMarginColumn(100);
editor.focus();
});
// $(window).resize(function () {
// $('#ace_source').height(Math.max($(window).height() - 353, 100));
// }).resize();
$('#problem_submit').submit(function (event) {
if ($('#id_source').val().length > 65536) {
alert("{{ _('Your source code must contain at most 65536 characters.') }}");
event.preventDefault();
$('#problem_submit').find(':submit').attr('disabled', false);
}
});
function get_source_default(file) {
const reader = new FileReader();
reader.readAsText(file);
reader.onload = function (evt) {
var src = evt.target.result;
update_submit_area(src);
}
reader.onerror = function (evt) {
alert("Fail to upload file");
}
}
function get_source_scratch(file) {
JSZip.loadAsync(file).then(function($content) {
return $content.files["project.json"].async('text');
}).then(function (src) {
update_submit_area(src);
});
}
$('#file-upload').on('click change', function(e) {
var file = $(this)[0].files[0];
if (file) {
if (file.name.endsWith('sb3')) {
get_source_scratch(file);
}
else {
get_source_default(file);
}
}
})
});
</script>
{% endcompress %}
{% endblock %}
{% block media %}
{{ form.media.css }}
{{ form.media.css }}
{% endblock %}
{% block body %}
<br>
{% if not no_judges %}
{% if default_lang not in form.fields.language.queryset %}
<div class="alert alert-warning alert-dismissable">
<a class="close">x</a>
{% trans trimmed default_language=default_lang.name %}
<b>Warning!</b> Your default language, <b>{{ default_language }}</b>,
is unavailable for this problem and has been deselected.
{% endtrans %}
</div>
{% endif %}
{% if request.in_contest and submission_limit %}
{% if submissions_left > 0 %}
<div class="alert alert-warning alert-dismissable">
<a class="close">x</a>
{% trans left=submissions_left %}
You have {{ left }} submission left
{% pluralize %}
You have {{ left }} submissions left
{% endtrans %}
</div>
{% else %}
<div class="alert alert-warning alert-dismissable">
<a class="close">x</a>
{{ _('You have 0 submissions left') }}
</div>
{% endif %}
{% endif %}
<br>
{% if not no_judges %}
{% if default_lang not in form.fields.language.queryset %}
<div class="alert alert-warning alert-dismissable">
<a class="close">x</a>
{% trans trimmed default_language=default_lang.name %}
<b>Warning!</b> Your default language, <b>{{ default_language }}</b>,
is unavailable for this problem and has been deselected.
{% endtrans %}
</div>
{% endif %}
<form id="problem_submit" action="" method="post" class="form-area">
{% csrf_token %}
{{ form.non_field_errors() }}
<div id="submit-wrapper">
<div id="editor">
{{ form.source.errors }}
{{ form.source }}
</div>
{% if not no_judges %}
<div id="language">
{{ form.language.errors }}
<div id="language-select">
<select id="id_language" name="language">
{% for lang in form.fields.language.queryset %}
<option value="{{ lang.id }}" data-id="{{ lang.id }}" data-name="{{ lang.name }}"
data-info="{{ lang.info }}" data-ace="{{ lang.ace }}"
data-judge-info="{{ runtime_versions(lang.runtime_versions()) }}"
{% if lang.id == default_lang.id %}selected{% endif %}>{{ lang.name }}</option>
{% endfor %}
</select>
</div>
</div>
{% endif %}
{% if request.in_contest and submission_limit %}
{% if submissions_left > 0 %}
<div class="alert alert-warning alert-dismissable">
<a class="close">x</a>
{% trans left=submissions_left %}
You have {{ left }} submission left
{% pluralize %}
You have {{ left }} submissions left
{% endtrans %}
</div>
{% else %}
<div class="alert alert-warning alert-dismissable">
<a class="close">x</a>
{{ _('You have 0 submissions left') }}
</div>
{% endif %}
{% endif %}
{% endif %}
<hr>
<form id="problem_submit" action="" method="post" class="form-area">
{% csrf_token %}
{{ form.non_field_errors() }}
<div id="submit-wrapper">
<div id="editor">
{{ form.source.errors }}
{{ form.source }}
</div>
{% if not no_judges %}
<div id="language">
{{ form.language.errors }}
<div id="language-select">
<select id="id_language" name="language">
{% for lang in form.fields.language.queryset %}
<option value="{{ lang.id }}" data-id="{{ lang.id }}" data-name="{{ lang.name }}"
data-info="{{ lang.info }}" data-ace="{{ lang.ace }}"
data-judge-info="{{ runtime_versions(lang.runtime_versions()) }}"
{% if lang.id == default_lang.id %}selected{% endif %}>{{ lang.name }}</option>
{% endfor %}
</select>
</div>
</div>
{% endif %}
</div>
{% if no_judges %}
<span style="color: red">{{ _('No judge is available for this problem.') }}</span>
{% else %}
<input type="file" id="file-upload">
<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 %}>
</div>
{% endif %}
</form>
<hr>
{% if no_judges %}
<span style="color: red">{{ _('No judge is available for this problem.') }}</span>
{% else %}
<input type="file" id="file-upload">
<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 %}>
</div>
{% endif %}
</form>
{% endblock %}

View file

@ -1,20 +1,20 @@
{% 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>
<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>
{% endblock %}