Description:
merge
Commit status:
[Not Reviewed]
References:
merge java
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r512:4a0989b96ef2 - - 8 files changed: 35 inserted, 4 deleted

@@ -77,12 +77,13
77 when "c" then Rouge::Lexers::C.new
77 when "c" then Rouge::Lexers::C.new
78 when "cpp" then Rouge::Lexers::Cpp.new
78 when "cpp" then Rouge::Lexers::Cpp.new
79 when "pas" then Rouge::Lexers::Pas.new
79 when "pas" then Rouge::Lexers::Pas.new
80 when "ruby" then Rouge::Lexers::Ruby.new
80 when "ruby" then Rouge::Lexers::Ruby.new
81 when "python" then Rouge::Lexers::Python.new
81 when "python" then Rouge::Lexers::Python.new
82 when "java" then Rouge::Lexers::Java.new
82 when "java" then Rouge::Lexers::Java.new
83 + when "php" then Rouge::Lexers::PHP.new
83 end
84 end
84 @formatted_code = formatter.format(lexer.lex(@submission.source))
85 @formatted_code = formatter.format(lexer.lex(@submission.source))
85 @css_style = Rouge::Themes::ThankfulEyes.render(scope: '.highlight')
86 @css_style = Rouge::Themes::ThankfulEyes.render(scope: '.highlight')
86
87
87 end
88 end
88
89
@@ -86,14 +86,36
86 elsif @description!=nil
86 elsif @description!=nil
87 if !@description.update_attributes(params[:description])
87 if !@description.update_attributes(params[:description])
88 flash[:notice] = 'Error saving description'
88 flash[:notice] = 'Error saving description'
89 render :action => 'edit' and return
89 render :action => 'edit' and return
90 end
90 end
91 end
91 end
92 + if params[:file] and params[:file].content_type != 'application/pdf'
93 + flash[:notice] = 'Error: Uploaded file is not PDF'
94 + render :action => 'edit' and return
95 + end
92 if @problem.update_attributes(params[:problem])
96 if @problem.update_attributes(params[:problem])
93 flash[:notice] = 'Problem was successfully updated.'
97 flash[:notice] = 'Problem was successfully updated.'
98 + unless params[:file] == nil or params[:file] == ''
99 + flash[:notice] = 'Problem was successfully updated and a new PDF file is uploaded.'
100 + out_dirname = "#{Problem.download_file_basedir}/#{@problem.id}"
101 + if not FileTest.exists? out_dirname
102 + Dir.mkdir out_dirname
103 + end
104 +
105 + out_filename = "#{out_dirname}/#{@problem.name}.pdf"
106 + if FileTest.exists? out_filename
107 + File.delete out_filename
108 + end
109 +
110 + File.open(out_filename,"wb") do |file|
111 + file.write(params[:file].read)
112 + end
113 + @problem.description_filename = "#{@problem.name}.pdf"
114 + @problem.save
115 + end
94 redirect_to :action => 'show', :id => @problem
116 redirect_to :action => 'show', :id => @problem
95 else
117 else
96 render :action => 'edit'
118 render :action => 'edit'
97 end
119 end
98 end
120 end
99
121
@@ -1,10 +1,12
1
1
2 %tr{:class => ((submission_counter%2==0) ? "info-even" : "info-odd")}
2 %tr{:class => ((submission_counter%2==0) ? "info-even" : "info-odd")}
3 %td.info{:align => "center"}
3 %td.info{:align => "center"}
4 = submission_counter+1
4 = submission_counter+1
5 + %td.info{:align => "center"}
6 + = link_to "##{submission.id}", controller: :graders, action: :submission, id: submission.id
5 %td.info= format_short_time(submission.submitted_at)
7 %td.info= format_short_time(submission.submitted_at)
6 %td.info{:align => "center"}
8 %td.info{:align => "center"}
7 = link_to('[load]',{:action => 'source', :id => submission.id})
9 = link_to('[load]',{:action => 'source', :id => submission.id})
8 %td.info
10 %td.info
9 - if submission.graded_at!=nil
11 - if submission.graded_at!=nil
10 = "Graded at #{format_short_time(submission.graded_at)}."
12 = "Graded at #{format_short_time(submission.graded_at)}."
@@ -10,12 +10,13
10 %h2= "Task: #{@problem.full_name} (#{@problem.name})"
10 %h2= "Task: #{@problem.full_name} (#{@problem.name})"
11
11
12 - if @submissions!=nil
12 - if @submissions!=nil
13 - if @submissions.length>0
13 - if @submissions.length>0
14 %table.info
14 %table.info
15 %tr.info-head
15 %tr.info-head
16 + %th.info No.
16 %th.info #
17 %th.info #
17 %th.info At
18 %th.info At
18 %th.info Source
19 %th.info Source
19 %th.info Result
20 %th.info Result
20 %th.info{:width => "300px"}
21 %th.info{:width => "300px"}
21 Compiler message
22 Compiler message
@@ -45,8 +45,10
45 {:selected => (@description) ? @description.markdowned : false }
45 {:selected => (@description) ? @description.markdowned : false }
46 %></p>
46 %></p>
47
47
48 <p><label for="problem_url">URL</label><br/>
48 <p><label for="problem_url">URL</label><br/>
49 <%= text_field 'problem', 'url' %></p>
49 <%= text_field 'problem', 'url' %></p>
50
50
51 + <p>Task PDF <%= file_field_tag 'file' %></p>
52 +
51
53
52 <!--[eoform:problem]-->
54 <!--[eoform:problem]-->
@@ -1,9 +1,9
1 <h1>Editing problem</h1>
1 <h1>Editing problem</h1>
2
2
3 - <%= form_tag :action => 'update', :id => @problem do %>
3 + <%= form_tag({action: 'update', id: @problem},multipart: true) do %>
4 <%= render :partial => 'form' %>
4 <%= render :partial => 'form' %>
5 <%= submit_tag 'Edit' %>
5 <%= submit_tag 'Edit' %>
6 <% end %>
6 <% end %>
7
7
8 <%= link_to 'Show', :action => 'show', :id => @problem %> |
8 <%= link_to 'Show', :action => 'show', :id => @problem %> |
9 <%= link_to 'Back', :action => 'list' %>
9 <%= link_to 'Back', :action => 'list' %>
@@ -65,14 +65,15
65 <th></th>
65 <th></th>
66 <th></th>
66 <th></th>
67 </tr>
67 </tr>
68
68
69 <% for user in @users %>
69 <% for user in @users %>
70 <tr class="info-<%= cycle("odd","even") %>">
70 <tr class="info-<%= cycle("odd","even") %>">
71 + <td><%= link_to user.login, controller: :users, :action => 'profile', :id => user %></td>
71 <% for column in User.content_columns %>
72 <% for column in User.content_columns %>
72 - <% if !@hidden_columns.index(column.name) %>
73 + <% if !@hidden_columns.index(column.name) and column.name != 'login' %>
73 <td><%=h user.send(column.name) %></td>
74 <td><%=h user.send(column.name) %></td>
74 <% end %>
75 <% end %>
75 <% end %>
76 <% end %>
76 <td><%= link_to 'Show', :action => 'show', :id => user %></td>
77 <td><%= link_to 'Show', :action => 'show', :id => user %></td>
77 <td><%= link_to 'Edit', :action => 'edit', :id => user %></td>
78 <td><%= link_to 'Edit', :action => 'edit', :id => user %></td>
78 <td><%= link_to 'Destroy', { :action => 'destroy', :id => user }, :confirm => 'Are you sure?', :method => :post %></td>
79 <td><%= link_to 'Destroy', { :action => 'destroy', :id => user }, :confirm => 'Are you sure?', :method => :post %></td>
@@ -1,12 +1,12
1 - content_for :header do
1 - content_for :header do
2 = javascript_include_tag 'new'
2 = javascript_include_tag 'new'
3
3
4 %script{:type=>"text/javascript"}
4 %script{:type=>"text/javascript"}
5 $(function () {
5 $(function () {
6 - $('#submission_table').tablesorter({widgets: ['zebra','filter']});
6 + $('#submission_table').tablesorter({widgets: ['zebra']});
7 });
7 });
8
8
9 :css
9 :css
10 .fix-width {
10 .fix-width {
11 font-family: Droid Sans Mono,Consolas, monospace, mono, Courier New, Courier;
11 font-family: Droid Sans Mono,Consolas, monospace, mono, Courier New, Courier;
12 }
12 }
@@ -24,26 +24,28
24
24
25 %table.tablesorter-cafe#submission_table
25 %table.tablesorter-cafe#submission_table
26 %thead
26 %thead
27 %tr
27 %tr
28 %th ID
28 %th ID
29 %th Problem code
29 %th Problem code
30 - %th Problem name
30 + %th Problem full name
31 %th Language
31 %th Language
32 + %th Submitted at
32 %th Result
33 %th Result
33 %th Score
34 %th Score
34 - if session[:admin]
35 - if session[:admin]
35 %th IP
36 %th IP
36 %tbody
37 %tbody
37 - @submission.each do |s|
38 - @submission.each do |s|
38 - next unless s.problem
39 - next unless s.problem
39 %tr
40 %tr
40 %td= link_to "#{s.id}", controller: "graders", action: "submission", id: s.id
41 %td= link_to "#{s.id}", controller: "graders", action: "submission", id: s.id
41 %td= s.problem.name
42 %td= s.problem.name
42 %td= s.problem.full_name
43 %td= s.problem.full_name
43 %td= s.language.pretty_name
44 %td= s.language.pretty_name
45 + %td #{s.submitted_at.strftime('%Y-%m-%d %H:%M')} (#{time_ago_in_words(s.submitted_at)} ago)
44 %td.fix-width= s.grader_comment
46 %td.fix-width= s.grader_comment
45 %td= (s.points*100)/s.problem.full_score
47 %td= (s.points*100)/s.problem.full_score
46 - if session[:admin]
48 - if session[:admin]
47 %td= s.ip_address
49 %td= s.ip_address
48
50
49
51
You need to be logged in to leave comments. Login now