Description:
[web] no site admin login box when not in contest mode
git-svn-id: http://theory.cpe.ku.ac.th/grader/web/trunk@252 6386c4cd-e34a-4fa8-8920-d93eb39b512e
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r124:44e64c191944 - - 2 files changed: 5 inserted, 4 deleted
@@ -13,6 +13,7 | |||||
|
13 | verify :method => :post, :only => [:submit], |
|
13 | verify :method => :post, :only => [:submit], |
|
14 | :redirect_to => { :action => :index } |
|
14 | :redirect_to => { :action => :index } |
|
15 |
|
15 | ||
|
|
16 | + caches_action :index, :login | ||
|
16 |
|
17 | ||
|
17 | def index |
|
18 | def index |
|
18 | redirect_to :action => 'login' |
|
19 | redirect_to :action => 'login' |
@@ -26,7 +27,7 | |||||
|
26 | # |
|
27 | # |
|
27 | # These are for site administrator login |
|
28 | # These are for site administrator login |
|
28 | # |
|
29 | # |
|
29 | - @countries = Country.find(:all) |
|
30 | + @countries = Country.find(:all, :include => :sites) |
|
30 | @country_select = @countries.collect { |c| [c.name, c.id] } |
|
31 | @country_select = @countries.collect { |c| [c.name, c.id] } |
|
31 |
|
32 | ||
|
32 | @country_select_with_all = [['Any',0]] |
|
33 | @country_select_with_all = [['Any',0]] |
@@ -148,8 +149,8 | |||||
|
148 | end |
|
149 | end |
|
149 |
|
150 | ||
|
150 | def check_viewability |
|
151 | def check_viewability |
|
151 | - user = User.find(session[:user_id]) |
|
152 | + @user = User.find(session[:user_id]) |
|
152 | - if (!Configuration.show_tasks_to?(user)) and |
|
153 | + if (!Configuration.show_tasks_to?(@user)) and |
|
153 | ((action_name=='submission') or (action_name=='submit')) |
|
154 | ((action_name=='submission') or (action_name=='submit')) |
|
154 | redirect_to :action => 'list' and return |
|
155 | redirect_to :action => 'list' and return |
|
155 | end |
|
156 | end |
@@ -24,6 +24,7 | |||||
|
24 |
|
24 | ||
|
25 | %br/ |
|
25 | %br/ |
|
26 |
|
26 | ||
|
|
27 | + - if Configuration['system.mode']=='contest' | ||
|
27 | %script{:type => 'text/javascript'} |
|
28 | %script{:type => 'text/javascript'} |
|
28 | var siteList = new Array(); |
|
29 | var siteList = new Array(); |
|
29 | - @countries.each do |country| |
|
30 | - @countries.each do |country| |
@@ -41,7 +42,6 | |||||
|
41 | %b For Site Administrator. |
|
42 | %b For Site Administrator. |
|
42 | %br/ |
|
43 | %br/ |
|
43 | Please select your country and site and login. |
|
44 | Please select your country and site and login. |
|
44 | - .login-box |
|
||
|
45 | - form_for :login, nil, :url => {:controller => 'login', :action => 'site_login'} do |f| |
|
45 | - form_for :login, nil, :url => {:controller => 'login', :action => 'site_login'} do |f| |
|
46 | Country: |
|
46 | Country: |
|
47 | = select :site_country, :id, @country_select_with_all, {}, {:onchange => "updateSiteList();", :onclick => "updateSiteList();" } |
|
47 | = select :site_country, :id, @country_select_with_all, {}, {:onchange => "updateSiteList();", :onclick => "updateSiteList();" } |
You need to be logged in to leave comments.
Login now