Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 10 additions & 13 deletions cms/server/contest/templates/task_submissions.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,6 @@

{% set score_type = get_score_type(dataset=task.active_dataset) %}

{% block js_init %}
// Define TASK_LANGUAGES for task-specific language filtering
var TASK_LANGUAGES = {
{% for lang in task.get_allowed_languages() or [] %}
'{{ lang }}': {
{% for extension in (lang|to_language).source_extensions %}
'{{ extension }}': true,
{% endfor %}
},
{% endfor %}
};
{% endblock js_init %}

{# Whether tokens are allowed on this contest. #}
{% set can_use_tokens_in_contest =
tokens_contest != TOKEN_MODE_DISABLED
Expand All @@ -37,6 +24,16 @@
{% set can_play_token_now = can_play_token and tokens_info[2] is none %}

{% block additional_js %}
// Define TASK_LANGUAGES for task-specific language filtering
var TASK_LANGUAGES = {
{% for lang in task.get_allowed_languages() or [] %}
'{{ lang }}': {
{% for extension in (lang|to_language).source_extensions %}
'{{ extension }}': true,
{% endfor %}
},
{% endfor %}
};

$(document).on("click", ".submission_list tbody tr td.status .details", function (event) {
var submission_id = $(this).parent().parent().attr("data-submission");
Expand Down
26 changes: 15 additions & 11 deletions cms/server/contest/templates/test_interface.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,22 @@

{% set page = "test_interface" %}

{% block js_init %}
{% block additional_js %}
// Define TASK_LANGUAGES for task-specific language filtering
var TASK_LANGUAGES = {
{% for lang in task.get_allowed_languages() or [] %}
'{{ lang }}': {
{% for extension in (lang|to_language).source_extensions %}
'{{ extension }}': true,
{% endfor %}
},
{% for task in contest.tasks %}
'{{ task.name }}': {
{% for lang in task.get_allowed_languages() or [] %}
'{{ lang }}': {
{% for extension in (lang|to_language).source_extensions %}
'{{ extension }}': true,
{% endfor %}
},
{% endfor %}
},
{% endfor %}
};
{% endblock js_init %}

{% block additional_js %}
$(document).on("click", ".user_test_list tbody tr td.status .details", function (event) {
var $this = $(this);
var task_id = $this.parent().parent().parent().parent().attr("data-task");
Expand Down Expand Up @@ -117,8 +119,10 @@ <h2 style="margin-bottom: 10px">{% trans %}Submit a test{% endtrans %}</h2>
<div class="controls">
<input type="file" class="input-xlarge"
id="input{{ loop.index0 }}" name="{{ filename }}"
onchange="CMS.CWSUtils.filter_languages($(this).parents('form').find('select[name=language] option'),
$(this).parents('form').find('input[type=file]').not('#input_file'), TASK_LANGUAGES)"/>
onchange="CMS.CWSUtils.filter_languages(
$(this).parents('form').find('select[name=language] option'),
$(this).parents('form').find('input[type=file]').not('#input_file'),
TASK_LANGUAGES['{{ task.name }}'])"/>
</div>
</div>
{% endfor %}
Expand Down