Description:
add options to allow hall of fame viewing by any user add menu item for normal user
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r424:217b94aa4f76 - - 6 files changed: 25 inserted, 12 deleted

@@ -23,6 +23,10
23 23
24 24 def authenticate
25 25 unless session[:user_id]
26 + flash[:notice] = 'You need to login'
27 + if GraderConfiguration[SINGLE_USER_MODE_CONF_KEY]
28 + flash[:notice] = 'You need to login but you cannot log in at this time'
29 + end
26 30 redirect_to :controller => 'main', :action => 'login'
27 31 return false
28 32 end
@@ -1,18 +1,14
1 1 class ReportController < ApplicationController
2 2
3 3 before_filter :admin_authorization, only: [:login_stat,:submission_stat]
4 - before_filter(only: :problem_hof) { |c|
5 - user = User.find(session[:user_id]) if session[:user_id]
6 - if user==nil
7 - flash[:notice] = 'You have to login first'
8 - redirect_to :controller => 'main', :action => 'login'
9 - return false
4 + before_filter { |c|
5 + return false unless authenticate
6 +
7 + if GraderConfiguration["system.hall_of_fame_available"]
8 + return true;
10 9 end
11 10
12 - unless GraderConfiguration["hall_of_fame_available"]
13 - flash[:notice] = 'You are not authorized to view the page you requested'
14 - redirect_to :controller => 'main', :action => 'login' unless GraderConfiguration[ "hall_of_fame_available" ]
15 - end
11 + admin_authorization
16 12 }
17 13
18 14 def login_stat
@@ -30,6 +30,10
30 30 append_to menu_items, "[#{I18n.t 'menu.submissions'}]", 'main', 'submission'
31 31 append_to menu_items, "[#{I18n.t 'menu.test'}]", 'test', 'index'
32 32 end
33 +
34 + if GraderConfiguration['system.hall_of_fame_available']
35 + append_to menu_items, "[#{I18n.t 'menu.hall_of_fame'}]", 'report', 'problem_hof'
36 + end
33 37 append_to menu_items, "[#{I18n.t 'menu.help'}]", 'main', 'help'
34 38
35 39 if GraderConfiguration['system.user_setting_enabled']
@@ -20,6 +20,7
20 20 tasks: 'Tasks'
21 21 submissions: 'Submissions'
22 22 test: 'Test Interface'
23 + hall_of_fame: 'Hall of Fame'
23 24 help: 'Help'
24 25 settings: 'Settings'
25 26 log_out: 'Log out'
@@ -20,6 +20,7
20 20 tasks: 'โจทย์'
21 21 submissions: 'โปรแกรมที่ส่ง'
22 22 test: 'ทดสอบโปรแกรม'
23 + hall_of_fame: 'หอเกียรติยศ'
23 24 help: 'ความช่วยเหลือ'
24 25 settings: 'เปลี่ยนรหัสผ่าน'
25 26 log_out: 'ออกจากระบบ'
@@ -54,10 +54,10
54 54 },
55 55
56 56 {
57 - :key => 'system.online_registration',
57 + :key => 'system.hall_of_fame_available',
58 58 :value_type => 'boolean',
59 59 :default_value => 'false',
60 - :description => 'This option enables online registration.'
60 + :description => 'If true, any user can access hall of fame page.'
61 61 },
62 62
63 63 # If Configuration['system.online_registration'] is true, the
@@ -88,6 +88,13
88 88 :description => 'If this option is true, users can change their settings'
89 89 },
90 90
91 + {
92 + :key => 'system.user_setting_enabled',
93 + :value_type => 'boolean',
94 + :default_value => 'true',
95 + :description => 'If this option is true, users can change their settings'
96 + }
97 +
91 98 # If Configuration['contest.test_request.early_timeout'] is true
92 99 # the user will not be able to use test request at 30 minutes
93 100 # before the contest ends.
You need to be logged in to leave comments. Login now