Merge branch 'develop' into 'develop'
issue详情页面一、二级回复、一级删除局部刷新 See merge request !80
This commit is contained in:
commit
4125c1b44a
|
@ -109,9 +109,9 @@ class DocumentsController < ApplicationController
|
||||||
attachments = Attachment.attach_files(@document, params[:attachments])
|
attachments = Attachment.attach_files(@document, params[:attachments])
|
||||||
render_attachment_warning_if_needed(@document)
|
render_attachment_warning_if_needed(@document)
|
||||||
|
|
||||||
if attachments.present? && attachments[:files].present? && Setting.notified_events.include?('document_added')
|
# if attachments.present? && attachments[:files].present? && Setting.notified_events.include?('document_added')
|
||||||
Mailer.run.attachments_added(attachments[:files])
|
# # Mailer.run.attachments_added(attachments[:files])
|
||||||
end
|
# end
|
||||||
redirect_to document_url(@document)
|
redirect_to document_url(@document)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -524,7 +524,7 @@ class FilesController < ApplicationController
|
||||||
attachments = Attachment.attach_filesex(@project, params[:attachments], params[:attachment_type])
|
attachments = Attachment.attach_filesex(@project, params[:attachments], params[:attachment_type])
|
||||||
if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added')
|
if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added')
|
||||||
# 发送邮件
|
# 发送邮件
|
||||||
Mailer.run.attachments_added(attachments[:files])
|
# Mailer.run.attachments_added(attachments[:files])
|
||||||
# 生成动态
|
# 生成动态
|
||||||
attachments[:files].each do |file|
|
attachments[:files].each do |file|
|
||||||
ForgeActivity.create(:user_id => User.current.id, :project_id => @project.id, :forge_act_id => file.id, :forge_act_type => "Attachment")
|
ForgeActivity.create(:user_id => User.current.id, :project_id => @project.id, :forge_act_id => file.id, :forge_act_type => "Attachment")
|
||||||
|
@ -581,9 +581,9 @@ class FilesController < ApplicationController
|
||||||
end
|
end
|
||||||
attachments = Attachment.attach_filesex(@course, params[:attachments], params[:attachment_type])
|
attachments = Attachment.attach_filesex(@course, params[:attachments], params[:attachment_type])
|
||||||
|
|
||||||
if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added')
|
# if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added')
|
||||||
Mailer.run.attachments_added(attachments[:files])
|
# # Mailer.run.attachments_added(attachments[:files])
|
||||||
end
|
# end
|
||||||
if !attachments.empty? && attachments[:files]
|
if !attachments.empty? && attachments[:files]
|
||||||
attachments[:files].each do |attachment|
|
attachments[:files].each do |attachment|
|
||||||
if params[:publish_time]
|
if params[:publish_time]
|
||||||
|
|
|
@ -284,7 +284,7 @@ class HomeworkCommonController < ApplicationController
|
||||||
@statue = 1
|
@statue = 1
|
||||||
# 匿评开启消息邮件通知
|
# 匿评开启消息邮件通知
|
||||||
send_message_anonymous_comment(@homework, m_status = 2)
|
send_message_anonymous_comment(@homework, m_status = 2)
|
||||||
Mailer.send_mail_anonymous_comment_open(@homework).deliver
|
# Mailer.send_mail_anonymous_comment_open(@homework).deliver
|
||||||
else
|
else
|
||||||
@statue = 2
|
@statue = 2
|
||||||
|
|
||||||
|
@ -326,7 +326,7 @@ class HomeworkCommonController < ApplicationController
|
||||||
|
|
||||||
# 匿评关闭消息邮件通知
|
# 匿评关闭消息邮件通知
|
||||||
send_message_anonymous_comment(@homework, m_status = 3)
|
send_message_anonymous_comment(@homework, m_status = 3)
|
||||||
Mailer.send_mail_anonymous_comment_close(@homework).deliver
|
# Mailer.send_mail_anonymous_comment_close(@homework).deliver
|
||||||
@user_activity_id = params[:user_activity_id].to_i
|
@user_activity_id = params[:user_activity_id].to_i
|
||||||
@hw_status = params[:hw_status].to_i
|
@hw_status = params[:hw_status].to_i
|
||||||
@is_teacher = User.current.admin? || User.current.allowed_to?(:as_teacher, @course)
|
@is_teacher = User.current.admin? || User.current.allowed_to?(:as_teacher, @course)
|
||||||
|
|
|
@ -262,6 +262,7 @@ class IssuesController < ApplicationController
|
||||||
retrieve_previous_and_next_issue_ids
|
retrieve_previous_and_next_issue_ids
|
||||||
render :template => 'issues/show', :layout => @project_base_tag#by young
|
render :template => 'issues/show', :layout => @project_base_tag#by young
|
||||||
}
|
}
|
||||||
|
format.js
|
||||||
format.api
|
format.api
|
||||||
format.atom { render :template => 'journals/index', :layout => false, :content_type => 'application/atom+xml' }
|
format.atom { render :template => 'journals/index', :layout => false, :content_type => 'application/atom+xml' }
|
||||||
format.pdf {
|
format.pdf {
|
||||||
|
@ -586,12 +587,15 @@ class IssuesController < ApplicationController
|
||||||
update_forge_activity(@issue.class,@issue.id)
|
update_forge_activity(@issue.class,@issue.id)
|
||||||
@allowed_statuses = @issue.new_statuses_allowed_to(User.current)
|
@allowed_statuses = @issue.new_statuses_allowed_to(User.current)
|
||||||
@user_activity_id = params[:user_activity_id]
|
@user_activity_id = params[:user_activity_id]
|
||||||
if params[:issue_id]
|
|
||||||
@issue_id = params[:issue_id]
|
|
||||||
end
|
|
||||||
@priorities = IssuePriority.active
|
@priorities = IssuePriority.active
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.js
|
# Issue详情单独处理
|
||||||
|
if params[:is_issue_show]
|
||||||
|
format.js{redirect_to issue_path(@issue)}
|
||||||
|
else
|
||||||
|
format.js
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -643,7 +647,11 @@ class IssuesController < ApplicationController
|
||||||
update_user_activity(@issue.class,@issue.id)
|
update_user_activity(@issue.class,@issue.id)
|
||||||
update_forge_activity(@issue.class,@issue.id)
|
update_forge_activity(@issue.class,@issue.id)
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.js
|
if params[:is_issue_show]
|
||||||
|
format.js{redirect_to issue_path(@issue)}
|
||||||
|
else
|
||||||
|
format.js
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -655,23 +663,23 @@ class IssuesController < ApplicationController
|
||||||
# 非动态页面直接刷新,动态页面手动刷新
|
# 非动态页面直接刷新,动态页面手动刷新
|
||||||
def delete_journal
|
def delete_journal
|
||||||
@is_project = params[:is_project]
|
@is_project = params[:is_project]
|
||||||
@issue = Issue.find(params[:id])
|
@issue = Issue.find(params[:id])
|
||||||
begin
|
begin
|
||||||
forge_acts = ForgeMessage.where(:forge_message_type => "Journal", :forge_message_id => params[:journal_id])
|
forge_acts = ForgeMessage.where(:forge_message_type => "Journal", :forge_message_id => params[:journal_id])
|
||||||
forge_acts.destroy_all unless forge_acts.empty?
|
forge_acts.destroy_all unless forge_acts.empty?
|
||||||
at_message = AtMessage.where(:at_message_type => "Journal", :at_message_id => params[:journal_id])
|
at_message = AtMessage.where(:at_message_type => "Journal", :at_message_id => params[:journal_id])
|
||||||
at_message.destroy_all unless at_message.empty?
|
at_message.destroy_all unless at_message.empty?
|
||||||
Journal.delete(params[:journal_id])
|
Journal.delete(params[:journal_id])
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
puts e
|
puts e
|
||||||
end
|
end
|
||||||
@user_activity_id = params[:user_activity_id]
|
@user_activity_id = params[:user_activity_id]
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @user_activity_id
|
if @user_activity_id
|
||||||
format.js
|
format.js
|
||||||
else
|
else
|
||||||
format.html{ redirect_to issue_url(@issue)}
|
format.js{ redirect_to issue_url(@issue)}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -157,23 +157,33 @@ class MembersController < ApplicationController
|
||||||
project_info = []
|
project_info = []
|
||||||
if params[:membership]
|
if params[:membership]
|
||||||
if params[:membership][:user_ids]
|
if params[:membership][:user_ids]
|
||||||
attrs = params[:membership].dup
|
ActiveRecord::Base.transaction do
|
||||||
user_ids = attrs.delete(:user_ids)
|
begin
|
||||||
user_ids.each do |user_id|
|
attrs = params[:membership].dup
|
||||||
members << Member.new(:role_ids => params[:membership][:role_ids], :user_id => user_id)
|
user_ids = attrs.delete(:user_ids)
|
||||||
user_grades << UserGrade.new(:user_id => user_id, :project_id => @project.id)
|
user_ids.each do |user_id|
|
||||||
|
members << Member.new(:role_ids => params[:membership][:role_ids], :user_id => user_id)
|
||||||
|
user_grades << UserGrade.new(:user_id => user_id, :project_id => @project.id)
|
||||||
|
|
||||||
#给新成员发送加入项目的消息,发送者id放在ForgeMessage的forge_message_id字段中,
|
#给新成员发送加入项目的消息,发送者id放在ForgeMessage的forge_message_id字段中,
|
||||||
#forge_message_type设置为JoinProject
|
#forge_message_type设置为JoinProject
|
||||||
forge_join = ForgeMessage.new(:user_id =>user_id, :forge_message_id=>User.current.id,:project_id => @project.id,:forge_message_type=>"JoinProject", :viewed => false)
|
forge_join = ForgeMessage.new(:user_id =>user_id, :forge_message_id=>User.current.id,:project_id => @project.id,:forge_message_type=>"JoinProject", :viewed => false)
|
||||||
forge_join.save
|
forge_join.save
|
||||||
## added by nie
|
## added by nie
|
||||||
if (params[:membership][:role_ids])
|
if (params[:membership][:role_ids])
|
||||||
role = Role.find(params[:membership][:role_ids][0])
|
role = Role.find(params[:membership][:role_ids][0])
|
||||||
project_info << ProjectInfo.new(:user_id => user_id, :project_id => @project.id) if role.allowed_to?(:is_manager)
|
project_info << ProjectInfo.new(:user_id => user_id, :project_id => @project.id) if role.allowed_to?(:is_manager)
|
||||||
# ProjectInfo.create(:name => "test", :user_id => 123)
|
# ProjectInfo.create(:name => "test", :user_id => 123)
|
||||||
|
end
|
||||||
|
## end
|
||||||
|
end
|
||||||
|
rescue Gitlab::Error::Forbidden => e
|
||||||
|
@message = l(:label_pull_request_forbidden)
|
||||||
|
rescue Gitlab::Error::BadRequest => e
|
||||||
|
@message = "添加成员失败,可能是你添加的用户名中含有非法字符"
|
||||||
|
rescue Exception => e
|
||||||
|
puts e
|
||||||
end
|
end
|
||||||
## end
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
members << Member.new(:role_ids => params[:membership][:role_ids], :user_id => params[:membership][:user_id])
|
members << Member.new(:role_ids => params[:membership][:role_ids], :user_id => params[:membership][:user_id])
|
||||||
|
@ -297,26 +307,29 @@ class MembersController < ApplicationController
|
||||||
#增加对课程成员修改的支持
|
#增加对课程成员修改的支持
|
||||||
if @project
|
if @project
|
||||||
if params[:membership]
|
if params[:membership]
|
||||||
@member.role_ids = params[:membership][:role_ids]
|
ActiveRecord::Base.transaction do
|
||||||
|
begin
|
||||||
#added by nie
|
@member.role_ids = params[:membership][:role_ids]
|
||||||
if (params[:membership][:role_ids])
|
if (params[:membership][:role_ids])
|
||||||
role = Role.find(params[:membership][:role_ids][0])
|
role = Role.find(params[:membership][:role_ids][0])
|
||||||
if role.allowed_to?(:is_manager)
|
if role.allowed_to?(:is_manager)
|
||||||
@projectInfo = ProjectInfo.new(:user_id => @member.user_id, :project_id => @project.id)
|
@projectInfo = ProjectInfo.new(:user_id => @member.user_id, :project_id => @project.id)
|
||||||
@projectInfo.save
|
@projectInfo.save
|
||||||
else
|
else
|
||||||
user_admin = ProjectInfo.where("user_id = ? and project_id = ?", @member.user_id, @project.id)
|
user_admin = ProjectInfo.where("user_id = ? and project_id = ?", @member.user_id, @project.id)
|
||||||
if user_admin.size > 0
|
if user_admin.size > 0
|
||||||
user_admin.each do |user|
|
user_admin.each do |user|
|
||||||
user.destroy
|
user.destroy
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@member.save!
|
||||||
|
rescue Exception => e
|
||||||
|
puts e
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
saved = @member.save
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html { redirect_to_settings_in_projects }
|
format.html { redirect_to_settings_in_projects }
|
||||||
format.js
|
format.js
|
||||||
|
@ -385,27 +398,33 @@ class MembersController < ApplicationController
|
||||||
#课程成员删除修改
|
#课程成员删除修改
|
||||||
if @project
|
if @project
|
||||||
if request.delete? && @member.deletable?
|
if request.delete? && @member.deletable?
|
||||||
@member.destroy
|
ActiveRecord::Base.transaction do
|
||||||
# end
|
begin
|
||||||
user_admin = ProjectInfo.where("user_id = ? and project_id = ?", @member.user_id, @project.id)
|
@member.destroy
|
||||||
if user_admin.size > 0
|
# end
|
||||||
user_admin.each do |user|
|
user_admin = ProjectInfo.where("user_id = ? and project_id = ?", @member.user_id, @project.id)
|
||||||
user.destroy
|
if user_admin.size > 0
|
||||||
|
user_admin.each do |user|
|
||||||
|
user.destroy
|
||||||
|
end
|
||||||
|
end
|
||||||
|
user_grade = UserGrade.where("user_id = ? and project_id = ?", @member.user_id, @project.id)
|
||||||
|
if user_grade.size > 0
|
||||||
|
user_grade.each do |grade|
|
||||||
|
grade.destroy
|
||||||
|
end
|
||||||
|
end
|
||||||
|
# 移出的时候删除申请消息,不需要删除消息,所以不必要关联删除
|
||||||
|
applied_projects = AppliedProject.where(:project_id => @project.id, :user_id => @member.user_id).first
|
||||||
|
unless applied_projects.nil?
|
||||||
|
applied_projects.delete
|
||||||
|
end
|
||||||
|
#移出项目发送消息
|
||||||
|
ForgeMessage.create(:user_id => @member.user_id, :project_id => @project.id, :forge_message_type => "RemoveFromProject", :viewed => false, :forge_message_id => User.current.id)
|
||||||
|
rescue Exception => e
|
||||||
|
puts e
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
user_grade = UserGrade.where("user_id = ? and project_id = ?", @member.user_id, @project.id)
|
|
||||||
if user_grade.size > 0
|
|
||||||
user_grade.each do |grade|
|
|
||||||
grade.destroy
|
|
||||||
end
|
|
||||||
end
|
|
||||||
# 移出的时候删除申请消息,不需要删除消息,所以不必要关联删除
|
|
||||||
applied_projects = AppliedProject.where(:project_id => @project.id, :user_id => @member.user_id).first
|
|
||||||
unless applied_projects.nil?
|
|
||||||
applied_projects.delete
|
|
||||||
end
|
|
||||||
#移出项目发送消息
|
|
||||||
ForgeMessage.create(:user_id => @member.user_id, :project_id => @project.id, :forge_message_type => "RemoveFromProject", :viewed => false, :forge_message_id => User.current.id)
|
|
||||||
end
|
end
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html { redirect_to_settings_in_projects }
|
format.html { redirect_to_settings_in_projects }
|
||||||
|
|
|
@ -159,8 +159,8 @@ class MyController < ApplicationController
|
||||||
g = Gitlab.client
|
g = Gitlab.client
|
||||||
begin
|
begin
|
||||||
g.edit_user(@user.gid, :email => params[:user][:mail])
|
g.edit_user(@user.gid, :email => params[:user][:mail])
|
||||||
rescue
|
rescue Exception => e
|
||||||
logger.error "sync user's email of gitlab failed!"
|
puts e
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -432,7 +432,7 @@ class ProjectsController < ApplicationController
|
||||||
# 如果已经邀请过该用户,则不重复发送
|
# 如果已经邀请过该用户,则不重复发送
|
||||||
if InviteList.where("project_id =? and mail =?", @project.id, params[:mail].to_s).first.nil?
|
if InviteList.where("project_id =? and mail =?", @project.id, params[:mail].to_s).first.nil?
|
||||||
email = params[:mail]
|
email = params[:mail]
|
||||||
Mailer.request_member_to_project(email, @project, User.current).deliver
|
# Mailer.request_member_to_project(email, @project, User.current).deliver
|
||||||
flash[:notice] = l(:notice_email_sent, :value => email)
|
flash[:notice] = l(:notice_email_sent, :value => email)
|
||||||
else
|
else
|
||||||
flash[:error] = l(:notice_email_invited)
|
flash[:error] = l(:notice_email_invited)
|
||||||
|
@ -445,7 +445,7 @@ class ProjectsController < ApplicationController
|
||||||
first_name = params[:first_name]
|
first_name = params[:first_name]
|
||||||
last_name = params[:last_name]
|
last_name = params[:last_name]
|
||||||
gender = params[:gender]
|
gender = params[:gender]
|
||||||
Mailer.send_invite_in_project(email, @project, User.current, first_name, last_name, gender).deliver
|
# Mailer.send_invite_in_project(email, @project, User.current, first_name, last_name, gender).deliver
|
||||||
@is_zhuce = false
|
@is_zhuce = false
|
||||||
flash[:notice] = l(:notice_email_sent, :value => email)
|
flash[:notice] = l(:notice_email_sent, :value => email)
|
||||||
end
|
end
|
||||||
|
@ -458,13 +458,13 @@ class ProjectsController < ApplicationController
|
||||||
invite_list = InviteList.where("project_id =? and mail =?", @project.id, params[:mail].to_s).first
|
invite_list = InviteList.where("project_id =? and mail =?", @project.id, params[:mail].to_s).first
|
||||||
if invite_list.nil?
|
if invite_list.nil?
|
||||||
email = params[:mail]
|
email = params[:mail]
|
||||||
Mailer.request_member_to_project(email, @project, User.current).deliver
|
# Mailer.request_member_to_project(email, @project, User.current).deliver
|
||||||
flash[:notice] = l(:notice_email_sent, :value => email)
|
flash[:notice] = l(:notice_email_sent, :value => email)
|
||||||
else
|
else
|
||||||
# 已经发送过了,则隔3小时才能再次发送
|
# 已经发送过了,则隔3小时才能再次发送
|
||||||
if Time.now - invite_list.created_at > 10800
|
if Time.now - invite_list.created_at > 10800
|
||||||
email = params[:mail]
|
email = params[:mail]
|
||||||
Mailer.request_member_to_project(email, @project, User.current).deliver
|
# Mailer.request_member_to_project(email, @project, User.current).deliver
|
||||||
flash[:notice] = l(:notice_email_sent, :value => email)
|
flash[:notice] = l(:notice_email_sent, :value => email)
|
||||||
else
|
else
|
||||||
flash[:error] = l(:notice_email_invited)
|
flash[:error] = l(:notice_email_invited)
|
||||||
|
|
|
@ -35,7 +35,7 @@ class RepositoriesController < ApplicationController
|
||||||
before_filter :find_project_by_project_id, :only => [:new, :create, :newrepo, :stats, :quality_analysis]
|
before_filter :find_project_by_project_id, :only => [:new, :create, :newrepo, :stats, :quality_analysis]
|
||||||
before_filter :find_repository, :only => [:edit, :update, :destroy, :committers]
|
before_filter :find_repository, :only => [:edit, :update, :destroy, :committers]
|
||||||
|
|
||||||
before_filter :find_project_repository, :except => [:new, :create, :newcreate, :edit, :update, :destroy, :committers, :newrepo, :to_gitlab, :forked, :project_archive, :export_rep_static]
|
before_filter :find_project_repository, :except => [:new, :create, :newcreate, :edit, :update, :destroy, :committers, :newrepo, :to_gitlab, :forked, :export_rep_static]
|
||||||
# 连接gitlab
|
# 连接gitlab
|
||||||
# before_filter :connect_gitlab, :only => [:quality_analysis, :commit_diff]
|
# before_filter :connect_gitlab, :only => [:quality_analysis, :commit_diff]
|
||||||
|
|
||||||
|
@ -121,9 +121,15 @@ class RepositoriesController < ApplicationController
|
||||||
|
|
||||||
# 一键ZIP下载
|
# 一键ZIP下载
|
||||||
def project_archive
|
def project_archive
|
||||||
g = Gitlab.client
|
token = Gitlab.private_token
|
||||||
g.get()
|
token = aes_encrypt(token, "abcd")
|
||||||
# g.project_archive(params[:gpid].to_i, params[:rev])
|
# g = Gitlab.client
|
||||||
|
# g.project_archive(@project.gpid, @rev)
|
||||||
|
# 'git archive --format zip --output /path/to/file.zip master' # 将 master 以zip格式打包到指定文件
|
||||||
|
#
|
||||||
|
# zip_path = Gitlab.endpoint.to_s + "/projects/" + @project.gpid.to_s + "/repository/archive?&private_token=" + Gitlab.private_token
|
||||||
|
# f = open(zip_path).read
|
||||||
|
# send_file "/path/to/file.zip"
|
||||||
end
|
end
|
||||||
|
|
||||||
# 判断用户是否已经fork过该项目
|
# 判断用户是否已经fork过该项目
|
||||||
|
@ -265,12 +271,23 @@ update
|
||||||
@repository.type = 'Repository::Gitlab'
|
@repository.type = 'Repository::Gitlab'
|
||||||
@repository.identifier = @repository.identifier.downcase
|
@repository.identifier = @repository.identifier.downcase
|
||||||
@repository.url = @repository.identifier
|
@repository.url = @repository.identifier
|
||||||
if request.post? && @repository.save
|
ActiveRecord::Base.transaction do
|
||||||
s = Trustie::Gitlab::Sync.new
|
begin
|
||||||
s.create_project(@project, @repository)
|
if request.post? && @repository.save
|
||||||
redirect_to(:controller => 'repositories', :action => 'show', :id => @project, :repository_id => gitlab_repository(@project).try(:identifier))
|
s = Trustie::Gitlab::Sync.new
|
||||||
else
|
s.create_project(@project, @repository)
|
||||||
redirect_to settings_project_url(@project, :tab => 'repositories',:repository_error_message=>@repository.errors.full_messages)
|
raise "sync failed" if @project.gpid.blank?
|
||||||
|
redirect_to(:controller => 'repositories', :action => 'show', :id => @project, :repository_id => gitlab_repository(@project).try(:identifier))
|
||||||
|
else
|
||||||
|
redirect_to settings_project_url(@project, :tab => 'repositories',:repository_error_message=>@repository.errors.full_messages)
|
||||||
|
end
|
||||||
|
rescue Gitlab::Error::Forbidden => e
|
||||||
|
@message = l(:label_pull_request_forbidden)
|
||||||
|
rescue Gitlab::Error::NotFound => e
|
||||||
|
@message = l(:label_pull_request_notfound)
|
||||||
|
rescue Exception => e
|
||||||
|
puts e
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -398,8 +415,12 @@ update
|
||||||
|
|
||||||
@creator = @project.owner.to_s
|
@creator = @project.owner.to_s
|
||||||
gitlab_address = Redmine::Configuration['gitlab_address']
|
gitlab_address = Redmine::Configuration['gitlab_address']
|
||||||
# REDO:需优化,仅测试用
|
gitlab_token = Gitlab.private_token
|
||||||
@zip_path = Gitlab.endpoint.to_s + "/projects/" + @project.gpid.to_s + "/repository/archive?&private_token=" + Gitlab.private_token
|
# token值加密解密
|
||||||
|
token = aes_encrypt("priEn3UwXfJs3Pmy", gitlab_token)
|
||||||
|
# token值解密
|
||||||
|
# gitlab_token = aes_dicrypt("priEn3UwXfJs3Pmy", token)
|
||||||
|
@zip_path = Gitlab.endpoint.to_s + "/projects/" + @project.gpid.to_s + "/repository/archive?&private_token=" + token
|
||||||
end
|
end
|
||||||
|
|
||||||
@creator = @project.owner.to_s
|
@creator = @project.owner.to_s
|
||||||
|
|
|
@ -768,7 +768,7 @@ class UsersController < ApplicationController
|
||||||
ah = ApplyHomework.where("user_id = ? and homework_common_id = ?", User.current.id, params[:homework_id].to_i)
|
ah = ApplyHomework.where("user_id = ? and homework_common_id = ?", User.current.id, params[:homework_id].to_i)
|
||||||
if ah.empty?
|
if ah.empty?
|
||||||
ApplyHomework.create(:user_id => params[:id].to_i, :homework_common_id => params[:homework_id].to_i, :status => 1)
|
ApplyHomework.create(:user_id => params[:id].to_i, :homework_common_id => params[:homework_id].to_i, :status => 1)
|
||||||
Mailer.run.apply_for_homework_request(homework, User.current)
|
# Mailer.run.apply_for_homework_request(homework, User.current)
|
||||||
CourseMessage.create(:user_id => homework.user_id, :course_id => homework.course.id, :viewed => false,:course_message_id=>params[:homework_id].to_i,:course_message_type=>'HomeworkCommon',:status=>5,:apply_user_id=>params[:id].to_i,:content=>params[:content])
|
CourseMessage.create(:user_id => homework.user_id, :course_id => homework.course.id, :viewed => false,:course_message_id=>params[:homework_id].to_i,:course_message_type=>'HomeworkCommon',:status=>5,:apply_user_id=>params[:id].to_i,:content=>params[:content])
|
||||||
@state = 2
|
@state = 2
|
||||||
@ah = ApplyHomework.where("user_id = ? and homework_common_id = ?", params[:id].to_i, params[:homework_id].to_i).first
|
@ah = ApplyHomework.where("user_id = ? and homework_common_id = ?", params[:id].to_i, params[:homework_id].to_i).first
|
||||||
|
|
|
@ -37,6 +37,23 @@ module ApplicationHelper
|
||||||
# super
|
# super
|
||||||
# end
|
# end
|
||||||
|
|
||||||
|
# 字符串加密
|
||||||
|
def aes_encrypt(key, encrypted_string)
|
||||||
|
aes = OpenSSL::Cipher::Cipher.new("AES-128-ECB")
|
||||||
|
aes.encrypt
|
||||||
|
aes.key = key
|
||||||
|
txt = aes.update(encrypted_string) << aes.final
|
||||||
|
txt.unpack('H*')[0].upcase
|
||||||
|
end
|
||||||
|
|
||||||
|
# 字符串解密
|
||||||
|
def aes_dicrypt(key, dicrypted_string)
|
||||||
|
aes = OpenSSL::Cipher::Cipher.new("AES-128-ECB")
|
||||||
|
aes.decrypt
|
||||||
|
aes.key = key
|
||||||
|
aes.update([dicrypted_string].pack('H*')) << aes.final
|
||||||
|
end
|
||||||
|
|
||||||
# 获取多种类型的user用户名
|
# 获取多种类型的user用户名
|
||||||
def user_message_username user
|
def user_message_username user
|
||||||
user.try(:show_name)
|
user.try(:show_name)
|
||||||
|
|
|
@ -63,6 +63,11 @@ module PollHelper
|
||||||
def total_answer id
|
def total_answer id
|
||||||
total = PollVote.find_by_sql("SELECT distinct(user_id) FROM `poll_votes` where poll_question_id = #{id}").count
|
total = PollVote.find_by_sql("SELECT distinct(user_id) FROM `poll_votes` where poll_question_id = #{id}").count
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# 获取其它选项的答案
|
||||||
|
def other_answers poll_question
|
||||||
|
poll_question.poll_votes.select{|pv| !pv.try(:vote_text).blank?}
|
||||||
|
end
|
||||||
|
|
||||||
#页面体型显示
|
#页面体型显示
|
||||||
def options_show pq
|
def options_show pq
|
||||||
|
|
|
@ -64,9 +64,9 @@ class Comment < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def send_mail
|
def send_mail
|
||||||
if self.commented.is_a?(News) && Setting.notified_events.include?('news_comment_added')
|
# if self.commented.is_a?(News) && Setting.notified_events.include?('news_comment_added')
|
||||||
Mailer.run.news_comment_added(self)
|
# Mailer.run.news_comment_added(self)
|
||||||
end
|
# end
|
||||||
end
|
end
|
||||||
after_destroy :delete_kindeditor_assets
|
after_destroy :delete_kindeditor_assets
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ class Document < ActiveRecord::Base
|
||||||
after_save :be_user_score # user_score
|
after_save :be_user_score # user_score
|
||||||
after_destroy :down_user_score
|
after_destroy :down_user_score
|
||||||
acts_as_attachable :delete_permission => :delete_documents
|
acts_as_attachable :delete_permission => :delete_documents
|
||||||
after_create :send_mail
|
# after_create :send_mail
|
||||||
# 被ForgeActivity虚拟关联
|
# 被ForgeActivity虚拟关联
|
||||||
has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy
|
has_many :forge_acts, :class_name => 'ForgeActivity',:as =>:forge_act ,:dependent => :destroy
|
||||||
# end
|
# end
|
||||||
|
@ -89,7 +89,7 @@ class Document < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def send_mail
|
def send_mail
|
||||||
Mailer.run.document_added(self) if Setting.notified_events.include?('document_added')
|
# Mailer.run.document_added(self) if Setting.notified_events.include?('document_added')
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -31,7 +31,7 @@ class HomeworkCommon < ActiveRecord::Base
|
||||||
:description => :description,
|
:description => :description,
|
||||||
:author => :author,
|
:author => :author,
|
||||||
:url => Proc.new {|o| {:controller => 'student_work', :action => 'index', :homework => o.id}}
|
:url => Proc.new {|o| {:controller => 'student_work', :action => 'index', :homework => o.id}}
|
||||||
after_create :act_as_activity, :send_mail,:act_as_course_message
|
after_create :act_as_activity, :act_as_course_message
|
||||||
after_update :update_activity
|
after_update :update_activity
|
||||||
after_save :act_as_course_activity
|
after_save :act_as_course_activity
|
||||||
after_destroy :delete_kindeditor_assets
|
after_destroy :delete_kindeditor_assets
|
||||||
|
@ -129,9 +129,9 @@ class HomeworkCommon < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def send_mail
|
def send_mail
|
||||||
if self.homework_detail_manual.comment_status != 0
|
# if self.homework_detail_manual.comment_status != 0
|
||||||
Mailer.run.homework_added(self)
|
# Mailer.run.homework_added(self)
|
||||||
end
|
# end
|
||||||
end
|
end
|
||||||
|
|
||||||
def is_program_homework?
|
def is_program_homework?
|
||||||
|
|
|
@ -19,10 +19,10 @@ class IssueObserver < ActiveRecord::Observer
|
||||||
|
|
||||||
def after_create(issue)
|
def after_create(issue)
|
||||||
# 将跟踪者与本项目的其他成员都设为收件方,并去重,不在进行抄送,
|
# 将跟踪者与本项目的其他成员都设为收件方,并去重,不在进行抄送,
|
||||||
recipients = issue.recipients - issue.watcher_recipients + issue.watcher_recipients
|
# recipients = issue.recipients - issue.watcher_recipients + issue.watcher_recipients
|
||||||
recipients.each do |rec|
|
# recipients.each do |rec|
|
||||||
Mailer.run.issue_add(issue,rec) if Setting.notified_events.include?('issue_added')
|
# Mailer.run.issue_add(issue,rec) if Setting.notified_events.include?('issue_added')
|
||||||
end
|
# end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,36 +2,36 @@ class IssueOverdue < ActiveRecord::Base
|
||||||
#缺陷到期后发送邮件提示
|
#缺陷到期后发送邮件提示
|
||||||
#只监听已经提交的未到期的缺陷,已过期的缺陷默认已经发过邮件通知,不再提醒。
|
#只监听已经提交的未到期的缺陷,已过期的缺陷默认已经发过邮件通知,不再提醒。
|
||||||
def self.mail_issue
|
def self.mail_issue
|
||||||
threads = []
|
# threads = []
|
||||||
issues = Issue.where("done_ratio <> 100 and closed_on is null and due_date is not null")
|
# issues = Issue.where("done_ratio <> 100 and closed_on is null and due_date is not null")
|
||||||
puts issues
|
# puts issues
|
||||||
issues.each do |issue|
|
# issues.each do |issue|
|
||||||
thread = Thread.new do
|
# thread = Thread.new do
|
||||||
while true
|
# while true
|
||||||
cur_issue = Issue.find issue.id
|
# cur_issue = Issue.find issue.id
|
||||||
if cur_issue.done_ratio == 100 || cur_issue.closed_on != nil
|
# if cur_issue.done_ratio == 100 || cur_issue.closed_on != nil
|
||||||
break
|
# break
|
||||||
end
|
# end
|
||||||
if Time.now < Time.parse(cur_issue.due_date.to_s)
|
# if Time.now < Time.parse(cur_issue.due_date.to_s)
|
||||||
#休眠一个小时。。。
|
# #休眠一个小时。。。
|
||||||
puts cur_issue.id.to_s
|
# puts cur_issue.id.to_s
|
||||||
sleep 5
|
# sleep 5
|
||||||
else
|
# else
|
||||||
#发邮件
|
# #发邮件
|
||||||
#puts "11" + issue.id.to_s
|
# #puts "11" + issue.id.to_s
|
||||||
#Mailer.issue_expire(issue).deliver
|
# #Mailer.issue_expire(issue).deliver
|
||||||
recipients = issue.recipients
|
# recipients = issue.recipients
|
||||||
recipients.each do |rec|
|
# recipients.each do |rec|
|
||||||
|
#
|
||||||
Mailer.issue_edit(issue,rec).deliver
|
# Mailer.issue_edit(issue,rec).deliver
|
||||||
end
|
# end
|
||||||
break
|
# break
|
||||||
end
|
# end
|
||||||
end
|
# end
|
||||||
end
|
# end
|
||||||
threads << thread
|
# threads << thread
|
||||||
end
|
# end
|
||||||
puts threads
|
# puts threads
|
||||||
return threads
|
# return threads
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -17,18 +17,18 @@
|
||||||
|
|
||||||
class JournalObserver < ActiveRecord::Observer
|
class JournalObserver < ActiveRecord::Observer
|
||||||
def after_create(journal)
|
def after_create(journal)
|
||||||
if journal.notify? &&
|
# if journal.notify? &&
|
||||||
(Setting.notified_events.include?('issue_updated') ||
|
# (Setting.notified_events.include?('issue_updated') ||
|
||||||
(Setting.notified_events.include?('issue_note_added') && journal.notes.present?) ||
|
# (Setting.notified_events.include?('issue_note_added') && journal.notes.present?) ||
|
||||||
(Setting.notified_events.include?('issue_status_updated') && journal.new_status.present?) ||
|
# (Setting.notified_events.include?('issue_status_updated') && journal.new_status.present?) ||
|
||||||
(Setting.notified_events.include?('issue_priority_updated') && journal.new_value_for('priority_id').present?)
|
# (Setting.notified_events.include?('issue_priority_updated') && journal.new_value_for('priority_id').present?)
|
||||||
)
|
# )
|
||||||
# 将跟踪者与本项目的其他成员都设为收件方,并去重,不在进行抄送,
|
# # 将跟踪者与本项目的其他成员都设为收件方,并去重,不在进行抄送,
|
||||||
recipients = journal.recipients - journal.watcher_recipients + journal.watcher_recipients
|
# recipients = journal.recipients - journal.watcher_recipients + journal.watcher_recipients
|
||||||
recipients.each do |rec|
|
# recipients.each do |rec|
|
||||||
|
#
|
||||||
Mailer.run.issue_edit(journal,rec)
|
# Mailer.run.issue_edit(journal,rec)
|
||||||
end
|
# end
|
||||||
end
|
# end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -50,59 +50,59 @@ class Mailer < ActionMailer::Base
|
||||||
|
|
||||||
# 作业匿评开启
|
# 作业匿评开启
|
||||||
def send_mail_anonymous_comment_open(homework_common)
|
def send_mail_anonymous_comment_open(homework_common)
|
||||||
course = homework_common.course
|
# course = homework_common.course
|
||||||
recipients ||= []
|
# recipients ||= []
|
||||||
course.members.each do |member|
|
# course.members.each do |member|
|
||||||
user = User.find(member.user_id)
|
# user = User.find(member.user_id)
|
||||||
@subject = "#{l(:mail_homework)}#{homework_common.name} #{l(:mail_anonymous_comment_open)}"
|
# @subject = "#{l(:mail_homework)}#{homework_common.name} #{l(:mail_anonymous_comment_open)}"
|
||||||
@token = Token.get_token_from_user(user, 'autologin')
|
# @token = Token.get_token_from_user(user, 'autologin')
|
||||||
@anonymous_comment_close_url = url_for(student_work_index_url(:homework => homework_common.id, :token => @token.value))
|
# @anonymous_comment_close_url = url_for(student_work_index_url(:homework => homework_common.id, :token => @token.value))
|
||||||
@anonymous_comment_close_name = homework_common.name
|
# @anonymous_comment_close_name = homework_common.name
|
||||||
@author = homework_common.user
|
# @author = homework_common.user
|
||||||
#收件人邮箱
|
# #收件人邮箱
|
||||||
recipients << user.mail
|
# recipients << user.mail
|
||||||
end
|
# end
|
||||||
mail :to => recipients,
|
# mail :to => recipients,
|
||||||
:subject => @subject
|
# :subject => @subject
|
||||||
end
|
end
|
||||||
|
|
||||||
# 作业匿评关闭
|
# 作业匿评关闭
|
||||||
def send_mail_anonymous_comment_close(homework_common)
|
def send_mail_anonymous_comment_close(homework_common)
|
||||||
course = homework_common.course
|
# course = homework_common.course
|
||||||
recipients ||= []
|
# recipients ||= []
|
||||||
course.members.each do |member|
|
# course.members.each do |member|
|
||||||
user = User.find(member.user_id)
|
# user = User.find(member.user_id)
|
||||||
@subject = "#{l(:mail_homework)}#{homework_common.name} #{l(:mail_anonymous_comment_close)}"
|
# @subject = "#{l(:mail_homework)}#{homework_common.name} #{l(:mail_anonymous_comment_close)}"
|
||||||
@token = Token.get_token_from_user(user, 'autologin')
|
# @token = Token.get_token_from_user(user, 'autologin')
|
||||||
@anonymous_comment_close_url = url_for(student_work_index_url(:homework => homework_common.id, :token => @token.value))
|
# @anonymous_comment_close_url = url_for(student_work_index_url(:homework => homework_common.id, :token => @token.value))
|
||||||
@anonymous_comment_close_name = homework_common.name
|
# @anonymous_comment_close_name = homework_common.name
|
||||||
@author = homework_common.user
|
# @author = homework_common.user
|
||||||
#收件人邮箱
|
# #收件人邮箱
|
||||||
recipients << user.mail
|
# recipients << user.mail
|
||||||
end
|
# end
|
||||||
mail :to => recipients,
|
# mail :to => recipients,
|
||||||
:subject => @subject
|
# :subject => @subject
|
||||||
end
|
end
|
||||||
|
|
||||||
# 匿评失败给老师发送邮件通知
|
# 匿评失败给老师发送邮件通知
|
||||||
def send_mail_anonymous_comment_fail(homework_common)
|
def send_mail_anonymous_comment_fail(homework_common)
|
||||||
course = homework_common.course
|
# course = homework_common.course
|
||||||
recipients ||= []
|
# recipients ||= []
|
||||||
# 只给该课程的老师发送邮件提醒
|
# # 只给该课程的老师发送邮件提醒
|
||||||
course.members.each do |member|
|
# course.members.each do |member|
|
||||||
if member.user.allowed_to?(:as_teacher,course)
|
# if member.user.allowed_to?(:as_teacher,course)
|
||||||
user = User.find(member.user_id)
|
# user = User.find(member.user_id)
|
||||||
@subject = "[#{l(:mail_homework)} #{homework_common.name}] #{l(:mail_anonymous_comment_failed)}"
|
# @subject = "[#{l(:mail_homework)} #{homework_common.name}] #{l(:mail_anonymous_comment_failed)}"
|
||||||
@token = Token.get_token_from_user(user, 'autologin')
|
# @token = Token.get_token_from_user(user, 'autologin')
|
||||||
@anonymous_comment_fail_url = url_for(student_work_index_url(:homework => homework_common.id, :token => @token.value))
|
# @anonymous_comment_fail_url = url_for(student_work_index_url(:homework => homework_common.id, :token => @token.value))
|
||||||
@anonymous_comment_fail_name = homework_common.name
|
# @anonymous_comment_fail_name = homework_common.name
|
||||||
@author = homework_common.user
|
# @author = homework_common.user
|
||||||
#收件人邮箱
|
# #收件人邮箱
|
||||||
recipients << user.mail
|
# recipients << user.mail
|
||||||
end
|
# end
|
||||||
end
|
# end
|
||||||
mail :to => recipients,
|
# mail :to => recipients,
|
||||||
:subject => @subject
|
# :subject => @subject
|
||||||
end
|
end
|
||||||
|
|
||||||
# author: alan
|
# author: alan
|
||||||
|
@ -146,149 +146,149 @@ class Mailer < ActionMailer::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
# 邀请信息消息 注:forge_message_id 为邀请人ID(特殊情况)
|
# 邀请信息消息 注:forge_message_id 为邀请人ID(特殊情况)
|
||||||
def send_message_request_member(user, project)
|
# def send_message_request_member(user, project)
|
||||||
key = newpass(6).to_s
|
# key = newpass(6).to_s
|
||||||
ForgeMessage.create(:user_id => user.id, :project_id => project.id, :forge_message_type => "ProjectInvite",:forge_message_id => User.current.id, :viewed => false, :secret_key =>key)
|
# ForgeMessage.create(:user_id => user.id, :project_id => project.id, :forge_message_type => "ProjectInvite",:forge_message_id => User.current.id, :viewed => false, :secret_key =>key)
|
||||||
end
|
# end
|
||||||
|
|
||||||
# author: alan
|
# author: alan
|
||||||
# 根据用户选择发送个人日报或周报
|
# 根据用户选择发送个人日报或周报
|
||||||
# 发送内容: 项目【缺陷,讨论区,新闻】,课程【通知,留言,新闻】, 贴吧, 个人留言
|
# 发送内容: 项目【缺陷,讨论区,新闻】,课程【通知,留言,新闻】, 贴吧, 个人留言
|
||||||
def send_for_user_activities(user, date_to, days)
|
def send_for_user_activities(user, date_to, days)
|
||||||
date_from = date_to - days.days
|
# date_from = date_to - days.days
|
||||||
date_from = "#{date_from} 17:59:59"
|
# date_from = "#{date_from} 17:59:59"
|
||||||
date_to = "#{date_to} 17:59:59"
|
# date_to = "#{date_to} 17:59:59"
|
||||||
# 生成token用于直接点击登录
|
# # 生成token用于直接点击登录
|
||||||
@user = user
|
# @user = user
|
||||||
@token = Token.get_token_from_user(user, 'autologin')
|
# @token = Token.get_token_from_user(user, 'autologin')
|
||||||
|
#
|
||||||
# 查询user参加的项目及课程
|
# # 查询user参加的项目及课程
|
||||||
projects = user.projects
|
# projects = user.projects
|
||||||
courses = user.courses
|
# courses = user.courses
|
||||||
project_ids = projects.map{|project| project.id}.join(",")
|
# project_ids = projects.map{|project| project.id}.join(",")
|
||||||
course_ids = courses.map {|course| course.id}.join(",")
|
# course_ids = courses.map {|course| course.id}.join(",")
|
||||||
|
#
|
||||||
# 查询user的缺陷,项目中成员都能收到
|
# # 查询user的缺陷,项目中成员都能收到
|
||||||
sql = "select DISTINCT * from members m, issues i where i.project_id = m.project_id and m.user_id='#{user.id}'
|
# sql = "select DISTINCT * from members m, issues i where i.project_id = m.project_id and m.user_id='#{user.id}'
|
||||||
and (i.updated_on between '#{date_from}' and '#{date_to}') order by i.project_id, i.updated_on desc"
|
# and (i.updated_on between '#{date_from}' and '#{date_to}') order by i.project_id, i.updated_on desc"
|
||||||
@issues = Issue.find_by_sql(sql)
|
# @issues = Issue.find_by_sql(sql)
|
||||||
|
#
|
||||||
# issue回复
|
# # issue回复
|
||||||
@issues_journals = Journal.find_by_sql("select j.* from journals j, members m, projects p, issues i
|
# @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
|
# 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 i.project_id, created_on desc")
|
# and j.journalized_type='Issue' and (j.created_on between '#{date_from}' and '#{date_to}') order by i.project_id, created_on desc")
|
||||||
|
#
|
||||||
# @bids 查询课程作业,包括老师发布的作业,以及user提交作业
|
# # @bids 查询课程作业,包括老师发布的作业,以及user提交作业
|
||||||
# @attachments查询课程课件更新
|
# # @attachments查询课程课件更新
|
||||||
@attachments ||= []
|
# @attachments ||= []
|
||||||
@bids ||= [] # 老师发布的作业
|
# @bids ||= [] # 老师发布的作业
|
||||||
unless courses.first.nil?
|
# unless courses.first.nil?
|
||||||
count = courses.count
|
# count = courses.count
|
||||||
count = count - 1
|
# count = count - 1
|
||||||
for i in 0..count do
|
# for i in 0..count do
|
||||||
bids = courses[i].homework_commons.where("homework_commons.created_at between '#{date_from}' and '#{date_to}'").order("homework_commons.created_at desc")
|
# bids = courses[i].homework_commons.where("homework_commons.created_at between '#{date_from}' and '#{date_to}'").order("homework_commons.created_at desc")
|
||||||
attachments = courses[i].attachments.where("attachments.created_on between '#{date_from}' and '#{date_to}'")
|
# attachments = courses[i].attachments.where("attachments.created_on between '#{date_from}' and '#{date_to}'")
|
||||||
@bids += bids if bids.count > 0
|
# @bids += bids if bids.count > 0
|
||||||
@attachments += attachments if attachments.count > 0
|
# @attachments += attachments if attachments.count > 0
|
||||||
end
|
# end
|
||||||
# @bids = @bids.sort_by { |obj| obj.created_at }
|
# # @bids = @bids.sort_by { |obj| obj.created_at }
|
||||||
end
|
# end
|
||||||
|
#
|
||||||
# 项目附件
|
# # 项目附件
|
||||||
@project_attachments = Attachment.find_by_sql("select DISTINCT a.* from members m, attachments a
|
# @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 m.project_id, a.created_on desc")
|
# 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 m.project_id, a.created_on desc")
|
||||||
|
#
|
||||||
# user 提交的作业
|
# # user 提交的作业
|
||||||
# @homeworks = HomeworkAttach.where("user_id=#{user.id} and (created_at between '#{date_from}' and '#{date_to}')").order("created_at desc")
|
# # @homeworks = HomeworkAttach.where("user_id=#{user.id} and (created_at between '#{date_from}' and '#{date_to}')").order("created_at desc")
|
||||||
|
#
|
||||||
# 查询user所在项目添加wiki
|
# # 查询user所在项目添加wiki
|
||||||
@wiki_contents = WikiContent.find_by_sql("select DISTINCT wc.* from wikis w, members m, projects p, wiki_pages wp, wiki_contents wc where
|
# @wiki_contents = WikiContent.find_by_sql("select DISTINCT wc.* from wikis w, members m, projects p, wiki_pages wp, wiki_contents wc where
|
||||||
m.user_id = '#{user.id}' and m.project_id = p.id and w.project_id = p.id and w.id = wp.wiki_id and wc.page_id = wp.id and w.project_id>0
|
# m.user_id = '#{user.id}' and m.project_id = p.id and w.project_id = p.id and w.id = wp.wiki_id and wc.page_id = wp.id and w.project_id>0
|
||||||
and (wc.updated_on between '#{date_from}' and '#{date_to}') order by m.project_id, updated_on desc")
|
# and (wc.updated_on between '#{date_from}' and '#{date_to}') order by m.project_id, updated_on desc")
|
||||||
|
#
|
||||||
# 查询user在课程中发布的讨论帖子
|
# # 查询user在课程中发布的讨论帖子
|
||||||
course_mesages = Message.find_by_sql("select DISTINCT me.* from messages me, boards b, members m where
|
# course_mesages = Message.find_by_sql("select DISTINCT me.* from messages me, boards b, members m where
|
||||||
b.id = me.board_id and b.course_id = m.course_id
|
# b.id = me.board_id and b.course_id = m.course_id
|
||||||
and b.course_id is not Null and m.user_id = '#{user.id}'
|
# and b.course_id is not Null and m.user_id = '#{user.id}'
|
||||||
and (me.created_on between '#{date_from}' and '#{date_to}') order by m.course_id, created_on desc")
|
# and (me.created_on between '#{date_from}' and '#{date_to}') order by m.course_id, created_on desc")
|
||||||
|
#
|
||||||
# 查询user在项目中发布的讨论帖子
|
# # 查询user在项目中发布的讨论帖子
|
||||||
project_messages = Message.find_by_sql("select DISTINCT me.* from messages me, boards b, members m where
|
# project_messages = Message.find_by_sql("select DISTINCT me.* from messages me, boards b, members m where
|
||||||
b.id = me.board_id and b.project_id = m.project_id
|
# b.id = me.board_id and b.project_id = m.project_id
|
||||||
and b.project_id != '-1' and m.user_id = '#{user.id}' and (me.created_on between '#{date_from}' and '#{date_to}') order by m.project_id, created_on desc")
|
# and b.project_id != '-1' and m.user_id = '#{user.id}' and (me.created_on between '#{date_from}' and '#{date_to}') order by m.project_id, created_on desc")
|
||||||
# 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")
|
# # 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 ||= []
|
# @course_messages ||= []
|
||||||
@project_messages ||= []
|
# @project_messages ||= []
|
||||||
unless course_mesages.first.nil?
|
# unless course_mesages.first.nil?
|
||||||
course_mesages.each do |msg|
|
# course_mesages.each do |msg|
|
||||||
@course_messages << msg
|
# @course_messages << msg
|
||||||
end
|
# end
|
||||||
end
|
# end
|
||||||
unless project_messages.first.nil?
|
# unless project_messages.first.nil?
|
||||||
project_messages.each do |msg|
|
# project_messages.each do |msg|
|
||||||
@project_messages << msg
|
# @project_messages << msg
|
||||||
end
|
# end
|
||||||
end
|
# end
|
||||||
# wiki
|
# # wiki
|
||||||
|
#
|
||||||
# 查询user在课程中发布的通知和回复通知
|
# # 查询user在课程中发布的通知和回复通知
|
||||||
@course_news = (course_ids && !course_ids.empty?) ? News.find_by_sql("select DISTINCT n.* from news n
|
# @course_news = (course_ids && !course_ids.empty?) ? News.find_by_sql("select DISTINCT n.* from news n
|
||||||
where n.course_id in (#{course_ids})
|
# where n.course_id in (#{course_ids})
|
||||||
and (created_on between '#{date_from}' and '#{date_to}') order by n.course_id, created_on desc") : []
|
# and (created_on between '#{date_from}' and '#{date_to}') order by n.course_id, created_on desc") : []
|
||||||
|
#
|
||||||
@course_news_comments = Comment.find_by_sql("select cm.* from comments cm, members m, courses c, news n
|
# @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
|
# 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 m.course_id, created_on desc")
|
# and cm.commented_type ='News' and (cm.created_on between '#{date_from}' and '#{date_to}') order by m.course_id, created_on desc")
|
||||||
|
#
|
||||||
# 查询user在项目中添加新闻和回复新闻
|
# # 查询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})
|
# @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 n.project_id, created_on desc") : []
|
# and (created_on between '#{date_from}' and '#{date_to}') order by n.project_id, created_on desc") : []
|
||||||
|
#
|
||||||
@project_news_comments = Comment.find_by_sql("select c.* from comments c, members m, projects p, news n
|
# @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
|
# 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 m.project_id, created_on desc")
|
# and c.commented_type ='News' and (c.created_on between '#{date_from}' and '#{date_to}') order by m.project_id, created_on desc")
|
||||||
|
#
|
||||||
# 查询user在课程及个人中留言
|
# # 查询user在课程及个人中留言
|
||||||
@course_journal_messages = JournalsForMessage.find_by_sql("select DISTINCT jfm.* from journals_for_messages jfm, members m, courses c
|
# @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
|
# where m.user_id = '#{user.id}' and c.id = m.course_id and jfm.jour_id = c.id
|
||||||
and jfm.jour_type='Course' and (jfm.created_on between '#{date_from}' and '#{date_to}') order by m.course_id, created_on desc")
|
# and jfm.jour_type='Course' and (jfm.created_on between '#{date_from}' and '#{date_to}') order by m.course_id, created_on desc")
|
||||||
|
#
|
||||||
@user_journal_messages = user.journals_for_messages.where("jour_type='Principal' and (created_on between '#{date_from}' and '#{date_to}')").order('created_on DESC')
|
# @user_journal_messages = user.journals_for_messages.where("jour_type='Principal' and (created_on between '#{date_from}' and '#{date_to}')").order('created_on DESC')
|
||||||
|
#
|
||||||
# 查询user在项目中留言(用户反馈)
|
# # 查询user在项目中留言(用户反馈)
|
||||||
@project_journal_messages = JournalsForMessage.find_by_sql("select DISTINCT jfm.* from journals_for_messages jfm, members m, projects p
|
# @project_journal_messages = JournalsForMessage.find_by_sql("select DISTINCT jfm.* from journals_for_messages jfm, members m, projects p
|
||||||
where m.user_id = '#{user.id}' and p.id = m.project_id and jfm.jour_id = p.id
|
# where m.user_id = '#{user.id}' and p.id = m.project_id and jfm.jour_id = p.id
|
||||||
and jfm.jour_type='Project' and (jfm.created_on between '#{date_from}' and '#{date_to}') order by m.project_id, created_on desc")
|
# and jfm.jour_type='Project' and (jfm.created_on between '#{date_from}' and '#{date_to}') order by m.project_id, created_on desc")
|
||||||
|
#
|
||||||
# 查询user新建贴吧或发布帖子
|
# # 查询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 created_at 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}))
|
# @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")
|
# and (m.created_at between '#{date_from}' and '#{date_to}') order by m.created_at desc")
|
||||||
|
#
|
||||||
has_content = [@issues,@issues_journals,@course_messages,@project_messages,@course_news,@course_news_comments,@project_news,@project_news_comments,@project_attachments,
|
# 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?}
|
# @course_journal_messages,@user_journal_messages,@project_journal_messages,@forums,@memos,@attachments,@bids,@wiki_contents].any? {|o| !o.empty?}
|
||||||
total_count = @issues.count + @issues_journals.count + @course_messages.count + @project_messages.count + @course_news.count + @course_news_comments.count + @project_news.count + @project_news_comments.count +
|
# total_count = @issues.count + @issues_journals.count + @course_messages.count + @project_messages.count + @course_news.count + @course_news_comments.count + @project_news.count + @project_news_comments.count +
|
||||||
@project_attachments.count + @course_journal_messages.count + @user_journal_messages.count + @project_journal_messages.count + @forums.count + @memos.count + @attachments.count +
|
# @project_attachments.count + @course_journal_messages.count + @user_journal_messages.count + @project_journal_messages.count + @forums.count + @memos.count + @attachments.count +
|
||||||
@bids.count + @wiki_contents.count
|
# @bids.count + @wiki_contents.count
|
||||||
subject = "[ #{user.show_name}#{l(:label_day_mail_first)}#{total_count}#{l(:label_day_mail_last)}]"
|
# subject = "[ #{user.show_name}#{l(:label_day_mail_first)}#{total_count}#{l(:label_day_mail_last)}]"
|
||||||
@subject = " #{user.show_name}#{l(:label_day_mail_first)}#{total_count}#{l(:label_day_mail_last)}"
|
# @subject = " #{user.show_name}#{l(:label_day_mail_first)}#{total_count}#{l(:label_day_mail_last)}"
|
||||||
mylogger.debug "Sent activity mail : #{user.mail} - #{has_content}"
|
# mylogger.debug "Sent activity mail : #{user.mail} - #{has_content}"
|
||||||
#有内容才发,没有不发
|
# #有内容才发,没有不发
|
||||||
mail :to => user.mail,:subject => @subject if has_content
|
# mail :to => user.mail,:subject => @subject if has_content
|
||||||
end
|
end
|
||||||
|
|
||||||
# 作业截止时间邮件提醒
|
# 作业截止时间邮件提醒
|
||||||
def homework_endtime__added(homework_common, user_id)
|
def homework_endtime__added(homework_common, user_id)
|
||||||
user = User.find(user_id)
|
# user = User.find(user_id)
|
||||||
@subject = "#{l(:mail_homework)}#{homework_common.name} #{l(:mail_homework_endtime)} "
|
# @subject = "#{l(:mail_homework)}#{homework_common.name} #{l(:mail_homework_endtime)} "
|
||||||
@token = Token.get_token_from_user(user, 'autologin')
|
# @token = Token.get_token_from_user(user, 'autologin')
|
||||||
@homework_endtime_url = url_for(student_work_index_url(:homework => homework_common.id, :token => @token.value))
|
# @homework_endtime_url = url_for(student_work_index_url(:homework => homework_common.id, :token => @token.value))
|
||||||
@homework_endtime_name = homework_common.name
|
# @homework_endtime_name = homework_common.name
|
||||||
@author = homework_common.user
|
# @author = homework_common.user
|
||||||
#收件人邮箱
|
# #收件人邮箱
|
||||||
recipient = user.mail
|
# recipient = user.mail
|
||||||
mail :to => recipient,
|
# mail :to => recipient,
|
||||||
:subject => @subject
|
# :subject => @subject
|
||||||
end
|
end
|
||||||
|
|
||||||
# 公共讨论区发帖、回帖添加邮件发送信息
|
# 公共讨论区发帖、回帖添加邮件发送信息
|
||||||
|
@ -382,20 +382,20 @@ class Mailer < ActionMailer::Base
|
||||||
|
|
||||||
# issue截止时间提醒
|
# issue截止时间提醒
|
||||||
def issue_due_date(issue)
|
def issue_due_date(issue)
|
||||||
recipients ||= []
|
# recipients ||= []
|
||||||
if issue.author.id != issue.assigned_to_id
|
# if issue.author.id != issue.assigned_to_id
|
||||||
recipients << issue.author.mail
|
# recipients << issue.author.mail
|
||||||
end
|
# end
|
||||||
|
#
|
||||||
# 被指派人邮箱地址加入数组
|
# # 被指派人邮箱地址加入数组
|
||||||
recipients << issue.assigned_to.mail
|
# recipients << issue.assigned_to.mail
|
||||||
# cc = wiki_content.page.wiki.watcher_recipients - recipients
|
# # cc = wiki_content.page.wiki.watcher_recipients - recipients
|
||||||
@author = issue.author
|
# @author = issue.author
|
||||||
@issue_name = issue.subject
|
# @issue_name = issue.subject
|
||||||
@issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue.id)
|
# @issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue.id)
|
||||||
@subject = "#{l(:mail_issue)}#{issue.subject} #{l(:mail_issue_due_date)} "
|
# @subject = "#{l(:mail_issue)}#{issue.subject} #{l(:mail_issue_due_date)} "
|
||||||
mail :to => recipients,
|
# mail :to => recipients,
|
||||||
:subject => @subject
|
# :subject => @subject
|
||||||
end
|
end
|
||||||
|
|
||||||
# Builds a Mail::Message object used to email recipients of the added issue.
|
# Builds a Mail::Message object used to email recipients of the added issue.
|
||||||
|
@ -404,31 +404,31 @@ class Mailer < ActionMailer::Base
|
||||||
# issue_add(issue) => Mail::Message object
|
# issue_add(issue) => Mail::Message object
|
||||||
# Mailer.issue_add(issue).deliver => sends an email to issue recipients
|
# Mailer.issue_add(issue).deliver => sends an email to issue recipients
|
||||||
def issue_add(issue, recipients)
|
def issue_add(issue, recipients)
|
||||||
issue_id = issue.project_index
|
# issue_id = issue.project_index
|
||||||
redmine_headers 'Project' => issue.project.identifier,
|
# redmine_headers 'Project' => issue.project.identifier,
|
||||||
'Issue-Id' => issue_id,
|
# 'Issue-Id' => issue_id,
|
||||||
'Issue-Author' => issue.author.login
|
# 'Issue-Author' => issue.author.login
|
||||||
redmine_headers 'Issue-Assignee' => issue.assigned_to.login if issue.assigned_to
|
# redmine_headers 'Issue-Assignee' => issue.assigned_to.login if issue.assigned_to
|
||||||
message_id issue
|
# message_id issue
|
||||||
|
#
|
||||||
@author = issue.author
|
# @author = issue.author
|
||||||
@issue = issue
|
# @issue = issue
|
||||||
user = User.find_by_mail(recipients)
|
# user = User.find_by_mail(recipients)
|
||||||
@user = user
|
# @user = user
|
||||||
# @token = Token.get_token_from_user(user, 'autologin')
|
# # @token = Token.get_token_from_user(user, 'autologin')
|
||||||
@issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue.id)
|
# @issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue.id)
|
||||||
|
#
|
||||||
# edit
|
# # edit
|
||||||
@issue_author_url = url_for(user_activities_url(@author))
|
# @issue_author_url = url_for(user_activities_url(@author))
|
||||||
@project_url = url_for(:controller => 'projects', :action => 'show', :id => issue.project_id)
|
# @project_url = url_for(:controller => 'projects', :action => 'show', :id => issue.project_id)
|
||||||
|
#
|
||||||
@user_url = url_for(my_account_url(user))
|
# @user_url = url_for(my_account_url(user))
|
||||||
|
#
|
||||||
|
#
|
||||||
subject = "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] (#{issue.status.name}) #{issue.subject}"
|
# subject = "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] (#{issue.status.name}) #{issue.subject}"
|
||||||
mail :to => recipients,
|
# mail :to => recipients,
|
||||||
:subject => subject,
|
# :subject => subject,
|
||||||
:filter => true
|
# :filter => true
|
||||||
end
|
end
|
||||||
# issue.attachments.each do |attach|
|
# issue.attachments.each do |attach|
|
||||||
# attachments["#{attach.filename}"] = File.read("#{attach.disk_filename}")
|
# attachments["#{attach.filename}"] = File.read("#{attach.disk_filename}")
|
||||||
|
@ -445,36 +445,36 @@ class Mailer < ActionMailer::Base
|
||||||
# issue_edit(journal) => Mail::Message object
|
# issue_edit(journal) => Mail::Message object
|
||||||
# Mailer.issue_edit(journal).deliver => sends an email to issue recipients
|
# Mailer.issue_edit(journal).deliver => sends an email to issue recipients
|
||||||
def issue_edit(journal,recipients)
|
def issue_edit(journal,recipients)
|
||||||
issue = journal.journalized.reload
|
# issue = journal.journalized.reload
|
||||||
issue_id = issue.project_index
|
# issue_id = issue.project_index
|
||||||
redmine_headers 'Project' => issue.project.identifier,
|
# redmine_headers 'Project' => issue.project.identifier,
|
||||||
'Issue-Id' => issue_id.to_s,
|
# 'Issue-Id' => issue_id.to_s,
|
||||||
'Issue-Author' => issue.author.login
|
# 'Issue-Author' => issue.author.login
|
||||||
redmine_headers 'Issue-Assignee' => issue.assigned_to.login if issue.assigned_to
|
# redmine_headers 'Issue-Assignee' => issue.assigned_to.login if issue.assigned_to
|
||||||
message_id journal
|
# message_id journal
|
||||||
references issue
|
# references issue
|
||||||
@author = journal.user
|
# @author = journal.user
|
||||||
|
#
|
||||||
user = User.find_by_mail(recipients)
|
# user = User.find_by_mail(recipients)
|
||||||
@user = user
|
# @user = user
|
||||||
# @token = Token.get_token_from_user(user, 'autologin')
|
# # @token = Token.get_token_from_user(user, 'autologin')
|
||||||
|
#
|
||||||
|
#
|
||||||
# edit
|
# # edit
|
||||||
@issue_author_url = url_for(:controller => 'users', :action => 'show', :id => issue.author_id)
|
# @issue_author_url = url_for(:controller => 'users', :action => 'show', :id => issue.author_id)
|
||||||
@project_url = url_for(:controller => 'projects', :action => 'show', :id => issue.project_id)
|
# @project_url = url_for(:controller => 'projects', :action => 'show', :id => issue.project_id)
|
||||||
@user_url = url_for(my_account_url(user))
|
# @user_url = url_for(my_account_url(user))
|
||||||
|
#
|
||||||
@issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue.id, :anchor => "change-#{journal.id}")
|
# @issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue.id, :anchor => "change-#{journal.id}")
|
||||||
s = "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] "
|
# s = "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] "
|
||||||
s << "(#{issue.status.name}) " if journal.new_value_for('status_id')
|
# s << "(#{issue.status.name}) " if journal.new_value_for('status_id')
|
||||||
s << issue.subject
|
# s << issue.subject
|
||||||
@issue = issue
|
# @issue = issue
|
||||||
@journal = journal
|
# @journal = journal
|
||||||
# @issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue, :anchor => "change-#{journal.id}")
|
# # @issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue, :anchor => "change-#{journal.id}")
|
||||||
mail :to => recipients,
|
# mail :to => recipients,
|
||||||
:subject => s,
|
# :subject => s,
|
||||||
:filter => true
|
# :filter => true
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.deliver_mailer(to,cc, subject)
|
def self.deliver_mailer(to,cc, subject)
|
||||||
|
@ -510,19 +510,19 @@ class Mailer < ActionMailer::Base
|
||||||
|
|
||||||
#缺陷到期邮件通知
|
#缺陷到期邮件通知
|
||||||
def issue_expire issue
|
def issue_expire issue
|
||||||
issue_id = issue.project_index
|
# issue_id = issue.project_index
|
||||||
redmine_headers 'Project' => issue.project.identifier,
|
# redmine_headers 'Project' => issue.project.identifier,
|
||||||
'Issue-Id' => issue_id,
|
# 'Issue-Id' => issue_id,
|
||||||
'Issue-Author' => issue.author.login
|
# 'Issue-Author' => issue.author.login
|
||||||
redmine_headers 'Issue-Assignee' => issue.assigned_to.login if issue.assigned_to
|
# redmine_headers 'Issue-Assignee' => issue.assigned_to.login if issue.assigned_to
|
||||||
message_id issue
|
# message_id issue
|
||||||
@author = issue.author
|
# @author = issue.author
|
||||||
@issue = issue
|
# @issue = issue
|
||||||
@issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue.id)
|
# @issue_url = url_for(:controller => 'issues', :action => 'show', :id => issue.id)
|
||||||
recipients = issue.recipients
|
# recipients = issue.recipients
|
||||||
s = l(:text_issue_expire,:issue => "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] (#{issue.status.name}) #{issue.subject}")
|
# s = l(:text_issue_expire,:issue => "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] (#{issue.status.name}) #{issue.subject}")
|
||||||
mail :to => recipients,
|
# mail :to => recipients,
|
||||||
:subject => s
|
# :subject => s
|
||||||
#########################################################################################################
|
#########################################################################################################
|
||||||
#@issues = issues
|
#@issues = issues
|
||||||
#s = l(:text_issue_expire,:issue => "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] (#{issue.status.name}) #{issue.subject}")
|
#s = l(:text_issue_expire,:issue => "[#{issue.project.name} - #{issue.tracker.name} ##{issue_id}] (#{issue.status.name}) #{issue.subject}")
|
||||||
|
@ -627,19 +627,19 @@ class Mailer < ActionMailer::Base
|
||||||
# attachments_added(attachments) => Mail::Message object
|
# attachments_added(attachments) => Mail::Message object
|
||||||
# Mailer.attachments_added(attachments).deliver => sends an email to the project's recipients
|
# Mailer.attachments_added(attachments).deliver => sends an email to the project's recipients
|
||||||
def homework_added(homework_common)
|
def homework_added(homework_common)
|
||||||
logger.info "homework added"
|
# logger.info "homework added"
|
||||||
@homework_common = homework_common
|
# @homework_common = homework_common
|
||||||
@author = homework_common.user
|
# @author = homework_common.user
|
||||||
@homework_common_url = url_for(:controller => "homework_common", :action =>"index", :homework => @homework_common.id)
|
# @homework_common_url = url_for(:controller => "homework_common", :action =>"index", :homework => @homework_common.id)
|
||||||
@homework_author_url = url_for(user_activities_url(@author))
|
# @homework_author_url = url_for(user_activities_url(@author))
|
||||||
recipients ||= []
|
# recipients ||= []
|
||||||
#将帖子创建者邮箱地址加入数组
|
# #将帖子创建者邮箱地址加入数组
|
||||||
@homework_common.course.members.each do |member|
|
# @homework_common.course.members.each do |member|
|
||||||
recipients << member.user.mail
|
# recipients << member.user.mail
|
||||||
end
|
# end
|
||||||
mail :to => recipients,
|
# mail :to => recipients,
|
||||||
:subject => "[ #{l(:label_user_homework)} : #{homework_common.name} #{l(:label_memo_create_succ)}]",
|
# :subject => "[ #{l(:label_user_homework)} : #{homework_common.name} #{l(:label_memo_create_succ)}]",
|
||||||
:filter => true
|
# :filter => true
|
||||||
end
|
end
|
||||||
|
|
||||||
# Builds a Mail::Message object used to email recipients of a news' project when a news item is added.
|
# Builds a Mail::Message object used to email recipients of a news' project when a news item is added.
|
||||||
|
@ -649,28 +649,28 @@ class Mailer < ActionMailer::Base
|
||||||
# Mailer.news_added(news).deliver => sends an email to the news' project recipients
|
# Mailer.news_added(news).deliver => sends an email to the news' project recipients
|
||||||
def news_added(news)
|
def news_added(news)
|
||||||
|
|
||||||
if news.project
|
# if news.project
|
||||||
# redmine_headers 'Project' => news.project.identifier
|
# # redmine_headers 'Project' => news.project.identifier
|
||||||
# @author = news.author
|
# # @author = news.author
|
||||||
# @issue_author_url = url_for(user_activities_url(@author))
|
# # @issue_author_url = url_for(user_activities_url(@author))
|
||||||
# message_id news
|
# # message_id news
|
||||||
# @news = news
|
# # @news = news
|
||||||
# @news_url = url_for(:controller => 'news', :action => 'show', :id => news)
|
# # @news_url = url_for(:controller => 'news', :action => 'show', :id => news)
|
||||||
# mail :to => news.recipients,
|
# # mail :to => news.recipients,
|
||||||
# :subject => "[#{news.project.name}] #{l(:label_news)}: #{news.title}",
|
# # :subject => "[#{news.project.name}] #{l(:label_news)}: #{news.title}",
|
||||||
# :filter => true
|
# # :filter => true
|
||||||
elsif news.course
|
# elsif news.course
|
||||||
redmine_headers 'Course' => news.course.id
|
# redmine_headers 'Course' => news.course.id
|
||||||
@author = news.author
|
# @author = news.author
|
||||||
@issue_author_url = url_for(user_activities_url(@author))
|
# @issue_author_url = url_for(user_activities_url(@author))
|
||||||
message_id news
|
# message_id news
|
||||||
@news = news
|
# @news = news
|
||||||
recipients = news.course.notified_users.select { |user| user.allowed_to?(:view_files, news.course) }.collect { |u| u.mail }
|
# recipients = news.course.notified_users.select { |user| user.allowed_to?(:view_files, news.course) }.collect { |u| u.mail }
|
||||||
@news_url = url_for(:controller => 'news', :action => 'show', :id => news)
|
# @news_url = url_for(:controller => 'news', :action => 'show', :id => news)
|
||||||
mail :to => recipients,
|
# mail :to => recipients,
|
||||||
:subject => "[#{news.course.name}] #{l(:label_news)}: #{news.title}",
|
# :subject => "[#{news.course.name}] #{l(:label_news)}: #{news.title}",
|
||||||
:filter => true
|
# :filter => true
|
||||||
end
|
# end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Builds a Mail::Message object used to email recipients of a news' project when a news comment is added.
|
# Builds a Mail::Message object used to email recipients of a news' project when a news comment is added.
|
||||||
|
@ -679,33 +679,33 @@ class Mailer < ActionMailer::Base
|
||||||
# news_comment_added(comment) => Mail::Message object
|
# news_comment_added(comment) => Mail::Message object
|
||||||
# Mailer.news_comment_added(comment) => sends an email to the news' project recipients
|
# Mailer.news_comment_added(comment) => sends an email to the news' project recipients
|
||||||
def news_comment_added(comment)
|
def news_comment_added(comment)
|
||||||
news = comment.commented
|
# news = comment.commented
|
||||||
if news.project
|
# if news.project
|
||||||
# redmine_headers 'Project' => news.project.identifier
|
# # redmine_headers 'Project' => news.project.identifier
|
||||||
# @author = comment.author
|
# # @author = comment.author
|
||||||
# @issue_author_url = url_for(user_activities_url(@author))
|
# # @issue_author_url = url_for(user_activities_url(@author))
|
||||||
# message_id comment
|
# # message_id comment
|
||||||
# @news = news
|
# # @news = news
|
||||||
# @comment = comment
|
# # @comment = comment
|
||||||
# @news_url = url_for(:controller => 'news', :action => 'show', :id => news)
|
# # @news_url = url_for(:controller => 'news', :action => 'show', :id => news)
|
||||||
# mail :to => news.recipients,
|
# # mail :to => news.recipients,
|
||||||
# :cc => news.watcher_recipients,
|
# # :cc => news.watcher_recipients,
|
||||||
# :subject => "Re: [#{news.project.name}] #{l(:label_news)}: #{news.title}",
|
# # :subject => "Re: [#{news.project.name}] #{l(:label_news)}: #{news.title}",
|
||||||
# :filter => true
|
# # :filter => true
|
||||||
elsif news.course
|
# elsif news.course
|
||||||
redmine_headers 'Course' => news.course.id
|
# redmine_headers 'Course' => news.course.id
|
||||||
@author = comment.author
|
# @author = comment.author
|
||||||
@issue_author_url = url_for(user_activities_url(@author))
|
# @issue_author_url = url_for(user_activities_url(@author))
|
||||||
message_id comment
|
# message_id comment
|
||||||
@news = news
|
# @news = news
|
||||||
@comment = comment
|
# @comment = comment
|
||||||
@news_url = url_for(:controller => 'news', :action => 'show', :id => news)
|
# @news_url = url_for(:controller => 'news', :action => 'show', :id => news)
|
||||||
recipients = news.course.notified_users.select { |user| user.allowed_to?(:view_files, news.course) }.collect { |u| u.mail }
|
# recipients = news.course.notified_users.select { |user| user.allowed_to?(:view_files, news.course) }.collect { |u| u.mail }
|
||||||
|
#
|
||||||
mail :to => recipients,
|
# mail :to => recipients,
|
||||||
:subject => "[#{news.course.name}] #{l(:label_news)}: #{news.title}",
|
# :subject => "[#{news.course.name}] #{l(:label_news)}: #{news.title}",
|
||||||
:filter => true
|
# :filter => true
|
||||||
end
|
# end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Builds a Mail::Message object used to email the recipients of the specified message that was posted.
|
# Builds a Mail::Message object used to email the recipients of the specified message that was posted.
|
||||||
|
@ -1032,21 +1032,21 @@ class Mailer < ActionMailer::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def join_course_request(course, user, role)
|
def join_course_request(course, user, role)
|
||||||
@receive = User.find(course.tea_id)
|
# @receive = User.find(course.tea_id)
|
||||||
@course = course
|
# @course = course
|
||||||
@user = user
|
# @user = user
|
||||||
@role = role
|
# @role = role
|
||||||
@subject = "#{@user.show_name} #{l(:label_apply_join_course)} #{@course.name} "
|
# @subject = "#{@user.show_name} #{l(:label_apply_join_course)} #{@course.name} "
|
||||||
mail :to => @receive.mail,
|
# mail :to => @receive.mail,
|
||||||
:subject => @subject
|
# :subject => @subject
|
||||||
end
|
end
|
||||||
|
|
||||||
def apply_for_homework_request(homework, user)
|
def apply_for_homework_request(homework, user)
|
||||||
@receive = User.find(homework.user_id)
|
# @receive = User.find(homework.user_id)
|
||||||
@user = user
|
# @user = user
|
||||||
@subject = "#{@user.show_name} #{l(:label_apply_for_homework)} #{homework.name} "
|
# @subject = "#{@user.show_name} #{l(:label_apply_for_homework)} #{homework.name} "
|
||||||
mail :to => @receive.mail,
|
# mail :to => @receive.mail,
|
||||||
:subject => @subject
|
# :subject => @subject
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
@ -124,7 +124,7 @@ class Memo < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def send_mail
|
def send_mail
|
||||||
Mailer.run.forum_message_added(self) if Setting.notified_events.include?('forum_message_added')
|
# Mailer.run.forum_message_added(self) if Setting.notified_events.include?('forum_message_added')
|
||||||
end
|
end
|
||||||
|
|
||||||
def creator_user
|
def creator_user
|
||||||
|
@ -218,9 +218,9 @@ class Memo < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def send_notification
|
def send_notification
|
||||||
if Setting.notified_events.include?('message_posted')
|
# if Setting.notified_events.include?('message_posted')
|
||||||
Mailer.run.message_posted(self)
|
# Mailer.run.message_posted(self)
|
||||||
end
|
# end
|
||||||
end
|
end
|
||||||
|
|
||||||
def plusParentAndForum
|
def plusParentAndForum
|
||||||
|
|
|
@ -389,7 +389,7 @@ class Message < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def send_mail
|
def send_mail
|
||||||
Mailer.run.message_posted(self) if Setting.notified_events.include?('message_posted')
|
# Mailer.run.message_posted(self) if Setting.notified_events.include?('message_posted')
|
||||||
end
|
end
|
||||||
|
|
||||||
# Time 2015-03-31 09:15:06
|
# Time 2015-03-31 09:15:06
|
||||||
|
|
|
@ -65,7 +65,7 @@ class News < ActiveRecord::Base
|
||||||
:author_key => :author_id
|
:author_key => :author_id
|
||||||
acts_as_watchable
|
acts_as_watchable
|
||||||
|
|
||||||
after_create :act_as_course_activity, :add_author_as_watcher, :send_mail, :add_news_count, :act_as_student_score,:delay_news_wechat_send, :delay_news_send
|
after_create :act_as_course_activity, :add_author_as_watcher, :add_news_count, :act_as_student_score,:delay_news_wechat_send, :delay_news_send
|
||||||
after_update :update_activity
|
after_update :update_activity
|
||||||
after_destroy :delete_kindeditor_assets, :decrease_news_count, :delete_org_activities, :down_course_score
|
after_destroy :delete_kindeditor_assets, :decrease_news_count, :delete_org_activities, :down_course_score
|
||||||
|
|
||||||
|
@ -241,7 +241,7 @@ class News < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def send_mail
|
def send_mail
|
||||||
Mailer.run.news_added(self) if Setting.notified_events.include?('news_added')
|
# Mailer.run.news_added(self) if Setting.notified_events.include?('news_added')
|
||||||
end
|
end
|
||||||
|
|
||||||
def delete_org_activities
|
def delete_org_activities
|
||||||
|
|
|
@ -158,9 +158,9 @@ class RelativeMemo < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def send_notification
|
def send_notification
|
||||||
if Setting.notified_events.include?('message_posted')
|
# if Setting.notified_events.include?('message_posted')
|
||||||
Mailer.run.message_posted(self)
|
# Mailer.run.message_posted(self)
|
||||||
end
|
# end
|
||||||
end
|
end
|
||||||
|
|
||||||
# def plusParentAndForum
|
# def plusParentAndForum
|
||||||
|
|
|
@ -17,12 +17,12 @@
|
||||||
|
|
||||||
class WikiContentObserver < ActiveRecord::Observer
|
class WikiContentObserver < ActiveRecord::Observer
|
||||||
def after_create(wiki_content)
|
def after_create(wiki_content)
|
||||||
Mailer.run.wiki_content_added(wiki_content) if Setting.notified_events.include?('wiki_content_added')
|
# Mailer.run.wiki_content_added(wiki_content) if Setting.notified_events.include?('wiki_content_added')
|
||||||
end
|
end
|
||||||
|
|
||||||
def after_update(wiki_content)
|
def after_update(wiki_content)
|
||||||
if wiki_content.text_changed?
|
# if wiki_content.text_changed?
|
||||||
Mailer.run.wiki_content_updated(wiki_content) if Setting.notified_events.include?('wiki_content_updated')
|
# Mailer.run.wiki_content_updated(wiki_content) if Setting.notified_events.include?('wiki_content_updated')
|
||||||
end
|
# end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -658,7 +658,7 @@ class CoursesService
|
||||||
@state = 7
|
@state = 7
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
Mailer.run.join_course_request(course, current_user, params[:role])
|
# Mailer.run.join_course_request(course, current_user, params[:role])
|
||||||
CourseMessage.create(:user_id => course.tea_id, :course_id => course.id, :viewed => false,:content=> role_str,:course_message_id=>current_user.id,:course_message_type=>'JoinCourseRequest',:status=>0)
|
CourseMessage.create(:user_id => course.tea_id, :course_id => course.id, :viewed => false,:content=> role_str,:course_message_id=>current_user.id,:course_message_type=>'JoinCourseRequest',:status=>0)
|
||||||
|
|
||||||
#----------------微信通知----------------------
|
#----------------微信通知----------------------
|
||||||
|
|
|
@ -232,25 +232,27 @@ class UsersService
|
||||||
|
|
||||||
#修改密码
|
#修改密码
|
||||||
def change_password params
|
def change_password params
|
||||||
@current_user = User.find(params[:current_user_id])
|
ActiveRecord::Base.transaction do
|
||||||
if @current_user.check_password?(params[:password])
|
@current_user = User.find(params[:current_user_id])
|
||||||
@current_user.password, @current_user.password_confirmation = params[:new_password], params[:new_password_confirmation]
|
if @current_user.check_password?(params[:password])
|
||||||
@current_user.save
|
@current_user.password, @current_user.password_confirmation = params[:new_password], params[:new_password_confirmation]
|
||||||
# 修改密码同步gitlab密码修改
|
@current_user.save
|
||||||
unless @current_user.gid.nil?
|
# 修改密码同步gitlab密码修改
|
||||||
begin
|
unless @current_user.gid.nil?
|
||||||
g = Gitlab.client
|
begin
|
||||||
g.edit_user(@current_user.gid, :password => params[:new_password])
|
g = Gitlab.client
|
||||||
rescue Exception => e
|
g.edit_user(@current_user.gid, :password => params[:new_password])
|
||||||
logger.error "change users password failed! ===> #{e}"
|
rescue Exception => e
|
||||||
|
logger.error "change users password failed! ===> #{e}"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
#raise @current_user.errors.full_message
|
#raise @current_user.errors.full_message
|
||||||
#return @current_user
|
#return @current_user
|
||||||
else
|
else
|
||||||
raise l(:notice_account_wrong_password,:locale => 'zh')
|
raise l(:notice_account_wrong_password,:locale => 'zh')
|
||||||
|
end
|
||||||
|
@current_user
|
||||||
end
|
end
|
||||||
@current_user
|
|
||||||
end
|
end
|
||||||
|
|
||||||
#搜索用户
|
#搜索用户
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
<%= render :partial => "praise_tread/praise", :locals => {:activity => comment, :user_activity_id => comment.id, :type => "reply"} %>
|
<%= render :partial => "praise_tread/praise", :locals => {:activity => comment, :user_activity_id => comment.id, :type => "reply"} %>
|
||||||
</span>
|
</span>
|
||||||
<span style="position: relative" class="fr mr20">
|
<span style="position: relative" class="fr mr20">
|
||||||
<%= link_to(
|
<%= link_to(
|
||||||
l(:button_reply),
|
l(:button_reply),
|
||||||
{:controller => 'issues', :action => 'reply', :user_id => comment.user_id, :id => issue.id, :journal_id => comment.id},
|
{:controller => 'issues', :action => 'reply', :user_id => comment.user_id, :id => issue.id, :journal_id => comment.id},
|
||||||
:remote => true,
|
:remote => true,
|
||||||
|
@ -36,10 +36,11 @@
|
||||||
:title => l(:button_reply)) %>
|
:title => l(:button_reply)) %>
|
||||||
<span id="reply_iconup_<%= comment.id %>" class="reply_iconup02" style="display: none"> ︿</span>
|
<span id="reply_iconup_<%= comment.id %>" class="reply_iconup02" style="display: none"> ︿</span>
|
||||||
</span>
|
</span>
|
||||||
<%= link_to(
|
<%= link_to(
|
||||||
l(:button_delete),
|
l(:button_delete),
|
||||||
{:controller => 'issues',:action => 'delete_journal', :id => issue.id,:journal_id=>comment.id},
|
{:controller => 'issues',:action => 'delete_journal', :id => issue.id, :journal_id=>comment.id},
|
||||||
:method => :get,
|
:method => :get,
|
||||||
|
:remote => true,
|
||||||
:id => "delete_reply_#{comment.id}",
|
:id => "delete_reply_#{comment.id}",
|
||||||
:class => 'fr mr20 undis',
|
:class => 'fr mr20 undis',
|
||||||
:data => {:confirm => l(:text_are_you_sure)},
|
:data => {:confirm => l(:text_are_you_sure)},
|
||||||
|
@ -64,7 +65,7 @@
|
||||||
<div class="homepagePostReplyInputContainer mb10">
|
<div class="homepagePostReplyInputContainer mb10">
|
||||||
<% if User.current.logged? %>
|
<% if User.current.logged? %>
|
||||||
<div nhname='new_message_<%= @issue.id %>' style="display:none;">
|
<div nhname='new_message_<%= @issue.id %>' style="display:none;">
|
||||||
<%= form_for('new_form', :url => add_journal_issue_path(@issue.id), :method => "post", :remote => true) do |f| %>
|
<%= form_for('new_form', :url => add_journal_issue_path(@issue.id, :is_issue_show => true), :method => "post", :remote => true) do |f| %>
|
||||||
<input type="hidden" name="issue_id" value="<%=@issue.id%>"/>
|
<input type="hidden" name="issue_id" value="<%=@issue.id%>"/>
|
||||||
<div nhname='toolbar_container_<%= @issue.id %>' ></div>
|
<div nhname='toolbar_container_<%= @issue.id %>' ></div>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<div class="ReplyToMessageInputContainer">
|
<div class="ReplyToMessageInputContainer">
|
||||||
<% if User.current.logged? %>
|
<% if User.current.logged? %>
|
||||||
<div nhname='new_message_<%= @jour.id%>' style="display:none;">
|
<div nhname='new_message_<%= @jour.id%>' style="display:none;">
|
||||||
<%= form_for('new_form',:url => add_reply_issue_path(@issue.id),:method => "post", :remote => true) do |f|%>
|
<%= form_for('new_form',:url => add_reply_issue_path(@issue.id, :is_issue_show => true),:method => "post", :remote => true) do |f|%>
|
||||||
<input type="hidden" name="journal_id" value="<%=@jour.id%>"/>
|
<input type="hidden" name="journal_id" value="<%=@jour.id%>"/>
|
||||||
<div nhname='toolbar_container_<%= @jour.id%>' ></div>
|
<div nhname='toolbar_container_<%= @jour.id%>' ></div>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
|
|
|
@ -1,10 +1,4 @@
|
||||||
/* $("#reply_div_<%#= @issue.id %>").html("<%#= escape_javascript(render :partial => 'issues/issue_replies', :locals => {:issue => @issue}) %>");
|
$("#div_issue_attachment_<%=@issue.id %>").html("<%= escape_javascript(render :partial => 'issues/issue_attachments', :locals => {:issue => @issue}) %>");
|
||||||
$("#issue_detail_show").html('<%#= escape_javascript(render :partial => 'issues/detail') %>');
|
|
||||||
$("#issue_edit_show").html('<%#= escape_javascript(render :partial => 'issues/edit') %>');
|
|
||||||
$("#div_issue_attachment_<%#=@issue.id %>").html("<%#= escape_javascript(render :partial => 'issues/issue_attachments', :locals => {:issue => @issue}) %>");
|
|
||||||
sd_create_editor_from_data(<%#= @issue.id %>, null, "100%", "<%#= @issue.class.name %>");*/
|
|
||||||
|
|
||||||
location.reload();
|
|
||||||
issue_desc_editor = KindEditor.create('#issue_description',
|
issue_desc_editor = KindEditor.create('#issue_description',
|
||||||
{"width":"85%",
|
{"width":"85%",
|
||||||
"resizeType":0,
|
"resizeType":0,
|
||||||
|
@ -18,6 +12,5 @@ issue_desc_editor = KindEditor.create('#issue_description',
|
||||||
"allowFileManager":true,
|
"allowFileManager":true,
|
||||||
"uploadJson":"/kindeditor/upload",
|
"uploadJson":"/kindeditor/upload",
|
||||||
"fileManagerJson":"/kindeditor/filemanager"});
|
"fileManagerJson":"/kindeditor/filemanager"});
|
||||||
// $("#issue_test_<%#= @issue.id %>").html("<%#= escape_javascript(render :partial => 'issues/edit', :locals => {:issue => Issue.find( @issue_id)}) %>");
|
$(".homepagePostReplyBannerCount").html('<%= escape_javascript(render :partial => 'issues/issue_reply_banner') %>');
|
||||||
// $(".homepagePostReplyBannerCount").html('<%#= escape_javascript(render :partial => 'issues/issue_reply_banner') %>');
|
sd_create_editor_from_data(<%= @issue.id%>, null, "100%","<%= @issue.class.name %>");
|
||||||
// sd_create_editor_from_data(<%#= @issue.id%>, null, "100%","<%#= @issue.class.name %>");
|
|
|
@ -1,6 +1,3 @@
|
||||||
<% if @issue_id %> //issue详情中回复
|
|
||||||
<%= render "jounal_refresh" %>
|
|
||||||
<%else%>
|
|
||||||
<% if params[:is_project] %>
|
<% if params[:is_project] %>
|
||||||
$("#div_user_issue_reply_<%=@user_activity_id %>").html("<%= escape_javascript(render :partial => 'projects/project_issue_reply', :locals => {:activity => @issue, :user_activity_id => @user_activity_id}) %>");
|
$("#div_user_issue_reply_<%=@user_activity_id %>").html("<%= escape_javascript(render :partial => 'projects/project_issue_reply', :locals => {:activity => @issue, :user_activity_id => @user_activity_id}) %>");
|
||||||
<% else %>
|
<% else %>
|
||||||
|
@ -8,6 +5,6 @@ $("#div_user_issue_reply_<%=@user_activity_id %>").html("<%= escape_javascript(r
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
sd_create_editor_from_data(<%= @user_activity_id %>, null, "100%", "UserActivity");
|
sd_create_editor_from_data(<%= @user_activity_id %>, null, "100%", "UserActivity");
|
||||||
//init_activity_KindEditor_data(<%= @user_activity_id %>,"","87%", 'UserActivity');
|
//init_activity_KindEditor_data(<%#= @user_activity_id %>,"","87%", 'UserActivity');
|
||||||
// sd_create_editor_from_data(<%#= @issue.id%>, null, "100%");
|
// sd_create_editor_from_data(<%#= @issue.id%>, null, "100%");
|
||||||
<%end %>
|
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
$("#div_user_issue_reply_<%=@user_activity_id %>").html("<%= escape_javascript(render :partial => 'projects/project_issue_reply', :locals => {:activity => @issue, :user_activity_id => @user_activity_id}) %>");
|
||||||
|
|
||||||
|
$("#reply_div_<%= @issue.id %>").html("<%= escape_javascript(render :partial => 'issues/issue_replies', :locals => {:issue => @issue}) %>");
|
||||||
|
$("#div_issue_attachment_<%=@issue.id %>").html("<%= escape_javascript(render :partial => 'issues/issue_attachments', :locals => {:issue => @issue}) %>");
|
||||||
|
issue_desc_editor = KindEditor.create('#issue_description',
|
||||||
|
{"width":"85%",
|
||||||
|
"resizeType":0,
|
||||||
|
"no_label":true,
|
||||||
|
"at_id":<%= @issue.project_id%>,
|
||||||
|
"at_type":"Project",
|
||||||
|
"autoHeightMode":true,
|
||||||
|
"afterCreate":"eval(function(){ if(typeof enablePasteImg ==='function'){enablePasteImg(self);};if(typeof enableAt ==='function'){enableAt(self, \"<%=@issue.project_id %>\", 'Project');}; this.loadPlugin('autoheight')})",
|
||||||
|
"emotionsBasePath":'<%= Setting.host_name%>',
|
||||||
|
"height":300,
|
||||||
|
"allowFileManager":true,
|
||||||
|
"uploadJson":"/kindeditor/upload",
|
||||||
|
"fileManagerJson":"/kindeditor/filemanager"});
|
||||||
|
$(".homepagePostReplyBannerCount").html('<%= escape_javascript(render :partial => 'issues/issue_reply_banner') %>');
|
||||||
|
sd_create_editor_from_data(<%= @issue.id%>, null, "100%","<%= @issue.class.name %>");
|
|
@ -1,28 +1,63 @@
|
||||||
<div class="ur_table_result">
|
<div class="ur_table_result">
|
||||||
<table border="0" cellspacing="0" cellpadding="0" >
|
<table border="0" cellspacing="0" cellpadding="0" >
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr class="table_bluebg">
|
<tr class="table_bluebg">
|
||||||
<td class="td327"><%= l(:label_poll_options) %> </td>
|
<td class="td327"><%= l(:label_poll_options) %> </td>
|
||||||
<td class="td42"><%= l(:label_poll_subtotal) %> </td>
|
<td class="td42"><%= l(:label_poll_subtotal) %> </td>
|
||||||
<td class="td287"><%= l(:label_poll_proportion) %> </td>
|
<td class="td287"><%= l(:label_poll_proportion) %> </td>
|
||||||
</tr>
|
</tr>
|
||||||
<% poll_question.poll_answers.each do |poll_answer| %>
|
<% poll_question.poll_answers.each do |poll_answer| %>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="td327"><%= poll_answer.answer_text == "" ? "其他" :poll_answer.answer_text %> </td>
|
<td class="td327">
|
||||||
<td class="td42"><%= poll_answer.poll_votes.count %> </td>
|
<% if poll_answer.answer_text == "" %>
|
||||||
<td class="td287">
|
其它<a onclick="hidden_others(<%= poll_question.id %>, <%= poll_answer.id %>);" class="c_blue fr mr5" id ="other_answer_<%= poll_answer.id %>"><%= "隐藏" if other_answers(poll_question).count > 0 %></a>
|
||||||
<div class="Bar">
|
<% else %>
|
||||||
<span style="width:<%= statistics_result_percentage(poll_answer.poll_votes.count, total_answer(poll_question.id)) %>%;" id="choice_percentage_<%= poll_answer.id %>"></span>
|
<%= poll_answer.answer_text %>
|
||||||
</div>
|
<% end %>
|
||||||
<%= statistics_result_percentage(poll_answer.poll_votes.count, total_answer(poll_question.id)) %>%</td>
|
</td>
|
||||||
</tr>
|
<td class="td42"><%= poll_answer.poll_votes.count %> </td>
|
||||||
<% end %>
|
<td class="td287">
|
||||||
<tr class="table_bluebg">
|
<div class="Bar">
|
||||||
<td class="td327"><%= l(:label_poll_valid_commit) %> </td>
|
<span style="width:<%= statistics_result_percentage(poll_answer.poll_votes.count, total_answer(poll_question.id)) %>%;" id="choice_percentage_<%= poll_answer.id %>"></span>
|
||||||
<td class="td42"><%= total_answer(poll_question.id) %></td>
|
</div>
|
||||||
<td class="td287"> </td>
|
<%= statistics_result_percentage(poll_answer.poll_votes.count, total_answer(poll_question.id)) %>%</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
<% end %>
|
||||||
</table>
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<div id="other_tip_<%= poll_question.id %>" style="display: block">
|
||||||
|
<% if other_answers(poll_question).count > 0 %>
|
||||||
|
<table border="0" cellspacing="0" cellpadding="0">
|
||||||
|
<tbody>
|
||||||
|
<tr class="table_bluebg"><td class="pl5 w607">其它(详情)</td></tr>
|
||||||
|
<% other_answers(poll_question).each do |pv| %>
|
||||||
|
<tr><td class="pl5 w607"><%= pv.vote_text %></td></tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<table border="0" cellspacing="0" cellpadding="0">
|
||||||
|
<tr class="table_bluebg">
|
||||||
|
<td class="td327"><%= l(:label_poll_valid_commit) %> </td>
|
||||||
|
<td class="td42"><%= total_answer(poll_question.id) %></td>
|
||||||
|
<td class="td287"> </td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function hidden_others(id1, id2){
|
||||||
|
var other_answer = document.getElementById("other_answer_"+id2).innerText;
|
||||||
|
if (other_answer == "隐藏")
|
||||||
|
{
|
||||||
|
$("#other_answer_"+id2).text("显示");
|
||||||
|
$("#other_tip_"+id1).hide();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$("#other_answer_"+id2).text("隐藏");
|
||||||
|
$("#other_tip_"+id1).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
|
@ -13,6 +13,6 @@
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if params[:action] == "commit_diff" %>
|
<% if params[:action] == "commit_diff" %>
|
||||||
<div class="fr">Commit<a class="ml5" style="color: #3498db"><%= changeset.id %></a></div>
|
<div class="fr">Commit<a class="ml5" style="color: #999;"><%= changeset.id %></a></div>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
|
@ -0,0 +1,9 @@
|
||||||
|
class UpdateUserMailNotification < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
sql = "update `users` set mail_notification ='all' where mail_notification in ('day','week');"
|
||||||
|
execute(sql)
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
end
|
||||||
|
end
|
292
db/schema.rb
292
db/schema.rb
|
@ -11,7 +11,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended to check this file into your version control system.
|
# It's strongly recommended to check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(:version => 20161208015939) do
|
ActiveRecord::Schema.define(:version => 20161223030701) do
|
||||||
|
|
||||||
create_table "activities", :force => true do |t|
|
create_table "activities", :force => true do |t|
|
||||||
t.integer "act_id", :null => false
|
t.integer "act_id", :null => false
|
||||||
|
@ -325,14 +325,16 @@ ActiveRecord::Schema.define(:version => 20161208015939) do
|
||||||
add_index "changeset_parents", ["parent_id"], :name => "changeset_parents_parent_ids"
|
add_index "changeset_parents", ["parent_id"], :name => "changeset_parents_parent_ids"
|
||||||
|
|
||||||
create_table "changesets", :force => true do |t|
|
create_table "changesets", :force => true do |t|
|
||||||
t.integer "repository_id", :null => false
|
t.integer "repository_id", :null => false
|
||||||
t.string "revision", :null => false
|
t.string "revision", :null => false
|
||||||
t.string "committer"
|
t.string "committer"
|
||||||
t.datetime "committed_on", :null => false
|
t.datetime "committed_on", :null => false
|
||||||
t.text "comments"
|
t.text "comments"
|
||||||
t.date "commit_date"
|
t.date "commit_date"
|
||||||
t.string "scmid"
|
t.string "scmid"
|
||||||
t.integer "user_id"
|
t.integer "user_id"
|
||||||
|
t.integer "project_id"
|
||||||
|
t.integer "type", :default => 0
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "changesets", ["committed_on"], :name => "index_changesets_on_committed_on"
|
add_index "changesets", ["committed_on"], :name => "index_changesets_on_committed_on"
|
||||||
|
@ -426,6 +428,14 @@ ActiveRecord::Schema.define(:version => 20161208015939) do
|
||||||
add_index "comments", ["author_id"], :name => "index_comments_on_author_id"
|
add_index "comments", ["author_id"], :name => "index_comments_on_author_id"
|
||||||
add_index "comments", ["commented_id", "commented_type"], :name => "index_comments_on_commented_id_and_commented_type"
|
add_index "comments", ["commented_id", "commented_type"], :name => "index_comments_on_commented_id_and_commented_type"
|
||||||
|
|
||||||
|
create_table "commit_issues", :force => true do |t|
|
||||||
|
t.string "commit_id"
|
||||||
|
t.integer "issue_id"
|
||||||
|
t.integer "project_id"
|
||||||
|
t.datetime "created_at", :null => false
|
||||||
|
t.datetime "updated_at", :null => false
|
||||||
|
end
|
||||||
|
|
||||||
create_table "commits", :force => true do |t|
|
create_table "commits", :force => true do |t|
|
||||||
t.integer "repository_id"
|
t.integer "repository_id"
|
||||||
t.string "version"
|
t.string "version"
|
||||||
|
@ -437,54 +447,123 @@ ActiveRecord::Schema.define(:version => 20161208015939) do
|
||||||
t.datetime "updated_at", :null => false
|
t.datetime "updated_at", :null => false
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "contest_notifications", :force => true do |t|
|
create_table "contest_activities", :force => true do |t|
|
||||||
t.text "title"
|
t.integer "user_id"
|
||||||
|
t.integer "contest_id"
|
||||||
|
t.integer "contest_act_id"
|
||||||
|
t.string "contest_act_type"
|
||||||
|
t.datetime "created_at", :null => false
|
||||||
|
t.datetime "updated_at", :null => false
|
||||||
|
end
|
||||||
|
|
||||||
|
add_index "contest_activities", ["contest_id"], :name => "index_contest_activities_on_contest_id"
|
||||||
|
add_index "contest_activities", ["user_id"], :name => "index_contest_activities_on_user_id"
|
||||||
|
|
||||||
|
create_table "contest_member_roles", :force => true do |t|
|
||||||
|
t.integer "contest_member_id"
|
||||||
|
t.integer "role_id"
|
||||||
|
t.boolean "is_current", :default => true
|
||||||
|
t.datetime "created_at", :null => false
|
||||||
|
t.datetime "updated_at", :null => false
|
||||||
|
end
|
||||||
|
|
||||||
|
add_index "contest_member_roles", ["contest_member_id"], :name => "index_contest_member_roles_on_contest_member_id"
|
||||||
|
add_index "contest_member_roles", ["role_id"], :name => "index_contest_member_roles_on_role_id"
|
||||||
|
|
||||||
|
create_table "contest_members", :force => true do |t|
|
||||||
|
t.integer "user_id"
|
||||||
|
t.integer "contest_id"
|
||||||
|
t.boolean "is_collect", :default => true
|
||||||
|
t.datetime "created_at", :null => false
|
||||||
|
t.datetime "updated_at", :null => false
|
||||||
|
end
|
||||||
|
|
||||||
|
add_index "contest_members", ["contest_id"], :name => "index_contest_members_on_contest_id"
|
||||||
|
add_index "contest_members", ["user_id"], :name => "index_contest_members_on_user_id"
|
||||||
|
|
||||||
|
create_table "contest_messages", :force => true do |t|
|
||||||
|
t.integer "user_id"
|
||||||
|
t.integer "contest_id"
|
||||||
|
t.integer "contest_message_id"
|
||||||
|
t.string "course_message_type"
|
||||||
|
t.boolean "viewed", :default => false
|
||||||
t.text "content"
|
t.text "content"
|
||||||
|
t.integer "status"
|
||||||
|
t.datetime "created_at", :null => false
|
||||||
|
t.datetime "updated_at", :null => false
|
||||||
|
end
|
||||||
|
|
||||||
|
add_index "contest_messages", ["contest_id"], :name => "index_contest_messages_on_contest_id"
|
||||||
|
add_index "contest_messages", ["user_id"], :name => "index_contest_messages_on_user_id"
|
||||||
|
|
||||||
|
create_table "contestant_for_contests", :force => true do |t|
|
||||||
|
t.integer "student_id"
|
||||||
|
t.integer "contest_id"
|
||||||
t.datetime "created_at", :null => false
|
t.datetime "created_at", :null => false
|
||||||
t.datetime "updated_at", :null => false
|
t.datetime "updated_at", :null => false
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "contesting_projects", :force => true do |t|
|
add_index "contestant_for_contests", ["contest_id"], :name => "index_contestant_for_contests_on_contest_id"
|
||||||
t.integer "project_id"
|
add_index "contestant_for_contests", ["student_id"], :name => "index_contestant_for_contests_on_student_id"
|
||||||
t.string "contest_id"
|
|
||||||
t.integer "user_id"
|
|
||||||
t.string "description"
|
|
||||||
t.datetime "created_at", :null => false
|
|
||||||
t.datetime "updated_at", :null => false
|
|
||||||
t.string "reward"
|
|
||||||
end
|
|
||||||
|
|
||||||
create_table "contesting_softapplications", :force => true do |t|
|
create_table "contestant_work_projects", :force => true do |t|
|
||||||
t.integer "softapplication_id"
|
|
||||||
t.integer "contest_id"
|
t.integer "contest_id"
|
||||||
|
t.integer "work_id"
|
||||||
|
t.integer "contestant_work_id"
|
||||||
|
t.integer "project_id"
|
||||||
t.integer "user_id"
|
t.integer "user_id"
|
||||||
t.string "description"
|
t.boolean "is_leader"
|
||||||
t.datetime "created_at", :null => false
|
t.datetime "created_at", :null => false
|
||||||
t.datetime "updated_at", :null => false
|
t.datetime "updated_at", :null => false
|
||||||
t.string "reward"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "contestnotifications", :force => true do |t|
|
add_index "contestant_work_projects", ["contest_id"], :name => "index_contestant_work_projects_on_contest_id"
|
||||||
t.integer "contest_id"
|
add_index "contestant_work_projects", ["contestant_work_id"], :name => "index_contestant_work_projects_on_contestant_work_id"
|
||||||
t.string "title"
|
add_index "contestant_work_projects", ["user_id"], :name => "index_contestant_work_projects_on_user_id"
|
||||||
t.string "summary"
|
add_index "contestant_work_projects", ["work_id"], :name => "index_contestant_work_projects_on_work_id"
|
||||||
t.text "description"
|
|
||||||
t.integer "author_id"
|
create_table "contestant_work_scores", :force => true do |t|
|
||||||
t.integer "notificationcomments_count"
|
t.integer "contestant_work_id"
|
||||||
t.datetime "created_at", :null => false
|
t.integer "user_id"
|
||||||
t.datetime "updated_at", :null => false
|
t.integer "score"
|
||||||
|
t.text "comment"
|
||||||
|
t.integer "reviewer_role"
|
||||||
|
t.datetime "created_at", :null => false
|
||||||
|
t.datetime "updated_at", :null => false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
add_index "contestant_work_scores", ["contestant_work_id"], :name => "index_contestant_work_scores_on_contestant_work_id"
|
||||||
|
add_index "contestant_work_scores", ["user_id"], :name => "index_contestant_work_scores_on_user_id"
|
||||||
|
|
||||||
|
create_table "contestant_works", :force => true do |t|
|
||||||
|
t.string "name"
|
||||||
|
t.text "description"
|
||||||
|
t.integer "work_id"
|
||||||
|
t.integer "user_id"
|
||||||
|
t.float "work_score"
|
||||||
|
t.integer "project_id"
|
||||||
|
t.integer "work_status"
|
||||||
|
t.datetime "commit_time"
|
||||||
|
t.boolean "is_delete", :default => false
|
||||||
|
t.datetime "created_at", :null => false
|
||||||
|
t.datetime "updated_at", :null => false
|
||||||
|
end
|
||||||
|
|
||||||
|
add_index "contestant_works", ["project_id"], :name => "index_contestant_works_on_project_id"
|
||||||
|
add_index "contestant_works", ["user_id"], :name => "index_contestant_works_on_user_id"
|
||||||
|
add_index "contestant_works", ["work_id"], :name => "index_contestant_works_on_work_id"
|
||||||
|
|
||||||
create_table "contests", :force => true do |t|
|
create_table "contests", :force => true do |t|
|
||||||
|
t.integer "user_id"
|
||||||
t.string "name"
|
t.string "name"
|
||||||
t.string "budget", :default => ""
|
t.text "description"
|
||||||
t.integer "author_id"
|
t.boolean "is_public"
|
||||||
t.date "deadline"
|
t.boolean "is_delete", :default => false
|
||||||
t.string "description"
|
t.integer "visits", :default => 0
|
||||||
t.integer "commit"
|
t.string "invite_code"
|
||||||
t.string "password"
|
t.integer "invite_code_halt", :default => 0
|
||||||
t.datetime "created_on", :null => false
|
t.datetime "created_at", :null => false
|
||||||
t.datetime "updated_on", :null => false
|
t.datetime "updated_at", :null => false
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "course_activities", :force => true do |t|
|
create_table "course_activities", :force => true do |t|
|
||||||
|
@ -516,20 +595,6 @@ ActiveRecord::Schema.define(:version => 20161208015939) do
|
||||||
t.integer "container_id", :default => 0
|
t.integer "container_id", :default => 0
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "course_class_post", :id => false, :force => true do |t|
|
|
||||||
t.integer "班级id", :default => 0, :null => false
|
|
||||||
t.string "班级名"
|
|
||||||
t.integer "帖子id", :default => 0, :null => false
|
|
||||||
t.integer "主贴id"
|
|
||||||
t.string "帖子标题", :default => "", :null => false
|
|
||||||
t.text "帖子内容"
|
|
||||||
t.integer "帖子用户id"
|
|
||||||
t.integer "帖子回复数", :default => 0, :null => false
|
|
||||||
t.integer "最后回帖id"
|
|
||||||
t.datetime "发帖时间", :null => false
|
|
||||||
t.datetime "帖子更新时间", :null => false
|
|
||||||
end
|
|
||||||
|
|
||||||
create_table "course_contributor_scores", :force => true do |t|
|
create_table "course_contributor_scores", :force => true do |t|
|
||||||
t.integer "course_id"
|
t.integer "course_id"
|
||||||
t.integer "user_id"
|
t.integer "user_id"
|
||||||
|
@ -598,8 +663,8 @@ ActiveRecord::Schema.define(:version => 20161208015939) do
|
||||||
t.string "code"
|
t.string "code"
|
||||||
t.integer "time"
|
t.integer "time"
|
||||||
t.string "extra"
|
t.string "extra"
|
||||||
t.datetime "created_at", :null => false
|
t.datetime "created_at", :null => false
|
||||||
t.datetime "updated_at", :null => false
|
t.datetime "updated_at", :null => false
|
||||||
t.string "location"
|
t.string "location"
|
||||||
t.string "term"
|
t.string "term"
|
||||||
t.string "string"
|
t.string "string"
|
||||||
|
@ -609,27 +674,28 @@ ActiveRecord::Schema.define(:version => 20161208015939) do
|
||||||
t.string "class_period"
|
t.string "class_period"
|
||||||
t.integer "school_id"
|
t.integer "school_id"
|
||||||
t.text "description"
|
t.text "description"
|
||||||
t.integer "status", :default => 1
|
t.integer "status", :default => 1
|
||||||
t.integer "attachmenttype", :default => 2
|
t.integer "attachmenttype", :default => 2
|
||||||
t.integer "lft"
|
t.integer "lft"
|
||||||
t.integer "rgt"
|
t.integer "rgt"
|
||||||
t.integer "is_public", :limit => 1, :default => 1
|
t.integer "is_public", :limit => 1, :default => 1
|
||||||
t.integer "inherit_members", :limit => 1, :default => 1
|
t.integer "inherit_members", :limit => 1, :default => 1
|
||||||
t.integer "open_student", :default => 0
|
t.integer "open_student", :default => 0
|
||||||
t.integer "outline", :default => 0
|
t.integer "outline", :default => 0
|
||||||
t.integer "publish_resource", :default => 0
|
t.integer "publish_resource", :default => 0
|
||||||
t.integer "is_delete", :default => 0
|
t.integer "is_delete", :default => 0
|
||||||
t.integer "end_time"
|
t.integer "end_time"
|
||||||
t.string "end_term"
|
t.string "end_term"
|
||||||
t.integer "is_excellent", :default => 0
|
t.integer "is_excellent", :default => 0
|
||||||
t.integer "excellent_option", :default => 0
|
t.integer "excellent_option", :default => 0
|
||||||
t.integer "is_copy", :default => 0
|
t.integer "is_copy", :default => 0
|
||||||
t.integer "visits", :default => 0
|
t.integer "visits", :default => 0
|
||||||
t.integer "syllabus_id"
|
t.integer "syllabus_id"
|
||||||
t.string "invite_code"
|
t.string "invite_code"
|
||||||
t.string "qrcode"
|
t.string "qrcode"
|
||||||
t.integer "qrcode_expiretime", :default => 0
|
t.integer "qrcode_expiretime", :default => 0
|
||||||
t.integer "invite_code_halt", :limit => 1, :default => 0
|
t.integer "professional_level_id", :limit => 1
|
||||||
|
t.integer "invite_code_halt", :limit => 1, :default => 0
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "courses", ["invite_code"], :name => "index_courses_on_invite_code", :unique => true
|
add_index "courses", ["invite_code"], :name => "index_courses_on_invite_code", :unique => true
|
||||||
|
@ -680,6 +746,14 @@ ActiveRecord::Schema.define(:version => 20161208015939) do
|
||||||
add_index "custom_values", ["custom_field_id"], :name => "index_custom_values_on_custom_field_id"
|
add_index "custom_values", ["custom_field_id"], :name => "index_custom_values_on_custom_field_id"
|
||||||
add_index "custom_values", ["customized_type", "customized_id"], :name => "custom_values_customized"
|
add_index "custom_values", ["customized_type", "customized_id"], :name => "custom_values_customized"
|
||||||
|
|
||||||
|
create_table "data_exceptions", :force => true do |t|
|
||||||
|
t.string "message"
|
||||||
|
t.integer "container_id"
|
||||||
|
t.string "container_type"
|
||||||
|
t.datetime "created_at", :null => false
|
||||||
|
t.datetime "updated_at", :null => false
|
||||||
|
end
|
||||||
|
|
||||||
create_table "delayed_jobs", :force => true do |t|
|
create_table "delayed_jobs", :force => true do |t|
|
||||||
t.integer "priority", :default => 0, :null => false
|
t.integer "priority", :default => 0, :null => false
|
||||||
t.integer "attempts", :default => 0, :null => false
|
t.integer "attempts", :default => 0, :null => false
|
||||||
|
@ -696,6 +770,11 @@ ActiveRecord::Schema.define(:version => 20161208015939) do
|
||||||
|
|
||||||
add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority"
|
add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority"
|
||||||
|
|
||||||
|
create_table "disciplines", :force => true do |t|
|
||||||
|
t.string "name"
|
||||||
|
t.integer "professional_level_id", :limit => 1
|
||||||
|
end
|
||||||
|
|
||||||
create_table "discuss_demos", :force => true do |t|
|
create_table "discuss_demos", :force => true do |t|
|
||||||
t.string "title"
|
t.string "title"
|
||||||
t.text "body"
|
t.text "body"
|
||||||
|
@ -821,13 +900,11 @@ ActiveRecord::Schema.define(:version => 20161208015939) do
|
||||||
t.integer "exercise_status"
|
t.integer "exercise_status"
|
||||||
t.integer "user_id"
|
t.integer "user_id"
|
||||||
t.integer "time"
|
t.integer "time"
|
||||||
t.datetime "created_at", :null => false
|
t.datetime "created_at", :null => false
|
||||||
t.datetime "updated_at", :null => false
|
t.datetime "updated_at", :null => false
|
||||||
t.datetime "publish_time"
|
t.datetime "publish_time"
|
||||||
t.datetime "end_time"
|
t.datetime "end_time"
|
||||||
t.integer "show_result"
|
t.integer "show_result"
|
||||||
t.integer "question_random", :default => 0
|
|
||||||
t.integer "choice_random", :default => 0
|
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "first_pages", :force => true do |t|
|
create_table "first_pages", :force => true do |t|
|
||||||
|
@ -944,6 +1021,7 @@ ActiveRecord::Schema.define(:version => 20161208015939) do
|
||||||
t.integer "is_open", :default => 0
|
t.integer "is_open", :default => 0
|
||||||
t.datetime "simi_time"
|
t.datetime "simi_time"
|
||||||
t.integer "score_open", :default => 1
|
t.integer "score_open", :default => 1
|
||||||
|
t.integer "anonymous_appeal", :default => 0
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "homework_commons", ["course_id", "id"], :name => "index_homework_commons_on_course_id_and_id"
|
add_index "homework_commons", ["course_id", "id"], :name => "index_homework_commons_on_course_id_and_id"
|
||||||
|
@ -970,6 +1048,7 @@ ActiveRecord::Schema.define(:version => 20161208015939) do
|
||||||
t.datetime "created_at", :null => false
|
t.datetime "created_at", :null => false
|
||||||
t.datetime "updated_at", :null => false
|
t.datetime "updated_at", :null => false
|
||||||
t.integer "no_anon_penalty", :default => 1
|
t.integer "no_anon_penalty", :default => 1
|
||||||
|
t.integer "appeal_penalty", :default => 0
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "homework_detail_programings", :force => true do |t|
|
create_table "homework_detail_programings", :force => true do |t|
|
||||||
|
@ -1014,6 +1093,10 @@ ActiveRecord::Schema.define(:version => 20161208015939) do
|
||||||
t.datetime "updated_at", :null => false
|
t.datetime "updated_at", :null => false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
create_table "innodb_monitor", :id => false, :force => true do |t|
|
||||||
|
t.integer "a"
|
||||||
|
end
|
||||||
|
|
||||||
create_table "invite_lists", :force => true do |t|
|
create_table "invite_lists", :force => true do |t|
|
||||||
t.integer "project_id"
|
t.integer "project_id"
|
||||||
t.integer "user_id"
|
t.integer "user_id"
|
||||||
|
@ -1545,9 +1628,12 @@ ActiveRecord::Schema.define(:version => 20161208015939) do
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "professional_levels", :force => true do |t|
|
create_table "professional_levels", :force => true do |t|
|
||||||
t.string "level"
|
t.integer "level"
|
||||||
t.datetime "created_at", :null => false
|
end
|
||||||
t.datetime "updated_at", :null => false
|
|
||||||
|
create_table "professions", :force => true do |t|
|
||||||
|
t.string "name"
|
||||||
|
t.integer "discipline_id", :limit => 1
|
||||||
end
|
end
|
||||||
|
|
||||||
create_table "project_infos", :force => true do |t|
|
create_table "project_infos", :force => true do |t|
|
||||||
|
@ -1610,7 +1696,6 @@ ActiveRecord::Schema.define(:version => 20161208015939) do
|
||||||
t.boolean "hidden_repo", :default => false, :null => false
|
t.boolean "hidden_repo", :default => false, :null => false
|
||||||
t.integer "attachmenttype", :default => 1
|
t.integer "attachmenttype", :default => 1
|
||||||
t.integer "user_id"
|
t.integer "user_id"
|
||||||
t.integer "dts_test", :default => 0
|
|
||||||
t.string "enterprise_name"
|
t.string "enterprise_name"
|
||||||
t.integer "organization_id"
|
t.integer "organization_id"
|
||||||
t.integer "project_new_type"
|
t.integer "project_new_type"
|
||||||
|
@ -1618,6 +1703,11 @@ ActiveRecord::Schema.define(:version => 20161208015939) do
|
||||||
t.integer "forked_from_project_id"
|
t.integer "forked_from_project_id"
|
||||||
t.integer "forked_count"
|
t.integer "forked_count"
|
||||||
t.integer "publish_resource", :default => 0
|
t.integer "publish_resource", :default => 0
|
||||||
|
t.integer "boards_count", :default => 0
|
||||||
|
t.integer "news_count", :default => 0
|
||||||
|
t.integer "acts_count", :default => 0
|
||||||
|
t.integer "journals_count", :default => 0
|
||||||
|
t.integer "boards_reply_count", :default => 0
|
||||||
t.integer "visits", :default => 0
|
t.integer "visits", :default => 0
|
||||||
t.integer "hot", :default => 0
|
t.integer "hot", :default => 0
|
||||||
t.string "invite_code"
|
t.string "invite_code"
|
||||||
|
@ -1922,6 +2012,7 @@ ActiveRecord::Schema.define(:version => 20161208015939) do
|
||||||
t.integer "work_status", :default => 0
|
t.integer "work_status", :default => 0
|
||||||
t.datetime "commit_time"
|
t.datetime "commit_time"
|
||||||
t.integer "is_delete", :default => 0
|
t.integer "is_delete", :default => 0
|
||||||
|
t.integer "appeal_penalty", :default => 0
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "student_works", ["homework_common_id", "user_id"], :name => "index_student_works_on_homework_common_id_and_user_id"
|
add_index "student_works", ["homework_common_id", "user_id"], :name => "index_student_works_on_homework_common_id_and_user_id"
|
||||||
|
@ -1939,13 +2030,23 @@ ActiveRecord::Schema.define(:version => 20161208015939) do
|
||||||
t.integer "score"
|
t.integer "score"
|
||||||
t.text "comment"
|
t.text "comment"
|
||||||
t.integer "reviewer_role"
|
t.integer "reviewer_role"
|
||||||
t.datetime "created_at", :null => false
|
t.datetime "created_at", :null => false
|
||||||
t.datetime "updated_at", :null => false
|
t.datetime "updated_at", :null => false
|
||||||
|
t.integer "appeal_status", :default => 0
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "student_works_scores", ["student_work_id"], :name => "student_work_id"
|
add_index "student_works_scores", ["student_work_id"], :name => "student_work_id"
|
||||||
add_index "student_works_scores", ["user_id"], :name => "user_id"
|
add_index "student_works_scores", ["user_id"], :name => "user_id"
|
||||||
|
|
||||||
|
create_table "student_works_scores_appeals", :force => true do |t|
|
||||||
|
t.integer "student_works_score_id"
|
||||||
|
t.integer "user_id"
|
||||||
|
t.text "comment"
|
||||||
|
t.integer "appeal_status"
|
||||||
|
t.datetime "created_at", :null => false
|
||||||
|
t.datetime "updated_at", :null => false
|
||||||
|
end
|
||||||
|
|
||||||
create_table "students_for_courses", :force => true do |t|
|
create_table "students_for_courses", :force => true do |t|
|
||||||
t.integer "student_id"
|
t.integer "student_id"
|
||||||
t.integer "course_id"
|
t.integer "course_id"
|
||||||
|
@ -2004,8 +2105,8 @@ ActiveRecord::Schema.define(:version => 20161208015939) do
|
||||||
t.string "title"
|
t.string "title"
|
||||||
t.text "description"
|
t.text "description"
|
||||||
t.integer "user_id"
|
t.integer "user_id"
|
||||||
t.datetime "created_at", :null => false
|
t.datetime "created_at", :null => false
|
||||||
t.datetime "updated_at", :null => false
|
t.datetime "updated_at", :null => false
|
||||||
t.string "eng_name"
|
t.string "eng_name"
|
||||||
t.integer "syllabus_type"
|
t.integer "syllabus_type"
|
||||||
t.integer "credit"
|
t.integer "credit"
|
||||||
|
@ -2014,8 +2115,9 @@ ActiveRecord::Schema.define(:version => 20161208015939) do
|
||||||
t.integer "practice_hours"
|
t.integer "practice_hours"
|
||||||
t.string "applicable_major"
|
t.string "applicable_major"
|
||||||
t.string "pre_course"
|
t.string "pre_course"
|
||||||
t.integer "visits", :default => 0
|
t.integer "visits", :default => 0
|
||||||
t.integer "des_status", :default => 0
|
t.integer "des_status", :default => 0
|
||||||
|
t.integer "professional_level_id", :limit => 1
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "syllabuses", ["user_id"], :name => "index_syllabuses_on_user_id"
|
add_index "syllabuses", ["user_id"], :name => "index_syllabuses_on_user_id"
|
||||||
|
@ -2379,6 +2481,17 @@ ActiveRecord::Schema.define(:version => 20161208015939) do
|
||||||
|
|
||||||
add_index "wikis", ["project_id"], :name => "wikis_project_id"
|
add_index "wikis", ["project_id"], :name => "wikis_project_id"
|
||||||
|
|
||||||
|
create_table "work_detail_groups", :force => true do |t|
|
||||||
|
t.integer "work_id"
|
||||||
|
t.integer "min_num"
|
||||||
|
t.integer "max_num"
|
||||||
|
t.boolean "base_on_project"
|
||||||
|
t.datetime "created_at", :null => false
|
||||||
|
t.datetime "updated_at", :null => false
|
||||||
|
end
|
||||||
|
|
||||||
|
add_index "work_detail_groups", ["work_id"], :name => "index_work_detail_groups_on_work_id"
|
||||||
|
|
||||||
create_table "workflows", :force => true do |t|
|
create_table "workflows", :force => true do |t|
|
||||||
t.integer "tracker_id", :default => 0, :null => false
|
t.integer "tracker_id", :default => 0, :null => false
|
||||||
t.integer "old_status_id", :default => 0, :null => false
|
t.integer "old_status_id", :default => 0, :null => false
|
||||||
|
@ -2396,6 +2509,25 @@ ActiveRecord::Schema.define(:version => 20161208015939) do
|
||||||
add_index "workflows", ["role_id", "tracker_id", "old_status_id"], :name => "wkfs_role_tracker_old_status"
|
add_index "workflows", ["role_id", "tracker_id", "old_status_id"], :name => "wkfs_role_tracker_old_status"
|
||||||
add_index "workflows", ["role_id"], :name => "index_workflows_on_role_id"
|
add_index "workflows", ["role_id"], :name => "index_workflows_on_role_id"
|
||||||
|
|
||||||
|
create_table "works", :force => true do |t|
|
||||||
|
t.string "name"
|
||||||
|
t.integer "user_id"
|
||||||
|
t.text "description"
|
||||||
|
t.date "publish_time"
|
||||||
|
t.date "end_time"
|
||||||
|
t.integer "work_type"
|
||||||
|
t.integer "contest_id"
|
||||||
|
t.boolean "is_delete", :default => false
|
||||||
|
t.boolean "score_open", :default => true
|
||||||
|
t.boolean "is_open", :default => false
|
||||||
|
t.integer "work_status"
|
||||||
|
t.datetime "created_at", :null => false
|
||||||
|
t.datetime "updated_at", :null => false
|
||||||
|
end
|
||||||
|
|
||||||
|
add_index "works", ["contest_id"], :name => "index_works_on_contest_id"
|
||||||
|
add_index "works", ["user_id"], :name => "index_works_on_user_id"
|
||||||
|
|
||||||
create_table "works_categories", :force => true do |t|
|
create_table "works_categories", :force => true do |t|
|
||||||
t.string "category"
|
t.string "category"
|
||||||
t.datetime "created_at", :null => false
|
t.datetime "created_at", :null => false
|
||||||
|
|
|
@ -10,7 +10,7 @@ namespace :homework_endtime do
|
||||||
homework_common.course.student.each do |s|
|
homework_common.course.student.each do |s|
|
||||||
homework_common.course_messages << CourseMessage.new(:user_id => s.student_id, :course_id => homework_common.course_id, :viewed => false, :status => true)
|
homework_common.course_messages << CourseMessage.new(:user_id => s.student_id, :course_id => homework_common.course_id, :viewed => false, :status => true)
|
||||||
# 发送邮件通知
|
# 发送邮件通知
|
||||||
Mailer.homework_endtime__added(homework_common, s.student_id).deliver
|
# Mailer.homework_endtime__added(homework_common, s.student_id).deliver
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -53,7 +53,7 @@ namespace :homework_evaluation do
|
||||||
homework_common.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 2)
|
homework_common.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 2)
|
||||||
end
|
end
|
||||||
# 邮件通知
|
# 邮件通知
|
||||||
Mailer.send_mail_anonymous_comment_open(homework_common).deliver
|
# Mailer.send_mail_anonymous_comment_open(homework_common).deliver
|
||||||
else
|
else
|
||||||
#作业数小于2,启动失败, 只给老师发
|
#作业数小于2,启动失败, 只给老师发
|
||||||
# status==4 发送失败
|
# status==4 发送失败
|
||||||
|
@ -65,7 +65,7 @@ namespace :homework_evaluation do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
# 邮件通知
|
# 邮件通知
|
||||||
Mailer.send_mail_anonymous_comment_fail(homework_common).deliver
|
# Mailer.send_mail_anonymous_comment_fail(homework_common).deliver
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -109,7 +109,7 @@ namespace :homework_evaluation do
|
||||||
homework_common.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 3)
|
homework_common.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => course.id, :viewed => false, :status => 3)
|
||||||
end
|
end
|
||||||
# 邮件通知
|
# 邮件通知
|
||||||
Mailer.send_mail_anonymous_comment_close(homework_common).deliver
|
# Mailer.send_mail_anonymous_comment_close(homework_common).deliver
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -34,7 +34,7 @@ namespace :homework_publishtime do
|
||||||
homework.course_acts << CourseActivity.new(:user_id => homework.user_id,:course_id => homework.course_id)
|
homework.course_acts << CourseActivity.new(:user_id => homework.user_id,:course_id => homework.course_id)
|
||||||
end
|
end
|
||||||
# 邮件通知
|
# 邮件通知
|
||||||
Mailer.run.homework_added(homework)
|
# Mailer.run.homework_added(homework)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
Rails.logger.info("log--------------------------------homework_publish end")
|
Rails.logger.info("log--------------------------------homework_publish end")
|
||||||
|
|
|
@ -17,7 +17,7 @@ namespace :issue_due_date do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
# issue截止时间邮件提醒
|
# issue截止时间邮件提醒
|
||||||
Mailer.issue_due_date(issue).deliver
|
# Mailer.issue_due_date(issue).deliver
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue