diff --git a/app/controllers/system_messages_controller.rb b/app/controllers/system_messages_controller.rb
index 2697f17b5..66ec6c2d7 100644
--- a/app/controllers/system_messages_controller.rb
+++ b/app/controllers/system_messages_controller.rb
@@ -14,8 +14,7 @@ class SystemMessagesController < ApplicationController
# end
def index
- render_403
- # @system_messages = SystemMessage.all
+ @system_messages = SystemMessage.all
end
# def show
@@ -39,7 +38,8 @@ class SystemMessagesController < ApplicationController
return
end
@system_messages = SystemMessage.new
- @system_messages.description = params[:system_messages][:description]
+ @system_messages.description = params[:system_message][:description]
+ @system_messages.subject = params[:system_message][:subject]
@system_messages.user_id = User.current.id
respond_to do |format|
if @system_messages.save
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index c88ceb299..c9253ad59 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -46,7 +46,7 @@ class UsersController < ApplicationController
:activity_score_index, :influence_score_index, :score_index,:show_new_score, :topic_new_score_index, :project_new_score_index,
:activity_new_score_index, :influence_new_score_index, :score_new_index,:user_projects_index,:user_resource,
:user_courses4show,:user_projects4show,:user_course_activities,:user_project_activities,:user_feedback4show,:user_visitorlist,:user_messages,:edit_brief_introduction,
- :user_import_homeworks,:user_search_homeworks,:user_import_resource, :system_messages]
+ :user_import_homeworks,:user_search_homeworks,:user_import_resource, :user_system_messages]
before_filter :auth_user_extension, only: :show
#before_filter :rest_user_score, only: :show
#before_filter :select_entry, only: :user_projects
@@ -201,7 +201,7 @@ class UsersController < ApplicationController
end
# 系统消息
- def system_messages
+ def user_system_messages
@sytem_messages = SystemMessage.order("created_at desc").all
@sytem_messages = paginateHelper @sytem_messages,25
respond_to do |format|
diff --git a/app/models/mailer.rb b/app/models/mailer.rb
index c2b66f2a5..931e2dbf0 100644
--- a/app/models/mailer.rb
+++ b/app/models/mailer.rb
@@ -207,6 +207,47 @@ class Mailer < ActionMailer::Base
mail :to => user.mail,:subject => subject if has_content
end
+ # 作业截止时间邮件提醒
+ def homework_endtime__added(homework_common, course)
+ # modify by nwb
+ #如果是直接留言并且留言对象是课程
+ if !journals_for_message.at_user && journals_for_message.jour.class.to_s.to_sym == :Course
+
+ @author = journals_for_message.user
+ #课程的教师
+ @members = course_all_member journals_for_message.jour
+
+
+ #收件人邮箱
+ students = course.student
+ recipients ||= []
+ students.each do |students|
+ recipients << recipients.user.mail
+ end
+ mail :to => @recipients,
+ :subject => "#{l(:label_your_course)}#{journals_for_message.jour.name}#{l(:label_have_message)} ",
+ :filter => true
+ # elsif journals_for_message.jour.class.to_s.to_sym == :Bid
+ # if !journals_for_message.jour.author.notify_about? journals_for_message
+ # return -1
+ # end
+ #
+ # mail :to => recipients, :subject => @title,:filter => true
+ elsif journals_for_message.jour.class.to_s.to_sym == :Contest
+ if !journals_for_message.jour.author.notify_about? journals_for_message
+ return -1
+ end
+ mail :to => recipients, :subject => @title,:filter => true
+ else
+ mail :to => recipients1, :subject => @title,:filter => true
+ end
+ recipients ||= []
+ # 将帖子创建者邮箱地址加入数组
+ recipients << course.student
+ # 回复人邮箱地址加入数组
+ recipients << @author.mail
+ end
+
# 公共讨论区发帖、回帖添加邮件发送信息
def forum_message_added(memo)
@memo = memo
diff --git a/app/models/system_message.rb b/app/models/system_message.rb
index 3430bea5f..2a810e8b8 100644
--- a/app/models/system_message.rb
+++ b/app/models/system_message.rb
@@ -1,7 +1,8 @@
class SystemMessage < ActiveRecord::Base
- attr_accessible :content, :id, :user_id, :description
+ attr_accessible :content, :id, :user_id, :description, :subject
belongs_to :user
- validates :description, presence: true
+ validates :subject, presence: true
+ # validates :description, presence: true
validates_length_of :description, maximum: 10000
end
diff --git a/app/views/admin/messages.html.erb b/app/views/admin/messages.html.erb
index 26a54d647..5e49822ad 100644
--- a/app/views/admin/messages.html.erb
+++ b/app/views/admin/messages.html.erb
@@ -4,6 +4,9 @@