邮件按天发送中添加wiki
This commit is contained in:
parent
8609e9efc8
commit
c72f522493
|
@ -125,11 +125,17 @@ class Mailer < ActionMailer::Base
|
||||||
# user 提交的作业
|
# user 提交的作业
|
||||||
# @homeworks = HomeworkAttach.where("user_id=#{user.id} and (created_at between '#{date_from}' and '#{date_to}')").order("created_at desc")
|
# @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
|
||||||
|
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在课程中发布的讨论帖子
|
# 查询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
|
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 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")
|
and (me.created_on between '#{date_from}' and '#{date_to}') order by created_on desc")
|
||||||
|
|
||||||
# 查询user在项目中发布的讨论帖子
|
# 查询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
|
b.id = me.board_id and b.project_id = m.project_id
|
||||||
|
@ -167,7 +173,7 @@ class Mailer < ActionMailer::Base
|
||||||
and (m.created_at between '#{date_from}' and '#{date_to}') order by m.created_at desc")
|
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,
|
has_content = [@issues,@course_messages,@project_messages,@course_news,@project_news,
|
||||||
@course_journal_messages,@user_journal_messages,@forums,@memos,@attachments,@bids].any? {|o| !o.empty?}
|
@course_journal_messages,@user_journal_messages,@forums,@memos,@attachments,@bids,@wiki_contents].any? {|o| !o.empty?}
|
||||||
mylogger.debug "Sent activity mail : #{user.mail} - #{has_content}"
|
mylogger.debug "Sent activity mail : #{user.mail} - #{has_content}"
|
||||||
#有内容才发,没有不发
|
#有内容才发,没有不发
|
||||||
mail :to => user.mail,:subject => subject if has_content
|
mail :to => user.mail,:subject => subject if has_content
|
||||||
|
|
|
@ -231,6 +231,38 @@
|
||||||
</ul><!--项目论坛 end-->
|
</ul><!--项目论坛 end-->
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
<!--项目wiki-->
|
||||||
|
<% unless @wiki_contents.first.nil? %>
|
||||||
|
<ul class="wmail_ul" style=" list-style-type:none;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_wiki) %>
|
||||||
|
<!--<span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%#= @project_news.count %>)</span>-->
|
||||||
|
</span>
|
||||||
|
<% @wiki_contents.each do |wikicontent|%>
|
||||||
|
<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>
|
||||||
|
<% unless wikicontent.page.nil? %>
|
||||||
|
<%= link_to truncate(wikicontent.page.wiki.project.name,length: 30,omission: '...'), project_url(wikicontent.page.wiki.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;" %>
|
||||||
|
<% end %>
|
||||||
|
<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>
|
||||||
|
<% 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>
|
||||||
|
</li>
|
||||||
|
<% end %>
|
||||||
|
<div class="cl"></div>
|
||||||
|
</ul><!-- 项目wikiend -->
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<!--项目新闻-->
|
<!--项目新闻-->
|
||||||
<% unless @project_news.first.nil? %>
|
<% unless @project_news.first.nil? %>
|
||||||
<ul class="wmail_ul" style=" list-style-type:none;clear: both;margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:1020px; margin-bottom:15px;">
|
<ul class="wmail_ul" style=" list-style-type:none;clear: both;margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:1020px; margin-bottom:15px;">
|
||||||
|
|
Loading…
Reference in New Issue