From 48cb0e0450334f23d629e59b1ba0c54d639e19a6 Mon Sep 17 00:00:00 2001
From: alan <547533434@qq.com>
Date: Sat, 31 Jan 2015 15:04:48 +0800
Subject: [PATCH 01/97] email verify
---
Gemfile | 2 +-
Gemfile.lock | 9 +++++++++
app/models/user.rb | 2 +-
config/application.rb | 6 +++---
4 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/Gemfile b/Gemfile
index 037c606c8..f59c92077 100644
--- a/Gemfile
+++ b/Gemfile
@@ -20,7 +20,7 @@ gem "builder", "3.0.0"
gem 'acts-as-taggable-on', '2.4.1'
gem 'spreadsheet'
gem 'ruby-ole'
-#gem 'email_verifier', path: 'lib/email_verifier'
+gem 'email_verifier', path: 'lib/email_verifier'
group :development do
gem 'grape-swagger'
diff --git a/Gemfile.lock b/Gemfile.lock
index 355ca422d..8c5816e13 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -12,6 +12,13 @@ PATH
coderay (>= 1.0.0)
erubis (>= 2.6.6)
+PATH
+ remote: lib/email_verifier
+ specs:
+ email_verifier (0.0.7)
+ dnsruby (>= 1.5)
+ rails (>= 3.0.0)
+
PATH
remote: lib/rack-mini-profiler
specs:
@@ -91,6 +98,7 @@ GEM
descendants_tracker (0.0.4)
thread_safe (~> 0.3, >= 0.3.1)
diff-lcs (1.2.5)
+ dnsruby (1.57.0)
equalizer (0.0.9)
erubis (2.7.0)
execjs (2.2.1)
@@ -315,6 +323,7 @@ DEPENDENCIES
capybara (~> 2.4.1)
coderay (~> 1.0.6)
coffee-rails (~> 3.2.1)
+ email_verifier!
factory_girl (~> 4.4.0)
faker
fastercsv (~> 1.5.0)
diff --git a/app/models/user.rb b/app/models/user.rb
index 06f59c764..bef65fe54 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -188,7 +188,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/config/application.rb b/config/application.rb
index c7f2f3ea5..647675784 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -17,9 +17,9 @@ module RedmineApp
# -- all .rb files in that directory are automatically loaded.
#verifier if email is real
- # EmailVerifier.config do |config|
- # config.verifier_email = "lizanle521@126.com"
- # end
+ EmailVerifier.config do |config|
+ config.verifier_email = "alanlong9278@126.com"
+ end
config.generators do |g|
g.test_framework :rspec,
From d61199f66b4182d0b7c8f476cab5270408ee210d Mon Sep 17 00:00:00 2001
From: alan <547533434@qq.com>
Date: Sat, 31 Jan 2015 16:43:10 +0800
Subject: [PATCH 02/97] merge szzh
---
Gemfile.lock | 4 ----
lib/email_verifier | 2 +-
2 files changed, 1 insertion(+), 5 deletions(-)
diff --git a/Gemfile.lock b/Gemfile.lock
index 8c5816e13..b26f17113 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -170,8 +170,6 @@ GEM
metaclass (~> 0.0.1)
multi_json (1.10.1)
multi_xml (0.5.5)
- mysql2 (0.3.11)
- mysql2 (0.3.11-x86-mingw32)
nenv (0.2.0)
net-ldap (0.3.1)
nokogiri (1.6.3)
@@ -316,7 +314,6 @@ PLATFORMS
DEPENDENCIES
activerecord-jdbc-adapter (= 1.2.5)
- activerecord-jdbcmysql-adapter
acts-as-taggable-on (= 2.4.1)
better_errors!
builder (= 3.0.0)
@@ -337,7 +334,6 @@ DEPENDENCIES
jquery-rails (~> 2.0.2)
kaminari
mocha (~> 1.1.0)
- mysql2 (= 0.3.11)
net-ldap (~> 0.3.1)
nokogiri (~> 1.6.3)
paperclip (~> 3.5.4)
diff --git a/lib/email_verifier b/lib/email_verifier
index 3cabcc643..222a9bdd7 160000
--- a/lib/email_verifier
+++ b/lib/email_verifier
@@ -1 +1 @@
-Subproject commit 3cabcc643f36939939685e6f55273dfbf89da545
+Subproject commit 222a9bdd72014f197baf2131ab71cc41660111ed
From 7391f3b5cffac583ffdd43ce94ef7d1eb23cbc12 Mon Sep 17 00:00:00 2001
From: alan <547533434@qq.com>
Date: Mon, 2 Feb 2015 09:52:05 +0800
Subject: [PATCH 03/97] Merge branch 'szzh' of
http://xianbo_trustie2@repository.trustie.net/xianbo/trustie2.git into szzh
Conflicts:
config/locales/zh.yml
Signed-off-by: alan <547533434@qq.com>
---
config/database.yml.example | 52 -------------------------------------
1 file changed, 52 deletions(-)
delete mode 100644 config/database.yml.example
diff --git a/config/database.yml.example b/config/database.yml.example
deleted file mode 100644
index 2ff6231d4..000000000
--- a/config/database.yml.example
+++ /dev/null
@@ -1,52 +0,0 @@
-# Default setup is given for MySQL with ruby1.9. If you're running Redmine
-# with MySQL and ruby1.8, replace the adapter name with `mysql`.
-# Examples for PostgreSQL, SQLite3 and SQL Server can be found at the end.
-# Line indentation must be 2 spaces (no tabs).
-
-production:
- adapter: mysql2
- database: redmine
- host: localhost
- username: root
- password: ""
- encoding: utf8
-
-development:
- adapter: mysql2
- database: redmine_development
- host: 10.107.17.20
- username: root
- password: "1234"
- encoding: utf8
-
-# Warning: The database defined as "test" will be erased and
-# re-generated from your development database when you run "rake".
-# Do not set this db to the same as development or production.
-test:
- adapter: mysql2
- database: redmine_test
- host: 10.107.17.20
- username: root
- password: "1234"
- encoding: utf8
-
-# PostgreSQL configuration example
-#production:
-# adapter: postgresql
-# database: redmine
-# host: localhost
-# username: postgres
-# password: "postgres"
-
-# SQLite3 configuration example
-#production:
-# adapter: sqlite3
-# database: db/redmine.sqlite3
-
-# SQL Server configuration example
-#production:
-# adapter: sqlserver
-# database: redmine
-# host: localhost
-# username: jenkins
-# password: jenkins
From 725b2749e2b14bf4484a39b376e2a251d38c58dc Mon Sep 17 00:00:00 2001
From: lizanle <491823689@qq.com>
Date: Mon, 2 Feb 2015 09:52:50 +0800
Subject: [PATCH 04/97] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=B8=80=E4=BA=9B?=
=?UTF-8?q?=E5=AF=B9=E4=BB=A3=E7=A0=81=E7=90=86=E8=A7=A3=E7=9A=84=E6=B3=A8?=
=?UTF-8?q?=E9=87=8A?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../lib/acts_as_activity_provider.rb | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/lib/plugins/acts_as_activity_provider/lib/acts_as_activity_provider.rb b/lib/plugins/acts_as_activity_provider/lib/acts_as_activity_provider.rb
index 35d168732..5a54187b3 100644
--- a/lib/plugins/acts_as_activity_provider/lib/acts_as_activity_provider.rb
+++ b/lib/plugins/acts_as_activity_provider/lib/acts_as_activity_provider.rb
@@ -24,6 +24,10 @@ module Redmine
module ClassMethods
def acts_as_activity_provider(options = {})
+ # Time 2015-01-31 13:54:34
+ # Author lizanle
+ # Description mod.included_modules -> array
+ # 返回mod包含的 modules数组
unless self.included_modules.include?(Redmine::Acts::ActivityProvider::InstanceMethods)
cattr_accessor :activity_provider_options
send :include, Redmine::Acts::ActivityProvider::InstanceMethods
From 8f5e613477b50080d0d3249c2efeb1d3e17629fe Mon Sep 17 00:00:00 2001
From: lizanle <491823689@qq.com>
Date: Mon, 2 Feb 2015 09:53:14 +0800
Subject: [PATCH 05/97] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=B8=80=E4=BA=9B?=
=?UTF-8?q?=E5=AF=B9=E4=BB=A3=E7=A0=81=E7=90=86=E8=A7=A3=E7=9A=84=E6=B3=A8?=
=?UTF-8?q?=E9=87=8A?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/models/issue.rb | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/app/models/issue.rb b/app/models/issue.rb
index a7b1a5943..78d20dca1 100644
--- a/app/models/issue.rb
+++ b/app/models/issue.rb
@@ -64,7 +64,9 @@ class Issue < ActiveRecord::Base
},
:url => Proc.new {|o| {:controller => 'issues', :action => 'show', :id => o}},
:type => Proc.new {|o| 'issue' + (o.closed? ? ' closed' : '') }
-
+ # Time 2015-01-31 13:52:53
+ # Author lizanle
+ # Description 将hash传进去
acts_as_activity_provider :find_options => {:include => [:project, :author, :tracker]},
:author_key => :author_id
From aa2590d4519d3924dea381da112b266f166e7403 Mon Sep 17 00:00:00 2001
From: alan <547533434@qq.com>
Date: Tue, 3 Feb 2015 10:16:46 +0800
Subject: [PATCH 06/97] Signed-off-by: alan <547533434@qq.com>
---
app/models/forum.rb | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/models/forum.rb b/app/models/forum.rb
index e47d18b02..f5581b232 100644
--- a/app/models/forum.rb
+++ b/app/models/forum.rb
@@ -5,7 +5,7 @@ class Forum < ActiveRecord::Base
has_many :memos, :dependent => :destroy, conditions: "parent_id IS NULL"
belongs_to :creator, :class_name => "User", :foreign_key => 'creator_id'
- after_create :expire_forum_cache
+ after_create :expire_forum_cache, :send_email
after_update :expire_forum_cache
before_destroy :expire_forum_cache
safe_attributes 'name',
@@ -23,7 +23,7 @@ class Forum < ActiveRecord::Base
acts_as_taggable
scope :by_join_date, order("created_at DESC")
- after_create :send_email
+ #after_create :send_email
def reset_counters!
self.class.reset_counters!(id)
end
From d902d76ae21d7bc53bca83ef9cabecb29e0a91ae Mon Sep 17 00:00:00 2001
From: lizanle <491823689@qq.com>
Date: Fri, 6 Feb 2015 10:15:18 +0800
Subject: [PATCH 07/97] =?UTF-8?q?=E5=B0=86google=E7=BB=9F=E8=AE=A1?=
=?UTF-8?q?=E6=8D=A2=E4=B8=BA=E4=BA=86=E7=99=BE=E5=BA=A6=E7=BB=9F=E8=AE=A1?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/layouts/_base_footer.html.erb | 23 ++++++++++-------------
1 file changed, 10 insertions(+), 13 deletions(-)
diff --git a/app/views/layouts/_base_footer.html.erb b/app/views/layouts/_base_footer.html.erb
index 4716ed25a..0c7cca7d5 100644
--- a/app/views/layouts/_base_footer.html.erb
+++ b/app/views/layouts/_base_footer.html.erb
@@ -40,18 +40,15 @@
<%= debug(params) if Rails.env.development? %>
-
-
-
+
+
From 859889b750f659daf2ee248e03e4cec25e71c56e Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Fri, 6 Feb 2015 11:27:37 +0800
Subject: [PATCH 08/97] =?UTF-8?q?=E7=AE=80=E5=8C=96=E6=9F=A5=E8=AF=A2?=
=?UTF-8?q?=E5=8C=BF=E8=AF=84=E6=95=B0=E9=87=8F=E7=9A=84=E4=BB=A3=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/helpers/homework_attach_helper.rb | 2 --
1 file changed, 2 deletions(-)
diff --git a/app/helpers/homework_attach_helper.rb b/app/helpers/homework_attach_helper.rb
index 0b98283ff..72d381b28 100644
--- a/app/helpers/homework_attach_helper.rb
+++ b/app/helpers/homework_attach_helper.rb
@@ -140,8 +140,6 @@ module HomeworkAttachHelper
#######################################################
def get_student_not_batch_homework_list bid,user
HomeworkAttach.find_by_sql("SELECT * FROM(SELECT homework_attaches.*,
- (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 1) AS t_score,
- (SELECT AVG(stars) FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND is_teacher_score = 0) AS s_score,
(SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = homework_attaches.id AND rater_id = #{user.id} AND is_teacher_score = 0) AS m_score
FROM homework_attaches
INNER JOIN homework_evaluations ON homework_evaluations.homework_attach_id = homework_attaches.id
From 6f9e2bad63584cdf8301bc32e507aea330632c9f Mon Sep 17 00:00:00 2001
From: alan <547533434@qq.com>
Date: Fri, 6 Feb 2015 18:15:08 +0800
Subject: [PATCH 09/97] mail weekly
---
Gemfile | 2 +-
Gemfile.lock | 3 +
app/controllers/courses_controller.rb | 1 +
app/controllers/messages_controller.rb | 1 +
app/controllers/news_controller.rb | 1 +
app/controllers/projects_controller.rb | 2 +-
app/models/journals_for_message.rb | 4 +-
app/models/mailer.rb | 75 +++-
app/models/user.rb | 4 +-
.../mailer/send_for_user_activities.html.erb | 337 ++++++++++++++++++
.../mailer/send_for_user_activities.text.erb | 253 +++++++++++++
config/initializers/send_mail.rb | 23 ++
config/locales/zh.yml | 20 +-
13 files changed, 718 insertions(+), 8 deletions(-)
create mode 100644 app/views/mailer/send_for_user_activities.html.erb
create mode 100644 app/views/mailer/send_for_user_activities.text.erb
create mode 100644 config/initializers/send_mail.rb
diff --git a/Gemfile b/Gemfile
index 037c606c8..1bc9e6629 100644
--- a/Gemfile
+++ b/Gemfile
@@ -21,7 +21,7 @@ gem 'acts-as-taggable-on', '2.4.1'
gem 'spreadsheet'
gem 'ruby-ole'
#gem 'email_verifier', path: 'lib/email_verifier'
-
+gem 'rufus-scheduler'
group :development do
gem 'grape-swagger'
gem 'grape-swagger-ui', git: 'https://github.com/guange2015/grape-swagger-ui.git'
diff --git a/Gemfile.lock b/Gemfile.lock
index 355ca422d..861c49754 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -252,6 +252,8 @@ GEM
ruby-ole (1.2.11.7)
ruby-openid (2.1.8)
rubyzip (1.1.6)
+ rufus-scheduler (3.0.8)
+ tzinfo
sass (3.3.10)
sass-rails (3.2.6)
railties (~> 3.2.0)
@@ -339,6 +341,7 @@ DEPENDENCIES
rspec-rails (= 2.13.1)
ruby-ole
ruby-openid (~> 2.1.4)
+ rufus-scheduler
sass-rails (~> 3.2.3)
seems_rateable!
selenium-webdriver (~> 2.42.0)
diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb
index 61944ca2c..a55abd123 100644
--- a/app/controllers/courses_controller.rb
+++ b/app/controllers/courses_controller.rb
@@ -5,6 +5,7 @@ class CoursesController < ApplicationController
helper :members
helper :words
+ before_filter :authorize1, :only => [:show, :feedback]
menu_item :overview
menu_item :feedback, :only => :feedback
menu_item :homework, :only => :homework
diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb
index 8d6943f02..d2a253c2a 100644
--- a/app/controllers/messages_controller.rb
+++ b/app/controllers/messages_controller.rb
@@ -17,6 +17,7 @@
class MessagesController < ApplicationController
include ApplicationHelper
+ before_filter :authorize1, :only => [:show]
menu_item :boards
default_search_scope :messages
before_filter :find_board, :only => [:new, :preview,:edit]
diff --git a/app/controllers/news_controller.rb b/app/controllers/news_controller.rb
index 2df17d73f..b44e8a348 100644
--- a/app/controllers/news_controller.rb
+++ b/app/controllers/news_controller.rb
@@ -17,6 +17,7 @@
class NewsController < ApplicationController
layout 'base_projects'# by young
+ before_filter :authorize1, :only => [:show]
default_search_scope :news
model_object News
before_filter :find_model_object, :except => [:new, :create, :index]
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index 02bfc9e19..5054fd5c1 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -19,7 +19,7 @@
# Description 封装代码,简化代码,格式化代码,
class ProjectsController < ApplicationController
layout :select_project_layout
-
+ before_filter :authorize1, :only => [:show]
menu_item :overview, :only => :show
menu_item :roadmap, :only => :roadmap
menu_item :settings, :only => :settings
diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb
index c71fbaf47..39618e43b 100644
--- a/app/models/journals_for_message.rb
+++ b/app/models/journals_for_message.rb
@@ -22,8 +22,8 @@ class JournalsForMessage < ActiveRecord::Base
:foreign_key => 'jour_id',
:conditions => "#{self.table_name}.jour_type = 'Project' "
belongs_to :course,
- :foreign_key => 'jour_id',
- :conditions => "#{self.table_name}.jour_type = 'Course' "
+ :foreign_key => 'jour_id'
+
belongs_to :jour, :polymorphic => true
belongs_to :user
diff --git a/app/models/mailer.rb b/app/models/mailer.rb
index 2cae982a7..85ce46e8b 100644
--- a/app/models/mailer.rb
+++ b/app/models/mailer.rb
@@ -27,6 +27,80 @@ class Mailer < ActionMailer::Base
{ :host => Setting.host_name, :protocol => Setting.protocol }
end
+ # author: alan
+ # 根据用户选择发送个人日报或周报
+ # 发送内容: 项目【缺陷,讨论区,新闻】,课程【通知,留言,新闻】, 贴吧, 个人留言
+ def send_for_user_activities(user, date_to, days)
+ date_from = date_to - days.days
+
+ # 生成token用于直接点击登录
+ token = Token.new(:user =>user , :action => 'autologin')
+ token.save
+ @token = token
+
+ @user_url = url_for(my_account_url(user,:token => @token.value))
+ # 查询user参加的项目及课程
+ projects = user.projects
+ courses = user.courses
+ project_ids = projects.map{|project| project.id}.join(",")
+ course_ids = courses.map {|course| course.id}.join(",")
+
+ # 查询user的缺陷,包括发布的,跟踪的以及被指派的缺陷
+ @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")
+
+ # 查询课程作业,包括老师发布的作业,以及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
+ 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")
+ @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")
+
+ # 查询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')
+
+ # 查询课程课件更新
+ @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")
+ @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")
+ if days == 1
+ subject = "[ #{user.show_name} : #{date_from} - #{l(:label_day_mail)}]"
+ else
+ subject = "[ #{user.show_name} : #{l(:label_week_mail)}]"
+ end
+ mail :to => user.mail,:subject => "[ #{user.show_name} : #{l(:notice_successful_create)}]"
+
+ end
# 贴吧新建贴吧发送邮件
# example Mailer.forum(forum).deliver
def forum_add(forum)
@@ -140,7 +214,6 @@ class Mailer < ActionMailer::Base
@author = issue.author
@issue = issue
user = User.find_by_mail(recipients)
-
token = Token.new(:user =>user , :action => 'autologin')
token.save
@token = token
diff --git a/app/models/user.rb b/app/models/user.rb
index 06f59c764..dd06db838 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -24,7 +24,7 @@ class User < Principal
DEVELOPER = 3
include Redmine::SafeAttributes
-
+ seems_rateable_rater
# Different ways of displaying/sorting users
USER_FORMATS = {
:firstname_lastname => {
@@ -149,7 +149,7 @@ class User < Principal
scope :by_join_date, order("created_on DESC")
############################# added by liuping 关注
acts_as_watchable
- seems_rateable_rater
+
has_one :user_extensions,:dependent => :destroy
## end
diff --git a/app/views/mailer/send_for_user_activities.html.erb b/app/views/mailer/send_for_user_activities.html.erb
new file mode 100644
index 000000000..22b071a1f
--- /dev/null
+++ b/app/views/mailer/send_for_user_activities.html.erb
@@ -0,0 +1,337 @@
+
+
+
+
+
+
+
+
<%= l(:label_course_overview)%>
+ <% unless @course_news.first.nil? %>
+
+
+
+ <%= l(:label_course_news) %>
+ (<%= @course_news.count %>)
+
+
+ <% @course_news.each do |course_new|%>
+ -
+ ▪
+ [
+
+ <%= 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 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;"%>
+ <%= 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 %>
+
+ <% end %>
+
+
+
+ <% end %>
+ <% if !@bids.first.nil? || !@homeworks.first.nil? %>
+
+
+ <%= 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],
+ :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 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;"%>
+ <%= 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;"
+ %>
+ <%= 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],
+ :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 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;"%>
+ <%= 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;"
+ %>
+ <%= homework.created_on %>
+
+ <% end %>
+ <% end %>
+
+
+
+ <% end %>
+
+ <% unless @course_journal_messages.first.nil? %>
+
+
+
+ <%= l(:view_course_journals_for_messages) %>
+ (<%= @course_journal_messages.count %>)
+
+
+ <% @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],
+ :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 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;"%>
+ <%= 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;"
+ %>
+ <%= course_journal_message.created_on %>
+
+ <% end %>
+
+
+
+ <% end %>
+
+ <% unless @course_messages.first.nil? %>
+
+
+
+ <%= l(:view_borad_course) %>
+ (<%= @course_journal_messages.count %>)
+
+
+ <% @course_messages.each do |course_message|%>
+ -
+ ▪
+ [
+
+ <%= 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 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;"%>
+ <%= 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;"
+ %>
+ <%= course_message.created_on %>
+
+ <% end %>
+
+
+
+ <% end %>
+
+ <% unless @attachments.first.nil? %>
+
+
+ <%= l(:label_course_attendingcontestwork_download) %>
+ (<%= @attachments.count %>)
+
+
+ <% @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 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;"%>
+ <%= 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;"
+ %>
+ <%= course_message.created_on %>
+
+ <% end %>
+
+
+ <% end %>
+
+
+
+
+
<%= l(:label_project_overview)%>
+ <% unless @issues.first.nil? %>
+
+
+ <%= l(:label_issue_tracking) %>
+ (<%= @issues.count %>)
+
+
+ <% @issues.each do |issue|%>
+ -
+ ▪
+ [
+
+ <%= 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 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;"%>
+ <%= 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;"
+ %>
+ <%= issue.created_on %>
+
+ <% end %>
+
+
+
+ <% end %>
+
+ <% unless @project_messages.first.nil? %>
+
+
+ <%= l(:project_moule_boards_show) %>
+ (<%= @course_journal_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 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;"%>
+ <%= 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;"
+ %>
+ <%= project_message.created_on %>
+
+ <% end %>
+
+
+
+ <% end %>
+
+
+
+
+
+
+
<%= l(:label_activities) %>
+ <% unless @user_journal_messages.first.nil? %>
+
+
+ <%= 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(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;" %>
+ <%= 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;"
+ %>
+ <%= user_journal_message.created_on %>
+
+ <% end %>
+
+
+
+ <% end %>
+
+
+
+
+
+
diff --git a/app/views/mailer/send_for_user_activities.text.erb b/app/views/mailer/send_for_user_activities.text.erb
new file mode 100644
index 000000000..03ea31ec3
--- /dev/null
+++ b/app/views/mailer/send_for_user_activities.text.erb
@@ -0,0 +1,253 @@
+<%= l(:label_course_overview)%>
+ <% unless @course_news.first.nil? %>
+ <%= l(:label_course_news) %>
+ (<%= @course_news.count %>)
+
+
+ <% @course_news.each do |course_new|%>
+
+ ▪
+ [
+
+ <%= 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 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;"%>
+ <%= 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 %>
+
+ <% end %>
+
+ <% end %>
+ <% if !@bids.first.nil? || !@homeworks.first.nil? %>
+ <%= 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],
+ :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 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;"%>
+ <%= 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;"
+ %>
+ <%= 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],
+ :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 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;"%>
+ <%= 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;"
+ %>
+ <%= homework.created_on %>
+ <% end %>
+ <% end %>
+
+
+
+ <% end %>
+
+ <% unless @course_journal_messages.first.nil? %>
+
+ <%= l(:view_course_journals_for_messages) %> (<%= @course_journal_messages.count %>)
+
+
+ <% @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],
+ :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 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;"%>
+ <%= 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;"
+ %>
+ <%= course_journal_message.created_on %>
+
+ <% end %>
+
+
+ <% end %>
+
+ <% unless @course_messages.first.nil? %>
+
+ <%= l(:view_borad_course) %>
+ (<%= @course_journal_messages.count %>)
+
+
+ <% @course_messages.each do |course_message|%>
+
+ ▪
+ [
+
+ <%= 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 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;"%>
+ <%= 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;"
+ %>
+ <%= course_message.created_on %>
+
+ <% end %>
+
+
+ <% end %>
+
+ <% unless @attachments.first.nil? %>
+
+ <%= l(:label_course_attendingcontestwork_download) %>
+ (<%= @attachments.count %>)
+
+
+ <% @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 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;"%>
+ <%= 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;"
+ %>
+ <%= course_message.created_on %>
+
+ <% end %>
+
+
+ <% end %>
+
+
+
+<%= l(:label_project_overview)%>
+ <% unless @issues.first.nil? %>
+
+ <%= l(:label_issue_tracking) %>
+ (<%= @issues.count %>)
+
+ <% @issues.each do |issue|%>
+ ▪
+ [
+
+ <%= 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 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;"%>
+ <%= 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;"
+ %>
+ <%= issue.created_on %>
+ <% end %>
+
+
+ <% end %>
+
+ <% unless @project_messages.first.nil? %>
+
+ <%= l(:project_moule_boards_show) %>
+ (<%= @course_journal_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 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;"%>
+ <%= 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;"
+ %>
+ <%= project_message.created_on %>
+ <% end %>
+
+
+ <% end %>
+
+
+
+<%= l(:label_activities) %>
+ <% unless @user_journal_messages.first.nil? %>
+
+ <%= 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(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;" %>
+ <%= 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;"
+ %>
+ <%= user_journal_message.created_on %>
+
+ <% end %>
+
+
+ <% end %>
+<
+
+ <%= link_to l(:mail_footer), @user_url, :style => "margin-top:20px;color:#2775d2; margin-left:10px;" %>
diff --git a/config/initializers/send_mail.rb b/config/initializers/send_mail.rb
new file mode 100644
index 000000000..4cfd3cc03
--- /dev/null
+++ b/config/initializers/send_mail.rb
@@ -0,0 +1,23 @@
+#!/usr/bin/env ruby
+
+require 'rubygems'
+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%'")
+ 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}"
+ Thread.start do
+ Mailer.send_for_user_activities(user, Date.today, 7).deliver
+ end
+ end
+end
+
diff --git a/config/locales/zh.yml b/config/locales/zh.yml
index 42a1143ec..8899256a9 100644
--- a/config/locales/zh.yml
+++ b/config/locales/zh.yml
@@ -248,6 +248,9 @@ zh:
# end
field_name: 名称
field_enterprise_name: 组织名称
+
+ label_week_mail: 一周动态
+ label_day_mail: 一日动态
#added by huang
field_tea_name: 教师
field_couurse_time: 学时
@@ -497,6 +500,9 @@ zh:
permission_paret_in_homework: 加入作业
permission_view_homework_attaches: 查看作业附件
permission_view_course_journals_for_messages: 查看课程留言
+ view_course_journals_for_messages: 课程留言
+ label_send_course_journals_for_messages: 发布了留言
+ label_send_course_messages: 发布了讨论
permission_select_course_modules: 选择课程模块
permission_view_course_files: 查看课程资源
permission_add_course: 新建课程
@@ -511,6 +517,7 @@ zh:
permission_upload_attachments: 资源上传
project_module_issue_tracking: 问题跟踪
+ project_moule_boards_show: 项目论坛
project_module_time_tracking: 时间跟踪
project_module_news: 新闻
project_module_documents: 文档
@@ -657,6 +664,8 @@ zh:
label_user_login_attending_contest: 您还没有登录,请登录后参赛
label_user_login_score_and_comment: 您还没有登录,请登录后对作品进行打分评价
label_user_login_notificationcomment: 您还没有登录,请登录后参加评论
+ label_user_message: 您的留言
+ label_show_your_message: 给您的留言
#end
#by huang # modified by bai
label_college: 高校进入
@@ -727,6 +736,7 @@ zh:
label_attachment: 文件
label_attachment_new: 新建文件
label_file_upload: 上传资料
+ label_course_file_upload: 上传了课件
label_attachment_delete: 删除文件
label_attachment_plural: 文件
label_file_added: 文件已添加
@@ -745,6 +755,8 @@ zh:
label_settings: 配置
label_overview: 近期动态
label_course_overview: "课程动态"
+ label_project_overview: "项目动态"
+ label_homework_overview: 作业动态
label_question_student: 作业交流 #bai
label_homework_commit: 提交作业 #huang
label_homework_info: 提交情况 #huang
@@ -992,6 +1004,7 @@ zh:
label_project_newother: "查看其他评论"
label_project_newshare: "分享了"
label_project_notice: "发布了通知:"
+ label_project_issue: "发布了问题:"
label_project_newadd: "添加了"
label_project_unadd: "暂无项目,赶快去创建吧!"
label_project_un: "该用户暂未参与任何项目!"
@@ -1591,6 +1604,7 @@ zh:
label_exist_repository_path: 定义已有版本库URL路径,定义格式file://, http://, https://, svn://
label_project_no_activity: 该项目暂无动态!
label_course_homework_un: 暂未发布任何作业
+ label_course_homework: 发布了作业
label_follow_no_requirement: 暂未关注任何需求!
label_no_user_respond_you: 暂无任何用户对您进行反馈!
label_tags_issue: 问题名称:
@@ -1662,6 +1676,7 @@ zh:
label_project_no_follow: 该项目暂未被关注!
label_no_bid_project: 暂无参与项目
label_no_course_project: 暂无已提交的作业!
+ label_course_submit_homework: 提交了作业
label_bids_reward_method: 奖励方式 :
label_bids_reward_what: 输入奖励内容
label_call_bonus: 奖金
@@ -1769,6 +1784,7 @@ zh:
label_wiki_number: wiki的数量
label_message_number: 留言的数量
label_activity_number: 个人动态数量
+ label_activities: 个人动态
label_issue_message_number: 对issue的留言数量
label_code_submit_number: 代码提交次数
label_topic_number: 讨论区发言数量
@@ -1954,6 +1970,7 @@ zh:
label_hot_project: '热门项目'
label_borad_project: 项目讨论区
label_borad_course: 课程讨论区
+ view_borad_course: 课程讨论
label_memo_create_succ: 发布成功
label_memo_create_fail: 发布失败
label_forum_create_succ: 贴吧新建成功
@@ -2117,6 +2134,7 @@ zh:
label_attendingcontestwork_release_person: 发布人员
label_attendingcontestwork_adaptive_system: 系统支持
label_attendingcontestwork_download: 作品下载
+ label_course_attendingcontestwork_download: 课件下载
label_attendingcontestwork_developers: 开发人员
label_attendingcontestwork_average_scores: 平均评分
label_attendingcontestwork_release_time: 发布时间
@@ -2370,7 +2388,7 @@ zh:
mail_issue_from_project: "项目问题跟踪"
mail_issue_attachments: "附件:"
mail_issue_reply: "我要回复"
-
+ mail_footer: "退订Trustie社区任务提醒?"
# 课程资源上传
# edit by meng
# 课程资源上传>
From 1166a1463bd10802a6af7b9c65027d3241e0b557 Mon Sep 17 00:00:00 2001
From: alan <547533434@qq.com>
Date: Sat, 7 Feb 2015 09:33:54 +0800
Subject: [PATCH 10/97] Signed-off-by: alan <547533434@qq.com>
---
app/models/forum.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/models/forum.rb b/app/models/forum.rb
index f5581b232..baa8e6260 100644
--- a/app/models/forum.rb
+++ b/app/models/forum.rb
@@ -5,7 +5,7 @@ class Forum < ActiveRecord::Base
has_many :memos, :dependent => :destroy, conditions: "parent_id IS NULL"
belongs_to :creator, :class_name => "User", :foreign_key => 'creator_id'
- after_create :expire_forum_cache, :send_email
+ after_create :expire_forum_cache
after_update :expire_forum_cache
before_destroy :expire_forum_cache
safe_attributes 'name',
From f380d781e72bfbcdddb0d523d250d89366a48dfd Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Mon, 9 Feb 2015 10:28:33 +0800
Subject: [PATCH 11/97] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=A0=B9=E6=8D=AE?=
=?UTF-8?q?=E5=B7=B2=E6=9C=89=E8=AF=BE=E7=A8=8B=E5=A4=8D=E5=88=B6=E6=88=90?=
=?UTF-8?q?=E6=96=B0=E8=AF=BE=E7=A8=8B=E7=9A=84=E8=B7=AF=E7=94=B1=E4=BB=A5?=
=?UTF-8?q?=E5=8F=8A=E6=96=B9=E6=B3=95=E5=AE=9E=E7=8E=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/courses_controller.rb | 28 +++++++++++++++++++++++++--
config/routes.rb | 1 +
2 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb
index 61944ca2c..19f9c0fa2 100644
--- a/app/controllers/courses_controller.rb
+++ b/app/controllers/courses_controller.rb
@@ -955,10 +955,34 @@ class CoursesController < ApplicationController
else
render_403
end
-
end
-
+ #根据已有课程复制课程
+ #param id:已有课程ID
+ def copy_course
+ if @course
+ @new_course = Course.new @course.attributes
+ @new_course.tea_id = User.current.id
+ @new_course.created_at = DateTime.now
+ @new_course.updated_at = DateTime.now
+ @new_course.endup_time = nil
+ if @new_course.save
+ r = Role.givable.find_by_id(Setting.new_project_user_role_id.to_i) || Role.givable.first
+ m = Member.new(:user => User.current, :roles => [r])
+ m.project_id = -1
+ course = CourseInfos.new(:user_id => User.current.id, :course_id => @new_course.id)
+ #user_grades = UserGrade.create(:user_id => User.current.id, :course_id => @course.id)
+ if @new_course.is_public == 1
+ course_status = CourseStatus.create(:course_id => @new_course.id, :watchers_count => 0, :changesets_count => 0, :grade => 0, :course_type => 1)
+ end
+ @new_course.members << m
+ @new_course.course_infos << course
+ redirect_to settings_course_url @new_course
+ end
+ else
+ render_404
+ end
+ end
private
diff --git a/config/routes.rb b/config/routes.rb
index a06679fba..bf0b73e8d 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -682,6 +682,7 @@ RedmineApp::Application.routes.draw do
match 'valid_ajax', :to => 'courses#valid_ajax', :via => :get
post 'join_in/join_group', :to => 'courses#join_group', :as => 'join_group'
delete 'join_in/join_group', :to => 'courses#unjoin_group'
+ get 'copy_course'
end
collection do
match 'join_private_courses', :via => [:get, :post]
From 5ef1bc1d02a9872be4aff0c37325d33784014efa Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Tue, 10 Feb 2015 10:21:46 +0800
Subject: [PATCH 12/97] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9C=AC=E5=9C=B0?=
=?UTF-8?q?=E7=99=BB=E5=BD=95=E5=90=8E=E6=8A=A5=E9=94=99=20=E4=BF=AE?=
=?UTF-8?q?=E6=94=B9zh.yml=E6=96=87=E4=BB=B6=E5=BC=82=E5=B8=B8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/users/show.html.erb | 2 +-
config/locales/zh.yml | 837 +++++++++++++++++++++++++---------
2 files changed, 625 insertions(+), 214 deletions(-)
diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb
index bb250a584..23f57dc37 100644
--- a/app/views/users/show.html.erb
+++ b/app/views/users/show.html.erb
@@ -2,7 +2,7 @@