Description:
renamed model Configuration to GraderConfiguration, renamed rhtml views to erb, fixed other small errors
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r320:c31111f6e4b5 - - 61 files changed: 696 inserted, 640 deleted
@@ -0,0 +1,176 | |||||
|
|
1 | + require 'yaml' | ||
|
|
2 | + | ||
|
|
3 | + # | ||
|
|
4 | + # This class also contains various login of the system. | ||
|
|
5 | + # | ||
|
|
6 | + class GraderConfiguration < ActiveRecord::Base | ||
|
|
7 | + | ||
|
|
8 | + SYSTEM_MODE_CONF_KEY = 'system.mode' | ||
|
|
9 | + TEST_REQUEST_EARLY_TIMEOUT_KEY = 'contest.test_request.early_timeout' | ||
|
|
10 | + MULTICONTESTS_KEY = 'system.multicontests' | ||
|
|
11 | + CONTEST_TIME_LIMIT_KEY = 'contest.time_limit' | ||
|
|
12 | + | ||
|
|
13 | + cattr_accessor :config_cache | ||
|
|
14 | + cattr_accessor :task_grading_info_cache | ||
|
|
15 | + cattr_accessor :contest_time_str | ||
|
|
16 | + cattr_accessor :contest_time | ||
|
|
17 | + | ||
|
|
18 | + GraderConfiguration.config_cache = nil | ||
|
|
19 | + GraderConfiguration.task_grading_info_cache = nil | ||
|
|
20 | + | ||
|
|
21 | + def self.config_cached? | ||
|
|
22 | + (defined? CONFIGURATION_CACHE_ENABLED) and (CONFIGURATION_CACHE_ENABLED) | ||
|
|
23 | + end | ||
|
|
24 | + | ||
|
|
25 | + def self.get(key) | ||
|
|
26 | + if GraderConfiguration.config_cached? | ||
|
|
27 | + if GraderConfiguration.config_cache == nil | ||
|
|
28 | + self.read_config | ||
|
|
29 | + end | ||
|
|
30 | + return GraderConfiguration.config_cache[key] | ||
|
|
31 | + else | ||
|
|
32 | + return GraderConfiguration.read_one_key(key) | ||
|
|
33 | + end | ||
|
|
34 | + end | ||
|
|
35 | + | ||
|
|
36 | + def self.[](key) | ||
|
|
37 | + self.get(key) | ||
|
|
38 | + end | ||
|
|
39 | + | ||
|
|
40 | + def self.reload | ||
|
|
41 | + self.read_config | ||
|
|
42 | + end | ||
|
|
43 | + | ||
|
|
44 | + def self.clear | ||
|
|
45 | + GraderConfiguration.config_cache = nil | ||
|
|
46 | + end | ||
|
|
47 | + | ||
|
|
48 | + # | ||
|
|
49 | + # View decision | ||
|
|
50 | + # | ||
|
|
51 | + def self.show_submitbox_to?(user) | ||
|
|
52 | + mode = get(SYSTEM_MODE_CONF_KEY) | ||
|
|
53 | + return false if mode=='analysis' | ||
|
|
54 | + if (mode=='contest') | ||
|
|
55 | + return false if (user.site!=nil) and | ||
|
|
56 | + ((user.site.started!=true) or (user.site.finished?)) | ||
|
|
57 | + end | ||
|
|
58 | + return true | ||
|
|
59 | + end | ||
|
|
60 | + | ||
|
|
61 | + def self.show_tasks_to?(user) | ||
|
|
62 | + if time_limit_mode? | ||
|
|
63 | + return false if not user.contest_started? | ||
|
|
64 | + end | ||
|
|
65 | + return true | ||
|
|
66 | + end | ||
|
|
67 | + | ||
|
|
68 | + def self.show_grading_result | ||
|
|
69 | + return (get(SYSTEM_MODE_CONF_KEY)=='analysis') | ||
|
|
70 | + end | ||
|
|
71 | + | ||
|
|
72 | + def self.allow_test_request(user) | ||
|
|
73 | + mode = get(SYSTEM_MODE_CONF_KEY) | ||
|
|
74 | + early_timeout = get(TEST_REQUEST_EARLY_TIMEOUT_KEY) | ||
|
|
75 | + if (mode=='contest') | ||
|
|
76 | + return false if ((user.site!=nil) and | ||
|
|
77 | + ((user.site.started!=true) or | ||
|
|
78 | + (early_timeout and (user.site.time_left < 30.minutes)))) | ||
|
|
79 | + end | ||
|
|
80 | + return false if mode=='analysis' | ||
|
|
81 | + return true | ||
|
|
82 | + end | ||
|
|
83 | + | ||
|
|
84 | + def self.task_grading_info | ||
|
|
85 | + if GraderConfiguration.task_grading_info_cache==nil | ||
|
|
86 | + read_grading_info | ||
|
|
87 | + end | ||
|
|
88 | + return GraderConfiguration.task_grading_info_cache | ||
|
|
89 | + end | ||
|
|
90 | + | ||
|
|
91 | + def self.standard_mode? | ||
|
|
92 | + return get(SYSTEM_MODE_CONF_KEY) == 'standard' | ||
|
|
93 | + end | ||
|
|
94 | + | ||
|
|
95 | + def self.contest_mode? | ||
|
|
96 | + return get(SYSTEM_MODE_CONF_KEY) == 'contest' | ||
|
|
97 | + end | ||
|
|
98 | + | ||
|
|
99 | + def self.indv_contest_mode? | ||
|
|
100 | + return get(SYSTEM_MODE_CONF_KEY) == 'indv-contest' | ||
|
|
101 | + end | ||
|
|
102 | + | ||
|
|
103 | + def self.multicontests? | ||
|
|
104 | + return get(MULTICONTESTS_KEY) == true | ||
|
|
105 | + end | ||
|
|
106 | + | ||
|
|
107 | + def self.time_limit_mode? | ||
|
|
108 | + mode = get(SYSTEM_MODE_CONF_KEY) | ||
|
|
109 | + return ((mode == 'contest') or (mode == 'indv-contest')) | ||
|
|
110 | + end | ||
|
|
111 | + | ||
|
|
112 | + def self.analysis_mode? | ||
|
|
113 | + return get(SYSTEM_MODE_CONF_KEY) == 'analysis' | ||
|
|
114 | + end | ||
|
|
115 | + | ||
|
|
116 | + def self.contest_time_limit | ||
|
|
117 | + contest_time_str = GraderConfiguration[CONTEST_TIME_LIMIT_KEY] | ||
|
|
118 | + | ||
|
|
119 | + if not defined? GraderConfiguration.contest_time_str | ||
|
|
120 | + GraderConfiguration.contest_time_str = nil | ||
|
|
121 | + end | ||
|
|
122 | + | ||
|
|
123 | + if GraderConfiguration.contest_time_str != contest_time_str | ||
|
|
124 | + GraderConfiguration.contest_time_str = contest_time_str | ||
|
|
125 | + if tmatch = /(\d+):(\d+)/.match(contest_time_str) | ||
|
|
126 | + h = tmatch[1].to_i | ||
|
|
127 | + m = tmatch[2].to_i | ||
|
|
128 | + | ||
|
|
129 | + GraderConfiguration.contest_time = h.hour + m.minute | ||
|
|
130 | + else | ||
|
|
131 | + GraderConfiguration.contest_time = nil | ||
|
|
132 | + end | ||
|
|
133 | + end | ||
|
|
134 | + return GraderConfiguration.contest_time | ||
|
|
135 | + end | ||
|
|
136 | + | ||
|
|
137 | + protected | ||
|
|
138 | + | ||
|
|
139 | + def self.convert_type(val,type) | ||
|
|
140 | + case type | ||
|
|
141 | + when 'string' | ||
|
|
142 | + return val | ||
|
|
143 | + | ||
|
|
144 | + when 'integer' | ||
|
|
145 | + return val.to_i | ||
|
|
146 | + | ||
|
|
147 | + when 'boolean' | ||
|
|
148 | + return (val=='true') | ||
|
|
149 | + end | ||
|
|
150 | + end | ||
|
|
151 | + | ||
|
|
152 | + def self.read_config | ||
|
|
153 | + GraderConfiguration.config_cache = {} | ||
|
|
154 | + GraderConfiguration.find(:all).each do |conf| | ||
|
|
155 | + key = conf.key | ||
|
|
156 | + val = conf.value | ||
|
|
157 | + GraderConfiguration.config_cache[key] = GraderConfiguration.convert_type(val,conf.value_type) | ||
|
|
158 | + end | ||
|
|
159 | + end | ||
|
|
160 | + | ||
|
|
161 | + def self.read_one_key(key) | ||
|
|
162 | + conf = GraderConfiguration.find_by_key(key) | ||
|
|
163 | + if conf | ||
|
|
164 | + return GraderConfiguration.convert_type(conf.value,conf.value_type) | ||
|
|
165 | + else | ||
|
|
166 | + return nil | ||
|
|
167 | + end | ||
|
|
168 | + end | ||
|
|
169 | + | ||
|
|
170 | + def self.read_grading_info | ||
|
|
171 | + f = File.open(TASK_GRADING_INFO_FILENAME) | ||
|
|
172 | + GraderConfiguration.task_grading_info_cache = YAML.load(f) | ||
|
|
173 | + f.close | ||
|
|
174 | + end | ||
|
|
175 | + | ||
|
|
176 | + end |
@@ -0,0 +1,52 | |||||
|
|
1 | + <%= error_messages_for 'problem' %> | ||
|
|
2 | + | ||
|
|
3 | + <!--[form:problem]--> | ||
|
|
4 | + <p><label for="problem_name">Name</label><br/> | ||
|
|
5 | + <%= text_field 'problem', 'name' %></p> | ||
|
|
6 | + | ||
|
|
7 | + <p><label for="problem_full_name">Full name</label><br/> | ||
|
|
8 | + <%= text_field 'problem', 'full_name' %></p> | ||
|
|
9 | + | ||
|
|
10 | + <p><label for="problem_full_score">Full score</label><br/> | ||
|
|
11 | + <%= text_field 'problem', 'full_score' %></p> | ||
|
|
12 | + | ||
|
|
13 | + <p><label for="problem_date_added">Date added</label><br/> | ||
|
|
14 | + <%= date_select 'problem', 'date_added' %></p> | ||
|
|
15 | + | ||
|
|
16 | + <% | ||
|
|
17 | + # TODO: these should be put in model Problem, but I can't think of | ||
|
|
18 | + # nice default values for them. These values look fine only | ||
|
|
19 | + # in this case (of lazily adding new problems). | ||
|
|
20 | + @problem.available = true if @problem!=nil and @problem.available==nil | ||
|
|
21 | + @problem.test_allowed = true if @problem!=nil and @problem.test_allowed==nil | ||
|
|
22 | + @problem.output_only = false if @problem!=nil and @problem.output_only==nil | ||
|
|
23 | + %> | ||
|
|
24 | + | ||
|
|
25 | + <p> | ||
|
|
26 | + <label for="problem_available">Available?</label> | ||
|
|
27 | + <%= check_box :problem, :available %> | ||
|
|
28 | + | ||
|
|
29 | + <label for="problem_test_allowed">Test allowed?</label> | ||
|
|
30 | + <%= check_box :problem, :test_allowed %> | ||
|
|
31 | + | ||
|
|
32 | + <label for="problem_output_only">Output only?</label> | ||
|
|
33 | + <%= check_box :problem, :output_only %> | ||
|
|
34 | + </p> | ||
|
|
35 | + | ||
|
|
36 | + <%= error_messages_for 'description' %> | ||
|
|
37 | + | ||
|
|
38 | + <p><label for="description_body">Description</label><br/> | ||
|
|
39 | + <%= text_area :description, :body, :rows => 10, :cols => 80 %></p> | ||
|
|
40 | + | ||
|
|
41 | + <p><label for="description_markdowned">Markdowned?</label> | ||
|
|
42 | + <%= select "description", | ||
|
|
43 | + "markdowned", | ||
|
|
44 | + [['True',true],['False',false]], | ||
|
|
45 | + {:selected => (@description) ? @description.markdowned : false } | ||
|
|
46 | + %></p> | ||
|
|
47 | + | ||
|
|
48 | + <p><label for="problem_url">URL</label><br/> | ||
|
|
49 | + <%= text_field 'problem', 'url' %></p> | ||
|
|
50 | + | ||
|
|
51 | + | ||
|
|
52 | + <!--[eoform:problem]--> |
@@ -0,0 +1,9 | |||||
|
|
1 | + <h1>Editing problem</h1> | ||
|
|
2 | + | ||
|
|
3 | + <%= form_tag :action => 'update', :id => @problem do %> | ||
|
|
4 | + <%= render :partial => 'form' %> | ||
|
|
5 | + <%= submit_tag 'Edit' %> | ||
|
|
6 | + <% end %> | ||
|
|
7 | + | ||
|
|
8 | + <%= link_to 'Show', :action => 'show', :id => @problem %> | | ||
|
|
9 | + <%= link_to 'Back', :action => 'list' %> |
@@ -0,0 +1,67 | |||||
|
|
1 | + <% content_for :head do %> | ||
|
|
2 | + <%= stylesheet_link_tag 'problems' %> | ||
|
|
3 | + <%= javascript_include_tag :defaults %> | ||
|
|
4 | + <% end %> | ||
|
|
5 | + | ||
|
|
6 | + <h1>Listing problems</h1> | ||
|
|
7 | + | ||
|
|
8 | + <p> | ||
|
|
9 | + <%= link_to '[New problem]', :action => 'new' %> | ||
|
|
10 | + <%= link_to '[Manage problems]', :action => 'manage' %> | ||
|
|
11 | + <%= link_to '[Import problems]', :action => 'import' %> | ||
|
|
12 | + <%= link_to '[Turn off all problems]', :action => 'turn_all_off' %> | ||
|
|
13 | + <%= link_to '[Turn on all problems]', :action => 'turn_all_on' %> | ||
|
|
14 | + </p> | ||
|
|
15 | + | ||
|
|
16 | + <div class="submitbox"> | ||
|
|
17 | + <%= form_tag :action => 'quick_create' do %> | ||
|
|
18 | + <b>Quick New:</b> | ||
|
|
19 | + <label for="problem_name">Name</label> | ||
|
|
20 | + <%= text_field 'problem', 'name' %> | | ||
|
|
21 | + <label for="problem_full_name">Full name</label> | ||
|
|
22 | + <%= text_field 'problem', 'full_name' %> | ||
|
|
23 | + <%= submit_tag "Create" %> | ||
|
|
24 | + <% end %> | ||
|
|
25 | + </div> | ||
|
|
26 | + | ||
|
|
27 | + <table> | ||
|
|
28 | + <tr> | ||
|
|
29 | + <th>Name</th> | ||
|
|
30 | + <th>Full name</th> | ||
|
|
31 | + <th>Full score</th> | ||
|
|
32 | + <th>Date added</th> | ||
|
|
33 | + <th>Avail?</th> | ||
|
|
34 | + <th>Test?</th> | ||
|
|
35 | + <% if GraderConfiguration.multicontests? %> | ||
|
|
36 | + <th>Contests</th> | ||
|
|
37 | + <% end %> | ||
|
|
38 | + </tr> | ||
|
|
39 | + | ||
|
|
40 | + <% for problem in @problems %> | ||
|
|
41 | + <tr id="prob-<%= problem.id %>" name="prob-<%= problem.id %>" class="<%= (problem.available) ? "available" : "not-available" %>"> | ||
|
|
42 | + <% @problem=problem %> | ||
|
|
43 | + <td><%= in_place_editor_field :problem, :name, {}, :rows=>1 %></td> | ||
|
|
44 | + <td><%= in_place_editor_field :problem, :full_name, {}, :rows=>1 %></td> | ||
|
|
45 | + <td><%= in_place_editor_field :problem, :full_score, {}, :rows=>1 %></td> | ||
|
|
46 | + <td><%= problem.date_added %></td> | ||
|
|
47 | + <td id="prob-<%= problem.id %>-avail"><%= problem.available %></td> | ||
|
|
48 | + <td><%= problem.test_allowed %></td> | ||
|
|
49 | + | ||
|
|
50 | + <% if GraderConfiguration.multicontests? %> | ||
|
|
51 | + <td> | ||
|
|
52 | + <%= problem.contests.collect { |c| c.name }.join(', ') %> | ||
|
|
53 | + </td> | ||
|
|
54 | + <% end %> | ||
|
|
55 | + | ||
|
|
56 | + <td><%= link_to_remote '[Toggle]', :url => {:action => 'toggle', :id => problem.id } %></td> | ||
|
|
57 | + <td><%= link_to '[Stat]', :action => 'stat', :id => problem.id %></td> | ||
|
|
58 | + <td><%= link_to '[Show]', :action => 'show', :id => problem %></td> | ||
|
|
59 | + <td><%= link_to '[Edit]', :action => 'edit', :id => problem %></td> | ||
|
|
60 | + <td><%= link_to '[Destroy]', { :action => 'destroy', :id => problem }, :confirm => 'Are you sure?', :method => :post %></td> | ||
|
|
61 | + </tr> | ||
|
|
62 | + <% end %> | ||
|
|
63 | + </table> | ||
|
|
64 | + | ||
|
|
65 | + <br /> | ||
|
|
66 | + | ||
|
|
67 | + <%= link_to '[New problem]', :action => 'new' %> |
@@ -0,0 +1,8 | |||||
|
|
1 | + <h1>New problem</h1> | ||
|
|
2 | + | ||
|
|
3 | + <%= form_tag :action => 'create' do %> | ||
|
|
4 | + <%= render :partial => 'form' %> | ||
|
|
5 | + <%= submit_tag "Create" %> | ||
|
|
6 | + <% end %> | ||
|
|
7 | + | ||
|
|
8 | + <%= link_to 'Back', :action => 'list' %> |
@@ -0,0 +1,28 | |||||
|
|
1 | + <h1>Problem stat: <%= @problem.name %></h1> | ||
|
|
2 | + | ||
|
|
3 | + <i>This is just a hack. Really not efficient.</i><br/><br/> | ||
|
|
4 | + | ||
|
|
5 | + <% if @submissions!=nil %> | ||
|
|
6 | + <table class="info"> | ||
|
|
7 | + <tr class="info-head"> | ||
|
|
8 | + <th>login</th> | ||
|
|
9 | + <th>name</th> | ||
|
|
10 | + <th>submitted_at</th> | ||
|
|
11 | + <th>points</th> | ||
|
|
12 | + <th>comment</th> | ||
|
|
13 | + </tr> | ||
|
|
14 | + <% count = 0 %> | ||
|
|
15 | + <% @submissions.each do |sub| %> | ||
|
|
16 | + <tr class="<%= (count % 2 ==0) ? "info-even" : "info-odd" %>"> | ||
|
|
17 | + <td><%= sub.user.login %></td> | ||
|
|
18 | + <td><%= sub.user.full_name if sub.user %></td> | ||
|
|
19 | + <td><%= sub.submitted_at.to_s %></td> | ||
|
|
20 | + <td><%= sub.points %></td> | ||
|
|
21 | + <td><div style="font-family: monospace"><%= sub.grader_comment %></div></td> | ||
|
|
22 | + </tr> | ||
|
|
23 | + <% count += 1 %> | ||
|
|
24 | + <% end %> | ||
|
|
25 | + </table> | ||
|
|
26 | + <% else %> | ||
|
|
27 | + No submission | ||
|
|
28 | + <% end %> |
@@ -0,0 +1,22 | |||||
|
|
1 | + <%= error_messages_for 'user' %> | ||
|
|
2 | + | ||
|
|
3 | + <!--[form:user]--> | ||
|
|
4 | + <p><label for="user_name">Login</label><br/> | ||
|
|
5 | + <%= text_field 'user', 'login' %></p> | ||
|
|
6 | + | ||
|
|
7 | + <p><label for="user_name">Full name</label><br/> | ||
|
|
8 | + <%= text_field 'user', 'full_name' %></p> | ||
|
|
9 | + | ||
|
|
10 | + <p><label for="password">Password</label><br/> | ||
|
|
11 | + <%= password_field 'user', 'password' %></p> | ||
|
|
12 | + | ||
|
|
13 | + <p><label for="password_confirmation">Password (confirm)</label><br/> | ||
|
|
14 | + <%= password_field 'user', 'password_confirmation' %></p> | ||
|
|
15 | + | ||
|
|
16 | + <p><label for="user_email">E-mail</label><br/> | ||
|
|
17 | + <%= text_field 'user', 'email' %></p> | ||
|
|
18 | + | ||
|
|
19 | + <p><label for="user_alias">Alias</label><br/> | ||
|
|
20 | + <%= text_field 'user', 'alias' %></p> | ||
|
|
21 | + <!--[eoform:user]--> | ||
|
|
22 | + |
@@ -0,0 +1,9 | |||||
|
|
1 | + <h1>Editing user</h1> | ||
|
|
2 | + | ||
|
|
3 | + <%= form_tag :action => 'update', :id => @user do %> | ||
|
|
4 | + <%= render :partial => 'form' %> | ||
|
|
5 | + <%= submit_tag 'Edit' %> | ||
|
|
6 | + <% end %> | ||
|
|
7 | + | ||
|
|
8 | + <%= link_to 'Show', :action => 'show', :id => @user %> | | ||
|
|
9 | + <%= link_to 'Back', :action => 'list' %> |
@@ -0,0 +1,86 | |||||
|
|
1 | + <h1>Listing users</h1> | ||
|
|
2 | + | ||
|
|
3 | + <div class="submitbox"> | ||
|
|
4 | + <b>Quick add</b> | ||
|
|
5 | + <%= form_tag :action => 'create' do %> | ||
|
|
6 | + <table border="0"> | ||
|
|
7 | + <tr> | ||
|
|
8 | + <td><label for="user_login">Login</label></td> | ||
|
|
9 | + <td><label for="user_full_name">Full name</label></td> | ||
|
|
10 | + <td><label for="user_password">Password</label></td> | ||
|
|
11 | + <td><label for="user_password_confirmation">Confirm</label></td> | ||
|
|
12 | + <td><label for="user_email">Email</label></td> | ||
|
|
13 | + </tr> | ||
|
|
14 | + <tr> | ||
|
|
15 | + <td><%= text_field 'user', 'login', :size => 10 %></td> | ||
|
|
16 | + <td><%= text_field 'user', 'full_name', :size => 30 %></td> | ||
|
|
17 | + <td><%= password_field 'user', 'password', :size => 10 %></td> | ||
|
|
18 | + <td><%= password_field 'user', 'password_confirmation', :size => 10 %></td> | ||
|
|
19 | + <td><%= text_field 'user', 'email', :size => 15 %></td> | ||
|
|
20 | + <td><%= submit_tag "Create" %></td> | ||
|
|
21 | + </tr> | ||
|
|
22 | + </table> | ||
|
|
23 | + <% end %> | ||
|
|
24 | + <br/> | ||
|
|
25 | + <b>Import from site management</b> | ||
|
|
26 | + <%= form_tag({:action => 'import'}, :multipart => true) do %> | ||
|
|
27 | + File: <%= file_field_tag 'file' %> <%= submit_tag 'Import' %> | ||
|
|
28 | + <% end %> | ||
|
|
29 | + <br/> | ||
|
|
30 | + <b>What else: </b> | ||
|
|
31 | + <%= link_to '[New user]', :action => 'new' %> | ||
|
|
32 | + <%= link_to '[New list of users]', :action => 'new_list' %> | ||
|
|
33 | + <%= link_to '[View administrators]', :action => 'admin' %> | ||
|
|
34 | + <%= link_to '[Random passwords]', :action => 'random_all_passwords' %> | ||
|
|
35 | + <%= link_to '[View active users]', :action => 'active' %> | ||
|
|
36 | + <%= link_to '[Mass mailing]', :action => 'mass_mailing' %> | ||
|
|
37 | + <% if GraderConfiguration.multicontests? %> | ||
|
|
38 | + <br/><b>Multi-contest:</b> | ||
|
|
39 | + <%= link_to '[Manage bulk users in contests]', :action => 'contest_management' %> | ||
|
|
40 | + View users in: | ||
|
|
41 | + <% @contests.each do |contest| %> | ||
|
|
42 | + <%= link_to "[#{contest.name}]", :action => 'contests', :id => contest.id %> | ||
|
|
43 | + <% end %> | ||
|
|
44 | + <%= link_to "[no contest]", :action => 'contests', :id => 'none' %> | ||
|
|
45 | + <% end %> | ||
|
|
46 | + </div> | ||
|
|
47 | + | ||
|
|
48 | + Total <%= @user_count %> users | | ||
|
|
49 | + <% if !@paginated %> | ||
|
|
50 | + Display all users. | ||
|
|
51 | + <%= link_to '[show in pages]', :action => 'list', :page => '1' %> | ||
|
|
52 | + <% else %> | ||
|
|
53 | + Display in pages. | ||
|
|
54 | + <%= link_to '[display all]', :action => 'list', :page => 'all' %> | | ||
|
|
55 | + <%= will_paginate @users, :container => false %> | ||
|
|
56 | + <% end %> | ||
|
|
57 | + <table class="info"> | ||
|
|
58 | + <tr class="info-head"> | ||
|
|
59 | + <% for column in User.content_columns %> | ||
|
|
60 | + <% if !@hidden_columns.index(column.name) %> | ||
|
|
61 | + <th><%= column.human_name %></th> | ||
|
|
62 | + <% end %> | ||
|
|
63 | + <% end %> | ||
|
|
64 | + <th></th> | ||
|
|
65 | + <th></th> | ||
|
|
66 | + <th></th> | ||
|
|
67 | + </tr> | ||
|
|
68 | + | ||
|
|
69 | + <% for user in @users %> | ||
|
|
70 | + <tr class="info-<%= cycle("odd","even") %>"> | ||
|
|
71 | + <% for column in User.content_columns %> | ||
|
|
72 | + <% if !@hidden_columns.index(column.name) %> | ||
|
|
73 | + <td><%=h user.send(column.name) %></td> | ||
|
|
74 | + <% end %> | ||
|
|
75 | + <% end %> | ||
|
|
76 | + <td><%= link_to 'Show', :action => 'show', :id => user %></td> | ||
|
|
77 | + <td><%= link_to 'Edit', :action => 'edit', :id => user %></td> | ||
|
|
78 | + <td><%= link_to 'Destroy', { :action => 'destroy', :id => user }, :confirm => 'Are you sure?', :method => :post %></td> | ||
|
|
79 | + </tr> | ||
|
|
80 | + <% end %> | ||
|
|
81 | + </table> | ||
|
|
82 | + | ||
|
|
83 | + <br /> | ||
|
|
84 | + | ||
|
|
85 | + <%= link_to '[New user]', :action => 'new' %> | ||
|
|
86 | + <%= link_to '[New list of users]', :action => 'new_list' %> |
@@ -0,0 +1,8 | |||||
|
|
1 | + <h1>New user</h1> | ||
|
|
2 | + | ||
|
|
3 | + <%= form_tag :action => 'create' do %> | ||
|
|
4 | + <%= render :partial => 'form' %> | ||
|
|
5 | + <%= submit_tag "Create" %> | ||
|
|
6 | + <% end %> | ||
|
|
7 | + | ||
|
|
8 | + <%= link_to 'Back', :action => 'list' %> |
@@ -0,0 +1,8 | |||||
|
|
1 | + <h1>Adding list of users</h1> | ||
|
|
2 | + | ||
|
|
3 | + <%= form_tag :action => 'create_from_list' do %> | ||
|
|
4 | + <%= submit_tag 'create users' %><br/> | ||
|
|
5 | + List of user information in this format: <tt>user_id,name(,passwd(,alias))</tt><br/> | ||
|
|
6 | + Note that <tt>passwd</tt> and <tt>alias</tt> is optional.<br/> | ||
|
|
7 | + <%= text_area_tag 'user_list', nil, :rows => 50, :cols => 80 %> | ||
|
|
8 | + <% end %> |
@@ -0,0 +1,10 | |||||
|
|
1 | + <h1>User information</h1> | ||
|
|
2 | + | ||
|
|
3 | + <% for column in User.content_columns %> | ||
|
|
4 | + <p> | ||
|
|
5 | + <b><%= column.human_name %>:</b> <%=h @user.send(column.name) %> | ||
|
|
6 | + </p> | ||
|
|
7 | + <% end %> | ||
|
|
8 | + | ||
|
|
9 | + <%= link_to 'Edit', :action => 'edit', :id => @user %> | | ||
|
|
10 | + <%= link_to 'Back', :action => 'list' %> |
@@ -0,0 +1,43 | |||||
|
|
1 | + <h1>User grading results</h1> | ||
|
|
2 | + | ||
|
|
3 | + <table class="info"> | ||
|
|
4 | + <tr class="info-head"> | ||
|
|
5 | + <th>User</th> | ||
|
|
6 | + <th>Name</th> | ||
|
|
7 | + <th>Activated?</th> | ||
|
|
8 | + <th>Logged in</th> | ||
|
|
9 | + <th>Contest(s)</th> | ||
|
|
10 | + <% @problems.each do |p| %> | ||
|
|
11 | + <th><%= p.name %></th> | ||
|
|
12 | + <% end %> | ||
|
|
13 | + <th>Total</th> | ||
|
|
14 | + <th>Passed</th> | ||
|
|
15 | + </tr> | ||
|
|
16 | + <% counter = 0 %> | ||
|
|
17 | + <% @scorearray.each do |sc| %> | ||
|
|
18 | + <tr class="<%= (counter %2 ==0) ? "info-even" : "info-odd" %>"> | ||
|
|
19 | + <% total = 0 %> | ||
|
|
20 | + <% num_passed = 0 %> | ||
|
|
21 | + <% sc.each_index do |i| %> | ||
|
|
22 | + <% if i==0 %> | ||
|
|
23 | + <td><%= sc[i].login %></td> | ||
|
|
24 | + <td><%= sc[i].full_name %></td> | ||
|
|
25 | + <td><%= sc[i].activated %></td> | ||
|
|
26 | + <td> | ||
|
|
27 | + <%= sc[i].try(:contest_stat).try(:started_at)!=nil ? 'yes' : 'no' %> | ||
|
|
28 | + </td> | ||
|
|
29 | + <td> | ||
|
|
30 | + <%= sc[i].contests.collect {|c| c.name}.join(', ') %> | ||
|
|
31 | + </td> | ||
|
|
32 | + <% else %> | ||
|
|
33 | + <td><%= sc[i][0] %></td> | ||
|
|
34 | + <% total += sc[i][0] %> | ||
|
|
35 | + <% num_passed += 1 if sc[i][1] %> | ||
|
|
36 | + <% end %> | ||
|
|
37 | + <% end %> | ||
|
|
38 | + <td><%= total %></td> | ||
|
|
39 | + <td><%= num_passed %></td> | ||
|
|
40 | + </tr> | ||
|
|
41 | + <% counter += 1 %> | ||
|
|
42 | + <% end %> | ||
|
|
43 | + </table> |
@@ -0,0 +1,5 | |||||
|
|
1 | + class RenameConfigurationsToGraderConfigurations < ActiveRecord::Migration | ||
|
|
2 | + def change | ||
|
|
3 | + rename_table 'configurations', 'grader_configurations' | ||
|
|
4 | + end | ||
|
|
5 | + end |
@@ -41,6 +41,7 | |||||
|
41 | gem "rdiscount", :require => "rdiscount" |
|
41 | gem "rdiscount", :require => "rdiscount" |
|
42 | gem "test-unit" |
|
42 | gem "test-unit" |
|
43 | gem 'will_paginate', '~> 3.0.0' |
|
43 | gem 'will_paginate', '~> 3.0.0' |
|
|
44 | + gem 'dynamic_form' | ||
|
44 |
|
45 | ||
|
45 | group :test, :development do |
|
46 | group :test, :development do |
|
46 | gem "rspec-rails", "~> 2.0" |
|
47 | gem "rspec-rails", "~> 2.0" |
@@ -38,6 +38,7 | |||||
|
38 | execjs |
|
38 | execjs |
|
39 | coffee-script-source (1.3.3) |
|
39 | coffee-script-source (1.3.3) |
|
40 | diff-lcs (1.1.3) |
|
40 | diff-lcs (1.1.3) |
|
|
41 | + dynamic_form (1.1.4) | ||
|
41 | erubis (2.7.0) |
|
42 | erubis (2.7.0) |
|
42 | execjs (1.4.0) |
|
43 | execjs (1.4.0) |
|
43 | multi_json (~> 1.0) |
|
44 | multi_json (~> 1.0) |
@@ -122,6 +123,7 | |||||
|
122 |
|
123 | ||
|
123 | DEPENDENCIES |
|
124 | DEPENDENCIES |
|
124 | coffee-rails (~> 3.2.1) |
|
125 | coffee-rails (~> 3.2.1) |
|
|
126 | + dynamic_form | ||
|
125 | haml |
|
127 | haml |
|
126 | mysql2 |
|
128 | mysql2 |
|
127 | prototype-rails |
|
129 | prototype-rails |
@@ -28,7 +28,7 | |||||
|
28 | end |
|
28 | end |
|
29 |
|
29 | ||
|
30 | # check if run in single user mode |
|
30 | # check if run in single user mode |
|
31 | - if Configuration[SINGLE_USER_MODE_CONF_KEY] |
|
31 | + if GraderConfiguration[SINGLE_USER_MODE_CONF_KEY] |
|
32 | user = User.find(session[:user_id]) |
|
32 | user = User.find(session[:user_id]) |
|
33 | if user==nil or (not user.admin?) |
|
33 | if user==nil or (not user.admin?) |
|
34 | flash[:notice] = 'You cannot log in at this time' |
|
34 | flash[:notice] = 'You cannot log in at this time' |
@@ -38,7 +38,7 | |||||
|
38 | return true |
|
38 | return true |
|
39 | end |
|
39 | end |
|
40 |
|
40 | ||
|
41 | - if Configuration.multicontests? |
|
41 | + if GraderConfiguration.multicontests? |
|
42 | user = User.find(session[:user_id]) |
|
42 | user = User.find(session[:user_id]) |
|
43 | return true if user.admin? |
|
43 | return true if user.admin? |
|
44 | begin |
|
44 | begin |
@@ -8,12 +8,12 | |||||
|
8 | in_place_edit_for :configuration, :value |
|
8 | in_place_edit_for :configuration, :value |
|
9 |
|
9 | ||
|
10 | def index |
|
10 | def index |
|
11 | - @configurations = Configuration.find(:all, |
|
11 | + @configurations = GraderConfiguration.find(:all, |
|
12 | :order => '`key`') |
|
12 | :order => '`key`') |
|
13 | end |
|
13 | end |
|
14 |
|
14 | ||
|
15 | def reload |
|
15 | def reload |
|
16 | - Configuration.reload |
|
16 | + GraderConfiguration.reload |
|
17 | redirect_to :action => 'index' |
|
17 | redirect_to :action => 'index' |
|
18 | end |
|
18 | end |
|
19 |
|
19 |
@@ -7,7 +7,7 | |||||
|
7 | end |
|
7 | end |
|
8 |
|
8 | ||
|
9 | def user_stat |
|
9 | def user_stat |
|
10 | - if not Configuration.indv_contest_mode? |
|
10 | + if not GraderConfiguration.indv_contest_mode? |
|
11 | redirect_to :action => 'index' and return |
|
11 | redirect_to :action => 'index' and return |
|
12 | end |
|
12 | end |
|
13 |
|
13 | ||
@@ -27,7 +27,7 | |||||
|
27 | end |
|
27 | end |
|
28 |
|
28 | ||
|
29 | def clear_all_stat |
|
29 | def clear_all_stat |
|
30 | - if not Configuration.indv_contest_mode? |
|
30 | + if not GraderConfiguration.indv_contest_mode? |
|
31 | redirect_to :action => 'index' and return |
|
31 | redirect_to :action => 'index' and return |
|
32 | end |
|
32 | end |
|
33 |
|
33 | ||
@@ -38,7 +38,7 | |||||
|
38 |
|
38 | ||
|
39 | def change_contest_mode |
|
39 | def change_contest_mode |
|
40 | if ['standard', 'contest', 'indv-contest'].include? params[:id] |
|
40 | if ['standard', 'contest', 'indv-contest'].include? params[:id] |
|
41 | - config = Configuration.find_by_key('system.mode') |
|
41 | + config = GraderConfiguration.find_by_key('system.mode') |
|
42 | config.value = params[:id] |
|
42 | config.value = params[:id] |
|
43 | config.save |
|
43 | config.save |
|
44 | else |
|
44 | else |
@@ -12,7 +12,7 | |||||
|
12 | session[:admin] = user.admin? |
|
12 | session[:admin] = user.admin? |
|
13 |
|
13 | ||
|
14 | # clear forced logout flag for multicontests contest change |
|
14 | # clear forced logout flag for multicontests contest change |
|
15 | - if Configuration.multicontests? |
|
15 | + if GraderConfiguration.multicontests? |
|
16 | contest_stat = user.contest_stat |
|
16 | contest_stat = user.contest_stat |
|
17 | if contest_stat.respond_to? :forced_logout |
|
17 | if contest_stat.respond_to? :forced_logout |
|
18 | if contest_stat.forced_logout |
|
18 | if contest_stat.forced_logout |
@@ -38,7 +38,7 | |||||
|
38 | # explicitly specify /login |
|
38 | # explicitly specify /login |
|
39 | # |
|
39 | # |
|
40 | # logger.info "PATH: #{request.path}" |
|
40 | # logger.info "PATH: #{request.path}" |
|
41 | - # if Configuration['system.single_user_mode'] and |
|
41 | + # if GraderConfiguration['system.single_user_mode'] and |
|
42 | # request.path!='/main/login' |
|
42 | # request.path!='/main/login' |
|
43 | # @hidelogin = true |
|
43 | # @hidelogin = true |
|
44 | # end |
|
44 | # end |
@@ -67,7 +67,7 | |||||
|
67 | end |
|
67 | end |
|
68 | @submission.submitted_at = Time.new.gmtime |
|
68 | @submission.submitted_at = Time.new.gmtime |
|
69 |
|
69 | ||
|
70 | - if Configuration.time_limit_mode? and user.contest_finished? |
|
70 | + if GraderConfiguration.time_limit_mode? and user.contest_finished? |
|
71 | @submission.errors.add_to_base "The contest is over." |
|
71 | @submission.errors.add_to_base "The contest is over." |
|
72 | prepare_list_information |
|
72 | prepare_list_information |
|
73 | render :action => 'list' and return |
|
73 | render :action => 'list' and return |
@@ -129,7 +129,7 | |||||
|
129 | end |
|
129 | end |
|
130 |
|
130 | ||
|
131 | def result |
|
131 | def result |
|
132 | - if !Configuration.show_grading_result |
|
132 | + if !GraderConfiguration.show_grading_result |
|
133 | redirect_to :action => 'list' and return |
|
133 | redirect_to :action => 'list' and return |
|
134 | end |
|
134 | end |
|
135 | @user = User.find(session[:user_id]) |
|
135 | @user = User.find(session[:user_id]) |
@@ -142,7 +142,7 | |||||
|
142 | end |
|
142 | end |
|
143 |
|
143 | ||
|
144 | def load_output |
|
144 | def load_output |
|
145 | - if !Configuration.show_grading_result or params[:num]==nil |
|
145 | + if !GraderConfiguration.show_grading_result or params[:num]==nil |
|
146 | redirect_to :action => 'list' and return |
|
146 | redirect_to :action => 'list' and return |
|
147 | end |
|
147 | end |
|
148 | @user = User.find(session[:user_id]) |
|
148 | @user = User.find(session[:user_id]) |
@@ -203,7 +203,7 | |||||
|
203 | protected |
|
203 | protected |
|
204 |
|
204 | ||
|
205 | def prepare_announcements(recent=nil) |
|
205 | def prepare_announcements(recent=nil) |
|
206 | - if Configuration.show_tasks_to?(@user) |
|
206 | + if GraderConfiguration.show_tasks_to?(@user) |
|
207 | @announcements = Announcement.find_published(true) |
|
207 | @announcements = Announcement.find_published(true) |
|
208 | else |
|
208 | else |
|
209 | @announcements = Announcement.find_published |
|
209 | @announcements = Announcement.find_published |
@@ -216,7 +216,7 | |||||
|
216 |
|
216 | ||
|
217 | def prepare_list_information |
|
217 | def prepare_list_information |
|
218 | @user = User.find(session[:user_id]) |
|
218 | @user = User.find(session[:user_id]) |
|
219 | - if not Configuration.multicontests? |
|
219 | + if not GraderConfiguration.multicontests? |
|
220 | @problems = @user.available_problems |
|
220 | @problems = @user.available_problems |
|
221 | else |
|
221 | else |
|
222 | @contest_problems = @user.available_problems_group_by_contests |
|
222 | @contest_problems = @user.available_problems_group_by_contests |
@@ -236,15 +236,15 | |||||
|
236 |
|
236 | ||
|
237 | def check_viewability |
|
237 | def check_viewability |
|
238 | @user = User.find(session[:user_id]) |
|
238 | @user = User.find(session[:user_id]) |
|
239 | - if (!Configuration.show_tasks_to?(@user)) and |
|
239 | + if (!GraderConfiguration.show_tasks_to?(@user)) and |
|
240 | ((action_name=='submission') or (action_name=='submit')) |
|
240 | ((action_name=='submission') or (action_name=='submit')) |
|
241 | redirect_to :action => 'list' and return |
|
241 | redirect_to :action => 'list' and return |
|
242 | end |
|
242 | end |
|
243 | end |
|
243 | end |
|
244 |
|
244 | ||
|
245 | def prepare_grading_result(submission) |
|
245 | def prepare_grading_result(submission) |
|
246 | - if Configuration.task_grading_info.has_key? submission.problem.name |
|
246 | + if GraderConfiguration.task_grading_info.has_key? submission.problem.name |
|
247 | - grading_info = Configuration.task_grading_info[submission.problem.name] |
|
247 | + grading_info = GraderConfiguration.task_grading_info[submission.problem.name] |
|
248 | else |
|
248 | else |
|
249 | # guess task info from problem.full_score |
|
249 | # guess task info from problem.full_score |
|
250 | cases = submission.problem.full_score / 10 |
|
250 | cases = submission.problem.full_score / 10 |
@@ -353,12 +353,12 | |||||
|
353 |
|
353 | ||
|
354 | def confirm_and_update_start_time |
|
354 | def confirm_and_update_start_time |
|
355 | user = User.find(session[:user_id]) |
|
355 | user = User.find(session[:user_id]) |
|
356 | - if (Configuration.indv_contest_mode? and |
|
356 | + if (GraderConfiguration.indv_contest_mode? and |
|
357 | - Configuration['contest.confirm_indv_contest_start'] and |
|
357 | + GraderConfiguration['contest.confirm_indv_contest_start'] and |
|
358 | !user.contest_started?) |
|
358 | !user.contest_started?) |
|
359 | redirect_to :action => 'confirm_contest_start' and return |
|
359 | redirect_to :action => 'confirm_contest_start' and return |
|
360 | end |
|
360 | end |
|
361 | - if not Configuration.analysis_mode? |
|
361 | + if not GraderConfiguration.analysis_mode? |
|
362 | user.update_start_time |
|
362 | user.update_start_time |
|
363 | end |
|
363 | end |
|
364 | end |
|
364 | end |
@@ -368,7 +368,7 | |||||
|
368 | render :text => 'Access forbidden', :status => 403 |
|
368 | render :text => 'Access forbidden', :status => 403 |
|
369 | end |
|
369 | end |
|
370 |
|
370 | ||
|
371 | - if Configuration.multicontests? |
|
371 | + if GraderConfiguration.multicontests? |
|
372 | user = User.find(session[:user_id]) |
|
372 | user = User.find(session[:user_id]) |
|
373 | if user.contest_stat.forced_logout |
|
373 | if user.contest_stat.forced_logout |
|
374 | render :text => 'Access forbidden', :status => 403 |
|
374 | render :text => 'Access forbidden', :status => 403 |
@@ -19,7 +19,7 | |||||
|
19 | end |
|
19 | end |
|
20 | end |
|
20 | end |
|
21 |
|
21 | ||
|
22 | - @default_site = Site.first if !Configuration['contest.multisites'] |
|
22 | + @default_site = Site.first if !GraderConfiguration['contest.multisites'] |
|
23 |
|
23 | ||
|
24 | render :action => 'login', :layout => 'empty' |
|
24 | render :action => 'login', :layout => 'empty' |
|
25 | end |
|
25 | end |
@@ -66,7 +66,7 | |||||
|
66 |
|
66 | ||
|
67 | def check_viewability |
|
67 | def check_viewability |
|
68 | @user = User.find(session[:user_id]) |
|
68 | @user = User.find(session[:user_id]) |
|
69 | - if @user==nil or !Configuration.show_tasks_to?(@user) |
|
69 | + if @user==nil or !GraderConfiguration.show_tasks_to?(@user) |
|
70 | redirect_to :controller => 'main', :action => 'list' |
|
70 | redirect_to :controller => 'main', :action => 'list' |
|
71 | return false |
|
71 | return false |
|
72 | end |
|
72 | end |
@@ -24,14 +24,14 | |||||
|
24 | render :action => 'index' and return |
|
24 | render :action => 'index' and return |
|
25 | end |
|
25 | end |
|
26 |
|
26 | ||
|
27 | - if Configuration.time_limit_mode? |
|
27 | + if GraderConfiguration.time_limit_mode? |
|
28 | if @user.contest_finished? |
|
28 | if @user.contest_finished? |
|
29 | @submitted_test_request.errors.add_to_base('Contest is over.') |
|
29 | @submitted_test_request.errors.add_to_base('Contest is over.') |
|
30 | prepare_index_information |
|
30 | prepare_index_information |
|
31 | render :action => 'index' and return |
|
31 | render :action => 'index' and return |
|
32 | end |
|
32 | end |
|
33 |
|
33 | ||
|
34 | - if !Configuration.allow_test_request(@user) |
|
34 | + if !GraderConfiguration.allow_test_request(@user) |
|
35 | prepare_index_information |
|
35 | prepare_index_information |
|
36 | flash[:notice] = 'Test request is not allowed during the last 30 minutes' |
|
36 | flash[:notice] = 'Test request is not allowed during the last 30 minutes' |
|
37 | redirect_to :action => 'index' and return |
|
37 | redirect_to :action => 'index' and return |
@@ -107,10 +107,10 | |||||
|
107 |
|
107 | ||
|
108 | def check_viewability |
|
108 | def check_viewability |
|
109 | user = User.find(session[:user_id]) |
|
109 | user = User.find(session[:user_id]) |
|
110 | - if !Configuration.show_tasks_to?(user) |
|
110 | + if !GraderConfiguration.show_tasks_to?(user) |
|
111 | redirect_to :controller => 'main', :action => 'list' |
|
111 | redirect_to :controller => 'main', :action => 'list' |
|
112 | end |
|
112 | end |
|
113 | - if (!Configuration.show_submitbox_to?(user)) and (action_name=='submit') |
|
113 | + if (!GraderConfiguration.show_submitbox_to?(user)) and (action_name=='submit') |
|
114 | redirect_to :controller => 'test', :action => 'index' |
|
114 | redirect_to :controller => 'test', :action => 'index' |
|
115 | end |
|
115 | end |
|
116 | end |
|
116 | end |
@@ -1,14 +1,9 | |||||
|
1 | class UserAdminController < ApplicationController |
|
1 | class UserAdminController < ApplicationController |
|
2 |
|
2 | ||
|
3 | - include MailHelperMethods |
|
3 | + #include MailHelperMethods |
|
4 |
|
4 | ||
|
5 | before_filter :admin_authorization |
|
5 | before_filter :admin_authorization |
|
6 |
|
6 | ||
|
7 | - def index |
|
||
|
8 | - list |
|
||
|
9 | - render :action => 'list' |
|
||
|
10 | - end |
|
||
|
11 | - |
|
||
|
12 | # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html) |
|
7 | # GETs should be safe (see http://www.w3.org/2001/tag/doc/whenToUseGet.html) |
|
13 | verify :method => :post, :only => [ :destroy, |
|
8 | verify :method => :post, :only => [ :destroy, |
|
14 | :create, :create_from_list, |
|
9 | :create, :create_from_list, |
@@ -18,6 +13,11 | |||||
|
18 | ], |
|
13 | ], |
|
19 | :redirect_to => { :action => :list } |
|
14 | :redirect_to => { :action => :list } |
|
20 |
|
15 | ||
|
|
16 | + def index | ||
|
|
17 | + list | ||
|
|
18 | + render :action => 'list' | ||
|
|
19 | + end | ||
|
|
20 | + | ||
|
21 | def list |
|
21 | def list |
|
22 | @user_count = User.count |
|
22 | @user_count = User.count |
|
23 | if params[:page] == 'all' |
|
23 | if params[:page] == 'all' |
@@ -424,7 +424,7 | |||||
|
424 | end |
|
424 | end |
|
425 |
|
425 | ||
|
426 | def send_contest_update_notification_email(user, contest) |
|
426 | def send_contest_update_notification_email(user, contest) |
|
427 | - contest_title_name = Configuration['contest.name'] |
|
427 | + contest_title_name = GraderConfiguration['contest.name'] |
|
428 | contest_name = contest.name |
|
428 | contest_name = contest.name |
|
429 | subject = t('contest.notification.email_subject', { |
|
429 | subject = t('contest.notification.email_subject', { |
|
430 | :contest_title_name => contest_title_name, |
|
430 | :contest_title_name => contest_title_name, |
@@ -3,7 +3,7 | |||||
|
3 |
|
3 | ||
|
4 | class UsersController < ApplicationController |
|
4 | class UsersController < ApplicationController |
|
5 |
|
5 | ||
|
6 | - include MailHelperMethods |
|
6 | + #include MailHelperMethods |
|
7 |
|
7 | ||
|
8 | before_filter :authenticate, :except => [:new, |
|
8 | before_filter :authenticate, :except => [:new, |
|
9 | :register, |
|
9 | :register, |
@@ -23,7 +23,7 | |||||
|
23 | #in_place_edit_for :user, :email_for_editing |
|
23 | #in_place_edit_for :user, :email_for_editing |
|
24 |
|
24 | ||
|
25 | def index |
|
25 | def index |
|
26 | - if !Configuration['system.user_setting_enabled'] |
|
26 | + if !GraderConfiguration['system.user_setting_enabled'] |
|
27 | redirect_to :controller => 'main', :action => 'list' |
|
27 | redirect_to :controller => 'main', :action => 'list' |
|
28 | else |
|
28 | else |
|
29 | @user = User.find(session[:user_id]) |
|
29 | @user = User.find(session[:user_id]) |
@@ -59,7 +59,7 | |||||
|
59 | if send_confirmation_email(@user) |
|
59 | if send_confirmation_email(@user) |
|
60 | render :action => 'new_splash', :layout => 'empty' |
|
60 | render :action => 'new_splash', :layout => 'empty' |
|
61 | else |
|
61 | else |
|
62 | - @admin_email = Configuration['system.admin_email'] |
|
62 | + @admin_email = GraderConfiguration['system.admin_email'] |
|
63 | render :action => 'email_error', :layout => 'empty' |
|
63 | render :action => 'email_error', :layout => 'empty' |
|
64 | end |
|
64 | end |
|
65 | else |
|
65 | else |
@@ -112,14 +112,14 | |||||
|
112 | protected |
|
112 | protected |
|
113 |
|
113 | ||
|
114 | def verify_online_registration |
|
114 | def verify_online_registration |
|
115 | - if !Configuration['system.online_registration'] |
|
115 | + if !GraderConfiguration['system.online_registration'] |
|
116 | redirect_to :controller => 'main', :action => 'login' |
|
116 | redirect_to :controller => 'main', :action => 'login' |
|
117 | end |
|
117 | end |
|
118 | end |
|
118 | end |
|
119 |
|
119 | ||
|
120 | def send_confirmation_email(user) |
|
120 | def send_confirmation_email(user) |
|
121 | - contest_name = Configuration['contest.name'] |
|
121 | + contest_name = GraderConfiguration['contest.name'] |
|
122 | - admin_email = Configuration['system.admin_email'] |
|
122 | + admin_email = GraderConfiguration['system.admin_email'] |
|
123 | activation_url = url_for(:action => 'confirm', |
|
123 | activation_url = url_for(:action => 'confirm', |
|
124 | :login => user.login, |
|
124 | :login => user.login, |
|
125 | :activation => user.activation_key) |
|
125 | :activation => user.activation_key) |
@@ -140,8 +140,8 | |||||
|
140 | end |
|
140 | end |
|
141 |
|
141 | ||
|
142 | def send_new_password_email(user) |
|
142 | def send_new_password_email(user) |
|
143 | - contest_name = Configuration['contest.name'] |
|
143 | + contest_name = GraderConfiguration['contest.name'] |
|
144 | - admin_email = Configuration['system.admin_email'] |
|
144 | + admin_email = GraderConfiguration['system.admin_email'] |
|
145 | subject = "[#{contest_name}] Password recovery" |
|
145 | subject = "[#{contest_name}] Password recovery" |
|
146 | body = t('registration.password_retrieval.email_body', { |
|
146 | body = t('registration.password_retrieval.email_body', { |
|
147 | :full_name => user.full_name, |
|
147 | :full_name => user.full_name, |
@@ -24,19 +24,19 | |||||
|
24 | append_to menu_items, "[#{I18n.t 'menu.main'}]", 'main', 'list' |
|
24 | append_to menu_items, "[#{I18n.t 'menu.main'}]", 'main', 'list' |
|
25 | append_to menu_items, "[#{I18n.t 'menu.messages'}]", 'messages', 'list' |
|
25 | append_to menu_items, "[#{I18n.t 'menu.messages'}]", 'messages', 'list' |
|
26 |
|
26 | ||
|
27 | - if (user!=nil) and (Configuration.show_tasks_to?(user)) |
|
27 | + if (user!=nil) and (GraderConfiguration.show_tasks_to?(user)) |
|
28 | append_to menu_items, "[#{I18n.t 'menu.tasks'}]", 'tasks', 'list' |
|
28 | append_to menu_items, "[#{I18n.t 'menu.tasks'}]", 'tasks', 'list' |
|
29 | append_to menu_items, "[#{I18n.t 'menu.submissions'}]", 'main', 'submission' |
|
29 | append_to menu_items, "[#{I18n.t 'menu.submissions'}]", 'main', 'submission' |
|
30 | append_to menu_items, "[#{I18n.t 'menu.test'}]", 'test', 'index' |
|
30 | append_to menu_items, "[#{I18n.t 'menu.test'}]", 'test', 'index' |
|
31 | end |
|
31 | end |
|
32 | append_to menu_items, "[#{I18n.t 'menu.help'}]", 'main', 'help' |
|
32 | append_to menu_items, "[#{I18n.t 'menu.help'}]", 'main', 'help' |
|
33 |
|
33 | ||
|
34 | - if Configuration['system.user_setting_enabled'] |
|
34 | + if GraderConfiguration['system.user_setting_enabled'] |
|
35 | append_to menu_items, "[#{I18n.t 'menu.settings'}]", 'users', 'index' |
|
35 | append_to menu_items, "[#{I18n.t 'menu.settings'}]", 'users', 'index' |
|
36 | end |
|
36 | end |
|
37 | append_to menu_items, "[#{I18n.t 'menu.log_out'}]", 'main', 'login' |
|
37 | append_to menu_items, "[#{I18n.t 'menu.log_out'}]", 'main', 'login' |
|
38 |
|
38 | ||
|
39 | - menu_items |
|
39 | + menu_items.html_safe |
|
40 | end |
|
40 | end |
|
41 |
|
41 | ||
|
42 | def append_to(option,label, controller, action) |
|
42 | def append_to(option,label, controller, action) |
@@ -76,7 +76,7 | |||||
|
76 |
|
76 | ||
|
77 | # |
|
77 | # |
|
78 | # if the contest is over |
|
78 | # if the contest is over |
|
79 | - if Configuration.time_limit_mode? |
|
79 | + if GraderConfiguration.time_limit_mode? |
|
80 | if user.contest_finished? |
|
80 | if user.contest_finished? |
|
81 | header = <<CONTEST_OVER |
|
81 | header = <<CONTEST_OVER |
|
82 | <tr><td colspan="2" align="center"> |
|
82 | <tr><td colspan="2" align="center"> |
@@ -94,7 +94,7 | |||||
|
94 |
|
94 | ||
|
95 | # |
|
95 | # |
|
96 | # if the contest is in the anaysis mode |
|
96 | # if the contest is in the anaysis mode |
|
97 | - if Configuration.analysis_mode? |
|
97 | + if GraderConfiguration.analysis_mode? |
|
98 | header = <<ANALYSISMODE |
|
98 | header = <<ANALYSISMODE |
|
99 | <tr><td colspan="2" align="center"> |
|
99 | <tr><td colspan="2" align="center"> |
|
100 | <span class="contest-over-msg">ANALYSIS MODE</span> |
|
100 | <span class="contest-over-msg">ANALYSIS MODE</span> |
@@ -102,11 +102,11 | |||||
|
102 | ANALYSISMODE |
|
102 | ANALYSISMODE |
|
103 | end |
|
103 | end |
|
104 |
|
104 | ||
|
105 | - contest_name = Configuration['contest.name'] |
|
105 | + contest_name = GraderConfiguration['contest.name'] |
|
106 |
|
106 | ||
|
107 | # |
|
107 | # |
|
108 | # build real title bar |
|
108 | # build real title bar |
|
109 | - <<TITLEBAR |
|
109 | + result = <<TITLEBAR |
|
110 | <div class="title"> |
|
110 | <div class="title"> |
|
111 | <table> |
|
111 | <table> |
|
112 | #{header} |
|
112 | #{header} |
@@ -122,6 +122,7 | |||||
|
122 | </table> |
|
122 | </table> |
|
123 | </div> |
|
123 | </div> |
|
124 | TITLEBAR |
|
124 | TITLEBAR |
|
|
125 | + result.html_safe | ||
|
125 |
|
|
126 | end |
|
126 |
|
127 | ||
|
127 | end |
|
128 | end |
@@ -10,7 +10,7 | |||||
|
10 | end |
|
10 | end |
|
11 |
|
11 | ||
|
12 | def time_left |
|
12 | def time_left |
|
13 | - contest_time = Configuration.contest_time_limit |
|
13 | + contest_time = GraderConfiguration.contest_time_limit |
|
14 |
|
14 | ||
|
15 | return nil if contest_time == nil |
|
15 | return nil if contest_time == nil |
|
16 |
|
16 | ||
@@ -35,7 +35,7 | |||||
|
35 | return false |
|
35 | return false |
|
36 | end |
|
36 | end |
|
37 |
|
37 | ||
|
38 | - contest_time = Configuration.contest_time_limit |
|
38 | + contest_time = GraderConfiguration.contest_time_limit |
|
39 | if contest_time!=nil |
|
39 | if contest_time!=nil |
|
40 | return Time.now.gmtime > (self.start_time + contest_time) |
|
40 | return Time.now.gmtime > (self.start_time + contest_time) |
|
41 | else |
|
41 | else |
@@ -136,11 +136,11 | |||||
|
136 |
|
136 | ||
|
137 |
|
137 | ||
|
138 | def contest_time_left |
|
138 | def contest_time_left |
|
139 | - if Configuration.contest_mode? |
|
139 | + if GraderConfiguration.contest_mode? |
|
140 | return nil if site==nil |
|
140 | return nil if site==nil |
|
141 | return site.time_left |
|
141 | return site.time_left |
|
142 | - elsif Configuration.indv_contest_mode? |
|
142 | + elsif GraderConfiguration.indv_contest_mode? |
|
143 | - time_limit = Configuration.contest_time_limit |
|
143 | + time_limit = GraderConfiguration.contest_time_limit |
|
144 | if time_limit == nil |
|
144 | if time_limit == nil |
|
145 | return nil |
|
145 | return nil |
|
146 | end |
|
146 | end |
@@ -161,10 +161,10 | |||||
|
161 | end |
|
161 | end |
|
162 |
|
162 | ||
|
163 | def contest_finished? |
|
163 | def contest_finished? |
|
164 | - if Configuration.contest_mode? |
|
164 | + if GraderConfiguration.contest_mode? |
|
165 | return false if site==nil |
|
165 | return false if site==nil |
|
166 | return site.finished? |
|
166 | return site.finished? |
|
167 | - elsif Configuration.indv_contest_mode? |
|
167 | + elsif GraderConfiguration.indv_contest_mode? |
|
168 | return false if self.contest_stat(true)==nil |
|
168 | return false if self.contest_stat(true)==nil |
|
169 | return contest_time_left == 0 |
|
169 | return contest_time_left == 0 |
|
170 | else |
|
170 | else |
@@ -173,10 +173,10 | |||||
|
173 | end |
|
173 | end |
|
174 |
|
174 | ||
|
175 | def contest_started? |
|
175 | def contest_started? |
|
176 | - if Configuration.indv_contest_mode? |
|
176 | + if GraderConfiguration.indv_contest_mode? |
|
177 | stat = self.contest_stat |
|
177 | stat = self.contest_stat |
|
178 | return ((stat != nil) and (stat.started_at != nil)) |
|
178 | return ((stat != nil) and (stat.started_at != nil)) |
|
179 | - elsif Configuration.contest_mode? |
|
179 | + elsif GraderConfiguration.contest_mode? |
|
180 | return true if site==nil |
|
180 | return true if site==nil |
|
181 | return site.started |
|
181 | return site.started |
|
182 | else |
|
182 | else |
@@ -228,7 +228,7 | |||||
|
228 | end |
|
228 | end |
|
229 |
|
229 | ||
|
230 | def available_problems |
|
230 | def available_problems |
|
231 | - if not Configuration.multicontests? |
|
231 | + if not GraderConfiguration.multicontests? |
|
232 | return Problem.find_available_problems |
|
232 | return Problem.find_available_problems |
|
233 | else |
|
233 | else |
|
234 | contest_problems = [] |
|
234 | contest_problems = [] |
@@ -247,7 +247,7 | |||||
|
247 | end |
|
247 | end |
|
248 |
|
248 | ||
|
249 | def can_view_problem?(problem) |
|
249 | def can_view_problem?(problem) |
|
250 | - if not Configuration.multicontests? |
|
250 | + if not GraderConfiguration.multicontests? |
|
251 | return problem.available |
|
251 | return problem.available |
|
252 | else |
|
252 | else |
|
253 | return problem_in_user_contests? problem |
|
253 | return problem_in_user_contests? problem |
@@ -278,7 +278,7 | |||||
|
278 | # have to catch error when migrating (because self.site is not available). |
|
278 | # have to catch error when migrating (because self.site is not available). |
|
279 | begin |
|
279 | begin |
|
280 | if self.contests.length == 0 |
|
280 | if self.contests.length == 0 |
|
281 | - default_contest = Contest.find_by_name(Configuration['contest.default_contest_name']) |
|
281 | + default_contest = Contest.find_by_name(GraderConfiguration['contest.default_contest_name']) |
|
282 | if default_contest |
|
282 | if default_contest |
|
283 | self.contests = [default_contest] |
|
283 | self.contests = [default_contest] |
|
284 | end |
|
284 | end |
@@ -20,7 +20,7 | |||||
|
20 | = in_place_editor_field :configuration, :value, {}, :rows=>1 |
|
20 | = in_place_editor_field :configuration, :value, {}, :rows=>1 |
|
21 | %td= conf.description |
|
21 | %td= conf.description |
|
22 |
|
22 | ||
|
23 | - - if Configuration.config_cached? |
|
23 | + - if GraderConfiguration.config_cached? |
|
24 | %br/ |
|
24 | %br/ |
|
25 | Your config is saved, but it does not automatically take effect. |
|
25 | Your config is saved, but it does not automatically take effect. |
|
26 | %br/ |
|
26 | %br/ |
@@ -11,9 +11,9 | |||||
|
11 |
|
11 | ||
|
12 | .infobox |
|
12 | .infobox |
|
13 | %b Web interface mode: |
|
13 | %b Web interface mode: |
|
14 | - - if (not Configuration.contest_mode?) and (not Configuration.indv_contest_mode?) |
|
14 | + - if (not GraderConfiguration.contest_mode?) and (not GraderConfiguration.indv_contest_mode?) |
|
15 | standard mode |
|
15 | standard mode |
|
16 | - - elsif Configuration.contest_mode? |
|
16 | + - elsif GraderConfiguration.contest_mode? |
|
17 | normal contest mode. |
|
17 | normal contest mode. |
|
18 | - else |
|
18 | - else |
|
19 | individual contest mode. |
|
19 | individual contest mode. |
@@ -24,7 +24,7 | |||||
|
24 | = "[#{link_to 'contest', :action => 'change_contest_mode', :id => 'contest'}]" |
|
24 | = "[#{link_to 'contest', :action => 'change_contest_mode', :id => 'contest'}]" |
|
25 | = "[#{link_to 'individual contest', :action => 'change_contest_mode', :id => 'indv-contest'}]" |
|
25 | = "[#{link_to 'individual contest', :action => 'change_contest_mode', :id => 'indv-contest'}]" |
|
26 |
|
26 | ||
|
27 | - - if Configuration.indv_contest_mode? |
|
27 | + - if GraderConfiguration.indv_contest_mode? |
|
28 | = render :partial => 'indv_contest_mode_index' |
|
28 | = render :partial => 'indv_contest_mode_index' |
|
29 |
|
29 | ||
|
30 | %br/ |
|
30 | %br/ |
@@ -1,13 +1,20 | |||||
|
1 | <!DOCTYPE html> |
|
1 | <!DOCTYPE html> |
|
2 | <html> |
|
2 | <html> |
|
3 | <head> |
|
3 | <head> |
|
4 | - <title>CafeGraderWeb</title> |
|
4 | + <title><%= GraderConfiguration['contest.name'] %></title> |
|
5 |
<%= stylesheet_link_tag |
|
5 | <%= stylesheet_link_tag "application", :media => "all" %> |
|
6 | <%= javascript_include_tag "application" %> |
|
6 | <%= javascript_include_tag "application" %> |
|
7 | <%= csrf_meta_tags %> |
|
7 | <%= csrf_meta_tags %> |
|
|
8 | + <%= yield :head %> | ||
|
8 | </head> |
|
9 | </head> |
|
9 | <body> |
|
10 | <body> |
|
10 |
|
11 | ||
|
|
12 | + <div class="userbar"> | ||
|
|
13 | + <%= user_header %> | ||
|
|
14 | + </div> | ||
|
|
15 | + | ||
|
|
16 | + <%= content_tag(:p,flash[:notice],:style => "color:green") if flash[:notice]!=nil %> | ||
|
|
17 | + | ||
|
11 | <%= yield %> |
|
18 | <%= yield %> |
|
12 |
|
19 | ||
|
13 | </body> |
|
20 | </body> |
@@ -4,7 +4,7 | |||||
|
4 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
|
4 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
|
5 | <head> |
|
5 | <head> |
|
6 | <meta http-equiv="content-type" content="text/html;charset=UTF-8" /> |
|
6 | <meta http-equiv="content-type" content="text/html;charset=UTF-8" /> |
|
7 | - <title><%= Configuration['contest.name'] %></title> |
|
7 | + <title><%= GraderConfiguration['contest.name'] %></title> |
|
8 | <%= stylesheet_link_tag 'application' %> |
|
8 | <%= stylesheet_link_tag 'application' %> |
|
9 | </head> |
|
9 | </head> |
|
10 | <body> |
|
10 | <body> |
@@ -1,4 +1,4 | |||||
|
1 | - %b= Configuration['ui.front.welcome_message'] |
|
1 | + %b= GraderConfiguration['ui.front.welcome_message'] |
|
2 | %br/ |
|
2 | %br/ |
|
3 |
|
3 | ||
|
4 | - if !@hidelogin |
|
4 | - if !@hidelogin |
@@ -25,7 +25,7 | |||||
|
25 | = submit_tag t('login.login_submit') |
|
25 | = submit_tag t('login.login_submit') |
|
26 | %br/ |
|
26 | %br/ |
|
27 |
|
27 | ||
|
28 | - - if Configuration['system.online_registration'] |
|
28 | + - if GraderConfiguration['system.online_registration'] |
|
29 | =t 'login.participation' |
|
29 | =t 'login.participation' |
|
30 | %b |
|
30 | %b |
|
31 | = "#{t 'login.please'} " |
|
31 | = "#{t 'login.please'} " |
@@ -9,7 +9,7 | |||||
|
9 | - if submission.graded_at!=nil |
|
9 | - if submission.graded_at!=nil |
|
10 | = "Graded at #{format_short_time(submission.graded_at)}." |
|
10 | = "Graded at #{format_short_time(submission.graded_at)}." |
|
11 | %br/ |
|
11 | %br/ |
|
12 | - = "Score: #{(submission.points*100/submission.problem.full_score).to_i} " if Configuration['ui.show_score'] |
|
12 | + = "Score: #{(submission.points*100/submission.problem.full_score).to_i} " if GraderConfiguration['ui.show_score'] |
|
13 | = " [" |
|
13 | = " [" |
|
14 | %tt |
|
14 | %tt |
|
15 | = submission.grader_comment |
|
15 | = submission.grader_comment |
@@ -8,14 +8,14 | |||||
|
8 | - else |
|
8 | - else |
|
9 | = t 'main.graded_at' |
|
9 | = t 'main.graded_at' |
|
10 | = "#{format_short_time(submission.graded_at.localtime)}, " |
|
10 | = "#{format_short_time(submission.graded_at.localtime)}, " |
|
11 | - - if Configuration['ui.show_score'] |
|
11 | + - if GraderConfiguration['ui.show_score'] |
|
12 | = t 'main.score' |
|
12 | = t 'main.score' |
|
13 | = "#{(submission.points*100/submission.problem.full_score).to_i} " |
|
13 | = "#{(submission.points*100/submission.problem.full_score).to_i} " |
|
14 | = " [" |
|
14 | = " [" |
|
15 | %tt |
|
15 | %tt |
|
16 | = submission.grader_comment |
|
16 | = submission.grader_comment |
|
17 | = "]" |
|
17 | = "]" |
|
18 | - - if Configuration.show_grading_result |
|
18 | + - if GraderConfiguration.show_grading_result |
|
19 | = " | " |
|
19 | = " | " |
|
20 | = link_to '[detailed result]', :action => 'result', :id => submission.id |
|
20 | = link_to '[detailed result]', :action => 'result', :id => submission.id |
|
21 | = " | " |
|
21 | = " | " |
@@ -2,13 +2,13 | |||||
|
2 |
|
2 | ||
|
3 | .announcementbox |
|
3 | .announcementbox |
|
4 | %span{:class => 'title'} |
|
4 | %span{:class => 'title'} |
|
5 | - =t 'help.how_to_submit' |
|
5 | + =raw t 'help.how_to_submit' |
|
6 | .announcement |
|
6 | .announcement |
|
7 | %p |
|
7 | %p |
|
8 | - =t 'help.must_specify_language' |
|
8 | + =raw t 'help.must_specify_language' |
|
9 |
|
9 | ||
|
10 | %p |
|
10 | %p |
|
11 | - =t 'help.list_available_language' |
|
11 | + =raw t 'help.list_available_language' |
|
12 |
|
12 | ||
|
13 | %table{:border => '1'} |
|
13 | %table{:border => '1'} |
|
14 | %tr |
|
14 | %tr |
@@ -16,18 +16,18 | |||||
|
16 | %th{:width => '150px'} C++ |
|
16 | %th{:width => '150px'} C++ |
|
17 | %th{:width => '150px'} Pascal |
|
17 | %th{:width => '150px'} Pascal |
|
18 | %tr |
|
18 | %tr |
|
19 | - %td= "<tt>/*<br/>LANG: C<br/>*/</tt>" |
|
19 | + %td=raw "<tt>/*<br/>LANG: C<br/>*/</tt>" |
|
20 | - %td= "<tt>/*<br/>LANG: C++<br/>*/</tt>" |
|
20 | + %td=raw "<tt>/*<br/>LANG: C++<br/>*/</tt>" |
|
21 | - %td= "<tt>{<br/>LANG: Pascal<br/>}</tt>" |
|
21 | + %td=raw "<tt>{<br/>LANG: Pascal<br/>}</tt>" |
|
22 |
|
22 | ||
|
23 | %p |
|
23 | %p |
|
24 | - =t 'help.accept_only_language_specified' |
|
24 | + =raw t 'help.accept_only_language_specified' |
|
25 |
|
25 | ||
|
26 | %p |
|
26 | %p |
|
27 | - =t 'help.specifying_task' |
|
27 | + =raw t 'help.specifying_task' |
|
28 |
|
28 | ||
|
29 | %p |
|
29 | %p |
|
30 | - =t 'help.example_cpp' |
|
30 | + =raw t 'help.example_cpp' |
|
31 |
|
31 | ||
|
32 | %table{:border => '1'} |
|
32 | %table{:border => '1'} |
|
33 | %tr |
|
33 | %tr |
@@ -35,7 +35,7 | |||||
|
35 | %tt <tt>/*<br/>LANG: C++<br/>TASK: mobiles<br/>*/</tt> |
|
35 | %tt <tt>/*<br/>LANG: C++<br/>TASK: mobiles<br/>*/</tt> |
|
36 |
|
36 | ||
|
37 | %p |
|
37 | %p |
|
38 | - =t 'help.example_pas' |
|
38 | + =raw t 'help.example_pas' |
|
39 |
|
39 | ||
|
40 | %table{:border => '1'} |
|
40 | %table{:border => '1'} |
|
41 | %tr |
|
41 | %tr |
@@ -43,5 +43,5 | |||||
|
43 | %tt <tt>{<br/>LANG: Pascal<br/>TASK: mobiles<br/>}</tt> |
|
43 | %tt <tt>{<br/>LANG: Pascal<br/>TASK: mobiles<br/>}</tt> |
|
44 |
|
44 | ||
|
45 | %p |
|
45 | %p |
|
46 | - = (t('help.ask_questions_at_messages',:message_link_name => (t 'menu.messages'),:url => url_for(:controller => 'messages', :action => 'list'))) |
|
46 | + = raw(t('help.ask_questions_at_messages',:message_link_name => (t 'menu.messages'),:url => url_for(:controller => 'messages', :action => 'list'))) |
|
47 |
|
47 |
@@ -10,7 +10,7 | |||||
|
10 | #announcementbox-body |
|
10 | #announcementbox-body |
|
11 | = render :partial => 'announcement', :collection => @announcements |
|
11 | = render :partial => 'announcement', :collection => @announcements |
|
12 |
|
12 | ||
|
13 | - - if Configuration.show_submitbox_to?(@user) |
|
13 | + - if GraderConfiguration.show_submitbox_to?(@user) |
|
14 | .submitbox |
|
14 | .submitbox |
|
15 | = error_messages_for 'submission' |
|
15 | = error_messages_for 'submission' |
|
16 | = render :partial => 'submission_box' |
|
16 | = render :partial => 'submission_box' |
@@ -18,11 +18,11 | |||||
|
18 |
|
18 | ||
|
19 | %hr/ |
|
19 | %hr/ |
|
20 |
|
20 | ||
|
21 | - - if (Configuration.contest_mode?) and (@user.site!=nil) and (@user.site.started!=true) |
|
21 | + - if (GraderConfiguration.contest_mode?) and (@user.site!=nil) and (@user.site.started!=true) |
|
22 | %p=t 'main.start_soon' |
|
22 | %p=t 'main.start_soon' |
|
23 |
|
23 | ||
|
24 | - - if Configuration.show_tasks_to?(@user) |
|
24 | + - if GraderConfiguration.show_tasks_to?(@user) |
|
25 | - - if not Configuration.multicontests? |
|
25 | + - if not GraderConfiguration.multicontests? |
|
26 | %table.info |
|
26 | %table.info |
|
27 | %tr.info-head |
|
27 | %tr.info-head |
|
28 | %th |
|
28 | %th |
@@ -1,4 +1,4 | |||||
|
1 | - %h1= Configuration['ui.front.title'] |
|
1 | + %h1= GraderConfiguration['ui.front.title'] |
|
2 |
|
2 | ||
|
3 | %table |
|
3 | %table |
|
4 | %tr |
|
4 | %tr |
@@ -11,7 +11,7 | |||||
|
11 | %br/ |
|
11 | %br/ |
|
12 | = "Graded at #{format_short_time(@submission.graded_at)} " |
|
12 | = "Graded at #{format_short_time(@submission.graded_at)} " |
|
13 | %br/ |
|
13 | %br/ |
|
14 | - = "score: #{(@submission.points*100/@submission.problem.full_score).to_i} " if Configuration['ui.show_score'] |
|
14 | + = "score: #{(@submission.points*100/@submission.problem.full_score).to_i} " if GraderConfiguration['ui.show_score'] |
|
15 | = " [" |
|
15 | = " [" |
|
16 | %tt |
|
16 | %tt |
|
17 | = @submission.grader_comment |
|
17 | = @submission.grader_comment |
@@ -17,7 +17,7 | |||||
|
17 | |
|
17 | |
|
18 | = submit_tag 'Change', :name => 'change_date_added' |
|
18 | = submit_tag 'Change', :name => 'change_date_added' |
|
19 |
|
19 | ||
|
20 | - - if Configuration.multicontests? |
|
20 | + - if GraderConfiguration.multicontests? |
|
21 | %li |
|
21 | %li |
|
22 | Add to |
|
22 | Add to |
|
23 | = select("contest","id",Contest.all.collect {|c| [c.title, c.id]}) |
|
23 | = select("contest","id",Contest.all.collect {|c| [c.title, c.id]}) |
@@ -29,7 +29,7 | |||||
|
29 | %th Name |
|
29 | %th Name |
|
30 | %th Full name |
|
30 | %th Full name |
|
31 | %th Date added |
|
31 | %th Date added |
|
32 | - - if Configuration.multicontests? |
|
32 | + - if GraderConfiguration.multicontests? |
|
33 | %th Contests |
|
33 | %th Contests |
|
34 |
|
34 | ||
|
35 | - for problem in @problems |
|
35 | - for problem in @problems |
@@ -38,7 +38,7 | |||||
|
38 | %td= problem.name |
|
38 | %td= problem.name |
|
39 | %td= problem.full_name |
|
39 | %td= problem.full_name |
|
40 | %td= problem.date_added |
|
40 | %td= problem.date_added |
|
41 | - - if Configuration.multicontests? |
|
41 | + - if GraderConfiguration.multicontests? |
|
42 | %td |
|
42 | %td |
|
43 | - problem.contests.each do |contest| |
|
43 | - problem.contests.each do |contest| |
|
44 | = "(#{contest.name} [#{link_to 'x', :action => 'remove_contest', :id => problem.id, :contest_id => contest.id }])" |
|
44 | = "(#{contest.name} [#{link_to 'x', :action => 'remove_contest', :id => problem.id, :contest_id => contest.id }])" |
@@ -4,7 +4,7 | |||||
|
4 |
|
4 | ||
|
5 | <div class="test-desc"> |
|
5 | <div class="test-desc"> |
|
6 | <%=t 'test.intro' %><br/> |
|
6 | <%=t 'test.intro' %><br/> |
|
7 | - <% if Configuration['contest.test_request.early_timeout'] %> |
|
7 | + <% if GraderConfiguration['contest.test_request.early_timeout'] %> |
|
8 | <%=t 'test.disabled_at_end_announcement' %> |
|
8 | <%=t 'test.disabled_at_end_announcement' %> |
|
9 | <% end %> |
|
9 | <% end %> |
|
10 | </div> |
|
10 | </div> |
@@ -37,7 +37,7 | |||||
|
37 | } |
|
37 | } |
|
38 | </script> |
|
38 | </script> |
|
39 |
|
39 | ||
|
40 | - <% if Configuration.show_submitbox_to?(@user) and Configuration.allow_test_request(@user) %> |
|
40 | + <% if GraderConfiguration.show_submitbox_to?(@user) and GraderConfiguration.allow_test_request(@user) %> |
|
41 | <div class="submitbox"> |
|
41 | <div class="submitbox"> |
|
42 | <%= error_messages_for 'submitted_test_request' %> |
|
42 | <%= error_messages_for 'submitted_test_request' %> |
|
43 | <% form_for :test_request, nil, |
|
43 | <% form_for :test_request, nil, |
@@ -5,7 +5,7 | |||||
|
5 |
|
5 | ||
|
6 | <div class="submitbox"> |
|
6 | <div class="submitbox"> |
|
7 | <%= link_to '[View all users]', :action => 'list' %> |
|
7 | <%= link_to '[View all users]', :action => 'list' %> |
|
8 | - <% if Configuration.multicontests? %> |
|
8 | + <% if GraderConfiguration.multicontests? %> |
|
9 | <%= link_to '[Manage bulk users in contests]', :action => 'contest_management' %> |
|
9 | <%= link_to '[Manage bulk users in contests]', :action => 'contest_management' %> |
|
10 | <br/> |
|
10 | <br/> |
|
11 | View users in: |
|
11 | View users in: |
@@ -32,7 +32,7 | |||||
|
32 | <th></th> |
|
32 | <th></th> |
|
33 | <th></th> |
|
33 | <th></th> |
|
34 | <th></th> |
|
34 | <th></th> |
|
35 | - <% if Configuration.multicontests? %> |
|
35 | + <% if GraderConfiguration.multicontests? %> |
|
36 | <th>Contests</th> |
|
36 | <th>Contests</th> |
|
37 | <th>Other enabled contests</th> |
|
37 | <th>Other enabled contests</th> |
|
38 | <% end %> |
|
38 | <% end %> |
@@ -47,7 +47,7 | |||||
|
47 | <td><%= link_to 'Show', :action => 'show', :id => user %></td> |
|
47 | <td><%= link_to 'Show', :action => 'show', :id => user %></td> |
|
48 | <td><%= link_to 'Edit', :action => 'edit', :id => user %></td> |
|
48 | <td><%= link_to 'Edit', :action => 'edit', :id => user %></td> |
|
49 | <td><%= link_to 'Destroy', { :action => 'destroy', :id => user }, :confirm => 'Are you sure?', :method => :post %></td> |
|
49 | <td><%= link_to 'Destroy', { :action => 'destroy', :id => user }, :confirm => 'Are you sure?', :method => :post %></td> |
|
50 | - <% if Configuration.multicontests? %> |
|
50 | + <% if GraderConfiguration.multicontests? %> |
|
51 | <td> |
|
51 | <td> |
|
52 | <% user.contests.each do |contest| %> |
|
52 | <% user.contests.each do |contest| %> |
|
53 | <%= contest.name %> [<%= link_to 'x', :action => 'remove_from_contest', :id => user.id, :contest_id => contest.id %>] |
|
53 | <%= contest.name %> [<%= link_to 'x', :action => 'remove_from_contest', :id => user.id, :contest_id => contest.id %>] |
@@ -1,6 +1,6 | |||||
|
1 | .contest-title |
|
1 | .contest-title |
|
2 | %h1 |
|
2 | %h1 |
|
3 | - = "#{Configuration['contest.name']}: #{t 'registration.password_retrieval.header'}" |
|
3 | + = "#{GraderConfiguration['contest.name']}: #{t 'registration.password_retrieval.header'}" |
|
4 |
|
4 | ||
|
5 | - if flash[:notice] |
|
5 | - if flash[:notice] |
|
6 | %hr/ |
|
6 | %hr/ |
@@ -1,6 +1,6 | |||||
|
1 | .contest-title |
|
1 | .contest-title |
|
2 | %h1 |
|
2 | %h1 |
|
3 | - = "#{Configuration['contest.name']}: #{t 'registration.title'}" |
|
3 | + = "#{GraderConfiguration['contest.name']}: #{t 'registration.title'}" |
|
4 |
|
4 | ||
|
5 | .registration-desc |
|
5 | .registration-desc |
|
6 | =t 'registration.description' |
|
6 | =t 'registration.description' |
@@ -54,7 +54,7 | |||||
|
54 | config.active_record.whitelist_attributes = true |
|
54 | config.active_record.whitelist_attributes = true |
|
55 |
|
55 | ||
|
56 | # Enable the asset pipeline |
|
56 | # Enable the asset pipeline |
|
57 |
- config.assets.enabled = |
|
57 | + config.assets.enabled = false |
|
58 |
|
58 | ||
|
59 | # Version of your assets, change this if you want to expire all your assets |
|
59 | # Version of your assets, change this if you want to expire all your assets |
|
60 | config.assets.version = '1.0' |
|
60 | config.assets.version = '1.0' |
@@ -1,15 +1,17 | |||||
|
1 | - # This file is auto-generated from the current state of the database. Instead of editing this file, |
|
1 | + # encoding: UTF-8 |
|
2 | - # please use the migrations feature of Active Record to incrementally modify your database, and |
|
2 | + # This file is auto-generated from the current state of the database. Instead |
|
3 | - # then regenerate this schema definition. |
|
3 | + # of editing this file, please use the migrations feature of Active Record to |
|
|
4 | + # incrementally modify your database, and then regenerate this schema definition. | ||
|
4 | # |
|
5 | # |
|
5 |
- # Note that this schema.rb definition is the authoritative source for your |
|
6 | + # Note that this schema.rb definition is the authoritative source for your |
|
6 | - # to create the application database on another system, you should be using db:schema:load, not running |
|
7 | + # database schema. If you need to create the application database on another |
|
7 | - # all the migrations from scratch. The latter is a flawed and unsustainable approach (the more migrations |
|
8 | + # system, you should be using db:schema:load, not running all the migrations |
|
|
9 | + # from scratch. The latter is a flawed and unsustainable approach (the more migrations | ||
|
8 | # you'll amass, the slower it'll run and the greater likelihood for issues). |
|
10 | # you'll amass, the slower it'll run and the greater likelihood for issues). |
|
9 | # |
|
11 | # |
|
10 | # It's strongly recommended to check this file into your version control system. |
|
12 | # It's strongly recommended to check this file into your version control system. |
|
11 |
|
13 | ||
|
12 |
- ActiveRecord::Schema.define(:version => 201 |
|
14 | + ActiveRecord::Schema.define(:version => 20121001033508) do |
|
13 |
|
15 | ||
|
14 | create_table "announcements", :force => true do |t| |
|
16 | create_table "announcements", :force => true do |t| |
|
15 | t.string "author" |
|
17 | t.string "author" |
@@ -23,13 +25,12 | |||||
|
23 | t.string "notes" |
|
25 | t.string "notes" |
|
24 | end |
|
26 | end |
|
25 |
|
27 | ||
|
26 |
- create_table "co |
|
28 | + create_table "codejom_statuses", :force => true do |t| |
|
27 |
- t. |
|
29 | + t.integer "user_id" |
|
28 | - t.string "value_type" |
|
30 | + t.boolean "alive" |
|
29 | - t.string "value" |
|
31 | + t.integer "num_problems_passed" |
|
30 | t.datetime "created_at" |
|
32 | t.datetime "created_at" |
|
31 | t.datetime "updated_at" |
|
33 | t.datetime "updated_at" |
|
32 | - t.text "description" |
|
||
|
33 | end |
|
34 | end |
|
34 |
|
35 | ||
|
35 | create_table "contests", :force => true do |t| |
|
36 | create_table "contests", :force => true do |t| |
@@ -63,6 +64,15 | |||||
|
63 | t.datetime "updated_at" |
|
64 | t.datetime "updated_at" |
|
64 | end |
|
65 | end |
|
65 |
|
66 | ||
|
|
67 | + create_table "grader_configurations", :force => true do |t| | ||
|
|
68 | + t.string "key" | ||
|
|
69 | + t.string "value_type" | ||
|
|
70 | + t.string "value" | ||
|
|
71 | + t.datetime "created_at" | ||
|
|
72 | + t.datetime "updated_at" | ||
|
|
73 | + t.text "description" | ||
|
|
74 | + end | ||
|
|
75 | + | ||
|
66 | create_table "grader_processes", :force => true do |t| |
|
76 | create_table "grader_processes", :force => true do |t| |
|
67 | t.string "host", :limit => 20 |
|
77 | t.string "host", :limit => 20 |
|
68 | t.integer "pid" |
|
78 | t.integer "pid" |
@@ -104,6 +114,8 | |||||
|
104 | t.integer "description_id" |
|
114 | t.integer "description_id" |
|
105 | t.boolean "test_allowed" |
|
115 | t.boolean "test_allowed" |
|
106 | t.boolean "output_only" |
|
116 | t.boolean "output_only" |
|
|
117 | + t.integer "level", :default => 0 | ||
|
|
118 | + t.datetime "updated_at" | ||
|
107 | t.string "description_filename" |
|
119 | t.string "description_filename" |
|
108 | end |
|
120 | end |
|
109 |
|
121 | ||
@@ -150,6 +162,15 | |||||
|
150 | t.string "password" |
|
162 | t.string "password" |
|
151 | end |
|
163 | end |
|
152 |
|
164 | ||
|
|
165 | + create_table "submission_statuses", :force => true do |t| | ||
|
|
166 | + t.integer "user_id" | ||
|
|
167 | + t.integer "problem_id" | ||
|
|
168 | + t.boolean "passed" | ||
|
|
169 | + t.integer "submission_count" | ||
|
|
170 | + t.datetime "created_at" | ||
|
|
171 | + t.datetime "updated_at" | ||
|
|
172 | + end | ||
|
|
173 | + | ||
|
153 | create_table "submissions", :force => true do |t| |
|
174 | create_table "submissions", :force => true do |t| |
|
154 | t.integer "user_id" |
|
175 | t.integer "user_id" |
|
155 | t.integer "problem_id" |
|
176 | t.integer "problem_id" |
@@ -176,12 +197,24 | |||||
|
176 | t.datetime "updated_at" |
|
197 | t.datetime "updated_at" |
|
177 | end |
|
198 | end |
|
178 |
|
199 | ||
|
|
200 | + create_table "test_pair_assignments", :force => true do |t| | ||
|
|
201 | + t.integer "user_id" | ||
|
|
202 | + t.integer "problem_id" | ||
|
|
203 | + t.integer "test_pair_id" | ||
|
|
204 | + t.integer "test_pair_number" | ||
|
|
205 | + t.integer "request_number" | ||
|
|
206 | + t.datetime "created_at" | ||
|
|
207 | + t.datetime "updated_at" | ||
|
|
208 | + t.boolean "submitted" | ||
|
|
209 | + end | ||
|
|
210 | + | ||
|
179 | create_table "test_pairs", :force => true do |t| |
|
211 | create_table "test_pairs", :force => true do |t| |
|
180 | t.integer "problem_id" |
|
212 | t.integer "problem_id" |
|
181 | t.text "input", :limit => 16777215 |
|
213 | t.text "input", :limit => 16777215 |
|
182 | t.text "solution", :limit => 16777215 |
|
214 | t.text "solution", :limit => 16777215 |
|
183 | t.datetime "created_at" |
|
215 | t.datetime "created_at" |
|
184 | t.datetime "updated_at" |
|
216 | t.datetime "updated_at" |
|
|
217 | + t.integer "number" | ||
|
185 | end |
|
218 | end |
|
186 |
|
219 | ||
|
187 | create_table "test_requests", :force => true do |t| |
|
220 | create_table "test_requests", :force => true do |t| |
@@ -226,6 +259,13 | |||||
|
226 | t.boolean "activated", :default => false |
|
259 | t.boolean "activated", :default => false |
|
227 | t.datetime "created_at" |
|
260 | t.datetime "created_at" |
|
228 | t.datetime "updated_at" |
|
261 | t.datetime "updated_at" |
|
|
262 | + t.string "member1_full_name" | ||
|
|
263 | + t.string "member2_full_name" | ||
|
|
264 | + t.string "member3_full_name" | ||
|
|
265 | + t.boolean "high_school" | ||
|
|
266 | + t.string "member1_school_name" | ||
|
|
267 | + t.string "member2_school_name" | ||
|
|
268 | + t.string "member3_school_name" | ||
|
229 | end |
|
269 | end |
|
230 |
|
270 | ||
|
231 | add_index "users", ["login"], :name => "index_users_on_login", :unique => true |
|
271 | add_index "users", ["login"], :name => "index_users_on_login", :unique => true |
@@ -123,8 +123,8 | |||||
|
123 | value_type, |
|
123 | value_type, |
|
124 | default_value, |
|
124 | default_value, |
|
125 | description='') |
|
125 | description='') |
|
126 | - conf = (Configuration.find_by_key(key) || |
|
126 | + conf = (GraderConfiguration.find_by_key(key) || |
|
127 | - Configuration.new(:key => key, |
|
127 | + GraderConfiguration.new(:key => key, |
|
128 | :value_type => value_type, |
|
128 | :value_type => value_type, |
|
129 | :value => default_value)) |
|
129 | :value => default_value)) |
|
130 | conf.description = description |
|
130 | conf.description = description |
deleted file |
deleted file |
deleted file |
deleted file |
deleted file |
deleted file |
deleted file |
deleted file |
deleted file |
deleted file |
deleted file |
deleted file |
deleted file |
You need to be logged in to leave comments.
Login now