更新:wiki项目其它成员可以收到;

项目、课程留言其它成员可以收到
邮件显示页面国际化
This commit is contained in:
huang 2015-06-11 16:30:14 +08:00
parent 7bf4cfd218
commit a4f1edcdee
4 changed files with 98 additions and 31 deletions

View File

@ -103,7 +103,7 @@ class Mailer < ActionMailer::Base
course_ids = courses.map {|course| course.id}.join(",")
# 查询user的缺陷项目中成员都能收到
sql = "select * from members m, issues i where i.project_id = m.project_id and m.user_id='#{user.id}'
sql = "select DISTINCT * from members m, issues i where i.project_id = m.project_id and m.user_id='#{user.id}'
and (i.created_on between '#{date_from}' and '#{date_to}') order by i.created_on desc"
@issues = Issue.find_by_sql(sql)
@ -127,7 +127,7 @@ class Mailer < ActionMailer::Base
# 查询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 p.user_id = m.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
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 updated_on desc")
# 查询user在课程中发布的讨论帖子
@ -163,13 +163,16 @@ class Mailer < ActionMailer::Base
and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc") : []
# 查询user在课程及个人中留言
@course_journal_messages = JournalsForMessage.find_by_sql("select DISTINCT * from journals_for_messages where
jour_type='Course' and user_id = #{user.id} and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc")
@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 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 * from journals_for_messages where
jour_type='Project' and user_id = #{user.id} and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc")
@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 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")

View File

@ -29,7 +29,7 @@
:class => 'wmail_info',
:style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
%>
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(course_new.created_on) %></span>
<span class="wmail_date" style="color:#6e6e6e; float:left;display:block; margin-left:40px;"><%= format_time(course_new.created_on) %></span>
</li>
<% end %>
<div class="cl"></div>
@ -62,7 +62,7 @@
:class => 'wmail_info',
:style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
%>
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(bid.created_at) %></span>
<span class="wmail_date" style="color:#6e6e6e; float:left;display:block; margin-left:40px;"><%= format_time(bid.created_at) %></span>
</li>
<% end %>
<% end %>
@ -97,7 +97,7 @@
:class => 'wmail_info',
:style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
%>
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(course_journal_message.created_on) %></span>
<span class="wmail_date" style="color:#6e6e6e; float:left;display:block; margin-left:40px;"><%= format_time(course_journal_message.created_on) %></span>
</li>
<% end %>
<div class="cl"></div>
@ -125,7 +125,7 @@
<%= link_to truncate(course_message.subject,length: 30,omission: '...'),board_message_url(course_message, :board_id => course_message.board_id,: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;" %>
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(course_message.created_on) %></span>
<span class="wmail_date" style="color:#6e6e6e; float:left;display:block; margin-left:40px;"><%= format_time(course_message.created_on) %></span>
</li>
<% end %>
<div class="cl"></div>
@ -157,7 +157,7 @@
:class => 'wmail_info',
:style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
%>
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(attachment.created_on) %></span>
<span class="wmail_date" style="color:#6e6e6e; float:left;display:block; margin-left:40px;"><%= format_time(attachment.created_on) %></span>
</li>
<% end %>
<div class="cl"></div>
@ -190,7 +190,7 @@
<%= link_to truncate(issue.subject,length: 30,omission: '...'),issue_url(issue, :token => @token.value),
:style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
%>
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(issue.created_on) %></span>
<span class="wmail_date" style="color:#6e6e6e; float:left;display:block; margin-left:40px;"><%= format_time(issue.created_on) %></span>
</li>
<% end %>
@ -223,7 +223,7 @@
:class => 'wmail_info',
:style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
%>
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(project_message.created_on) %></span>
<span class="wmail_date" style="color:#6e6e6e; float:left;display:block; margin-left:40px;"><%= format_time(project_message.created_on) %></span>
</li>
<% end %>
@ -250,13 +250,13 @@
<span class="wmail_b" style="color:#666; font-weight:bold; float:left;">]</span>
<%= link_to wikicontent.author, user_activities_url(wikicontent.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;"%>
<span class="wmail_txt" style="float:left; margin-right:5px;color:#ACAEB1;"><%= l(:label_project_notice) %></span>
<span class="wmail_txt" style="float:left; margin-right:5px;color:#ACAEB1;"><%= l(:label_wiki_mail_notification) %></span>
<% unless wikicontent.page.nil? %>
<%= link_to truncate(wikicontent.text.html_safe, length: 30,omission: '...'), project_wiki_url(wikicontent.page.wiki,: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;" %>
<% end %>
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(wikicontent.updated_on) %></span>
<span class="wmail_date" style="color:#6e6e6e; float:left;display:block; margin-left:40px;"><%= format_time(wikicontent.updated_on) %></span>
</li>
<% end %>
<div class="cl"></div>
@ -281,12 +281,12 @@
<span class="wmail_b" style="color:#666; font-weight:bold; float:left;">]</span>
<%= link_to project_new.author, user_activities_url(project_new.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;"%>
<span class="wmail_txt" style="float:left; margin-right:5px;color:#ACAEB1;"><%= l(:label_project_notice) %></span>
<span class="wmail_txt" style="float:left; margin-right:5px;color:#ACAEB1;"><%= l(:label_project_mail_notice) %></span>
<%= link_to truncate(project_new.title,length: 30,omission: '...'), news_url(project_new,: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;" %>
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(project_new.created_on) %></span>
<span class="wmail_date" style="color:#6e6e6e; float:left;display:block; margin-left:40px;"><%= format_time(project_new.created_on) %></span>
</li>
<% end %>
<div class="cl"></div>
@ -319,7 +319,7 @@
:class => 'wmail_info',
:style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
%>
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(project_journal_message.created_on) %></span>
<span class="wmail_date" style="color:#6e6e6e; float:left;display:block; margin-left:40px;"><%= format_time(project_journal_message.created_on) %></span>
</li>
<% end %>
<div class="cl"></div>
@ -352,7 +352,7 @@
:class => 'wmail_info',
:style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
%>
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(user_journal_message.created_on) %></span></li>
<span class="wmail_date" style="color:#6e6e6e; float:left;display:block; margin-left:40px;"><%= format_time(user_journal_message.created_on) %></span></li>
<% end %>
@ -384,7 +384,7 @@
:class => 'wmail_info',
:style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
%>
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(forum.created_at) %></span></li>
<span class="wmail_date" style="color:#6e6e6e; float:left;display:block; margin-left:40px;"><%= format_time(forum.created_at) %></span></li>
<% end %>
@ -411,7 +411,7 @@
:class => 'wmail_info',
:style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
%>
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(memo.created_at) %></span></li>
<span class="wmail_date" style="color:#6e6e6e; float:left;display:block; margin-left:40px;"><%= format_time(memo.created_at) %></span></li>
<% end %>

View File

@ -4,7 +4,7 @@
<%= l(:label_course_overview)%>
<% unless @course_news.first.nil? %>
<%= l(:label_course_news) %>
(<%= @course_news.count %>)
<% @course_news.each do |course_new|%>
@ -28,7 +28,7 @@
<% end %>
<% unless @bids.empty? %>
<%= l(:label_homework_overview) %><%= @bids.count %>
<%= l(:label_homework_overview) %>
<% unless @bids.first.nil?%>
<% @bids.each do |bid| %>
@ -58,7 +58,7 @@
<% unless @course_journal_messages.first.nil? %>
<%= l(:view_course_journals_for_messages) %> (<%= @course_journal_messages.count %>)
<%= l(:view_course_journals_for_messages) %>
<% @course_journal_messages.each do |course_journal_message|%>
@ -88,7 +88,7 @@
<% unless @course_messages.first.nil? %>
<%= l(:view_borad_course) %>
(<%= @course_messages.count %>)
<% @course_messages.each do |course_message|%>
@ -119,7 +119,7 @@
<% unless @attachments.first.nil? %>
<%= l(:label_course_attendingcontestwork_download) %>
(<%= @attachments.count %>)
<% @attachments.each do |attachment|%>
@ -146,12 +146,12 @@
<% end %>
<% end %><!--课程动态 end-->
<% @issues.first || @project_messages.first %>
<% @issues.first || @project_messages.first || @wiki_contents.first || @project_news.first || @project_journal_messages.first %>
<%= l(:label_project_overview_new)%>
<% unless @issues.first.nil? %>
<%= l(:label_issue_tracking) %>
(<%= @issues.count %>)
<% @issues.each do |issue|%>
@ -179,7 +179,7 @@
<% unless @project_messages.first.nil? %>
<%= l(:project_moule_boards_show) %>
(<%= @project_messages.count %>)
<% @project_messages.each do |project_message|%>
▪[
@ -200,6 +200,68 @@
<%= format_time(project_message.created_on) %>
<% end %>
<% unless @wiki_contents.first.nil? %>
<%= l(:label_wiki) %>
<% @wiki_contents.each do |wikicontent|%>
▪[
<% unless wikicontent.page.nil? %>
<%= link_to truncate(wikicontent.page.wiki.project.name,length: 30,omission: '...'), project_url(wikicontent.page.wiki.project, :token => @token.value)
%>
<% end %>
]
<%= link_to wikicontent.author, user_activities_url(wikicontent.author,:token => @token.value) %>
<%= l(:label_project_notice) %>
<% unless wikicontent.page.nil? %>
<%= link_to truncate(wikicontent.text.html_safe, length: 30,omission: '...'), project_wiki_url(wikicontent.page.wiki,:token => @token.value) %>
<% end %>
<%= format_time(wikicontent.updated_on) %>
<% end %>
<% end %>
<!--项目新闻-->
<% unless @project_news.first.nil? %>
<%= l(:label_project_news) %>
<% @project_news.each do |project_new|%>
▪[
<%= link_to truncate(project_new.project.name,length: 30,omission: '...'), project_url(project_new.project, :token => @token.value)
%>
]
<%= link_to project_new.author, user_activities_url(project_new.author,:token => @token.value)
%>
<%= l(:label_project_notice) %>
<%= link_to truncate(project_new.title,length: 30,omission: '...'), news_url(project_new,:token => @token.value)
%>
<%= format_time(project_new.created_on) %>
<% end %>
<% end %>
<!--项目留言-->
<% unless @project_journal_messages.first.nil? %>
<%= l(:label_project_mail_feedback) %>
<% @project_journal_messages.each do |project_journal_message|%>
▪[
<%= link_to truncate(project_journal_message.project.name,length: 30,omission: '...'), project_url(project_journal_message.project, :token => @token.value)
%>
]
<%= link_to project_journal_message.user, user_activities_url(project_journal_message.user,:token => @token.value) %>
<%= l(:label_send_course_journals_for_messages) %>
<%= link_to truncate(project_journal_message.notes.html_safe,length: 30,omission: '...'), project_feedback_url(project_journal_message.project,:token => @token.value)
%>
<%= format_time(project_journal_message.created_on) %>
<% end %>
<% end %>
<% end %>
@ -234,7 +296,7 @@
<% unless @forums.first.nil? %>
<%= l(:label_user_forum) %>
(<%= @forums.count %>)
<% @forums.each do |forum|%>
@ -253,7 +315,7 @@
<% unless @memos.first.nil? %>
<%= l(:label_user_message_forum) %>
(<%= @memos.count %>)
<% @memos.each do |memo|%>

View File

@ -783,6 +783,7 @@ zh:
label_project_newother: "查看其他评论"
label_project_newshare: "分享了"
label_project_notice: "发布了通知:"
label_project_mail_notice: "发布了新闻:"
label_project_issue: "发布了问题:"
label_project_newadd: "添加了"
label_project_unadd: "暂无项目,赶快去创建吧!"
@ -1505,6 +1506,7 @@ zh:
label_news_number: 新闻的数量
label_wiki_number: wiki的数量
label_wiki_mail_notification: 发布了wiki