diff --git a/app/controllers/journals_controller.rb b/app/controllers/journals_controller.rb
index f6e17593f..aa3a7e0ea 100644
--- a/app/controllers/journals_controller.rb
+++ b/app/controllers/journals_controller.rb
@@ -56,7 +56,7 @@ class JournalsController < ApplicationController
@diff = Redmine::Helpers::Diff.new(@detail.value, @detail.old_value)
respond_to do |format|
format.html {
- render :layout => 'project_base'
+ render :layout => 'new_base'
}
end
end
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index efe5a52ee..6ad450315 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -413,10 +413,11 @@ class ProjectsController < ApplicationController
# 2、加入项目、创建角色
# 3、用户得分
if params[:mail]
- user = User.find(params[:user_id])
+ userid = Token.find_by_value(params[:token]).user_id
+ user = User.find(userid)
user.activate!
- Member.create(:role_ids => [4], :user_id => params[:user_id],:project_id => params[:id])
- UserGrade.create(:user_id => params[:user_id], :project_id => params[:id])
+ Member.create(:role_ids => [4], :user_id => userid, :project_id => params[:id])
+ UserGrade.create(:user_id => userid, :project_id => params[:id])
token = Token.get_token_from_user(user, 'autologin')
#user = User.try_to_autologin(token.value)
if user
@@ -456,7 +457,6 @@ class ProjectsController < ApplicationController
end
end
@members = paginateHelper @members
- render :layout => 'base_courses' if @project.project_type == 1
end
#判断指定用户是否为课程教师
@@ -675,9 +675,9 @@ class ProjectsController < ApplicationController
def memberAccess
# 是课程,则判断当前用户是否参加了课程
- return 0 if @project.project_type == Project::ProjectType_project
- currentUser = User.current
- render_403 unless currentUser.member_of?(@project)
+ # return 0 if @project.project_type == Project::ProjectType_project
+ # currentUser = User.current
+ render_403 unless User.current.member_of?(@project)
end
def toggleCourse
diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb
index aae150728..e4f9a7a81 100644
--- a/app/helpers/issues_helper.rb
+++ b/app/helpers/issues_helper.rb
@@ -361,15 +361,16 @@ module IssuesHelper
end
end
+ # 之所以注释是因为该功能冗余了
if detail.property == 'attr' && detail.prop_key == 'description'
s = l(:text_journal_changed_no_detail, :label => label)
- unless no_html
- diff_link = link_to l(:label_diff),
- {:controller => 'journals', :action => 'diff', :id => detail.journal_id,
- :detail_id => detail.id, :only_path => options[:only_path]},
- :title => l(:label_view_diff)
- s << " (#{ diff_link })"
- end
+ # unless no_html
+ # diff_link = link_to l(:label_diff),
+ # {:controller => 'journals', :action => 'diff', :id => detail.journal_id,
+ # :detail_id => detail.id, :only_path => options[:only_path]},
+ # :title => l(:label_view_diff)
+ # s << " (#{ diff_link })"
+ # end
s.html_safe
elsif detail.value.present?
case detail.property
diff --git a/app/models/document.rb b/app/models/document.rb
index 6bfb4b8ff..37983d6d4 100644
--- a/app/models/document.rb
+++ b/app/models/document.rb
@@ -85,7 +85,7 @@ class Document < ActiveRecord::Base
# Description 新创建的document要在公共表ForgeActivity中记录
def act_as_forge_activity
self.forge_acts << ForgeActivity.new(:user_id => self.user_id,
- :project_id => self.project_id)
+ :project_id => self.project_id)
end
def send_mail
diff --git a/app/models/homework_common.rb b/app/models/homework_common.rb
index ac10b2516..291c14563 100644
--- a/app/models/homework_common.rb
+++ b/app/models/homework_common.rb
@@ -18,7 +18,7 @@ class HomeworkCommon < ActiveRecord::Base
:description => :description,
:author => :author,
:url => Proc.new {|o| {:controller => 'student_work', :action => 'index', :homework => o.id}}
- after_create :act_as_activity
+ after_create :act_as_activity, :send_mail
after_destroy :delete_kindeditor_assets
def act_as_activity
@@ -28,4 +28,9 @@ class HomeworkCommon < ActiveRecord::Base
def delete_kindeditor_assets
delete_kindeditor_assets_from_disk self.id,OwnerTypeHelper::HOMEWORKCOMMON
end
+
+ def send_mail
+ Mailer.run.homework_added(self)
+ end
+
end
diff --git a/app/models/mailer.rb b/app/models/mailer.rb
index 8488fc1d0..d0ee99421 100644
--- a/app/models/mailer.rb
+++ b/app/models/mailer.rb
@@ -61,8 +61,8 @@ class Mailer < ActionMailer::Base
InviteList.create(:user_id => user.id, :project_id => project.id)
User.current = user unless User.current.nil?
@user = user
-
- @project_url = url_for(:controller => 'projects', :action => 'member', :id => project.id, :user_id => user.id, :mail => true)
+ @token = Token.get_token_from_user(user, 'autologin')
+ @project_url = url_for(:controller => 'projects', :action => 'member', :id => project.id, :mail => true, :token => @token.value)
mail :to => email, :subject => @subject
end
@@ -104,9 +104,14 @@ class Mailer < ActionMailer::Base
# 查询user的缺陷,项目中成员都能收到
sql = "select DISTINCT * from members m, issues i where i.project_id = m.project_id and m.user_id='#{user.id}'
- and (i.created_on between '#{date_from}' and '#{date_to}') order by i.created_on desc"
+ and (i.updated_on between '#{date_from}' and '#{date_to}') order by i.updated_on desc"
@issues = Issue.find_by_sql(sql)
+ # issue回复
+ @issues_journals = Journal.find_by_sql("select j.* from journals j, members m, projects p, issues i
+ where m.user_id = '#{user.id}' and p.id = m.project_id and i.project_id = p.id and j.journalized_id = i.id
+ and j.journalized_type='Issue' and (j.created_on between '#{date_from}' and '#{date_to}') order by created_on desc")
+
# @bids 查询课程作业,包括老师发布的作业,以及user提交作业
# @attachments查询课程课件更新
@attachments ||= []
@@ -122,6 +127,11 @@ class Mailer < ActionMailer::Base
end
end
+
+ # 项目附件
+ @project_attachments = Attachment.find_by_sql("select DISTINCT a.* from members m, attachments a
+ where a.container_id = m.project_id and m.user_id='#{user.id}' and container_type = 'Project' and (a.created_on between '#{date_from}' and '#{date_to}') order by a.created_on desc")
+
# user 提交的作业
# @homeworks = HomeworkAttach.where("user_id=#{user.id} and (created_at between '#{date_from}' and '#{date_to}')").order("created_at desc")
@@ -155,13 +165,23 @@ class Mailer < ActionMailer::Base
end
# wiki
- # 查询user在课程中发布的通知,项目中发的新闻
+ # 查询user在课程中发布的通知和回复通知
@course_news = (course_ids && !course_ids.empty?) ? 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 created_on desc") : []
+
+ @course_news_comments = Comment.find_by_sql("select cm.* from comments cm, members m, courses c, news n
+ where m.user_id = '#{user.id}' and c.id = m.course_id and n.course_id = c.id and cm.commented_id = n.id
+ and cm.commented_type ='News' and (cm.created_on between '#{date_from}' and '#{date_to}') order by created_on desc")
+
+ # 查询user在项目中添加新闻和回复新闻
@project_news = (project_ids && !project_ids.empty?) ? 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 created_on desc") : []
+ @project_news_comments = Comment.find_by_sql("select c.* from comments c, members m, projects p, news n
+ where m.user_id = '#{user.id}' and p.id = m.project_id and n.project_id = p.id and c.commented_id = n.id
+ and c.commented_type ='News' and (c.created_on between '#{date_from}' and '#{date_to}') order by created_on desc")
+
# 查询user在课程及个人中留言
@course_journal_messages = JournalsForMessage.find_by_sql("select DISTINCT jfm.* from journals_for_messages jfm, members m, courses c
where m.user_id = '#{user.id}' and c.id = m.course_id and jfm.jour_id = c.id
@@ -179,7 +199,7 @@ class Mailer < ActionMailer::Base
@memos = Memo.find_by_sql("select DISTINCT m.* from memos m, forums f where (m.author_id = #{user.id} or (m.forum_id = f.id and f.creator_id = #{user.id}))
and (m.created_at between '#{date_from}' and '#{date_to}') order by m.created_at desc")
- has_content = [@issues,@course_messages,@project_messages,@course_news,@project_news,
+ has_content = [@issues,@issues_journals,@course_messages,@project_messages,@course_news,@course_news_comments,@project_news,@project_news_comments,@project_attachments,
@course_journal_messages,@user_journal_messages,@project_journal_messages,@forums,@memos,@attachments,@bids,@wiki_contents].any? {|o| !o.empty?}
mylogger.debug "Sent activity mail : #{user.mail} - #{has_content}"
#有内容才发,没有不发
@@ -497,6 +517,26 @@ class Mailer < ActionMailer::Base
end
end
+ # Builds a Mail::Message object used to email recipients of a course when an homework are posted.
+ #
+ # Example:
+ # attachments_added(attachments) => Mail::Message object
+ # Mailer.attachments_added(attachments).deliver => sends an email to the project's recipients
+ def homework_added(homework_common)
+ @homework_common = homework_common
+ @author = homework_common.user
+ @homework_common_url = url_for(:controller => "homework_common", :action =>"index", :homework => @homework_common.id)
+ @homework_author_url = url_for(user_activities_url(@author))
+ recipients ||= []
+ #将帖子创建者邮箱地址加入数组
+ @homework_common.course.members.each do |member|
+ recipients << member.user.mail
+ end
+ mail :to => recipients,
+ :subject => "[ #{l(:label_user_homework)} : #{homework_common.name} #{l(:label_memo_create_succ)}]",
+ :filter => true
+ end
+
# Builds a Mail::Message object used to email recipients of a news' project when a news item is added.
#
# Example:
diff --git a/app/views/journals/diff.html.erb b/app/views/journals/diff.html.erb
index d3dfa7d34..5bc823c76 100644
--- a/app/views/journals/diff.html.erb
+++ b/app/views/journals/diff.html.erb
@@ -2,7 +2,7 @@
<%= authoring @journal.created_on, @journal.user, :label => :label_updated_time_by %>
-<%= simple_format_without_paragraph @diff.to_html %>
+ <%= simple_format_without_paragraph @diff.to_html %>
<%= link_to l(:button_back), issue_path(@issue), :onclick => 'history.back(); return false;' %>
diff --git a/app/views/mailer/_issue.html.erb b/app/views/mailer/_issue.html.erb
index 5145dbb2c..49f137df5 100644
--- a/app/views/mailer/_issue.html.erb
+++ b/app/views/mailer/_issue.html.erb
@@ -1,46 +1,43 @@
-
-
+
<%= link_to(h("#{@author.login}(#{@author.show_name})"), @issue_author_url , :style=>'color:#1b55a7; font-weight:bold;') %>
- <%= l(:mail_issue_title_userin)%>
- <%= link_to(h("#{@issue.project.name}"), @project_url, :style=>'color:#1b55a7; font-weight:bold;') %><%= l(:mail_issue_title_active)%>
+ <%= l(:mail_issue_title_userin)%>
+ <%= link_to(h("#{@issue.project.name}"), @project_url, :style=>'color:#1b55a7; font-weight:bold;') %><%= l(:mail_issue_title_active)%>
+
-
- - <%= l(:mail_issue_subject)%><%= link_to(issue.subject, issue_url, :style=>'color:#1b55a7; font-weight:bold;') %>
- - <%= l(:mail_issue_sent_from)%><%= issue.project.name %>| <%= l(:mail_issue_from_project)%>
- - <%= l(:mail_issue_content)%>
+
+ - <%= l(:mail_issue_subject)%><%= link_to(issue.subject, issue_url, :style=>'color:#1b55a7; font-weight:bold;') %>
+ - <%= l(:mail_issue_sent_from)%><%= issue.project.name %>| <%= l(:mail_issue_from_project)%>
+ - <%= l(:mail_issue_content)%>
<% if @journal.nil? %>
- <%= issue.description=='' ? l(:label_none) : issue.description %>
+ <%= issue.description=='' ? l(:label_none) : issue.description.html_safe %>
<% else %>
- <%= @journal.notes=='' ? l(:label_none) : @journal.notes %>
+ <%= @journal.notes=='' ? l(:label_none) : @journal.notes.html_safe %>
<% end%>
-
<%= l(:mail_issue_attachments)%>
<% if @issue.attachments.count == 0 %>
- <%= l(:label_none)%>
+ <%= l(:label_none)%>
<% else %>
<% @issue.attachments.each do |attach| %>
<%= link_to_attachment(attach, :download => true, :token => @token.value, :only_path => false, :style=>'color:#1b55a7; font-weight:bold;')%>
<% end %>
<% end %>
-
-
-
+
+ <%= link_to( l(:mail_issue_reply), issue_url, :class => "mail_reply", :style =>'display:block; float:right; width:80px; text-align:center; height:30px; background:#15bccf; color:#fff; font-weight:normal; font-size:14px; line-height: 30px;') %>
+
<% unless @course_news.first.nil? %>
<% end %>
+
+ <% unless @course_news_comments.first.nil? %>
+
+
+ <%= l(:label_course_news) %>
+
+ <% @course_news_comments.each do |course_news_comment|%>
+ -
+ ▪
+ [
+ <% unless course_news_comment.commented.nil? %>
+ <%= link_to truncate(course_news_comment.commented.course.name,length: 30,omission: '...'), course_url(course_news_comment.commented.course, :token => @token.value),
+ :class=> "wmail_column",
+ :style=> " font-weight: bold; display:block; float:left; color:#666;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
+ <% end %>
+ ]
+
+ <%= link_to course_news_comment.author, user_activities_url(course_news_comment.author,:token => @token.value), :class => "wmail_name",
+ :style => "color:#2E8DD7; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
+ <%= l(:label_project_notice) %>
+
+ <%= link_to truncate(course_news_comment.comments,length: 30,omission: '...'), news_url(course_news_comment.commented,:token => @token.value),
+ :class => 'wmail_info',
+ :style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
+ %>
+ <%= format_time(course_news_comment.created_on) %>
+
+ <% end %>
+
+
+ <% end %>
+
<% unless @bids.empty? %>
@@ -64,7 +97,6 @@
<% end %>
<% end %>
-
<% end %>
@@ -162,7 +194,8 @@
<% end %>
-<% if @issues.first || @project_messages.first || @wiki_contents.first || @project_news.first || @project_journal_messages.first %>
+<% if @issues.first || @project_messages.first || @issues_journals.first || @wiki_contents.first || @project_news.first || @project_news_comments.first || @project_journal_messages.first ||
+ @project_news_comments.first %>
<%= l(:label_project_overview_new)%>
<% unless @issues.first.nil? %>
@@ -192,6 +225,41 @@
<% end %>
+
+
+ <% unless @issues_journals.first.nil? %>
+
+
+ <%= l(:label_issue_tracking) %>
+
+ <% @issues_journals.each do |issues_journal| %>
+ -
+ ▪
+ [
+ <%= link_to truncate(issues_journal.issue.project.name,length: 30,omission: '...'), project_url(issues_journal.issue.project, :token => @token.value),
+ :class=> "wmail_column",
+ :style=> " font-weight: bold; display:block; float:left; color:#666;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
+ ]
+ <%= link_to issues_journal.user, user_activities_url(issues_journal.user,:token => @token.value), :class => "wmail_name",
+ :style => "color:#2E8DD7; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
+ <%= l(:label_project_issue) %>
+ <% if issues_journal.notes.nil? %>
+ <%= link_to truncate(issues_journal.issue.subject,length: 30,omission: '...'),issue_url(issue, :token => @token.value),
+ :style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
+ %>
+ <% else %>
+ <%= link_to truncate(issues_journal.notes,length: 30,omission: '...'),issue_url(issues_journal.issue, :token => @token.value),
+ :style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
+ %>
+ <% end %>
+ <%= format_time(issues_journal.created_on) %>
+
+ <% end %>
+
+
+
+ <% end %>
+
<% unless @project_messages.first.nil? %>
<% end %>
+
+ <% unless @project_news_comments.first.nil? %>
+
+
+ <%= l(:label_project_news) %>
+
+ <% @project_news_comments.each do |project_news_comment|%>
+ -
+ ▪
+ [
+ <% unless project_news_comment.commented.nil? %>
+ <%= link_to truncate(project_news_comment.commented.project.name,length: 30,omission: '...'), project_url(project_news_comment.commented.project, :token => @token.value),
+ :class=> "wmail_column",
+ :style=> " font-weight: bold; display:block; float:left; color:#666;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
+ <% end %>
+ ]
+ <%= link_to project_news_comment.author, user_activities_url(project_news_comment.author,:token => @token.value), :class => "wmail_name",
+ :style => "color:#2E8DD7; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
+ <%= l(:label_project_mail_notice) %>
+
+ <%= link_to truncate(project_news_comment.comments.html_safe,length: 30,omission: '...'), news_url(project_news_comment.commented,:token => @token.value),
+ :class => 'wmail_info',
+ :style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
+ <%= format_time(project_news_comment.created_on) %>
+
+ <% end %>
+
+
+ <% end %>
+
+
+ <% unless @project_attachments.first.nil? %>
+
+
+ <%= l(:label_project_mail_attachments) %>
+
+ <% @project_attachments.each do |project_attachment|%>
+ -
+ ▪
+ [
+
+ <%= link_to truncate(project_attachment.project.name,length: 30,omission: '...'), project_url(project_attachment.project, :token => @token.value),
+ :class=> "wmail_column",
+ :style=> " font-weight: bold; display:block; float:left; color:#666;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;" %>
+ ]
+
+ <%= link_to project_attachment.author, user_activities_url(project_attachment.author,:token => @token.value), :class => "wmail_name",
+ :style => "color:#2E8DD7; float:left;display:block; margin-right:5px; margin-left:5px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"%>
+ <%= l(:label_project_mail_upload) %>
+
+ <%= link_to truncate(project_attachment.filename,length: 30,omission: '...'), project_files_url(project_attachment.project,:token => @token.value),
+ :class => 'wmail_info',
+ :style => "color:#2E8DD7;float:left; font-weight:normal;margin-right:5px; display:block;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;"
+ %>
+ <%= format_time(project_attachment.created_on) %>
+
+ <% end %>
+
+
+ <% end %>
+
<% unless @project_journal_messages.first.nil? %>
diff --git a/app/views/mailer/send_for_user_activities.text.erb b/app/views/mailer/send_for_user_activities.text.erb
index c46e96f03..bcafb896f 100644
--- a/app/views/mailer/send_for_user_activities.text.erb
+++ b/app/views/mailer/send_for_user_activities.text.erb
@@ -1,344 +1,243 @@
<%= @subject %>
-<% if @attachments.first || @course_news.first || @bids.first ||
- @course_journal_messages.first|| @course_messages.first %>
-<%= l(:label_course_overview)%>
- <% unless @course_news.first.nil? %>
- <%= l(:label_course_news) %>
-
-
-
+<% if @attachments.first || @course_news.first || @course_news_comments.first || @bids.first ||
+ @course_journal_messages.first|| @course_messages.first || @attachments.first %>
+ <%= l(:label_course_overview)%>
+ <% unless @course_news.first.nil? %>
+ <%= l(:label_course_news) %>
<% @course_news.each do |course_new|%>
- ▪
- [
-
- <%= 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)
- %>
- <%= l(:label_project_notice) %>
+ ▪[<%= link_to truncate(course_new.course.name,length: 30,omission: '...'), course_url(course_new.course, :token => @token.value)%> ]
- <%= link_to truncate(course_new.title,length: 30,omission: '...'), news_url(course_new,:token => @token.value)
-
-
- %> <%= format_time(course_new.created_on) %>
+ <%= link_to course_new.author, user_activities_url(course_new.author,:token => @token.value) %>
+ <%= l(:label_project_notice) %>
+ <%= link_to truncate(course_new.title,length: 30,omission: '...'), news_url(course_new,:token => @token.value) %>
+ <%= format_time(course_new.created_on) %>
+ <% end %>
+ <% end %>
+ <% unless @course_news_comments.first.nil? %>
+ <%= l(:label_course_news) %>
+ <% @course_news_comments.each do |course_news_comment|%>
+ ▪[ <% unless course_news_comment.commented.nil? %>
+ <%= link_to truncate(course_news_comment.commented.course.name,length: 30,omission: '...'), course_url(course_news_comment.commented.course, :token => @token.value) %>
+ <% end %>
+ ]
+ <%= link_to course_news_comment.author, user_activities_url(course_news_comment.author,:token => @token.value) %>
+ <%= l(:label_project_notice) %>
+ <%= link_to truncate(course_news_comment.comments,length: 30,omission: '...'), news_url(course_news_comment.commented,:token => @token.value) %>
+ <%= format_time(course_news_comment.created_on) %>
<% end %>
+ <% end %>
- <% end %>
- <% unless @bids.empty? %>
- <%= l(:label_homework_overview) %>
+ <% unless @bids.empty? %>
+ <%= l(:label_homework_overview) %>
<% unless @bids.first.nil?%>
<% @bids.each do |bid| %>
- ▪
- [
-
- <%= link_to truncate(bid.course.name,length: 30,omission: '...'),course_url(bid.course, :token => @token.value)
-
- %>
- ]
-
- <%= link_to bid.user, user_activities_url(bid.user,:token => @token.value)
- %>
- <%= l(:label_course_homework) %>
-
- <%= link_to truncate(bid.name, length: 30,omission: '...'), student_work_index_path(:homework => bid.id,:token => @token.value)
-
-
- %>
- <%= format_time(bid.created_at) %>
-
+ ▪[<%= link_to truncate(bid.course.name,length: 30,omission: '...'),course_url(bid.course, :token => @token.value) %>]
+ <%= link_to bid.user, user_activities_url(bid.user,:token => @token.value) %>
+ <%= l(:label_course_homework) %>
+ <%= link_to truncate(bid.name, length: 30,omission: '...'), student_work_index_path(:homework => bid.id,:token => @token.value) %>
+ <%= format_time(bid.created_at) %>
<% end %>
<% end %>
+
+ <% end %>
-
-
- <% end %>
-
- <% unless @course_journal_messages.first.nil? %>
-
- <%= l(:view_course_journals_for_messages) %>
-
-
+ <% unless @course_journal_messages.first.nil? %>
+ <%= l(:view_course_journals_for_messages) %>
<% @course_journal_messages.each do |course_journal_message|%>
-
- [
-
- <%= 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)
- %>
+ [ <%= 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) %>
<%= l(:label_send_course_journals_for_messages) %>
-
- <%= link_to truncate(course_journal_message.notes,length: 30,omission: '...'), course_feedback_url(course_journal_message.course,:token => @token.value)
-
-
- %>
- <%= format_time(course_journal_message.created_on) %>
-
+ <%= link_to truncate(course_journal_message.notes,length: 30,omission: '...'), course_feedback_url(course_journal_message.course,:token => @token.value) %>
+ <%= format_time(course_journal_message.created_on) %>
<% end %>
+ <% end %>
-
- <% end %>
-
- <% unless @course_messages.first.nil? %>
-
- <%= l(:view_borad_course) %>
-
-
-
+ <% unless @course_messages.first.nil? %>
+ <%= l(:view_borad_course) %>
<% @course_messages.each do |course_message|%>
-
- ▪
- [
-
- <%= 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)
- %>
- <%= l(:label_send_course_messages) %>
-
- <%= link_to truncate(course_message.subject,length: 30,omission: '...'),board_message_url(course_message, :board_id => course_message.board_id,:token => @token.value)
-
-
- %>
- <%= format_time(course_message.created_on) %>
-
+ ▪[<%= 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) %>
+ <%= l(:label_send_course_messages) %>
+ <%= link_to truncate(course_message.subject,length: 30,omission: '...'),board_message_url(course_message, :board_id => course_message.board_id,:token => @token.value) %>
+ <%= format_time(course_message.created_on) %>
<% end %>
+ <% end %>
-
- <% end %>
-
- <% unless @attachments.first.nil? %>
-
- <%= l(:label_course_attendingcontestwork_download) %>
-
-
-
+ <% unless @attachments.first.nil? %>
+ <%= l(:label_course_attendingcontestwork_download) %>
<% @attachments.each do |attachment|%>
- ▪[
-
- <%= 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)
- %>
- <%= l(:label_course_file_upload) %>
-
- <%= link_to truncate(attachment.filename,length: 30,omission: '...'),course_files_url(attachment.course,:token => @token.value)
-
-
- %>
- <%= format_time(attachment.created_on) %>
-
+ ▪[<%= 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) %>
+ <%= l(:label_course_file_upload) %>
+ <%= link_to truncate(attachment.filename,length: 30,omission: '...'),course_files_url(attachment.course,:token => @token.value) %>
+ <%= format_time(attachment.created_on) %>
<% end %>
-
-
- <% end %>
+
+ <% end %>
<% end %>
-<% @issues.first || @project_messages.first || @wiki_contents.first || @project_news.first || @project_journal_messages.first %>
-<%= l(:label_project_overview_new)%>
- <% unless @issues.first.nil? %>
-
- <%= l(:label_issue_tracking) %>
-
-
+
+
+<% if @issues.first || @project_messages.first || @issues_journals.first || @wiki_contents.first || @project_news.first || @project_news_comments.first || @project_journal_messages.first ||
+ @project_news_comments.first %>
+ <%= l(:label_project_overview_new)%>
+ <% unless @issues.first.nil? %>
+ <%= l(:label_issue_tracking) %>
<% @issues.each do |issue|%>
- ▪
- [
-
- <%= 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)
- %>
- <%= l(:label_project_issue) %>
-
- <%= link_to truncate(issue. subject,length: 30,omission: '...'),issue_url(issue, :token => @token.value)
-
-
- %>
- <%= format_time(issue.created_on) %>
+ ▪[<%= 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) %>
+ <%= l(:label_project_issue) %>
+ <%= link_to truncate(issue.subject,length: 30,omission: '...'),issue_url(issue, :token => @token.value) %>
+ <%= format_time(issue.created_on) %>
<% end %>
+
+ <% end %>
+
+ <% unless @issues_journals.first.nil? %>
+ <%= l(:label_issue_tracking) %>
+ <% @issues_journals.each do |issues_journal| %>
+ ▪[<%= link_to truncate(issues_journal.issue.project.name,length: 30,omission: '...'), project_url(issues_journal.issue.project, :token => @token.value) %>]
+ <%= link_to issues_journal.user, user_activities_url(issues_journal.user,:token => @token.value) %>
+ <%= l(:label_project_issue) %>
+ <% if issues_journal.notes.nil? %>
+ <%= link_to truncate(issues_journal.issue.subject,length: 30,omission: '...'),issue_url(issue, :token => @token.value) %>
+ <% else %>
+ <%= link_to truncate(issues_journal.notes,length: 30,omission: '...'),issue_url(issues_journal.issue, :token => @token.value) %>
+ <% end %>
+ <%= format_time(issues_journal.created_on) %>
+ <% end %>
+ <% end %>
- <% end %>
-
- <% unless @project_messages.first.nil? %>
-
- <%= l(:project_moule_boards_show) %>
-
-
+
+ <% unless @project_messages.first.nil? %>
+ <%= l(:project_moule_boards_show) %>
<% @project_messages.each do |project_message|%>
- ▪[
-
- <%= link_to truncate(project_message.project.name,length: 30,omission: '...'), project_url(project_message.project, :token => @token.value)
-
- %>
- ]
-
- <%= 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 truncate(project_message. subject,length: 30,omission: '...'),board_message_url(project_message, :board_id => project_message.board_id,:token => @token.value)
-
-
- %>
- <%= format_time(project_message.created_on) %>
+ ▪[<%= 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) %>
+ <%= l(:label_send_course_messages) %>
+ <%= link_to truncate(project_message.subject,length: 30,omission: '...'),board_message_url(project_message, :board_id => project_message.board_id,:token => @token.value) %>
+ <%= format_time(project_message.created_on) %>
<% end %>
+
+ <% end %>
+
<% unless @wiki_contents.first.nil? %>
-
- <%= l(:label_wiki) %>
-
- <% @wiki_contents.each do |wikicontent|%>
- ▪[
- <% unless wikicontent.page.nil? %>
- <%= link_to truncate(wikicontent.page.wiki.project.name,length: 30,omission: '...'), project_url(wikicontent.page.wiki.project, :token => @token.value)
- %>
- <% end %>
- ]
- <%= link_to wikicontent.author, user_activities_url(wikicontent.author,:token => @token.value) %>
- <%= l(:label_project_notice) %>
- <% unless wikicontent.page.nil? %>
- <%= link_to truncate(wikicontent.text.html_safe, length: 30,omission: '...'), project_wiki_url(wikicontent.page.wiki,:token => @token.value) %>
- <% end %>
- <%= format_time(wikicontent.updated_on) %>
-
- <% end %>
+ <%= l(:label_wiki) %>
+ <% @wiki_contents.each do |wikicontent|%>
+ ▪[<% unless wikicontent.page.nil? %>
+ <%= link_to truncate(wikicontent.page.wiki.project.name,length: 30,omission: '...'), project_url(wikicontent.page.wiki.project, :token => @token.value) %>
+ <% end %>
+ ]
+ <%= link_to wikicontent.author, user_activities_url(wikicontent.author,:token => @token.value) %>
+ <%= l(:label_wiki_mail_notification) %>
+ <% unless wikicontent.page.nil? %>
+ <%= link_to truncate(wikicontent.text.html_safe, length: 30,omission: '...'), project_wiki_url(wikicontent.page.wiki,:token => @token.value) %>
+ <% end %>
+ <%= format_time(wikicontent.updated_on) %>
+ <% end %>
<% end %>
<% unless @project_news.first.nil? %>
+ <%= l(:label_project_news) %>
+ <% @project_news.each do |project_new|%>
+ ▪[<%= link_to truncate(project_new.project.name,length: 30,omission: '...'), project_url(project_new.project, :token => @token.value) %> ]
+ <%= link_to project_new.author, user_activities_url(project_new.author,:token => @token.value) %>
+ <%= l(:label_project_mail_notice) %>
+ <%= link_to truncate(project_new.title,length: 30,omission: '...'), news_url(project_new,:token => @token.value) %>
+ <%= format_time(project_new.created_on) %>
+ <% end %>
+ <% end %>
- <%= l(:label_project_news) %>
-
- <% @project_news.each do |project_new|%>
- ▪[
-
- <%= link_to truncate(project_new.project.name,length: 30,omission: '...'), project_url(project_new.project, :token => @token.value)
- %>
- ]
- <%= link_to project_new.author, user_activities_url(project_new.author,:token => @token.value)
- %>
- <%= l(:label_project_notice) %>
-
- <%= link_to truncate(project_new.title,length: 30,omission: '...'), news_url(project_new,:token => @token.value)
- %>
- <%= format_time(project_new.created_on) %>
+
+ <% unless @project_news_comments.first.nil? %>
+ <%= l(:label_project_news) %>
+ <% @project_news_comments.each do |project_news_comment|%>
+ ▪[ <% unless project_news_comment.commented.nil? %>
+ <%= link_to truncate(project_news_comment.commented.project.name,length: 30,omission: '...'), project_url(project_news_comment.commented.project, :token => @token.value) %>
+ <% end %>]
+ <%= link_to project_news_comment.author, user_activities_url(project_news_comment.author,:token => @token.value) %>
+ <%= l(:label_project_mail_notice) %>
+ <%= link_to truncate(project_news_comment.comments.html_safe,length: 30,omission: '...'), news_url(project_news_comment.commented,:token => @token.value) %>
+ <%= format_time(project_news_comment.created_on) %>
+ <% end %>
+
+ <% end %>
- <% end %>
+
+ <% unless @project_attachments.first.nil? %>
+ <%= l(:label_project_mail_attachments) %>
+ <% @project_attachments.each do |project_attachment|%>
+ ▪[<%= link_to truncate(project_attachment.project.name,length: 30,omission: '...'), project_url(project_attachment.project, :token => @token.value) %>]
+ <%= link_to project_attachment.author, user_activities_url(project_attachment.author,:token => @token.value) %>
+ <%= l(:label_project_mail_upload) %>
+ <%= link_to truncate(project_attachment.filename,length: 30,omission: '...'),project_files_url(project_attachment.project,:token => @token.value) %>
+ <%= format_time(project_attachment.created_on) %>
+ <% end %>
<% end %>
<% unless @project_journal_messages.first.nil? %>
- <%= l(:label_project_mail_feedback) %>
-
- <% @project_journal_messages.each do |project_journal_message|%>
- ▪[
-
- <%= link_to truncate(project_journal_message.project.name,length: 30,omission: '...'), project_url(project_journal_message.project, :token => @token.value)
- %>
- ]
-
- <%= link_to project_journal_message.user, user_activities_url(project_journal_message.user,:token => @token.value) %>
- <%= l(:label_send_course_journals_for_messages) %>
-
- <%= link_to truncate(project_journal_message.notes.html_safe,length: 30,omission: '...'), project_feedback_url(project_journal_message.project,:token => @token.value)
- %>
- <%= format_time(project_journal_message.created_on) %>
- <% end %>
+ <%= l(:label_project_mail_feedback) %>
+ <% @project_journal_messages.each do |project_journal_message|%>
+ ▪[<%= link_to truncate(project_journal_message.project.name,length: 30,omission: '...'), project_url(project_journal_message.project, :token => @token.value) %> ]
+ <%= link_to project_journal_message.user, user_activities_url(project_journal_message.user,:token => @token.value) %>
+ <%= l(:label_send_course_journals_for_messages) %>
+ <%= link_to truncate(project_journal_message.notes.html_safe,length: 30,omission: '...'), project_feedback_url(project_journal_message.project,:token => @token.value) %>
+ <%= format_time(project_journal_message.created_on) %>
+ <% end %>
+
<% end %>
+
+<% end %>
- <% end %>
<% unless @user_journal_messages.first.nil? %>
-<%= l(:label_activities) %>
-
-
- <%= l(:label_user_message) %>
- (<%= @user_journal_messages.count %>)
-
- <% @user_journal_messages.each do |user_journal_message|%>
- ▪
-
- <%= link_to user_journal_message.user, user_activities_url(user_journal_message.user,:token => @token.value)
-
- %>
- <%= l(:label_show_your_message) %>
-
- <%= link_to truncate(user_journal_message.notes,length: 30,omission: '...'), feedback_url(@user,:token => @token.value)
-
-
- %>
- <%= format_time(user_journal_message.created_on) %>
-
- <% end %>
-
-
+ <%= l(:label_activities) %>
+ <%= l(:label_user_message) %>
+ (<%= @user_journal_messages.count %>)
+ <% @user_journal_messages.each do |user_journal_message|%>
+ ▪ <%= link_to user_journal_message.user, user_activities_url(user_journal_message.user,:token => @token.value)%>
+ <%= l(:label_show_your_message) %>
+ <%= link_to truncate(user_journal_message.notes,length: 30,omission: '...'), feedback_url(@user,:token => @token.value) %>
+ <%= format_time(user_journal_message.created_on) %>
+ <% end %>
<% end %>
+
<% if @forums.first || @memos.first %>
<%= l(:lable_bar_active) %>
- <% unless @forums.first.nil? %>
-
- <%= l(:label_user_forum) %>
-
-
- <% @forums.each do |forum|%>
- ▪
-
- <%= link_to forum.creator, user_activities_url(forum.creator,: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.each do |memo|%>
- ▪
-
- <%= link_to memo.author, user_activities_url(memo.author,:token => @token.value)%>
- <%= memo.parent_id.nil? ? l(:label_memo_new_from_forum) : l(:label_reply) %>
-
- <%= 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 %>
+ <% unless @forums.first.nil? %>
+ <%= l(:label_user_forum) %>
+ <% @forums.each do |forum|%>
+ ▪<%= link_to forum.creator, user_activities_url(forum.creator,: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.each do |memo|%>
+ ▪<%= link_to memo.author, user_activities_url(memo.author,:token => @token.value)%>
+ <%= memo.parent_id.nil? ? l(:label_memo_new_from_forum) : l(:label_reply) %>
+ <%= 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 %>
<% [:label_user_mail_option_all, :label_user_mail_option_day, :label_user_mail_option_none].each do |mail_option| %>
- <% if Hash[*User::MAIL_NOTIFICATION_OPTIONS.flatten][@user.mail_notification] == mail_option %>
- <%= l(mail_option) %>
- <% else %>
- <%= link_to l(mail_option), my_change_mail_notification_url(token: @token.value,mail_notification: Hash[*User::MAIL_NOTIFICATION_OPTIONS.flatten].invert[mail_option]), :style => "margin-top:20px;color:#2775d2; margin-left:10px;" %>
- <% end %>
+ <% if Hash[*User::MAIL_NOTIFICATION_OPTIONS.flatten][@user.mail_notification] == mail_option %>
+ <%= l(mail_option) %>
+ <% else %>
+ <%= link_to l(mail_option), my_change_mail_notification_url(token: @token.value,mail_notification: Hash[*User::MAIL_NOTIFICATION_OPTIONS.flatten].invert[mail_option]), :style => "margin-top:20px;color:#2775d2; margin-left:10px;" %>
+ <% end %>
<% end %>
diff --git a/config/locales/mailers/zh.yml b/config/locales/mailers/zh.yml
index 46666ee25..211f2e62d 100644
--- a/config/locales/mailers/zh.yml
+++ b/config/locales/mailers/zh.yml
@@ -21,3 +21,6 @@ zh:
mail_issue_from_project: "项目问题跟踪"
mail_issue_attachments: "附件:"
mail_issue_reply: "我要回复"
+ mail_course_title_userin: "在课程"
+ mail_course_homework_active: "中发布了作业"
+ mail_attention: "请您关注!"
diff --git a/config/locales/projects/en.yml b/config/locales/projects/en.yml
index 57ef221b0..b142c6ca8 100644
--- a/config/locales/projects/en.yml
+++ b/config/locales/projects/en.yml
@@ -41,7 +41,9 @@ en:
lable_sure_exit_project: "Are you sure exit from the projcet"
label_member: "Members"
- project_module_attachments: "Resources"
+ project_module_attachments: "Resources"
+ label_project_mail_attachments: Project Resources
+ label_project_mail_upload: had uploaded project resources
label_invite: Invitation
label_invite_new_user: "Send email to invite new user"
diff --git a/config/locales/projects/zh.yml b/config/locales/projects/zh.yml
index 42eea8dcc..5bf8957bf 100644
--- a/config/locales/projects/zh.yml
+++ b/config/locales/projects/zh.yml
@@ -62,7 +62,9 @@ zh:
label_development_team: 开发模式
label_member: 成员
- project_module_attachments: 资源
+ project_module_attachments: 资源
+ label_project_mail_attachments: 项目资源
+ label_project_mail_upload: 上传了资源
label_invite: 邀请