邮件相关改进
This commit is contained in:
parent
5add0af4b8
commit
37f1aa1442
|
@ -109,9 +109,9 @@ class DocumentsController < ApplicationController
|
|||
attachments = Attachment.attach_files(@document, params[:attachments])
|
||||
render_attachment_warning_if_needed(@document)
|
||||
|
||||
if attachments.present? && attachments[:files].present? && Setting.notified_events.include?('document_added')
|
||||
Mailer.run.attachments_added(attachments[:files])
|
||||
end
|
||||
# if attachments.present? && attachments[:files].present? && Setting.notified_events.include?('document_added')
|
||||
# # Mailer.run.attachments_added(attachments[:files])
|
||||
# end
|
||||
redirect_to document_url(@document)
|
||||
end
|
||||
|
||||
|
|
|
@ -524,7 +524,7 @@ class FilesController < ApplicationController
|
|||
attachments = Attachment.attach_filesex(@project, params[:attachments], params[:attachment_type])
|
||||
if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added')
|
||||
# 发送邮件
|
||||
Mailer.run.attachments_added(attachments[:files])
|
||||
# Mailer.run.attachments_added(attachments[:files])
|
||||
# 生成动态
|
||||
attachments[:files].each do |file|
|
||||
ForgeActivity.create(:user_id => User.current.id, :project_id => @project.id, :forge_act_id => file.id, :forge_act_type => "Attachment")
|
||||
|
@ -581,9 +581,9 @@ class FilesController < ApplicationController
|
|||
end
|
||||
attachments = Attachment.attach_filesex(@course, params[:attachments], params[:attachment_type])
|
||||
|
||||
if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added')
|
||||
Mailer.run.attachments_added(attachments[:files])
|
||||
end
|
||||
# if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added')
|
||||
# # Mailer.run.attachments_added(attachments[:files])
|
||||
# end
|
||||
if !attachments.empty? && attachments[:files]
|
||||
attachments[:files].each do |attachment|
|
||||
if params[:publish_time]
|
||||
|
|
|
@ -284,7 +284,7 @@ class HomeworkCommonController < ApplicationController
|
|||
@statue = 1
|
||||
# 匿评开启消息邮件通知
|
||||
send_message_anonymous_comment(@homework, m_status = 2)
|
||||
Mailer.send_mail_anonymous_comment_open(@homework).deliver
|
||||
# Mailer.send_mail_anonymous_comment_open(@homework).deliver
|
||||
else
|
||||
@statue = 2
|
||||
|
||||
|
@ -326,7 +326,7 @@ class HomeworkCommonController < ApplicationController
|
|||
|
||||
# 匿评关闭消息邮件通知
|
||||
send_message_anonymous_comment(@homework, m_status = 3)
|
||||
Mailer.send_mail_anonymous_comment_close(@homework).deliver
|
||||
# Mailer.send_mail_anonymous_comment_close(@homework).deliver
|
||||
@user_activity_id = params[:user_activity_id].to_i
|
||||
@hw_status = params[:hw_status].to_i
|
||||
@is_teacher = User.current.admin? || User.current.allowed_to?(:as_teacher, @course)
|
||||
|
|
|
@ -432,7 +432,7 @@ class ProjectsController < ApplicationController
|
|||
# 如果已经邀请过该用户,则不重复发送
|
||||
if InviteList.where("project_id =? and mail =?", @project.id, params[:mail].to_s).first.nil?
|
||||
email = params[:mail]
|
||||
Mailer.request_member_to_project(email, @project, User.current).deliver
|
||||
# Mailer.request_member_to_project(email, @project, User.current).deliver
|
||||
flash[:notice] = l(:notice_email_sent, :value => email)
|
||||
else
|
||||
flash[:error] = l(:notice_email_invited)
|
||||
|
@ -445,7 +445,7 @@ class ProjectsController < ApplicationController
|
|||
first_name = params[:first_name]
|
||||
last_name = params[:last_name]
|
||||
gender = params[:gender]
|
||||
Mailer.send_invite_in_project(email, @project, User.current, first_name, last_name, gender).deliver
|
||||
# Mailer.send_invite_in_project(email, @project, User.current, first_name, last_name, gender).deliver
|
||||
@is_zhuce = false
|
||||
flash[:notice] = l(:notice_email_sent, :value => email)
|
||||
end
|
||||
|
@ -458,13 +458,13 @@ class ProjectsController < ApplicationController
|
|||
invite_list = InviteList.where("project_id =? and mail =?", @project.id, params[:mail].to_s).first
|
||||
if invite_list.nil?
|
||||
email = params[:mail]
|
||||
Mailer.request_member_to_project(email, @project, User.current).deliver
|
||||
# Mailer.request_member_to_project(email, @project, User.current).deliver
|
||||
flash[:notice] = l(:notice_email_sent, :value => email)
|
||||
else
|
||||
# 已经发送过了,则隔3小时才能再次发送
|
||||
if Time.now - invite_list.created_at > 10800
|
||||
email = params[:mail]
|
||||
Mailer.request_member_to_project(email, @project, User.current).deliver
|
||||
# Mailer.request_member_to_project(email, @project, User.current).deliver
|
||||
flash[:notice] = l(:notice_email_sent, :value => email)
|
||||
else
|
||||
flash[:error] = l(:notice_email_invited)
|
||||
|
|
|
@ -768,7 +768,7 @@ class UsersController < ApplicationController
|
|||
ah = ApplyHomework.where("user_id = ? and homework_common_id = ?", User.current.id, params[:homework_id].to_i)
|
||||
if ah.empty?
|
||||
ApplyHomework.create(:user_id => params[:id].to_i, :homework_common_id => params[:homework_id].to_i, :status => 1)
|
||||
Mailer.run.apply_for_homework_request(homework, User.current)
|
||||
# Mailer.run.apply_for_homework_request(homework, User.current)
|
||||
CourseMessage.create(:user_id => homework.user_id, :course_id => homework.course.id, :viewed => false,:course_message_id=>params[:homework_id].to_i,:course_message_type=>'HomeworkCommon',:status=>5,:apply_user_id=>params[:id].to_i,:content=>params[:content])
|
||||
@state = 2
|
||||
@ah = ApplyHomework.where("user_id = ? and homework_common_id = ?", params[:id].to_i, params[:homework_id].to_i).first
|
||||
|
|
|
@ -64,9 +64,9 @@ class Comment < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def send_mail
|
||||
if self.commented.is_a?(News) && Setting.notified_events.include?('news_comment_added')
|
||||
Mailer.run.news_comment_added(self)
|
||||
end
|
||||
# if self.commented.is_a?(News) && Setting.notified_events.include?('news_comment_added')
|
||||
# Mailer.run.news_comment_added(self)
|
||||
# end
|
||||
end
|
||||
after_destroy :delete_kindeditor_assets
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ class Document < ActiveRecord::Base
|
|||
after_save :be_user_score # user_score
|
||||
after_destroy :down_user_score
|
||||
acts_as_attachable :delete_permission => :delete_documents
|
||||
after_create :send_mail
|
||||
# after_create :send_mail
|
||||
# 被ForgeActivity虚拟关联
|
||||
has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy
|
||||
# end
|
||||
|
@ -89,7 +89,7 @@ class Document < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def send_mail
|
||||
Mailer.run.document_added(self) if Setting.notified_events.include?('document_added')
|
||||
# Mailer.run.document_added(self) if Setting.notified_events.include?('document_added')
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -31,7 +31,7 @@ class HomeworkCommon < ActiveRecord::Base
|
|||
:description => :description,
|
||||
:author => :author,
|
||||
:url => Proc.new {|o| {:controller => 'student_work', :action => 'index', :homework => o.id}}
|
||||
after_create :act_as_activity, :send_mail,:act_as_course_message
|
||||
after_create :act_as_activity, :act_as_course_message
|
||||
after_update :update_activity
|
||||
after_save :act_as_course_activity
|
||||
after_destroy :delete_kindeditor_assets
|
||||
|
@ -129,9 +129,9 @@ class HomeworkCommon < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def send_mail
|
||||
if self.homework_detail_manual.comment_status != 0
|
||||
Mailer.run.homework_added(self)
|
||||
end
|
||||
# if self.homework_detail_manual.comment_status != 0
|
||||
# Mailer.run.homework_added(self)
|
||||
# end
|
||||
end
|
||||
|
||||
def is_program_homework?
|
||||
|
|
|
@ -19,10 +19,10 @@ class IssueObserver < ActiveRecord::Observer
|
|||
|
||||
def after_create(issue)
|
||||
# 将跟踪者与本项目的其他成员都设为收件方,并去重,不在进行抄送,
|
||||
recipients = issue.recipients - issue.watcher_recipients + issue.watcher_recipients
|
||||
recipients.each do |rec|
|
||||
Mailer.run.issue_add(issue,rec) if Setting.notified_events.include?('issue_added')
|
||||
end
|
||||
# recipients = issue.recipients - issue.watcher_recipients + issue.watcher_recipients
|
||||
# recipients.each do |rec|
|
||||
# Mailer.run.issue_add(issue,rec) if Setting.notified_events.include?('issue_added')
|
||||
# end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,36 +2,36 @@ class IssueOverdue < ActiveRecord::Base
|
|||
#缺陷到期后发送邮件提示
|
||||
#只监听已经提交的未到期的缺陷,已过期的缺陷默认已经发过邮件通知,不再提醒。
|
||||
def self.mail_issue
|
||||
threads = []
|
||||
issues = Issue.where("done_ratio <> 100 and closed_on is null and due_date is not null")
|
||||
puts issues
|
||||
issues.each do |issue|
|
||||
thread = Thread.new do
|
||||
while true
|
||||
cur_issue = Issue.find issue.id
|
||||
if cur_issue.done_ratio == 100 || cur_issue.closed_on != nil
|
||||
break
|
||||
end
|
||||
if Time.now < Time.parse(cur_issue.due_date.to_s)
|
||||
#休眠一个小时。。。
|
||||
puts cur_issue.id.to_s
|
||||
sleep 5
|
||||
else
|
||||
#发邮件
|
||||
#puts "11" + issue.id.to_s
|
||||
#Mailer.issue_expire(issue).deliver
|
||||
recipients = issue.recipients
|
||||
recipients.each do |rec|
|
||||
|
||||
Mailer.issue_edit(issue,rec).deliver
|
||||
end
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
threads << thread
|
||||
end
|
||||
puts threads
|
||||
return threads
|
||||
# threads = []
|
||||
# issues = Issue.where("done_ratio <> 100 and closed_on is null and due_date is not null")
|
||||
# puts issues
|
||||
# issues.each do |issue|
|
||||
# thread = Thread.new do
|
||||
# while true
|
||||
# cur_issue = Issue.find issue.id
|
||||
# if cur_issue.done_ratio == 100 || cur_issue.closed_on != nil
|
||||
# break
|
||||
# end
|
||||
# if Time.now < Time.parse(cur_issue.due_date.to_s)
|
||||
# #休眠一个小时。。。
|
||||
# puts cur_issue.id.to_s
|
||||
# sleep 5
|
||||
# else
|
||||
# #发邮件
|
||||
# #puts "11" + issue.id.to_s
|
||||
# #Mailer.issue_expire(issue).deliver
|
||||
# recipients = issue.recipients
|
||||
# recipients.each do |rec|
|
||||
#
|
||||
# Mailer.issue_edit(issue,rec).deliver
|
||||
# end
|
||||
# break
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
# threads << thread
|
||||
# end
|
||||
# puts threads
|
||||
# return threads
|
||||
end
|
||||
end
|
|
@ -17,18 +17,18 @@
|
|||
|
||||
class JournalObserver < ActiveRecord::Observer
|
||||
def after_create(journal)
|
||||
if journal.notify? &&
|
||||
(Setting.notified_events.include?('issue_updated') ||
|
||||
(Setting.notified_events.include?('issue_note_added') && journal.notes.present?) ||
|
||||
(Setting.notified_events.include?('issue_status_updated') && journal.new_status.present?) ||
|
||||
(Setting.notified_events.include?('issue_priority_updated') && journal.new_value_for('priority_id').present?)
|
||||
)
|
||||
# 将跟踪者与本项目的其他成员都设为收件方,并去重,不在进行抄送,
|
||||
recipients = journal.recipients - journal.watcher_recipients + journal.watcher_recipients
|
||||
recipients.each do |rec|
|
||||
|
||||
Mailer.run.issue_edit(journal,rec)
|
||||
end
|
||||
end
|
||||
# if journal.notify? &&
|
||||
# (Setting.notified_events.include?('issue_updated') ||
|
||||
# (Setting.notified_events.include?('issue_note_added') && journal.notes.present?) ||
|
||||
# (Setting.notified_events.include?('issue_status_updated') && journal.new_status.present?) ||
|
||||
# (Setting.notified_events.include?('issue_priority_updated') && journal.new_value_for('priority_id').present?)
|
||||
# )
|
||||
# # 将跟踪者与本项目的其他成员都设为收件方,并去重,不在进行抄送,
|
||||
# recipients = journal.recipients - journal.watcher_recipients + journal.watcher_recipients
|
||||
# recipients.each do |rec|
|
||||
#
|
||||
# Mailer.run.issue_edit(journal,rec)
|
||||
# end
|
||||
# end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -50,59 +50,59 @@ class Mailer < ActionMailer::Base
|
|||
|
||||
# 作业匿评开启
|
||||
def send_mail_anonymous_comment_open(homework_common)
|
||||
course = homework_common.course
|
||||
recipients ||= []
|
||||
course.members.each do |member|
|
||||
user = User.find(member.user_id)
|
||||
@subject = "#{l(:mail_homework)}#{homework_common.name} #{l(:mail_anonymous_comment_open)}"
|
||||
@token = Token.get_token_from_user(user, 'autologin')
|
||||
@anonymous_comment_close_url = url_for(student_work_index_url(:homework => homework_common.id, :token => @token.value))
|
||||
@anonymous_comment_close_name = homework_common.name
|
||||
@author = homework_common.user
|
||||
#收件人邮箱
|
||||
recipients << user.mail
|
||||
end
|
||||
mail :to => recipients,
|
||||
:subject => @subject
|
||||
# course = homework_common.course
|
||||
# recipients ||= []
|
||||
# course.members.each do |member|
|
||||
# user = User.find(member.user_id)
|
||||
# @subject = "#{l(:mail_homework)}#{homework_common.name} #{l(:mail_anonymous_comment_open)}"
|
||||
# @token = Token.get_token_from_user(user, 'autologin')
|
||||
# @anonymous_comment_close_url = url_for(student_work_index_url(:homework => homework_common.id, :token => @token.value))
|
||||
# @anonymous_comment_close_name = homework_common.name
|
||||
# @author = homework_common.user
|
||||
# #收件人邮箱
|
||||
# recipients << user.mail
|
||||
# end
|
||||
# mail :to => recipients,
|
||||
# :subject => @subject
|
||||
end
|
||||
|
||||
# 作业匿评关闭
|
||||
def send_mail_anonymous_comment_close(homework_common)
|
||||
course = homework_common.course
|
||||
recipients ||= []
|
||||
course.members.each do |member|
|
||||
user = User.find(member.user_id)
|
||||
@subject = "#{l(:mail_homework)}#{homework_common.name} #{l(:mail_anonymous_comment_close)}"
|
||||
@token = Token.get_token_from_user(user, 'autologin')
|
||||
@anonymous_comment_close_url = url_for(student_work_index_url(:homework => homework_common.id, :token => @token.value))
|
||||
@anonymous_comment_close_name = homework_common.name
|
||||
@author = homework_common.user
|
||||
#收件人邮箱
|
||||
recipients << user.mail
|
||||
end
|
||||
mail :to => recipients,
|
||||
:subject => @subject
|
||||
# course = homework_common.course
|
||||
# recipients ||= []
|
||||
# course.members.each do |member|
|
||||
# user = User.find(member.user_id)
|
||||
# @subject = "#{l(:mail_homework)}#{homework_common.name} #{l(:mail_anonymous_comment_close)}"
|
||||
# @token = Token.get_token_from_user(user, 'autologin')
|
||||
# @anonymous_comment_close_url = url_for(student_work_index_url(:homework => homework_common.id, :token => @token.value))
|
||||
# @anonymous_comment_close_name = homework_common.name
|
||||
# @author = homework_common.user
|
||||
# #收件人邮箱
|
||||
# recipients << user.mail
|
||||
# end
|
||||
# mail :to => recipients,
|
||||
# :subject => @subject
|
||||
end
|
||||
|
||||
# 匿评失败给老师发送邮件通知
|
||||
def send_mail_anonymous_comment_fail(homework_common)
|
||||
course = homework_common.course
|
||||
recipients ||= []
|
||||
# 只给该课程的老师发送邮件提醒
|
||||
course.members.each do |member|
|
||||
if member.user.allowed_to?(:as_teacher,course)
|
||||
user = User.find(member.user_id)
|
||||
@subject = "[#{l(:mail_homework)} #{homework_common.name}] #{l(:mail_anonymous_comment_failed)}"
|
||||
@token = Token.get_token_from_user(user, 'autologin')
|
||||
@anonymous_comment_fail_url = url_for(student_work_index_url(:homework => homework_common.id, :token => @token.value))
|
||||
@anonymous_comment_fail_name = homework_common.name
|
||||
@author = homework_common.user
|
||||
#收件人邮箱
|
||||
recipients << user.mail
|
||||
end
|
||||
end
|
||||
mail :to => recipients,
|
||||
:subject => @subject
|
||||
# course = homework_common.course
|
||||
# recipients ||= []
|
||||
# # 只给该课程的老师发送邮件提醒
|
||||
# course.members.each do |member|
|
||||
# if member.user.allowed_to?(:as_teacher,course)
|
||||
# user = User.find(member.user_id)
|
||||
# @subject = "[#{l(:mail_homework)} #{homework_common.name}] #{l(:mail_anonymous_comment_failed)}"
|
||||
# @token = Token.get_token_from_user(user, 'autologin')
|
||||
# @anonymous_comment_fail_url = url_for(student_work_index_url(:homework => homework_common.id, :token => @token.value))
|
||||
# @anonymous_comment_fail_name = homework_common.name
|
||||
# @author = homework_common.user
|
||||
# #收件人邮箱
|
||||
# recipients << user.mail
|
||||
# end
|
||||
# end
|
||||
# mail :to => recipients,
|
||||
# :subject => @subject
|
||||
end
|
||||
|
||||
# author: alan
|
||||
|
@ -146,149 +146,149 @@ class Mailer < ActionMailer::Base
|
|||
end
|
||||
|
||||
# 邀请信息消息 注:forge_message_id 为邀请人ID(特殊情况)
|
||||
def send_message_request_member(user, project)
|
||||
key = newpass(6).to_s
|
||||
ForgeMessage.create(:user_id => user.id, :project_id => project.id, :forge_message_type => "ProjectInvite",:forge_message_id => User.current.id, :viewed => false, :secret_key =>key)
|
||||
end
|
||||
# def send_message_request_member(user, project)
|
||||
# key = newpass(6).to_s
|
||||
# ForgeMessage.create(:user_id => user.id, :project_id => project.id, :forge_message_type => "ProjectInvite",:forge_message_id => User.current.id, :viewed => false, :secret_key =>key)
|
||||
# end
|
||||
|
||||
# author: alan
|
||||
# 根据用户选择发送个人日报或周报
|
||||
# 发送内容: 项目【缺陷,讨论区,新闻】,课程【通知,留言,新闻】, 贴吧, 个人留言
|
||||
def send_for_user_activities(user, date_to, days)
|
||||
date_from = date_to - days.days
|
||||
date_from = "#{date_from} 17:59:59"
|
||||
date_to = "#{date_to} 17:59:59"
|
||||
# 生成token用于直接点击登录
|
||||
@user = user
|
||||
@token = Token.get_token_from_user(user, 'autologin')
|
||||
|
||||
# 查询user参加的项目及课程
|
||||
projects = user.projects
|
||||
courses = user.courses
|
||||
project_ids = projects.map{|project| project.id}.join(",")
|
||||
course_ids = courses.map {|course| course.id}.join(",")
|
||||
|
||||
# 查询user的缺陷,项目中成员都能收到
|
||||
sql = "select DISTINCT * from members m, issues i where i.project_id = m.project_id and m.user_id='#{user.id}'
|
||||
and (i.updated_on between '#{date_from}' and '#{date_to}') order by i.project_id, i.updated_on desc"
|
||||
@issues = Issue.find_by_sql(sql)
|
||||
|
||||
# issue回复
|
||||
@issues_journals = Journal.find_by_sql("select j.* from journals j, members m, projects p, issues i
|
||||
where m.user_id = '#{user.id}' and p.id = m.project_id and i.project_id = p.id and j.journalized_id = i.id
|
||||
and j.journalized_type='Issue' and (j.created_on between '#{date_from}' and '#{date_to}') order by i.project_id, created_on desc")
|
||||
|
||||
# @bids 查询课程作业,包括老师发布的作业,以及user提交作业
|
||||
# @attachments查询课程课件更新
|
||||
@attachments ||= []
|
||||
@bids ||= [] # 老师发布的作业
|
||||
unless courses.first.nil?
|
||||
count = courses.count
|
||||
count = count - 1
|
||||
for i in 0..count do
|
||||
bids = courses[i].homework_commons.where("homework_commons.created_at between '#{date_from}' and '#{date_to}'").order("homework_commons.created_at desc")
|
||||
attachments = courses[i].attachments.where("attachments.created_on between '#{date_from}' and '#{date_to}'")
|
||||
@bids += bids if bids.count > 0
|
||||
@attachments += attachments if attachments.count > 0
|
||||
end
|
||||
# @bids = @bids.sort_by { |obj| obj.created_at }
|
||||
end
|
||||
|
||||
# 项目附件
|
||||
@project_attachments = Attachment.find_by_sql("select DISTINCT a.* from members m, attachments a
|
||||
where a.container_id = m.project_id and m.user_id='#{user.id}' and container_type = 'Project' and (a.created_on between '#{date_from}' and '#{date_to}') order by m.project_id, a.created_on desc")
|
||||
|
||||
# user 提交的作业
|
||||
# @homeworks = HomeworkAttach.where("user_id=#{user.id} and (created_at between '#{date_from}' and '#{date_to}')").order("created_at desc")
|
||||
|
||||
# 查询user所在项目添加wiki
|
||||
@wiki_contents = WikiContent.find_by_sql("select DISTINCT wc.* from wikis w, members m, projects p, wiki_pages wp, wiki_contents wc where
|
||||
m.user_id = '#{user.id}' and m.project_id = p.id and w.project_id = p.id and w.id = wp.wiki_id and wc.page_id = wp.id and w.project_id>0
|
||||
and (wc.updated_on between '#{date_from}' and '#{date_to}') order by m.project_id, updated_on desc")
|
||||
|
||||
# 查询user在课程中发布的讨论帖子
|
||||
course_mesages = Message.find_by_sql("select DISTINCT me.* from messages me, boards b, members m where
|
||||
b.id = me.board_id and b.course_id = m.course_id
|
||||
and b.course_id is not Null and m.user_id = '#{user.id}'
|
||||
and (me.created_on between '#{date_from}' and '#{date_to}') order by m.course_id, created_on desc")
|
||||
|
||||
# 查询user在项目中发布的讨论帖子
|
||||
project_messages = Message.find_by_sql("select DISTINCT me.* from messages me, boards b, members m where
|
||||
b.id = me.board_id and b.project_id = m.project_id
|
||||
and b.project_id != '-1' and m.user_id = '#{user.id}' and (me.created_on between '#{date_from}' and '#{date_to}') order by m.project_id, created_on desc")
|
||||
# messages = Message.find_by_sql("select DISTINCT * from messages where author_id = #{user.id} and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc")
|
||||
@course_messages ||= []
|
||||
@project_messages ||= []
|
||||
unless course_mesages.first.nil?
|
||||
course_mesages.each do |msg|
|
||||
@course_messages << msg
|
||||
end
|
||||
end
|
||||
unless project_messages.first.nil?
|
||||
project_messages.each do |msg|
|
||||
@project_messages << msg
|
||||
end
|
||||
end
|
||||
# wiki
|
||||
|
||||
# 查询user在课程中发布的通知和回复通知
|
||||
@course_news = (course_ids && !course_ids.empty?) ? News.find_by_sql("select DISTINCT n.* from news n
|
||||
where n.course_id in (#{course_ids})
|
||||
and (created_on between '#{date_from}' and '#{date_to}') order by n.course_id, created_on desc") : []
|
||||
|
||||
@course_news_comments = Comment.find_by_sql("select cm.* from comments cm, members m, courses c, news n
|
||||
where m.user_id = '#{user.id}' and c.id = m.course_id and n.course_id = c.id and cm.commented_id = n.id
|
||||
and cm.commented_type ='News' and (cm.created_on between '#{date_from}' and '#{date_to}') order by m.course_id, created_on desc")
|
||||
|
||||
# 查询user在项目中添加新闻和回复新闻
|
||||
@project_news = (project_ids && !project_ids.empty?) ? News.find_by_sql("select DISTINCT n.* from news n where n.project_id in (#{project_ids})
|
||||
and (created_on between '#{date_from}' and '#{date_to}') order by n.project_id, created_on desc") : []
|
||||
|
||||
@project_news_comments = Comment.find_by_sql("select c.* from comments c, members m, projects p, news n
|
||||
where m.user_id = '#{user.id}' and p.id = m.project_id and n.project_id = p.id and c.commented_id = n.id
|
||||
and c.commented_type ='News' and (c.created_on between '#{date_from}' and '#{date_to}') order by m.project_id, created_on desc")
|
||||
|
||||
# 查询user在课程及个人中留言
|
||||
@course_journal_messages = JournalsForMessage.find_by_sql("select DISTINCT jfm.* from journals_for_messages jfm, members m, courses c
|
||||
where m.user_id = '#{user.id}' and c.id = m.course_id and jfm.jour_id = c.id
|
||||
and jfm.jour_type='Course' and (jfm.created_on between '#{date_from}' and '#{date_to}') order by m.course_id, created_on desc")
|
||||
|
||||
@user_journal_messages = user.journals_for_messages.where("jour_type='Principal' and (created_on between '#{date_from}' and '#{date_to}')").order('created_on DESC')
|
||||
|
||||
# 查询user在项目中留言(用户反馈)
|
||||
@project_journal_messages = JournalsForMessage.find_by_sql("select DISTINCT jfm.* from journals_for_messages jfm, members m, projects p
|
||||
where m.user_id = '#{user.id}' and p.id = m.project_id and jfm.jour_id = p.id
|
||||
and jfm.jour_type='Project' and (jfm.created_on between '#{date_from}' and '#{date_to}') order by m.project_id, created_on desc")
|
||||
|
||||
# 查询user新建贴吧或发布帖子
|
||||
@forums = Forum.find_by_sql("select DISTINCT * from forums where creator_id = #{user.id} and (created_at between '#{date_from}' and '#{date_to}') order by created_at desc")
|
||||
@memos = Memo.find_by_sql("select DISTINCT m.* from memos m, forums f where (m.author_id = #{user.id} or (m.forum_id = f.id and f.creator_id = #{user.id}))
|
||||
and (m.created_at between '#{date_from}' and '#{date_to}') order by m.created_at desc")
|
||||
|
||||
has_content = [@issues,@issues_journals,@course_messages,@project_messages,@course_news,@course_news_comments,@project_news,@project_news_comments,@project_attachments,
|
||||
@course_journal_messages,@user_journal_messages,@project_journal_messages,@forums,@memos,@attachments,@bids,@wiki_contents].any? {|o| !o.empty?}
|
||||
total_count = @issues.count + @issues_journals.count + @course_messages.count + @project_messages.count + @course_news.count + @course_news_comments.count + @project_news.count + @project_news_comments.count +
|
||||
@project_attachments.count + @course_journal_messages.count + @user_journal_messages.count + @project_journal_messages.count + @forums.count + @memos.count + @attachments.count +
|
||||
@bids.count + @wiki_contents.count
|
||||
subject = "[ #{user.show_name}#{l(:label_day_mail_first)}#{total_count}#{l(:label_day_mail_last)}]"
|
||||
@subject = " #{user.show_name}#{l(:label_day_mail_first)}#{total_count}#{l(:label_day_mail_last)}"
|
||||
mylogger.debug "Sent activity mail : #{user.mail} - #{has_content}"
|
||||
#有内容才发,没有不发
|
||||
mail :to => user.mail,:subject => @subject if has_content
|
||||
# date_from = date_to - days.days
|
||||
# date_from = "#{date_from} 17:59:59"
|
||||
# date_to = "#{date_to} 17:59:59"
|
||||
# # 生成token用于直接点击登录
|
||||
# @user = user
|
||||
# @token = Token.get_token_from_user(user, 'autologin')
|
||||
#
|
||||
# # 查询user参加的项目及课程
|
||||
# projects = user.projects
|
||||
# courses = user.courses
|
||||
# project_ids = projects.map{|project| project.id}.join(",")
|
||||
# course_ids = courses.map {|course| course.id}.join(",")
|
||||
#
|
||||
# # 查询user的缺陷,项目中成员都能收到
|
||||
# sql = "select DISTINCT * from members m, issues i where i.project_id = m.project_id and m.user_id='#{user.id}'
|
||||
# and (i.updated_on between '#{date_from}' and '#{date_to}') order by i.project_id, i.updated_on desc"
|
||||
# @issues = Issue.find_by_sql(sql)
|
||||
#
|
||||
# # issue回复
|
||||
# @issues_journals = Journal.find_by_sql("select j.* from journals j, members m, projects p, issues i
|
||||
# where m.user_id = '#{user.id}' and p.id = m.project_id and i.project_id = p.id and j.journalized_id = i.id
|
||||
# and j.journalized_type='Issue' and (j.created_on between '#{date_from}' and '#{date_to}') order by i.project_id, created_on desc")
|
||||
#
|
||||
# # @bids 查询课程作业,包括老师发布的作业,以及user提交作业
|
||||
# # @attachments查询课程课件更新
|
||||
# @attachments ||= []
|
||||
# @bids ||= [] # 老师发布的作业
|
||||
# unless courses.first.nil?
|
||||
# count = courses.count
|
||||
# count = count - 1
|
||||
# for i in 0..count do
|
||||
# bids = courses[i].homework_commons.where("homework_commons.created_at between '#{date_from}' and '#{date_to}'").order("homework_commons.created_at desc")
|
||||
# attachments = courses[i].attachments.where("attachments.created_on between '#{date_from}' and '#{date_to}'")
|
||||
# @bids += bids if bids.count > 0
|
||||
# @attachments += attachments if attachments.count > 0
|
||||
# end
|
||||
# # @bids = @bids.sort_by { |obj| obj.created_at }
|
||||
# end
|
||||
#
|
||||
# # 项目附件
|
||||
# @project_attachments = Attachment.find_by_sql("select DISTINCT a.* from members m, attachments a
|
||||
# where a.container_id = m.project_id and m.user_id='#{user.id}' and container_type = 'Project' and (a.created_on between '#{date_from}' and '#{date_to}') order by m.project_id, a.created_on desc")
|
||||
#
|
||||
# # user 提交的作业
|
||||
# # @homeworks = HomeworkAttach.where("user_id=#{user.id} and (created_at between '#{date_from}' and '#{date_to}')").order("created_at desc")
|
||||
#
|
||||
# # 查询user所在项目添加wiki
|
||||
# @wiki_contents = WikiContent.find_by_sql("select DISTINCT wc.* from wikis w, members m, projects p, wiki_pages wp, wiki_contents wc where
|
||||
# m.user_id = '#{user.id}' and m.project_id = p.id and w.project_id = p.id and w.id = wp.wiki_id and wc.page_id = wp.id and w.project_id>0
|
||||
# and (wc.updated_on between '#{date_from}' and '#{date_to}') order by m.project_id, updated_on desc")
|
||||
#
|
||||
# # 查询user在课程中发布的讨论帖子
|
||||
# course_mesages = Message.find_by_sql("select DISTINCT me.* from messages me, boards b, members m where
|
||||
# b.id = me.board_id and b.course_id = m.course_id
|
||||
# and b.course_id is not Null and m.user_id = '#{user.id}'
|
||||
# and (me.created_on between '#{date_from}' and '#{date_to}') order by m.course_id, created_on desc")
|
||||
#
|
||||
# # 查询user在项目中发布的讨论帖子
|
||||
# project_messages = Message.find_by_sql("select DISTINCT me.* from messages me, boards b, members m where
|
||||
# b.id = me.board_id and b.project_id = m.project_id
|
||||
# and b.project_id != '-1' and m.user_id = '#{user.id}' and (me.created_on between '#{date_from}' and '#{date_to}') order by m.project_id, created_on desc")
|
||||
# # messages = Message.find_by_sql("select DISTINCT * from messages where author_id = #{user.id} and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc")
|
||||
# @course_messages ||= []
|
||||
# @project_messages ||= []
|
||||
# unless course_mesages.first.nil?
|
||||
# course_mesages.each do |msg|
|
||||
# @course_messages << msg
|
||||
# end
|
||||
# end
|
||||
# unless project_messages.first.nil?
|
||||
# project_messages.each do |msg|
|
||||
# @project_messages << msg
|
||||
# end
|
||||
# end
|
||||
# # wiki
|
||||
#
|
||||
# # 查询user在课程中发布的通知和回复通知
|
||||
# @course_news = (course_ids && !course_ids.empty?) ? News.find_by_sql("select DISTINCT n.* from news n
|
||||
# where n.course_id in (#{course_ids})
|
||||
# and (created_on between '#{date_from}' and '#{date_to}') order by n.course_id, created_on desc") : []
|
||||
#
|
||||
# @course_news_comments = Comment.find_by_sql("select cm.* from comments cm, members m, courses c, news n
|
||||
# where m.user_id = '#{user.id}' and c.id = m.course_id and n.course_id = c.id and cm.commented_id = n.id
|
||||
# and cm.commented_type ='News' and (cm.created_on between '#{date_from}' and '#{date_to}') order by m.course_id, created_on desc")
|
||||
#
|
||||
# # 查询user在项目中添加新闻和回复新闻
|
||||
# @project_news = (project_ids && !project_ids.empty?) ? News.find_by_sql("select DISTINCT n.* from news n where n.project_id in (#{project_ids})
|
||||
# and (created_on between '#{date_from}' and '#{date_to}') order by n.project_id, created_on desc") : []
|
||||
#
|
||||
# @project_news_comments = Comment.find_by_sql("select c.* from comments c, members m, projects p, news n
|
||||
# where m.user_id = '#{user.id}' and p.id = m.project_id and n.project_id = p.id and c.commented_id = n.id
|
||||
# and c.commented_type ='News' and (c.created_on between '#{date_from}' and '#{date_to}') order by m.project_id, created_on desc")
|
||||
#
|
||||
# # 查询user在课程及个人中留言
|
||||
# @course_journal_messages = JournalsForMessage.find_by_sql("select DISTINCT jfm.* from journals_for_messages jfm, members m, courses c
|
||||
# where m.user_id = '#{user.id}' and c.id = m.course_id and jfm.jour_id = c.id
|
||||
# and jfm.jour_type='Course' and (jfm.created_on between '#{date_from}' and '#{date_to}') order by m.course_id, created_on desc")
|
||||
#
|
||||
# @user_journal_messages = user.journals_for_messages.where("jour_type='Principal' and (created_on between '#{date_from}' and '#{date_to}')").order('created_on DESC')
|
||||
#
|
||||
# # 查询user在项目中留言(用户反馈)
|
||||
# @project_journal_messages = JournalsForMessage.find_by_sql("select DISTINCT jfm.* from journals_for_messages jfm, members m, projects p
|
||||
# where m.user_id = '#{user.id}' and p.id = m.project_id and jfm.jour_id = p.id
|
||||
# and jfm.jour_type='Project' and (jfm.created_on between '#{date_from}' and '#{date_to}') order by m.project_id, created_on desc")
|
||||
#
|
||||
# # 查询user新建贴吧或发布帖子
|
||||
# @forums = Forum.find_by_sql("select DISTINCT * from forums where creator_id = #{user.id} and (created_at between '#{date_from}' and '#{date_to}') order by created_at desc")
|
||||
# @memos = Memo.find_by_sql("select DISTINCT m.* from memos m, forums f where (m.author_id = #{user.id} or (m.forum_id = f.id and f.creator_id = #{user.id}))
|
||||
# and (m.created_at between '#{date_from}' and '#{date_to}') order by m.created_at desc")
|
||||
#
|
||||
# has_content = [@issues,@issues_journals,@course_messages,@project_messages,@course_news,@course_news_comments,@project_news,@project_news_comments,@project_attachments,
|
||||
# @course_journal_messages,@user_journal_messages,@project_journal_messages,@forums,@memos,@attachments,@bids,@wiki_contents].any? {|o| !o.empty?}
|
||||
# total_count = @issues.count + @issues_journals.count + @course_messages.count + @project_messages.count + @course_news.count + @course_news_comments.count + @project_news.count + @project_news_comments.count +
|
||||
# @project_attachments.count + @course_journal_messages.count + @user_journal_messages.count + @project_journal_messages.count + @forums.count + @memos.count + @attachments.count +
|
||||
# @bids.count + @wiki_contents.count
|
||||
# subject = "[ #{user.show_name}#{l(:label_day_mail_first)}#{total_count}#{l(:label_day_mail_last)}]"
|
||||
# @subject = " #{user.show_name}#{l(:label_day_mail_first)}#{total_count}#{l(:label_day_mail_last)}"
|
||||
# mylogger.debug "Sent activity mail : #{user.mail} - #{has_content}"
|
||||
# #有内容才发,没有不发
|
||||
# mail :to => user.mail,:subject => @subject if has_content
|
||||
end
|
||||
|
||||
# 作业截止时间邮件提醒
|
||||
def homework_endtime__added(homework_common, user_id)
|
||||
user = User.find(user_id)
|
||||
@subject = "#{l(:mail_homework)}#{homework_common.name} #{l(:mail_homework_endtime)} "
|
||||
@token = Token.get_token_from_user(user, 'autologin')
|
||||
@homework_endtime_url = url_for(student_work_index_url(:homework => homework_common.id, :token => @token.value))
|
||||
@homework_endtime_name = homework_common.name
|
||||
@author = homework_common.user
|
||||
#收件人邮箱
|
||||
recipient = user.mail
|
||||
mail :to => recipient,
|
||||
:subject => @subject
|
||||
# user = User.find(user_id)
|
||||
# @subject = "#{l(:mail_homework)}#{homework_common.name} #{l(:mail_homework_endtime)} "
|
||||
# @token = Token.get_token_from_user(user, 'autologin')
|
||||
# @homework_endtime_url = url_for(student_work_index_url(:homework => homework_common.id, :token => @token.value))
|
||||
# @homework_endtime_name = homework_common.name
|
||||
# @author = homework_common.user
|
||||
# #收件人邮箱
|
||||
# recipient = user.mail
|
||||
# mail :to => recipient,
|
||||
# :subject => @subject
|
||||
end
|
||||
|
||||
# 公共讨论区发帖、回帖添加邮件发送信息
|
||||
|
@ -382,20 +382,20 @@ class Mailer < ActionMailer::Base
|
|||
|
||||
# issue截止时间提醒
|
||||
def issue_due_date(issue)
|
||||
recipients ||= []
|
||||
if issue.author.id != issue.assigned_to_id
|
||||
recipients << issue.author.mail
|
||||
end
|
||||
|
||||
# 被指派人邮箱地址加入数组
|
||||
recipients << issue.assigned_to.mail
|
||||
# cc = wiki_content.page.wiki.watcher_recipients - recipients
|
||||
@author = issue.author
|
||||
@issue_name = issue.subject
|
||||
@issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue.id)
|
||||
@subject = "#{l(:mail_issue)}#{issue.subject} #{l(:mail_issue_due_date)} "
|
||||
mail :to => recipients,
|
||||
:subject => @subject
|
||||
# recipients ||= []
|
||||
# if issue.author.id != issue.assigned_to_id
|
||||
# recipients << issue.author.mail
|
||||
# end
|
||||
#
|
||||
# # 被指派人邮箱地址加入数组
|
||||
# recipients << issue.assigned_to.mail
|
||||
# # cc = wiki_content.page.wiki.watcher_recipients - recipients
|
||||
# @author = issue.author
|
||||
# @issue_name = issue.subject
|
||||
# @issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue.id)
|
||||
# @subject = "#{l(:mail_issue)}#{issue.subject} #{l(:mail_issue_due_date)} "
|
||||
# mail :to => recipients,
|
||||
# :subject => @subject
|
||||
end
|
||||
|
||||
# Builds a Mail::Message object used to email recipients of the added issue.
|
||||
|
@ -404,31 +404,31 @@ class Mailer < ActionMailer::Base
|
|||
# issue_add(issue) => Mail::Message object
|
||||
# Mailer.issue_add(issue).deliver => sends an email to issue recipients
|
||||
def issue_add(issue, recipients)
|
||||
issue_id = issue.project_index
|
||||
redmine_headers 'Project' => issue.project.identifier,
|
||||
'Issue-Id' => issue_id,
|
||||
'Issue-Author' => issue.author.login
|
||||
redmine_headers 'Issue-Assignee' => issue.assigned_to.login if issue.assigned_to
|
||||
message_id issue
|
||||
|
||||
@author = issue.author
|
||||
@issue = issue
|
||||
user = User.find_by_mail(recipients)
|
||||
@user = user
|
||||
# @token = Token.get_token_from_user(user, 'autologin')
|
||||
@issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue.id)
|
||||
|
||||
# edit
|
||||
@issue_author_url = url_for(user_activities_url(@author))
|
||||
@project_url = url_for(:controller => 'projects', :action => 'show', :id => issue.project_id)
|
||||
|
||||
@user_url = url_for(my_account_url(user))
|
||||
|
||||
|
||||
subject = "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] (#{issue.status.name}) #{issue.subject}"
|
||||
mail :to => recipients,
|
||||
:subject => subject,
|
||||
:filter => true
|
||||
# issue_id = issue.project_index
|
||||
# redmine_headers 'Project' => issue.project.identifier,
|
||||
# 'Issue-Id' => issue_id,
|
||||
# 'Issue-Author' => issue.author.login
|
||||
# redmine_headers 'Issue-Assignee' => issue.assigned_to.login if issue.assigned_to
|
||||
# message_id issue
|
||||
#
|
||||
# @author = issue.author
|
||||
# @issue = issue
|
||||
# user = User.find_by_mail(recipients)
|
||||
# @user = user
|
||||
# # @token = Token.get_token_from_user(user, 'autologin')
|
||||
# @issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue.id)
|
||||
#
|
||||
# # edit
|
||||
# @issue_author_url = url_for(user_activities_url(@author))
|
||||
# @project_url = url_for(:controller => 'projects', :action => 'show', :id => issue.project_id)
|
||||
#
|
||||
# @user_url = url_for(my_account_url(user))
|
||||
#
|
||||
#
|
||||
# subject = "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] (#{issue.status.name}) #{issue.subject}"
|
||||
# mail :to => recipients,
|
||||
# :subject => subject,
|
||||
# :filter => true
|
||||
end
|
||||
# issue.attachments.each do |attach|
|
||||
# attachments["#{attach.filename}"] = File.read("#{attach.disk_filename}")
|
||||
|
@ -445,36 +445,36 @@ class Mailer < ActionMailer::Base
|
|||
# issue_edit(journal) => Mail::Message object
|
||||
# Mailer.issue_edit(journal).deliver => sends an email to issue recipients
|
||||
def issue_edit(journal,recipients)
|
||||
issue = journal.journalized.reload
|
||||
issue_id = issue.project_index
|
||||
redmine_headers 'Project' => issue.project.identifier,
|
||||
'Issue-Id' => issue_id.to_s,
|
||||
'Issue-Author' => issue.author.login
|
||||
redmine_headers 'Issue-Assignee' => issue.assigned_to.login if issue.assigned_to
|
||||
message_id journal
|
||||
references issue
|
||||
@author = journal.user
|
||||
|
||||
user = User.find_by_mail(recipients)
|
||||
@user = user
|
||||
# @token = Token.get_token_from_user(user, 'autologin')
|
||||
|
||||
|
||||
# edit
|
||||
@issue_author_url = url_for(:controller => 'users', :action => 'show', :id => issue.author_id)
|
||||
@project_url = url_for(:controller => 'projects', :action => 'show', :id => issue.project_id)
|
||||
@user_url = url_for(my_account_url(user))
|
||||
|
||||
@issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue.id, :anchor => "change-#{journal.id}")
|
||||
s = "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] "
|
||||
s << "(#{issue.status.name}) " if journal.new_value_for('status_id')
|
||||
s << issue.subject
|
||||
@issue = issue
|
||||
@journal = journal
|
||||
# @issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue, :anchor => "change-#{journal.id}")
|
||||
mail :to => recipients,
|
||||
:subject => s,
|
||||
:filter => true
|
||||
# issue = journal.journalized.reload
|
||||
# issue_id = issue.project_index
|
||||
# redmine_headers 'Project' => issue.project.identifier,
|
||||
# 'Issue-Id' => issue_id.to_s,
|
||||
# 'Issue-Author' => issue.author.login
|
||||
# redmine_headers 'Issue-Assignee' => issue.assigned_to.login if issue.assigned_to
|
||||
# message_id journal
|
||||
# references issue
|
||||
# @author = journal.user
|
||||
#
|
||||
# user = User.find_by_mail(recipients)
|
||||
# @user = user
|
||||
# # @token = Token.get_token_from_user(user, 'autologin')
|
||||
#
|
||||
#
|
||||
# # edit
|
||||
# @issue_author_url = url_for(:controller => 'users', :action => 'show', :id => issue.author_id)
|
||||
# @project_url = url_for(:controller => 'projects', :action => 'show', :id => issue.project_id)
|
||||
# @user_url = url_for(my_account_url(user))
|
||||
#
|
||||
# @issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue.id, :anchor => "change-#{journal.id}")
|
||||
# s = "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] "
|
||||
# s << "(#{issue.status.name}) " if journal.new_value_for('status_id')
|
||||
# s << issue.subject
|
||||
# @issue = issue
|
||||
# @journal = journal
|
||||
# # @issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue, :anchor => "change-#{journal.id}")
|
||||
# mail :to => recipients,
|
||||
# :subject => s,
|
||||
# :filter => true
|
||||
end
|
||||
|
||||
def self.deliver_mailer(to,cc, subject)
|
||||
|
@ -510,19 +510,19 @@ class Mailer < ActionMailer::Base
|
|||
|
||||
#缺陷到期邮件通知
|
||||
def issue_expire issue
|
||||
issue_id = issue.project_index
|
||||
redmine_headers 'Project' => issue.project.identifier,
|
||||
'Issue-Id' => issue_id,
|
||||
'Issue-Author' => issue.author.login
|
||||
redmine_headers 'Issue-Assignee' => issue.assigned_to.login if issue.assigned_to
|
||||
message_id issue
|
||||
@author = issue.author
|
||||
@issue = issue
|
||||
@issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue.id)
|
||||
recipients = issue.recipients
|
||||
s = l(:text_issue_expire,:issue => "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] (#{issue.status.name}) #{issue.subject}")
|
||||
mail :to => recipients,
|
||||
:subject => s
|
||||
# issue_id = issue.project_index
|
||||
# redmine_headers 'Project' => issue.project.identifier,
|
||||
# 'Issue-Id' => issue_id,
|
||||
# 'Issue-Author' => issue.author.login
|
||||
# redmine_headers 'Issue-Assignee' => issue.assigned_to.login if issue.assigned_to
|
||||
# message_id issue
|
||||
# @author = issue.author
|
||||
# @issue = issue
|
||||
# @issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue.id)
|
||||
# recipients = issue.recipients
|
||||
# s = l(:text_issue_expire,:issue => "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] (#{issue.status.name}) #{issue.subject}")
|
||||
# mail :to => recipients,
|
||||
# :subject => s
|
||||
#########################################################################################################
|
||||
#@issues = issues
|
||||
#s = l(:text_issue_expire,:issue => "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] (#{issue.status.name}) #{issue.subject}")
|
||||
|
@ -627,19 +627,19 @@ class Mailer < ActionMailer::Base
|
|||
# attachments_added(attachments) => Mail::Message object
|
||||
# Mailer.attachments_added(attachments).deliver => sends an email to the project's recipients
|
||||
def homework_added(homework_common)
|
||||
logger.info "homework added"
|
||||
@homework_common = homework_common
|
||||
@author = homework_common.user
|
||||
@homework_common_url = url_for(:controller => "homework_common", :action =>"index", :homework => @homework_common.id)
|
||||
@homework_author_url = url_for(user_activities_url(@author))
|
||||
recipients ||= []
|
||||
#将帖子创建者邮箱地址加入数组
|
||||
@homework_common.course.members.each do |member|
|
||||
recipients << member.user.mail
|
||||
end
|
||||
mail :to => recipients,
|
||||
:subject => "[ #{l(:label_user_homework)} : #{homework_common.name} #{l(:label_memo_create_succ)}]",
|
||||
:filter => true
|
||||
# logger.info "homework added"
|
||||
# @homework_common = homework_common
|
||||
# @author = homework_common.user
|
||||
# @homework_common_url = url_for(:controller => "homework_common", :action =>"index", :homework => @homework_common.id)
|
||||
# @homework_author_url = url_for(user_activities_url(@author))
|
||||
# recipients ||= []
|
||||
# #将帖子创建者邮箱地址加入数组
|
||||
# @homework_common.course.members.each do |member|
|
||||
# recipients << member.user.mail
|
||||
# end
|
||||
# mail :to => recipients,
|
||||
# :subject => "[ #{l(:label_user_homework)} : #{homework_common.name} #{l(:label_memo_create_succ)}]",
|
||||
# :filter => true
|
||||
end
|
||||
|
||||
# Builds a Mail::Message object used to email recipients of a news' project when a news item is added.
|
||||
|
@ -649,28 +649,28 @@ class Mailer < ActionMailer::Base
|
|||
# Mailer.news_added(news).deliver => sends an email to the news' project recipients
|
||||
def news_added(news)
|
||||
|
||||
if news.project
|
||||
# redmine_headers 'Project' => news.project.identifier
|
||||
# if news.project
|
||||
# # redmine_headers 'Project' => news.project.identifier
|
||||
# # @author = news.author
|
||||
# # @issue_author_url = url_for(user_activities_url(@author))
|
||||
# # message_id news
|
||||
# # @news = news
|
||||
# # @news_url = url_for(:controller => 'news', :action => 'show', :id => news)
|
||||
# # mail :to => news.recipients,
|
||||
# # :subject => "[#{news.project.name}] #{l(:label_news)}: #{news.title}",
|
||||
# # :filter => true
|
||||
# elsif news.course
|
||||
# redmine_headers 'Course' => news.course.id
|
||||
# @author = news.author
|
||||
# @issue_author_url = url_for(user_activities_url(@author))
|
||||
# message_id news
|
||||
# @news = news
|
||||
# recipients = news.course.notified_users.select { |user| user.allowed_to?(:view_files, news.course) }.collect { |u| u.mail }
|
||||
# @news_url = url_for(:controller => 'news', :action => 'show', :id => news)
|
||||
# mail :to => news.recipients,
|
||||
# :subject => "[#{news.project.name}] #{l(:label_news)}: #{news.title}",
|
||||
# mail :to => recipients,
|
||||
# :subject => "[#{news.course.name}] #{l(:label_news)}: #{news.title}",
|
||||
# :filter => true
|
||||
elsif news.course
|
||||
redmine_headers 'Course' => news.course.id
|
||||
@author = news.author
|
||||
@issue_author_url = url_for(user_activities_url(@author))
|
||||
message_id news
|
||||
@news = news
|
||||
recipients = news.course.notified_users.select { |user| user.allowed_to?(:view_files, news.course) }.collect { |u| u.mail }
|
||||
@news_url = url_for(:controller => 'news', :action => 'show', :id => news)
|
||||
mail :to => recipients,
|
||||
:subject => "[#{news.course.name}] #{l(:label_news)}: #{news.title}",
|
||||
:filter => true
|
||||
end
|
||||
# end
|
||||
end
|
||||
|
||||
# Builds a Mail::Message object used to email recipients of a news' project when a news comment is added.
|
||||
|
@ -679,33 +679,33 @@ class Mailer < ActionMailer::Base
|
|||
# news_comment_added(comment) => Mail::Message object
|
||||
# Mailer.news_comment_added(comment) => sends an email to the news' project recipients
|
||||
def news_comment_added(comment)
|
||||
news = comment.commented
|
||||
if news.project
|
||||
# redmine_headers 'Project' => news.project.identifier
|
||||
# news = comment.commented
|
||||
# if news.project
|
||||
# # redmine_headers 'Project' => news.project.identifier
|
||||
# # @author = comment.author
|
||||
# # @issue_author_url = url_for(user_activities_url(@author))
|
||||
# # message_id comment
|
||||
# # @news = news
|
||||
# # @comment = comment
|
||||
# # @news_url = url_for(:controller => 'news', :action => 'show', :id => news)
|
||||
# # mail :to => news.recipients,
|
||||
# # :cc => news.watcher_recipients,
|
||||
# # :subject => "Re: [#{news.project.name}] #{l(:label_news)}: #{news.title}",
|
||||
# # :filter => true
|
||||
# elsif news.course
|
||||
# redmine_headers 'Course' => news.course.id
|
||||
# @author = comment.author
|
||||
# @issue_author_url = url_for(user_activities_url(@author))
|
||||
# message_id comment
|
||||
# @news = news
|
||||
# @comment = comment
|
||||
# @news_url = url_for(:controller => 'news', :action => 'show', :id => news)
|
||||
# mail :to => news.recipients,
|
||||
# :cc => news.watcher_recipients,
|
||||
# :subject => "Re: [#{news.project.name}] #{l(:label_news)}: #{news.title}",
|
||||
# recipients = news.course.notified_users.select { |user| user.allowed_to?(:view_files, news.course) }.collect { |u| u.mail }
|
||||
#
|
||||
# mail :to => recipients,
|
||||
# :subject => "[#{news.course.name}] #{l(:label_news)}: #{news.title}",
|
||||
# :filter => true
|
||||
elsif news.course
|
||||
redmine_headers 'Course' => news.course.id
|
||||
@author = comment.author
|
||||
@issue_author_url = url_for(user_activities_url(@author))
|
||||
message_id comment
|
||||
@news = news
|
||||
@comment = comment
|
||||
@news_url = url_for(:controller => 'news', :action => 'show', :id => news)
|
||||
recipients = news.course.notified_users.select { |user| user.allowed_to?(:view_files, news.course) }.collect { |u| u.mail }
|
||||
|
||||
mail :to => recipients,
|
||||
:subject => "[#{news.course.name}] #{l(:label_news)}: #{news.title}",
|
||||
:filter => true
|
||||
end
|
||||
# end
|
||||
end
|
||||
|
||||
# Builds a Mail::Message object used to email the recipients of the specified message that was posted.
|
||||
|
@ -1032,21 +1032,21 @@ class Mailer < ActionMailer::Base
|
|||
end
|
||||
|
||||
def join_course_request(course, user, role)
|
||||
@receive = User.find(course.tea_id)
|
||||
@course = course
|
||||
@user = user
|
||||
@role = role
|
||||
@subject = "#{@user.show_name} #{l(:label_apply_join_course)} #{@course.name} "
|
||||
mail :to => @receive.mail,
|
||||
:subject => @subject
|
||||
# @receive = User.find(course.tea_id)
|
||||
# @course = course
|
||||
# @user = user
|
||||
# @role = role
|
||||
# @subject = "#{@user.show_name} #{l(:label_apply_join_course)} #{@course.name} "
|
||||
# mail :to => @receive.mail,
|
||||
# :subject => @subject
|
||||
end
|
||||
|
||||
def apply_for_homework_request(homework, user)
|
||||
@receive = User.find(homework.user_id)
|
||||
@user = user
|
||||
@subject = "#{@user.show_name} #{l(:label_apply_for_homework)} #{homework.name} "
|
||||
mail :to => @receive.mail,
|
||||
:subject => @subject
|
||||
# @receive = User.find(homework.user_id)
|
||||
# @user = user
|
||||
# @subject = "#{@user.show_name} #{l(:label_apply_for_homework)} #{homework.name} "
|
||||
# mail :to => @receive.mail,
|
||||
# :subject => @subject
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -124,7 +124,7 @@ class Memo < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def send_mail
|
||||
Mailer.run.forum_message_added(self) if Setting.notified_events.include?('forum_message_added')
|
||||
# Mailer.run.forum_message_added(self) if Setting.notified_events.include?('forum_message_added')
|
||||
end
|
||||
|
||||
def creator_user
|
||||
|
@ -218,9 +218,9 @@ class Memo < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def send_notification
|
||||
if Setting.notified_events.include?('message_posted')
|
||||
Mailer.run.message_posted(self)
|
||||
end
|
||||
# if Setting.notified_events.include?('message_posted')
|
||||
# Mailer.run.message_posted(self)
|
||||
# end
|
||||
end
|
||||
|
||||
def plusParentAndForum
|
||||
|
|
|
@ -389,7 +389,7 @@ class Message < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def send_mail
|
||||
Mailer.run.message_posted(self) if Setting.notified_events.include?('message_posted')
|
||||
# Mailer.run.message_posted(self) if Setting.notified_events.include?('message_posted')
|
||||
end
|
||||
|
||||
# Time 2015-03-31 09:15:06
|
||||
|
|
|
@ -65,7 +65,7 @@ class News < ActiveRecord::Base
|
|||
:author_key => :author_id
|
||||
acts_as_watchable
|
||||
|
||||
after_create :act_as_course_activity, :add_author_as_watcher, :send_mail, :add_news_count, :act_as_student_score,:delay_news_wechat_send, :delay_news_send
|
||||
after_create :act_as_course_activity, :add_author_as_watcher, :add_news_count, :act_as_student_score,:delay_news_wechat_send, :delay_news_send
|
||||
after_update :update_activity
|
||||
after_destroy :delete_kindeditor_assets, :decrease_news_count, :delete_org_activities, :down_course_score
|
||||
|
||||
|
@ -241,7 +241,7 @@ class News < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def send_mail
|
||||
Mailer.run.news_added(self) if Setting.notified_events.include?('news_added')
|
||||
# Mailer.run.news_added(self) if Setting.notified_events.include?('news_added')
|
||||
end
|
||||
|
||||
def delete_org_activities
|
||||
|
|
|
@ -158,9 +158,9 @@ class RelativeMemo < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def send_notification
|
||||
if Setting.notified_events.include?('message_posted')
|
||||
Mailer.run.message_posted(self)
|
||||
end
|
||||
# if Setting.notified_events.include?('message_posted')
|
||||
# Mailer.run.message_posted(self)
|
||||
# end
|
||||
end
|
||||
|
||||
# def plusParentAndForum
|
||||
|
|
|
@ -17,12 +17,12 @@
|
|||
|
||||
class WikiContentObserver < ActiveRecord::Observer
|
||||
def after_create(wiki_content)
|
||||
Mailer.run.wiki_content_added(wiki_content) if Setting.notified_events.include?('wiki_content_added')
|
||||
# Mailer.run.wiki_content_added(wiki_content) if Setting.notified_events.include?('wiki_content_added')
|
||||
end
|
||||
|
||||
def after_update(wiki_content)
|
||||
if wiki_content.text_changed?
|
||||
Mailer.run.wiki_content_updated(wiki_content) if Setting.notified_events.include?('wiki_content_updated')
|
||||
end
|
||||
# if wiki_content.text_changed?
|
||||
# Mailer.run.wiki_content_updated(wiki_content) if Setting.notified_events.include?('wiki_content_updated')
|
||||
# end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -658,7 +658,7 @@ class CoursesService
|
|||
@state = 7
|
||||
end
|
||||
else
|
||||
Mailer.run.join_course_request(course, current_user, params[:role])
|
||||
# Mailer.run.join_course_request(course, current_user, params[:role])
|
||||
CourseMessage.create(:user_id => course.tea_id, :course_id => course.id, :viewed => false,:content=> role_str,:course_message_id=>current_user.id,:course_message_type=>'JoinCourseRequest',:status=>0)
|
||||
|
||||
#----------------微信通知----------------------
|
||||
|
|
224
db/schema.rb
224
db/schema.rb
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20161208015939) do
|
||||
ActiveRecord::Schema.define(:version => 20161223030701) do
|
||||
|
||||
create_table "activities", :force => true do |t|
|
||||
t.integer "act_id", :null => false
|
||||
|
@ -333,6 +333,8 @@ ActiveRecord::Schema.define(:version => 20161208015939) do
|
|||
t.date "commit_date"
|
||||
t.string "scmid"
|
||||
t.integer "user_id"
|
||||
t.integer "project_id"
|
||||
t.integer "type", :default => 0
|
||||
end
|
||||
|
||||
add_index "changesets", ["committed_on"], :name => "index_changesets_on_committed_on"
|
||||
|
@ -426,6 +428,14 @@ ActiveRecord::Schema.define(:version => 20161208015939) do
|
|||
add_index "comments", ["author_id"], :name => "index_comments_on_author_id"
|
||||
add_index "comments", ["commented_id", "commented_type"], :name => "index_comments_on_commented_id_and_commented_type"
|
||||
|
||||
create_table "commit_issues", :force => true do |t|
|
||||
t.string "commit_id"
|
||||
t.integer "issue_id"
|
||||
t.integer "project_id"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "commits", :force => true do |t|
|
||||
t.integer "repository_id"
|
||||
t.string "version"
|
||||
|
@ -437,54 +447,123 @@ ActiveRecord::Schema.define(:version => 20161208015939) do
|
|||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "contest_notifications", :force => true do |t|
|
||||
t.text "title"
|
||||
create_table "contest_activities", :force => true do |t|
|
||||
t.integer "user_id"
|
||||
t.integer "contest_id"
|
||||
t.integer "contest_act_id"
|
||||
t.string "contest_act_type"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
add_index "contest_activities", ["contest_id"], :name => "index_contest_activities_on_contest_id"
|
||||
add_index "contest_activities", ["user_id"], :name => "index_contest_activities_on_user_id"
|
||||
|
||||
create_table "contest_member_roles", :force => true do |t|
|
||||
t.integer "contest_member_id"
|
||||
t.integer "role_id"
|
||||
t.boolean "is_current", :default => true
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
add_index "contest_member_roles", ["contest_member_id"], :name => "index_contest_member_roles_on_contest_member_id"
|
||||
add_index "contest_member_roles", ["role_id"], :name => "index_contest_member_roles_on_role_id"
|
||||
|
||||
create_table "contest_members", :force => true do |t|
|
||||
t.integer "user_id"
|
||||
t.integer "contest_id"
|
||||
t.boolean "is_collect", :default => true
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
add_index "contest_members", ["contest_id"], :name => "index_contest_members_on_contest_id"
|
||||
add_index "contest_members", ["user_id"], :name => "index_contest_members_on_user_id"
|
||||
|
||||
create_table "contest_messages", :force => true do |t|
|
||||
t.integer "user_id"
|
||||
t.integer "contest_id"
|
||||
t.integer "contest_message_id"
|
||||
t.string "course_message_type"
|
||||
t.boolean "viewed", :default => false
|
||||
t.text "content"
|
||||
t.integer "status"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "contesting_projects", :force => true do |t|
|
||||
add_index "contest_messages", ["contest_id"], :name => "index_contest_messages_on_contest_id"
|
||||
add_index "contest_messages", ["user_id"], :name => "index_contest_messages_on_user_id"
|
||||
|
||||
create_table "contestant_for_contests", :force => true do |t|
|
||||
t.integer "student_id"
|
||||
t.integer "contest_id"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
add_index "contestant_for_contests", ["contest_id"], :name => "index_contestant_for_contests_on_contest_id"
|
||||
add_index "contestant_for_contests", ["student_id"], :name => "index_contestant_for_contests_on_student_id"
|
||||
|
||||
create_table "contestant_work_projects", :force => true do |t|
|
||||
t.integer "contest_id"
|
||||
t.integer "work_id"
|
||||
t.integer "contestant_work_id"
|
||||
t.integer "project_id"
|
||||
t.string "contest_id"
|
||||
t.integer "user_id"
|
||||
t.string "description"
|
||||
t.boolean "is_leader"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.string "reward"
|
||||
end
|
||||
|
||||
create_table "contesting_softapplications", :force => true do |t|
|
||||
t.integer "softapplication_id"
|
||||
t.integer "contest_id"
|
||||
add_index "contestant_work_projects", ["contest_id"], :name => "index_contestant_work_projects_on_contest_id"
|
||||
add_index "contestant_work_projects", ["contestant_work_id"], :name => "index_contestant_work_projects_on_contestant_work_id"
|
||||
add_index "contestant_work_projects", ["user_id"], :name => "index_contestant_work_projects_on_user_id"
|
||||
add_index "contestant_work_projects", ["work_id"], :name => "index_contestant_work_projects_on_work_id"
|
||||
|
||||
create_table "contestant_work_scores", :force => true do |t|
|
||||
t.integer "contestant_work_id"
|
||||
t.integer "user_id"
|
||||
t.string "description"
|
||||
t.integer "score"
|
||||
t.text "comment"
|
||||
t.integer "reviewer_role"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.string "reward"
|
||||
end
|
||||
|
||||
create_table "contestnotifications", :force => true do |t|
|
||||
t.integer "contest_id"
|
||||
t.string "title"
|
||||
t.string "summary"
|
||||
add_index "contestant_work_scores", ["contestant_work_id"], :name => "index_contestant_work_scores_on_contestant_work_id"
|
||||
add_index "contestant_work_scores", ["user_id"], :name => "index_contestant_work_scores_on_user_id"
|
||||
|
||||
create_table "contestant_works", :force => true do |t|
|
||||
t.string "name"
|
||||
t.text "description"
|
||||
t.integer "author_id"
|
||||
t.integer "notificationcomments_count"
|
||||
t.integer "work_id"
|
||||
t.integer "user_id"
|
||||
t.float "work_score"
|
||||
t.integer "project_id"
|
||||
t.integer "work_status"
|
||||
t.datetime "commit_time"
|
||||
t.boolean "is_delete", :default => false
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
add_index "contestant_works", ["project_id"], :name => "index_contestant_works_on_project_id"
|
||||
add_index "contestant_works", ["user_id"], :name => "index_contestant_works_on_user_id"
|
||||
add_index "contestant_works", ["work_id"], :name => "index_contestant_works_on_work_id"
|
||||
|
||||
create_table "contests", :force => true do |t|
|
||||
t.integer "user_id"
|
||||
t.string "name"
|
||||
t.string "budget", :default => ""
|
||||
t.integer "author_id"
|
||||
t.date "deadline"
|
||||
t.string "description"
|
||||
t.integer "commit"
|
||||
t.string "password"
|
||||
t.datetime "created_on", :null => false
|
||||
t.datetime "updated_on", :null => false
|
||||
t.text "description"
|
||||
t.boolean "is_public"
|
||||
t.boolean "is_delete", :default => false
|
||||
t.integer "visits", :default => 0
|
||||
t.string "invite_code"
|
||||
t.integer "invite_code_halt", :default => 0
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "course_activities", :force => true do |t|
|
||||
|
@ -516,20 +595,6 @@ ActiveRecord::Schema.define(:version => 20161208015939) do
|
|||
t.integer "container_id", :default => 0
|
||||
end
|
||||
|
||||
create_table "course_class_post", :id => false, :force => true do |t|
|
||||
t.integer "班级id", :default => 0, :null => false
|
||||
t.string "班级名"
|
||||
t.integer "帖子id", :default => 0, :null => false
|
||||
t.integer "主贴id"
|
||||
t.string "帖子标题", :default => "", :null => false
|
||||
t.text "帖子内容"
|
||||
t.integer "帖子用户id"
|
||||
t.integer "帖子回复数", :default => 0, :null => false
|
||||
t.integer "最后回帖id"
|
||||
t.datetime "发帖时间", :null => false
|
||||
t.datetime "帖子更新时间", :null => false
|
||||
end
|
||||
|
||||
create_table "course_contributor_scores", :force => true do |t|
|
||||
t.integer "course_id"
|
||||
t.integer "user_id"
|
||||
|
@ -629,6 +694,7 @@ ActiveRecord::Schema.define(:version => 20161208015939) do
|
|||
t.string "invite_code"
|
||||
t.string "qrcode"
|
||||
t.integer "qrcode_expiretime", :default => 0
|
||||
t.integer "professional_level_id", :limit => 1
|
||||
t.integer "invite_code_halt", :limit => 1, :default => 0
|
||||
end
|
||||
|
||||
|
@ -680,6 +746,14 @@ ActiveRecord::Schema.define(:version => 20161208015939) do
|
|||
add_index "custom_values", ["custom_field_id"], :name => "index_custom_values_on_custom_field_id"
|
||||
add_index "custom_values", ["customized_type", "customized_id"], :name => "custom_values_customized"
|
||||
|
||||
create_table "data_exceptions", :force => true do |t|
|
||||
t.string "message"
|
||||
t.integer "container_id"
|
||||
t.string "container_type"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "delayed_jobs", :force => true do |t|
|
||||
t.integer "priority", :default => 0, :null => false
|
||||
t.integer "attempts", :default => 0, :null => false
|
||||
|
@ -696,6 +770,11 @@ ActiveRecord::Schema.define(:version => 20161208015939) do
|
|||
|
||||
add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority"
|
||||
|
||||
create_table "disciplines", :force => true do |t|
|
||||
t.string "name"
|
||||
t.integer "professional_level_id", :limit => 1
|
||||
end
|
||||
|
||||
create_table "discuss_demos", :force => true do |t|
|
||||
t.string "title"
|
||||
t.text "body"
|
||||
|
@ -826,8 +905,6 @@ ActiveRecord::Schema.define(:version => 20161208015939) do
|
|||
t.datetime "publish_time"
|
||||
t.datetime "end_time"
|
||||
t.integer "show_result"
|
||||
t.integer "question_random", :default => 0
|
||||
t.integer "choice_random", :default => 0
|
||||
end
|
||||
|
||||
create_table "first_pages", :force => true do |t|
|
||||
|
@ -944,6 +1021,7 @@ ActiveRecord::Schema.define(:version => 20161208015939) do
|
|||
t.integer "is_open", :default => 0
|
||||
t.datetime "simi_time"
|
||||
t.integer "score_open", :default => 1
|
||||
t.integer "anonymous_appeal", :default => 0
|
||||
end
|
||||
|
||||
add_index "homework_commons", ["course_id", "id"], :name => "index_homework_commons_on_course_id_and_id"
|
||||
|
@ -970,6 +1048,7 @@ ActiveRecord::Schema.define(:version => 20161208015939) do
|
|||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.integer "no_anon_penalty", :default => 1
|
||||
t.integer "appeal_penalty", :default => 0
|
||||
end
|
||||
|
||||
create_table "homework_detail_programings", :force => true do |t|
|
||||
|
@ -1014,6 +1093,10 @@ ActiveRecord::Schema.define(:version => 20161208015939) do
|
|||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "innodb_monitor", :id => false, :force => true do |t|
|
||||
t.integer "a"
|
||||
end
|
||||
|
||||
create_table "invite_lists", :force => true do |t|
|
||||
t.integer "project_id"
|
||||
t.integer "user_id"
|
||||
|
@ -1545,9 +1628,12 @@ ActiveRecord::Schema.define(:version => 20161208015939) do
|
|||
end
|
||||
|
||||
create_table "professional_levels", :force => true do |t|
|
||||
t.string "level"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.integer "level"
|
||||
end
|
||||
|
||||
create_table "professions", :force => true do |t|
|
||||
t.string "name"
|
||||
t.integer "discipline_id", :limit => 1
|
||||
end
|
||||
|
||||
create_table "project_infos", :force => true do |t|
|
||||
|
@ -1610,7 +1696,6 @@ ActiveRecord::Schema.define(:version => 20161208015939) do
|
|||
t.boolean "hidden_repo", :default => false, :null => false
|
||||
t.integer "attachmenttype", :default => 1
|
||||
t.integer "user_id"
|
||||
t.integer "dts_test", :default => 0
|
||||
t.string "enterprise_name"
|
||||
t.integer "organization_id"
|
||||
t.integer "project_new_type"
|
||||
|
@ -1618,6 +1703,11 @@ ActiveRecord::Schema.define(:version => 20161208015939) do
|
|||
t.integer "forked_from_project_id"
|
||||
t.integer "forked_count"
|
||||
t.integer "publish_resource", :default => 0
|
||||
t.integer "boards_count", :default => 0
|
||||
t.integer "news_count", :default => 0
|
||||
t.integer "acts_count", :default => 0
|
||||
t.integer "journals_count", :default => 0
|
||||
t.integer "boards_reply_count", :default => 0
|
||||
t.integer "visits", :default => 0
|
||||
t.integer "hot", :default => 0
|
||||
t.string "invite_code"
|
||||
|
@ -1922,6 +2012,7 @@ ActiveRecord::Schema.define(:version => 20161208015939) do
|
|||
t.integer "work_status", :default => 0
|
||||
t.datetime "commit_time"
|
||||
t.integer "is_delete", :default => 0
|
||||
t.integer "appeal_penalty", :default => 0
|
||||
end
|
||||
|
||||
add_index "student_works", ["homework_common_id", "user_id"], :name => "index_student_works_on_homework_common_id_and_user_id"
|
||||
|
@ -1941,11 +2032,21 @@ ActiveRecord::Schema.define(:version => 20161208015939) do
|
|||
t.integer "reviewer_role"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.integer "appeal_status", :default => 0
|
||||
end
|
||||
|
||||
add_index "student_works_scores", ["student_work_id"], :name => "student_work_id"
|
||||
add_index "student_works_scores", ["user_id"], :name => "user_id"
|
||||
|
||||
create_table "student_works_scores_appeals", :force => true do |t|
|
||||
t.integer "student_works_score_id"
|
||||
t.integer "user_id"
|
||||
t.text "comment"
|
||||
t.integer "appeal_status"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "students_for_courses", :force => true do |t|
|
||||
t.integer "student_id"
|
||||
t.integer "course_id"
|
||||
|
@ -2016,6 +2117,7 @@ ActiveRecord::Schema.define(:version => 20161208015939) do
|
|||
t.string "pre_course"
|
||||
t.integer "visits", :default => 0
|
||||
t.integer "des_status", :default => 0
|
||||
t.integer "professional_level_id", :limit => 1
|
||||
end
|
||||
|
||||
add_index "syllabuses", ["user_id"], :name => "index_syllabuses_on_user_id"
|
||||
|
@ -2379,6 +2481,17 @@ ActiveRecord::Schema.define(:version => 20161208015939) do
|
|||
|
||||
add_index "wikis", ["project_id"], :name => "wikis_project_id"
|
||||
|
||||
create_table "work_detail_groups", :force => true do |t|
|
||||
t.integer "work_id"
|
||||
t.integer "min_num"
|
||||
t.integer "max_num"
|
||||
t.boolean "base_on_project"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
add_index "work_detail_groups", ["work_id"], :name => "index_work_detail_groups_on_work_id"
|
||||
|
||||
create_table "workflows", :force => true do |t|
|
||||
t.integer "tracker_id", :default => 0, :null => false
|
||||
t.integer "old_status_id", :default => 0, :null => false
|
||||
|
@ -2396,6 +2509,25 @@ ActiveRecord::Schema.define(:version => 20161208015939) do
|
|||
add_index "workflows", ["role_id", "tracker_id", "old_status_id"], :name => "wkfs_role_tracker_old_status"
|
||||
add_index "workflows", ["role_id"], :name => "index_workflows_on_role_id"
|
||||
|
||||
create_table "works", :force => true do |t|
|
||||
t.string "name"
|
||||
t.integer "user_id"
|
||||
t.text "description"
|
||||
t.date "publish_time"
|
||||
t.date "end_time"
|
||||
t.integer "work_type"
|
||||
t.integer "contest_id"
|
||||
t.boolean "is_delete", :default => false
|
||||
t.boolean "score_open", :default => true
|
||||
t.boolean "is_open", :default => false
|
||||
t.integer "work_status"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
add_index "works", ["contest_id"], :name => "index_works_on_contest_id"
|
||||
add_index "works", ["user_id"], :name => "index_works_on_user_id"
|
||||
|
||||
create_table "works_categories", :force => true do |t|
|
||||
t.string "category"
|
||||
t.datetime "created_at", :null => false
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace :homework_endtime do
|
|||
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.homework_endtime__added(homework_common, s.student_id).deliver
|
||||
# Mailer.homework_endtime__added(homework_common, s.student_id).deliver
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -53,7 +53,7 @@ namespace :homework_evaluation do
|
|||
homework_common.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 2)
|
||||
end
|
||||
# 邮件通知
|
||||
Mailer.send_mail_anonymous_comment_open(homework_common).deliver
|
||||
# Mailer.send_mail_anonymous_comment_open(homework_common).deliver
|
||||
else
|
||||
#作业数小于2,启动失败, 只给老师发
|
||||
# status==4 发送失败
|
||||
|
@ -65,7 +65,7 @@ namespace :homework_evaluation do
|
|||
end
|
||||
end
|
||||
# 邮件通知
|
||||
Mailer.send_mail_anonymous_comment_fail(homework_common).deliver
|
||||
# Mailer.send_mail_anonymous_comment_fail(homework_common).deliver
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -109,7 +109,7 @@ namespace :homework_evaluation do
|
|||
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
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace :homework_publishtime do
|
|||
homework.course_acts << CourseActivity.new(:user_id => homework.user_id,:course_id => homework.course_id)
|
||||
end
|
||||
# 邮件通知
|
||||
Mailer.run.homework_added(homework)
|
||||
# Mailer.run.homework_added(homework)
|
||||
end
|
||||
end
|
||||
Rails.logger.info("log--------------------------------homework_publish end")
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace :issue_due_date do
|
|||
end
|
||||
end
|
||||
# issue截止时间邮件提醒
|
||||
Mailer.issue_due_date(issue).deliver
|
||||
# Mailer.issue_due_date(issue).deliver
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue