Description:
[web] uploading output-only submission git-svn-id: http://theory.cpe.ku.ac.th/grader/web/trunk@189 6386c4cd-e34a-4fa8-8920-d93eb39b512e
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r100:2ce8f9387085 - - 2 files changed: 8 inserted, 0 deleted

@@ -53,25 +53,29
53 flash[:notice] = 'Error adding your submission to task queue'
53 flash[:notice] = 'Error adding your submission to task queue'
54 end
54 end
55 else
55 else
56 prepare_list_information
56 prepare_list_information
57 render :action => 'list' and return
57 render :action => 'list' and return
58 end
58 end
59 redirect_to :action => 'list'
59 redirect_to :action => 'list'
60 end
60 end
61
61
62 def source
62 def source
63 submission = Submission.find(params[:id])
63 submission = Submission.find(params[:id])
64 if submission.user_id == session[:user_id]
64 if submission.user_id == session[:user_id]
65 + if submission.problem.output_only
66 + fname = submission.source_filename
67 + else
65 fname = submission.problem.name + '.' + submission.language.ext
68 fname = submission.problem.name + '.' + submission.language.ext
69 + end
66 send_data(submission.source,
70 send_data(submission.source,
67 {:filename => fname,
71 {:filename => fname,
68 :type => 'text/plain'})
72 :type => 'text/plain'})
69 else
73 else
70 flash[:notice] = 'Error viewing source'
74 flash[:notice] = 'Error viewing source'
71 redirect_to :action => 'list'
75 redirect_to :action => 'list'
72 end
76 end
73 end
77 end
74
78
75 def compiler_msg
79 def compiler_msg
76 @submission = Submission.find(params[:id])
80 @submission = Submission.find(params[:id])
77 if @submission.user_id == session[:user_id]
81 if @submission.user_id == session[:user_id]
@@ -90,15 +90,19
90
90
91 def turn_all_off
91 def turn_all_off
92 Problem.find(:all,
92 Problem.find(:all,
93 :conditions => "available = 1").each do |problem|
93 :conditions => "available = 1").each do |problem|
94 problem.available = false
94 problem.available = false
95 problem.save
95 problem.save
96 end
96 end
97 redirect_to :action => 'list'
97 redirect_to :action => 'list'
98 end
98 end
99
99
100 def stat
100 def stat
101 @problem = Problem.find(params[:id])
101 @problem = Problem.find(params[:id])
102 + if !@problem.available
103 + redirect_to :controller => 'main', :action => 'list'
104 + else
102 @submissions = Submission.find_all_last_by_problem(params[:id])
105 @submissions = Submission.find_all_last_by_problem(params[:id])
103 end
106 end
104 end
107 end
108 + end
You need to be logged in to leave comments. Login now