Description:
fixed form_tag/form_for, disabled attributes whitelist
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r321:6490fd9a1f54 - - 17 files changed: 23 inserted, 22 deleted
@@ -1,253 +1,254 | |||||
|
1 | class MainController < ApplicationController |
|
1 | class MainController < ApplicationController |
|
2 |
|
2 | ||
|
3 | before_filter :authenticate, :except => [:index, :login] |
|
3 | before_filter :authenticate, :except => [:index, :login] |
|
4 | before_filter :check_viewability, :except => [:index, :login] |
|
4 | before_filter :check_viewability, :except => [:index, :login] |
|
5 |
|
5 | ||
|
6 | append_before_filter :confirm_and_update_start_time, |
|
6 | append_before_filter :confirm_and_update_start_time, |
|
7 | :except => [:index, |
|
7 | :except => [:index, |
|
8 | :login, |
|
8 | :login, |
|
9 | :confirm_contest_start] |
|
9 | :confirm_contest_start] |
|
10 |
|
10 | ||
|
11 | # to prevent log in box to be shown when user logged out of the |
|
11 | # to prevent log in box to be shown when user logged out of the |
|
12 | # system only in some tab |
|
12 | # system only in some tab |
|
13 | prepend_before_filter :reject_announcement_refresh_when_logged_out, |
|
13 | prepend_before_filter :reject_announcement_refresh_when_logged_out, |
|
14 | :only => [:announcements] |
|
14 | :only => [:announcements] |
|
15 |
|
15 | ||
|
16 | # COMMENTED OUT: filter in each action instead |
|
16 | # COMMENTED OUT: filter in each action instead |
|
17 | # before_filter :verify_time_limit, :only => [:submit] |
|
17 | # before_filter :verify_time_limit, :only => [:submit] |
|
18 |
|
18 | ||
|
19 | verify :method => :post, :only => [:submit], |
|
19 | verify :method => :post, :only => [:submit], |
|
20 | :redirect_to => { :action => :index } |
|
20 | :redirect_to => { :action => :index } |
|
21 |
|
21 | ||
|
22 | # COMMENT OUT: only need when having high load |
|
22 | # COMMENT OUT: only need when having high load |
|
23 | # caches_action :index, :login |
|
23 | # caches_action :index, :login |
|
24 |
|
24 | ||
|
25 | # NOTE: This method is not actually needed, 'config/routes.rb' has |
|
25 | # NOTE: This method is not actually needed, 'config/routes.rb' has |
|
26 | # assigned action login as a default action. |
|
26 | # assigned action login as a default action. |
|
27 | def index |
|
27 | def index |
|
28 | redirect_to :action => 'login' |
|
28 | redirect_to :action => 'login' |
|
29 | end |
|
29 | end |
|
30 |
|
30 | ||
|
31 | def login |
|
31 | def login |
|
32 | saved_notice = flash[:notice] |
|
32 | saved_notice = flash[:notice] |
|
33 | reset_session |
|
33 | reset_session |
|
34 | flash.now[:notice] = saved_notice |
|
34 | flash.now[:notice] = saved_notice |
|
35 |
|
35 | ||
|
36 | # EXPERIMENT: |
|
36 | # EXPERIMENT: |
|
37 | # Hide login if in single user mode and the url does not |
|
37 | # Hide login if in single user mode and the url does not |
|
38 | # explicitly specify /login |
|
38 | # explicitly specify /login |
|
39 | # |
|
39 | # |
|
40 | # logger.info "PATH: #{request.path}" |
|
40 | # logger.info "PATH: #{request.path}" |
|
41 | # if GraderConfiguration['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 |
|
45 |
|
45 | ||
|
46 | @announcements = Announcement.find_for_frontpage |
|
46 | @announcements = Announcement.find_for_frontpage |
|
47 | render :action => 'login', :layout => 'empty' |
|
47 | render :action => 'login', :layout => 'empty' |
|
48 | end |
|
48 | end |
|
49 |
|
49 | ||
|
50 | def list |
|
50 | def list |
|
51 | prepare_list_information |
|
51 | prepare_list_information |
|
52 | end |
|
52 | end |
|
53 |
|
53 | ||
|
54 | def help |
|
54 | def help |
|
55 | @user = User.find(session[:user_id]) |
|
55 | @user = User.find(session[:user_id]) |
|
56 | end |
|
56 | end |
|
57 |
|
57 | ||
|
58 | def submit |
|
58 | def submit |
|
59 | user = User.find(session[:user_id]) |
|
59 | user = User.find(session[:user_id]) |
|
60 |
|
60 | ||
|
61 |
- @submission = Submission.new |
|
61 | + @submission = Submission.new |
|
|
62 | + @submission.problem_id = params[:submission][:problem_id] | ||
|
62 | @submission.user = user |
|
63 | @submission.user = user |
|
63 | @submission.language_id = 0 |
|
64 | @submission.language_id = 0 |
|
64 | if (params['file']) and (params['file']!='') |
|
65 | if (params['file']) and (params['file']!='') |
|
65 | @submission.source = params['file'].read |
|
66 | @submission.source = params['file'].read |
|
66 | @submission.source_filename = params['file'].original_filename |
|
67 | @submission.source_filename = params['file'].original_filename |
|
67 | end |
|
68 | end |
|
68 | @submission.submitted_at = Time.new.gmtime |
|
69 | @submission.submitted_at = Time.new.gmtime |
|
69 |
|
70 | ||
|
70 | if GraderConfiguration.time_limit_mode? and user.contest_finished? |
|
71 | if GraderConfiguration.time_limit_mode? and user.contest_finished? |
|
71 | @submission.errors.add_to_base "The contest is over." |
|
72 | @submission.errors.add_to_base "The contest is over." |
|
72 | prepare_list_information |
|
73 | prepare_list_information |
|
73 | render :action => 'list' and return |
|
74 | render :action => 'list' and return |
|
74 | end |
|
75 | end |
|
75 |
|
76 | ||
|
76 | if @submission.valid? |
|
77 | if @submission.valid? |
|
77 | if @submission.save == false |
|
78 | if @submission.save == false |
|
78 | flash[:notice] = 'Error saving your submission' |
|
79 | flash[:notice] = 'Error saving your submission' |
|
79 | elsif Task.create(:submission_id => @submission.id, |
|
80 | elsif Task.create(:submission_id => @submission.id, |
|
80 | :status => Task::STATUS_INQUEUE) == false |
|
81 | :status => Task::STATUS_INQUEUE) == false |
|
81 | flash[:notice] = 'Error adding your submission to task queue' |
|
82 | flash[:notice] = 'Error adding your submission to task queue' |
|
82 | end |
|
83 | end |
|
83 | else |
|
84 | else |
|
84 | prepare_list_information |
|
85 | prepare_list_information |
|
85 | render :action => 'list' and return |
|
86 | render :action => 'list' and return |
|
86 | end |
|
87 | end |
|
87 | redirect_to :action => 'list' |
|
88 | redirect_to :action => 'list' |
|
88 | end |
|
89 | end |
|
89 |
|
90 | ||
|
90 | def source |
|
91 | def source |
|
91 | submission = Submission.find(params[:id]) |
|
92 | submission = Submission.find(params[:id]) |
|
92 | if ((submission.user_id == session[:user_id]) and |
|
93 | if ((submission.user_id == session[:user_id]) and |
|
93 | (submission.problem != nil) and |
|
94 | (submission.problem != nil) and |
|
94 | (submission.problem.available)) |
|
95 | (submission.problem.available)) |
|
95 | send_data(submission.source, |
|
96 | send_data(submission.source, |
|
96 | {:filename => submission.download_filename, |
|
97 | {:filename => submission.download_filename, |
|
97 | :type => 'text/plain'}) |
|
98 | :type => 'text/plain'}) |
|
98 | else |
|
99 | else |
|
99 | flash[:notice] = 'Error viewing source' |
|
100 | flash[:notice] = 'Error viewing source' |
|
100 | redirect_to :action => 'list' |
|
101 | redirect_to :action => 'list' |
|
101 | end |
|
102 | end |
|
102 | end |
|
103 | end |
|
103 |
|
104 | ||
|
104 | def compiler_msg |
|
105 | def compiler_msg |
|
105 | @submission = Submission.find(params[:id]) |
|
106 | @submission = Submission.find(params[:id]) |
|
106 | if @submission.user_id == session[:user_id] |
|
107 | if @submission.user_id == session[:user_id] |
|
107 | render :action => 'compiler_msg', :layout => 'empty' |
|
108 | render :action => 'compiler_msg', :layout => 'empty' |
|
108 | else |
|
109 | else |
|
109 | flash[:notice] = 'Error viewing source' |
|
110 | flash[:notice] = 'Error viewing source' |
|
110 | redirect_to :action => 'list' |
|
111 | redirect_to :action => 'list' |
|
111 | end |
|
112 | end |
|
112 | end |
|
113 | end |
|
113 |
|
114 | ||
|
114 | def submission |
|
115 | def submission |
|
115 | @user = User.find(session[:user_id]) |
|
116 | @user = User.find(session[:user_id]) |
|
116 | @problems = @user.available_problems |
|
117 | @problems = @user.available_problems |
|
117 | if params[:id]==nil |
|
118 | if params[:id]==nil |
|
118 | @problem = nil |
|
119 | @problem = nil |
|
119 | @submissions = nil |
|
120 | @submissions = nil |
|
120 | else |
|
121 | else |
|
121 | @problem = Problem.find_by_name(params[:id]) |
|
122 | @problem = Problem.find_by_name(params[:id]) |
|
122 | if not @problem.available |
|
123 | if not @problem.available |
|
123 | redirect_to :action => 'list' |
|
124 | redirect_to :action => 'list' |
|
124 | flash[:notice] = 'Error: submissions for that problem are not viewable.' |
|
125 | flash[:notice] = 'Error: submissions for that problem are not viewable.' |
|
125 | return |
|
126 | return |
|
126 | end |
|
127 | end |
|
127 | @submissions = Submission.find_all_by_user_problem(@user.id, @problem.id) |
|
128 | @submissions = Submission.find_all_by_user_problem(@user.id, @problem.id) |
|
128 | end |
|
129 | end |
|
129 | end |
|
130 | end |
|
130 |
|
131 | ||
|
131 | def result |
|
132 | def result |
|
132 | if !GraderConfiguration.show_grading_result |
|
133 | if !GraderConfiguration.show_grading_result |
|
133 | redirect_to :action => 'list' and return |
|
134 | redirect_to :action => 'list' and return |
|
134 | end |
|
135 | end |
|
135 | @user = User.find(session[:user_id]) |
|
136 | @user = User.find(session[:user_id]) |
|
136 | @submission = Submission.find(params[:id]) |
|
137 | @submission = Submission.find(params[:id]) |
|
137 | if @submission.user!=@user |
|
138 | if @submission.user!=@user |
|
138 | flash[:notice] = 'You are not allowed to view result of other users.' |
|
139 | flash[:notice] = 'You are not allowed to view result of other users.' |
|
139 | redirect_to :action => 'list' and return |
|
140 | redirect_to :action => 'list' and return |
|
140 | end |
|
141 | end |
|
141 | prepare_grading_result(@submission) |
|
142 | prepare_grading_result(@submission) |
|
142 | end |
|
143 | end |
|
143 |
|
144 | ||
|
144 | def load_output |
|
145 | def load_output |
|
145 | if !GraderConfiguration.show_grading_result or params[:num]==nil |
|
146 | if !GraderConfiguration.show_grading_result or params[:num]==nil |
|
146 | redirect_to :action => 'list' and return |
|
147 | redirect_to :action => 'list' and return |
|
147 | end |
|
148 | end |
|
148 | @user = User.find(session[:user_id]) |
|
149 | @user = User.find(session[:user_id]) |
|
149 | @submission = Submission.find(params[:id]) |
|
150 | @submission = Submission.find(params[:id]) |
|
150 | if @submission.user!=@user |
|
151 | if @submission.user!=@user |
|
151 | flash[:notice] = 'You are not allowed to view result of other users.' |
|
152 | flash[:notice] = 'You are not allowed to view result of other users.' |
|
152 | redirect_to :action => 'list' and return |
|
153 | redirect_to :action => 'list' and return |
|
153 | end |
|
154 | end |
|
154 | case_num = params[:num].to_i |
|
155 | case_num = params[:num].to_i |
|
155 | out_filename = output_filename(@user.login, |
|
156 | out_filename = output_filename(@user.login, |
|
156 | @submission.problem.name, |
|
157 | @submission.problem.name, |
|
157 | @submission.id, |
|
158 | @submission.id, |
|
158 | case_num) |
|
159 | case_num) |
|
159 | if !FileTest.exists?(out_filename) |
|
160 | if !FileTest.exists?(out_filename) |
|
160 | flash[:notice] = 'Output not found.' |
|
161 | flash[:notice] = 'Output not found.' |
|
161 | redirect_to :action => 'list' and return |
|
162 | redirect_to :action => 'list' and return |
|
162 | end |
|
163 | end |
|
163 |
|
164 | ||
|
164 | if defined?(USE_APACHE_XSENDFILE) and USE_APACHE_XSENDFILE |
|
165 | if defined?(USE_APACHE_XSENDFILE) and USE_APACHE_XSENDFILE |
|
165 | response.headers['Content-Type'] = "application/force-download" |
|
166 | response.headers['Content-Type'] = "application/force-download" |
|
166 | response.headers['Content-Disposition'] = "attachment; filename=\"output-#{case_num}.txt\"" |
|
167 | response.headers['Content-Disposition'] = "attachment; filename=\"output-#{case_num}.txt\"" |
|
167 | response.headers["X-Sendfile"] = out_filename |
|
168 | response.headers["X-Sendfile"] = out_filename |
|
168 | response.headers['Content-length'] = File.size(out_filename) |
|
169 | response.headers['Content-length'] = File.size(out_filename) |
|
169 | render :nothing => true |
|
170 | render :nothing => true |
|
170 | else |
|
171 | else |
|
171 | send_file out_filename, :stream => false, :filename => "output-#{case_num}.txt", :type => "text/plain" |
|
172 | send_file out_filename, :stream => false, :filename => "output-#{case_num}.txt", :type => "text/plain" |
|
172 | end |
|
173 | end |
|
173 | end |
|
174 | end |
|
174 |
|
175 | ||
|
175 | def error |
|
176 | def error |
|
176 | @user = User.find(session[:user_id]) |
|
177 | @user = User.find(session[:user_id]) |
|
177 | end |
|
178 | end |
|
178 |
|
179 | ||
|
179 | # announcement refreshing and hiding methods |
|
180 | # announcement refreshing and hiding methods |
|
180 |
|
181 | ||
|
181 | def announcements |
|
182 | def announcements |
|
182 | if params.has_key? 'recent' |
|
183 | if params.has_key? 'recent' |
|
183 | prepare_announcements(params[:recent]) |
|
184 | prepare_announcements(params[:recent]) |
|
184 | else |
|
185 | else |
|
185 | prepare_announcements |
|
186 | prepare_announcements |
|
186 | end |
|
187 | end |
|
187 | render(:partial => 'announcement', |
|
188 | render(:partial => 'announcement', |
|
188 | :collection => @announcements, |
|
189 | :collection => @announcements, |
|
189 | :locals => {:announcement_effect => true}) |
|
190 | :locals => {:announcement_effect => true}) |
|
190 | end |
|
191 | end |
|
191 |
|
192 | ||
|
192 | def confirm_contest_start |
|
193 | def confirm_contest_start |
|
193 | user = User.find(session[:user_id]) |
|
194 | user = User.find(session[:user_id]) |
|
194 | if request.method == :post |
|
195 | if request.method == :post |
|
195 | user.update_start_time |
|
196 | user.update_start_time |
|
196 | redirect_to :action => 'list' |
|
197 | redirect_to :action => 'list' |
|
197 | else |
|
198 | else |
|
198 | @contests = user.contests |
|
199 | @contests = user.contests |
|
199 | @user = user |
|
200 | @user = user |
|
200 | end |
|
201 | end |
|
201 | end |
|
202 | end |
|
202 |
|
203 | ||
|
203 | protected |
|
204 | protected |
|
204 |
|
205 | ||
|
205 | def prepare_announcements(recent=nil) |
|
206 | def prepare_announcements(recent=nil) |
|
206 | if GraderConfiguration.show_tasks_to?(@user) |
|
207 | if GraderConfiguration.show_tasks_to?(@user) |
|
207 | @announcements = Announcement.find_published(true) |
|
208 | @announcements = Announcement.find_published(true) |
|
208 | else |
|
209 | else |
|
209 | @announcements = Announcement.find_published |
|
210 | @announcements = Announcement.find_published |
|
210 | end |
|
211 | end |
|
211 | if recent!=nil |
|
212 | if recent!=nil |
|
212 | recent_id = recent.to_i |
|
213 | recent_id = recent.to_i |
|
213 | @announcements = @announcements.find_all { |a| a.id > recent_id } |
|
214 | @announcements = @announcements.find_all { |a| a.id > recent_id } |
|
214 | end |
|
215 | end |
|
215 | end |
|
216 | end |
|
216 |
|
217 | ||
|
217 | def prepare_list_information |
|
218 | def prepare_list_information |
|
218 | @user = User.find(session[:user_id]) |
|
219 | @user = User.find(session[:user_id]) |
|
219 | if not GraderConfiguration.multicontests? |
|
220 | if not GraderConfiguration.multicontests? |
|
220 | @problems = @user.available_problems |
|
221 | @problems = @user.available_problems |
|
221 | else |
|
222 | else |
|
222 | @contest_problems = @user.available_problems_group_by_contests |
|
223 | @contest_problems = @user.available_problems_group_by_contests |
|
223 | @problems = @user.available_problems |
|
224 | @problems = @user.available_problems |
|
224 | end |
|
225 | end |
|
225 | @prob_submissions = {} |
|
226 | @prob_submissions = {} |
|
226 | @problems.each do |p| |
|
227 | @problems.each do |p| |
|
227 | sub = Submission.find_last_by_user_and_problem(@user.id,p.id) |
|
228 | sub = Submission.find_last_by_user_and_problem(@user.id,p.id) |
|
228 | if sub!=nil |
|
229 | if sub!=nil |
|
229 | @prob_submissions[p.id] = { :count => sub.number, :submission => sub } |
|
230 | @prob_submissions[p.id] = { :count => sub.number, :submission => sub } |
|
230 | else |
|
231 | else |
|
231 | @prob_submissions[p.id] = { :count => 0, :submission => nil } |
|
232 | @prob_submissions[p.id] = { :count => 0, :submission => nil } |
|
232 | end |
|
233 | end |
|
233 | end |
|
234 | end |
|
234 | prepare_announcements |
|
235 | prepare_announcements |
|
235 | end |
|
236 | end |
|
236 |
|
237 | ||
|
237 | def check_viewability |
|
238 | def check_viewability |
|
238 | @user = User.find(session[:user_id]) |
|
239 | @user = User.find(session[:user_id]) |
|
239 | if (!GraderConfiguration.show_tasks_to?(@user)) and |
|
240 | if (!GraderConfiguration.show_tasks_to?(@user)) and |
|
240 | ((action_name=='submission') or (action_name=='submit')) |
|
241 | ((action_name=='submission') or (action_name=='submit')) |
|
241 | redirect_to :action => 'list' and return |
|
242 | redirect_to :action => 'list' and return |
|
242 | end |
|
243 | end |
|
243 | end |
|
244 | end |
|
244 |
|
245 | ||
|
245 | def prepare_grading_result(submission) |
|
246 | def prepare_grading_result(submission) |
|
246 | if GraderConfiguration.task_grading_info.has_key? submission.problem.name |
|
247 | if GraderConfiguration.task_grading_info.has_key? submission.problem.name |
|
247 | grading_info = GraderConfiguration.task_grading_info[submission.problem.name] |
|
248 | grading_info = GraderConfiguration.task_grading_info[submission.problem.name] |
|
248 | else |
|
249 | else |
|
249 | # guess task info from problem.full_score |
|
250 | # guess task info from problem.full_score |
|
250 | cases = submission.problem.full_score / 10 |
|
251 | cases = submission.problem.full_score / 10 |
|
251 | grading_info = { |
|
252 | grading_info = { |
|
252 | 'testruns' => cases, |
|
253 | 'testruns' => cases, |
|
253 | 'testcases' => cases |
|
254 | 'testcases' => cases |
@@ -1,51 +1,51 | |||||
|
1 | - content_for :head do |
|
1 | - content_for :head do |
|
2 | = stylesheet_link_tag 'graders' |
|
2 | = stylesheet_link_tag 'graders' |
|
3 | <meta http-equiv ="refresh" content="60"/> |
|
3 | <meta http-equiv ="refresh" content="60"/> |
|
4 |
|
4 | ||
|
5 | %h1 Grader information |
|
5 | %h1 Grader information |
|
6 |
|
6 | ||
|
7 | = link_to '[Refresh]', :action => 'list' |
|
7 | = link_to '[Refresh]', :action => 'list' |
|
8 | %br/ |
|
8 | %br/ |
|
9 |
|
9 | ||
|
10 | .submitbox |
|
10 | .submitbox |
|
11 | .item |
|
11 | .item |
|
12 | Grader control: |
|
12 | Grader control: |
|
13 | .item |
|
13 | .item |
|
14 |
- |
|
14 | + = form_for :clear, nil, :url => {:action => 'start_grading'} do |f| |
|
15 | = submit_tag 'Start graders in grading env' |
|
15 | = submit_tag 'Start graders in grading env' |
|
16 | .item |
|
16 | .item |
|
17 |
- |
|
17 | + = form_for :clear, nil, :url => {:action => 'start_exam'} do |f| |
|
18 | = submit_tag 'Start graders in exam env' |
|
18 | = submit_tag 'Start graders in exam env' |
|
19 | .item |
|
19 | .item |
|
20 |
- |
|
20 | + = form_for :clear, nil, :url => {:action => 'stop_all'} do |f| |
|
21 | = submit_tag 'Stop all running graders' |
|
21 | = submit_tag 'Stop all running graders' |
|
22 | .item |
|
22 | .item |
|
23 |
- |
|
23 | + = form_for :clear, nil, :url => {:action => 'clear_all'} do |f| |
|
24 | = submit_tag 'Clear all data' |
|
24 | = submit_tag 'Clear all data' |
|
25 | %br{:style => 'clear:both'}/ |
|
25 | %br{:style => 'clear:both'}/ |
|
26 |
|
26 | ||
|
27 | - if @last_task |
|
27 | - if @last_task |
|
28 | Last task: |
|
28 | Last task: |
|
29 | = link_to "#{@last_task.id}", :action => 'view', :id => @last_task.id, :type => 'Task' |
|
29 | = link_to "#{@last_task.id}", :action => 'view', :id => @last_task.id, :type => 'Task' |
|
30 |
|
30 | ||
|
31 | %br/ |
|
31 | %br/ |
|
32 |
|
32 | ||
|
33 | - if @last_test_request |
|
33 | - if @last_test_request |
|
34 | Last test_request: |
|
34 | Last test_request: |
|
35 | = link_to "#{@last_test_request.id}", :action => 'view', :id => @last_test_request.id, :type => 'TestRequest' |
|
35 | = link_to "#{@last_test_request.id}", :action => 'view', :id => @last_test_request.id, :type => 'TestRequest' |
|
36 |
|
36 | ||
|
37 |
|
37 | ||
|
38 | %h2 Current graders |
|
38 | %h2 Current graders |
|
39 |
|
39 | ||
|
40 | = render :partial => 'grader_list', :locals => {:grader_list => @grader_processes} |
|
40 | = render :partial => 'grader_list', :locals => {:grader_list => @grader_processes} |
|
41 |
|
41 | ||
|
42 | %h2 Stalled graders |
|
42 | %h2 Stalled graders |
|
43 |
|
43 | ||
|
44 | = render :partial => 'grader_list', :locals => {:grader_list => @stalled_processes} |
|
44 | = render :partial => 'grader_list', :locals => {:grader_list => @stalled_processes} |
|
45 |
|
45 | ||
|
46 | %h2 Terminated graders |
|
46 | %h2 Terminated graders |
|
47 |
|
47 | ||
|
48 |
- |
|
48 | + = form_for :clear, nil, :url => {:action => 'clear_terminated'} do |f| |
|
49 | = submit_tag 'Clear data for terminated graders' |
|
49 | = submit_tag 'Clear data for terminated graders' |
|
50 |
|
50 | ||
|
51 | = render :partial => 'grader_list', :locals => {:grader_list => @terminated_processes} |
|
51 | = render :partial => 'grader_list', :locals => {:grader_list => @terminated_processes} |
@@ -1,16 +1,16 | |||||
|
1 | = user_title_bar(@user) |
|
1 | = user_title_bar(@user) |
|
2 |
|
2 | ||
|
3 | .announcementbox |
|
3 | .announcementbox |
|
4 | %span{:class => 'title'} |
|
4 | %span{:class => 'title'} |
|
5 | =t 'main.confirm_contest_start.box_title' |
|
5 | =t 'main.confirm_contest_start.box_title' |
|
6 | .announcement |
|
6 | .announcement |
|
7 | %center |
|
7 | %center |
|
8 | =t 'main.confirm_contest_start.contest_list' |
|
8 | =t 'main.confirm_contest_start.contest_list' |
|
9 | - @contests.each do |contest| |
|
9 | - @contests.each do |contest| |
|
10 | = contest.title |
|
10 | = contest.title |
|
11 | %br |
|
11 | %br |
|
12 |
|
12 | ||
|
13 | =t 'main.confirm_contest_start.timer_starts_after_click' |
|
13 | =t 'main.confirm_contest_start.timer_starts_after_click' |
|
14 |
|
14 | ||
|
15 |
- |
|
15 | + = form_tag :action => 'confirm_contest_start', :method => 'post' do |
|
16 | = submit_tag t('main.confirm_contest_start.start_button'), :confirm => t('main.confirm_contest_start.start_button_confirm') |
|
16 | = submit_tag t('main.confirm_contest_start.start_button'), :confirm => t('main.confirm_contest_start.start_button_confirm') |
@@ -1,26 +1,26 | |||||
|
1 | = user_title_bar(@user) |
|
1 | = user_title_bar(@user) |
|
2 |
|
2 | ||
|
3 | .announcementbox |
|
3 | .announcementbox |
|
4 | %span{:class => 'title'} |
|
4 | %span{:class => 'title'} |
|
5 | How to submit clarification requests |
|
5 | How to submit clarification requests |
|
6 | .announcement |
|
6 | .announcement |
|
7 | %p |
|
7 | %p |
|
8 | :markdown |
|
8 | :markdown |
|
9 | The clarification requests should be phrased as yes/no questions. |
|
9 | The clarification requests should be phrased as yes/no questions. |
|
10 | The answers will be one of the following: |
|
10 | The answers will be one of the following: |
|
11 | (1) **YES**, |
|
11 | (1) **YES**, |
|
12 | (2) <b>NO</b>, |
|
12 | (2) <b>NO</b>, |
|
13 | (3) **ANSWERED IN TASK DESCRIPTION (EXPLICITLY OR IMPLICITLY)**, |
|
13 | (3) **ANSWERED IN TASK DESCRIPTION (EXPLICITLY OR IMPLICITLY)**, |
|
14 | (4) **INVALID QUESTION**, and |
|
14 | (4) **INVALID QUESTION**, and |
|
15 | (5) **NO COMMENT**. |
|
15 | (5) **NO COMMENT**. |
|
16 |
|
16 | ||
|
17 |
- |
|
17 | + = form_for 'message', nil, :url => { :action => 'create'} do |f| |
|
18 | %p |
|
18 | %p |
|
19 | %b New clarification request |
|
19 | %b New clarification request |
|
20 | = submit_tag "Post" |
|
20 | = submit_tag "Post" |
|
21 | %br/ |
|
21 | %br/ |
|
22 | = f.text_area :body, :rows => 5, :cols => 100 |
|
22 | = f.text_area :body, :rows => 5, :cols => 100 |
|
23 |
|
23 | ||
|
24 | %hr/ |
|
24 | %hr/ |
|
25 |
|
25 | ||
|
26 | = render :partial => 'message', :collection => @messages, :locals => {:reply => false} |
|
26 | = render :partial => 'message', :collection => @messages, :locals => {:reply => false} |
@@ -1,20 +1,20 | |||||
|
1 | %h3 Message |
|
1 | %h3 Message |
|
2 |
|
2 | ||
|
3 | .message |
|
3 | .message |
|
4 | .stat |
|
4 | .stat |
|
5 | = "#{@message.sender.full_name} at #{@message.created_at}" |
|
5 | = "#{@message.sender.full_name} at #{@message.created_at}" |
|
6 | .body= simple_format(@message.body) |
|
6 | .body= simple_format(@message.body) |
|
7 |
|
7 | ||
|
8 | %h3 Your reply: |
|
8 | %h3 Your reply: |
|
9 |
- |
|
9 | + = form_for 'r_message', nil, :url => { :action => 'reply'} do |f| |
|
10 | = f.text_area :body, :rows => 5, :cols => 100 |
|
10 | = f.text_area :body, :rows => 5, :cols => 100 |
|
11 | = f.hidden_field :receiver_id, {:value => @message.sender_id } |
|
11 | = f.hidden_field :receiver_id, {:value => @message.sender_id } |
|
12 | = f.hidden_field :replying_message_id, {:value => @message.id } |
|
12 | = f.hidden_field :replying_message_id, {:value => @message.id } |
|
13 | = submit_tag "Post" |
|
13 | = submit_tag "Post" |
|
14 |
|
14 | ||
|
15 | %p |
|
15 | %p |
|
16 | If you do not want to reply, but want to hide this message from |
|
16 | If you do not want to reply, but want to hide this message from |
|
17 | console, you can |
|
17 | console, you can |
|
18 | = link_to "[hide]", :action => 'hide', :id => @message.id |
|
18 | = link_to "[hide]", :action => 'hide', :id => @message.id |
|
19 | this message. (This message will be marked as replied.) |
|
19 | this message. (This message will be marked as replied.) |
|
20 |
|
20 |
@@ -1,59 +1,59 | |||||
|
1 | - content_for :head do |
|
1 | - content_for :head do |
|
2 | = stylesheet_link_tag 'problems' |
|
2 | = stylesheet_link_tag 'problems' |
|
3 | = javascript_include_tag :defaults |
|
3 | = javascript_include_tag :defaults |
|
4 |
|
4 | ||
|
5 | %h1 Import problems |
|
5 | %h1 Import problems |
|
6 |
|
6 | ||
|
7 | %p= link_to '[Back to problem list]', :action => 'list' |
|
7 | %p= link_to '[Back to problem list]', :action => 'list' |
|
8 |
|
8 | ||
|
9 | - if @problem and @problem.errors |
|
9 | - if @problem and @problem.errors |
|
10 | =error_messages_for 'problem' |
|
10 | =error_messages_for 'problem' |
|
11 |
|
11 | ||
|
12 |
- |
|
12 | + = form_tag({:action => 'do_import'}, :multipart => true) do |
|
13 | .submitbox |
|
13 | .submitbox |
|
14 | %table |
|
14 | %table |
|
15 | %tr |
|
15 | %tr |
|
16 | %td Name: |
|
16 | %td Name: |
|
17 | %td= text_field_tag 'name' |
|
17 | %td= text_field_tag 'name' |
|
18 | %tr |
|
18 | %tr |
|
19 | %td Full name: |
|
19 | %td Full name: |
|
20 | %td |
|
20 | %td |
|
21 | = text_field_tag 'full_name' |
|
21 | = text_field_tag 'full_name' |
|
22 | %span{:class => 'help'} Leave blank to use the same value as the name above. |
|
22 | %span{:class => 'help'} Leave blank to use the same value as the name above. |
|
23 | %tr |
|
23 | %tr |
|
24 | %td Testdata file: |
|
24 | %td Testdata file: |
|
25 | %td= file_field_tag 'file' |
|
25 | %td= file_field_tag 'file' |
|
26 | %tr |
|
26 | %tr |
|
27 | %td |
|
27 | %td |
|
28 | %td |
|
28 | %td |
|
29 | %span{:class => 'help'} |
|
29 | %span{:class => 'help'} |
|
30 | In .zip, .tgz, tar.gz, .tar format. |
|
30 | In .zip, .tgz, tar.gz, .tar format. |
|
31 | It should includes inputs (e.g., 1.in, 2a.in, 2b.in) |
|
31 | It should includes inputs (e.g., 1.in, 2a.in, 2b.in) |
|
32 | and solutions (e.g., 1.sol, 2a.sol, 2b.sol). |
|
32 | and solutions (e.g., 1.sol, 2a.sol, 2b.sol). |
|
33 | %br/ |
|
33 | %br/ |
|
34 | You may put task description in *.html for raw html |
|
34 | You may put task description in *.html for raw html |
|
35 | and *.md or *.markdown for markdown. |
|
35 | and *.md or *.markdown for markdown. |
|
36 | - if @allow_test_pair_import |
|
36 | - if @allow_test_pair_import |
|
37 | %tr |
|
37 | %tr |
|
38 | %td |
|
38 | %td |
|
39 | %td |
|
39 | %td |
|
40 | = check_box_tag 'import_to_db' |
|
40 | = check_box_tag 'import_to_db' |
|
41 | Import test data to database (for a test-pair task) |
|
41 | Import test data to database (for a test-pair task) |
|
42 | %tr |
|
42 | %tr |
|
43 | %td Time limit: |
|
43 | %td Time limit: |
|
44 | %td |
|
44 | %td |
|
45 | = text_field_tag 'time_limit' |
|
45 | = text_field_tag 'time_limit' |
|
46 | %span{:class => 'help'} In seconds. Leave blank to use 1 sec. |
|
46 | %span{:class => 'help'} In seconds. Leave blank to use 1 sec. |
|
47 | %tr |
|
47 | %tr |
|
48 | %td Memory limit: |
|
48 | %td Memory limit: |
|
49 | %td |
|
49 | %td |
|
50 | = text_field_tag 'memory_limit' |
|
50 | = text_field_tag 'memory_limit' |
|
51 | %span{:class => 'help'} In MB. Leave blank to use 32MB. |
|
51 | %span{:class => 'help'} In MB. Leave blank to use 32MB. |
|
52 | %tr |
|
52 | %tr |
|
53 | %td |
|
53 | %td |
|
54 | %td= submit_tag 'Import problem' |
|
54 | %td= submit_tag 'Import problem' |
|
55 |
|
55 | ||
|
56 | - if @log |
|
56 | - if @log |
|
57 | %h3 Import log |
|
57 | %h3 Import log |
|
58 | %pre.import-log |
|
58 | %pre.import-log |
|
59 | = @log |
|
59 | = @log |
@@ -1,44 +1,44 | |||||
|
1 | - content_for :head do |
|
1 | - content_for :head do |
|
2 | = stylesheet_link_tag 'problems' |
|
2 | = stylesheet_link_tag 'problems' |
|
3 | = javascript_include_tag :defaults |
|
3 | = javascript_include_tag :defaults |
|
4 |
|
4 | ||
|
5 | %h1 Manage problems |
|
5 | %h1 Manage problems |
|
6 |
|
6 | ||
|
7 | %p= link_to '[Back to problem list]', :action => 'list' |
|
7 | %p= link_to '[Back to problem list]', :action => 'list' |
|
8 |
|
8 | ||
|
9 |
- |
|
9 | + = form_tag :action=>'do_manage' do |
|
10 | .submitbox |
|
10 | .submitbox |
|
11 | What do you want to do? |
|
11 | What do you want to do? |
|
12 | %br/ |
|
12 | %br/ |
|
13 | %ul |
|
13 | %ul |
|
14 | %li |
|
14 | %li |
|
15 | Change date added to |
|
15 | Change date added to |
|
16 | = select_date Date.current, :prefix => 'date_added' |
|
16 | = select_date Date.current, :prefix => 'date_added' |
|
17 | |
|
17 | |
|
18 | = submit_tag 'Change', :name => 'change_date_added' |
|
18 | = submit_tag 'Change', :name => 'change_date_added' |
|
19 |
|
19 | ||
|
20 | - if GraderConfiguration.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]}) |
|
24 | = submit_tag 'Add', :name => 'add_to_contest' |
|
24 | = submit_tag 'Add', :name => 'add_to_contest' |
|
25 |
|
25 | ||
|
26 | %table |
|
26 | %table |
|
27 | %tr |
|
27 | %tr |
|
28 | %th/ |
|
28 | %th/ |
|
29 | %th Name |
|
29 | %th Name |
|
30 | %th Full name |
|
30 | %th Full name |
|
31 | %th Date added |
|
31 | %th Date added |
|
32 | - if GraderConfiguration.multicontests? |
|
32 | - if GraderConfiguration.multicontests? |
|
33 | %th Contests |
|
33 | %th Contests |
|
34 |
|
34 | ||
|
35 | - for problem in @problems |
|
35 | - for problem in @problems |
|
36 | %tr{:id => "row-prob-#{problem.id}", :name=> "prob-#{problem.id}"} |
|
36 | %tr{:id => "row-prob-#{problem.id}", :name=> "prob-#{problem.id}"} |
|
37 | %td= check_box_tag "prob-#{problem.id}" |
|
37 | %td= check_box_tag "prob-#{problem.id}" |
|
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 GraderConfiguration.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 }])" |
@@ -1,39 +1,39 | |||||
|
1 | %script{:type => 'text/javascript'} |
|
1 | %script{:type => 'text/javascript'} |
|
2 | var siteList = new Array(); |
|
2 | var siteList = new Array(); |
|
3 | - @countries.each do |country| |
|
3 | - @countries.each do |country| |
|
4 | = "siteList[#{country.id}] = new Array();" |
|
4 | = "siteList[#{country.id}] = new Array();" |
|
5 | - country.sites.each do |site| |
|
5 | - country.sites.each do |site| |
|
6 | = "siteList[#{country.id}][#{site.id}] = \"#{site.name}\";" |
|
6 | = "siteList[#{country.id}][#{site.id}] = \"#{site.name}\";" |
|
7 |
|
7 | ||
|
8 | var allSiteList = new Array(); |
|
8 | var allSiteList = new Array(); |
|
9 | - @site_select.each do |sel| |
|
9 | - @site_select.each do |sel| |
|
10 | = "allSiteList[#{sel[1]}]=\"#{sel[0]}\";" |
|
10 | = "allSiteList[#{sel[1]}]=\"#{sel[0]}\";" |
|
11 |
|
11 | ||
|
12 | %script{:type => 'text/javascript', :src => '/javascripts/site_update.js'} |
|
12 | %script{:type => 'text/javascript', :src => '/javascripts/site_update.js'} |
|
13 |
|
13 | ||
|
14 | %div{ :style => "border: solid 1px gray; padding: 2px; background: #f0f0f0;"} |
|
14 | %div{ :style => "border: solid 1px gray; padding: 2px; background: #f0f0f0;"} |
|
15 | %h2 For Site Administrator. |
|
15 | %h2 For Site Administrator. |
|
16 |
|
16 | ||
|
17 | - if @default_site |
|
17 | - if @default_site |
|
18 |
- |
|
18 | + = form_for :login, nil, :url => {:controller => 'login', :action => 'site_login'} do |f| |
|
19 | %b Log in for default site. |
|
19 | %b Log in for default site. |
|
20 | = f.hidden_field :site_id, :value => @default_site.id |
|
20 | = f.hidden_field :site_id, :value => @default_site.id |
|
21 | %br/ |
|
21 | %br/ |
|
22 | Password: |
|
22 | Password: |
|
23 | = f.password_field :password |
|
23 | = f.password_field :password |
|
24 | = submit_tag "Site Administrator Login" |
|
24 | = submit_tag "Site Administrator Login" |
|
25 |
|
25 | ||
|
26 | - else |
|
26 | - else |
|
27 | Please select your country and site and login. |
|
27 | Please select your country and site and login. |
|
28 |
- |
|
28 | + = form_for :login, nil, :url => {:controller => 'login', :action => 'site_login'} do |f| |
|
29 | Country: |
|
29 | Country: |
|
30 | = select :site_country, :id, @country_select_with_all, {}, {:onchange => "updateSiteList();", :onclick => "updateSiteList();" } |
|
30 | = select :site_country, :id, @country_select_with_all, {}, {:onchange => "updateSiteList();", :onclick => "updateSiteList();" } |
|
31 | Site: |
|
31 | Site: |
|
32 | = select :login, :site_id, @site_select |
|
32 | = select :login, :site_id, @site_select |
|
33 | %br/ |
|
33 | %br/ |
|
34 | Password: |
|
34 | Password: |
|
35 | = f.password_field :password |
|
35 | = f.password_field :password |
|
36 | = submit_tag "Site Administrator Login" |
|
36 | = submit_tag "Site Administrator Login" |
|
37 |
|
37 | ||
|
38 | %script{:type => 'text/javascript'} |
|
38 | %script{:type => 'text/javascript'} |
|
39 | updateSiteList(); |
|
39 | updateSiteList(); |
@@ -1,24 +1,24 | |||||
|
1 | %h2 |
|
1 | %h2 |
|
2 | Contest Administration for site: |
|
2 | Contest Administration for site: |
|
3 | = "#{@site.name}, #{@site.country.name if @site.country}" |
|
3 | = "#{@site.name}, #{@site.country.name if @site.country}" |
|
4 |
|
4 | ||
|
5 |
|
5 | ||
|
6 | Current time at the server is |
|
6 | Current time at the server is |
|
7 | = "#{format_short_time(Time.new.gmtime)} UTC" |
|
7 | = "#{format_short_time(Time.new.gmtime)} UTC" |
|
8 | (please |
|
8 | (please |
|
9 | = link_to 'refresh', :action => 'index' |
|
9 | = link_to 'refresh', :action => 'index' |
|
10 | to update) |
|
10 | to update) |
|
11 | %br/ |
|
11 | %br/ |
|
12 | %br/ |
|
12 | %br/ |
|
13 |
|
13 | ||
|
14 |
- |
|
14 | + = form_tag :action => 'start' do |
|
15 | When you're ready, you can click the button below to start the contest. |
|
15 | When you're ready, you can click the button below to start the contest. |
|
16 | %br/ |
|
16 | %br/ |
|
17 | Please make sure that the contestants are ready. |
|
17 | Please make sure that the contestants are ready. |
|
18 | After the contest is started, it <b>cannot</b> be paused or stopped. |
|
18 | After the contest is started, it <b>cannot</b> be paused or stopped. |
|
19 | %br/ |
|
19 | %br/ |
|
20 | = submit_tag 'Start the Contest.', :onclick => "return confirm('Are you sure?');" |
|
20 | = submit_tag 'Start the Contest.', :onclick => "return confirm('Are you sure?');" |
|
21 |
|
21 | ||
|
22 | %br/ |
|
22 | %br/ |
|
23 | %br/ |
|
23 | %br/ |
|
24 | = link_to '[log out]', :action => 'logout' |
|
24 | = link_to '[log out]', :action => 'logout' |
@@ -1,99 +1,99 | |||||
|
1 | <%= user_title_bar(@user) %> |
|
1 | <%= user_title_bar(@user) %> |
|
2 |
|
2 | ||
|
3 | <h2><%=t 'test.title' %></h2> |
|
3 | <h2><%=t 'test.title' %></h2> |
|
4 |
|
4 | ||
|
5 | <div class="test-desc"> |
|
5 | <div class="test-desc"> |
|
6 | <%=t 'test.intro' %><br/> |
|
6 | <%=t 'test.intro' %><br/> |
|
7 | <% if GraderConfiguration['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> |
|
11 |
|
11 | ||
|
12 | <% if @problems.length==0 %> |
|
12 | <% if @problems.length==0 %> |
|
13 | There is no submission |
|
13 | There is no submission |
|
14 | <% else %> |
|
14 | <% else %> |
|
15 |
|
15 | ||
|
16 | <script type="text/javascript"> |
|
16 | <script type="text/javascript"> |
|
17 | var submissionCount = new Array(); |
|
17 | var submissionCount = new Array(); |
|
18 | <% @submissions.each do |submission| %> |
|
18 | <% @submissions.each do |submission| %> |
|
19 | submissionCount[<%= submission.problem_id %>]=<%= submission.number %>; |
|
19 | submissionCount[<%= submission.problem_id %>]=<%= submission.number %>; |
|
20 | <% end %> |
|
20 | <% end %> |
|
21 |
|
21 | ||
|
22 | function updateSubmissionList() { |
|
22 | function updateSubmissionList() { |
|
23 | currentProb = document.getElementById("test_request_problem_id").value; |
|
23 | currentProb = document.getElementById("test_request_problem_id").value; |
|
24 | count = submissionCount[currentProb]; |
|
24 | count = submissionCount[currentProb]; |
|
25 | submissionSelect = document.getElementById("test_request_submission_number"); |
|
25 | submissionSelect = document.getElementById("test_request_submission_number"); |
|
26 | old_len = submissionSelect.length; |
|
26 | old_len = submissionSelect.length; |
|
27 | // clear the box |
|
27 | // clear the box |
|
28 | for(i=0; i<old_len; i++) |
|
28 | for(i=0; i<old_len; i++) |
|
29 | submissionSelect.remove(0); |
|
29 | submissionSelect.remove(0); |
|
30 | for(i=count; i>=1; i--) { |
|
30 | for(i=count; i>=1; i--) { |
|
31 | try { |
|
31 | try { |
|
32 | submissionSelect.add(new Option(""+i,""+i,false,false),null); |
|
32 | submissionSelect.add(new Option(""+i,""+i,false,false),null); |
|
33 | } catch(ex) { |
|
33 | } catch(ex) { |
|
34 | submissionSelect.add(new Option(""+i,""+i,false,false)); |
|
34 | submissionSelect.add(new Option(""+i,""+i,false,false)); |
|
35 | } |
|
35 | } |
|
36 | } |
|
36 | } |
|
37 | } |
|
37 | } |
|
38 | </script> |
|
38 | </script> |
|
39 |
|
39 | ||
|
40 | <% if GraderConfiguration.show_submitbox_to?(@user) and GraderConfiguration.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, |
|
44 | :url => { :action => 'submit'}, |
|
44 | :url => { :action => 'submit'}, |
|
45 | :html => { :multipart => true } do |f| %> |
|
45 | :html => { :multipart => true } do |f| %> |
|
46 | <table> |
|
46 | <table> |
|
47 | <tr> |
|
47 | <tr> |
|
48 | <td>Task:</td> |
|
48 | <td>Task:</td> |
|
49 | <td> |
|
49 | <td> |
|
50 | <%= select(:test_request, |
|
50 | <%= select(:test_request, |
|
51 | :problem_id, |
|
51 | :problem_id, |
|
52 | @problems.collect {|p| [p.name, p.id]}, {}, |
|
52 | @problems.collect {|p| [p.name, p.id]}, {}, |
|
53 | { :onclick => "updateSubmissionList();" }) %> |
|
53 | { :onclick => "updateSubmissionList();" }) %> |
|
54 | </td> |
|
54 | </td> |
|
55 | </tr> |
|
55 | </tr> |
|
56 | <tr> |
|
56 | <tr> |
|
57 | <td>Submission:</td> |
|
57 | <td>Submission:</td> |
|
58 | <td> |
|
58 | <td> |
|
59 | <%= select(:test_request, |
|
59 | <%= select(:test_request, |
|
60 | :submission_number, |
|
60 | :submission_number, |
|
61 | ((1..@submissions[0].number).collect {|n| [n,n]}).reverse) %> |
|
61 | ((1..@submissions[0].number).collect {|n| [n,n]}).reverse) %> |
|
62 | </td> |
|
62 | </td> |
|
63 | </tr> |
|
63 | </tr> |
|
64 | <tr> |
|
64 | <tr> |
|
65 | <td>Input data:</td> |
|
65 | <td>Input data:</td> |
|
66 | <td> |
|
66 | <td> |
|
67 | <%= f.file_field :input_file %> |
|
67 | <%= f.file_field :input_file %> |
|
68 | </td> |
|
68 | </td> |
|
69 | <td> |
|
69 | <td> |
|
70 | (combined size should not exceed 2MB) |
|
70 | (combined size should not exceed 2MB) |
|
71 | </td> |
|
71 | </td> |
|
72 | </tr> |
|
72 | </tr> |
|
73 | <tr> |
|
73 | <tr> |
|
74 | <td colspan="2"> |
|
74 | <td colspan="2"> |
|
75 | <%= submit_tag 'submit' %> |
|
75 | <%= submit_tag 'submit' %> |
|
76 | </td> |
|
76 | </td> |
|
77 | </tr> |
|
77 | </tr> |
|
78 | </table> |
|
78 | </table> |
|
79 | <% end %> |
|
79 | <% end %> |
|
80 | </div> |
|
80 | </div> |
|
81 | <% end %> |
|
81 | <% end %> |
|
82 |
|
82 | ||
|
83 | <h3>Previous requests</h3> |
|
83 | <h3>Previous requests</h3> |
|
84 |
|
84 | ||
|
85 | <table class="info"> |
|
85 | <table class="info"> |
|
86 | <tr class="info-head"> |
|
86 | <tr class="info-head"> |
|
87 | <th>at</th> |
|
87 | <th>at</th> |
|
88 | <th>problem</th> |
|
88 | <th>problem</th> |
|
89 | <th>sub #</th> |
|
89 | <th>sub #</th> |
|
90 | <th>status</th> |
|
90 | <th>status</th> |
|
91 | <th>output (first 2kb)</th> |
|
91 | <th>output (first 2kb)</th> |
|
92 | <th>compiler message</th> |
|
92 | <th>compiler message</th> |
|
93 | <th>detail</th> |
|
93 | <th>detail</th> |
|
94 | </tr> |
|
94 | </tr> |
|
95 | <%= render :partial => 'test_request', :collection => @test_requests %> |
|
95 | <%= render :partial => 'test_request', :collection => @test_requests %> |
|
96 | </table> |
|
96 | </table> |
|
97 |
|
97 | ||
|
98 | <% end %> |
|
98 | <% end %> |
|
99 |
|
99 |
@@ -1,25 +1,25 | |||||
|
1 | %h1 Administrators |
|
1 | %h1 Administrators |
|
2 |
|
2 | ||
|
3 | %table{:class => 'info'} |
|
3 | %table{:class => 'info'} |
|
4 | %tr{:class => 'info-head'} |
|
4 | %tr{:class => 'info-head'} |
|
5 | %th # |
|
5 | %th # |
|
6 | %th Login |
|
6 | %th Login |
|
7 | %th Full name |
|
7 | %th Full name |
|
8 | %th |
|
8 | %th |
|
9 | - @admins.each_with_index do |user, i| |
|
9 | - @admins.each_with_index do |user, i| |
|
10 | %tr |
|
10 | %tr |
|
11 | %td= i+1 |
|
11 | %td= i+1 |
|
12 | %td= user.login |
|
12 | %td= user.login |
|
13 | %td= user.full_name |
|
13 | %td= user.full_name |
|
14 | %td |
|
14 | %td |
|
15 | - if user.login!='root' |
|
15 | - if user.login!='root' |
|
16 | = link_to '[revoke]', :action => 'revoke_admin', :id => user.id |
|
16 | = link_to '[revoke]', :action => 'revoke_admin', :id => user.id |
|
17 | %hr |
|
17 | %hr |
|
18 |
|
18 | ||
|
19 |
- |
|
19 | + = form_tag :action => 'grant_admin' do |
|
20 | Grant admin permission to: |
|
20 | Grant admin permission to: |
|
21 | = text_field_tag 'login' |
|
21 | = text_field_tag 'login' |
|
22 | = submit_tag 'Grant' |
|
22 | = submit_tag 'Grant' |
|
23 |
|
23 | ||
|
24 | %hr/ |
|
24 | %hr/ |
|
25 | = link_to '[go back to index]', :action => 'index' |
|
25 | = link_to '[go back to index]', :action => 'index' |
@@ -1,26 +1,26 | |||||
|
1 | %h1 Bulk edit users in contests |
|
1 | %h1 Bulk edit users in contests |
|
2 |
|
2 | ||
|
3 |
- |
|
3 | + = form_tag :action => 'manage_contest' do |
|
4 | List users' login below; one per line. |
|
4 | List users' login below; one per line. |
|
5 | %br/ |
|
5 | %br/ |
|
6 | = text_area_tag 'login_list', nil, :rows => 23, :cols => 80 |
|
6 | = text_area_tag 'login_list', nil, :rows => 23, :cols => 80 |
|
7 | %br/ |
|
7 | %br/ |
|
8 | %table |
|
8 | %table |
|
9 | %tr |
|
9 | %tr |
|
10 | %td{:valign => 'top'} |
|
10 | %td{:valign => 'top'} |
|
11 | You want to |
|
11 | You want to |
|
12 | = select(nil,"operation",[['assign users to','assign'],['add users to','add'],['remove users from','remove']]) |
|
12 | = select(nil,"operation",[['assign users to','assign'],['add users to','add'],['remove users from','remove']]) |
|
13 | contest |
|
13 | contest |
|
14 | = select("contest","id",Contest.all.collect {|c| [c.title, c.id]}) |
|
14 | = select("contest","id",Contest.all.collect {|c| [c.title, c.id]}) |
|
15 | and also |
|
15 | and also |
|
16 | %td |
|
16 | %td |
|
17 | = check_box_tag 'reset_timer' |
|
17 | = check_box_tag 'reset_timer' |
|
18 | Auto-reset current contest timer. |
|
18 | Auto-reset current contest timer. |
|
19 | %br/ |
|
19 | %br/ |
|
20 | = check_box_tag 'notification_emails' |
|
20 | = check_box_tag 'notification_emails' |
|
21 | Send notification email(s). |
|
21 | Send notification email(s). |
|
22 |
|
22 | ||
|
23 | = submit_tag "Perform action!", :confirm => 'Are you sure?' |
|
23 | = submit_tag "Perform action!", :confirm => 'Are you sure?' |
|
24 |
|
24 | ||
|
25 | %hr/ |
|
25 | %hr/ |
|
26 | = link_to '[go back to index]', :action => 'index' |
|
26 | = link_to '[go back to index]', :action => 'index' |
@@ -1,19 +1,19 | |||||
|
1 | %h1 Send mass e-mails |
|
1 | %h1 Send mass e-mails |
|
2 |
|
2 | ||
|
3 |
- |
|
3 | + = form_tag :action => 'bulk_mail' do |
|
4 | %b List recipients' login below; one per line. |
|
4 | %b List recipients' login below; one per line. |
|
5 | %br/ |
|
5 | %br/ |
|
6 | = text_area_tag 'login_list', nil, :rows => 7, :cols => 80 |
|
6 | = text_area_tag 'login_list', nil, :rows => 7, :cols => 80 |
|
7 | %br/ |
|
7 | %br/ |
|
8 | %b Subject: |
|
8 | %b Subject: |
|
9 | = text_field_tag 'subject', '', :size => 60 |
|
9 | = text_field_tag 'subject', '', :size => 60 |
|
10 | %br/ |
|
10 | %br/ |
|
11 | %b Email body: |
|
11 | %b Email body: |
|
12 | %br/ |
|
12 | %br/ |
|
13 | = text_area_tag 'email_body', nil, :rows => 11, :cols => 80 |
|
13 | = text_area_tag 'email_body', nil, :rows => 11, :cols => 80 |
|
14 | %br/ |
|
14 | %br/ |
|
15 |
|
15 | ||
|
16 | = submit_tag "Send mails", :confirm => 'Are you sure?' |
|
16 | = submit_tag "Send mails", :confirm => 'Are you sure?' |
|
17 |
|
17 | ||
|
18 | %hr/ |
|
18 | %hr/ |
|
19 | = link_to '[go back to index]', :action => 'index' |
|
19 | = link_to '[go back to index]', :action => 'index' |
@@ -1,18 +1,18 | |||||
|
1 | .contest-title |
|
1 | .contest-title |
|
2 | %h1 |
|
2 | %h1 |
|
3 | = "#{GraderConfiguration['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/ |
|
7 | %b= flash[:notice] |
|
7 | %b= flash[:notice] |
|
8 | %hr/ |
|
8 | %hr/ |
|
9 |
|
9 | ||
|
10 | %br/ |
|
10 | %br/ |
|
11 |
|
11 | ||
|
12 |
- |
|
12 | + = form_tag :action => 'retrieve_password' do |
|
13 | =t 'registration.password_retrieval.instructions' |
|
13 | =t 'registration.password_retrieval.instructions' |
|
14 | = text_field 'email', nil, :size => 20 |
|
14 | = text_field 'email', nil, :size => 20 |
|
15 | %br/ |
|
15 | %br/ |
|
16 | = submit_tag(t 'registration.password_retrieval.button_label') |
|
16 | = submit_tag(t 'registration.password_retrieval.button_label') |
|
17 |
|
17 | ||
|
18 | = link_to "#{t 'go_back_to'}#{t 'home_page'}", :controller => 'main', :action => 'index' |
|
18 | = link_to "#{t 'go_back_to'}#{t 'home_page'}", :controller => 'main', :action => 'index' |
@@ -1,38 +1,38 | |||||
|
1 | - content_for :head do |
|
1 | - content_for :head do |
|
2 | = javascript_include_tag :defaults |
|
2 | = javascript_include_tag :defaults |
|
3 |
|
3 | ||
|
4 | = user_title_bar(@user) |
|
4 | = user_title_bar(@user) |
|
5 |
|
5 | ||
|
6 | %h1 Your account settings |
|
6 | %h1 Your account settings |
|
7 |
|
7 | ||
|
8 | -#%p |
|
8 | -#%p |
|
9 | -#You can edit your alias and e-mails. Just click on the text and edit it. |
|
9 | -#You can edit your alias and e-mails. Just click on the text and edit it. |
|
10 |
|
10 | ||
|
11 | %table.uinfo |
|
11 | %table.uinfo |
|
12 | %tr |
|
12 | %tr |
|
13 | %th.uinfo Login |
|
13 | %th.uinfo Login |
|
14 | %td.uinfo= @user.login |
|
14 | %td.uinfo= @user.login |
|
15 | %tr |
|
15 | %tr |
|
16 | %th.uinfo Full name |
|
16 | %th.uinfo Full name |
|
17 | %td.uinfo= @user.full_name |
|
17 | %td.uinfo= @user.full_name |
|
18 | -#%tr |
|
18 | -#%tr |
|
19 | -#%th.uinfo Alias |
|
19 | -#%th.uinfo Alias |
|
20 | -#%td.uinfo= in_place_editor_field :user, 'alias_for_editing', {}, :rows => 1 |
|
20 | -#%td.uinfo= in_place_editor_field :user, 'alias_for_editing', {}, :rows => 1 |
|
21 | -#%tr |
|
21 | -#%tr |
|
22 | -#%th.uinfo E-mail |
|
22 | -#%th.uinfo E-mail |
|
23 | -#%td.uinfo= in_place_editor_field :user, 'email_for_editing', {}, :rows => 1 |
|
23 | -#%td.uinfo= in_place_editor_field :user, 'email_for_editing', {}, :rows => 1 |
|
24 | %tr |
|
24 | %tr |
|
25 | %th.uinfo Password |
|
25 | %th.uinfo Password |
|
26 | %td.uinfo |
|
26 | %td.uinfo |
|
27 |
- |
|
27 | + = form_tag :action => 'chg_passwd', :method => 'post' do |
|
28 | %table |
|
28 | %table |
|
29 | %tr |
|
29 | %tr |
|
30 | %td= password_field_tag 'passwd' |
|
30 | %td= password_field_tag 'passwd' |
|
31 | %td (new) |
|
31 | %td (new) |
|
32 | %tr |
|
32 | %tr |
|
33 | %td= password_field_tag 'passwd_verify' |
|
33 | %td= password_field_tag 'passwd_verify' |
|
34 | %td (verify) |
|
34 | %td (verify) |
|
35 | %tr |
|
35 | %tr |
|
36 | %td{:colspan => "2"} |
|
36 | %td{:colspan => "2"} |
|
37 | = submit_tag 'change password' |
|
37 | = submit_tag 'change password' |
|
38 |
|
38 |
@@ -1,39 +1,39 | |||||
|
1 | .contest-title |
|
1 | .contest-title |
|
2 | %h1 |
|
2 | %h1 |
|
3 | = "#{GraderConfiguration['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' |
|
7 |
|
7 | ||
|
8 | = error_messages_for :user, :header_message => (t 'registration.errors.header') |
|
8 | = error_messages_for :user, :header_message => (t 'registration.errors.header') |
|
9 |
|
9 | ||
|
10 | %table |
|
10 | %table |
|
11 |
- |
|
11 | + = form_for :user, @user, :url => { :action => 'register' } do |f| |
|
12 | %tr |
|
12 | %tr |
|
13 | %td{:align => "right"} |
|
13 | %td{:align => "right"} |
|
14 | = "#{t 'login_label'}:" |
|
14 | = "#{t 'login_label'}:" |
|
15 | %td= f.text_field :login |
|
15 | %td= f.text_field :login |
|
16 | %tr |
|
16 | %tr |
|
17 | %td |
|
17 | %td |
|
18 | %td |
|
18 | %td |
|
19 | %small |
|
19 | %small |
|
20 | =t 'registration.login_guide' |
|
20 | =t 'registration.login_guide' |
|
21 | %tr |
|
21 | %tr |
|
22 | %td{:align => "right"} |
|
22 | %td{:align => "right"} |
|
23 | = "#{t 'full_name_label'}:" |
|
23 | = "#{t 'full_name_label'}:" |
|
24 | %td= f.text_field :full_name |
|
24 | %td= f.text_field :full_name |
|
25 | %tr |
|
25 | %tr |
|
26 | %td{:align => "right"} |
|
26 | %td{:align => "right"} |
|
27 | = "#{t 'email_label'}:" |
|
27 | = "#{t 'email_label'}:" |
|
28 | %td= f.text_field :email |
|
28 | %td= f.text_field :email |
|
29 | %tr |
|
29 | %tr |
|
30 | %td |
|
30 | %td |
|
31 | %td |
|
31 | %td |
|
32 | %small |
|
32 | %small |
|
33 | =t 'registration.email_guide' |
|
33 | =t 'registration.email_guide' |
|
34 | %tr |
|
34 | %tr |
|
35 | %td/ |
|
35 | %td/ |
|
36 | %td |
|
36 | %td |
|
37 | = submit_tag((t 'registration.register'), :name => 'commit') |
|
37 | = submit_tag((t 'registration.register'), :name => 'commit') |
|
38 | = submit_tag((t 'cancel'), :name => 'cancel') |
|
38 | = submit_tag((t 'cancel'), :name => 'cancel') |
|
39 |
|
39 |
@@ -1,62 +1,62 | |||||
|
1 | require File.expand_path('../boot', __FILE__) |
|
1 | require File.expand_path('../boot', __FILE__) |
|
2 |
|
2 | ||
|
3 | require 'rails/all' |
|
3 | require 'rails/all' |
|
4 |
|
4 | ||
|
5 | if defined?(Bundler) |
|
5 | if defined?(Bundler) |
|
6 | # If you precompile assets before deploying to production, use this line |
|
6 | # If you precompile assets before deploying to production, use this line |
|
7 | Bundler.require(*Rails.groups(:assets => %w(development test))) |
|
7 | Bundler.require(*Rails.groups(:assets => %w(development test))) |
|
8 | # If you want your assets lazily compiled in production, use this line |
|
8 | # If you want your assets lazily compiled in production, use this line |
|
9 | # Bundler.require(:default, :assets, Rails.env) |
|
9 | # Bundler.require(:default, :assets, Rails.env) |
|
10 | end |
|
10 | end |
|
11 |
|
11 | ||
|
12 | module CafeGrader |
|
12 | module CafeGrader |
|
13 | class Application < Rails::Application |
|
13 | class Application < Rails::Application |
|
14 | # Settings in config/environments/* take precedence over those specified here. |
|
14 | # Settings in config/environments/* take precedence over those specified here. |
|
15 | # Application configuration should go into files in config/initializers |
|
15 | # Application configuration should go into files in config/initializers |
|
16 | # -- all .rb files in that directory are automatically loaded. |
|
16 | # -- all .rb files in that directory are automatically loaded. |
|
17 |
|
17 | ||
|
18 | # Custom directories with classes and modules you want to be autoloadable. |
|
18 | # Custom directories with classes and modules you want to be autoloadable. |
|
19 | # config.autoload_paths += %W(#{config.root}/extras) |
|
19 | # config.autoload_paths += %W(#{config.root}/extras) |
|
20 |
|
20 | ||
|
21 | # Only load the plugins named here, in the order given (default is alphabetical). |
|
21 | # Only load the plugins named here, in the order given (default is alphabetical). |
|
22 | # :all can be used as a placeholder for all plugins not explicitly named. |
|
22 | # :all can be used as a placeholder for all plugins not explicitly named. |
|
23 | # config.plugins = [ :exception_notification, :ssl_requirement, :all ] |
|
23 | # config.plugins = [ :exception_notification, :ssl_requirement, :all ] |
|
24 |
|
24 | ||
|
25 | # Activate observers that should always be running. |
|
25 | # Activate observers that should always be running. |
|
26 | # config.active_record.observers = :cacher, :garbage_collector, :forum_observer |
|
26 | # config.active_record.observers = :cacher, :garbage_collector, :forum_observer |
|
27 |
|
27 | ||
|
28 | # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. |
|
28 | # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. |
|
29 | # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. |
|
29 | # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. |
|
30 | config.time_zone = 'UTC' |
|
30 | config.time_zone = 'UTC' |
|
31 |
|
31 | ||
|
32 | # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. |
|
32 | # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. |
|
33 | # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] |
|
33 | # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] |
|
34 | config.i18n.default_locale = :en |
|
34 | config.i18n.default_locale = :en |
|
35 |
|
35 | ||
|
36 | # Configure the default encoding used in templates for Ruby 1.9. |
|
36 | # Configure the default encoding used in templates for Ruby 1.9. |
|
37 | config.encoding = "utf-8" |
|
37 | config.encoding = "utf-8" |
|
38 |
|
38 | ||
|
39 | # Configure sensitive parameters which will be filtered from the log file. |
|
39 | # Configure sensitive parameters which will be filtered from the log file. |
|
40 | config.filter_parameters += [:password] |
|
40 | config.filter_parameters += [:password] |
|
41 |
|
41 | ||
|
42 | # Enable escaping HTML in JSON. |
|
42 | # Enable escaping HTML in JSON. |
|
43 | config.active_support.escape_html_entities_in_json = true |
|
43 | config.active_support.escape_html_entities_in_json = true |
|
44 |
|
44 | ||
|
45 | # Use SQL instead of Active Record's schema dumper when creating the database. |
|
45 | # Use SQL instead of Active Record's schema dumper when creating the database. |
|
46 | # This is necessary if your schema can't be completely dumped by the schema dumper, |
|
46 | # This is necessary if your schema can't be completely dumped by the schema dumper, |
|
47 | # like if you have constraints or database-specific column types |
|
47 | # like if you have constraints or database-specific column types |
|
48 | # config.active_record.schema_format = :sql |
|
48 | # config.active_record.schema_format = :sql |
|
49 |
|
49 | ||
|
50 | # Enforce whitelist mode for mass assignment. |
|
50 | # Enforce whitelist mode for mass assignment. |
|
51 | # This will create an empty whitelist of attributes available for mass-assignment for all models |
|
51 | # This will create an empty whitelist of attributes available for mass-assignment for all models |
|
52 | # in your app. As such, your models will need to explicitly whitelist or blacklist accessible |
|
52 | # in your app. As such, your models will need to explicitly whitelist or blacklist accessible |
|
53 | # parameters by using an attr_accessible or attr_protected declaration. |
|
53 | # parameters by using an attr_accessible or attr_protected declaration. |
|
54 |
- config.active_record.whitelist_attributes = |
|
54 | + config.active_record.whitelist_attributes = false |
|
55 |
|
55 | ||
|
56 | # Enable the asset pipeline |
|
56 | # Enable the asset pipeline |
|
57 | config.assets.enabled = false |
|
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' |
|
61 | end |
|
61 | end |
|
62 | end |
|
62 | end |
You need to be logged in to leave comments.
Login now