Show More
Commit Description:
associate logins with users
Commit Description:
associate logins with users
References:
File last commit:
Show/Diff file:
Action:
app/controllers/site_controller.rb | 62 lines | 1.5 KiB | text/x-ruby | RubyLexer |
jittat
[web] site start/stop supports...
r123 class SiteController < ApplicationController
jittat
MERGED 308:HEAD from http://theory.cpe.ku.ac.th/grader/web/branches/ytopc08-2/, removed some registration info...
r162 before_filter :site_admin_authorization, :except => 'login'
def login
# Site administrator login
@countries = Country.find(:all, :include => :sites)
@country_select = @countries.collect { |c| [c.name, c.id] }
@country_select_with_all = [['Any',0]]
@countries.each do |country|
@country_select_with_all << [country.name, country.id]
end
@site_select = []
@countries.each do |country|
country.sites.each do |site|
@site_select << ["#{site.name}, #{country.name}", site.id]
end
end
Jittat Fakcharoenphol
renamed model Configuration to GraderConfiguration, renamed rhtml views to erb, fixed other small errors
r320 @default_site = Site.first if !GraderConfiguration['contest.multisites']
jittat
MERGED 308:HEAD from http://theory.cpe.ku.ac.th/grader/web/branches/ytopc08-2/, removed some registration info...
r162
render :action => 'login', :layout => 'empty'
end
jittat
[web] site start/stop supports...
r123
def index
if @site.started
render :action => 'started', :layout => 'empty'
else
render :action => 'prompt', :layout => 'empty'
end
end
def start
@site.started = true
@site.start_time = Time.new.gmtime
@site.save
redirect_to :action => 'index'
end
jittat
[web] download through apache, sites highlight, logout for site admin...
r133 def logout
reset_session
redirect_to :controller => 'main', :action => 'login'
end
jittat
[web] site start/stop supports...
r123 protected
def site_admin_authorization
if session[:site_id]==nil
jittat
MERGED 308:HEAD from http://theory.cpe.ku.ac.th/grader/web/branches/ytopc08-2/, removed some registration info...
r162 redirect_to :controller => 'site', :action => 'login' and return
jittat
[web] site start/stop supports...
r123 end
begin
@site = Site.find(session[:site_id], :include => :country)
rescue ActiveRecord::RecordNotFound
@site = nil
end
if @site==nil
jittat
MERGED 308:HEAD from http://theory.cpe.ku.ac.th/grader/web/branches/ytopc08-2/, removed some registration info...
r162 redirect_to :controller => 'site', :action => 'login' and return
jittat
[web] site start/stop supports...
r123 end
end
end