添加《邮件周日发送》功能,修改《贴吧》邮件发送策略

Signed-off-by: alan <547533434@qq.com>
This commit is contained in:
alan 2015-02-11 20:23:50 +08:00
parent 7442cc1ca4
commit 4bfc4493eb
16 changed files with 372 additions and 291 deletions

View File

@ -20,13 +20,8 @@ gem "builder", "3.0.0"
gem 'acts-as-taggable-on', '2.4.1'
gem 'spreadsheet'
gem 'ruby-ole'
<<<<<<< HEAD
gem 'email_verifier', path: 'lib/email_verifier'
=======
#gem 'email_verifier', path: 'lib/email_verifier'
gem 'rufus-scheduler'
>>>>>>> szzh
group :development do
gem 'grape-swagger'
gem 'grape-swagger-ui', git: 'https://github.com/guange2015/grape-swagger-ui.git'

View File

@ -9,7 +9,7 @@ class BidsController < ApplicationController
menu_item :homework_statistics, :only => :homework_statistics
menu_item :edit, :only => :edit
before_filter :auth_login1, :only => [:show_courseEx]
before_filter :can_show_course,only: []
before_filter :can_show_contest,only: []

View File

@ -5,7 +5,7 @@ class CoursesController < ApplicationController
helper :members
helper :words
before_filter :authorize1, :only => [:show, :feedback]
before_filter :auth_login1, :only => [:show, :feedback]
menu_item :overview
menu_item :feedback, :only => :feedback
menu_item :homework, :only => :homework

View File

@ -20,7 +20,7 @@ class FilesController < ApplicationController
layout 'base_projects' #by young
menu_item :files
before_filter :auth_login1, :only => [:index]
before_filter :find_project_by_project_id#, :except => [:getattachtype]
before_filter :authorize, :except => [:getattachtype,:quote_resource_show,:search]

View File

@ -18,7 +18,7 @@ class UsersController < ApplicationController
layout :setting_layout
#Added by young
before_filter :auth_login1, :only => [:show, :user_activities]
before_filter :auth_login1, :only => [:show, :user_activities, :user_newfeedback]
menu_item :activity
menu_item :user_information, :only => :info
menu_item :user_course, :only => :user_courses

View File

@ -1,8 +1,8 @@
class ForumObserver < ActiveRecord::Observer
def after_create(forum)
Thread.start do
Mailer.forum_add(forum).deliver if Setting.notified_events.include?('forum_add')
end
end
# def after_create(forum)
# Thread.start do
# Mailer.forum_add(forum).deliver if Setting.notified_events.include?('forum_add')
# end
#
# end
end

View File

