Description:
[web] confirm when start contest, downloading task description through apache git-svn-id: http://theory.cpe.ku.ac.th/grader/web/trunk@260 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

r130:f343b8fb7d21 - - 2 files changed: 11 inserted, 3 deleted

@@ -2,23 +2,33
2 2
3 3 before_filter :authenticate, :check_viewability
4 4
5 5 def index
6 6 redirect_to :action => 'list'
7 7 end
8 8
9 9 def list
10 10 @problems = Problem.find_available_problems
11 11 @user = User.find(session[:user_id])
12 12 end
13 13
14 + def view
15 + file_name = "#{RAILS_ROOT}/data/tasks/#{params[:file]}"
16 + if !FileTest.exists?(file_name)
17 + redirect_to :action => 'index' and return
18 + end
19 + # ask Apache to send the file
20 + response.headers['X-Sendfile'] = file_name
21 + render :nothing => true
22 + end
23 +
14 24 protected
15 25
16 26 def check_viewability
17 27 user = User.find(session[:user_id])
18 28 if user==nil or !Configuration.show_tasks_to?(user)
19 29 redirect_to :controller => 'main', :action => 'list'
20 30 return false
21 31 end
22 32 end
23 33
24 34 end
@@ -8,15 +8,13
8 8 (please
9 9 = link_to 'refresh', :action => 'index'
10 10 to update)
11 11 %br/
12 12 %br/
13 13
14 14 - form_tag :action => 'start' do
15 15 When you're ready, you can click the button below to start the contest.
16 16 %br/
17 17 Please make sure that the contestants are ready.
18 18 After the contest is started, it <b>cannot</b> be paused or stopped.
19 19 %br/
20 - = submit_tag 'Start the Contest.'
21 -
22 -
20 + = submit_tag 'Start the Contest.', :onclick => "return confirm('Are you sure?');"
You need to be logged in to leave comments. Login now