Show More
Commit Description:
added message hiding for admin in msg console...
Commit Description:
added message hiding for admin in msg console git-svn-id: http://theory.cpe.ku.ac.th/grader/web/trunk@371 6386c4cd-e34a-4fa8-8920-d93eb39b512e
File last commit:
Show/Diff file:
Action:
app/controllers/tasks_controller.rb | 44 lines | 1.3 KiB | 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
jittat
[web] fixed tasks viewing, changed routes for it...
r131 base_filename = File.basename("#{params[:file]}.#{params[:ext]}")
filename = "#{RAILS_ROOT}/data/tasks/#{base_filename}"
jittat
[web] download through apache, sites highlight, logout for site admin...
r133 #filename = "/home/ioi/web_grader/data/tasks/#{base_filename}"
#filename = "/home/ioi/web_grader/public/images/rails.png"
jittat
[web] fixed tasks viewing, changed routes for it...
r131 if !FileTest.exists?(filename)
jittat
[web] confirm when start contest, downloading task description through apache...
r130 redirect_to :action => 'index' and return
end
jittat
[web] download through apache, sites highlight, logout for site admin...
r133
jittat
added option for Apapche X-Sendfile...
r172 if defined?(USE_APACHE_XSENDFILE) and USE_APACHE_XSENDFILE
response.headers['Content-Type'] = "application/force-download"
response.headers['Content-Disposition'] = "attachment; filename=\"#{File.basename(filename)}\""
response.headers["X-Sendfile"] = filename
response.headers['Content-length'] = File.size(filename)
render :nothing => true
else
send_file filename, :stream => false, :filename => base_filename
end
jittat
[web] confirm when start contest, downloading task description through apache...
r130 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