From b16acda21e8f44bf355ac1ea5b336ca3a99a3a78 Mon Sep 17 00:00:00 2001
From: cxt
Date: Mon, 30 Nov 2015 17:22:03 +0800
Subject: [PATCH 1/7] =?UTF-8?q?=E5=8C=BF=E8=AF=84=E7=BB=93=E6=9D=9F?=
=?UTF-8?q?=E6=B6=88=E6=81=AF=E6=9A=82=E6=97=B6=E4=B8=8D=E5=8F=91=E9=80=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
lib/tasks/homework_evaluation.rake | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/lib/tasks/homework_evaluation.rake b/lib/tasks/homework_evaluation.rake
index 6be2d6a04..456de479b 100644
--- a/lib/tasks/homework_evaluation.rake
+++ b/lib/tasks/homework_evaluation.rake
@@ -65,12 +65,12 @@ namespace :homework_evaluation do
end
homework_detail_manual.update_column('comment_status', 3)
# 匿评关闭消息通知 给所有人发
- course = homework_common.course
- course.members.each do |m|
- homework_common.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 3)
- end
+ #course = homework_common.course
+ #course.members.each do |m|
+ # homework_common.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 3)
+ #end
# 邮件通知
- Mailer.send_mail_anonymous_comment_close(homework_common).deliver
+ #Mailer.send_mail_anonymous_comment_close(homework_common).deliver
end
end
end
From 259cb67c5878e26d40d96256fc85ca7b26b24030 Mon Sep 17 00:00:00 2001
From: cxt
Date: Tue, 1 Dec 2015 09:22:01 +0800
Subject: [PATCH 2/7] =?UTF-8?q?rake=E5=91=BD=E4=BB=A4=E7=9A=84=E6=B6=88?=
=?UTF-8?q?=E6=81=AF=E9=80=9A=E7=9F=A5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
lib/tasks/delete_evalution.rake | 21 ---------------------
lib/tasks/homework_evaluation.rake | 12 ++++++------
lib/tasks/homework_publishtime.rake | 2 +-
3 files changed, 7 insertions(+), 28 deletions(-)
delete mode 100644 lib/tasks/delete_evalution.rake
diff --git a/lib/tasks/delete_evalution.rake b/lib/tasks/delete_evalution.rake
deleted file mode 100644
index 94075ae00..000000000
--- a/lib/tasks/delete_evalution.rake
+++ /dev/null
@@ -1,21 +0,0 @@
-namespace :delete_evalution do
- desc "delete evaluation"
- task :delete => :environment do
- homework = HomeworkCommon.where("id = 844").first
- homework_detail_manual = homework.homework_detail_manual
- homework_detail_manual.update_column('comment_status', 3)
- student_work_score = StudentWorksScore.where("student_work_id = 28088 and user_id = 9263").first
- student_work_score.destroy
- student_work_9203 = StudentWork.where("id = 28088").first
- student_work_9263 = StudentWork.where("homework_common_id = 844 and user_id = 9263").first
- student_work_9203.update_column("student_score",91)
- student_work_9203.update_column("final_score",91)
- student_work_9263.update_column("absence_penalty",student_work_9263.absence_penalty+homework_detail_manual.absence_penalty)
- work_ids = "(" + homework.student_works.map(&:id).join(",") + ")"
- homework.student_works.each do |student_work|
- absence_penalty_count = student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - student_work.user.student_works_scores.where("student_work_id IN #{work_ids}").count
- student_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * homework_detail_manual.absence_penalty : 0
- student_work.save
- end
- end
-end
\ No newline at end of file
diff --git a/lib/tasks/homework_evaluation.rake b/lib/tasks/homework_evaluation.rake
index 456de479b..84082eb9b 100644
--- a/lib/tasks/homework_evaluation.rake
+++ b/lib/tasks/homework_evaluation.rake
@@ -52,7 +52,7 @@ namespace :homework_evaluation do
#自动关闭匿评的任务
task :end_evaluation => :environment do
- homework_detail_manuals = HomeworkDetailManual.where("evaluation_end <= '#{Date.today}'")
+ homework_detail_manuals = HomeworkDetailManual.where("evaluation_end = '#{Date.today}'")
homework_detail_manuals.each do |homework_detail_manual|
homework_common = homework_detail_manual.homework_common
if homework_common.anonymous_comment == 0 && homework_detail_manual.comment_status == 2 #开启匿评状态才可关闭匿评
@@ -65,12 +65,12 @@ namespace :homework_evaluation do
end
homework_detail_manual.update_column('comment_status', 3)
# 匿评关闭消息通知 给所有人发
- #course = homework_common.course
- #course.members.each do |m|
- # homework_common.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 3)
- #end
+ course = homework_common.course
+ course.members.each do |m|
+ homework_common.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 3)
+ end
# 邮件通知
- #Mailer.send_mail_anonymous_comment_close(homework_common).deliver
+ Mailer.send_mail_anonymous_comment_close(homework_common).deliver
end
end
end
diff --git a/lib/tasks/homework_publishtime.rake b/lib/tasks/homework_publishtime.rake
index 8e231fafd..5eaeb37cb 100644
--- a/lib/tasks/homework_publishtime.rake
+++ b/lib/tasks/homework_publishtime.rake
@@ -22,7 +22,7 @@ namespace :homework_publishtime do
end
task :end => :environment do
- homework_commons = HomeworkCommon.where("end_time < '#{Date.today}'")
+ homework_commons = HomeworkCommon.where("end_time = '#{Date.today}'")
homework_commons.each do |homework|
if homework.anonymous_comment == 1
homework_detail_manual = homework.homework_detail_manual
From 68a29d813157db74396dbd934d92f2449361306b Mon Sep 17 00:00:00 2001
From: cxt
Date: Tue, 1 Dec 2015 15:18:14 +0800
Subject: [PATCH 3/7] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E6=8F=90=E4=BA=A4?=
=?UTF-8?q?=E4=BD=9C=E5=93=81=E5=90=8E=E5=8F=AF=E7=82=B9=E5=87=BB=E9=87=8D?=
=?UTF-8?q?=E8=AF=95=E9=87=8D=E6=96=B0=E4=B8=8A=E4=BC=A0=E4=BD=9C=E5=93=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/student_work_controller.rb | 23 ++++++++++++++++---
.../student_work/_work_information.html.erb | 3 ++-
app/views/student_work/create.js.erb | 2 +-
app/views/student_work/new.html.erb | 4 ++--
app/views/student_work/retry_work.js.erb | 2 ++
config/routes.rb | 2 ++
6 files changed, 29 insertions(+), 7 deletions(-)
create mode 100644 app/views/student_work/retry_work.js.erb
diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb
index d2aba1386..dd2a5b5fc 100644
--- a/app/controllers/student_work_controller.rb
+++ b/app/controllers/student_work_controller.rb
@@ -3,8 +3,8 @@ class StudentWorkController < ApplicationController
include StudentWorkHelper
require 'bigdecimal'
require "base64"
- before_filter :find_homework, :only => [:new, :index, :create, :student_work_absence_penalty, :absence_penalty_list, :evaluation_list, :program_test,:set_score_rule,:forbidden_anonymous_comment]
- before_filter :find_work, :only => [:edit, :update, :show, :destroy, :add_score, :praise_student_work]
+ before_filter :find_homework, :only => [:new, :index, :create, :student_work_absence_penalty, :absence_penalty_list, :evaluation_list, :program_test,:set_score_rule,:forbidden_anonymous_comment,:delete_work]
+ before_filter :find_work, :only => [:edit, :update, :show, :destroy, :add_score, :praise_student_work,:retry_work]
before_filter :member_of_course, :only => [:index, :new, :create, :show, :add_score, :praise_student_work]
before_filter :author_of_work, :only => [:edit, :update, :destroy]
before_filter :teacher_of_course, :only => [:student_work_absence_penalty, :absence_penalty_list, :evaluation_list, :set_score_rule, :forbidden_anonymous_comment]
@@ -222,7 +222,7 @@ class StudentWorkController < ApplicationController
def edit
@user = User.current
- if !User.current.admin? && @homework.homework_type == 2 #编程作业不能修改作业
+ if (!User.current.admin? && @homework.homework_type == 2) || Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") #编程作业不能修改作业|| 截止日期已到不能修改作业
render_403
else
respond_to do |format|
@@ -284,6 +284,23 @@ class StudentWorkController < ApplicationController
end
end
+ def delete_work
+ @work = StudentWork.where("user_id =? and homework_common_id =?", User.current.id, @homework.id).first
+ if @work
+ @work.destroy
+ end
+ redirect_to user_homeworks_user_path(User.current.id)
+ end
+
+ def retry_work
+ if @work.destroy
+ @student_work = StudentWork.new
+ respond_to do |format|
+ format.js
+ end
+ end
+ end
+
#添加评分,已评分则为修改评分
def add_score
@is_last = params[:is_last] == "true"
diff --git a/app/views/student_work/_work_information.html.erb b/app/views/student_work/_work_information.html.erb
index f8a55a03d..90d749af1 100644
--- a/app/views/student_work/_work_information.html.erb
+++ b/app/views/student_work/_work_information.html.erb
@@ -19,9 +19,10 @@
-
+
确 定
+ <%= link_to("重试", retry_work_student_work_path(@student_work.id),:class => "tijiao",:style =>"margin-bottom: 15px;margin-top:15px;",:remote => true)%>
diff --git a/app/views/student_work/create.js.erb b/app/views/student_work/create.js.erb
index afd8617aa..67a1ccb50 100644
--- a/app/views/student_work/create.js.erb
+++ b/app/views/student_work/create.js.erb
@@ -11,7 +11,7 @@
showModal('ajax-modal', '500px');
$('#ajax-modal').siblings().remove();
$('#ajax-modal').before("" +
- "");
+ "");
$('#ajax-modal').parent().css("top","").css("left","");
$('#ajax-modal').parent().addClass("anonymos");
<% else %>
diff --git a/app/views/student_work/new.html.erb b/app/views/student_work/new.html.erb
index 4f9999277..45c26654e 100644
--- a/app/views/student_work/new.html.erb
+++ b/app/views/student_work/new.html.erb
@@ -111,9 +111,9 @@
-
确定
+
提交
或
- <%= link_to "取消", user_homeworks_user_path(User.current.id), :class => "fr mr10 mt3"%>
+ <%= link_to "取消", delete_work_student_work_index_path(:homework =>@homework.id), :class => "fr mr10 mt3"%>
<% end%>
diff --git a/app/views/student_work/retry_work.js.erb b/app/views/student_work/retry_work.js.erb
new file mode 100644
index 000000000..c5fca76d4
--- /dev/null
+++ b/app/views/student_work/retry_work.js.erb
@@ -0,0 +1,2 @@
+hideModal('#popbox02');
+$("#homework_attachments").html("<%= escape_javascript(render :partial => 'users/user_homework_attachment', :locals => {:container => @student_work, :has_program=>false})%>");
\ No newline at end of file
diff --git a/config/routes.rb b/config/routes.rb
index bfe62bc3f..f6fe95a33 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -206,11 +206,13 @@ RedmineApp::Application.routes.draw do
resources :student_work do
member do
post 'add_score'
+ get 'retry_work'
get 'praise_student_work'
get 'forbidden_anonymous_comment'
end
collection do
post 'add_score_reply'
+ get 'delete_work'
get 'destroy_score_reply'
get 'student_work_absence_penalty'
get 'absence_penalty_list'
From 77e96af78f042e01f5f8ee4c77ed40bdf72f73c8 Mon Sep 17 00:00:00 2001
From: cxt
Date: Thu, 3 Dec 2015 10:41:27 +0800
Subject: [PATCH 4/7] =?UTF-8?q?=E8=BF=98=E5=8E=9F=E5=88=86=E7=BB=84?=
=?UTF-8?q?=E4=BD=9C=E4=B8=9A?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/words_controller.rb | 2 +
app/models/attachment.rb | 2 +-
app/models/course.rb | 2 +-
app/models/project.rb | 2 +-
app/models/user.rb | 4 +-
app/views/student_work/new.html.erb | 2 +-
app/views/users/_user_homework_form.html.erb | 2 +-
app/views/users/_user_message_course.html.erb | 8 +--
config/application.rb | 2 +-
db/schema.rb | 56 ++++++++++--------
public/images/course/hwork_icon.png | Bin 0 -> 4494 bytes
public/images/course/right-arrow.png | Bin 0 -> 1325 bytes
public/javascripts/homework.js | 4 +-
public/stylesheets/courses.css | 18 +++++-
public/stylesheets/new_user.css | 16 +++++
15 files changed, 79 insertions(+), 41 deletions(-)
create mode 100644 public/images/course/hwork_icon.png
create mode 100644 public/images/course/right-arrow.png
diff --git a/app/controllers/words_controller.rb b/app/controllers/words_controller.rb
index 6cc622c49..c9c4dcce3 100644
--- a/app/controllers/words_controller.rb
+++ b/app/controllers/words_controller.rb
@@ -3,6 +3,8 @@
class WordsController < ApplicationController
include ApplicationHelper
before_filter :find_user, :only => [:new, :create, :destroy, :more, :back]
+ before_filter :require_login, :only => [:create_reply]
+
def create
if params[:new_form][:user_message].size>0 && User.current.logged?
unless params[:user_id].nil?
diff --git a/app/models/attachment.rb b/app/models/attachment.rb
index aa436965b..999cefdaa 100644
--- a/app/models/attachment.rb
+++ b/app/models/attachment.rb
@@ -43,7 +43,7 @@ class Attachment < ActiveRecord::Base
#elasticsearch kaminari init
Kaminari::Hooks.init
Elasticsearch::Model::Response::Response.__send__ :include, Elasticsearch::Model::Response::Pagination::Kaminari
- settings index: { number_of_shards: 1 } do
+ settings index: { number_of_shards: 5 } do
mappings dynamic: 'false' do
indexes :filename, analyzer: 'smartcn',index_options: 'offsets'
indexes :downloads, analyzer: 'smartcn',index_options: 'offsets'
diff --git a/app/models/course.rb b/app/models/course.rb
index edc5e105b..30a6bb439 100644
--- a/app/models/course.rb
+++ b/app/models/course.rb
@@ -12,7 +12,7 @@ class Course < ActiveRecord::Base
#elasticsearch kaminari init
Kaminari::Hooks.init
Elasticsearch::Model::Response::Response.__send__ :include, Elasticsearch::Model::Response::Pagination::Kaminari
- settings index: { number_of_shards: 1 } do
+ settings index: { number_of_shards: 5 } do
mappings dynamic: 'false' do
indexes :name, analyzer: 'smartcn',index_options: 'offsets'
indexes :description, analyzer: 'smartcn',index_options: 'offsets'
diff --git a/app/models/project.rb b/app/models/project.rb
index c68e73369..ff546e098 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -35,7 +35,7 @@ class Project < ActiveRecord::Base
#elasticsearch kaminari init
Kaminari::Hooks.init
Elasticsearch::Model::Response::Response.__send__ :include, Elasticsearch::Model::Response::Pagination::Kaminari
- settings index: { number_of_shards: 1 } do
+ settings index: { number_of_shards: 5 } do
mappings dynamic: 'false' do
indexes :name, analyzer: 'smartcn',index_options: 'offsets'
indexes :description, analyzer: 'smartcn',index_options: 'offsets'
diff --git a/app/models/user.rb b/app/models/user.rb
index cdec39a3d..9c437a186 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -30,7 +30,7 @@ class User < Principal
#elasticsearch kaminari init
Kaminari::Hooks.init
Elasticsearch::Model::Response::Response.__send__ :include, Elasticsearch::Model::Response::Pagination::Kaminari
- settings index: { number_of_shards: 1 } do
+ settings index: { number_of_shards: 5 } do
mappings dynamic: 'false' do
indexes :login, analyzer: 'smartcn',index_options: 'offsets'
indexes :firstname, analyzer: 'smartcn',index_options: 'offsets'
@@ -477,7 +477,7 @@ class User < Principal
end
if user
# user is already in local database
- #return nil unless user.active?
+ return nil if user.locked?
return nil unless user.check_password?(password)
else
# user is not yet registered, try to authenticate with available sources
diff --git a/app/views/student_work/new.html.erb b/app/views/student_work/new.html.erb
index 45c26654e..ee0dd7e9b 100644
--- a/app/views/student_work/new.html.erb
+++ b/app/views/student_work/new.html.erb
@@ -99,7 +99,7 @@
diff --git a/app/views/users/_user_homework_form.html.erb b/app/views/users/_user_homework_form.html.erb
index efaed2d9d..cfc098645 100644
--- a/app/views/users/_user_homework_form.html.erb
+++ b/app/views/users/_user_homework_form.html.erb
@@ -97,7 +97,7 @@
-
+
diff --git a/app/views/users/_user_message_course.html.erb b/app/views/users/_user_message_course.html.erb
index c2b1b509f..6e8fda92e 100644
--- a/app/views/users/_user_message_course.html.erb
+++ b/app/views/users/_user_message_course.html.erb
@@ -126,7 +126,7 @@
<% end %>
- 截止时间快到了!
+ 截止时间快到啦
<%= time_tag(ma.created_at).html_safe %>
<% end %>
@@ -158,7 +158,7 @@
匿评截止:<%= ma.course_message.homework_detail_manual.evaluation_end %> 23:59
<% unless User.current.allowed_to?(:as_teacher, ma.course_message.course)%>
- 请您尽早完成匿评!如果您在截止日期前未完成匿评,您的最终成绩将被扣除<%= ma.course_message.homework_detail_manual.absence_penalty %>分乘以缺评份数。
+ 请您尽早完成匿评,如果您在截止日期前未完成匿评,您的最终成绩将被扣除<%= ma.course_message.homework_detail_manual.absence_penalty %>分乘以缺评份数。
例如,您缺评了两份作品,则您的最终成绩将被扣除 <%= ma.course_message.homework_detail_manual.absence_penalty %> * 2 = <%= ma.course_message.homework_detail_manual.absence_penalty * 2 %>分
<% end%>
@@ -209,7 +209,7 @@
<%= User.current.lastname + User.current.firstname %><%= User.current.allowed_to?(:as_teacher, ma.course_message.course) ? '老师':'同学'%>您好!
- <%= User.current.eql?(ma.course_message.user) ?"您":(ma.course_message.user.lastname + ma.course_message.user.firstname + "老师") %>启动作业匿评失败!
+ <%= User.current.eql?(ma.course_message.user) ?"您":(ma.course_message.user.lastname + ma.course_message.user.firstname + "老师") %>启动作业匿评失败啦
如需获得最终成绩,请您联系主讲老师对您的作品进行单独评分!
- 您迟交了作品!
+ 您成功提交了作品(但被标记为迟交啦)
<%= time_tag(ma.created_at).html_safe %>
<% end %>
diff --git a/config/application.rb b/config/application.rb
index 61f73ee3d..9e6d41abe 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -80,7 +80,7 @@ module RedmineApp
elsif RbConfig::CONFIG['target_os'] == 'linux' && ["testtrustie11","agent12"].include?(`hostname`.gsub("\n",""))
Elasticsearch::Client.new hosts: ['localhost:9200','192.168.80.11:9200','192.168.80.12:9200'], retry_on_failure: true
elsif RbConfig::CONFIG['target_os'] == 'linux' && ["trustie168","trustieserver14","trustieserver16","Trustie18"].include?(`hostname`.gsub("\n",""))
- Elasticsearch::Client.new hosts: ['localhost:9200','192.168.80.168:9200','192.168.80.14:9200','192.168.80.16:9200','192.168.80.18:9200'], retry_on_failure: true
+ Elasticsearch::Client.new hosts: ['localhost:9200','192.168.80.168:9200'], retry_on_failure: true
else
Elasticsearch::Client.new hosts: ['localhost:9200'], retry_on_failure: true
end
diff --git a/db/schema.rb b/db/schema.rb
index c6ca6a0ce..442ceaab9 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20151130033906) do
+ActiveRecord::Schema.define(:version => 20151202064455) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
@@ -543,23 +543,26 @@ ActiveRecord::Schema.define(:version => 20151130033906) do
add_index "documents", ["created_on"], :name => "index_documents_on_created_on"
add_index "documents", ["project_id"], :name => "documents_project_id"
- create_table "dts", :force => true do |t|
- t.string "IPLineCode"
- t.string "Description"
- t.string "Num"
- t.string "Variable"
- t.string "TraceInfo"
- t.string "Method"
+ create_table "dts", :primary_key => "Num", :force => true do |t|
+ t.string "Defect", :limit => 50
+ t.string "Category", :limit => 50
t.string "File"
- t.string "IPLine"
- t.string "Review"
- t.string "Category"
- t.string "Defect"
- t.string "PreConditions"
- t.string "StartLine"
+ t.string "Method"
+ t.string "Module", :limit => 20
+ t.string "Variable", :limit => 50
+ t.integer "StartLine"
+ t.integer "IPLine"
+ t.string "IPLineCode", :limit => 200
+ t.string "Judge", :limit => 15
+ t.integer "Review", :limit => 1
+ t.string "Description"
+ t.text "PreConditions", :limit => 2147483647
+ t.text "TraceInfo", :limit => 2147483647
+ t.text "Code", :limit => 2147483647
t.integer "project_id"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.integer "id", :null => false
end
create_table "enabled_modules", :force => true do |t|
@@ -735,6 +738,17 @@ ActiveRecord::Schema.define(:version => 20151130033906) do
add_index "homework_commons", ["course_id", "id"], :name => "index_homework_commons_on_course_id_and_id"
+ create_table "homework_detail_groups", :force => true do |t|
+ t.integer "homework_common_id"
+ t.integer "min_num"
+ t.integer "max_num"
+ t.integer "base_on_project"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
+ end
+
+ add_index "homework_detail_groups", ["homework_common_id"], :name => "index_homework_detail_groups_on_homework_common_id"
+
create_table "homework_detail_manuals", :force => true do |t|
t.float "ta_proportion"
t.integer "comment_status"
@@ -891,16 +905,6 @@ ActiveRecord::Schema.define(:version => 20151130033906) do
add_index "journal_details", ["journal_id"], :name => "journal_details_journal_id"
- create_table "journal_details_copy", :force => true do |t|
- t.integer "journal_id", :default => 0, :null => false
- t.string "property", :limit => 30, :default => "", :null => false
- t.string "prop_key", :limit => 30, :default => "", :null => false
- t.text "old_value"
- t.text "value"
- end
-
- add_index "journal_details_copy", ["journal_id"], :name => "journal_details_journal_id"
-
create_table "journal_replies", :id => false, :force => true do |t|
t.integer "journal_id"
t.integer "user_id"
diff --git a/public/images/course/hwork_icon.png b/public/images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te
z>s+7CyvrzfNn3x;Aq{O{uD*X7W@xmR>RKG43mZ5=8)n#NvB{~;6p(zcTFnDJjR4P1
zyi|Z{Mk|O6I=aPBST!#zU}eRpn_5n_fs59bJ_irivf$;l4+v!{N`HOFE_}d-WH<}lCu$?yITf1)0Vbwl;R#foTy{ueQzanEf
zE*CLN@f>&Oh|u7X#TIusH}nrXywgD`g}e>v_Y90fD=7&r=`qt@Z1fm0>KwzHOdm9t
z`@lhCcO@hq%3OvBc~1%#YF^<-*+-tux|mP~{3-pjG!9&eDQr^=hBq|fGZ=4E>EX~r
z8PlZTb>2dYDC6tOHMn|F%<#K^-}rXg;{V#r{oidJLMHRSzvKJfdcQX2@9p^i5zEfE
m&`vo2Zj1TMe#_y~E}nVbXZnw;Ok{WdkeHw_$U?-0EB^qHH0+cB
literal 0
HcmV?d00001
diff --git a/public/images/course/right-arrow.png b/public/images/course/right-arrow.png
new file mode 100644
index 0000000000000000000000000000000000000000..b152e9ce9f65165d57377cb50087c2a5ede4f311
GIT binary patch
literal 1325
zcmeAS@N?(olHy`uVBq!ia0vp^0zfRs!3HE%f6fyGQj#UE5hcO-X(i=}MX3yqDfvmM
z3ZA)%>8U}fi7AzZCsS=07?=ezLn2Bde0{8v^Kf6`()~Xj@TAnpKdC8`Lf!&sHg;q@=(~U%$M(
zT(8_%FTW^V-_X+15@d#vkuFe$ZgFK^Nn(X=Ua>OF1ees}t-3#_`hBq$Z(46Le)Ln;eW^@CE2
z^Gl18f$@>14ATq@JNy=b6armi<&vLVnwy$e;^|_m1QgLr$xN{_cXl-~GjTJuw6HWb
zG;}q!Ff(&@c6KqcGGjMjE=kNwPKD{sMCdiatJli8C^fMpzbGU>KL-|j
z0U7xv`NbLe1q#l=W(wh%c`5nj#h`$Nx-+#Xvn(~mttdZN0UR<`nMk&~S{j>}nz*=`
z7`Pc5I~h1TyBfQhIGI?w8oC&onV7gKLG`2{`Iev_eW2y~plC#jR+tblt$>*DL<;1<
zlX+?$Fl`qB6Y-fD5;+VEjGH}O978H@EtzWT&Fm=9_T7n#Q-hJUHR4#kg4v>04y79^
zT}g{rnmZB_pP%0#?DB~HQM$0SD@$NN&Xr3>Ym*kX%+U~YstJ3iBDcMGr^SbqzLfjr
z<>}wmrsdxD_gd*aqxpN*)>S1D)0V#K?Pd)LL6QkIJ;0Vw8o9DLV^Ga-RJyqPAdvMA0kd`GcmEIn<>CbQS?3X*9
zJpHA}mXka?b*?OlzAqd$dyCf8uFL?wu!ScpS|*-wp2Gih-=TR+SN)H98W=GxE&XTt
zk}3C1<(j`Xn17Pnv}V&2Q;FxNogDmkq<+)c`Q+{)lSjUuJs;X;EsZT)>&UlpU4@T8
z{A9HU7o(3vMoc_%L^Ng3Bl+ZAMKfq
ew!is*#1a_(E}x^jPDLDCf_b|7xvX
Date: Thu, 3 Dec 2015 18:33:08 +0800
Subject: [PATCH 5/7] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BF=AE=E8=AE=A2?=
=?UTF-8?q?=E9=99=84=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../student_work/_revise_attachments.html.erb | 30 +++++++++++++++++++
app/views/student_work/_show.html.erb | 25 ++++++++++++++++
.../20151203030635_add_attachment_type.rb | 9 ++++++
db/schema.rb | 2 +-
public/stylesheets/courses.css | 5 ++++
5 files changed, 70 insertions(+), 1 deletion(-)
create mode 100644 app/views/student_work/_revise_attachments.html.erb
create mode 100644 db/migrate/20151203030635_add_attachment_type.rb
diff --git a/app/views/student_work/_revise_attachments.html.erb b/app/views/student_work/_revise_attachments.html.erb
new file mode 100644
index 000000000..1321da368
--- /dev/null
+++ b/app/views/student_work/_revise_attachments.html.erb
@@ -0,0 +1,30 @@
+
+
+
+ 上传附件
+ <%#= button_tag "上传附件", :type=>"button", :onclick=>"$('#_file#{work.id}').click();",:onmouseover => 'this.focus()',:class => 'blueCir ml5' %>
+ <%= file_field_tag 'attachments[dummy][file]',
+ :id => "_file#{work.id}",
+ :class => 'file_selector',
+ :multiple => true,
+ :onchange => "addReviseFiles(this, '#{work.id}');",
+ :style => 'display:none',
+ :data => {
+ :max_file_size => Setting.attachment_max_size.to_i.kilobytes,
+ :max_file_size_message => l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)),
+ :max_concurrent_uploads => Redmine::Configuration['max_concurrent_ajax_uploads'].to_i,
+ :upload_path => uploads_path(:format => 'js'),
+ :description_placeholder => l(:label_optional_description),
+ :field_is_public => l(:field_is_public),
+ :are_you_sure => l(:text_are_you_sure),
+ :file_count => l(:label_file_count),
+ :lebel_file_uploding => l(:lebel_file_uploding),
+ :delete_all_files => l(:text_are_you_sure_all),
+ :containerid => "#{work.id}"
+ } %>
+
+ <% content_for :header_tags do %>
+ <%= javascript_include_tag 'attachments' %>
+ <% end %>
+
+
diff --git a/app/views/student_work/_show.html.erb b/app/views/student_work/_show.html.erb
index 1b0202536..894f9fb39 100644
--- a/app/views/student_work/_show.html.erb
+++ b/app/views/student_work/_show.html.erb
@@ -61,6 +61,31 @@
+
+ <%#= text_field_tag("attachments[p#{i}][filename]", attachment.filename, :class => 'filename link_file', :readonly=>'readonly')%>
+ <%#= text_field_tag("attachments[p#{i}][description]", attachment.description, :maxlength => 254, :placeholder => l(:label_optional_description), :class => 'description', :style=>"display: inline-block;") %>
+
+ <%#= check_box_tag("attachments[p#{i}][is_public_checkbox]", attachment.is_public,attachment.is_public == 1 ? true : false,:class => 'is_public')%>
+ <%#= link_to(' '.html_safe, attachment_path(attachment, :attachment_id => "p#{i}", :format => 'js'), :method => 'delete', :remote => true, :class => 'remove-upload') unless attachment.id.nil? %>
+ <%#= hidden_field_tag "attachments[p#{i}][token]", "#{attachment.token}" %>
+
+
<%student_work_scores.each do |student_score|%>
diff --git a/db/migrate/20151203030635_add_attachment_type.rb b/db/migrate/20151203030635_add_attachment_type.rb
new file mode 100644
index 000000000..2c41aa5f2
--- /dev/null
+++ b/db/migrate/20151203030635_add_attachment_type.rb
@@ -0,0 +1,9 @@
+# encoding: utf-8
+class AddAttachmentType < ActiveRecord::Migration
+ def up
+ Attachmentstype.create(typeId:3,typeName:'修订附件')
+ end
+
+ def down
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 442ceaab9..a7e3224d2 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20151202064455) do
+ActiveRecord::Schema.define(:version => 20151203030635) do
create_table "activities", :force => true do |t|
t.integer "act_id", :null => false
diff --git a/public/stylesheets/courses.css b/public/stylesheets/courses.css
index 57838bdba..584a49a4f 100644
--- a/public/stylesheets/courses.css
+++ b/public/stylesheets/courses.css
@@ -1192,3 +1192,8 @@ a:hover.memberBtn{background: url(/images/course/hwork_icon.png) -80px -90px no-
.addMemberCP {width:514px; height:auto; border:3px solid #269ac9; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:absolute; z-index:1000;}
.rightArrow {margin:50px 15px 0px 15px; float:left;}
.relateText {font-size:16px; color:#269ac9; line-height:16px; padding-top:20px; display:inline-block; font-weight: bold;}
+
+.resubAtt {border-top:1px solid #dddddd; position:relative; margin-top:15px;}
+.resubTitle {position:absolute; top:-10px; left:5px; background-color:#ffffff; display:block; font-weight:bold; padding:0px 2px;}
+a.blueCir{ display:inline-block; padding:2px 5px; background-color:#ffffff;border:1px solid #3598db; color:#3598db; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px;}
+a:hover.blueCir{ background:#3598db; color:#fff;}
From 838140ada86ec067f2df122edc0441c90b7ba016 Mon Sep 17 00:00:00 2001
From: cxt
Date: Thu, 3 Dec 2015 19:08:15 +0800
Subject: [PATCH 6/7] =?UTF-8?q?=E5=9C=A8=E7=BA=BF=E6=B5=8B=E9=AA=8C?=
=?UTF-8?q?=E7=9A=84=E8=87=AA=E5=8A=A8=E5=8F=91=E5=B8=83=E5=92=8C=E6=88=AA?=
=?UTF-8?q?=E6=AD=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/exercise_controller.rb | 16 ++++++++++++++++
lib/tasks/exercise_publish.rake | 18 ++++++++++++++++++
2 files changed, 34 insertions(+)
create mode 100644 lib/tasks/exercise_publish.rake
diff --git a/app/controllers/exercise_controller.rb b/app/controllers/exercise_controller.rb
index 6d6d429b6..0c794fe33 100644
--- a/app/controllers/exercise_controller.rb
+++ b/app/controllers/exercise_controller.rb
@@ -6,6 +6,14 @@ class ExerciseController < ApplicationController
include ExerciseHelper
def index
+ publish_exercises = Exercise.where("publish_time is not null and exercise_status = 1 and publish_time <=?",Time.now)
+ publish_exercises.each do |exercise|
+ exercise.update_column('exercise_status', 2)
+ end
+ end_exercises = Exercise.where("end_time <=? and exercise_status = 2",Time.now)
+ end_exercises.each do |exercise|
+ exercise.update_column('exercise_status', 3)
+ end
if @course.is_public == 0 && !User.current.member_of_course?(@course)
render_403
return
@@ -24,6 +32,14 @@ class ExerciseController < ApplicationController
end
def show
+ publish_exercises = Exercise.where("publish_time is not null and exercise_status = 1 and publish_time <=?",Time.now)
+ publish_exercises.each do |exercise|
+ exercise.update_column('exercise_status', 2)
+ end
+ end_exercises = Exercise.where("end_time <=? and exercise_status = 2",Time.now)
+ end_exercises.each do |exercise|
+ exercise.update_column('exercise_status', 3)
+ end
unless User.current.member_of_course?(@course)
render_403
return
diff --git a/lib/tasks/exercise_publish.rake b/lib/tasks/exercise_publish.rake
new file mode 100644
index 000000000..aacd67c1f
--- /dev/null
+++ b/lib/tasks/exercise_publish.rake
@@ -0,0 +1,18 @@
+#coding=utf-8
+
+namespace :exercise_publish do
+ desc "publish exercise and end exercise"
+ task :publish => :environment do
+ exercises = Exercise.where("publish_time is not null and exercise_status = 1 and publish_time <=?",Time.now)
+ exercises.each do |exercise|
+ exercise.update_column('exercise_status', 2)
+ end
+ end
+
+ task :end => :environment do
+ exercises = Exercise.where("end_time <=? and exercise_status = 2",Time.now)
+ exercises.each do |exercise|
+ exercise.update_column('exercise_status', 3)
+ end
+ end
+end
From 4e9e7543baa592c5f2704c7195539a43a5051852 Mon Sep 17 00:00:00 2001
From: cxt
Date: Thu, 3 Dec 2015 19:21:35 +0800
Subject: [PATCH 7/7] =?UTF-8?q?chrome=E6=B5=8F=E8=A7=88=E5=99=A8=E7=82=B9?=
=?UTF-8?q?=E5=87=BB=E4=BF=9D=E5=AD=98=E6=B5=8B=E9=AA=8C=E5=A4=B4=E9=83=A8?=
=?UTF-8?q?=E4=BF=A1=E6=81=AF=E6=97=A0=E5=8F=8D=E5=BA=94?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/exercise/_edit_head.html.erb | 1 -
1 file changed, 1 deletion(-)
diff --git a/app/views/exercise/_edit_head.html.erb b/app/views/exercise/_edit_head.html.erb
index 64f34b5aa..a071904ce 100644
--- a/app/views/exercise/_edit_head.html.erb
+++ b/app/views/exercise/_edit_head.html.erb
@@ -35,6 +35,5 @@
$("#exercise_time").val("<%=exercise.time if exercise.time!= -1 %>");
$("#exercise_publish_time").val("<%= Time.parse(format_time(exercise.publish_time)).strftime("%Y-%m-%d") if !exercise.publish_time.nil?%>");
/*$("#exercise_description").text("<%#=exercise.exercise_description.html_safe %>");*/
- document.getElementById("exercise_description").innerHTML = <%=exercise.exercise_description.html_safe %>;
}
\ No newline at end of file