diff --git a/app/models/mailer.rb b/app/models/mailer.rb
index 8b8ed7d73..729da17c3 100644
--- a/app/models/mailer.rb
+++ b/app/models/mailer.rb
@@ -127,6 +127,11 @@ class Mailer < ActionMailer::Base
end
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 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")
@@ -194,7 +199,7 @@ class Mailer < ActionMailer::Base
@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,
+ 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?}
mylogger.debug "Sent activity mail : #{user.mail} - #{has_content}"
#有内容才发,没有不发
diff --git a/app/views/mailer/send_for_user_activities.html.erb b/app/views/mailer/send_for_user_activities.html.erb
index 70dab08f0..324e20cb3 100644
--- a/app/views/mailer/send_for_user_activities.html.erb
+++ b/app/views/mailer/send_for_user_activities.html.erb
@@ -382,6 +382,37 @@
<% end %>
+
+ <% unless @project_attachments.first.nil? %>
+
+
+ <%= l(:label_project_mail_attachments) %>
+
+ <% @project_attachments.each do |project_attachment|%>
+ -
+ ▪
+ [
+
+ <%= link_to truncate(project_attachment.project.name,length: 30,omission: '...'), project_url(project_attachment.project, :token => @token.value),
+ :class=> "wmail_column",
+ :style=> " font-weight: bold; display:block; float:left; color:#666;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
+ ]
+
+ <%= link_to project_attachment.author, user_activities_url(project_attachment.author,:token => @token.value), :class => "wmail_name",
+ :style => "color:#2E8DD7; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
+ <%= l(:label_project_mail_upload) %>
+
+ <%= link_to truncate(project_attachment.filename,length: 30,omission: '...'),project_files_url(project_attachment.project,:token => @token.value),
+ :class => 'wmail_info',
+ :style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
+ %>
+ <%= format_time(project_attachment.created_on) %>
+
+ <% end %>
+
+
+ <% end %>
+
<% unless @project_journal_messages.first.nil? %>
diff --git a/app/views/mailer/send_for_user_activities.text.erb b/app/views/mailer/send_for_user_activities.text.erb
index 43a4dbe9e..bcafb896f 100644
--- a/app/views/mailer/send_for_user_activities.text.erb
+++ b/app/views/mailer/send_for_user_activities.text.erb
@@ -168,6 +168,18 @@
<% end %>
+
+ <% unless @project_attachments.first.nil? %>
+ <%= l(:label_project_mail_attachments) %>
+ <% @project_attachments.each do |project_attachment|%>
+ ▪[<%= link_to truncate(project_attachment.project.name,length: 30,omission: '...'), project_url(project_attachment.project, :token => @token.value) %>]
+ <%= link_to project_attachment.author, user_activities_url(project_attachment.author,:token => @token.value) %>
+ <%= l(:label_project_mail_upload) %>
+ <%= link_to truncate(project_attachment.filename,length: 30,omission: '...'),project_files_url(project_attachment.project,:token => @token.value) %>
+ <%= format_time(project_attachment.created_on) %>
+ <% end %>
+ <% end %>
+
<% unless @project_journal_messages.first.nil? %>
<%= l(:label_project_mail_feedback) %>
diff --git a/config/locales/projects/en.yml b/config/locales/projects/en.yml
index 57ef221b0..b142c6ca8 100644
--- a/config/locales/projects/en.yml
+++ b/config/locales/projects/en.yml
@@ -41,7 +41,9 @@ en:
lable_sure_exit_project: "Are you sure exit from the projcet"
label_member: "Members"
- project_module_attachments: "Resources"
+ project_module_attachments: "Resources"
+ label_project_mail_attachments: Project Resources
+ label_project_mail_upload: had uploaded project resources
label_invite: Invitation
label_invite_new_user: "Send email to invite new user"
diff --git a/config/locales/projects/zh.yml b/config/locales/projects/zh.yml
index 42eea8dcc..5bf8957bf 100644
--- a/config/locales/projects/zh.yml
+++ b/config/locales/projects/zh.yml
@@ -62,7 +62,9 @@ zh:
label_development_team: 开发模式
label_member: 成员
- project_module_attachments: 资源
+ project_module_attachments: 资源
+ label_project_mail_attachments: 项目资源
+ label_project_mail_upload: 上传了资源
label_invite: 邀请