diff --git a/Gemfile b/Gemfile index b14c25664..1bc9e6629 100644 --- a/Gemfile +++ b/Gemfile @@ -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' diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb index 7e5894b83..a22012390 100644 --- a/app/controllers/bids_controller.rb +++ b/app/controllers/bids_controller.rb @@ -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: [] diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index a55abd123..3cf69c777 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -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 diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index 56f760e13..5336ab54d 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -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] diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index a2933c577..8ef6f6b53 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -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 diff --git a/app/models/forum_observer.rb b/app/models/forum_observer.rb index 1c514d6ab..6afcac824 100644 --- a/app/models/forum_observer.rb +++ b/app/models/forum_observer.rb @@ -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 diff --git a/app/models/mailer.rb b/app/models/mailer.rb index 85ce46e8b..e8af704d8 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -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 diff --git a/app/models/memo_observer.rb b/app/models/memo_observer.rb index 66cabe923..e50bcf5a2 100644 --- a/app/models/memo_observer.rb +++ b/app/models/memo_observer.rb @@ -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 diff --git a/app/models/user.rb b/app/models/user.rb index cdda07c54..83e08254c 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -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 diff --git a/app/views/mailer/send_for_user_activities.html.erb b/app/views/mailer/send_for_user_activities.html.erb index 22b071a1f..ed7877360 100644 --- a/app/views/mailer/send_for_user_activities.html.erb +++ b/app/views/mailer/send_for_user_activities.html.erb @@ -1,40 +1,15 @@ -
-
+

+<%= @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? %>
    @@ -45,24 +20,24 @@ <% @course_news.each do |course_new|%> -
  • +
  • [ - - <%= 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;" %> ] <%= 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;"%> <%= l(:label_project_notice) %> - <%= 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;" %> - <%= course_new.created_on %> + <%= format_time(course_new.created_on) %>
  • <% end %> @@ -72,50 +47,50 @@ <% if !@bids.first.nil? || !@homeworks.first.nil? %>
      -

      <%= l(:label_homework_overview) %>>(<%= @bids.count %>)

      +

      <%= l(:label_homework_overview) %>(<%= @bids.count %>)

      <% unless @bids.first.nil?%> <% @bids.each do |bid| %> -
    • +
    • [ - <%= 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;" %> ] <%= 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;"%> <%= l(:label_course_homework) %> - <%= 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;" %> - <%= bid.created_on %> + <%= format_time(bid.created_on) %>
    • <% end %> <% end %> <% unless @homeworks.first.nil? %> <% @homeworks.each do |homework| %> -
    • +
    • [ - <%= 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;" %> ] <%= 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;"%> <%= l(:label_course_submit_homework) %> - <%= 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;" %> - <%= homework.created_on %> + <%= format_time(homework.created_on) %>
    • <% end %> <% end %> @@ -133,24 +108,24 @@ <% @course_journal_messages.each do |course_journal_message|%> -
    • +
    • [ - <%= 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;" %> ] <%= 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;"%> <%= 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], + <%= 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;" %> - <%= course_journal_message.created_on %> + <%= format_time(course_journal_message.created_on) %>
    • <% end %> @@ -167,24 +142,24 @@ <% @course_messages.each do |course_message|%> -
    • +
    • [ - <%= 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;" %> ] <%= 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;"%> <%= l(:label_send_course_messages) %> - <%= 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;" %> - <%= course_message.created_on %> + <%= format_time(course_message.created_on) %>
    • <% end %> @@ -200,34 +175,34 @@ <% @attachments.each do |attachment|%> -
    • +
    • [ - <%= 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;" %> ] <%= 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;"%> <%= l(:label_course_file_upload) %> - <%= 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;" %> - <%= course_message.created_on %> + <%= format_time(attachment.created_on) %>
    • <% end %> - +
    <% end %>
- - + <% end %> + <% if @issues.first || @project_messages.first %>
-

<%= l(:label_project_overview)%>

+

<%= l(:label_project_overview_new)%>

<% unless @issues.first.nil? %>

    @@ -236,24 +211,24 @@

    <% @issues.each do |issue|%> -
  • +
  • [ - <%= 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;" %> ] <%= 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;"%> <%= l(:label_project_issue) %> - <%= 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;" %> - <%= issue.created_on %> + <%= format_time(issue.created_on) %>
  • <% end %> @@ -265,28 +240,28 @@

      <%= 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], + <%= 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;" %> ] <%= 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;"%> <%= l(:label_send_course_messages) %> - <%= 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;" %> - <%= project_message.created_on %> + <%= format_time(project_message.created_on) %>
    • <% end %> @@ -297,10 +272,11 @@
- + <% end %> + <% unless @user_journal_messages.first.nil? %>

<%= l(:label_activities) %>

- <% unless @user_journal_messages.first.nil? %> +

    <%= l(:label_user_message) %> @@ -308,26 +284,86 @@

    <% @user_journal_messages.each do |user_journal_message|%> -
  • +
  • - <%= 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;" %> <%= l(:label_show_your_message) %> - <%= 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;" %> - <%= 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), + :class => "wmail_name", + :style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> + <%= l(:label_forum_new) %> + + <%= 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;" + %> + <%= format_time(forum.created_at) %>
  • + + <% 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), + :class => "wmail_name", + :style => "color:#fe5722; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %> + <%= 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)), + :class => 'wmail_info', + :style => "color:#5a5a5a; float:left; margin-right:5px; display:block;color:#1b55a7;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" + %> + <%= format_time(memo.created_at) %>
  • + + <% end %> + +
    +
+ <% end %> +
+<% end %>
<%= link_to l(:mail_footer), @user_url, :style => "margin-top:20px;color:#2775d2; margin-left:10px;" %>
diff --git a/app/views/mailer/send_for_user_activities.text.erb b/app/views/mailer/send_for_user_activities.text.erb index 03ea31ec3..b7d0553e3 100644 --- a/app/views/mailer/send_for_user_activities.text.erb +++ b/app/views/mailer/send_for_user_activities.text.erb @@ -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 %> + <%= 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) %> <% 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 %> + <% 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 %> <%= link_to l(:mail_footer), @user_url, :style => "margin-top:20px;color:#2775d2; margin-left:10px;" %> diff --git a/config/application.rb b/config/application.rb index 100beb93c..3b36d7cb7 100644 --- a/config/application.rb +++ b/config/application.rb @@ -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, diff --git a/config/initializers/send_mail.rb b/config/initializers/send_mail.rb index 4cfd3cc03..86b3a53fd 100644 --- a/config/initializers/send_mail.rb +++ b/config/initializers/send_mail.rb @@ -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 diff --git a/config/locales/en.yml b/config/locales/en.yml index 9d6172f23..db5d698ef 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -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 diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 472bf6fe2..ac35990fa 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -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 diff --git a/lib/redmine/notifiable.rb b/lib/redmine/notifiable.rb index 42a81980f..26ad31966 100644 --- a/lib/redmine/notifiable.rb +++ b/lib/redmine/notifiable.rb @@ -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