Description:
merge with java
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r416:3378c5a77746 - - 24 files changed: 294 inserted, 86 deleted
@@ -0,0 +1,6 | |||||
|
|
1 | + //= require jquery | ||
|
|
2 | + //= require jquery_ujs | ||
|
|
3 | + //= require jquery.ui.all | ||
|
|
4 | + //= require jquery.ui.datepicker | ||
|
|
5 | + //= require jquery.ui.slider | ||
|
|
6 | + //= require jquery-ui-timepicker-addon |
@@ -0,0 +1,3 | |||||
|
|
1 | + # Place all the behaviors and hooks related to the matching controller here. | ||
|
|
2 | + # All this logic will automatically be available in application.js. | ||
|
|
3 | + # You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/ |
@@ -0,0 +1,3 | |||||
|
|
1 | + // Place all the styles related to the report controller here. | ||
|
|
2 | + // They will automatically be included in application.css. | ||
|
|
3 | + // You can use Sass (SCSS) here: http://sass-lang.com/ |
@@ -0,0 +1,3 | |||||
|
|
1 | + class Login < ActiveRecord::Base | ||
|
|
2 | + attr_accessible :ip_address, :logged_in_at, :user_id | ||
|
|
3 | + end |
@@ -0,0 +1,23 | |||||
|
|
1 | + | ||
|
|
2 | + = form_tag({session: :url }) do | ||
|
|
3 | + .submitbox | ||
|
|
4 | + %table | ||
|
|
5 | + %tr | ||
|
|
6 | + %td{colspan: 6, style: 'font-weight: bold'}= title | ||
|
|
7 | + %tr | ||
|
|
8 | + %td{style: 'width: 120px; font-weight: bold'}= param_text | ||
|
|
9 | + %td{align: 'right'} since: | ||
|
|
10 | + %td= text_field_tag 'since_datetime' | ||
|
|
11 | + %tr | ||
|
|
12 | + %td | ||
|
|
13 | + %td{align: 'right'} until: | ||
|
|
14 | + %td= text_field_tag 'until_datetime' | ||
|
|
15 | + %tr | ||
|
|
16 | + %td | ||
|
|
17 | + %td | ||
|
|
18 | + %td Blank mean no condition | ||
|
|
19 | + %tr | ||
|
|
20 | + %td | ||
|
|
21 | + %td | ||
|
|
22 | + %td= submit_tag 'query' | ||
|
|
23 | + |
@@ -0,0 +1,33 | |||||
|
|
1 | + - content_for :header do | ||
|
|
2 | + = javascript_include_tag 'new' | ||
|
|
3 | + | ||
|
|
4 | + %script{:type=>"text/javascript"} | ||
|
|
5 | + $(function () { | ||
|
|
6 | + $('#since_datetime').datetimepicker({ showButtonPanel: true, dateFormat: "yy-mm-dd", controlType: "slider"} ); | ||
|
|
7 | + $('#until_datetime').datetimepicker({ showButtonPanel: true, dateFormat: "yy-mm-dd", controlType: "slider"} ); | ||
|
|
8 | + }); | ||
|
|
9 | + | ||
|
|
10 | + | ||
|
|
11 | + %h1 Login status | ||
|
|
12 | + | ||
|
|
13 | + | ||
|
|
14 | + =render partial: 'report_menu' | ||
|
|
15 | + =render partial: 'date_range', locals: {param_text: 'Login date range:', title: 'Query login stat in the range' } | ||
|
|
16 | + | ||
|
|
17 | + %table.info | ||
|
|
18 | + %thead | ||
|
|
19 | + %tr.info-head | ||
|
|
20 | + %th login | ||
|
|
21 | + %th full name | ||
|
|
22 | + %th login count | ||
|
|
23 | + %th earliest | ||
|
|
24 | + %th latest | ||
|
|
25 | + %tbody | ||
|
|
26 | + - @logins.each do |l| | ||
|
|
27 | + %tr{class: cycle('info-even','info-odd')} | ||
|
|
28 | + %td= l[:login] | ||
|
|
29 | + %td= l[:full_name] | ||
|
|
30 | + %td= l[:count] | ||
|
|
31 | + %td= l[:min] ? l[:min].in_time_zone.strftime('%Y-%m-%d %H:%M') : '' | ||
|
|
32 | + %td= l[:max] ? l[:max].in_time_zone.strftime('%Y-%m-%d %H:%M') : '' | ||
|
|
33 | + |
@@ -0,0 +1,41 | |||||
|
|
1 | + - content_for :header do | ||
|
|
2 | + = javascript_include_tag 'new' | ||
|
|
3 | + | ||
|
|
4 | + %script{:type=>"text/javascript"} | ||
|
|
5 | + $(function () { | ||
|
|
6 | + $('#since_datetime').datetimepicker({ showButtonPanel: true, dateFormat: "yy-mm-dd", controlType: "slider"} ); | ||
|
|
7 | + $('#until_datetime').datetimepicker({ showButtonPanel: true, dateFormat: "yy-mm-dd", controlType: "slider"} ); | ||
|
|
8 | + }); | ||
|
|
9 | + | ||
|
|
10 | + | ||
|
|
11 | + %h1 Login status | ||
|
|
12 | + | ||
|
|
13 | + | ||
|
|
14 | + | ||
|
|
15 | + | ||
|
|
16 | + =render partial: 'report_menu' | ||
|
|
17 | + =render partial: 'date_range', locals: {param_text: 'Submission date range:', title: 'Query submission stat in the range' } | ||
|
|
18 | + | ||
|
|
19 | + %table.info | ||
|
|
20 | + %thead | ||
|
|
21 | + %tr.info-head | ||
|
|
22 | + %th login | ||
|
|
23 | + %th full name | ||
|
|
24 | + %th total submissions | ||
|
|
25 | + %th submissions | ||
|
|
26 | + %tbody | ||
|
|
27 | + - @submissions.each do |user_id,data| | ||
|
|
28 | + %tr{class: cycle('info-even','info-odd')} | ||
|
|
29 | + %td= data[:login] | ||
|
|
30 | + %td= data[:full_name] | ||
|
|
31 | + %td= data[:count] | ||
|
|
32 | + %td | ||
|
|
33 | + - data[:sub].each do |prob_id,sub_data| | ||
|
|
34 | + = "#{sub_data[:prob_name]}: [" | ||
|
|
35 | + - st = [] | ||
|
|
36 | + - sub_data[:sub_ids].each do |id| | ||
|
|
37 | + - st << link_to(id, controller: 'graders' , action: 'submission', id: id) | ||
|
|
38 | + = raw st.join ', ' | ||
|
|
39 | + = ']' | ||
|
|
40 | + %br/ | ||
|
|
41 | + |
@@ -0,0 +1,10 | |||||
|
|
1 | + class CreateLogins < ActiveRecord::Migration | ||
|
|
2 | + def change | ||
|
|
3 | + create_table :logins do |t| | ||
|
|
4 | + t.string :user_id | ||
|
|
5 | + t.string :ip_address | ||
|
|
6 | + | ||
|
|
7 | + t.timestamps | ||
|
|
8 | + end | ||
|
|
9 | + end | ||
|
|
10 | + end |
@@ -0,0 +1,5 | |||||
|
|
1 | + require 'spec_helper' | ||
|
|
2 | + | ||
|
|
3 | + describe Login do | ||
|
|
4 | + pending "add some examples to (or delete) #{__FILE__}" | ||
|
|
5 | + end |
@@ -1,6 +1,6 | |||||
|
1 | source 'https://rubygems.org' |
|
1 | source 'https://rubygems.org' |
|
2 |
|
2 | ||
|
3 |
- gem 'rails', '3.2. |
|
3 | + gem 'rails', '3.2.19' |
|
4 |
|
4 | ||
|
5 | # Bundle edge Rails instead: |
|
5 | # Bundle edge Rails instead: |
|
6 | # gem 'rails', :git => 'git://github.com/rails/rails.git' |
|
6 | # gem 'rails', :git => 'git://github.com/rails/rails.git' |
@@ -35,6 +35,12 | |||||
|
35 |
|
35 | ||
|
36 | # To use debugger |
|
36 | # To use debugger |
|
37 | # gem 'debugger' |
|
37 | # gem 'debugger' |
|
|
38 | + # | ||
|
|
39 | + | ||
|
|
40 | + gem 'jquery-rails' | ||
|
|
41 | + gem 'jquery-ui-sass-rails' | ||
|
|
42 | + gem 'jquery-timepicker-addon-rails' | ||
|
|
43 | + | ||
|
38 |
|
44 | ||
|
39 | gem "haml" |
|
45 | gem "haml" |
|
40 | gem "mail" |
|
46 | gem "mail" |
@@ -1,130 +1,146 | |||||
|
1 | GIT |
|
1 | GIT |
|
2 | remote: git://github.com/sikachu/verification.git |
|
2 | remote: git://github.com/sikachu/verification.git |
|
3 | - revision: 344ad2535da3dc9671872628ff9c79d6f59af9da |
|
3 | + revision: 76eaf51b13276ecae54bd9cd115832595d2ff56d |
|
4 | specs: |
|
4 | specs: |
|
5 | verification (1.0.3) |
|
5 | verification (1.0.3) |
|
6 |
- actionpack (>= 3.0.0, < |
|
6 | + actionpack (>= 3.0.0, < 5.0) |
|
7 |
- activesupport (>= 3.0.0, < |
|
7 | + activesupport (>= 3.0.0, < 5.0) |
|
8 |
|
8 | ||
|
9 | GEM |
|
9 | GEM |
|
10 | remote: https://rubygems.org/ |
|
10 | remote: https://rubygems.org/ |
|
11 | specs: |
|
11 | specs: |
|
12 |
- actionmailer (3.2. |
|
12 | + actionmailer (3.2.19) |
|
13 |
- actionpack (= 3.2. |
|
13 | + actionpack (= 3.2.19) |
|
14 |
- mail (~> 2. |
|
14 | + mail (~> 2.5.4) |
|
15 |
- actionpack (3.2. |
|
15 | + actionpack (3.2.19) |
|
16 |
- activemodel (= 3.2. |
|
16 | + activemodel (= 3.2.19) |
|
17 |
- activesupport (= 3.2. |
|
17 | + activesupport (= 3.2.19) |
|
18 | builder (~> 3.0.0) |
|
18 | builder (~> 3.0.0) |
|
19 | erubis (~> 2.7.0) |
|
19 | erubis (~> 2.7.0) |
|
20 | journey (~> 1.0.4) |
|
20 | journey (~> 1.0.4) |
|
21 |
- rack (~> 1.4. |
|
21 | + rack (~> 1.4.5) |
|
22 | rack-cache (~> 1.2) |
|
22 | rack-cache (~> 1.2) |
|
23 | rack-test (~> 0.6.1) |
|
23 | rack-test (~> 0.6.1) |
|
24 |
- sprockets (~> 2. |
|
24 | + sprockets (~> 2.2.1) |
|
25 |
- activemodel (3.2. |
|
25 | + activemodel (3.2.19) |
|
26 |
- activesupport (= 3.2. |
|
26 | + activesupport (= 3.2.19) |
|
27 | builder (~> 3.0.0) |
|
27 | builder (~> 3.0.0) |
|
28 |
- activerecord (3.2. |
|
28 | + activerecord (3.2.19) |
|
29 |
- activemodel (= 3.2. |
|
29 | + activemodel (= 3.2.19) |
|
30 |
- activesupport (= 3.2. |
|
30 | + activesupport (= 3.2.19) |
|
31 | arel (~> 3.0.2) |
|
31 | arel (~> 3.0.2) |
|
32 | tzinfo (~> 0.3.29) |
|
32 | tzinfo (~> 0.3.29) |
|
33 |
- activeresource (3.2. |
|
33 | + activeresource (3.2.19) |
|
34 |
- activemodel (= 3.2. |
|
34 | + activemodel (= 3.2.19) |
|
35 |
- activesupport (= 3.2. |
|
35 | + activesupport (= 3.2.19) |
|
36 |
- activesupport (3.2. |
|
36 | + activesupport (3.2.19) |
|
37 | - i18n (~> 0.6) |
|
37 | + i18n (~> 0.6, >= 0.6.4) |
|
38 | multi_json (~> 1.0) |
|
38 | multi_json (~> 1.0) |
|
39 |
- arel (3.0. |
|
39 | + arel (3.0.3) |
|
40 |
- builder (3.0. |
|
40 | + builder (3.0.4) |
|
41 | coffee-rails (3.2.2) |
|
41 | coffee-rails (3.2.2) |
|
42 | coffee-script (>= 2.2.0) |
|
42 | coffee-script (>= 2.2.0) |
|
43 | railties (~> 3.2.0) |
|
43 | railties (~> 3.2.0) |
|
44 |
- coffee-script (2. |
|
44 | + coffee-script (2.3.0) |
|
45 | coffee-script-source |
|
45 | coffee-script-source |
|
46 | execjs |
|
46 | execjs |
|
47 |
- coffee-script-source (1. |
|
47 | + coffee-script-source (1.7.1) |
|
48 |
- diff-lcs (1. |
|
48 | + diff-lcs (1.2.5) |
|
49 | dynamic_form (1.1.4) |
|
49 | dynamic_form (1.1.4) |
|
50 | erubis (2.7.0) |
|
50 | erubis (2.7.0) |
|
51 |
- execjs ( |
|
51 | + execjs (2.2.1) |
|
52 | - multi_json (~> 1.0) |
|
52 | + haml (4.0.5) |
|
53 | - haml (3.1.7) |
|
53 | + tilt |
|
54 |
- hike (1.2. |
|
54 | + hike (1.2.3) |
|
55 | - i18n (0.6.1) |
|
55 | + i18n (0.6.11) |
|
56 | in_place_editing (1.2.0) |
|
56 | in_place_editing (1.2.0) |
|
57 | journey (1.0.4) |
|
57 | journey (1.0.4) |
|
58 | - json (1.7.5) |
|
58 | + jquery-rails (3.1.1) |
|
59 | - mail (2.4.4) |
|
59 | + railties (>= 3.0, < 5.0) |
|
60 |
- |
|
60 | + thor (>= 0.14, < 2.0) |
|
|
61 | + jquery-timepicker-addon-rails (1.4.1) | ||
|
|
62 | + railties (>= 3.1) | ||
|
|
63 | + jquery-ui-rails (4.0.3) | ||
|
|
64 | + jquery-rails | ||
|
|
65 | + railties (>= 3.1.0) | ||
|
|
66 | + jquery-ui-sass-rails (4.0.3.0) | ||
|
|
67 | + jquery-rails | ||
|
|
68 | + jquery-ui-rails (= 4.0.3) | ||
|
|
69 | + railties (>= 3.1.0) | ||
|
|
70 | + json (1.8.1) | ||
|
|
71 | + mail (2.5.4) | ||
|
61 | mime-types (~> 1.16) |
|
72 | mime-types (~> 1.16) |
|
62 | treetop (~> 1.4.8) |
|
73 | treetop (~> 1.4.8) |
|
63 |
- mime-types (1.1 |
|
74 | + mime-types (1.25.1) |
|
64 |
- multi_json (1. |
|
75 | + multi_json (1.10.1) |
|
65 |
- mysql2 (0.3.1 |
|
76 | + mysql2 (0.3.16) |
|
66 |
- polyglot (0.3. |
|
77 | + polyglot (0.3.5) |
|
|
78 | + power_assert (0.1.3) | ||
|
67 | prototype-rails (3.2.1) |
|
79 | prototype-rails (3.2.1) |
|
68 | rails (~> 3.2) |
|
80 | rails (~> 3.2) |
|
69 |
- rack (1.4. |
|
81 | + rack (1.4.5) |
|
70 | rack-cache (1.2) |
|
82 | rack-cache (1.2) |
|
71 | rack (>= 0.4) |
|
83 | rack (>= 0.4) |
|
72 |
- rack-ssl (1.3. |
|
84 | + rack-ssl (1.3.4) |
|
73 | rack |
|
85 | rack |
|
74 | rack-test (0.6.2) |
|
86 | rack-test (0.6.2) |
|
75 | rack (>= 1.0) |
|
87 | rack (>= 1.0) |
|
76 |
- rails (3.2. |
|
88 | + rails (3.2.19) |
|
77 |
- actionmailer (= 3.2. |
|
89 | + actionmailer (= 3.2.19) |
|
78 |
- actionpack (= 3.2. |
|
90 | + actionpack (= 3.2.19) |
|
79 |
- activerecord (= 3.2. |
|
91 | + activerecord (= 3.2.19) |
|
80 |
- activeresource (= 3.2. |
|
92 | + activeresource (= 3.2.19) |
|
81 |
- activesupport (= 3.2. |
|
93 | + activesupport (= 3.2.19) |
|
82 | bundler (~> 1.0) |
|
94 | bundler (~> 1.0) |
|
83 |
- railties (= 3.2. |
|
95 | + railties (= 3.2.19) |
|
84 |
- railties (3.2. |
|
96 | + railties (3.2.19) |
|
85 |
- actionpack (= 3.2. |
|
97 | + actionpack (= 3.2.19) |
|
86 |
- activesupport (= 3.2. |
|
98 | + activesupport (= 3.2.19) |
|
87 | rack-ssl (~> 1.3.2) |
|
99 | rack-ssl (~> 1.3.2) |
|
88 | rake (>= 0.8.7) |
|
100 | rake (>= 0.8.7) |
|
89 | rdoc (~> 3.4) |
|
101 | rdoc (~> 3.4) |
|
90 | thor (>= 0.14.6, < 2.0) |
|
102 | thor (>= 0.14.6, < 2.0) |
|
91 |
- rake ( |
|
103 | + rake (10.3.2) |
|
92 |
- rdiscount ( |
|
104 | + rdiscount (2.1.7.1) |
|
93 | - rdoc (3.12) |
|
105 | + rdoc (3.12.2) |
|
94 | json (~> 1.4) |
|
106 | json (~> 1.4) |
|
95 | - rspec (2.11.0) |
|
107 | + rspec-collection_matchers (1.0.0) |
|
96 |
- rspec- |
|
108 | + rspec-expectations (>= 2.99.0.beta1) |
|
97 | - rspec-expectations (~> 2.11.0) |
|
109 | + rspec-core (2.99.2) |
|
98 |
- |
|
110 | + rspec-expectations (2.99.2) |
|
99 | - rspec-core (2.11.1) |
|
111 | + diff-lcs (>= 1.1.3, < 2.0) |
|
100 |
- rspec- |
|
112 | + rspec-mocks (2.99.2) |
|
101 | - diff-lcs (~> 1.1.3) |
|
113 | + rspec-rails (2.99.0) |
|
102 | - rspec-mocks (2.11.3) |
|
||
|
103 | - rspec-rails (2.11.0) |
|
||
|
104 | actionpack (>= 3.0) |
|
114 | actionpack (>= 3.0) |
|
|
115 | + activemodel (>= 3.0) | ||
|
105 | activesupport (>= 3.0) |
|
116 | activesupport (>= 3.0) |
|
106 | railties (>= 3.0) |
|
117 | railties (>= 3.0) |
|
107 | - rspec (~> 2.11.0) |
|
118 | + rspec-collection_matchers |
|
108 | - sass (3.2.1) |
|
119 | + rspec-core (~> 2.99.0) |
|
109 | - sass-rails (3.2.5) |
|
120 | + rspec-expectations (~> 2.99.0) |
|
|
121 | + rspec-mocks (~> 2.99.0) | ||
|
|
122 | + sass (3.4.1) | ||
|
|
123 | + sass-rails (3.2.6) | ||
|
110 | railties (~> 3.2.0) |
|
124 | railties (~> 3.2.0) |
|
111 | sass (>= 3.1.10) |
|
125 | sass (>= 3.1.10) |
|
112 | tilt (~> 1.3) |
|
126 | tilt (~> 1.3) |
|
113 |
- sprockets (2. |
|
127 | + sprockets (2.2.2) |
|
114 | hike (~> 1.2) |
|
128 | hike (~> 1.2) |
|
|
129 | + multi_json (~> 1.0) | ||
|
115 | rack (~> 1.0) |
|
130 | rack (~> 1.0) |
|
116 | tilt (~> 1.1, != 1.3.0) |
|
131 | tilt (~> 1.1, != 1.3.0) |
|
117 |
- test-unit ( |
|
132 | + test-unit (3.0.1) |
|
118 | - thor (0.16.0) |
|
133 | + power_assert |
|
119 |
- t |
|
134 | + thor (0.19.1) |
|
120 |
- t |
|
135 | + tilt (1.4.1) |
|
|
136 | + treetop (1.4.15) | ||
|
121 | polyglot |
|
137 | polyglot |
|
122 | polyglot (>= 0.3.1) |
|
138 | polyglot (>= 0.3.1) |
|
123 |
- tzinfo (0.3. |
|
139 | + tzinfo (0.3.41) |
|
124 |
- uglifier ( |
|
140 | + uglifier (2.5.3) |
|
125 | execjs (>= 0.3.0) |
|
141 | execjs (>= 0.3.0) |
|
126 |
- |
|
142 | + json (>= 1.8.0) |
|
127 |
- will_paginate (3.0. |
|
143 | + will_paginate (3.0.7) |
|
128 |
|
144 | ||
|
129 | PLATFORMS |
|
145 | PLATFORMS |
|
130 | ruby |
|
146 | ruby |
@@ -134,10 +150,13 | |||||
|
134 | dynamic_form |
|
150 | dynamic_form |
|
135 | haml |
|
151 | haml |
|
136 | in_place_editing |
|
152 | in_place_editing |
|
|
153 | + jquery-rails | ||
|
|
154 | + jquery-timepicker-addon-rails | ||
|
|
155 | + jquery-ui-sass-rails | ||
|
137 |
|
156 | ||
|
138 | mysql2 |
|
157 | mysql2 |
|
139 | prototype-rails |
|
158 | prototype-rails |
|
140 |
- rails (= 3.2. |
|
159 | + rails (= 3.2.19) |
|
141 | rdiscount |
|
160 | rdiscount |
|
142 | rspec-rails (~> 2.0) |
|
161 | rspec-rails (~> 2.0) |
|
143 | sass-rails (~> 3.2.3) |
|
162 | sass-rails (~> 3.2.3) |
@@ -1,3 +1,11 | |||||
|
|
1 | + | ||
|
|
2 | + @import jquery.ui.core | ||
|
|
3 | + @import jquery.ui.theme | ||
|
|
4 | + @import jquery.ui.datepicker | ||
|
|
5 | + @import jquery.ui.slider | ||
|
|
6 | + @import jquery-ui-timepicker-addon | ||
|
|
7 | + | ||
|
|
8 | + | ||
|
1 | body |
|
9 | body |
|
2 | background: white image-url("topbg.jpg") repeat-x top center |
|
10 | background: white image-url("topbg.jpg") repeat-x top center |
|
3 | font-size: 13px |
|
11 | font-size: 13px |
@@ -290,4 +298,4 | |||||
|
290 |
|
298 | ||
|
291 | h2.contest-title |
|
299 | h2.contest-title |
|
292 | margin-top: 5px |
|
300 | margin-top: 5px |
|
293 | - margin-bottom: 5px No newline at end of file |
|
301 | + margin-bottom: 5px |
@@ -22,6 +22,9 | |||||
|
22 | end |
|
22 | end |
|
23 | end |
|
23 | end |
|
24 |
|
24 | ||
|
|
25 | + #save login information | ||
|
|
26 | + Login.create(user_id: user.id, ip_address: request.remote_ip) | ||
|
|
27 | + | ||
|
25 | redirect_to :controller => 'main', :action => 'list' |
|
28 | redirect_to :controller => 'main', :action => 'list' |
|
26 | else |
|
29 | else |
|
27 | flash[:notice] = 'Wrong password' |
|
30 | flash[:notice] = 'Wrong password' |
@@ -13,6 +13,7 | |||||
|
13 | append_to menu_items, '[Problems]', 'problems', 'index' |
|
13 | append_to menu_items, '[Problems]', 'problems', 'index' |
|
14 | append_to menu_items, '[Users]', 'user_admin', 'index' |
|
14 | append_to menu_items, '[Users]', 'user_admin', 'index' |
|
15 | append_to menu_items, '[Results]', 'user_admin', 'user_stat' |
|
15 | append_to menu_items, '[Results]', 'user_admin', 'user_stat' |
|
|
16 | + append_to menu_items, '[Report]', 'report', 'login_stat' | ||
|
16 | append_to menu_items, '[Graders]', 'graders', 'list' |
|
17 | append_to menu_items, '[Graders]', 'graders', 'list' |
|
17 | append_to menu_items, '[Contests]', 'contest_management', 'index' |
|
18 | append_to menu_items, '[Contests]', 'contest_management', 'index' |
|
18 | append_to menu_items, '[Sites]', 'sites', 'index' |
|
19 | append_to menu_items, '[Sites]', 'sites', 'index' |
@@ -14,7 +14,7 | |||||
|
14 | DEFAULT_MEMORY_LIMIT = 32 |
|
14 | DEFAULT_MEMORY_LIMIT = 32 |
|
15 |
|
15 | ||
|
16 | def self.find_available_problems |
|
16 | def self.find_available_problems |
|
17 | - Problem.available.all(:order => "date_added DESC") |
|
17 | + Problem.available.all(:order => "date_added DESC, name ASC") |
|
18 | end |
|
18 | end |
|
19 |
|
19 | ||
|
20 | def self.create_from_import_form_params(params, old_problem=nil) |
|
20 | def self.create_from_import_form_params(params, old_problem=nil) |
@@ -43,6 +43,7 | |||||
|
43 | if not importer.import_from_file(import_params[:file], |
|
43 | if not importer.import_from_file(import_params[:file], |
|
44 | import_params[:time_limit], |
|
44 | import_params[:time_limit], |
|
45 | import_params[:memory_limit], |
|
45 | import_params[:memory_limit], |
|
|
46 | + import_params[:checker_name], | ||
|
46 | import_to_db) |
|
47 | import_to_db) |
|
47 | problem.errors.add_to_base('Import error.') |
|
48 | problem.errors.add_to_base('Import error.') |
|
48 | end |
|
49 | end |
@@ -90,6 +91,11 | |||||
|
90 | problem.errors.add_to_base('No testdata file.') |
|
91 | problem.errors.add_to_base('No testdata file.') |
|
91 | end |
|
92 | end |
|
92 |
|
93 | ||
|
|
94 | + checker_name = 'text' | ||
|
|
95 | + if ['text','float'].include? params[:checker] | ||
|
|
96 | + checker_name = params[:checker] | ||
|
|
97 | + end | ||
|
|
98 | + | ||
|
93 | file = params[:file] |
|
99 | file = params[:file] |
|
94 |
|
100 | ||
|
95 | if !problem.errors.empty? |
|
101 | if !problem.errors.empty? |
@@ -106,7 +112,8 | |||||
|
106 | return [{ |
|
112 | return [{ |
|
107 | :time_limit => time_limit, |
|
113 | :time_limit => time_limit, |
|
108 | :memory_limit => memory_limit, |
|
114 | :memory_limit => memory_limit, |
|
109 | - :file => file |
|
115 | + :file => file, |
|
|
116 | + :checker_name => checker_name | ||
|
110 | }, |
|
117 | }, |
|
111 | problem] |
|
118 | problem] |
|
112 | end |
|
119 | end |
@@ -1,5 +1,7 | |||||
|
1 | require 'digest/sha1' |
|
1 | require 'digest/sha1' |
|
2 | require 'net/pop' |
|
2 | require 'net/pop' |
|
|
3 | + require 'net/https' | ||
|
|
4 | + require 'net/http' | ||
|
3 | require 'json' |
|
5 | require 'json' |
|
4 |
|
6 | ||
|
5 | class User < ActiveRecord::Base |
|
7 | class User < ActiveRecord::Base |
@@ -81,7 +83,7 | |||||
|
81 | end |
|
83 | end |
|
82 | end |
|
84 | end |
|
83 |
|
85 | ||
|
84 |
- def authenticated_by_pop3?(password) |
|
86 | + def authenticated_by_pop3?(password) |
|
85 | Net::POP3.enable_ssl |
|
87 | Net::POP3.enable_ssl |
|
86 | pop = Net::POP3.new('pops.it.chula.ac.th') |
|
88 | pop = Net::POP3.new('pops.it.chula.ac.th') |
|
87 | authen = true |
|
89 | authen = true |
@@ -107,8 +109,15 | |||||
|
107 |
|
109 | ||
|
108 | #simple call |
|
110 | #simple call |
|
109 | begin |
|
111 | begin |
|
110 | - resp = Net::HTTP.post_form(url, post_args) |
|
112 | + http = Net::HTTP.new('www.cas.chula.ac.th', 443) |
|
111 | - result = JSON.parse resp.body |
|
113 | + http.use_ssl = true |
|
|
114 | + result = [ ] | ||
|
|
115 | + http.start do |http| | ||
|
|
116 | + req = Net::HTTP::Post.new('/cas/api/?q=studentAuthenticate') | ||
|
|
117 | + param = "appid=#{appid}&appsecret=#{appsecret}&username=#{login}&password=#{password}" | ||
|
|
118 | + resp = http.request(req,param) | ||
|
|
119 | + result = JSON.parse resp.body | ||
|
|
120 | + end | ||
|
112 | return true if result["type"] == "beanStudent" |
|
121 | return true if result["type"] == "beanStudent" |
|
113 | rescue |
|
122 | rescue |
|
114 | return false |
|
123 | return false |
@@ -5,7 +5,9 | |||||
|
5 | <%= stylesheet_link_tag "application", :media => "all" %> |
|
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 | + <%= content_for :header %> | ||
|
8 | <%= yield :head %> |
|
9 | <%= yield :head %> |
|
|
10 | + | ||
|
9 | </head> |
|
11 | </head> |
|
10 | <body> |
|
12 | <body> |
|
11 |
|
13 |
@@ -3,7 +3,7 | |||||
|
3 | <%= "#{problem_counter+1}" %> |
|
3 | <%= "#{problem_counter+1}" %> |
|
4 | </td> |
|
4 | </td> |
|
5 | <td> |
|
5 | <td> |
|
6 |
- <%= "#{problem.full_name} |
|
6 | + <%= "(#{problem.name}) #{problem.full_name}" %> |
|
7 | <%= link_to_description_if_any "[#{t 'main.problem_desc'}]", problem %> |
|
7 | <%= link_to_description_if_any "[#{t 'main.problem_desc'}]", problem %> |
|
8 | </td> |
|
8 | </td> |
|
9 | <td align="center"> |
|
9 | <td align="center"> |
@@ -32,6 +32,19 | |||||
|
32 | %br/ |
|
32 | %br/ |
|
33 | You may put task description in *.html for raw html |
|
33 | You may put task description in *.html for raw html |
|
34 | and *.md or *.markdown for markdown. |
|
34 | and *.md or *.markdown for markdown. |
|
|
35 | + %br/ | ||
|
|
36 | + You may also put a pdf file for the task description | ||
|
|
37 | + %tr | ||
|
|
38 | + %td Checker: | ||
|
|
39 | + %td= select_tag 'checker', options_for_select([['Text checker','text'],['Float checker','float']], 'text') | ||
|
|
40 | + %tr | ||
|
|
41 | + %td | ||
|
|
42 | + %td | ||
|
|
43 | + %span{:class => 'help'} | ||
|
|
44 | + "Text" checker checks if the text (including numbers) is the same, ignoring any whitespace | ||
|
|
45 | + %br/ | ||
|
|
46 | + "Float" checker checks if all numbers is within EPSILON error using formula |a-b| < EPSILON * max(|a|,|b|) | ||
|
|
47 | + | ||
|
35 | - if @allow_test_pair_import |
|
48 | - if @allow_test_pair_import |
|
36 | %tr |
|
49 | %tr |
|
37 | %td |
|
50 | %td |
@@ -1,4 +1,6 | |||||
|
1 | CafeGrader::Application.routes.draw do |
|
1 | CafeGrader::Application.routes.draw do |
|
|
2 | + get "report/login" | ||
|
|
3 | + | ||
|
2 | resources :contests |
|
4 | resources :contests |
|
3 |
|
5 | ||
|
4 | resources :announcements |
|
6 | resources :announcements |
@@ -11,7 +11,7 | |||||
|
11 | # |
|
11 | # |
|
12 | # 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. |
|
13 |
|
13 | ||
|
14 |
- ActiveRecord::Schema.define(:version => 2014082 |
|
14 | + ActiveRecord::Schema.define(:version => 20140826095949) do |
|
15 |
|
15 | ||
|
16 | create_table "announcements", :force => true do |t| |
|
16 | create_table "announcements", :force => true do |t| |
|
17 | t.string "author" |
|
17 | t.string "author" |
@@ -86,6 +86,13 | |||||
|
86 | t.string "common_ext" |
|
86 | t.string "common_ext" |
|
87 | end |
|
87 | end |
|
88 |
|
88 | ||
|
|
89 | + create_table "logins", :force => true do |t| | ||
|
|
90 | + t.string "user_id" | ||
|
|
91 | + t.string "ip_address" | ||
|
|
92 | + t.datetime "created_at", :null => false | ||
|
|
93 | + t.datetime "updated_at", :null => false | ||
|
|
94 | + end | ||
|
|
95 | + | ||
|
89 | create_table "messages", :force => true do |t| |
|
96 | create_table "messages", :force => true do |t| |
|
90 | t.integer "sender_id" |
|
97 | t.integer "sender_id" |
|
91 | t.integer "receiver_id" |
|
98 | t.integer "receiver_id" |
@@ -50,7 +50,7 | |||||
|
50 |
|
50 | ||
|
51 | Dir.chdir(cur_dir) |
|
51 | Dir.chdir(cur_dir) |
|
52 |
|
52 | ||
|
53 | - return output |
|
53 | + return "import CMD: #{cmd}\n" + output |
|
54 | end |
|
54 | end |
|
55 | return '' |
|
55 | return '' |
|
56 | end |
|
56 | end |
@@ -11,6 +11,7 | |||||
|
11 | def import_from_file(tempfile, |
|
11 | def import_from_file(tempfile, |
|
12 | time_limit, |
|
12 | time_limit, |
|
13 | memory_limit, |
|
13 | memory_limit, |
|
|
14 | + checker_name='text', | ||
|
14 | import_to_db=false) |
|
15 | import_to_db=false) |
|
15 |
|
16 | ||
|
16 | dirname = extract(tempfile) |
|
17 | dirname = extract(tempfile) |
@@ -19,7 +20,8 | |||||
|
19 | @log_msg = GraderScript.call_import_problem(@problem.name, |
|
20 | @log_msg = GraderScript.call_import_problem(@problem.name, |
|
20 | dirname, |
|
21 | dirname, |
|
21 | time_limit, |
|
22 | time_limit, |
|
22 |
- memory_limit |
|
23 | + memory_limit, |
|
|
24 | + checker_name) | ||
|
23 | else |
|
25 | else |
|
24 | # Import test data to test pairs. |
|
26 | # Import test data to test pairs. |
|
25 |
|
27 |
You need to be logged in to leave comments.
Login now