2020-01-21 06:35:58 +00:00
|
|
|
{% extends "base.html" %}
|
|
|
|
|
|
|
|
{% block js_media %}
|
|
|
|
<script type="text/javascript">
|
|
|
|
window.valid_files = {{valid_files_json}};
|
2021-11-28 03:28:48 +00:00
|
|
|
window.big_input = (window.valid_files.length > 100);
|
2020-01-21 06:35:58 +00:00
|
|
|
</script>
|
2021-05-30 02:59:37 +00:00
|
|
|
<script type="text/javascript" src="{{ static('jquery-ui.min.js') }}"></script>
|
2020-01-21 06:35:58 +00:00
|
|
|
<script type="text/javascript" src="{{ static('libs/featherlight/featherlight.min.js') }}"></script>
|
2021-11-28 03:28:48 +00:00
|
|
|
<script type="text/javascript" src="{{ static('fine-uploader/jquery.fine-uploader.js') }}"></script>
|
2020-01-21 06:35:58 +00:00
|
|
|
<script type="text/javascript">
|
|
|
|
$(function () {
|
2021-11-28 03:28:48 +00:00
|
|
|
$("#problem-data-zipfile_fine_uploader").fineUploader({
|
|
|
|
request: {
|
|
|
|
endpoint: "{{url('problem_zip_upload', problem.code)}}",
|
|
|
|
params: {
|
|
|
|
'csrfmiddlewaretoken': '{{ csrf_token }}'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
chunking: {
|
|
|
|
enabled: true,
|
|
|
|
partSize: 40000000,
|
|
|
|
},
|
|
|
|
resume: {
|
|
|
|
enabled: true
|
|
|
|
},
|
|
|
|
validation: {
|
|
|
|
allowedExtensions: ['zip'],
|
|
|
|
},
|
|
|
|
}).on('complete', function (event, id, name, responseJSON) {
|
|
|
|
console.log(responseJSON);
|
|
|
|
if (!responseJSON.success) {
|
|
|
|
alert('Fail to upload: ' + responseJSON.error);
|
|
|
|
}
|
2022-05-08 01:10:10 +00:00
|
|
|
else {
|
|
|
|
$('#submit-button').click();
|
|
|
|
}
|
2021-11-28 03:28:48 +00:00
|
|
|
});;
|
|
|
|
|
2020-01-21 06:35:58 +00:00
|
|
|
function update_select2() {
|
|
|
|
$('tbody:not(.extra-row-body) .type-column select').select2({
|
|
|
|
minimumResultsForSearch: -1
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
update_select2();
|
|
|
|
|
|
|
|
function autofill_if_exists($select, file) {
|
|
|
|
if (!$select.val() && ~window.valid_files.indexOf(file))
|
|
|
|
$select.val(file).trigger('change');
|
|
|
|
}
|
|
|
|
|
|
|
|
var $table = $('#case-table');
|
|
|
|
$table.on('add-row', function (e, $tr) {
|
2020-01-26 05:22:27 +00:00
|
|
|
// update_select2();
|
2020-01-21 06:35:58 +00:00
|
|
|
$tr.find('input').filter('[id$=file]').each(function () {
|
|
|
|
var $select, val = $(this).replaceWith($select = $('<select>').attr({
|
|
|
|
id: $(this).attr('id'),
|
|
|
|
name: $(this).attr('name'),
|
|
|
|
style: 'width: 100%'
|
|
|
|
})).val();
|
|
|
|
$select.select2({
|
2021-11-28 03:28:48 +00:00
|
|
|
data: window.big_input ? [val] : window.valid_files,
|
2020-01-21 06:35:58 +00:00
|
|
|
allowClear: true,
|
|
|
|
placeholder: ''
|
|
|
|
}).val(val).trigger('change').on('change', function () {
|
|
|
|
var val = $select.val();
|
|
|
|
if (val) {
|
|
|
|
if ($select.attr('id').endsWith('input_file'))
|
|
|
|
autofill_if_exists($tr.find('select[id$=output_file]'), val.replace(/in(?!.*?in)/, 'out'));
|
|
|
|
else
|
|
|
|
autofill_if_exists($tr.find('select[id$=input_file]'), val.replace(/out(?!.*?out)/, 'in'));
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
var order = 0;
|
|
|
|
|
|
|
|
function handle_table_reorder() {
|
|
|
|
var in_batch = false;
|
|
|
|
$table.find('tbody:first tr').each(function () {
|
|
|
|
switch ($(this).attr('data-type')) {
|
|
|
|
case 'C':
|
2022-11-20 03:41:43 +00:00
|
|
|
$(this).find('input[id$=pretest]').toggle(!in_batch);
|
2020-01-21 06:35:58 +00:00
|
|
|
break;
|
|
|
|
case 'S':
|
|
|
|
in_batch = true;
|
|
|
|
break;
|
|
|
|
case 'E':
|
|
|
|
in_batch = false;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function try_parse_json(json) {
|
|
|
|
try {
|
|
|
|
return JSON.parse(json);
|
|
|
|
} catch (e) {
|
|
|
|
return {};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-05-30 02:59:37 +00:00
|
|
|
function swap_row($a, $b) {
|
|
|
|
var $a_order = $a.find('input[id$=order]'), $b_order = $b.find('input[id$=order]');
|
|
|
|
var order = $a_order.val();
|
|
|
|
$a_order.val($b_order.val());
|
|
|
|
$b_order.val(order);
|
|
|
|
$b.after($a);
|
|
|
|
$a.find('span.order').text($a_order.val());
|
|
|
|
$b.find('span.order').text($b_order.val());
|
|
|
|
handle_table_reorder();
|
|
|
|
}
|
|
|
|
|
2020-01-21 06:35:58 +00:00
|
|
|
function checker_precision($checker) {
|
|
|
|
var $td = $checker.parent();
|
2022-03-19 11:14:27 +00:00
|
|
|
var $args = $td.closest('table').find('#id_problem-data-checker_args');
|
2020-01-21 06:35:58 +00:00
|
|
|
var $precision = $('<input>', {
|
|
|
|
type: 'number',
|
|
|
|
value: try_parse_json($args.val()).precision || 6,
|
|
|
|
title: 'precision (decimal digits)',
|
|
|
|
style: 'width: 4em'
|
|
|
|
}).change(function () {
|
|
|
|
if ($checker.val().startsWith('floats'))
|
|
|
|
$args.val(JSON.stringify({precision: parseInt($(this).val())}));
|
|
|
|
else
|
|
|
|
$args.val('');
|
|
|
|
}).appendTo($td);
|
|
|
|
|
|
|
|
$checker.change(function () {
|
|
|
|
$precision.toggle($checker.val().startsWith('floats')).change();
|
|
|
|
}).change();
|
|
|
|
}
|
|
|
|
|
2020-03-17 06:11:03 +00:00
|
|
|
(function toggle_custom() {
|
|
|
|
let $checker = $('#id_problem-data-checker')
|
|
|
|
|
2022-04-14 19:14:58 +00:00
|
|
|
let $custom_checker = $('#id_problem-data-custom_checker')
|
|
|
|
let $validator = $('#id_problem-data-custom_validator')
|
|
|
|
let $interactive = $('#id_problem-data-interactive_judge')
|
|
|
|
|
2020-03-17 06:11:03 +00:00
|
|
|
$tr_checker = $custom_checker.parent().parent();
|
|
|
|
$tr_validator = $validator.parent().parent()
|
2022-04-14 19:14:58 +00:00
|
|
|
$tr_interactive = $interactive.parent().parent()
|
2020-03-17 06:11:03 +00:00
|
|
|
|
2020-01-26 05:22:27 +00:00
|
|
|
$td = $checker.parent();
|
|
|
|
var $sample = $("<a/>",{
|
2020-03-17 06:11:03 +00:00
|
|
|
text: "{{_('Instruction')}}",
|
2020-01-26 05:22:27 +00:00
|
|
|
style: "margin-left:3em;",
|
|
|
|
target: "_blank",
|
|
|
|
href: "{{url('custom_checker_sample')}}"
|
|
|
|
}).appendTo($td);
|
|
|
|
|
2020-01-24 02:32:46 +00:00
|
|
|
$checker.change(function () {
|
2020-03-17 06:11:03 +00:00
|
|
|
$tr_checker.toggle($checker.val() == 'custom').change();
|
2022-06-22 07:28:34 +00:00
|
|
|
$tr_validator.toggle($checker.val() == 'customval' || $checker.val() == 'testlib').change();
|
2022-04-14 19:14:58 +00:00
|
|
|
$tr_interactive.toggle($checker.val() == 'interact').change();
|
|
|
|
|
|
|
|
$sample.toggle(['custom', 'customval', 'interact'].includes($checker.val())).change();
|
2020-01-24 02:32:46 +00:00
|
|
|
}).change();
|
2020-03-17 06:11:03 +00:00
|
|
|
})();
|
|
|
|
|
2020-01-21 06:35:58 +00:00
|
|
|
checker_precision($('#id_problem-data-checker'));
|
2020-03-17 06:11:03 +00:00
|
|
|
|
2020-01-21 06:35:58 +00:00
|
|
|
$table.on('add-row', function (e, $tr) {
|
|
|
|
var $order = $tr.find('input').filter('[id$=order]').attr('type', 'hidden').val(++order);
|
|
|
|
$order.after($('<span>', {'class': 'order'}).text($order.val()))
|
|
|
|
.after($('<i>', {'class': 'fa fa-fw fa-lg fa-ellipsis-v'}));
|
|
|
|
|
|
|
|
var $opts = $tr.find('input').slice(2, 6);
|
|
|
|
var $files = $tr.find('select').slice(1, 3);
|
2022-11-20 03:41:43 +00:00
|
|
|
var $delete = $files.end().last();
|
2020-01-21 06:35:58 +00:00
|
|
|
$tr.find('select[id$=type]').change(function () {
|
|
|
|
var $this = $(this), val = $this.val(), disabled;
|
|
|
|
switch (val) {
|
|
|
|
case 'S':
|
|
|
|
case 'E':
|
|
|
|
disabled = val == 'S';
|
|
|
|
$opts.toggle(val == 'S');
|
|
|
|
$files.siblings('.select2').hide();
|
2022-11-20 03:41:43 +00:00
|
|
|
$delete.toggle(val == 'S');
|
2020-01-21 06:35:58 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
$opts.toggle(val == 'C');
|
|
|
|
$files.siblings('.select2').toggle(val == 'C');
|
2022-11-20 03:41:43 +00:00
|
|
|
$delete.toggle(val == 'C');
|
2020-01-21 06:35:58 +00:00
|
|
|
var $prevs = $tr.prevAll('tr[data-type=S], tr[data-type=E]');
|
|
|
|
disabled = $prevs.length && $prevs.get(0).getAttribute('data-type') == 'S';
|
2022-11-20 03:41:43 +00:00
|
|
|
$tr.find('input[id$=pretest]').toggle(val == 'C' && !disabled);
|
2020-01-21 06:35:58 +00:00
|
|
|
}
|
|
|
|
$tr.attr('data-type', val).nextUntil('tr[data-type=S], tr[data-type=E], tr[data-type=""]')
|
2022-11-20 03:41:43 +00:00
|
|
|
.find('input[id$=pretest]').toggle(!disabled);
|
2020-01-21 06:35:58 +00:00
|
|
|
}).change();
|
|
|
|
|
|
|
|
var tooltip_classes = 'tooltipped tooltipped-s';
|
|
|
|
$tr.find('a.edit-generator-args').mouseover(function () {
|
|
|
|
switch ($tr.attr('data-type')) {
|
|
|
|
case 'C':
|
|
|
|
case 'S':
|
|
|
|
var $this = $(this).addClass(tooltip_classes);
|
|
|
|
$this.attr('aria-label', $this.prev().val() || '(none)');
|
|
|
|
}
|
|
|
|
}).mouseout(function () {
|
|
|
|
$(this).removeClass(tooltip_classes).removeAttr('aria-label');
|
|
|
|
}).featherlight($('.generator-args-editor'), {
|
|
|
|
beforeOpen: function () {
|
|
|
|
switch ($tr.attr('data-type')) {
|
|
|
|
case 'C':
|
|
|
|
case 'S':
|
|
|
|
return true;
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
afterOpen: function () {
|
|
|
|
var $input = this.$currentTarget.prev();
|
|
|
|
this.$instance.find('.generator-args-editor')
|
|
|
|
.find('textarea').val($input.val()).end()
|
|
|
|
.find('.button').click(function () {
|
|
|
|
$input.val($(this).prev().val());
|
|
|
|
$.featherlight.current().close();
|
|
|
|
}).end()
|
|
|
|
.show();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
checker_precision($tr.find('select[id$=checker]'));
|
|
|
|
}).find('tbody:first').find('tr').each(function () {
|
|
|
|
$table.trigger('add-row', [$(this)]);
|
|
|
|
});
|
|
|
|
|
|
|
|
$('form').submit(function () {
|
|
|
|
$table.find('tbody:first').find('tr').each(function () {
|
|
|
|
var filled = false;
|
|
|
|
$(this).find('input, select').each(function () {
|
|
|
|
var $this = $(this);
|
|
|
|
if (!$this.attr('name'))
|
|
|
|
return;
|
|
|
|
if ($this.attr('type') === 'checkbox')
|
|
|
|
filled |= $this.is(':checked');
|
|
|
|
else if (!$this.attr('name').endsWith('order'))
|
|
|
|
filled |= !!$this.val();
|
|
|
|
});
|
|
|
|
if (!filled)
|
|
|
|
$(this).find('input[id$=order]').val('');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
var $total = $('#id_cases-TOTAL_FORMS');
|
|
|
|
|
|
|
|
$('a#add-case-row').click(function () {
|
|
|
|
var $tr;
|
|
|
|
$table.find('tbody:first').append($tr = $($table.find('.extra-row-body').html()
|
|
|
|
.replace(/__prefix__/g, $total.val())));
|
|
|
|
$tr.find('.type-column select option[value="C"]').attr('selected', true);
|
|
|
|
$total.val(parseInt($total.val()) + 1);
|
|
|
|
$table.trigger('add-row', [$tr]);
|
|
|
|
window.scrollBy(0, $tr.height());
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
|
2020-06-27 22:15:37 +00:00
|
|
|
function isInpFile(x) {
|
|
|
|
let tail = ['.in', '.inp', '.IN', '.INP']
|
|
|
|
for (let i of tail) {
|
|
|
|
if (x.endsWith(i)) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
function isOutFile(x) {
|
|
|
|
let tail = ['.out', '.OUT', '.ans', '.ANS']
|
|
|
|
for (let i of tail) {
|
|
|
|
if (x.endsWith(i)) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2022-11-20 03:41:43 +00:00
|
|
|
$('a#fill-testcases').click(function (e) {
|
|
|
|
e.preventDefault();
|
2020-01-22 05:27:18 +00:00
|
|
|
var inFiles = [], outFiles = [];
|
2020-06-27 22:15:37 +00:00
|
|
|
for (let file of window.valid_files) {
|
|
|
|
if (isInpFile(file)) {
|
|
|
|
inFiles.push(file);
|
2020-01-22 05:27:18 +00:00
|
|
|
}
|
2020-06-27 22:15:37 +00:00
|
|
|
if (isOutFile(file)) {
|
|
|
|
outFiles.push(file);
|
2020-01-22 05:27:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (inFiles.length == 0) {
|
2020-03-16 07:56:55 +00:00
|
|
|
alert("No input/output files. Make sure your files' suffices are .in(p)/.out");
|
2020-01-22 05:27:18 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (inFiles.length != outFiles.length) {
|
|
|
|
alert("The input files do not match the output files!");
|
|
|
|
return false;
|
|
|
|
}
|
2020-06-27 22:15:37 +00:00
|
|
|
|
|
|
|
inFiles.sort();
|
|
|
|
outFiles.sort();
|
|
|
|
|
2021-11-28 03:28:48 +00:00
|
|
|
// big number of input
|
|
|
|
if (inFiles.length > 100) {
|
|
|
|
window.big_input = true;
|
|
|
|
}
|
|
|
|
|
2022-11-20 03:41:43 +00:00
|
|
|
var batch_starts = $('#batch_starts').val();
|
|
|
|
batch_starts = batch_starts.split(',');
|
|
|
|
batch_starts = batch_starts.filter(e => {
|
|
|
|
return e.length && e == +e;
|
|
|
|
});
|
|
|
|
batch_starts = new Set(batch_starts.map(x => Math.min(Math.max(1, parseInt(x)), inFiles.length - 1)));
|
|
|
|
batch_starts.add(inFiles.length + 1);
|
|
|
|
|
|
|
|
var numRows = inFiles.length + 2 * batch_starts.size - 2;
|
|
|
|
while ($total.val() < numRows) {
|
2020-01-22 05:27:18 +00:00
|
|
|
$('a#add-case-row').click();
|
|
|
|
}
|
2022-11-20 03:41:43 +00:00
|
|
|
|
2020-01-22 05:27:18 +00:00
|
|
|
// fill cases
|
2022-11-20 03:41:43 +00:00
|
|
|
var row = 0;
|
2020-01-22 05:27:18 +00:00
|
|
|
for (var i = 0; i < inFiles.length; i++) {
|
2022-11-20 03:41:43 +00:00
|
|
|
if (batch_starts.has(i + 1)) {
|
|
|
|
$("#id_cases-"+row+"-type").val('S').change();
|
|
|
|
row += 1;
|
|
|
|
}
|
|
|
|
var $input = $("#id_cases-"+row+"-input_file");
|
|
|
|
$input.select2('destroy').empty().select2({ data: [inFiles[i]] });
|
|
|
|
$input.val(inFiles[i]).change();
|
|
|
|
var $output = $("#id_cases-"+row+"-input_file");
|
|
|
|
$output.select2('destroy').empty().select2({ data: [outFiles[i]] });
|
|
|
|
$output.val(outFiles[i]).change();
|
|
|
|
|
|
|
|
if ($("#problem-type").val() == "ICPC") {
|
|
|
|
$("#id_cases-"+row+"-points").val('0').change();
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$("#id_cases-"+row+"-points").val('1').change();
|
|
|
|
}
|
|
|
|
row += 1;
|
2021-05-30 02:59:37 +00:00
|
|
|
|
2022-11-20 03:41:43 +00:00
|
|
|
if (batch_starts.has(i + 2)) {
|
|
|
|
$("#id_cases-"+(row-1)+"-points").val('1').change();
|
|
|
|
$("#id_cases-"+row+"-type").val('E').change();
|
|
|
|
row += 1;
|
|
|
|
}
|
2020-01-22 05:27:18 +00:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
|
2020-01-21 06:35:58 +00:00
|
|
|
var oldIndex;
|
2021-05-30 02:59:37 +00:00
|
|
|
$('#case-table tbody').sortable({
|
2020-01-21 06:35:58 +00:00
|
|
|
itemSelector: 'tr',
|
|
|
|
handle: 'i.fa-ellipsis-v',
|
2021-05-30 02:59:37 +00:00
|
|
|
start: function (event, ui) {
|
|
|
|
$item = ui.item;
|
2020-01-21 06:35:58 +00:00
|
|
|
oldIndex = $item.index();
|
|
|
|
},
|
2021-05-30 02:59:37 +00:00
|
|
|
stop: function (event, ui) {
|
|
|
|
$item = ui.item;
|
2020-01-21 06:35:58 +00:00
|
|
|
var newIndex = $item.index();
|
|
|
|
if (newIndex > oldIndex) {
|
|
|
|
var order = parseInt($item.parent().children().slice(oldIndex, newIndex).each(function () {
|
|
|
|
var $order = $(this).find('input[id$=order]');
|
|
|
|
$order.val(parseInt($order.val()) - 1).siblings('span.order').text($order.val());
|
|
|
|
}).last().after($item).find('input[id$=order]').val());
|
|
|
|
$item.find('input[id$=order]').val(order + 1).siblings('span.order').text(order + 1);
|
|
|
|
} else if (newIndex < oldIndex) {
|
|
|
|
var order = parseInt($item.parent().children().slice(newIndex + 1, oldIndex + 1).each(function () {
|
|
|
|
var $order = $(this).find('input[id$=order]');
|
|
|
|
$order.val(parseInt($order.val()) + 1).siblings('span.order').text($order.val());
|
|
|
|
}).first().before($item).find('input[id$=order]').val());
|
|
|
|
$item.find('input[id$=order]').val(order - 1).siblings('span.order').text(order - 1);
|
|
|
|
}
|
|
|
|
if (newIndex != oldIndex)
|
|
|
|
handle_table_reorder();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2020-01-26 05:22:27 +00:00
|
|
|
$('input#delete-all').change(function() {
|
|
|
|
if (this.checked) {
|
|
|
|
$("input[name$='DELETE']").attr('checked', true);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
$("input[name$='DELETE']").attr('checked', false);
|
|
|
|
}
|
|
|
|
});
|
2021-11-10 17:53:24 +00:00
|
|
|
|
|
|
|
// Change to OI if the first row point > 0
|
|
|
|
if($("#id_cases-0-points").val() != '0') $('#problem-type').val('OI');
|
|
|
|
|
2022-11-20 03:41:43 +00:00
|
|
|
// Change batch_starts based on current tests
|
|
|
|
function update_batch_starts() {
|
|
|
|
var numBatches = 0;
|
|
|
|
var batchStarts = [];
|
|
|
|
$("#case-table tbody:first tr").each(function(idx) {
|
|
|
|
$select = $('#id_cases-' + idx + '-type');
|
|
|
|
if ($select.val() == 'S') {
|
|
|
|
batchStarts.push(idx + 1 - 2 * numBatches);
|
|
|
|
numBatches++;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
if (batchStarts) {
|
|
|
|
$("#batch_starts").val(batchStarts.join(', '));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
update_batch_starts();
|
|
|
|
|
2020-01-26 05:22:27 +00:00
|
|
|
}).change();
|
2020-01-21 06:35:58 +00:00
|
|
|
</script>
|
2021-11-28 03:28:48 +00:00
|
|
|
{% include 'fine_uploader/script.html' %}
|
2020-01-21 06:35:58 +00:00
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
{% block media %}
|
2021-11-28 03:28:48 +00:00
|
|
|
<link href="{{ static ('fine-uploader/fine-uploader.css') }}" rel="stylesheet">
|
2020-01-21 06:35:58 +00:00
|
|
|
<style>
|
|
|
|
#case-table .select2 {
|
|
|
|
text-align: initial;
|
|
|
|
}
|
|
|
|
|
|
|
|
.order-column {
|
|
|
|
width: 1em;
|
|
|
|
}
|
|
|
|
|
|
|
|
.bad-file input, .bad-file .select2-selection {
|
|
|
|
border-color: red;
|
|
|
|
}
|
|
|
|
|
|
|
|
span.order {
|
|
|
|
padding-right: 0.5em;
|
|
|
|
}
|
|
|
|
|
|
|
|
body.dragging, body.dragging * {
|
|
|
|
cursor: move !important;
|
|
|
|
}
|
|
|
|
|
|
|
|
.dragged {
|
|
|
|
position: absolute;
|
|
|
|
opacity: 0.5;
|
|
|
|
z-index: 2000;
|
|
|
|
}
|
|
|
|
|
|
|
|
i.fa-ellipsis-v {
|
|
|
|
cursor: move;
|
|
|
|
}
|
|
|
|
|
|
|
|
#case-table tbody td {
|
|
|
|
white-space: nowrap;
|
|
|
|
}
|
|
|
|
|
|
|
|
.type-column {
|
|
|
|
width: 8em;
|
|
|
|
}
|
|
|
|
|
|
|
|
ul.errorlist {
|
|
|
|
border: 3px red solid;
|
|
|
|
border-radius: 5px;
|
|
|
|
padding-top: 1em;
|
|
|
|
padding-bottom: 1em;
|
|
|
|
background: #e99;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
{% block header %}
|
|
|
|
{% if data_form.instance.has_yml %}
|
|
|
|
<div class="title-line-action">
|
|
|
|
[<a href="{{ url('problem_data_init', problem.code) }}">{{ _('View YAML') }}</a>]
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
{% block body %}
|
|
|
|
{% if data_form.instance.feedback %}
|
|
|
|
<ul class="errorlist">
|
|
|
|
<li>{{ data_form.instance.feedback }}</li>
|
|
|
|
</ul>
|
|
|
|
{% endif %}
|
|
|
|
<form action="" method="POST" enctype="multipart/form-data">
|
|
|
|
{% csrf_token %}
|
|
|
|
{{ cases_formset.management_form }}
|
2020-01-22 05:27:18 +00:00
|
|
|
<table class="table">
|
|
|
|
{{ data_form.as_table() }}
|
|
|
|
<th>
|
2022-06-02 05:20:45 +00:00
|
|
|
<label>{{_('Autofill testcases')}}:</label>
|
2020-01-22 05:27:18 +00:00
|
|
|
</th>
|
|
|
|
<td>
|
2022-11-20 03:41:43 +00:00
|
|
|
<div>
|
|
|
|
{{_('Problem type')}}:
|
|
|
|
<select id="problem-type">
|
|
|
|
<option value="ICPC">ICPC</option>
|
|
|
|
<option value="OI">OI</option>
|
|
|
|
</select>
|
|
|
|
<a id="fill-testcases" href="#">
|
|
|
|
<i class="fa fa-circle"></i>
|
|
|
|
{{_('Fill testcases')}}
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
<div style="margin-top: 1em;">
|
|
|
|
{{_("Batch start positions")}}:
|
|
|
|
<input id="batch_starts">
|
|
|
|
</div>
|
|
|
|
<div>
|
|
|
|
{{_("Leave empty if not use batch. If you want to divide to three batches [1, 4], [5, 8], [9, 10], enter: 1, 5, 9")}}
|
|
|
|
</div>
|
2020-01-22 05:27:18 +00:00
|
|
|
</td>
|
|
|
|
</table>
|
2020-03-17 06:11:03 +00:00
|
|
|
<input type="submit" value="{{ _('Apply!') }}" class="button" id="submit-button">
|
2020-01-21 06:35:58 +00:00
|
|
|
<table id="case-table" class="table">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th class="order-column"></th>
|
|
|
|
<th class="type-column">{{ _('Type') }}</th>
|
|
|
|
<th>{{ _('Input file') }}</th>
|
|
|
|
<th>{{ _('Output file') }}</th>
|
|
|
|
<th>{{ _('Points') }}</th>
|
|
|
|
<th>{{ _('Pretest?') }}</th>
|
|
|
|
{% if cases_formset.can_delete %}
|
2020-03-17 06:11:03 +00:00
|
|
|
<th>{{ _('Delete?') }}
|
|
|
|
<br>
|
|
|
|
<input type="checkbox" name="delete-all" id="delete-all">
|
2020-01-26 05:22:27 +00:00
|
|
|
</th>
|
2020-01-21 06:35:58 +00:00
|
|
|
{% endif %}
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
{% for form in all_case_forms %}
|
|
|
|
{% if form.non_field_errors() %}
|
|
|
|
<tr>
|
|
|
|
<td colspan="{{ 9 + cases_formset.can_delete }}">{{ form.non_field_errors() }}</td>
|
|
|
|
</tr>
|
|
|
|
{% endif %}
|
|
|
|
{% if form.prefix and '__prefix__' in form.prefix %}
|
|
|
|
</tbody>
|
|
|
|
<tbody class="extra-row-body" style="display: none">
|
|
|
|
{% endif %}
|
|
|
|
<tr data-type="{{ form['type'].value() }}">
|
2021-05-30 02:59:37 +00:00
|
|
|
<td>
|
|
|
|
{{ form.id }}{{ form.order.errors }}{{ form.order }}
|
|
|
|
</td>
|
2020-01-21 06:35:58 +00:00
|
|
|
<td class="type-column">{{ form.type.errors }}{{ form.type }}</td>
|
|
|
|
<td{% if not (form.empty_permitted or form['type'].value() != 'C' or
|
|
|
|
form['input_file'].value() in valid_files) %} class="bad-file"{% endif %}>
|
|
|
|
{{ form.input_file.errors }}{{ form.input_file }}
|
|
|
|
</td>
|
|
|
|
<td{% if not (form.empty_permitted or form['type'].value() != 'C' or
|
|
|
|
form['output_file'].value() in valid_files) %} class="bad-file"{% endif %}>
|
|
|
|
{{ form.output_file.errors }}{{ form.output_file }}
|
|
|
|
</td>
|
|
|
|
<td>{{ form.points.errors }}{{ form.points }}</td>
|
|
|
|
<td>{{ form.is_pretest.errors }}{{ form.is_pretest }}</td>
|
|
|
|
{% if cases_formset.can_delete %}
|
2021-05-30 02:59:37 +00:00
|
|
|
<td>{{ form.DELETE }}</td>
|
2020-01-21 06:35:58 +00:00
|
|
|
{% endif %}
|
|
|
|
</tr>
|
|
|
|
{% endfor %}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
2020-03-17 06:11:03 +00:00
|
|
|
<input type="submit" value="{{ _('Apply!') }}" class="button" id="submit-button">
|
2020-01-21 06:35:58 +00:00
|
|
|
<a id="add-case-row" href="#"><i class="fa fa-plus"></i> {{ _('Add new case') }}</a>
|
|
|
|
</form>
|
|
|
|
{% endblock %}
|