parent
7a014e1f79
commit
d00ad2e14d
|
@ -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,7 @@ 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.user_id = User.current.id
|
||||
respond_to do |format|
|
||||
if @system_messages.save
|
||||
|
|
|
@ -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|
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
<%# 系统贴吧 %>
|
||||
<li><%= link_to "用户留言",user_message_path(User.current, :type => 'user_feedback'), :class => "resourcesGrey" %></li>
|
||||
<%# 系统消息 %>
|
||||
<li><%= link_to "系统消息", system_messages_path(User.current), :class => "resourcesGrey" %></li>
|
||||
<li><%= link_to "系统消息", user_system_messages_path(User.current), :class => "resourcesGrey" %></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
|
@ -389,7 +389,7 @@ RedmineApp::Application.routes.draw do
|
|||
match 'users/:id/user_projects', :to => 'users#user_projects', :via => :get
|
||||
#消息
|
||||
match 'users/:id/user_messages', :to => 'users#user_messages', :via => :get, :as => "user_message"
|
||||
match 'users/:id/system_messages', :to => 'users#system_messages', :via => :get, :as => "system_messages"
|
||||
match 'users/:id/user_system_messages', :to => 'users#user_system_messages', :via => :get, :as => "user_system_messages"
|
||||
#match 'users/:id/user_messages/:homework', :to => 'users#user_messages_homework', :via => :get, :as => "user_message_homewrok"
|
||||
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ namespace :homework_endtime do
|
|||
if homework_common.end_time.day - Date.today.day < 2 && homework_common.end_time.year == Date.today.year
|
||||
homework_common.course.student.each do |s|
|
||||
homework_common.course_messages << CourseMessage.new(:user_id => s.student_id, :course_id => homework_common.course_id, :viewed => false, :status => true)
|
||||
Mailer.run.homework_endtime__added(homework_common, homework_common.course)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue