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). |
@@ -57,69 +57,73 | |||
|
57 | 57 | flash[:notice] = 'Error adding your submission to task queue' |
|
58 | 58 | end |
|
59 | 59 | else |
|
60 | 60 | prepare_list_information |
|
61 | 61 | render :action => 'list' and return |
|
62 | 62 | end |
|
63 | 63 | redirect_to :action => 'list' |
|
64 | 64 | end |
|
65 | 65 | |
|
66 | 66 | def source |
|
67 | 67 | submission = Submission.find(params[:id]) |
|
68 | 68 | if submission.user_id == session[:user_id] |
|
69 | 69 | if submission.problem.output_only |
|
70 | 70 | fname = submission.source_filename |
|
71 | 71 | else |
|
72 | 72 | fname = submission.problem.name + '.' + submission.language.ext |
|
73 | 73 | end |
|
74 | 74 | send_data(submission.source, |
|
75 | 75 | {:filename => fname, |
|
76 | 76 | :type => 'text/plain'}) |
|
77 | 77 | else |
|
78 | 78 | flash[:notice] = 'Error viewing source' |
|
79 | 79 | redirect_to :action => 'list' |
|
80 | 80 | end |
|
81 | 81 | end |
|
82 | 82 | |
|
83 | 83 | def compiler_msg |
|
84 | 84 | @submission = Submission.find(params[:id]) |
|
85 | 85 | if @submission.user_id == session[:user_id] |
|
86 | 86 | render :action => 'compiler_msg', :layout => 'empty' |
|
87 | 87 | else |
|
88 | 88 | flash[:notice] = 'Error viewing source' |
|
89 | 89 | redirect_to :action => 'list' |
|
90 | 90 | end |
|
91 | 91 | end |
|
92 | 92 | |
|
93 | 93 | def submission |
|
94 | 94 | @user = User.find(session[:user_id]) |
|
95 | 95 | @problems = Problem.find_available_problems |
|
96 | 96 | if params[:id]==nil |
|
97 | 97 | @problem = nil |
|
98 | 98 | @submissions = nil |
|
99 | 99 | else |
|
100 | 100 | @problem = Problem.find_by_name(params[:id]) |
|
101 | 101 | @submissions = Submission.find_all_by_user_problem(@user.id, @problem.id) |
|
102 | 102 | end |
|
103 | 103 | end |
|
104 | 104 | |
|
105 | + def error | |
|
106 | + @user = User.find(session[:user_id]) | |
|
107 | + end | |
|
108 | + | |
|
105 | 109 | protected |
|
106 | 110 | def prepare_list_information |
|
107 | 111 | @problems = Problem.find_available_problems |
|
108 | 112 | @prob_submissions = Array.new |
|
109 | 113 | @user = User.find(session[:user_id]) |
|
110 | 114 | @problems.each do |p| |
|
111 | 115 | sub = Submission.find_last_by_user_and_problem(@user.id,p.id) |
|
112 | 116 | if sub!=nil |
|
113 | 117 | @prob_submissions << { :count => sub.number, :submission => sub } |
|
114 | 118 | else |
|
115 | 119 | @prob_submissions << { :count => 0, :submission => nil } |
|
116 | 120 | end |
|
117 | 121 | end |
|
118 | 122 | |
|
119 | 123 | @announcements = Announcement.find(:all, |
|
120 | 124 | :conditions => "published = 1", |
|
121 | 125 | :order => "created_at DESC") |
|
122 | 126 | end |
|
123 | 127 | |
|
124 | 128 | end |
|
125 | 129 |
You need to be logged in to leave comments.
Login now