Description:
add options to allow hall of fame viewing by any user
add menu item for normal user
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r424:217b94aa4f76 - - 6 files changed: 40 inserted, 27 deleted
@@ -23,6 +23,10 | |||||
|
23 |
|
23 | ||
|
24 | def authenticate |
|
24 | def authenticate |
|
25 | unless session[:user_id] |
|
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 | redirect_to :controller => 'main', :action => 'login' |
|
30 | redirect_to :controller => 'main', :action => 'login' |
|
27 | return false |
|
31 | return false |
|
28 | end |
|
32 | end |
@@ -1,18 +1,14 | |||||
|
1 | class ReportController < ApplicationController |
|
1 | class ReportController < ApplicationController |
|
2 |
|
2 | ||
|
3 | before_filter :admin_authorization, only: [:login_stat,:submission_stat] |
|
3 | before_filter :admin_authorization, only: [:login_stat,:submission_stat] |
|
4 |
- before_filter |
|
4 | + before_filter { |c| |
|
5 | - user = User.find(session[:user_id]) if session[:user_id] |
|
5 | + return false unless authenticate |
|
6 | - if user==nil |
|
6 | + |
|
7 | - flash[:notice] = 'You have to login first' |
|
7 | + if GraderConfiguration["system.hall_of_fame_available"] |
|
8 | - redirect_to :controller => 'main', :action => 'login' |
|
8 | + return true; |
|
9 | - return false |
|
||
|
10 | end |
|
9 | end |
|
11 | - |
|
10 | + |
|
12 | - unless GraderConfiguration["hall_of_fame_available"] |
|
11 | + admin_authorization |
|
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 |
|
||
|
16 | } |
|
12 | } |
|
17 |
|
13 | ||
|
18 | def login_stat |
|
14 | def login_stat |
@@ -30,6 +30,10 | |||||
|
30 | append_to menu_items, "[#{I18n.t 'menu.submissions'}]", 'main', 'submission' |
|
30 | append_to menu_items, "[#{I18n.t 'menu.submissions'}]", 'main', 'submission' |
|
31 | append_to menu_items, "[#{I18n.t 'menu.test'}]", 'test', 'index' |
|
31 | append_to menu_items, "[#{I18n.t 'menu.test'}]", 'test', 'index' |
|
32 | end |
|
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 | append_to menu_items, "[#{I18n.t 'menu.help'}]", 'main', 'help' |
|
37 | append_to menu_items, "[#{I18n.t 'menu.help'}]", 'main', 'help' |
|
34 |
|
38 | ||
|
35 | if GraderConfiguration['system.user_setting_enabled'] |
|
39 | if GraderConfiguration['system.user_setting_enabled'] |
@@ -20,6 +20,7 | |||||
|
20 | tasks: 'Tasks' |
|
20 | tasks: 'Tasks' |
|
21 | submissions: 'Submissions' |
|
21 | submissions: 'Submissions' |
|
22 | test: 'Test Interface' |
|
22 | test: 'Test Interface' |
|
|
23 | + hall_of_fame: 'Hall of Fame' | ||
|
23 | help: 'Help' |
|
24 | help: 'Help' |
|
24 | settings: 'Settings' |
|
25 | settings: 'Settings' |
|
25 | log_out: 'Log out' |
|
26 | log_out: 'Log out' |
@@ -20,6 +20,7 | |||||
|
20 | tasks: 'โจทย์' |
|
20 | tasks: 'โจทย์' |
|
21 | submissions: 'โปรแกรมที่ส่ง' |
|
21 | submissions: 'โปรแกรมที่ส่ง' |
|
22 | test: 'ทดสอบโปรแกรม' |
|
22 | test: 'ทดสอบโปรแกรม' |
|
|
23 | + hall_of_fame: 'หอเกียรติยศ' | ||
|
23 | help: 'ความช่วยเหลือ' |
|
24 | help: 'ความช่วยเหลือ' |
|
24 | settings: 'เปลี่ยนรหัสผ่าน' |
|
25 | settings: 'เปลี่ยนรหัสผ่าน' |
|
25 | log_out: 'ออกจากระบบ' |
|
26 | log_out: 'ออกจากระบบ' |
@@ -6,60 +6,60 | |||||
|
6 | :default_value => 'false', |
|
6 | :default_value => 'false', |
|
7 | :description => 'Only admins can log in to the system when running under single user mode.' |
|
7 | :description => 'Only admins can log in to the system when running under single user mode.' |
|
8 | }, |
|
8 | }, |
|
9 | - |
|
9 | + |
|
10 | { |
|
10 | { |
|
11 | :key => 'ui.front.title', |
|
11 | :key => 'ui.front.title', |
|
12 | :value_type => 'string', |
|
12 | :value_type => 'string', |
|
13 | :default_value => 'Grader' |
|
13 | :default_value => 'Grader' |
|
14 | }, |
|
14 | }, |
|
15 | - |
|
15 | + |
|
16 | { |
|
16 | { |
|
17 | :key => 'ui.front.welcome_message', |
|
17 | :key => 'ui.front.welcome_message', |
|
18 | :value_type => 'string', |
|
18 | :value_type => 'string', |
|
19 | :default_value => 'Welcome!' |
|
19 | :default_value => 'Welcome!' |
|
20 | }, |
|
20 | }, |
|
21 | - |
|
21 | + |
|
22 | { |
|
22 | { |
|
23 | :key => 'ui.show_score', |
|
23 | :key => 'ui.show_score', |
|
24 | :value_type => 'boolean', |
|
24 | :value_type => 'boolean', |
|
25 | :default_value => 'true' |
|
25 | :default_value => 'true' |
|
26 | }, |
|
26 | }, |
|
27 | - |
|
27 | + |
|
28 | { |
|
28 | { |
|
29 | :key => 'contest.time_limit', |
|
29 | :key => 'contest.time_limit', |
|
30 | :value_type => 'string', |
|
30 | :value_type => 'string', |
|
31 | :default_value => 'unlimited', |
|
31 | :default_value => 'unlimited', |
|
32 | :description => 'Time limit in format hh:mm, or "unlimited" for contests with no time limits. This config is CACHED. Restart the server before the change can take effect.' |
|
32 | :description => 'Time limit in format hh:mm, or "unlimited" for contests with no time limits. This config is CACHED. Restart the server before the change can take effect.' |
|
33 | }, |
|
33 | }, |
|
34 | - |
|
34 | + |
|
35 | { |
|
35 | { |
|
36 | :key => 'system.mode', |
|
36 | :key => 'system.mode', |
|
37 | :value_type => 'string', |
|
37 | :value_type => 'string', |
|
38 | :default_value => 'standard', |
|
38 | :default_value => 'standard', |
|
39 | :description => 'Current modes are "standard", "contest", "indv-contest", and "analysis".' |
|
39 | :description => 'Current modes are "standard", "contest", "indv-contest", and "analysis".' |
|
40 | }, |
|
40 | }, |
|
41 | - |
|
41 | + |
|
42 | { |
|
42 | { |
|
43 | :key => 'contest.name', |
|
43 | :key => 'contest.name', |
|
44 | :value_type => 'string', |
|
44 | :value_type => 'string', |
|
45 | :default_value => 'Grader', |
|
45 | :default_value => 'Grader', |
|
46 | :description => 'This name will be shown on the user header bar.' |
|
46 | :description => 'This name will be shown on the user header bar.' |
|
47 | }, |
|
47 | }, |
|
48 | - |
|
48 | + |
|
49 | { |
|
49 | { |
|
50 | :key => 'contest.multisites', |
|
50 | :key => 'contest.multisites', |
|
51 | :value_type => 'boolean', |
|
51 | :value_type => 'boolean', |
|
52 | :default_value => 'false', |
|
52 | :default_value => 'false', |
|
53 | :description => 'If the server is in contest mode and this option is true, on the log in of the admin a menu for site selections is shown.' |
|
53 | :description => 'If the server is in contest mode and this option is true, on the log in of the admin a menu for site selections is shown.' |
|
54 | }, |
|
54 | }, |
|
55 | - |
|
55 | + |
|
56 | { |
|
56 | { |
|
57 |
- :key => 'system. |
|
57 | + :key => 'system.hall_of_fame_available', |
|
58 | :value_type => 'boolean', |
|
58 | :value_type => 'boolean', |
|
59 | :default_value => 'false', |
|
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 | # If Configuration['system.online_registration'] is true, the |
|
63 | # If Configuration['system.online_registration'] is true, the |
|
64 | # system allows online registration, and will use these |
|
64 | # system allows online registration, and will use these |
|
65 | # information for sending confirmation emails. |
|
65 | # information for sending confirmation emails. |
@@ -68,26 +68,33 | |||||
|
68 | :value_type => 'string', |
|
68 | :value_type => 'string', |
|
69 | :default_value => 'smtp.somehost.com' |
|
69 | :default_value => 'smtp.somehost.com' |
|
70 | }, |
|
70 | }, |
|
71 | - |
|
71 | + |
|
72 | { |
|
72 | { |
|
73 | :key => 'system.online_registration.from', |
|
73 | :key => 'system.online_registration.from', |
|
74 | :value_type => 'string', |
|
74 | :value_type => 'string', |
|
75 | :default_value => 'your.email@address' |
|
75 | :default_value => 'your.email@address' |
|
76 | }, |
|
76 | }, |
|
77 | - |
|
77 | + |
|
78 | { |
|
78 | { |
|
79 | :key => 'system.admin_email', |
|
79 | :key => 'system.admin_email', |
|
80 | :value_type => 'string', |
|
80 | :value_type => 'string', |
|
81 | :default_value => 'admin@admin.email' |
|
81 | :default_value => 'admin@admin.email' |
|
82 | }, |
|
82 | }, |
|
83 | - |
|
83 | + |
|
84 | { |
|
84 | { |
|
85 | :key => 'system.user_setting_enabled', |
|
85 | :key => 'system.user_setting_enabled', |
|
86 | :value_type => 'boolean', |
|
86 | :value_type => 'boolean', |
|
87 | :default_value => 'true', |
|
87 | :default_value => 'true', |
|
88 | :description => 'If this option is true, users can change their settings' |
|
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 | # If Configuration['contest.test_request.early_timeout'] is true |
|
98 | # If Configuration['contest.test_request.early_timeout'] is true |
|
92 | # the user will not be able to use test request at 30 minutes |
|
99 | # the user will not be able to use test request at 30 minutes |
|
93 | # before the contest ends. |
|
100 | # before the contest ends. |
@@ -115,7 +122,7 | |||||
|
115 | :default_value => 'none', |
|
122 | :default_value => 'none', |
|
116 | :description => "New user will be assigned to this contest automatically, if it exists. Set to 'none' if there is no default contest." |
|
123 | :description => "New user will be assigned to this contest automatically, if it exists. Set to 'none' if there is no default contest." |
|
117 | } |
|
124 | } |
|
118 | - |
|
125 | + |
|
119 | ] |
|
126 | ] |
|
120 |
|
127 | ||
|
121 |
|
128 |
You need to be logged in to leave comments.
Login now