This commit is contained in:
sw 2014-05-28 17:07:50 +08:00
commit 91497d3f95
6 changed files with 29 additions and 17 deletions

View File

@ -1,9 +1,7 @@
# Added by young
class JournalsForMessageObserver < ActiveRecord::Observer
def after_create(journals_for_message)
Thread.new do
Mailer.journals_for_message_add(User.current, journals_for_message).deliver
end
end
end

View File

@ -44,16 +44,7 @@ class Mailer < ActionMailer::Base
when :Bid
respond_url(journals_for_message.jour, anchor: "word_li_#{journals_for_message.id}")
when :Project
if journals_for_message.jour.project_type == 1
project = journals_for_message.jour
@teachers = searchTeacherAndAssistant journals_for_message.jour
@recipients ||= []
@teachers.each do |teacher|
@recipients << teacher
end
mail :to => @recipients,
:subject => "您的课程#{journals_for_message.jour.name}中有了新的留言"
end
return -1 if journals_for_message.jour.project_type == Project::ProjectType_project
project_feedback_url(journals_for_message.jour, anchor: "word_li_#{journals_for_message.id}")
when :Contest
show_contest_contest_url(journals_for_message.jour, anchor: "word_li_#{journals_for_message.id}")
@ -63,7 +54,23 @@ class Mailer < ActionMailer::Base
logger.error "[Builds a Mail::Message ERROR] journalsForMessage's jour is unkown type, journalsForMessage.id = #{journals_for_message.id}"
return -1
end
mail :to => @mail.mail, :subject => @title
#如果是直接留言并且留言对象是Project并且Project类型是课程
if !journals_for_message.at_user && journals_for_message.jour.class.to_s.to_sym == :Project && journals_for_message.jour.project_type == 1
project = journals_for_message.jour
#课程的教师
@teachers = searchTeacherAndAssistant journals_for_message.jour
#收件人邮箱
@recipients ||= []
@teachers.each do |teacher|
@recipients << teacher.user.mail
end
mail :to => @recipients,
:subject => "#{l(:label_your_course)}#{journals_for_message.jour.name}#{l(:label_have_message)} "
else
mail :to => @mail.mail, :subject => @title
end
end
# Builds a Mail::Message object used to email recipients of the added issue.
@ -433,7 +440,10 @@ class Mailer < ActionMailer::Base
headers[:to].delete(@author.mail) if headers[:to].is_a?(Array)
headers[:cc].delete(@author.mail) if headers[:cc].is_a?(Array)
end
if !User.current.nil?
#不给本人发邮件
headers[:to].delete(User.current.mail) if headers[:to].is_a?(Array)
end
if @author && @author.logged?
redmine_headers 'Sender' => @author.login
end

View File

@ -57,7 +57,7 @@
</tr>
<tr>
<td colspan="1" valign="top" style="width: 300px">&nbsp;
<strong>发布人:&nbsp; <%= link_to (display_id ? homework.user.realname : homework.user ), user_path(homework.user)%></strong>
<strong>发布人:&nbsp; <%= link_to ( is_teacher ? homework.user.realname : homework.user ), user_path(homework.user)%></strong>
</td>
<td>
<strong>作业评分:</strong>

View File

@ -18,7 +18,7 @@
<td colspan="2" valign="top">
<strong> <%= h(e.project) if @project.nil? || @project.id != e.project.id %></strong>
<span class="font_lighter">
<%= link_to_user(e.event_author,@canShowRealName) if e.respond_to?(:event_author) %>
<%= link_to_user(e.event_author) if e.respond_to?(:event_author) %>(<%= link_to_user(e.event_author,@canShowRealName) if e.respond_to?(:event_author) %>)
<%= l(:label_new_activity) %> </span>
<%= link_to "#{eventToLanguageCourse(e.event_type, @project)}: "<< format_activity_title(e.event_title), (e.event_type.eql?("attachment")&&e.container.kind_of?(Project)) ? project_files_path(e.container) : e.event_url %>
@ -86,7 +86,7 @@
#判断是否显示真名
if @canShowRealName
%>
<%= link_to (h @user.try(:realname)), user_path(@user) if @user %>
<%= link_to (h @user.try(:name)), user_path(@user) if @user %>(<%= link_to (h @user.try(:realname)), user_path(@user) if @user %>)
<% else %>
<%= link_to (h @user.try(:name)), user_path(@user) if @user %>
<% end %>

View File

@ -1617,6 +1617,8 @@ en:
label_class_hour: period
label_activity_time: publish date
label_your_course: your course
label_have_message : have a new message
label_login_prompt: Email/NickName
# ajax异步验证

View File

@ -1499,6 +1499,8 @@ zh:
label_tags_numbers: Tag统计
label_max_number: 昵称是在网站中显示的您的公开标识至多25个字符。
label_mail_attention: qq邮箱可能收不到此邮件其他邮箱如果没有收到可能在垃圾邮件中其中gmail与教育网邮箱的激活邮件有时比较慢请耐心等待。
label_your_course: 您的课程《
label_have_message : 》有新的留言
label_all_revisions: 所有版本:
label_upassword_info: 该密码在项目组内可共享
label_how_commit_code: 查看如何提交代码: