按天发送中添加项目留言
This commit is contained in:
parent
c72f522493
commit
15697e05ed
|
@ -126,18 +126,18 @@ class Mailer < ActionMailer::Base
|
|||
# @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 wc.* FROM wikis w, members m, projects p, wiki_pages wp, wiki_contents wc where
|
||||
@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
|
||||
and (wc.updated_on between '#{date_from}' and '#{date_to}') order by updated_on desc")
|
||||
|
||||
# 查询user在课程中发布的讨论帖子
|
||||
course_mesages = Message.find_by_sql("select distinct me.* from messages me, boards b, members m where
|
||||
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 created_on desc")
|
||||
|
||||
# 查询user在项目中发布的讨论帖子
|
||||
project_messages = Message.find_by_sql("select distinct me.* from messages me, boards b, members m where
|
||||
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 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")
|
||||
|
@ -164,16 +164,21 @@ class Mailer < ActionMailer::Base
|
|||
|
||||
# 查询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")
|
||||
jour_type='Course' and user_id = #{user.id} and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc")
|
||||
@user_journal_messages = user.journals_for_messages.where("m_parent_id IS NULL and (created_on between '#{date_from}' and '#{date_to}')").order('created_on DESC')
|
||||
|
||||
# 查询user在项目中留言(用户反馈)
|
||||
@project_journal_messages = JournalsForMessage.find_by_sql("select 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.user_id = m.user_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")
|
||||
@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,@course_messages,@project_messages,@course_news,@project_news,
|
||||
@course_journal_messages,@user_journal_messages,@forums,@memos,@attachments,@bids,@wiki_contents].any? {|o| !o.empty?}
|
||||
@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}"
|
||||
#有内容才发,没有不发
|
||||
mail :to => user.mail,:subject => subject if has_content
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<%= @subject %>
|
||||
</h4>
|
||||
<% if @attachments.first || @course_news.first || @bids.first ||
|
||||
@course_journal_messages.first|| @course_messages.first %>
|
||||
@course_journal_messages.first|| @course_messages.first || @attachments.first %>
|
||||
<div class="wmail_main" style="padding:20px 10px 0px;">
|
||||
<h3 class="wmail_h2" style="color:#15bccf; "><%= l(:label_course_overview)%></h3>
|
||||
<% unless @course_news.first.nil? %>
|
||||
|
@ -167,7 +167,7 @@
|
|||
<% end %>
|
||||
|
||||
<!--项目相关-->
|
||||
<% if @issues.first || @project_messages.first %>
|
||||
<% if @issues.first || @project_messages.first || @wiki_contents.first || @project_news.first || @project_journal_messages.first %>
|
||||
<div class="wmail_main" style="padding:20px 10px 0px;">
|
||||
<h3 class="wmail_h2" style="color:#15BCCF; "><%= l(:label_project_overview_new)%></h3>
|
||||
<% unless @issues.first.nil? %>
|
||||
|
@ -293,6 +293,38 @@
|
|||
</ul><!-- 项目新闻end -->
|
||||
<% end %>
|
||||
|
||||
<!--项目留言-->
|
||||
<% unless @project_journal_messages.first.nil? %>
|
||||
<ul class="wmail_ul" style="clear: both;margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:1020px; margin-bottom:15px;">
|
||||
<span class="wmail_h4" style="color:#666; font-size:14px; margin-bottom:5px;" >
|
||||
<%= l(:label_project_mail_feedback) %>
|
||||
<!--<span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%#= @course_journal_messages.count %>)</span>-->
|
||||
</span>
|
||||
|
||||
<% @project_journal_messages.each do |project_journal_message|%>
|
||||
<li style="clear: both; list-style: none;">
|
||||
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
|
||||
<span class="wmail_b" style="color:#666; font-weight:bold; float:left;">[</span>
|
||||
|
||||
<%= link_to truncate(project_journal_message.project.name,length: 30,omission: '...'), project_url(project_journal_message.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;" %>
|
||||
<span class="wmail_b" style="color:#666; font-weight:bold; float:left;">]</span>
|
||||
|
||||
<%= link_to project_journal_message.project.user, user_activities_url(project_journal_message.project.user,: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_send_course_journals_for_messages) %></span>
|
||||
|
||||
<%= link_to truncate(project_journal_message.project.notes,length: 30,omission: '...'), project_feedback_url(project_journal_message.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;"
|
||||
%>
|
||||
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(project_journal_message.project.created_on) %></span>
|
||||
</li>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</ul><!--项目留言 end-->
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %><!-- 项目动态end -->
|
||||
|
||||
|
|
|
@ -20,4 +20,4 @@ zh:
|
|||
mail_issue_sent_from: "来源:"
|
||||
mail_issue_from_project: "项目问题跟踪"
|
||||
mail_issue_attachments: "附件:"
|
||||
mail_issue_reply: "我要回复"
|
||||
mail_issue_reply: "我要回复"
|
||||
|
|
|
@ -395,7 +395,8 @@ zh:
|
|||
|
||||
label_issue_score: issue得分
|
||||
label_issue_number: issue的数量
|
||||
label_issue_journal_number: issue的留言数量
|
||||
label_issue_journal_number: issue的留言数量
|
||||
label_project_mail_feedback: 项目留言
|
||||
|
||||
label_news_score: 新闻得分
|
||||
label_new_number: 新闻的数量
|
||||
|
|
Loading…
Reference in New Issue