@ -34,6 +34,7 @@ class Mailer < ActionMailer::Base
date_from = date_to - days.days
# 生成token用于直接点击登录
@user = user
token = Token.new(:user =>user , :action => 'autologin')
token.save
@token = token
@ -49,72 +50,69 @@ class Mailer < ActionMailer::Base
@issues = Issue.find_by_sql("select DISTINCT i.* from issues i, watchers w
where (i.assigned_to_id = #{user.id} or i.author_id = #{user.id}
or (w.watchable_type = 'Issue' and w.watchable_id = i.id and w.user_id = #{user.id}))
and (i.created_on between #{date_from} and #{date_to}) order by i.created_on desc")
and (i.created_on between '#{date_from}' and '#{date_to}') order by i.created_on desc")
# @bids 查询课程作业包括老师发布的作业以及user提交作业
# @attachments查询课程课件更新
@attachments ||= []
# 查询课程作业包括老师发布的作业以及user提交作业
@bids ||= [] # 老师发布的作业
courses.each do |course|
@bids << course.homeworks.where("created_at between #{date_from} and #{date_to} order by i.created_on desc")
end
# user 提交的作业
@homeworks = HomeworkAttach.where("user_id=#{user.id} and (created_at between #{date_from} and #{date_to})")
# 查询user在课程。项目中发布的讨论帖子
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 i.created_on desc")
@course_messages ||= []
@project_messages ||= []
messages.each do |msg|
if msg.project
@project_messages << msg
elsif msg.course
@course_messages << msg
unless courses.first.nil?
count = courses.count
count = count - 1
for i in 0..count do
bids = courses[i].homeworks.where("bids.created_on between '#{date_from}' and '#{date_to}'").order("bids.created_on desc")
attachments = courses[i].attachments.where("attachments.created_on between '#{date_from}' and '#{date_to}'").order('attachments.created_on DESC')
@bids += bids if bids.count > 0
@attachments += attachments if attachments.count > 0
end
end
# user 提交的作业
@homeworks = HomeworkAttach.where("user_id=#{user.id} and (created_at between '#{date_from}' and '#{date_to}')").order("created_at desc")
# 查询user在课程。项目中发布的讨论帖子
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")
@course_messages ||= []
@project_messages ||= []
unless messages.first.nil?
messages.each do |msg|
if msg.project
@project_messages << msg
elsif msg.course
@course_messages << msg
end
end
end
# 查询user在课程中发布的通知项目中发的新闻
@course_news = News.find_by_sql("select DISTINCT n.* from news n
where n.course_id in (#{course_ids})
and (created_on between #{date_from} and #{date_to}) order by i.created_on desc")
and (created_on between '#{date_from}' and '#{date_to}') order by created_on desc")
@project_news = News.find_by_sql("select DISTINCT n.* from news n where n.project_id in (#{project_ids})
and (created_on between #{date_from} and #{date_to}) order by i.created_on desc")
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 i.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')
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')
# 查询课程课件更新
@attachments ||= []
courses.each do |course|
@attachments << course.attachments.where("created_on between #{date_from} and #{date_to}").order('created_at DESC')
end
# 查询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 i.created_on desc")
@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 (created_at between #{date_from} and #{date_to}) order by i.created_on desc")
and (m.created_at between '#{date_from}' and '#{date_to}') order by m.created_at desc")
if days == 1
subject = "[ #{user.show_name} : #{date_from} - #{l(:label_day_mail)}]"
subject = "[ #{user.show_name} : #{l(:label_day_mail)}]"
@subject = " #{user.show_name} : #{date_to - 1.days} #{l(:label_day_mail)}"
else
subject = "[ #{user.show_name} : #{l(:label_week_mail)}]"
@subject = "#{user.show_name} : #{l(:label_week_mail)}"
end
mail :to => user.mail,:subject => "[ #{user.show_name} : #{l(:notice_successful_create)}]"
mail :to => user.mail,:subject => subject
end
# 贴吧新建贴吧发送邮件
# example Mailer.forum(forum).deliver
def forum_add(forum)
redmine_headers 'Forum' => forum.id
@forum = forum
@author = forum.creator
recipients = forum.creator.mail
# cc = wiki_content.page.wiki.watcher_recipients - recipients
@issue_author_url = url_for(user_activities_url(@author))
@forum_url = url_for(:controller => 'forums', :action => 'show', :id => forum.id)
mail :to => recipients,:subject => "[ #{l(:label_forum)} : #{forum.name} #{l(:notice_successful_create)}]"
end
def forum_message_added(memo)
@memo = memo
@ -124,15 +122,12 @@ class Mailer < ActionMailer::Base
@forum_url = url_for(:controller => 'forums', :action => 'show', :id => @forum.id)
@issue_author_url = url_for(user_activities_url(@author))
recipients ||= []
# if !memo.parent_id.nil?
# mems = memo.self_and_siblings
# mems.each do |mem|
# recipients << mem.author.mail unless recipients.include? mem.author.mail
# end
# else
# recipients << memo.author.mail
# end
recipients << @author.mail
if @forum.author.mail_notification != 'day' && @forum.author.mail_notification != 'week'
recipients << @forum.author.mail
end
if @author.mail_notification != 'day' && @author.mail_notification != 'week'
recipients << @author.mail
end
# cc = wiki_content.page.wiki.watcher_recipients - recipients
@memo_url = url_for(forum_memo_url(@forum, (@memo.parent_id.nil? ? @memo : @memo.parent_id)))
@ -167,6 +162,17 @@ class Mailer < ActionMailer::Base
Rails.logger.error "[Builds a Mail::Message ERROR] journalsForMessage's jour is unkown type, journalsForMessage.id = #{journals_for_message.id}"
return -1
end
# 验证用户的收取邮件的方式
recipients ||= []
recipients1 ||= []
if @mail.mail_notification != 'week' && @mail.mail_notification != 'day'
recipients1 = @mail.mail
end
if journals_for_message.jour.author.mail_notification != 'week' && journals_for_message.jour.author.mail_notification != 'day'
recipients = journals_for_message.jour.author.mail
end
# modify by nwb
#如果是直接留言并且留言对象是课程
if !journals_for_message.at_user && journals_for_message.jour.class.to_s.to_sym == :Course
@ -177,7 +183,9 @@ class Mailer < ActionMailer::Base
#收件人邮箱
@recipients ||= []
@members.each do |teacher|
if teacher.user.mail_notification != 'week' && teacher.user.mail_notification != 'day'
@recipients << teacher.user.mail
end
end
mail :to => @recipients,
:subject => "#{l(:label_your_course)}#{journals_for_message.jour.name}#{l(:label_have_message)} "
@ -185,14 +193,15 @@ class Mailer < ActionMailer::Base
if !journals_for_message.jour.author.notify_about? journals_for_message
return -1
end
mail :to => journals_for_message.jour.author.mail, :subject => @title
mail :to => recipients, :subject => @title
elsif journals_for_message.jour.class.to_s.to_sym == :Contest
if !journals_for_message.jour.author.notify_about? journals_for_message
return -1
end
mail :to => journals_for_message.jour.author.mail, :subject => @title
mail :to => recipients, :subject => @title
else
mail :to => @mail.mail, :subject => @title
mail :to => recipients1, :subject => @title
end
@ -269,12 +278,6 @@ class Mailer < ActionMailer::Base
@user_url = url_for(my_account_url(user,:token => @token.value))
@issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue.id, :anchor => "change-#{journal.id}", :token => @token.value)
s = "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] "
s << "(#{issue.status.name}) " if journal.new_value_for('status_id')
s << issue.subject

View File

@ -3,6 +3,7 @@ class MemoObserver < ActiveRecord::Observer
thread1=Thread.new do
Mailer.forum_message_added(memo).deliver if Setting.notified_events.include?('forum_message_added')
end
end
end

View File

@ -66,10 +66,8 @@ class User < Principal
MAIL_NOTIFICATION_OPTIONS = [
['all', :label_user_mail_option_all],
['selected', :label_user_mail_option_selected],
['only_my_events', :label_user_mail_option_only_my_events],
['only_assigned', :label_user_mail_option_only_assigned],
['only_owner', :label_user_mail_option_only_owner],
['week', :label_user_mail_option_week],
['day', :label_user_mail_option_day],
['none', :label_user_mail_option_none]
]
@ -188,7 +186,7 @@ class User < Principal
validates_confirmation_of :password, :allow_nil => true
validates_inclusion_of :mail_notification, :in => MAIL_NOTIFICATION_OPTIONS.collect(&:first), :allow_blank => true
validate :validate_password_length
validates_email_realness_of :mail
# validates_email_realness_of :mail
before_create :set_mail_notification
before_save :update_hashed_password
before_destroy :remove_references_before_destroy

View File

@ -1,40 +1,15 @@
<style>
body{ font-size:12px; font-family:"微软雅黑","宋体"; line-height:1.9; background:#fff; font-style:normal;}
div,html,img,ul,li,p,body,h1,h2,h3,h4,p,a,table,tr,td,fieldset,input,span,ol{ margin:0; padding:0;}
ul,li{ list-style-type:none;}
div,img,tr,td,table{ border:0;}
.cl{ clear:both; overflow:hidden; }
a{ text-decoration:none; }
.fl{ float: left;}
.fr{ float:right;}
.wmail_main{ padding:20px 10px 0px;}
.wmail_main ul li{ clear: both;}
.wmail_h2{ color:#15bccf; }
.wmail_h4{ color:#474646; font-size:14px; margin-bottom:5px;}
.wmail_num{ color:#fe3f0c; margin-left:5px; font-weight:normal;}
.wmail_column{ width:90px; font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;}
.wmail_b{color:#1b55a7; font-weight:bold; float:left;}
.wmail_name{ color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; width:50px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;}
.wmail_info{color:#5a5a5a; float:left; width:400px; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;}
.wmail_date{ color:#6e6e6e; float:right;display:block; margin-left:10px;}
.wmail_txt{ float:left; margin-right:5px;color:#6e6e6e;}
.wmail_column:hover{ color:#07397f; }
.wmail_name:hover{ color:#d03106;}
.wmail_info:hover{ color:#07397f;}
.wmail_dis{ float:left; color:#000000; margin-right:5px;}
.wmail_ul{ margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;}
.wmail_foot{ margin-top:20px;color:#2775d2; margin-left:10px;}
.wmail_foot:hover{color:#0b53a7;}
</style>
<div class="content">
<div class="wmail_main" style="padding:20px 10px 0px;">
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" >
<%= @subject %>
</h4>
<% if @attachments.first || @course_news.first || @bids.first ||
@homeworks.first || @course_journal_messages.first|| @course_messages.first %>
<div class="wmail_main" style="padding:20px 10px 0px;">
<h2 class="wmail_h2" style="color:#15bccf; "><%= l(:label_course_overview)%></h2>
<% unless @course_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:720px; margin-bottom:15px;">
@ -45,24 +20,24 @@
</h4>
<% @course_news.each do |course_new|%>
<li style="clear: both;">
<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:#1b55a7; font-weight:bold; float:left;">[</span>
<%= link_to course_new.course.name, [:controller => 'courses', :action => 'show', :id => course_new.course_id, :token => @token.value],
<%= link_to truncate(course_new.course.name,length: 30,omission: '...'), course_url(course_new.course, :token => @token.value),
:class=> "wmail_column",
:style=> "width:90px; font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
:style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">]</span>
<%= link_to course_new.author, user_activities_url(course_new.author,:token => @token.value), :class => "wmail_name",
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; width:50px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
:style => "color:#fe5722; 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:#6e6e6e;"><%= l(:label_project_notice) %></span>
<%= link_to course_new.title, [:controller => 'news', :action => 'show', :id => course_new.id,:token => @token.value],
<%= link_to truncate(course_new.title,length: 30,omission: '...'), news_url(course_new,:token => @token.value),
:class => 'wmail_info',
:style => "color:#5a5a5a; float:left; width:400px; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
%>
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= course_new.created_on %></span>
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(course_new.created_on) %></span>
</li>
<% end %>
@ -72,50 +47,50 @@
<% if !@bids.first.nil? || !@homeworks.first.nil? %>
<ul class="wmail_ul" style="clear: both;margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;">
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;"><%= l(:label_homework_overview) %>><span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @bids.count %>)</span></h4>
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;"><%= l(:label_homework_overview) %><span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @bids.count %>)</span></h4>
<% unless @bids.first.nil?%>
<% @bids.each do |bid| %>
<li style="clear: both;">
<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:#1b55a7; font-weight:bold; float:left;">[</span>
<%= link_to bid.courses.first.name, [:controller => 'courses', :action => 'show', :id => bid.courses.first.id, :token => @token.value],
<%= link_to truncate(bid.courses.first.name,length: 30,omission: '...'), course_url(bid.courses.first, :token => @token.value),
:class=> "wmail_column",
:style=> "width:90px; font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
:style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">]</span>
<%= link_to bid.author, user_activities_url(bid.author,:token => @token.value), :class => "wmail_name",
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; width:50px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
:style => "color:#fe5722; 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:#6e6e6e;"><%= l(:label_course_homework) %></span>
<%= link_to bid.name, course_for_bid(:id => bid.id,:token => @token.value),
<%= link_to truncate(bid.name,length: 30,omission: '...'), course_for_bid_url(:id => bid.id,:token => @token.value),
:class => 'wmail_info',
:style => "color:#5a5a5a; float:left; width:400px; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
%>
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= bid.created_on %></span>
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(bid.created_on) %></span>
</li>
<% end %>
<% end %>
<% unless @homeworks.first.nil? %>
<% @homeworks.each do |homework| %>
<li style="clear: both;">
<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:#1b55a7; font-weight:bold; float:left;">[</span>
<%= link_to homework.bid.courses.first.name, [:controller => 'courses', :action => 'show', :id => homework.bid.courses.first.id, :token => @token.value],
<%= link_to truncate(homework.bid.courses.first.name,length: 30,omission: '...'), course_url(homework.bid.courses.first, :token => @token.value),
:class=> "wmail_column",
:style=> "width:90px; font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
:style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">]</span>
<%= link_to homework.user, user_activities_url(homework.user,:token => @token.value), :class => "wmail_name",
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; width:50px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
:style => "color:#fe5722; 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:#6e6e6e;"><%= l(:label_course_submit_homework) %></span>
<%= link_to homework.name, course_for_bid(:id => homework.bid.id,:token => @token.value),
<%= link_to truncate(homework.name,length: 30,omission: '...'), course_for_bid_url(:id => homework.bid.id,:token => @token.value),
:class => 'wmail_info',
:style => "color:#5a5a5a; float:left; width:400px; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
%>
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= homework.created_on %></span>
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(homework.created_on) %></span>
</li>
<% end %>
<% end %>
@ -133,24 +108,24 @@
</h4>
<% @course_journal_messages.each do |course_journal_message|%>
<li style="clear: both;">
<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:#1b55a7; font-weight:bold; float:left;">[</span>
<%= link_to course_journal_message.course.name, [:controller => 'courses', :action => 'show', :id => course_journal_message.jour_id, :token => @token.value],
<%= link_to truncate(course_journal_message.course.name,length: 30,omission: '...'), course_url(course_journal_message.course, :token => @token.value),
:class=> "wmail_column",
:style=> "width:90px; font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
:style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">]</span>
<%= link_to course_journal_message.user, user_activities_url(course_journal_message.user,:token => @token.value), :class => "wmail_name",
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; width:50px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
:style => "color:#fe5722; 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:#6e6e6e;"><%= l(:label_send_course_journals_for_messages) %></span>
<%= link_to course_journal_message.notes, [:controller => 'courses', :action => 'feedback', :id => course_journal_message.jour_id,:token => @token.value],
<%= link_to truncate(course_journal_message.notes,length: 30,omission: '...'), course_feedback_url(course_journal_message.course,:token => @token.value),
:class => 'wmail_info',
:style => "color:#5a5a5a; float:left; width:400px; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
%>
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= course_journal_message.created_on %></span>
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(course_journal_message.created_on) %></span>
</li>
<% end %>
@ -167,24 +142,24 @@
</h4>
<% @course_messages.each do |course_message|%>
<li style="clear: both;">
<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:#1b55a7; font-weight:bold; float:left;">[</span>
<%= link_to course_message.course.name, [:controller => 'courses', :action => 'show', :id => course_message.course.id, :token => @token.value],
<%= link_to truncate(course_message.course.name,length: 30,omission: '...'), course_url(course_message.course.id, :token => @token.value),
:class=> "wmail_column",
:style=> "width:90px; font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
:style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">]</span>
<%= link_to course_message.author, user_activities_url(course_message.author,:token => @token.value), :class => "wmail_name",
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; width:50px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
:style => "color:#fe5722; 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:#6e6e6e;"><%= l(:label_send_course_messages) %></span>
<%= link_to course_message.subject,url_for(course_message.event_url(:token => @token.value)),
<%= 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:#5a5a5a; float:left; width:400px; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
%>
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= course_message.created_on %></span>
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(course_message.created_on) %></span>
</li>
<% end %>
@ -200,34 +175,34 @@
</h4>
<% @attachments.each do |attachment|%>
<li style="clear: both;">
<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:#1b55a7; font-weight:bold; float:left;">[</span>
<%= link_to attachment.course.name, [:controller => 'courses', :action => 'show', :id => attachment.course.id, :token => @token.value],
<%= link_to truncate(attachment.course.name,length: 30,omission: '...'), course_url(attachment.course, :token => @token.value),
:class=> "wmail_column",
:style=> "width:90px; font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
:style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">]</span>
<%= link_to attachment.author, user_activities_url(attachment.author,:token => @token.value), :class => "wmail_name",
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; width:50px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
:style => "color:#fe5722; 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:#6e6e6e;"><%= l(:label_course_file_upload) %></span>
<%= link_to attachment.filename,course_files_path(@course,:token => @token.value),
<%= link_to truncate(attachment.filename,length: 30,omission: '...'),course_files_url(attachment.course,:token => @token.value),
:class => 'wmail_info',
:style => "color:#5a5a5a; float:left; width:400px; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
%>
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= course_message.created_on %></span>
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(attachment.created_on) %></span>
</li>
<% end %>
<div class="cl"></div>
</ul><!--课件下载 end-->
<% end %>
</div><!--课程动态 end-->
<% end %>
<% if @issues.first || @project_messages.first %>
<div class="wmail_main" style="padding:20px 10px 0px;">
<h2 class="wmail_h2" style="color:#15bccf; "><%= l(:label_project_overview)%></h2>
<h2 class="wmail_h2" style="color:#15bccf; "><%= l(:label_project_overview_new)%></h2>
<% unless @issues.first.nil? %>
<ul class="wmail_ul" style="margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;">
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" >
@ -236,24 +211,24 @@
</h4>
<% @issues.each do |issue|%>
<li style="clear: both;">
<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:#1b55a7; font-weight:bold; float:left;">[</span>
<%= link_to issue.project.name, [:controller => 'projects', :action => 'show', :id => issue.project.id, :token => @token.value],
<%= link_to truncate(issue.project.name,length: 30,omission: '...'), project_url(issue.project, :token => @token.value),
:class=> "wmail_column",
:style=> "width:90px; font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
:style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">]</span>
<%= link_to issue.author, user_activities_url(issue.author,:token => @token.value), :class => "wmail_name",
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; width:50px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
:style => "color:#fe5722; 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:#6e6e6e;"><%= l(:label_project_issue) %></span>
<%= link_to issue.subject,url_for(:controller => 'issues', :action => 'show', :id => issue.id, :token => @token.value),
<%= link_to truncate(issue.subject,length: 30,omission: '...'),issue_url(issue, :token => @token.value),
:class => 'wmail_info',
:style => "color:#5a5a5a; float:left; width:400px; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
%>
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= issue.created_on %></span>
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(issue.created_on) %></span>
</li>
<% end %>
@ -265,28 +240,28 @@
<ul class="wmail_ul" style="margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;">
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" >
<%= l(:project_moule_boards_show) %>
<span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @course_journal_messages.count %>)</span>
<span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @project_messages.count %>)</span>
</h4>
<% @project_messages.each do |project_message|%>
<li style="clear: both;">
<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:#1b55a7; font-weight:bold; float:left;">[</span>
<%= link_to project_message.project.name, [:controller => 'projects', :action => 'show', :id => project_message.project.id, :token => @token.value],
<%= link_to truncate(project_message.project.name,length: 30,omission: '...'), project_url(project_message.project, :token => @token.value),
:class=> "wmail_column",
:style=> "width:90px; font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
:style=> " font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
<span class="wmail_b" style="color:#1b55a7; font-weight:bold; float:left;">]</span>
<%= link_to project_message.author, user_activities_url(project_message.author,:token => @token.value), :class => "wmail_name",
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; width:50px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
:style => "color:#fe5722; 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:#6e6e6e;"><%= l(:label_send_course_messages) %></span>
<%= link_to project_message.subject,url_for(project_message.event_url(:token => @token.value)),
<%= link_to truncate(project_message.subject,length: 30,omission: '...'),board_message_url(project_message, :board_id => project_message.board_id,:token => @token.value),
:class => 'wmail_info',
:style => "color:#5a5a5a; float:left; width:400px; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
%>
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= project_message.created_on %></span>
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(project_message.created_on) %></span>
</li>
<% end %>
@ -297,10 +272,11 @@
</div><!--项目动态 end-->
<% end %>
<% unless @user_journal_messages.first.nil? %>
<div class="wmail_main" style="padding:20px 10px 0px;">
<h2 class="wmail_h2" style="color:#15bccf; "><%= l(:label_activities) %></h2>
<% unless @user_journal_messages.first.nil? %>
<ul class="wmail_ul" style="margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;">
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" >
<%= l(:label_user_message) %>
@ -308,26 +284,86 @@
</h4>
<% @user_journal_messages.each do |user_journal_message|%>
<li>
<li style="clear: both; list-style: none;">
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
<%= link_to user_journal_message.user, user_activities_url(course_journal_message.user,:token => @token.value),
<%= link_to user_journal_message.user, user_activities_url(user_journal_message.user,:token => @token.value),
:class => "wmail_name",
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; width:50px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
:style => "color:#fe5722; 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:#6e6e6e;"><%= l(:label_show_your_message) %></span>
<%= link_to user_journal_message.notes, [:controller => 'courses', :action => 'feedback', :id => course_journal_message.jour_id,:token => @token.value],
<%= link_to truncate(user_journal_message.notes,length: 30,omission: '...'),feedback_url(@user,:token => @token.value),
:class => 'wmail_info',
:style => "color:#5a5a5a; float:left; width:400px; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
%>
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= user_journal_message.created_on %></span></li>
<span class="wmail_date" style="color:#6e6e6e; float:right;display:block; margin-left:10px;"><%= format_time(user_journal_message.created_on) %></span></li>
<% end %>
<div class="cl"></div>
</ul><!--课程动态 end-->
<% end %>
</div><!--个人动态 end-->
<% end %>
<% if @forums.first || @memos.first %>
<div class="wmail_main" style="padding:20px 10px 0px;">
<h2 class="wmail_h2" style="color:#15bccf; "><%= l(:lable_bar_active) %></h2>
<% unless @forums.first.nil? %>
<ul class="wmail_ul" style="margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;">
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" >
<%= l(:label_user_forum) %>
<span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @forums.count %>)</span>
</h4>
<% @forums.each do |forum|%>
<li style="clear: both; list-style: none;">
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
<%= link_to forum.author, user_activities_url(forum.author,:token => @token.value),
:class => "wmail_name",
:style => "color:#fe5722; 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:#6e6e6e;"><%= l(:label_forum_new) %></span>
<%= link_to truncate(forum.name,length: 30,omission: '...'),forum_url(forum,:token => @token.value),
:class => 'wmail_info',
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;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>
<% end %>
<div class="cl"></div>
</ul><!-- 新建贴吧 end-->
<% end %>
<% unless @memos.first.nil? %>
<ul class="wmail_ul" style="margin-left:10px; border-bottom:1px dashed #cfcfcf; padding-bottom:15px; width:720px; margin-bottom:15px;">
<h4 class="wmail_h4" style="color:#474646; font-size:14px; margin-bottom:5px;" >
<%= l(:label_user_message_forum) %>
<span class="wmail_num" style="color:#fe3f0c; margin-left:5px; font-weight:normal;">(<%= @memos.count %>)</span>
</h4>
<% @memos.each do |memo|%>
<li style="clear: both; list-style: none;">
<span class="wmail_dis" style="float:left; color:#000000; margin-right:5px;">▪</span>
<%= link_to memo.author, user_activities_url(memo.author,:token => @token.value),
:class => "wmail_name",
:style => "color:#fe5722; 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:#6e6e6e;"><%= l(:label_memo_new_from_forum) %></span>
<%= link_to truncate(memo.subject,length: 30,omission: '...'),forum_memo_url(memo.forum, (memo.parent_id.nil? ? memo : memo.parent_id)),
:class => 'wmail_info',
:style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;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>
<% end %>
<div class="cl"></div>
</ul><!-- 新建贴吧 end-->
<% end %>
</div><!--贴吧动态 end-->
<% end %>
<div class="wmail_foot" style="margin-top:20px;color:#2775d2; margin-left:10px;">
<%= link_to l(:mail_footer), @user_url, :style => "margin-top:20px;color:#2775d2; margin-left:10px;" %>
</div>

View File

@ -1,3 +1,6 @@
<%= @subject %>
<% if @attachments.first || @course_news.first || @bids.first ||
@homeworks.first || @course_journal_messages.first|| @course_messages.first %>
<%= l(:label_course_overview)%>
<% unless @course_news.first.nil? %>
<%= l(:label_course_news) %>
@ -9,19 +12,17 @@
[
<%= link_to course_new.course.name, [:controller => 'courses', :action => 'show', :id => course_new.course_id, :token => @token.value],
:class=> "wmail_column",
:style=> "width:90px; font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
<%= link_to truncate(course_new.course.name,length: 30,omission: '...'), course_url(course_new.course, :token => @token.value)%>
]
<%= link_to course_new.author, user_activities_url(course_new.author,:token => @token.value), :class => "wmail_name",
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; width:50px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
<%= link_to course_new.author, user_activities_url(course_new.author,:token => @token.value)
%>
<%= l(:label_project_notice) %>
<%= link_to course_new.title, [:controller => 'news', :action => 'show', :id => course_new.id,:token => @token.value],
:class => 'wmail_info',
:style => "color:#5a5a5a; float:left; width:400px; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
%> <%= course_new.created_on %>
<%= link_to truncate(course_new.title,length: 30,omission: '...'), news_url(course_new,:token => @token.value)
%> <%= format_time(course_new.created_on) %>
<% end %>
@ -33,20 +34,20 @@
[
<%= link_to bid.courses.first.name, [:controller => 'courses', :action => 'show', :id => bid.courses.first.id, :token => @token.value],
:class=> "wmail_column",
:style=> "width:90px; font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
<%= link_to truncate(bid.courses.first.name,length: 30,omission: '...'),course_url(bid.courses.first, :token => @token.value)
%>
]
<%= link_to bid.author, user_activities_url(bid.author,:token => @token.value), :class => "wmail_name",
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; width:50px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
<%= link_to bid.author, user_activities_url(bid.author,:token => @token.value)
%>
<%= l(:label_course_homework) %>
<%= link_to bid.name, course_for_bid(:id => bid.id,:token => @token.value),
:class => 'wmail_info',
:style => "color:#5a5a5a; float:left; width:400px; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
<%= link_to truncate(bid.name,length: 30,omission: '...'), course_for_bid_url(bid,:token => @token.value)
%>
<%= bid.created_on %>
<%= format_time(bid.created_on) %>
<% end %>
<% end %>
@ -54,20 +55,20 @@
<% @homeworks.each do |homework| %>
▪[
<%= link_to homework.bid.courses.first.name, [:controller => 'courses', :action => 'show', :id => homework.bid.courses.first.id, :token => @token.value],
:class=> "wmail_column",
:style=> "width:90px; font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
<%= link_to truncate(homework.bid.courses.first.name,length: 30,omission: '...'), course_url(homework.bid.courses.first, :token => @token.value)
%>
]
<%= link_to homework.user, user_activities_url(homework.user,:token => @token.value), :class => "wmail_name",
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; width:50px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
<%= link_to homework.user, user_activities_url(homework.user,:token => @token.value)
%>
<%= l(:label_course_submit_homework) %>
<%= link_to homework.name, course_for_bid(:id => homework.bid.id,:token => @token.value),
:class => 'wmail_info',
:style => "color:#5a5a5a; float:left; width:400px; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
<%= link_to truncate(homework.name,length: 30,omission: '...'), course_for_bid_url(homework.bid,:token => @token.value)
%>
<%= homework.created_on %> </li>
<%= format_time(homework.created_at) %>
<% end %>
<% end %>
@ -84,20 +85,20 @@
[
<%= link_to course_journal_message.course.name, [:controller => 'courses', :action => 'show', :id => course_journal_message.jour_id, :token => @token.value],
:class=> "wmail_column",
:style=> "width:90px; font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
<%= link_to truncate(course_journal_message.course.name,length: 30,omission: '...'), course_url(course_journal_message.course, :token => @token.value)
%>
]
<%= link_to course_journal_message.user, user_activities_url(course_journal_message.user,:token => @token.value), :class => "wmail_name",
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; width:50px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
<%= link_to course_journal_message.user, user_activities_url(course_journal_message.user,:token => @token.value)
%>
<%= l(:label_send_course_journals_for_messages) %>
<%= link_to course_journal_message.notes, [:controller => 'courses', :action => 'feedback', :id => course_journal_message.jour_id,:token => @token.value],
:class => 'wmail_info',
:style => "color:#5a5a5a; float:left; width:400px; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
<%= link_to truncate(course_journal_message.notes,length: 30,omission: '...'), course_feedback_url(course_journal_message.course,:token => @token.value)
%>
<%= course_journal_message.created_on %>
<%= format_time(course_journal_message.created_on) %>
<% end %>
@ -115,20 +116,20 @@
[
<%= link_to course_message.course.name, [:controller => 'courses', :action => 'show', :id => course_message.course.id, :token => @token.value],
:class=> "wmail_column",
:style=> "width:90px; font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
<%= link_to truncate(course_message.course.name,length: 30,omission: '...'), course_url(course_message.course, :token => @token.value)
%>
]
<%= link_to course_message.author, user_activities_url(course_message.author,:token => @token.value), :class => "wmail_name",
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; width:50px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
<%= link_to course_message.author, user_activities_url(course_message.author,:token => @token.value)
%>
<%= l(:label_send_course_messages) %>
<%= link_to course_message.subject,url_for(course_message.event_url(:token => @token.value)),
:class => 'wmail_info',
:style => "color:#5a5a5a; float:left; width:400px; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
<%= link_to truncate(course_message.subject,length: 30,omission: '...'),board_message_url(course_message, :board_id => course_message.board_id,:token => @token.value)
%>
<%= course_message.created_on %>
<%= format_time(course_message.created_on) %>
<% end %>
@ -144,29 +145,29 @@
<% @attachments.each do |attachment|%>
▪[
<%= link_to attachment.course.name, [:controller => 'courses', :action => 'show', :id => attachment.course.id, :token => @token.value],
:class=> "wmail_column",
:style=> "width:90px; font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
<%= link_to truncate(attachment.course.name,length: 30,omission: '...'), course_url(attachment.course, :token => @token.value)
%>
]
<%= link_to attachment.author, user_activities_url(attachment.author,:token => @token.value), :class => "wmail_name",
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; width:50px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
<%= link_to attachment.author, user_activities_url(attachment.author,:token => @token.value)
%>
<%= l(:label_course_file_upload) %>
<%= link_to attachment.filename,course_files_path(@course,:token => @token.value),
:class => 'wmail_info',
:style => "color:#5a5a5a; float:left; width:400px; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
<%= link_to truncate(attachment.filename,length: 30,omission: '...'),course_files_url(attachment.course,:token => @token.value)
%>
<%= course_message.created_on %>
<%= format_time(attachment.created_on) %>
</li>
<% end %>
</ul><!--课件下载 end-->
<% end %>
</div><!--课程动态 end-->
<% end %><!--课程动态 end-->
<%= l(:label_project_overview)%>
<% @issues.first || @project_messages.first %>
<%= l(:label_project_overview_new)%>
<% unless @issues.first.nil? %>
<%= l(:label_issue_tracking) %>
@ -176,20 +177,20 @@
[
<%= link_to issue.project.name, [:controller => 'projects', :action => 'show', :id => issue.project.id, :token => @token.value],
:class=> "wmail_column",
:style=> "width:90px; font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
<%= link_to truncate(issue.project.name,length: 30,omission: '...'), project_url(issue.project, :token => @token.value)
%>
]
<%= link_to issue.author, user_activities_url(issue.author,:token => @token.value), :class => "wmail_name",
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; width:50px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
<%= link_to issue.author, user_activities_url(issue.author,:token => @token.value)
%>
<%= l(:label_project_issue) %>
<%= link_to issue.subject,url_for(:controller => 'issues', :action => 'show', :id => issue.id, :token => @token.value),
:class => 'wmail_info',
:style => "color:#5a5a5a; float:left; width:400px; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
<%= link_to truncate(issue. subject,length: 30,omission: '...'),issue_url(issue, :token => @token.value)
%>
<%= issue.created_on %>
<%= format_time(issue.created_on) %>
<% end %>
@ -198,34 +199,34 @@
<% unless @project_messages.first.nil? %>
<%= l(:project_moule_boards_show) %>
(<%= @course_journal_messages.count %>)
(<%= @project_messages.count %>)
<% @project_messages.each do |project_message|%>
▪[
<%= link_to project_message.project.name, [:controller => 'projects', :action => 'show', :id => project_message.project.id, :token => @token.value],
:class=> "wmail_column",
:style=> "width:90px; font-weight: bold; display:block; float:left; color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
]
<%= link_to truncate(project_message.project.name,length: 30,omission: '...'), project_url(project_message.project, :token => @token.value)
%>
]
<%= link_to project_message.author, user_activities_url(project_message.author,:token => @token.value), :class => "wmail_name",
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; width:50px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
<%= link_to project_message.author, board_message_url(project_message, :board_id => project_message.board_id,:token => @token.value)
%>
<%= l(:label_send_course_messages) %>
<%= link_to project_message.subject,url_for(project_message.event_url(:token => @token.value)),
:class => 'wmail_info',
:style => "color:#5a5a5a; float:left; width:400px; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
<%= link_to truncate(project_message. subject,length: 30,omission: '...'),board_message_url(project_message, :board_id => project_message.board_id,:token => @token.value)
%>
<%= project_message.created_on %>
<%= format_time(project_message.created_on) %>
<% end %>
<% end %>
<% unless @user_journal_messages.first.nil? %>
<%= l(:label_activities) %>
<% unless @user_journal_messages.first.nil? %>
<%= l(:label_user_message) %>
(<%= @user_journal_messages.count %>)
@ -233,21 +234,63 @@
<% @user_journal_messages.each do |user_journal_message|%>
<%= link_to user_journal_message.user, user_activities_url(course_journal_message.user,:token => @token.value),
:class => "wmail_name",
:style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; width:50px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
<%= link_to user_journal_message.user, user_activities_url(user_journal_message.user,:token => @token.value)
%>
<%= l(:label_show_your_message) %>
<%= link_to user_journal_message.notes, [:controller => 'courses', :action => 'feedback', :id => course_journal_message.jour_id,:token => @token.value],
:class => 'wmail_info',
:style => "color:#5a5a5a; float:left; width:400px; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
<%= link_to truncate(user_journal_message.notes,length: 30,omission: '...'), feedback_url(@user,:token => @token.value)
%>
<%= user_journal_message.created_on %>
<%= format_time(user_journal_message.created_on) %>
<% end %>
<% end %>
<
<% end %>
<% if @forums.first || @memos.first %>
<%= l(:lable_bar_active) %>
<% unless @forums.first.nil? %>
<%= l(:label_user_forum) %>
(<%= @forums.count %>)
<% @forums.each do |forum|%>
<%= link_to forum.author, user_activities_url(forum.author,:token => @token.value) %>
<%= l(:label_forum_new) %>
<%= link_to truncate(forum.name,length: 30,omission: '...'),forum_url(forum,:token => @token.value)
%>
<%= format_time(forum.created_at) %>
<% end %>
<!-- 新建贴吧 end-->
<% end %>
<% unless @memos.first.nil? %>
<%= l(:label_user_message_forum) %>
(<%= @memos.count %>)
<% @memos.each do |memo|%>
<%= link_to memo.author, user_activities_url(memo.author,:token => @token.value)%>
<%= l(:label_memo_new_from_forum) %>
<%= link_to truncate(memo.subject,length: 30,omission: '...'),forum_memo_url(memo.forum, (memo.parent_id.nil? ? memo : memo.parent_id))
%>
<%= format_time(memo.created_at) %>
<% end %>
<!-- 新建贴吧 end-->
<% end %>
<!--贴吧动态 end-->
<% end %>
<%= link_to l(:mail_footer), @user_url, :style => "margin-top:20px;color:#2775d2; margin-left:10px;" %>

View File

@ -17,9 +17,7 @@ module RedmineApp
# -- all .rb files in that directory are automatically loaded.
#verifier if email is real
EmailVerifier.config do |config|
config.verifier_email = "alanlong9278@126.com"
end
config.generators do |g|
g.test_framework :rspec,

View File

@ -6,18 +6,22 @@ require 'rufus-scheduler'
#users = User.where("mail_notification = 'week' or mail_notification = 'day'")
scheduler = Rufus::Scheduler.new
scheduler.cron('*/1 * * * *') do
users = User.where("login like '%alan%'")
scheduler.cron('0 0 * * 1') do
users = User.where("mail_notification = 'week'")
users.each do |user|
# if user.mail_notification == "week"
# cycle = '*/1 * * * *'
# else
# cycle = '*/2 * * * *'
# end
Rails.logger.info "send mail to #{user.show_name}(#{user.mail}) at #{Time.now}"
#Rails.logger.info "send mail to #{user.show_name}(#{user.mail}) at #{Time.now}"
Thread.start do
Mailer.send_for_user_activities(user, Date.today, 7).deliver
end
end
end
scheduler.cron('0 0 * * *') do
users = User.where("mail_notification = 'day'")
users.each do |user|
#Rails.logger.info "send mail to #{user.show_name}(#{user.mail}) at #{Time.now}"
Thread.start do
Mailer.send_for_user_activities(user, Date.today, 1).deliver
end
end
end

View File

@ -616,8 +616,8 @@ en:
label_document_new: New document
label_document_plural: Documents
label_document_added: Document added
label_forum_message_added: Message added
label_forum_add: Forum added
label_forum_message_added: Forum's message added
#label_forum_add: Forum added
label_document_public_info: "If you don't choose public, only the project's members can see the document."
label_role: Role
label_role_plural: Roles
@ -2089,4 +2089,4 @@ en:
label_anonymous: Anonymous
label_submit_comments: Submit_comments
label_course_empty_select: You have not selected course
label_enterprise_page_made: enterprise_page
label_enterprise_page_made: enterprise_page

View File

@ -573,7 +573,7 @@ zh:
label_document_new: 新建文档
label_document_plural: 文档
label_document_added: 文档已添加
label_forum_message_added: 发帖成功
label_forum_message_added: 贴吧发帖成功
label_forum_add: 贴吧创建成功
label_message_reply: 回帖人
label_document_public_info: (打钩为公开,不打钩则不公开,若不公开,仅项目成员可见该文档。)
@ -664,6 +664,8 @@ zh:
label_user_login_attending_contest: 您还没有登录,请登录后参赛
label_user_login_score_and_comment: 您还没有登录,请登录后对作品进行打分评价
label_user_login_notificationcomment: 您还没有登录,请登录后参加评论
label_user_forum: 您的贴吧
label_user_message_forum: 您的帖子
label_user_message: 您的留言
label_show_your_message: 给您的留言
#end
@ -755,7 +757,8 @@ zh:
label_settings: 配置
label_overview: 近期动态
label_course_overview: "课程动态"
label_project_overview: "项目动态"
label_project_overview_new: "项目动态"
label_forums_overview: "贴吧动态"
label_homework_overview: 作业动态
label_question_student: 作业交流 #bai
label_homework_commit: 提交作业 #huang
@ -968,7 +971,9 @@ zh:
label_theme: 主题
label_default: 默认
label_search_titles_only: 仅在标题中搜索
label_user_mail_option_all: "收取我的项目的所有通知"
label_user_mail_option_all: "收取我的所有通知"
label_user_mail_option_week: "按周收取我的所有通知"
label_user_mail_option_day: "按天收取我的所有通知"
label_must_answer: "必答"
label_poll_title: 问卷调查_问卷页面
#huang

View File

@ -20,9 +20,7 @@ module Redmine
notifications << Notifiable.new('message_posted')
notifications << Notifiable.new('wiki_content_added')
notifications << Notifiable.new('wiki_content_updated')
notifications << Notifiable.new('forum_add')
notifications << Notifiable.new('forum_message_added', 'forum_add')
notifications
notifications << Notifiable.new('forum_message_added')
end
end
end