diff --git a/judge/views/problem.py b/judge/views/problem.py index e031a90..450f017 100644 --- a/judge/views/problem.py +++ b/judge/views/problem.py @@ -1194,6 +1194,7 @@ def problem_submit(request, problem, submission=None): "ACE_URL": settings.ACE_URL, "default_lang": default_lang, "problem_id": problem.id, + "output_only": problem.data_files.output_only, }, ) diff --git a/templates/problem/submit.html b/templates/problem/submit.html index 85aa159..7f36406 100644 --- a/templates/problem/submit.html +++ b/templates/problem/submit.html @@ -21,22 +21,26 @@ } 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 output_only %} + window.ace_source.env.editor.setReadOnly(true); + {% else %} + 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); + }); + } } - } + {% endif %} } function makeDisplayData(data) {