|
|
<h2>Test Interface</h2>
|
|
|
|
|
|
<% if @problems.length==0 %>
|
|
|
There is no submission
|
|
|
<% else %>
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
var submissionCount = {
|
|
|
<% @submissions.each do |submission| %>
|
|
|
<%= submission.problem_id %> : <%= submission.number %>,
|
|
|
<% end %>
|
|
|
};
|
|
|
function updateSubmissionList() {
|
|
|
currentProb = document.getElementById("test_request_problem_id").value;
|
|
|
count = submissionCount[currentProb];
|
|
|
submissionSelect = document.getElementById("test_request_submission_number");
|
|
|
submissionSelect.options.length = 0;
|
|
|
for(i=0; i<count; i++) {
|
|
|
submissionSelect.options[i] = new Option(""+(i+1),""+(i+1),false,false);
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
<% form_for :test_request, nil,
|
|
|
:url => { :action => 'submit'},
|
|
|
:html => { :multipart => true } do |f| %>
|
|
|
<table>
|
|
|
<tr>
|
|
|
<td>Task:</td>
|
|
|
<td>
|
|
|
<%= select(:test_request,
|
|
|
:problem_id,
|
|
|
@problems.collect {|p| [p.name, p.id]}, {},
|
|
|
{ :onclick => "updateSubmissionList();" }) %>
|
|
|
</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td>Submission:</td>
|
|
|
<td>
|
|
|
<%= select(:test_request,
|
|
|
:submission_number,
|
|
|
((1..@submissions[0].number).collect {|n| [n,n]}).reverse) %>
|
|
|
</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td>Input data:</td>
|
|
|
<td><%= f.file_field :input_file %></td>
|
|
|
<tr>
|
|
|
<td colspan="2">
|
|
|
<%= submit_tag 'submit' %>
|
|
|
</td>
|
|
|
</tr>
|
|
|
</table>
|
|
|
<% end %>
|
|
|
|
|
|
<h3>Previous requests</h3>
|
|
|
|
|
|
<table class="info">
|
|
|
<tr class="info-head">
|
|
|
<th>at</th>
|
|
|
<th>problem</th>
|
|
|
<th>sub #</th>
|
|
|
<th>status</th>
|
|
|
<th>running stat</th>
|
|
|
<th>output (first 2kb)</th>
|
|
|
<th>grading comment</th>
|
|
|
<th>compiler message</th>
|
|
|
</tr>
|
|
|
<%= render :partial => 'test_request', :collection => @test_requests %>
|
|
|
</table>
|
|
|
|
|
|
<% end %>
|
|
|
|
|
|
|