diff --git a/app/controllers/tasks_controller.rb b/app/controllers/tasks_controller.rb --- a/app/controllers/tasks_controller.rb +++ b/app/controllers/tasks_controller.rb @@ -11,6 +11,16 @@ @user = User.find(session[:user_id]) end + def view + file_name = "#{RAILS_ROOT}/data/tasks/#{params[:file]}" + if !FileTest.exists?(file_name) + redirect_to :action => 'index' and return + end + # ask Apache to send the file + response.headers['X-Sendfile'] = file_name + render :nothing => true + end + protected def check_viewability diff --git a/app/models/configuration.rb b/app/models/configuration.rb --- a/app/models/configuration.rb +++ b/app/models/configuration.rb @@ -55,7 +55,7 @@ return false if mode=='analysis' return true end - + protected def self.read_config @@configurations = {} diff --git a/app/views/site/prompt.html.haml b/app/views/site/prompt.html.haml --- a/app/views/site/prompt.html.haml +++ b/app/views/site/prompt.html.haml @@ -17,6 +17,4 @@ Please make sure that the contestants are ready. After the contest is started, it cannot be paused or stopped. %br/ - = submit_tag 'Start the Contest.' - - + = submit_tag 'Start the Contest.', :onclick => "return confirm('Are you sure?');"