Description:
[web] added error page for uploading too large file
git-svn-id: http://theory.cpe.ku.ac.th/grader/web/trunk@228 6386c4cd-e34a-4fa8-8920-d93eb39b512e
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r109:da88b4336501 - - 2 files changed: 11 inserted, 0 deleted
@@ -0,0 +1,7 | |||||
|
|
1 | + = user_title_bar(@user) | ||
|
|
2 | + | ||
|
|
3 | + .announcementbox | ||
|
|
4 | + %span{:class => 'title'} | ||
|
|
5 | + Error | ||
|
|
6 | + .announcement | ||
|
|
7 | + You are uploading a file which is too large (> 2MB). |
@@ -81,45 +81,49 | |||||
|
81 | end |
|
81 | end |
|
82 |
|
82 | ||
|
83 | def compiler_msg |
|
83 | def compiler_msg |
|
84 | @submission = Submission.find(params[:id]) |
|
84 | @submission = Submission.find(params[:id]) |
|
85 | if @submission.user_id == session[:user_id] |
|
85 | if @submission.user_id == session[:user_id] |
|
86 | render :action => 'compiler_msg', :layout => 'empty' |
|
86 | render :action => 'compiler_msg', :layout => 'empty' |
|
87 | else |
|
87 | else |
|
88 | flash[:notice] = 'Error viewing source' |
|
88 | flash[:notice] = 'Error viewing source' |
|
89 | redirect_to :action => 'list' |
|
89 | redirect_to :action => 'list' |
|
90 | end |
|
90 | end |
|
91 | end |
|
91 | end |
|
92 |
|
92 | ||
|
93 | def submission |
|
93 | def submission |
|
94 | @user = User.find(session[:user_id]) |
|
94 | @user = User.find(session[:user_id]) |
|
95 | @problems = Problem.find_available_problems |
|
95 | @problems = Problem.find_available_problems |
|
96 | if params[:id]==nil |
|
96 | if params[:id]==nil |
|
97 | @problem = nil |
|
97 | @problem = nil |
|
98 | @submissions = nil |
|
98 | @submissions = nil |
|
99 | else |
|
99 | else |
|
100 | @problem = Problem.find_by_name(params[:id]) |
|
100 | @problem = Problem.find_by_name(params[:id]) |
|
101 | @submissions = Submission.find_all_by_user_problem(@user.id, @problem.id) |
|
101 | @submissions = Submission.find_all_by_user_problem(@user.id, @problem.id) |
|
102 | end |
|
102 | end |
|
103 | end |
|
103 | end |
|
104 |
|
104 | ||
|
|
105 | + def error | ||
|
|
106 | + @user = User.find(session[:user_id]) | ||
|
|
107 | + end | ||
|
|
108 | + | ||
|
105 | protected |
|
109 | protected |
|
106 | def prepare_list_information |
|
110 | def prepare_list_information |
|
107 | @problems = Problem.find_available_problems |
|
111 | @problems = Problem.find_available_problems |
|
108 | @prob_submissions = Array.new |
|
112 | @prob_submissions = Array.new |
|
109 | @user = User.find(session[:user_id]) |
|
113 | @user = User.find(session[:user_id]) |
|
110 | @problems.each do |p| |
|
114 | @problems.each do |p| |
|
111 | sub = Submission.find_last_by_user_and_problem(@user.id,p.id) |
|
115 | sub = Submission.find_last_by_user_and_problem(@user.id,p.id) |
|
112 | if sub!=nil |
|
116 | if sub!=nil |
|
113 | @prob_submissions << { :count => sub.number, :submission => sub } |
|
117 | @prob_submissions << { :count => sub.number, :submission => sub } |
|
114 | else |
|
118 | else |
|
115 | @prob_submissions << { :count => 0, :submission => nil } |
|
119 | @prob_submissions << { :count => 0, :submission => nil } |
|
116 | end |
|
120 | end |
|
117 | end |
|
121 | end |
|
118 |
|
122 | ||
|
119 | @announcements = Announcement.find(:all, |
|
123 | @announcements = Announcement.find(:all, |
|
120 | :conditions => "published = 1", |
|
124 | :conditions => "published = 1", |
|
121 | :order => "created_at DESC") |
|
125 | :order => "created_at DESC") |
|
122 | end |
|
126 | end |
|
123 |
|
127 | ||
|
124 | end |
|
128 | end |
|
125 |
|
129 |
You need to be logged in to leave comments.
Login now