Show More
Commit Description:
[web] confirm when start contest, downloading task description through apache...
Commit 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
File last commit:
Show/Diff file:
Action:
app/controllers/tasks_controller.rb | 34 lines | 767 B | text/x-ruby | RubyLexer |
jittat
[web] added body to problems, added task view page...
r88 class TasksController < ApplicationController
jittat
[web] added mode + access control, when sites started/finished...
r122 before_filter :authenticate, :check_viewability
jittat
[web] added body to problems, added task view page...
r88
def index
redirect_to :action => 'list'
end
def list
@problems = Problem.find_available_problems
@user = User.find(session[:user_id])
end
jittat
[web] confirm when start contest, downloading task description through apache...
r130 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
jittat
[web] added mode + access control, when sites started/finished...
r122 protected
def check_viewability
user = User.find(session[:user_id])
if user==nil or !Configuration.show_tasks_to?(user)
redirect_to :controller => 'main', :action => 'list'
return false
end
end
jittat
[web] added body to problems, added task view page...
r88 end