Merge branch 'develop' into cs_optimize_txz
This commit is contained in:
commit
fec493b287
|
@ -6,6 +6,8 @@
|
||||||
/config/database.yml
|
/config/database.yml
|
||||||
/config/configuration.yml
|
/config/configuration.yml
|
||||||
/config/additional_environment.rb
|
/config/additional_environment.rb
|
||||||
|
/config/oneapm.yml
|
||||||
|
/config/environments/production.rb
|
||||||
|
|
||||||
|
|
||||||
/files/*
|
/files/*
|
||||||
|
|
|
@ -36,7 +36,7 @@ module Mobile
|
||||||
principal_types = "JournalsForMessage"
|
principal_types = "JournalsForMessage"
|
||||||
watched_user_ids = User.watched_by(user.id).count == 0 ? " " : ("," + User.watched_by(user.id).map{|u| u.id.to_s }.join(','))
|
watched_user_ids = User.watched_by(user.id).count == 0 ? " " : ("," + User.watched_by(user.id).map{|u| u.id.to_s }.join(','))
|
||||||
user_ids = "(" + user.id.to_s + watched_user_ids + ")"
|
user_ids = "(" + user.id.to_s + watched_user_ids + ")"
|
||||||
watched_user_blog_ids = Blog.select("id").where("author_id in #{user_ids}").count == 0 ? " " :Blog.select("id").where("author_id in #{user_ids}").map { |blog| blog.id}.join(",")
|
watched_user_blog_ids = Blog.select("id").where("author_id in #{user_ids}").count == 0 ? "-1" :Blog.select("id").where("author_id in #{user_ids}").map { |blog| blog.id}.join(",")
|
||||||
blog_ids = "(" + watched_user_blog_ids + ")"
|
blog_ids = "(" + watched_user_blog_ids + ")"
|
||||||
|
|
||||||
if container_type == "Course"
|
if container_type == "Course"
|
||||||
|
|
|
@ -540,6 +540,7 @@ module Mobile
|
||||||
present :status, 0
|
present :status, 0
|
||||||
else
|
else
|
||||||
present :status, -1
|
present :status, -1
|
||||||
|
present :message, "该用户已不在班级中"
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -568,17 +569,26 @@ module Mobile
|
||||||
roles_id << 10
|
roles_id << 10
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
c = Course.find("#{params[:id]}")
|
c = Course.find("#{params[:id]}")
|
||||||
|
|
||||||
#7教辅 9教师 10学生
|
my_member = c.member_principals.where("users.id=#{current_user.id}").first
|
||||||
if c.tea_id == params[:user_id] || c.tea_id != current_user.id || roles_id.length <= 0
|
|
||||||
present :status, -1
|
|
||||||
else
|
|
||||||
|
|
||||||
|
rolesids = []
|
||||||
|
my_member.roles.each do |role|
|
||||||
|
rolesids << role.id
|
||||||
|
end
|
||||||
|
|
||||||
|
#7教辅 9教师 10学生
|
||||||
|
if c.tea_id == params[:user_id] || roles_id.length <= 0
|
||||||
|
present :status, -1
|
||||||
|
present :message,"修改失败"
|
||||||
|
elsif rolesids.include?(3) || rolesids.include?(7) || rolesids.include?(9)
|
||||||
cs = CoursesService.new
|
cs = CoursesService.new
|
||||||
status = cs.modify_user_course_role params,roles_id
|
status = cs.modify_user_course_role params,roles_id
|
||||||
present :status, status
|
present :status, status
|
||||||
|
else
|
||||||
|
present :status, -1
|
||||||
|
present :message,"修改失败"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -661,6 +671,85 @@ module Mobile
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
desc "删除班级成员"
|
||||||
|
params do
|
||||||
|
requires :id, type: Integer
|
||||||
|
requires :token, type: String
|
||||||
|
requires :user_id, type: Integer
|
||||||
|
end
|
||||||
|
post ':id/deletemember' do
|
||||||
|
authenticate!
|
||||||
|
|
||||||
|
status = -1
|
||||||
|
|
||||||
|
if(current_user.id != params[:user_id].to_i)
|
||||||
|
#权限
|
||||||
|
c = Course.find("#{params[:id]}")
|
||||||
|
if c.tea_id != params[:user_id].to_i
|
||||||
|
|
||||||
|
my_member = c.member_principals.where("users.id=#{current_user.id}").first
|
||||||
|
|
||||||
|
roles_ids = []
|
||||||
|
my_member.roles.each do |role|
|
||||||
|
roles_ids << role.id
|
||||||
|
end
|
||||||
|
|
||||||
|
if my_member && (roles_ids.include?(3) || roles_ids.include?(7) || roles_ids.include?(9) )
|
||||||
|
#删除该成员
|
||||||
|
cs = CoursesService.new
|
||||||
|
status = cs.delete_course_member(c,params[:user_id].to_i,current_user)
|
||||||
|
else
|
||||||
|
status = -2
|
||||||
|
end
|
||||||
|
else
|
||||||
|
status = -3
|
||||||
|
end
|
||||||
|
else
|
||||||
|
status = -4
|
||||||
|
end
|
||||||
|
|
||||||
|
out = {status: status}
|
||||||
|
message = case status
|
||||||
|
when 0; "删除成功"
|
||||||
|
when -1; "您还未登录"
|
||||||
|
when -2; "对不起您没有权限"
|
||||||
|
when -3; "不能删除班级管理员"
|
||||||
|
when -4; "不能删除自己"
|
||||||
|
when 1; "该用户不在该班级中"
|
||||||
|
else; "未知错误,请稍后再试"
|
||||||
|
end
|
||||||
|
out.merge(message: message)
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "退出班级"
|
||||||
|
params do
|
||||||
|
requires :id, type: Integer
|
||||||
|
requires :token, type: String
|
||||||
|
end
|
||||||
|
post ':id/quit' do
|
||||||
|
authenticate!
|
||||||
|
|
||||||
|
#管理员不能退
|
||||||
|
cs = CoursesService.new
|
||||||
|
c = Course.find("#{params[:id]}")
|
||||||
|
|
||||||
|
user = current_user
|
||||||
|
|
||||||
|
if c.tea_id != user.id
|
||||||
|
status = cs.exit_course({:object_id => params[:id]}, user)
|
||||||
|
else
|
||||||
|
status = 3
|
||||||
|
end
|
||||||
|
out = {status: status}
|
||||||
|
message = case status
|
||||||
|
when 0; "退出班级成功"
|
||||||
|
when 1; "您不是该班级成员"
|
||||||
|
when 2; "您还未登录"
|
||||||
|
when 3; "管理员不能退出班级"
|
||||||
|
else; "未知错误,请稍后再试"
|
||||||
|
end
|
||||||
|
out.merge(message: message)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -89,11 +89,15 @@ module Mobile
|
||||||
tip = 0 #0班级1项目
|
tip = 0 #0班级1项目
|
||||||
type = params[:type]
|
type = params[:type]
|
||||||
result = 1
|
result = 1
|
||||||
|
|
||||||
|
#0回复 1回复的回复
|
||||||
|
reply_type = params[:reply_type]
|
||||||
|
|
||||||
|
update_id = 0
|
||||||
|
|
||||||
if params[:content]!="" && current_user
|
if params[:content]!="" && current_user
|
||||||
case type
|
case type
|
||||||
when "HomeworkCommon"
|
when "HomeworkCommon"
|
||||||
homework_common = HomeworkCommon.find(params[:id])
|
|
||||||
|
|
||||||
#如果是私有的 并且不是成员则不能回复
|
#如果是私有的 并且不是成员则不能回复
|
||||||
# is_public = homework_common.course.is_public
|
# is_public = homework_common.course.is_public
|
||||||
# if is_public == 0 && !current_user.member_of_course?(homework_common.course)
|
# if is_public == 0 && !current_user.member_of_course?(homework_common.course)
|
||||||
|
@ -106,15 +110,29 @@ module Mobile
|
||||||
# result = 2
|
# result = 2
|
||||||
# end
|
# end
|
||||||
# end
|
# end
|
||||||
|
if reply_type == nil || reply_type == 0
|
||||||
|
homework_common = HomeworkCommon.find(params[:id])
|
||||||
feedback = HomeworkCommon.add_homework_jour(current_user, params[:content], params[:id])
|
feedback = HomeworkCommon.add_homework_jour(current_user, params[:content], params[:id])
|
||||||
if (feedback.errors.empty?)
|
if (feedback.errors.empty?)
|
||||||
homework_common.update_column(:updated_at, Time.now)
|
homework_common.update_column(:updated_at, Time.now)
|
||||||
result = 2
|
result = 2
|
||||||
|
update_id = homework_common.id
|
||||||
|
end
|
||||||
|
else
|
||||||
|
#二级回复
|
||||||
|
reply = JournalsForMessage.find params[:id].to_i
|
||||||
|
homework_common = HomeworkCommon.find reply.jour_id
|
||||||
|
|
||||||
|
options = {:notes => params[:content], :reply_id => reply.user_id,:user_id => current_user.id,:m_parent_id => params[:id].to_i,:m_reply_id => params[:id].to_i}
|
||||||
|
feedback = HomeworkCommon.add_homework_jour(current_user, params[:content], reply.jour_id, options)
|
||||||
|
if (feedback.errors.empty?)
|
||||||
|
homework_common.update_column(:updated_at, Time.now)
|
||||||
|
result = 2
|
||||||
|
update_id = homework_common.id
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
when "News"
|
when "News"
|
||||||
news = News.find(params[:id])
|
|
||||||
|
|
||||||
# if news.project
|
# if news.project
|
||||||
# if news.project.is_public == false && !current_user.member_of?(news.project)
|
# if news.project.is_public == false && !current_user.member_of?(news.project)
|
||||||
# status = -1
|
# status = -1
|
||||||
|
@ -126,19 +144,28 @@ module Mobile
|
||||||
# tip = 0
|
# tip = 0
|
||||||
# end
|
# end
|
||||||
# end
|
# end
|
||||||
|
|
||||||
if status == 0
|
if status == 0
|
||||||
|
if reply_type == nil || reply_type == 0
|
||||||
|
news = News.find(params[:id])
|
||||||
comment = Comment.new
|
comment = Comment.new
|
||||||
comment.comments = params[:content]
|
comment.comments = params[:content]
|
||||||
comment.author = current_user
|
comment.author = current_user
|
||||||
if news.comments << comment
|
if news.comments << comment
|
||||||
result = 2
|
result = 2
|
||||||
|
update_id = news.id
|
||||||
|
end
|
||||||
|
else
|
||||||
|
#二级回复
|
||||||
|
comment = Comment.find(params[:id])
|
||||||
|
news = News.find comment.commented_id
|
||||||
|
new_comment = news.comments.build(:author_id => current_user.id, :reply_id => params[:id], :comments => params[:content], :parent_id => comment.id)
|
||||||
|
if new_comment.save
|
||||||
|
result = 2
|
||||||
|
update_id = news.id
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
when "Message"
|
when "Message"
|
||||||
message = Message.find(params[:id])
|
|
||||||
board = Board.find(message.board_id)
|
|
||||||
|
|
||||||
# if message.project
|
# if message.project
|
||||||
# if message.project.is_public == false && !current_user.member_of?(message.project)
|
# if message.project.is_public == false && !current_user.member_of?(message.project)
|
||||||
# status = -1
|
# status = -1
|
||||||
|
@ -152,6 +179,9 @@ module Mobile
|
||||||
# end
|
# end
|
||||||
|
|
||||||
if status == 0
|
if status == 0
|
||||||
|
# if reply_type == nil || reply_type == 0
|
||||||
|
message = Message.find(params[:id])
|
||||||
|
board = Board.find(message.board_id)
|
||||||
topic = message.root
|
topic = message.root
|
||||||
reply = Message.new
|
reply = Message.new
|
||||||
reply.author = current_user
|
reply.author = current_user
|
||||||
|
@ -159,13 +189,16 @@ module Mobile
|
||||||
reply.content = params[:content]
|
reply.content = params[:content]
|
||||||
reply.parent_id = params[:id]
|
reply.parent_id = params[:id]
|
||||||
reply.subject = "RE: #{topic.subject}"
|
reply.subject = "RE: #{topic.subject}"
|
||||||
if topic.children << reply
|
if message.children << reply
|
||||||
result = 2
|
result = 2
|
||||||
|
update_id = topic.id
|
||||||
end
|
end
|
||||||
|
# else
|
||||||
|
#二级回复
|
||||||
|
|
||||||
|
# end
|
||||||
end
|
end
|
||||||
when "JournalsForMessage"
|
when "JournalsForMessage"
|
||||||
jour = JournalsForMessage.find params[:id]
|
|
||||||
|
|
||||||
# if jour.jour_type == "Project"
|
# if jour.jour_type == "Project"
|
||||||
# if jour.project.is_public == false && !current_user.member_of?(jour.project)
|
# if jour.project.is_public == false && !current_user.member_of?(jour.project)
|
||||||
# status = -1
|
# status = -1
|
||||||
|
@ -179,6 +212,8 @@ module Mobile
|
||||||
# end
|
# end
|
||||||
|
|
||||||
if status == 0
|
if status == 0
|
||||||
|
# if reply_type == nil || reply_type == 0
|
||||||
|
jour = JournalsForMessage.find(params[:id]).root
|
||||||
parent_id = params[:id]
|
parent_id = params[:id]
|
||||||
author_id = current_user.id
|
author_id = current_user.id
|
||||||
reply_user_id = jour.user_id
|
reply_user_id = jour.user_id
|
||||||
|
@ -195,26 +230,48 @@ module Mobile
|
||||||
if jfm.errors.empty?
|
if jfm.errors.empty?
|
||||||
(JournalsForMessage.find parent_id).update_attribute(:updated_on,Time.now)
|
(JournalsForMessage.find parent_id).update_attribute(:updated_on,Time.now)
|
||||||
result = 2
|
result = 2
|
||||||
|
update_id = jour.id
|
||||||
end
|
end
|
||||||
|
# else
|
||||||
|
#二级回复
|
||||||
|
|
||||||
|
# end
|
||||||
end
|
end
|
||||||
when 'Issue'
|
when 'Issue'
|
||||||
issue = Issue.find params[:id]
|
|
||||||
|
|
||||||
# if issue.project.is_public == false && !current_user.member_of?(issue.project)
|
# if issue.project.is_public == false && !current_user.member_of?(issue.project)
|
||||||
# status = -1
|
# status = -1
|
||||||
# tip = 1
|
# tip = 1
|
||||||
# end
|
# end
|
||||||
|
|
||||||
if status == 0
|
if status == 0
|
||||||
|
if reply_type == nil || reply_type == 0
|
||||||
|
issue = Issue.find params[:id]
|
||||||
is_jour = Journal.new
|
is_jour = Journal.new
|
||||||
is_jour.user_id = current_user.id
|
is_jour.user_id = current_user.id
|
||||||
is_jour.notes = params[:content]
|
is_jour.notes = params[:content]
|
||||||
is_jour.journalized = issue
|
is_jour.journalized = issue
|
||||||
if is_jour.save
|
if is_jour.save
|
||||||
result = 2
|
result = 2
|
||||||
|
update_id = issue.id
|
||||||
|
end
|
||||||
|
else
|
||||||
|
#二级回复
|
||||||
|
jour = Journal.find(params[:id])
|
||||||
|
issue = jour.journalized
|
||||||
|
is_jour = Journal.new
|
||||||
|
is_jour.user_id = current_user.id
|
||||||
|
is_jour.notes = params[:content]
|
||||||
|
is_jour.reply_id = params[:id]
|
||||||
|
is_jour.parent_id = params[:id]
|
||||||
|
is_jour.journalized = issue
|
||||||
|
if is_jour.save
|
||||||
|
result = 2
|
||||||
|
update_id = issue.id
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
when 'BlogComment'
|
when 'BlogComment'
|
||||||
|
if reply_type == nil || reply_type == 0
|
||||||
blog = BlogComment.find(params[:id]).root
|
blog = BlogComment.find(params[:id]).root
|
||||||
blogComment = BlogComment.new
|
blogComment = BlogComment.new
|
||||||
blogComment.author = current_user
|
blogComment.author = current_user
|
||||||
|
@ -223,20 +280,40 @@ module Mobile
|
||||||
blogComment.title = "RE: #{blog.title}"
|
blogComment.title = "RE: #{blog.title}"
|
||||||
if blog.children << blogComment
|
if blog.children << blogComment
|
||||||
result = 2
|
result = 2
|
||||||
|
update_id = blog.id
|
||||||
|
end
|
||||||
|
else
|
||||||
|
#二级回复
|
||||||
|
blog = BlogComment.find(params[:id]).root
|
||||||
|
blogComment = BlogComment.new
|
||||||
|
blogComment.author = current_user
|
||||||
|
blogComment.blog = blog.blog
|
||||||
|
blogComment.content = params[:content]
|
||||||
|
blogComment.title = "RE: #{blog.title}"
|
||||||
|
parent = BlogComment.find params[:id]
|
||||||
|
blogComment.parent_id = params[:id] #被回复的回复
|
||||||
|
blogComment.reply_id = parent.author.id #被回复者id
|
||||||
|
|
||||||
|
if parent.children << blogComment
|
||||||
|
result = 2
|
||||||
|
update_id = blog.id
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if result == 2
|
if result == 2
|
||||||
update_course_activity_api(type,params[:id])
|
update_course_activity_api(type,update_id)
|
||||||
update_user_activity_api(type,params[:id])
|
update_user_activity_api(type,update_id)
|
||||||
update_org_activity_api(type,params[:id])
|
update_org_activity_api(type,update_id)
|
||||||
update_forge_activity_api(type,params[:id])
|
update_forge_activity_api(type,update_id)
|
||||||
update_principal_activity_api(type,params[:id])
|
update_principal_activity_api(type,update_id)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
result = 3
|
result = 3
|
||||||
end
|
end
|
||||||
present :result, result
|
present :result, result
|
||||||
present :status, status
|
present :status, status
|
||||||
|
present :act_id, update_id
|
||||||
present :tip, tip
|
present :tip, tip
|
||||||
present :subscribe,subscribe
|
present :subscribe,subscribe
|
||||||
end
|
end
|
||||||
|
|
|
@ -35,6 +35,8 @@ module Mobile
|
||||||
present :is_public, is_public
|
present :is_public, is_public
|
||||||
present :status, 0
|
present :status, 0
|
||||||
rescue Exception=>e
|
rescue Exception=>e
|
||||||
|
Rails.logger.info "course_notice is not find!"
|
||||||
|
Rails.logger.info e
|
||||||
present :status, -1
|
present :status, -1
|
||||||
present :message, e.message
|
present :message, e.message
|
||||||
end
|
end
|
||||||
|
|
|
@ -127,6 +127,7 @@ module Mobile
|
||||||
present :status, 0
|
present :status, 0
|
||||||
else
|
else
|
||||||
present :status, -1
|
present :status, -1
|
||||||
|
present :message, "该用户已不在项目中"
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -268,6 +269,81 @@ module Mobile
|
||||||
present :status, 0
|
present :status, 0
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
desc "删除项目成员"
|
||||||
|
params do
|
||||||
|
requires :id, type: Integer
|
||||||
|
requires :token, type: String
|
||||||
|
requires :user_id, type: Integer
|
||||||
|
end
|
||||||
|
post ':id/deletemember' do
|
||||||
|
authenticate!
|
||||||
|
|
||||||
|
status = -1
|
||||||
|
|
||||||
|
if(current_user.id != params[:user_id].to_i)
|
||||||
|
#权限
|
||||||
|
project = Project.find("#{params[:id]}")
|
||||||
|
if project.user_id != params[:user_id].to_i
|
||||||
|
|
||||||
|
my_member = project.member_principals.where("users.id=#{current_user.id}").first
|
||||||
|
|
||||||
|
roles_ids = []
|
||||||
|
my_member.roles.each do |role|
|
||||||
|
roles_ids << role.id
|
||||||
|
end
|
||||||
|
|
||||||
|
if my_member && roles_ids.include?(3)
|
||||||
|
#删除该成员
|
||||||
|
ps = ProjectsService.new
|
||||||
|
status = ps.project_delete_member(project,params[:user_id].to_i,current_user)
|
||||||
|
else
|
||||||
|
status = -2
|
||||||
|
end
|
||||||
|
else
|
||||||
|
status = -3
|
||||||
|
end
|
||||||
|
else
|
||||||
|
status = -4
|
||||||
|
end
|
||||||
|
|
||||||
|
out = {status: status}
|
||||||
|
message = case status
|
||||||
|
when 0; "删除成功"
|
||||||
|
when 1; "该用户不在该项目中"
|
||||||
|
when -1; "您还未登录"
|
||||||
|
when -2; "您没有权限"
|
||||||
|
when -3; "不能删除项目创建者"
|
||||||
|
when -4; "不能删除自己"
|
||||||
|
else; "未知错误,请稍后再试"
|
||||||
|
end
|
||||||
|
out.merge(message: message)
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "退出项目"
|
||||||
|
params do
|
||||||
|
requires :id, type: Integer
|
||||||
|
requires :token, type: String
|
||||||
|
end
|
||||||
|
post ':id/quit' do
|
||||||
|
authenticate!
|
||||||
|
|
||||||
|
project = Project.find("#{params[:id]}")
|
||||||
|
|
||||||
|
ps = ProjectsService.new
|
||||||
|
status = ps.exit_project(project,current_user)
|
||||||
|
|
||||||
|
out = {status: status}
|
||||||
|
message = case status
|
||||||
|
when 0; "退出项目成功"
|
||||||
|
when -3; "您不是该项目成员"
|
||||||
|
when -1; "您还未登录"
|
||||||
|
when -2; "项目创建者不能退出项目"
|
||||||
|
else; "未知错误,请稍后再试"
|
||||||
|
end
|
||||||
|
out.merge(message: message)
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,61 @@ module Mobile
|
||||||
class Users < Grape::API
|
class Users < Grape::API
|
||||||
resource :users do
|
resource :users do
|
||||||
|
|
||||||
|
desc "我的资料"
|
||||||
|
params do
|
||||||
|
requires :token, type: String
|
||||||
|
end
|
||||||
|
|
||||||
|
get 'get_userinfo' do
|
||||||
|
authenticate!
|
||||||
|
present :data, current_user, with: Mobile::Entities::User
|
||||||
|
present :status, 0
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "上传头像"
|
||||||
|
params do
|
||||||
|
requires :token, type: String
|
||||||
|
requires :imgdata, type: String
|
||||||
|
end
|
||||||
|
|
||||||
|
post 'upload_head' do
|
||||||
|
authenticate!
|
||||||
|
#直接生成头像
|
||||||
|
dirPath = "public/images/avatars/User"
|
||||||
|
|
||||||
|
fileDir = dirPath + "/"+current_user.id.to_s
|
||||||
|
imgdata = Base64.decode64(params[:imgdata].split(",")[1])
|
||||||
|
if imgdata.length > 1024*1024
|
||||||
|
present :message,"上传图片不能超过1M"
|
||||||
|
present :status, -1
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
File.open(fileDir,'wb'){ |f| f.write(imgdata) }
|
||||||
|
present :status, 0
|
||||||
|
rescue
|
||||||
|
present :message,"上传失败"
|
||||||
|
present :status, -1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "解除绑定"
|
||||||
|
params do
|
||||||
|
requires :token, type: String
|
||||||
|
end
|
||||||
|
|
||||||
|
post 'user_unbind' do
|
||||||
|
authenticate!
|
||||||
|
|
||||||
|
user = current_user
|
||||||
|
uw = user.user_wechat
|
||||||
|
|
||||||
|
us = UsersService.new
|
||||||
|
us.wechat_unbind user.user_wechat
|
||||||
|
|
||||||
|
present :status, 0
|
||||||
|
end
|
||||||
|
|
||||||
desc "查询是否已绑定"
|
desc "查询是否已绑定"
|
||||||
params do
|
params do
|
||||||
requires :openid, type: String, desc: 'wechat openid'
|
requires :openid, type: String, desc: 'wechat openid'
|
||||||
|
@ -221,6 +276,73 @@ module Mobile
|
||||||
present :data,my_jours,with:Mobile::Entities::Jours
|
present :data,my_jours,with:Mobile::Entities::Jours
|
||||||
present :status,0
|
present :status,0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
desc "修改我的资料"
|
||||||
|
|
||||||
|
params do
|
||||||
|
requires :token, type: String
|
||||||
|
requires :lastname, type: String
|
||||||
|
requires :sex, type: Integer
|
||||||
|
requires :mail, type: String
|
||||||
|
end
|
||||||
|
|
||||||
|
post 'edit_userinfo' do
|
||||||
|
authenticate!
|
||||||
|
user = current_user
|
||||||
|
status = 0
|
||||||
|
message = ""
|
||||||
|
|
||||||
|
#昵称 不能超过30个字符
|
||||||
|
if params[:lastname].length > 30 then
|
||||||
|
message = "姓名不能超过30个字符!"
|
||||||
|
status = -1
|
||||||
|
end
|
||||||
|
|
||||||
|
if params[:mail].length > 60 then
|
||||||
|
message = "邮箱地址不能超过60个字符!"
|
||||||
|
status = -1
|
||||||
|
end
|
||||||
|
|
||||||
|
if !(params[:mail].match(/\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i))
|
||||||
|
message = "请输入正确的邮箱地址!"
|
||||||
|
status = -1
|
||||||
|
end
|
||||||
|
|
||||||
|
if status == 0
|
||||||
|
# 修改邮箱的时候同步修改到gitlab
|
||||||
|
if user.mail != params[:mail]
|
||||||
|
g = Gitlab.client
|
||||||
|
begin
|
||||||
|
g.edit_user(user.gid, :email => params[:mail])
|
||||||
|
rescue
|
||||||
|
Rails.logger.error "sync user's email of gitlab failed!"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
user.mail = params[:mail]
|
||||||
|
|
||||||
|
user.lastname = params[:lastname]
|
||||||
|
|
||||||
|
se = user.extensions
|
||||||
|
|
||||||
|
se.gender = params[:sex]
|
||||||
|
|
||||||
|
if user.save && se.save
|
||||||
|
status = 0
|
||||||
|
else
|
||||||
|
message = "该邮箱地址已被使用!"
|
||||||
|
status = -1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if status == 0
|
||||||
|
present :data, current_user, with: Mobile::Entities::User
|
||||||
|
present :status, 0
|
||||||
|
else
|
||||||
|
present :status, -1
|
||||||
|
present :message, message
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -73,6 +73,18 @@ module Mobile
|
||||||
elsif ac.container_type == "Blog"
|
elsif ac.container_type == "Blog"
|
||||||
"发表博客"
|
"发表博客"
|
||||||
end
|
end
|
||||||
|
when :syllabus_title
|
||||||
|
if ac.container_type == "Course"
|
||||||
|
course = get_course(ac.container_id)
|
||||||
|
name = course.syllabus.nil? ? "":course.syllabus.title
|
||||||
|
name
|
||||||
|
end
|
||||||
|
when :course_project_id
|
||||||
|
if ac.container_type == "Course"
|
||||||
|
ac.container_id
|
||||||
|
elsif ac.container_type == "Project"
|
||||||
|
ac.container_id
|
||||||
|
end
|
||||||
when :activity_type_name
|
when :activity_type_name
|
||||||
if ac.container_type == "Course"
|
if ac.container_type == "Course"
|
||||||
case ac.act_type
|
case ac.act_type
|
||||||
|
@ -137,7 +149,9 @@ module Mobile
|
||||||
act_expose :subject #标题
|
act_expose :subject #标题
|
||||||
act_expose :description #描述
|
act_expose :description #描述
|
||||||
act_expose :latest_update #最新更新时间
|
act_expose :latest_update #最新更新时间
|
||||||
|
act_expose :course_project_id #课程/项目ID
|
||||||
act_expose :course_project_name #课程/项目名字
|
act_expose :course_project_name #课程/项目名字
|
||||||
|
act_expose :syllabus_title #课程名字
|
||||||
act_expose :activity_type_name #课程问答区/项目缺陷等
|
act_expose :activity_type_name #课程问答区/项目缺陷等
|
||||||
expose :has_praise , if: lambda { |instance, options| options[:user] } do |instance, options|
|
expose :has_praise , if: lambda { |instance, options| options[:user] } do |instance, options|
|
||||||
if instance.act_type == "HomeworkCommon" || instance.act_type == "News" || instance.act_type == "Message" || instance.act_type == "BlogComment" || instance.act_type == "JournalsForMessage" || instance.act_type == "Issue"
|
if instance.act_type == "HomeworkCommon" || instance.act_type == "News" || instance.act_type == "Message" || instance.act_type == "BlogComment" || instance.act_type == "JournalsForMessage" || instance.act_type == "Issue"
|
||||||
|
|
|
@ -107,6 +107,7 @@ module Mobile
|
||||||
course_expose :current_user_is_member
|
course_expose :current_user_is_member
|
||||||
course_expose :current_user_is_teacher
|
course_expose :current_user_is_teacher
|
||||||
course_expose :work_unit
|
course_expose :work_unit
|
||||||
|
course_expose :syllabus_title
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -52,6 +52,10 @@ module Mobile
|
||||||
time_from_now issue.created_on
|
time_from_now issue.created_on
|
||||||
when :act_id
|
when :act_id
|
||||||
issue.id
|
issue.id
|
||||||
|
when :act_type
|
||||||
|
'Journal'
|
||||||
|
when :praise_count
|
||||||
|
get_activity_praise_num(issue)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -36,6 +36,10 @@ module Mobile
|
||||||
time_from_now f.created_on
|
time_from_now f.created_on
|
||||||
when :act_id
|
when :act_id
|
||||||
f.id
|
f.id
|
||||||
|
when :praise_count
|
||||||
|
get_activity_praise_num(f)
|
||||||
|
when :act_type
|
||||||
|
'Comment'
|
||||||
end
|
end
|
||||||
|
|
||||||
elsif f.is_a?(Hash) && !f.key?(field)
|
elsif f.is_a?(Hash) && !f.key?(field)
|
||||||
|
|
|
@ -3,6 +3,7 @@ module Mobile
|
||||||
class Project < Grape::Entity
|
class Project < Grape::Entity
|
||||||
expose :name
|
expose :name
|
||||||
expose :id
|
expose :id
|
||||||
|
expose :is_public
|
||||||
expose :user_id
|
expose :user_id
|
||||||
expose :invite_code
|
expose :invite_code
|
||||||
expose :qrcode
|
expose :qrcode
|
||||||
|
|
|
@ -30,15 +30,24 @@ module Mobile
|
||||||
u.nil? ? "" : u.show_name
|
u.nil? ? "" : u.show_name
|
||||||
when :roles_id
|
when :roles_id
|
||||||
u[:roles_id].nil? ? nil : u.roles_id
|
u[:roles_id].nil? ? nil : u.roles_id
|
||||||
|
when :login
|
||||||
|
u.login
|
||||||
|
when :lastname
|
||||||
|
u.lastname
|
||||||
|
when :mail
|
||||||
|
u.mail
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
expose :id
|
expose :id
|
||||||
#头像
|
#头像
|
||||||
|
user_expose :login
|
||||||
|
user_expose :lastname
|
||||||
|
#邮箱地址
|
||||||
|
user_expose :mail
|
||||||
expose :nickname
|
expose :nickname
|
||||||
#真名
|
#真名
|
||||||
user_expose :img_url
|
user_expose :img_url
|
||||||
|
@ -51,8 +60,6 @@ module Mobile
|
||||||
#我的二维码
|
#我的二维码
|
||||||
#工作单位
|
#工作单位
|
||||||
user_expose :work_unit
|
user_expose :work_unit
|
||||||
#邮箱地址
|
|
||||||
user_expose :mail
|
|
||||||
#地区
|
#地区
|
||||||
user_expose :location
|
user_expose :location
|
||||||
#签名
|
#签名
|
||||||
|
|
|
@ -599,8 +599,19 @@ class AdminController < ApplicationController
|
||||||
|
|
||||||
#学校列表
|
#学校列表
|
||||||
def schools
|
def schools
|
||||||
|
@order = ""
|
||||||
|
@sort = ""
|
||||||
@schools = School.find_by_sql("SELECT * FROM schools ORDER BY created_at DESC")
|
@schools = School.find_by_sql("SELECT * FROM schools ORDER BY created_at DESC")
|
||||||
|
if params[:sort] && (params[:order] == 'num')
|
||||||
|
@order = params[:order]
|
||||||
|
@sort = params[:sort]
|
||||||
|
@schools.each do |school|
|
||||||
|
count = UserExtensions.where("school_id = #{school.id} or occupation = '#{school.name}'").count
|
||||||
|
school[:infocount] = count.to_i
|
||||||
|
end
|
||||||
|
@sort == 'asc' ? (@schools = @schools.sort{|x,y| x[:infocount] <=> y[:infocount] }) : (@schools = @schools.sort{|x,y| y[:infocount] <=> x[:infocount]})
|
||||||
|
end
|
||||||
|
|
||||||
@school_count = @schools.count
|
@school_count = @schools.count
|
||||||
|
|
||||||
@school_pages = Paginator.new @school_count, 30, params['page'] || 1
|
@school_pages = Paginator.new @school_count, 30, params['page'] || 1
|
||||||
|
@ -777,8 +788,15 @@ class AdminController < ApplicationController
|
||||||
|
|
||||||
#留言列表
|
#留言列表
|
||||||
def leave_messages
|
def leave_messages
|
||||||
|
notes1, notes2, notes3 = '', '', ''
|
||||||
|
begin
|
||||||
|
notes1 = Message.find(19292).content
|
||||||
|
notes2 = Message.find(19291).content
|
||||||
|
notes3 = Message.find(19504).content
|
||||||
|
rescue => e
|
||||||
|
end
|
||||||
@jour = JournalsForMessage.find_by_sql("SELECT * FROM journals_for_messages AS j1
|
@jour = JournalsForMessage.find_by_sql("SELECT * FROM journals_for_messages AS j1
|
||||||
WHERE j1.jour_type IN ('Course','Principal') AND (j1.m_parent_id IS NULL OR (j1.m_parent_id IN (SELECT id FROM journals_for_messages WHERE jour_type IN ('Course','Principal')))) order by created_on desc")
|
WHERE j1.jour_type IN ('Course','Principal') AND (j1.m_parent_id IS NULL OR (j1.m_parent_id IN (SELECT id FROM journals_for_messages WHERE jour_type IN ('Course','Principal')))) AND j1.notes !='#{notes1}' AND j1.notes !='#{notes2}' AND j1.notes !='#{notes3}' order by created_on desc")
|
||||||
@jour = paginateHelper @jour,30
|
@jour = paginateHelper @jour,30
|
||||||
@page = (params['page'] || 1).to_i - 1
|
@page = (params['page'] || 1).to_i - 1
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
|
|
|
@ -372,7 +372,8 @@ class ApplicationController < ActionController::Base
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
if allowed
|
|
||||||
|
if allowed || (params[:type] && params[:type] == "wechat" )
|
||||||
true
|
true
|
||||||
else
|
else
|
||||||
if @project && @project.archived?
|
if @project && @project.archived?
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#encoding: utf-8
|
||||||
# Redmine - project management software
|
# Redmine - project management software
|
||||||
# Copyright (C) 2006-2013 Jean-Philippe Lang
|
# Copyright (C) 2006-2013 Jean-Philippe Lang
|
||||||
#
|
#
|
||||||
|
@ -129,7 +130,12 @@ class AttachmentsController < ApplicationController
|
||||||
def download
|
def download
|
||||||
# modify by nwb
|
# modify by nwb
|
||||||
# 下载添加权限设置
|
# 下载添加权限设置
|
||||||
|
if (params[:type] && params[:type] == "wechat" )
|
||||||
|
candown = true
|
||||||
|
else
|
||||||
candown = attachment_candown @attachment
|
candown = attachment_candown @attachment
|
||||||
|
end
|
||||||
|
|
||||||
if candown || User.current.admin? || User.current.id == @attachment.author_id
|
if candown || User.current.admin? || User.current.id == @attachment.author_id
|
||||||
if stale?(:etag => @attachment.digest)
|
if stale?(:etag => @attachment.digest)
|
||||||
if params[:preview] == 'true'
|
if params[:preview] == 'true'
|
||||||
|
@ -203,16 +209,51 @@ class AttachmentsController < ApplicationController
|
||||||
@attachment.save
|
@attachment.save
|
||||||
@newfiledense = filedense
|
@newfiledense = filedense
|
||||||
end
|
end
|
||||||
if @project
|
if @attachment.container_type == "Project" || @attachment.container_type == "Course"
|
||||||
|
tip_attachment_update
|
||||||
elsif @course
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.js
|
format.js
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def tip_attachment_update
|
||||||
|
if params[:course_id]
|
||||||
|
@tip_all_attachments = Attachment.where(:container_type => "Course", :container_id => params[:course_id])
|
||||||
|
@tip_all_public_attachments = Attachment.where(:container_type => "Course", :container_id => params[:course_id], :is_public => 1)
|
||||||
|
@tip_all_private_attachments = Attachment.where(:container_type => "Course", :container_id => params[:course_id], :is_public => 0)
|
||||||
|
@course = Course.find(params[:course_id])
|
||||||
|
elsif params[:project_id]
|
||||||
|
@tip_all_attachments = Attachment.where(:container_type => "Project", :container_id => params[:project_id])
|
||||||
|
@tip_all_public_attachments = Attachment.where(:container_type => "Project", :container_id => params[:project_id], :is_public => 1)
|
||||||
|
@tip_all_private_attachments = Attachment.where(:container_type => "Project", :container_id => params[:project_id], :is_public => 0)
|
||||||
|
@project = Project.find(params[:project_id])
|
||||||
|
end
|
||||||
|
@tag_name = params[:tag_name]
|
||||||
|
@other = params[:other]
|
||||||
|
unless @tag_name.blank?
|
||||||
|
if @other
|
||||||
|
if @project
|
||||||
|
@tip_all_attachments = @tip_all_attachments.select{|attachment| !attachment.tag_list.include?('软件版本') && !attachment.tag_list.include?('文档') && !attachment.tag_list.include?('代码') && !attachment.tag_list.include?('媒体') && !attachment.tag_list.include?('论文') }
|
||||||
|
@tip_all_public_attachments = @tip_all_public_attachments.select{|attachment| !attachment.tag_list.include?('软件版本') && !attachment.tag_list.include?('文档') && !attachment.tag_list.include?('代码') && !attachment.tag_list.include?('媒体') && !attachment.tag_list.include?('论文') }
|
||||||
|
@tip_all_private_attachments = @tip_all_private_attachments.select{|attachment| !attachment.tag_list.include?('软件版本') && !attachment.tag_list.include?('文档') && !attachment.tag_list.include?('代码') && !attachment.tag_list.include?('媒体') && !attachment.tag_list.include?('论文') }
|
||||||
|
elsif @course
|
||||||
|
@tip_all_attachments = @tip_all_attachments.select{|attachment| !attachment.tag_list.include?('课件') && !attachment.tag_list.include?('软件') && !attachment.tag_list.include?('媒体') && !attachment.tag_list.include?('代码') && !attachment.tag_list.include?('论文') }
|
||||||
|
@tip_all_public_attachments = @tip_all_public_attachments.select{|attachment| !attachment.tag_list.include?('课件') && !attachment.tag_list.include?('软件') && !attachment.tag_list.include?('媒体') && !attachment.tag_list.include?('代码') && !attachment.tag_list.include?('论文') }
|
||||||
|
@tip_all_private_attachments = @tip_all_private_attachments.select{|attachment| !attachment.tag_list.include?('课件') && !attachment.tag_list.include?('软件') && !attachment.tag_list.include?('媒体') && !attachment.tag_list.include?('代码') && !attachment.tag_list.include?('论文') }
|
||||||
|
end
|
||||||
|
else
|
||||||
|
@tip_all_attachments = @tip_all_attachments.select{|attachment| attachment.tag_list.include?(@tag_name)}
|
||||||
|
@tip_all_public_attachments = @tip_all_public_attachments.select{|attachment| attachment.tag_list.include?(@tag_name)}
|
||||||
|
@tip_all_private_attachments = @tip_all_private_attachments.select{|attachment| attachment.tag_list.include?(@tag_name)}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
@tip_all_attachments = @tip_all_attachments.count
|
||||||
|
@tip_all_public_attachments = @tip_all_public_attachments.count
|
||||||
|
@tip_all_private_attachments = @tip_all_private_attachments.count
|
||||||
|
end
|
||||||
|
|
||||||
def thumbnail
|
def thumbnail
|
||||||
if @attachment.thumbnailable? && thumbnail = @attachment.thumbnail(:size => params[:size])
|
if @attachment.thumbnailable? && thumbnail = @attachment.thumbnail(:size => params[:size])
|
||||||
if stale?(:etag => thumbnail)
|
if stale?(:etag => thumbnail)
|
||||||
|
@ -281,6 +322,7 @@ class AttachmentsController < ApplicationController
|
||||||
@attachment.delete
|
@attachment.delete
|
||||||
@flag = true
|
@flag = true
|
||||||
end
|
end
|
||||||
|
# tip_attachment_update
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.js
|
format.js
|
||||||
|
@ -673,7 +715,7 @@ class AttachmentsController < ApplicationController
|
||||||
def has_login
|
def has_login
|
||||||
unless (@attachment && @attachment.container_type == "Organization").nil?
|
unless (@attachment && @attachment.container_type == "Organization").nil?
|
||||||
unless (@attachment && @attachment.container_type == "PhoneAppVersion").nil?
|
unless (@attachment && @attachment.container_type == "PhoneAppVersion").nil?
|
||||||
render_403 if !User.current.logged? && !(@attachment.container_type == 'OrgSubfield' && @attachment.container.organization.allow_guest_download) && !(@attachment.container_type == 'OrgDocumentComment' && @attachment.container.organization.allow_guest_download)
|
render_403 if (!User.current.logged? && !(params[:type] && params[:type] == "wechat")) && !(@attachment.container_type == 'OrgSubfield' && @attachment.container.organization.allow_guest_download) && !(@attachment.container_type == 'OrgDocumentComment' && @attachment.container.organization.allow_guest_download)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -40,7 +40,7 @@ class AvatarController < ApplicationController
|
||||||
@urlfile='/' << File.join("images","avatars",avatar_directory(@source_type),avatar_filename(@source_id,@image_file))
|
@urlfile='/' << File.join("images","avatars",avatar_directory(@source_type),avatar_filename(@source_id,@image_file))
|
||||||
|
|
||||||
# 用户头像上传时进行特别处理
|
# 用户头像上传时进行特别处理
|
||||||
if @is_direct == '1' && (@source_type == 'User' || @source_type == 'Course' || @source_type == 'Project')
|
if @is_direct == '1' && (@source_type == 'User' || @source_type == 'Course' || @source_type == 'Project' || @source_type == 'Organization')
|
||||||
diskfile += "temp"
|
diskfile += "temp"
|
||||||
@urlfile += "temp"
|
@urlfile += "temp"
|
||||||
end
|
end
|
||||||
|
|
|
@ -331,7 +331,7 @@ class CoursesController < ApplicationController
|
||||||
@all_members = searchTeacherAndAssistant(@course)
|
@all_members = searchTeacherAndAssistant(@course)
|
||||||
@members = @all_members
|
@members = @all_members
|
||||||
when '2'
|
when '2'
|
||||||
if @course.open_student == 1 || User.current.member_of_course?(@course)
|
if @course.open_student == 1 || User.current.member_of_course?(@course) || User.current.admin?
|
||||||
@subPage_title = l :label_student_list
|
@subPage_title = l :label_student_list
|
||||||
page = params[:page].nil? ? 0 : (params['page'].to_i - 1)
|
page = params[:page].nil? ? 0 : (params['page'].to_i - 1)
|
||||||
@all_members = student_homework_score(0,page, 10,@score_sort_by,@sort_type)
|
@all_members = student_homework_score(0,page, 10,@score_sort_by,@sort_type)
|
||||||
|
@ -894,12 +894,15 @@ class CoursesController < ApplicationController
|
||||||
# return
|
# return
|
||||||
# end
|
# end
|
||||||
#更新创建课程消息状态
|
#更新创建课程消息状态
|
||||||
create_course_messages = @course.course_messages.where("user_id =? and course_message_type =? and course_id =? and viewed =?", User.current.id, 'Course', @course.id, 0)
|
course_request_messages = CourseMessage.where(:user_id => User.current.id, :course_id => @course.id, :course_message_type => ["CourseRequestDealResult", "Course"], :viewed => false)
|
||||||
create_course_messages.update_all(:viewed => true)
|
course_request_messages.update_all(:viewed => true)
|
||||||
|
|
||||||
|
# create_course_messages = @course.course_messages.where("user_id =? and course_message_type =? and course_id =? and viewed =?", User.current.id, 'Course', @course.id, 0)
|
||||||
|
# create_course_messages.update_all(:viewed => true)
|
||||||
|
|
||||||
#更新申请结果反馈消息的状态
|
#更新申请结果反馈消息的状态
|
||||||
course_request_messages = CourseMessage.where("user_id =? and course_id =? and course_message_type =? and viewed =?", User.current.id, @course.id, 'CourseRequestDealResult', false)
|
# course_request_messages = CourseMessage.where("user_id =? and course_id =? and course_message_type =? and viewed =?", User.current.id, @course.id, 'CourseRequestDealResult', false)
|
||||||
course_request_messages.update_all(:viewed => true)
|
# course_request_messages.update_all(:viewed => true)
|
||||||
|
|
||||||
course_activities = @course.course_activities
|
course_activities = @course.course_activities
|
||||||
@canShowRealName = User.current.member_of_course? @course
|
@canShowRealName = User.current.member_of_course? @course
|
||||||
|
|
|
@ -90,6 +90,7 @@ class FilesController < ApplicationController
|
||||||
@tag_list = get_course_tag_list @course
|
@tag_list = get_course_tag_list @course
|
||||||
end
|
end
|
||||||
@all_attachments = @result
|
@all_attachments = @result
|
||||||
|
get_attachment_for_tip(@all_attachments)
|
||||||
@limit = 10
|
@limit = 10
|
||||||
@feedback_count = @all_attachments.count
|
@feedback_count = @all_attachments.count
|
||||||
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
|
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
|
||||||
|
@ -164,6 +165,7 @@ class FilesController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
@all_attachments = @project_attachment_result
|
@all_attachments = @project_attachment_result
|
||||||
|
get_attachment_for_tip(@all_attachments)
|
||||||
@limit = 10
|
@limit = 10
|
||||||
@feedback_count = @all_attachments.count
|
@feedback_count = @all_attachments.count
|
||||||
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
|
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
|
||||||
|
@ -325,7 +327,7 @@ class FilesController < ApplicationController
|
||||||
@containers = [ Project.includes(:attachments).reorder(sort).find(@project.id)]
|
@containers = [ Project.includes(:attachments).reorder(sort).find(@project.id)]
|
||||||
|
|
||||||
show_attachments @containers
|
show_attachments @containers
|
||||||
# get_attachment_for_tip(@all_attachments)
|
get_attachment_for_tip(@all_attachments)
|
||||||
|
|
||||||
@tag_list = attachment_tag_list @all_attachments
|
@tag_list = attachment_tag_list @all_attachments
|
||||||
|
|
||||||
|
@ -378,7 +380,7 @@ class FilesController < ApplicationController
|
||||||
@containers = [ Course.includes(:attachments).reorder(sort).find(@course.id)]
|
@containers = [ Course.includes(:attachments).reorder(sort).find(@course.id)]
|
||||||
|
|
||||||
show_attachments @containers
|
show_attachments @containers
|
||||||
# get_attachment_for_tip(@all_attachments)
|
get_attachment_for_tip(@all_attachments)
|
||||||
|
|
||||||
@tag_list = attachment_tag_list @all_attachments
|
@tag_list = attachment_tag_list @all_attachments
|
||||||
|
|
||||||
|
|
|
@ -85,7 +85,16 @@ class HomeworkCommonController < ApplicationController
|
||||||
homework_detail_manual = @homework.homework_detail_manual || HomeworkDetailManual.new
|
homework_detail_manual = @homework.homework_detail_manual || HomeworkDetailManual.new
|
||||||
@homework.end_time = params[:homework_common][:end_time] || Time.now
|
@homework.end_time = params[:homework_common][:end_time] || Time.now
|
||||||
@homework.course_id = params[:course_id]
|
@homework.course_id = params[:course_id]
|
||||||
anonymous = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment].to_i : 0
|
if params[:homework_type] && params[:homework_type].to_i != @homework.homework_type
|
||||||
|
if @homework.homework_type == 2
|
||||||
|
@homework.homework_detail_programing.destroy if @homework.homework_detail_programing
|
||||||
|
@homework.homework_tests.destroy_all
|
||||||
|
elsif @homework.homework_type == 3
|
||||||
|
@homework.homework_detail_group.destroy if @homework.homework_detail_group
|
||||||
|
end
|
||||||
|
end
|
||||||
|
@homework.homework_type = params[:homework_type].to_i || @homework.homework_type
|
||||||
|
anonymous = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment].to_i : 1
|
||||||
if anonymous != @homework.anonymous_comment
|
if anonymous != @homework.anonymous_comment
|
||||||
if anonymous == 1
|
if anonymous == 1
|
||||||
homework_detail_manual.ta_proportion = @homework.homework_type == 1 ? 1.0 : 0.4
|
homework_detail_manual.ta_proportion = @homework.homework_type == 1 ? 1.0 : 0.4
|
||||||
|
@ -111,7 +120,7 @@ class HomeworkCommonController < ApplicationController
|
||||||
if @homework.homework_type == 2
|
if @homework.homework_type == 2
|
||||||
@homework.homework_detail_programing ||= HomeworkDetailPrograming.new
|
@homework.homework_detail_programing ||= HomeworkDetailPrograming.new
|
||||||
@homework_detail_programing = @homework.homework_detail_programing
|
@homework_detail_programing = @homework.homework_detail_programing
|
||||||
@homework_detail_programing.language = params[:language_type].to_i
|
@homework_detail_programing.language = params[:language_type].to_i if params[:language_type]
|
||||||
if anonymous != @homework.anonymous_comment
|
if anonymous != @homework.anonymous_comment
|
||||||
if anonymous == 1
|
if anonymous == 1
|
||||||
@homework_detail_programing.ta_proportion = 0.6
|
@homework_detail_programing.ta_proportion = 0.6
|
||||||
|
@ -120,8 +129,8 @@ class HomeworkCommonController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@homework.homework_tests.delete_all
|
@homework.homework_tests.delete_all if params[:program]
|
||||||
inputs = params[:program][:input]
|
inputs = params[:program][:input] if params[:program]
|
||||||
if Array === inputs
|
if Array === inputs
|
||||||
inputs.each_with_index do |val, i|
|
inputs.each_with_index do |val, i|
|
||||||
@homework.homework_tests << HomeworkTest.new(
|
@homework.homework_tests << HomeworkTest.new(
|
||||||
|
@ -136,12 +145,12 @@ class HomeworkCommonController < ApplicationController
|
||||||
if @homework.homework_type == 3
|
if @homework.homework_type == 3
|
||||||
@homework.homework_detail_group ||= HomeworkDetailGroup.new
|
@homework.homework_detail_group ||= HomeworkDetailGroup.new
|
||||||
@homework_detail_group = @homework.homework_detail_group
|
@homework_detail_group = @homework.homework_detail_group
|
||||||
@homework_detail_group.min_num = params[:min_num].to_i
|
@homework_detail_group.min_num = params[:min_num].to_i if params[:min_num]
|
||||||
@homework_detail_group.max_num = params[:max_num].to_i
|
@homework_detail_group.max_num = params[:max_num].to_i if params[:max_num]
|
||||||
@homework_detail_group.base_on_project = params[:base_on_project].to_i
|
@homework_detail_group.base_on_project = params[:base_on_project].to_i if params[:base_on_project]
|
||||||
end
|
end
|
||||||
|
|
||||||
@homework.anonymous_comment = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment].to_i : 0
|
@homework.anonymous_comment = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment].to_i : 1
|
||||||
if @homework.save
|
if @homework.save
|
||||||
homework_detail_manual.save if homework_detail_manual
|
homework_detail_manual.save if homework_detail_manual
|
||||||
@homework_detail_programing.save if @homework_detail_programing
|
@homework_detail_programing.save if @homework_detail_programing
|
||||||
|
|
|
@ -132,16 +132,13 @@ class IssuesController < ApplicationController
|
||||||
User.current.at_messages.unviewed('Journal', j.id).each {|x| x.viewed!}
|
User.current.at_messages.unviewed('Journal', j.id).each {|x| x.viewed!}
|
||||||
end
|
end
|
||||||
|
|
||||||
# 缺陷状态更新
|
# 缺陷状态消息更新
|
||||||
query_journals = @issue.journals
|
query_journals_ids = @issue.journals.map{|journal| journal.id}
|
||||||
query_journals.each do |query_journal|
|
if query_journals_ids.length > 0
|
||||||
query_journal.forge_messages.each do |f|
|
query_journals = ForgeMessage.where("user_id =? and forge_message_type =? and forge_message_id in (#{query_journals_ids.join(",")})", User.current.id, "Journal")
|
||||||
if User.current.id == f.user_id
|
query_journals.update_all(:viewed => true)
|
||||||
f.update_attributes(:viewed => true)
|
|
||||||
end
|
end
|
||||||
end
|
|
||||||
end
|
|
||||||
# end
|
|
||||||
@jour_reply = Journal.new
|
@jour_reply = Journal.new
|
||||||
@journals = @issue.journals.includes(:user, :details).reorder("#{Journal.table_name}.id ASC").all
|
@journals = @issue.journals.includes(:user, :details).reorder("#{Journal.table_name}.id ASC").all
|
||||||
@journals.each_with_index {|j,i| j.indice = i+1}
|
@journals.each_with_index {|j,i| j.indice = i+1}
|
||||||
|
@ -183,6 +180,7 @@ class IssuesController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# 用户发布新issue
|
||||||
def create
|
def create
|
||||||
call_hook(:controller_issues_new_before_save, { :params => params, :issue => @issue })
|
call_hook(:controller_issues_new_before_save, { :params => params, :issue => @issue })
|
||||||
@issue.save_attachments(params[:attachments] || (params[:issue] && params[:issue][:uploads]))
|
@issue.save_attachments(params[:attachments] || (params[:issue] && params[:issue][:uploads]))
|
||||||
|
@ -196,8 +194,9 @@ class IssuesController < ApplicationController
|
||||||
priority_id = params[:issue][:priority_id]
|
priority_id = params[:issue][:priority_id]
|
||||||
|
|
||||||
ps = ProjectsService.new
|
ps = ProjectsService.new
|
||||||
|
if senduser.id != User.current.id
|
||||||
ps.send_wechat_project_issue_notice senduser,@issue.project,issue_id,issue_title,priority_id
|
ps.send_wechat_project_issue_notice senduser,@issue.project,issue_id,issue_title,priority_id
|
||||||
|
end
|
||||||
call_hook(:controller_issues_new_after_save, { :params => params, :issue => @issue})
|
call_hook(:controller_issues_new_after_save, { :params => params, :issue => @issue})
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html {
|
format.html {
|
||||||
|
@ -224,6 +223,7 @@ class IssuesController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
|
# 修改实例变量的值
|
||||||
return unless update_issue_from_params
|
return unless update_issue_from_params
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
|
@ -232,6 +232,7 @@ class IssuesController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# 用户编辑更改issue
|
||||||
def update
|
def update
|
||||||
if params[:issue_detail]
|
if params[:issue_detail]
|
||||||
issue = Issue.find(params[:id])
|
issue = Issue.find(params[:id])
|
||||||
|
@ -239,6 +240,7 @@ class IssuesController < ApplicationController
|
||||||
@saved = update_user_issue_detail(issue, params)
|
@saved = update_user_issue_detail(issue, params)
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
|
# 修改实例变量的值
|
||||||
return unless update_issue_from_params
|
return unless update_issue_from_params
|
||||||
@issue.save_attachments(params[:attachments] || (params[:issue] && params[:issue][:uploads]))
|
@issue.save_attachments(params[:attachments] || (params[:issue] && params[:issue][:uploads]))
|
||||||
saved = false
|
saved = false
|
||||||
|
@ -574,6 +576,7 @@ class IssuesController < ApplicationController
|
||||||
@time_entry = TimeEntry.new(:issue => @issue, :project => @issue.project)
|
@time_entry = TimeEntry.new(:issue => @issue, :project => @issue.project)
|
||||||
@time_entry.attributes = params[:time_entry]
|
@time_entry.attributes = params[:time_entry]
|
||||||
|
|
||||||
|
# 更新issue状态时,journal表产生记录,返回@current_journal
|
||||||
@issue.init_journal(User.current)
|
@issue.init_journal(User.current)
|
||||||
|
|
||||||
issue_attributes = params[:issue]
|
issue_attributes = params[:issue]
|
||||||
|
@ -589,19 +592,19 @@ class IssuesController < ApplicationController
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@issue.safe_attributes = issue_attributes
|
|
||||||
|
|
||||||
senduser = User.find(params[:issue][:assigned_to_id])
|
senduser = User.find(params[:issue][:assigned_to_id])
|
||||||
|
|
||||||
if senduser.id != User.current.id
|
if senduser.id != User.current.id && @issue.assigned_to_id != params[:issue][:assigned_to_id].to_i
|
||||||
issue_id = @issue.id
|
issue_id = @issue.id
|
||||||
issue_title = params[:issue][:subject]
|
issue_title = params[:issue][:subject]
|
||||||
priority_id = params[:issue][:priority_id]
|
priority_id = params[:issue][:priority_id]
|
||||||
|
|
||||||
ps = ProjectsService.new
|
ps = ProjectsService.new
|
||||||
ps.send_wechat_project_issue_notice senduser,@issue.project,issue_id,issue_title,priority_id
|
ps.send_wechat_project_issue_notice senduser,@issue.project,issue_id,issue_title,priority_id
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@issue.safe_attributes = issue_attributes
|
||||||
|
|
||||||
@priorities = IssuePriority.active
|
@priorities = IssuePriority.active
|
||||||
@allowed_statuses = @issue.new_statuses_allowed_to(User.current)
|
@allowed_statuses = @issue.new_statuses_allowed_to(User.current)
|
||||||
true
|
true
|
||||||
|
|
|
@ -92,7 +92,13 @@ class MessagesController < ApplicationController
|
||||||
@message.board = @board
|
@message.board = @board
|
||||||
@message.safe_attributes = params[:message]
|
@message.safe_attributes = params[:message]
|
||||||
if request.post?
|
if request.post?
|
||||||
@message.save_attachments(params[:attachments])
|
if @project
|
||||||
|
is_public = @project.is_public
|
||||||
|
elsif @course
|
||||||
|
is_public = @course.is_public
|
||||||
|
end
|
||||||
|
# 公开项目/课程上传的资源是公开的,私有项目上传的是私有的
|
||||||
|
@message.save_attachments_containers(params[:attachments], User.current, is_public)
|
||||||
if @message.save
|
if @message.save
|
||||||
# 更新kindeditor上传的图片资源所有者
|
# 更新kindeditor上传的图片资源所有者
|
||||||
if params[:asset_id]
|
if params[:asset_id]
|
||||||
|
|
|
@ -96,6 +96,9 @@ class MyController < ApplicationController
|
||||||
elsif params[:project]
|
elsif params[:project]
|
||||||
@project = Project.find params[:project]
|
@project = Project.find params[:project]
|
||||||
diskfile = disk_filename('Project', @project.id)
|
diskfile = disk_filename('Project', @project.id)
|
||||||
|
elsif params[:organization]
|
||||||
|
@organization = Organization.find params[:organization]
|
||||||
|
diskfile = disk_filename('Organization', @organization.id)
|
||||||
else
|
else
|
||||||
@user = User.current
|
@user = User.current
|
||||||
diskfile = disk_filename('User', @user.id)
|
diskfile = disk_filename('User', @user.id)
|
||||||
|
@ -116,6 +119,9 @@ class MyController < ApplicationController
|
||||||
when 'Project'
|
when 'Project'
|
||||||
@project = Project.find params[:source_id]
|
@project = Project.find params[:source_id]
|
||||||
diskfile = disk_filename('Project', @project.id)
|
diskfile = disk_filename('Project', @project.id)
|
||||||
|
when 'Organization'
|
||||||
|
@organization = Organization.find params[:source_id]
|
||||||
|
diskfile = disk_filename('Organization', @organization.id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
diskfile1 = diskfile + 'temp'
|
diskfile1 = diskfile + 'temp'
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#encoding: utf-8
|
||||||
# Redmine - project management software
|
# Redmine - project management software
|
||||||
# Copyright (C) 2006-2013 Jean-Philippe Lang
|
# Copyright (C) 2006-2013 Jean-Philippe Lang
|
||||||
#
|
#
|
||||||
|
@ -212,6 +213,19 @@ class NewsController < ApplicationController
|
||||||
@news.safe_attributes = params[:news]
|
@news.safe_attributes = params[:news]
|
||||||
@news.save_attachments(params[:attachments])
|
@news.save_attachments(params[:attachments])
|
||||||
if @news.save
|
if @news.save
|
||||||
|
@course.members.each do |m|
|
||||||
|
if m.user_id != User.current.id
|
||||||
|
#self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.course_id, :viewed => false)
|
||||||
|
count = ShieldWechatMessage.where("container_type='User' and container_id=#{m.user_id} and shield_type='Course' and shield_id=#{@news.course_id}").count
|
||||||
|
if count == 0
|
||||||
|
ws = WechatService.new
|
||||||
|
content = @news.title
|
||||||
|
name = @news.course.syllabus.nil? ? @news.course.name : @news.course.syllabus.title+" • "+@news.course.name
|
||||||
|
ws.class_notice m.user_id, "course_notice", @news.id, "#{l(:label_new_notice_template)}", name, @news.author.show_name, format_time(@news.created_on), content, "点击查看通知详情"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if params[:asset_id]
|
if params[:asset_id]
|
||||||
ids = params[:asset_id].split(',')
|
ids = params[:asset_id].split(',')
|
||||||
update_kindeditor_assets_owner ids,@news.id,OwnerTypeHelper::NEWS
|
update_kindeditor_assets_owner ids,@news.id,OwnerTypeHelper::NEWS
|
||||||
|
|
|
@ -8,18 +8,33 @@ class OrgMemberController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# 组织子成员,及其分页
|
||||||
|
def org_member_paging
|
||||||
|
@organization = Organization.find(params[:org])
|
||||||
|
|
||||||
|
if User.current.admin? || User.current.admin_of_org?(@organization)
|
||||||
|
@members = OrgMember.where(:organization_id => @organization.id).all.sort
|
||||||
|
@members = paginateHelper @members, 20
|
||||||
|
respond_to do |format|
|
||||||
|
format.js
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
@org = Organization.find(params[:org])
|
@organization = Organization.find(params[:org])
|
||||||
if params[:membership].nil?
|
if params[:membership].nil?
|
||||||
@fail_hint = l(:label_blank_user_lists_for_org)
|
@fail_hint = l(:label_blank_user_lists_for_org)
|
||||||
else
|
else
|
||||||
member_ids = params[:membership][:user_ids]
|
member_ids = params[:membership][:user_ids]
|
||||||
role_id = params[:orgRole]
|
role_id = params[:orgRole]
|
||||||
member_ids.each do |user_id|
|
member_ids.each do |user_id|
|
||||||
member = OrgMember.create(:user_id=>user_id, :created_at => Time.now)
|
member = OrgMember.create(:user_id => user_id, :created_at => Time.now)
|
||||||
@org.org_members << member
|
@organization.org_members << member
|
||||||
OrgMemberRole.create(:org_member_id => member.id, :role_id => role_id)
|
OrgMemberRole.create(:org_member_id => member.id, :role_id => role_id)
|
||||||
end
|
end
|
||||||
|
@members = (@organization.org_members).sort
|
||||||
|
@members = paginateHelper @members, 20
|
||||||
end
|
end
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.js
|
format.js
|
||||||
|
@ -32,7 +47,11 @@ class OrgMemberController < ApplicationController
|
||||||
@member_role = @member.org_member_roles[0]
|
@member_role = @member.org_member_roles[0]
|
||||||
@member_role.role_id = params[:org_member][:role_ids][0]
|
@member_role.role_id = params[:org_member][:role_ids][0]
|
||||||
@member_role.save
|
@member_role.save
|
||||||
@org = @member.organization
|
@organization = @member.organization
|
||||||
|
# 成员编辑角色后分页
|
||||||
|
@members = (@organization.org_members).sort
|
||||||
|
@members = paginateHelper @members, 20
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.js
|
format.js
|
||||||
end
|
end
|
||||||
|
@ -44,8 +63,10 @@ class OrgMemberController < ApplicationController
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
member = OrgMember.find(params[:id])
|
member = OrgMember.find(params[:id])
|
||||||
@org = member.organization
|
@organization = member.organization
|
||||||
member.destroy
|
member.destroy
|
||||||
|
@members = (@organization.org_members).sort
|
||||||
|
@members = paginateHelper @members, 20
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.js
|
format.js
|
||||||
end
|
end
|
||||||
|
|
|
@ -88,7 +88,7 @@ class OrganizationsController < ApplicationController
|
||||||
shield_project_ids = ShieldActivity.where("container_type='Organization' and container_id=#{@organization.id} and shield_type='Project'").map(&:shield_id)
|
shield_project_ids = ShieldActivity.where("container_type='Organization' and container_id=#{@organization.id} and shield_type='Project'").map(&:shield_id)
|
||||||
shield_course_ids = ShieldActivity.where("container_type='Organization' and container_id=#{@organization.id} and shield_type='Course'").map(&:shield_id)
|
shield_course_ids = ShieldActivity.where("container_type='Organization' and container_id=#{@organization.id} and shield_type='Course'").map(&:shield_id)
|
||||||
project_ids = (@organization.projects.map(&:id) - shield_project_ids) << 0
|
project_ids = (@organization.projects.map(&:id) - shield_project_ids) << 0
|
||||||
course_ids = (@organization.courses.map(&:id) - shield_course_ids) << 0
|
course_ids = (@organization.courses.not_deleted.map(&:id) - shield_course_ids) << 0
|
||||||
course_types = "('Message','News','HomeworkCommon','Poll','Course')"
|
course_types = "('Message','News','HomeworkCommon','Poll','Course')"
|
||||||
@project_acts = get_project_activities_org @organization, project_ids
|
@project_acts = get_project_activities_org @organization, project_ids
|
||||||
@course_acts = get_course_activities_org @organization, course_ids
|
@course_acts = get_course_activities_org @organization, course_ids
|
||||||
|
@ -140,7 +140,7 @@ class OrganizationsController < ApplicationController
|
||||||
shield_project_ids = ShieldActivity.where("container_type='Organization' and container_id=#{@organization.id} and shield_type='Project'").map(&:shield_id)
|
shield_project_ids = ShieldActivity.where("container_type='Organization' and container_id=#{@organization.id} and shield_type='Project'").map(&:shield_id)
|
||||||
shield_course_ids = ShieldActivity.where("container_type='Organization' and container_id=#{@organization.id} and shield_type='Course'").map(&:shield_id)
|
shield_course_ids = ShieldActivity.where("container_type='Organization' and container_id=#{@organization.id} and shield_type='Course'").map(&:shield_id)
|
||||||
project_ids = (@organization.projects.map(&:id)-shield_project_ids) << 0
|
project_ids = (@organization.projects.map(&:id)-shield_project_ids) << 0
|
||||||
course_ids = (@organization.courses.map(&:id)-shield_course_ids) << 0
|
course_ids = (@organization.courses.not_deleted.map(&:id)-shield_course_ids) << 0
|
||||||
course_types = "('Message','News','HomeworkCommon','Poll','Course')"
|
course_types = "('Message','News','HomeworkCommon','Poll','Course')"
|
||||||
case params[:type]
|
case params[:type]
|
||||||
when nil
|
when nil
|
||||||
|
@ -421,6 +421,8 @@ class OrganizationsController < ApplicationController
|
||||||
@organization = Organization.find(params[:id])
|
@organization = Organization.find(params[:id])
|
||||||
|
|
||||||
if User.current.admin? || User.current.admin_of_org?(@organization)
|
if User.current.admin? || User.current.admin_of_org?(@organization)
|
||||||
|
@members = OrgMember.where(:organization_id => @organization.id).all.sort
|
||||||
|
@members = paginateHelper @members, 20
|
||||||
else
|
else
|
||||||
render_403
|
render_403
|
||||||
end
|
end
|
||||||
|
@ -451,10 +453,11 @@ class OrganizationsController < ApplicationController
|
||||||
|
|
||||||
def members
|
def members
|
||||||
if @organization.is_public? || User.current.admin? || User.current.member_of_org?(@organization)
|
if @organization.is_public? || User.current.admin? || User.current.member_of_org?(@organization)
|
||||||
@members = OrgMember.where("organization_id =?", @organization.id)
|
@members = OrgMember.where(:organization_id => @organization.id).all.sort
|
||||||
else
|
else
|
||||||
render_403
|
render_403
|
||||||
end
|
end
|
||||||
|
@members = paginateHelper @members, 20
|
||||||
end
|
end
|
||||||
|
|
||||||
def more_org_projects
|
def more_org_projects
|
||||||
|
|
|
@ -325,27 +325,27 @@ class ProjectsController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
# 版本库统计图
|
# 版本库统计图
|
||||||
unless @project.gpid.nil? || @project.project_score.changeset_num == 0
|
# unless @project.gpid.nil? || @project.project_score.changeset_num == 0
|
||||||
# rep_statics_commit = @project.rep_statics.order("commits_num desc")
|
# # rep_statics_commit = @project.rep_statics.order("commits_num desc")
|
||||||
rep_statics_commit = RepStatics.find_by_sql("SELECT * FROM `rep_statics` where project_id = #{@project.id} order by commits_num desc limit 10")
|
# rep_statics_commit = RepStatics.find_by_sql("SELECT * FROM `rep_statics` where project_id = #{@project.id} order by commits_num desc limit 10")
|
||||||
rep_statics_code = RepStatics.find_by_sql("SELECT * FROM `rep_statics` where project_id = #{@project.id} order by changeset desc limit 10")
|
# rep_statics_code = RepStatics.find_by_sql("SELECT * FROM `rep_statics` where project_id = #{@project.id} order by changeset desc limit 10")
|
||||||
# rep_statics_code = @project.rep_statics.sort_by {|u| u.changeset}.reverse
|
# # rep_statics_code = @project.rep_statics.sort_by {|u| u.changeset}.reverse
|
||||||
@a_uname = rep_statics_commit.map {|s| s.uname }
|
# @a_uname = rep_statics_commit.map {|s| s.uname }
|
||||||
@a_uname_code = rep_statics_code.map {|s| s.uname }
|
# @a_uname_code = rep_statics_code.map {|s| s.uname }
|
||||||
@a_commits_num = rep_statics_commit.map {|s| s.commits_num.to_i }
|
# @a_commits_num = rep_statics_commit.map {|s| s.commits_num.to_i }
|
||||||
@a_commits_add = rep_statics_code.map {|s| s.add.to_i }
|
# @a_commits_add = rep_statics_code.map {|s| s.add.to_i }
|
||||||
@a_commits_del = rep_statics_code.map {|s| s.del.to_i }
|
# @a_commits_del = rep_statics_code.map {|s| s.del.to_i }
|
||||||
@a_commits_changeset = rep_statics_code.map {|s| s.changeset.to_i }
|
# @a_commits_changeset = rep_statics_code.map {|s| s.changeset.to_i }
|
||||||
g = Gitlab.client
|
# g = Gitlab.client
|
||||||
begin
|
# begin
|
||||||
gid = @project.gpid
|
# gid = @project.gpid
|
||||||
g_project = g.project(gid)
|
# g_project = g.project(gid)
|
||||||
g_branch = g_project.default_branch.to_s
|
# g_branch = g_project.default_branch.to_s
|
||||||
rescue =>e
|
# rescue =>e
|
||||||
logger.error("get default branch failed: " + e)
|
# logger.error("get default branch failed: " + e)
|
||||||
end
|
# end
|
||||||
@rev = g_branch.nil? ? "master" : g_branch
|
# @rev = g_branch.nil? ? "master" : g_branch
|
||||||
end
|
# end
|
||||||
# 根据对应的请求,返回对应的数据
|
# 根据对应的请求,返回对应的数据
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html
|
format.html
|
||||||
|
@ -580,6 +580,7 @@ class ProjectsController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@members = paginateHelper @members
|
@members = paginateHelper @members
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_message_status(user, project)
|
def update_message_status(user, project)
|
||||||
|
|
|
@ -16,8 +16,8 @@ class QualityAnalysisController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
# params 说明:{identifier:版本库名}
|
# params 说明:{identifier:版本库名}
|
||||||
|
# type: 1 新的分析 2 重新分析
|
||||||
def create
|
def create
|
||||||
logger.info("11111111111111111111111111111")
|
|
||||||
begin
|
begin
|
||||||
user_name = User.find(params[:user_id]).try(:login)
|
user_name = User.find(params[:user_id]).try(:login)
|
||||||
identifier = params[:identifier]
|
identifier = params[:identifier]
|
||||||
|
@ -30,22 +30,26 @@ class QualityAnalysisController < ApplicationController
|
||||||
# 考虑到历史数据:有些用户创建类job但是build失败,即sonar没有结果,这个时候需要把job删除,并且删掉quality_analyses表数据
|
# 考虑到历史数据:有些用户创建类job但是build失败,即sonar没有结果,这个时候需要把job删除,并且删掉quality_analyses表数据
|
||||||
# 如果不要这句则需要迁移数据
|
# 如果不要这句则需要迁移数据
|
||||||
@sonar_address = Redmine::Configuration['sonar_address']
|
@sonar_address = Redmine::Configuration['sonar_address']
|
||||||
projects_date = open(@sonar_address + "/api/projects/index").read
|
# projects_date = open(@sonar_address + "/api/projects/index").read
|
||||||
arr = JSON.parse(projects_date).map {|m| m["nm"]} # eg: ["Hjqreturn:cc_rep", "Hjqreturn:putong", "Hjqreturn:sonar_rep2", "shitou:sonar_rep"]
|
# arr = JSON.parse(projects_date).map {|m| m["nm"]} # eg: ["Hjqreturn:cc_rep", "Hjqreturn:putong", "Hjqreturn:sonar_rep2", "shitou:sonar_rep"]
|
||||||
quality_an = QualityAnalysis.where(:sonar_name => sonar_name).first
|
quality_an = QualityAnalysis.where(:sonar_name => sonar_name)
|
||||||
if @client_jenkins.job.exists?(job_name) && QualityAnalysis.where(:sonar_name => sonar_name).select{|qa| arr.include?(qa.sonar_name)}.blank?
|
# if @client_jenkins.job.exists?(job_name) && QualityAnalysis.where(:sonar_name => sonar_name).select{|qa| arr.include?(qa.sonar_name)}.blank?
|
||||||
aa = @client_jenkins.job.delete("#{job_name}")
|
# aa = @client_jenkins.job.delete("#{job_name}")
|
||||||
quality_an.delete unless quality_an.blank?
|
# quality_an.delete unless quality_an.blank?
|
||||||
end
|
# end
|
||||||
|
|
||||||
|
# type 1的时候之所以判断job是否存在,为了防止特殊情况,正常情况是不会出现的
|
||||||
|
# 重新分析的时候需要删除以前的分析结果
|
||||||
|
@client_jenkins.job.delete("#{job_name}") if @client_jenkins.job.exists?(job_name)
|
||||||
|
quality_an.delete_all unless quality_an.blank?
|
||||||
|
|
||||||
# Checks if the given job exists in Jenkins.
|
# Checks if the given job exists in Jenkins.
|
||||||
unless @client_jenkins.job.exists?(job_name)
|
|
||||||
@g = Gitlab.client
|
@g = Gitlab.client
|
||||||
branch = params[:branch]
|
branch = params[:branch]
|
||||||
language = swith_language_type(params[:language])
|
language = swith_language_type(params[:language])
|
||||||
path = params[:path].blank? ? "./" : params[:path]
|
path = params[:path].blank? ? "./" : params[:path]
|
||||||
# qa = QualityAnalysis.where(:project_id => @project.id, :author_login => user_name).first
|
# qa = QualityAnalysis.where(:project_id => @project.id, :author_login => user_name).first
|
||||||
version = quality_an.nil? ? 1 : quality_an.sonar_version + 1
|
version = 1
|
||||||
properties = "sonar.projectKey=#{sonar_name}
|
properties = "sonar.projectKey=#{sonar_name}
|
||||||
sonar.projectName=#{sonar_name}
|
sonar.projectName=#{sonar_name}
|
||||||
sonar.projectVersion=#{version}
|
sonar.projectVersion=#{version}
|
||||||
|
@ -62,13 +66,11 @@ class QualityAnalysisController < ApplicationController
|
||||||
|
|
||||||
# jenkins job创建
|
# jenkins job创建
|
||||||
jenkins_job = @client_jenkins.job.create("#{job_name}", @doc.to_xml)
|
jenkins_job = @client_jenkins.job.create("#{job_name}", @doc.to_xml)
|
||||||
logger.info("Jenkins status of create ==> #{jenkins_job}")
|
|
||||||
|
|
||||||
# 将地址作为hook值添加到gitlab
|
# 将地址作为hook值添加到gitlab
|
||||||
@g.add_project_hook(@project.gpid, @jenkins_address + "/project/#{job_name}")
|
# @g.add_project_hook(@project.gpid, @jenkins_address + "/project/#{job_name}")
|
||||||
# job创建完成后自动运行job,如果运行成功则返回‘200’
|
# job创建完成后自动运行job,如果运行成功则返回‘200’
|
||||||
code = @client_jenkins.job.build("#{job_name}")
|
code = @client_jenkins.job.build("#{job_name}")
|
||||||
logger.error("build result ==> #{code}")
|
|
||||||
|
|
||||||
# 判断调用sonar分析是否成功
|
# 判断调用sonar分析是否成功
|
||||||
# 等待启动时间处理, 最长时间为30分钟
|
# 等待启动时间处理, 最长时间为30分钟
|
||||||
|
@ -108,8 +110,6 @@ class QualityAnalysisController < ApplicationController
|
||||||
if quality_an.blank?
|
if quality_an.blank?
|
||||||
QualityAnalysis.create(:project_id => @project.id, :author_login => user_name, :rep_identifier => identifier,
|
QualityAnalysis.create(:project_id => @project.id, :author_login => user_name, :rep_identifier => identifier,
|
||||||
:sonar_version => version, :path => path, :branch => branch, :language => language, :sonar_name => "#{user_name}:#{rep_id}")
|
:sonar_version => version, :path => path, :branch => branch, :language => language, :sonar_name => "#{user_name}:#{rep_id}")
|
||||||
else
|
|
||||||
qa.update_attribute(:sonar_version, version)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -121,7 +121,7 @@ class QualityAnalysisController < ApplicationController
|
||||||
format.html{redirect_to error_list_project_quality_analysi_path(:project_id => @project.id, :job_name => job_name)}
|
format.html{redirect_to error_list_project_quality_analysi_path(:project_id => @project.id, :job_name => job_name)}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
rescue => e
|
rescue => e
|
||||||
@message = e.message
|
@message = e.message
|
||||||
logger.error("######################====>#{e.message}")
|
logger.error("######################====>#{e.message}")
|
||||||
|
@ -252,7 +252,7 @@ class QualityAnalysisController < ApplicationController
|
||||||
unresolved_issue_count = JSON.parse(unresolved_issues)["total"].to_i
|
unresolved_issue_count = JSON.parse(unresolved_issues)["total"].to_i
|
||||||
all_issues = open(@sonar_address + "/api/issues/search?projectKeys=#{@resource_id}&authors=#{email}").read
|
all_issues = open(@sonar_address + "/api/issues/search?projectKeys=#{@resource_id}&authors=#{email}").read
|
||||||
all_issue_count = JSON.parse(all_issues)["total"].to_i
|
all_issue_count = JSON.parse(all_issues)["total"].to_i
|
||||||
ratio = (changes == 0 ? 0 : format("%0.4f",unresolved_issue_count.to_f/changes.to_f))
|
ratio = ((changes == 0 || all_issue_count == 0) ? 0 : format("%0.4f",all_issue_count.to_f/changes.to_f))
|
||||||
@user_quality_infos << {:email => email, :changes => changes, :unresolved_issue_count => unresolved_issue_count, :ratio => ratio, :all_issue_count => all_issue_count}
|
@user_quality_infos << {:email => email, :changes => changes, :unresolved_issue_count => unresolved_issue_count, :ratio => ratio, :all_issue_count => all_issue_count}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -302,10 +302,8 @@ class QualityAnalysisController < ApplicationController
|
||||||
@jenkins_address = Redmine::Configuration['jenkins_address']
|
@jenkins_address = Redmine::Configuration['jenkins_address']
|
||||||
jenkins_username = Redmine::Configuration['jenkins_username']
|
jenkins_username = Redmine::Configuration['jenkins_username']
|
||||||
jenkins_password = Redmine::Configuration['jenkins_password']
|
jenkins_password = Redmine::Configuration['jenkins_password']
|
||||||
logger.info("22222222222222222222222222222222")
|
|
||||||
# connect jenkins
|
# connect jenkins
|
||||||
@client_jenkins = JenkinsApi::Client.new(:server_url => @jenkins_address, :username => jenkins_username, :password => jenkins_password)
|
@client_jenkins = JenkinsApi::Client.new(:server_url => @jenkins_address, :username => jenkins_username, :password => jenkins_password)
|
||||||
logger.info("333333333333333333333333333333")
|
|
||||||
rescue => e
|
rescue => e
|
||||||
logger.error("failed to connect Jenkins ==> #{e}")
|
logger.error("failed to connect Jenkins ==> #{e}")
|
||||||
end
|
end
|
||||||
|
|
|
@ -338,41 +338,17 @@ class StudentWorkController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def index
|
def index
|
||||||
# 作业消息状态更新
|
# 作业消息状态更新?
|
||||||
@homework.course_messages.each do |homework_message|
|
homeworkcommon_messages = CourseMessage.where(:user_id => User.current.id, :viewed => 0, :course_message_id => @homework.id, :course_message_type => "HomeWorkCommon")
|
||||||
if User.current.id == homework_message.user_id && homework_message.viewed == 0
|
homeworkcommon_messages.update_all(:viewed => true)
|
||||||
homework_message.update_attributes(:viewed => true) if homework_message.viewed == 0
|
studentwork_messages = CourseMessage.where(:user_id => User.current.id, :viewed => 0, :course_id => @homework.course, :course_message_type => "StudentWork")
|
||||||
end
|
studentwork_messages.update_all(:viewed => true)
|
||||||
end
|
|
||||||
|
|
||||||
#修改作品提示消息更新
|
|
||||||
student_work_messages = CourseMessage.where("user_id =? and course_id =? and course_message_type =? and viewed =?", User.current.id, @homework.course, StudentWork.name, 0)
|
|
||||||
student_work_messages.each do |message|
|
|
||||||
message.update_attribute(:viewed, true)
|
|
||||||
end
|
|
||||||
|
|
||||||
# 作品打分消息状态更新
|
# 作品打分消息状态更新
|
||||||
studentworks_scores = CourseMessage.where("user_id =? and course_id =? and course_message_type =? and viewed =?", User.current.id, @homework.course, "StudentWorksScore", 0)
|
studentworks_scores = CourseMessage.where("user_id =? and course_id =? and course_message_type =? and viewed =?", User.current.id, @homework.course, "StudentWorksScore", 0)
|
||||||
studentworks_scores.each do |studentworks_score|
|
studentworks_scores.update_all(:viewed => true)
|
||||||
studentworks_score.update_attributes(:viewed => true) if studentworks_score.viewed == 0
|
|
||||||
end
|
|
||||||
# 作品评论消息状态更新
|
# 作品评论消息状态更新
|
||||||
journals_for_teacher = CourseMessage.where("user_id =? and course_id =? and course_message_type =? and viewed =?", User.current.id, @homework.course, "JournalsForMessage", 0)
|
journals_for_teacher = CourseMessage.where("user_id =? and course_id =? and course_message_type =? and viewed =?", User.current.id, @homework.course, "JournalsForMessage", 0)
|
||||||
journals_for_teacher.each do |journal_for_teacher|
|
journals_for_teacher.update_all(:viewed => true)
|
||||||
journal_for_teacher.update_attributes(:viewed => true)
|
|
||||||
end
|
|
||||||
#不能参与作业匿评消息状态更新
|
|
||||||
no_evaluation = CourseMessage.where("user_id =? and course_id =? and course_message_type =? and viewed =? and status =?", User.current.id, @homework.course, "StudentWork", 0, 0)
|
|
||||||
no_evaluation.update_all(:viewed => true)
|
|
||||||
# 作品留言
|
|
||||||
# 消息end
|
|
||||||
#设置作业对应的forge_messages表的viewed字段
|
|
||||||
query_student_work = @homework.course_messages
|
|
||||||
query_student_work.each do |query|
|
|
||||||
if User.current.id == query.user_id
|
|
||||||
query.update_attributes(:viewed => true)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
##################################################################################################################
|
##################################################################################################################
|
||||||
@order,@b_sort,@name,@group = params[:order] || "score",params[:sort] || "desc",params[:name].to_s.strip || "",params[:group]
|
@order,@b_sort,@name,@group = params[:order] || "score",params[:sort] || "desc",params[:name].to_s.strip || "",params[:group]
|
||||||
@homework_commons = @course.homework_commons.where("publish_time <= ?",Time.now.strftime("%Y-%m-%d")).order("created_at desc")
|
@homework_commons = @course.homework_commons.where("publish_time <= ?",Time.now.strftime("%Y-%m-%d")).order("created_at desc")
|
||||||
|
@ -410,11 +386,11 @@ class StudentWorkController < ApplicationController
|
||||||
#开放作品 || 老师 || 超级管理员 || 禁用匿评&&作业截止&&已提交作品 显示所有列表
|
#开放作品 || 老师 || 超级管理员 || 禁用匿评&&作业截止&&已提交作品 显示所有列表
|
||||||
if (@homework.is_open == 1 && @course.is_public == 1) || (@homework.is_open == 1 && @course.is_public == 0 && User.current.member_of_course?(@course)) || @is_teacher || User.current.admin? || (User.current.member_of_course?(@course) && @homework.anonymous_comment == 1 && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") && !@homework.student_works.has_committed.where(:user_id => User.current.id).empty?)
|
if (@homework.is_open == 1 && @course.is_public == 1) || (@homework.is_open == 1 && @course.is_public == 0 && User.current.member_of_course?(@course)) || @is_teacher || User.current.admin? || (User.current.member_of_course?(@course) && @homework.anonymous_comment == 1 && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") && !@homework.student_works.has_committed.where(:user_id => User.current.id).empty?)
|
||||||
if @order == 'lastname'
|
if @order == 'lastname'
|
||||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,student_works.work_score as score").joins(:user).where("users.id in #{student_in_group}").order("CONVERT(lastname USING gbk) COLLATE gbk_chinese_ci #{@b_sort}, login #{@b_sort}"),@name
|
@stundet_works = search_homework_member @homework.student_works.no_copy.select("student_works.*,student_works.work_score as score").joins(:user).where("users.id in #{student_in_group}").order("CONVERT(lastname USING gbk) COLLATE gbk_chinese_ci #{@b_sort}, login #{@b_sort}"),@name
|
||||||
elsif @order == 'student_id'
|
elsif @order == 'student_id'
|
||||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,student_works.work_score as score").joins(:user).where("users.id in #{student_in_group}").joins("join user_extensions on student_works.user_id = user_extensions.user_id").order("#{@order} #{@b_sort}"),@name
|
@stundet_works = search_homework_member @homework.student_works.no_copy.select("student_works.*,student_works.work_score as score").joins(:user).where("users.id in #{student_in_group}").joins("join user_extensions on student_works.user_id = user_extensions.user_id").order("#{@order} #{@b_sort}"),@name
|
||||||
else
|
else
|
||||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,student_works.work_score as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name
|
@stundet_works = search_homework_member @homework.student_works.no_copy.select("student_works.*,student_works.work_score as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name
|
||||||
end
|
end
|
||||||
@show_all = true
|
@show_all = true
|
||||||
elsif User.current.member_of_course?(@course)
|
elsif User.current.member_of_course?(@course)
|
||||||
|
@ -476,11 +452,11 @@ class StudentWorkController < ApplicationController
|
||||||
else
|
else
|
||||||
if (@homework.is_open == 1 &&@course.is_public == 1) || (@homework.is_open == 1 && @course.is_public == 0 && User.current.member_of_course?(@course)) || @is_teacher || User.current.admin? || (User.current.member_of_course?(@course) && @homework.anonymous_comment == 1 && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") && !@homework.student_works.has_committed.where(:user_id => User.current.id).empty?)
|
if (@homework.is_open == 1 &&@course.is_public == 1) || (@homework.is_open == 1 && @course.is_public == 0 && User.current.member_of_course?(@course)) || @is_teacher || User.current.admin? || (User.current.member_of_course?(@course) && @homework.anonymous_comment == 1 && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") && !@homework.student_works.has_committed.where(:user_id => User.current.id).empty?)
|
||||||
if @order == 'lastname'
|
if @order == 'lastname'
|
||||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,student_works.work_score as score").joins(:user).order("CONVERT(lastname USING gbk) COLLATE gbk_chinese_ci #{@b_sort}, login #{@b_sort}"),@name
|
@stundet_works = search_homework_member @homework.student_works.no_copy.select("student_works.*,student_works.work_score as score").joins(:user).order("CONVERT(lastname USING gbk) COLLATE gbk_chinese_ci #{@b_sort}, login #{@b_sort}"),@name
|
||||||
elsif @order == 'student_id'
|
elsif @order == 'student_id'
|
||||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,student_works.work_score as score").joins("join user_extensions on student_works.user_id = user_extensions.user_id").order("#{@order} #{@b_sort}"),@name
|
@stundet_works = search_homework_member @homework.student_works.no_copy.select("student_works.*,student_works.work_score as score").joins("join user_extensions on student_works.user_id = user_extensions.user_id").order("#{@order} #{@b_sort}"),@name
|
||||||
else
|
else
|
||||||
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,student_works.work_score as score").order("#{@order} #{@b_sort}"),@name
|
@stundet_works = search_homework_member @homework.student_works.no_copy.select("student_works.*,student_works.work_score as score").includes(:user => {:user_extensions => []}, :project => {}, :student_works_scores => {}).order("#{@order} #{@b_sort}"),@name
|
||||||
end
|
end
|
||||||
@show_all = true
|
@show_all = true
|
||||||
elsif User.current.member_of_course?(@course)
|
elsif User.current.member_of_course?(@course)
|
||||||
|
@ -571,7 +547,7 @@ class StudentWorkController < ApplicationController
|
||||||
@student_work = StudentWork.new
|
@student_work = StudentWork.new
|
||||||
#end
|
#end
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html{ render :layout => "new_base_user"}
|
format.html{ render :layout => "base_courses"}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -613,33 +589,21 @@ class StudentWorkController < ApplicationController
|
||||||
student_work.work_status = 1
|
student_work.work_status = 1
|
||||||
end
|
end
|
||||||
if student_work.save
|
if student_work.save
|
||||||
if @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1
|
if @homework.homework_type == 3
|
||||||
|
if @homework.homework_detail_group.base_on_project == 1
|
||||||
@student_work_project.student_work_id = student_work.id
|
@student_work_project.student_work_id = student_work.id
|
||||||
@student_work_project.save
|
@student_work_project.save
|
||||||
|
elsif @homework.homework_detail_group.base_on_project == 0
|
||||||
|
stu_project = StudentWorkProject.new(:homework_common_id => @homework.id, :student_work_id => student_work.id, :project_id => student_work.project_id, :user_id => student_work.user_id, :is_leader => 1)
|
||||||
|
stu_project.save
|
||||||
|
end
|
||||||
members = params[:group_member_ids].split(',')
|
members = params[:group_member_ids].split(',')
|
||||||
for i in 1 .. members.count-1
|
for i in 1 .. members.count-1
|
||||||
stu_project = StudentWorkProject.new
|
stu_work = StudentWork.new(:name => student_work.name, :description => student_work.description,:user_id =>members[i].to_i, :homework_common_id => @homework.id,:project_id => student_work.project_id, :late_penalty => student_work.late_penalty,:work_status => 3, :commit_time => student_work.commit_time)
|
||||||
stu_project.homework_common_id = @homework.id
|
if stu_work.save
|
||||||
stu_project.student_work_id = student_work.id
|
stu_project = StudentWorkProject.new(:homework_common_id => @homework.id, :student_work_id => student_work.id, :project_id => stu_work.project_id == 0 ? -1 : stu_work.project_id, :user_id => members[i].to_i, :is_leader => 0)
|
||||||
stu_project.project_id = @student_work_project.project_id
|
|
||||||
stu_project.user_id = members[i].to_i
|
|
||||||
stu_project.is_leader = 0
|
|
||||||
stu_project.save
|
stu_project.save
|
||||||
end
|
end
|
||||||
elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 0
|
|
||||||
members = params[:group_member_ids].split(',')
|
|
||||||
for i in 0 .. members.count-1
|
|
||||||
stu_project = StudentWorkProject.new
|
|
||||||
stu_project.homework_common_id = @homework.id
|
|
||||||
stu_project.student_work_id = student_work.id
|
|
||||||
stu_project.project_id = -1
|
|
||||||
stu_project.user_id = members[i].to_i
|
|
||||||
if i == 0
|
|
||||||
stu_project.is_leader = 1
|
|
||||||
else
|
|
||||||
stu_project.is_leader = 0
|
|
||||||
end
|
|
||||||
stu_project.save
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@homework.update_column(:updated_at, Time.now)
|
@homework.update_column(:updated_at, Time.now)
|
||||||
|
@ -669,7 +633,7 @@ class StudentWorkController < ApplicationController
|
||||||
render_403
|
render_403
|
||||||
else
|
else
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html{ render :layout => "new_base_user"}
|
format.html{ render :layout => "base_courses"}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -687,22 +651,19 @@ class StudentWorkController < ApplicationController
|
||||||
if @homework.homework_type == 3
|
if @homework.homework_type == 3
|
||||||
@student_work_project = @homework.student_work_projects.where("user_id=?",User.current.id).first
|
@student_work_project = @homework.student_work_projects.where("user_id=?",User.current.id).first
|
||||||
student_work_projects = @homework.student_work_projects.where("student_work_id=? and is_leader =?",@work.id,0)
|
student_work_projects = @homework.student_work_projects.where("student_work_id=? and is_leader =?",@work.id,0)
|
||||||
|
user_ids = student_work_projects.empty? ? "(-1)" : "(" + student_work_projects.map{|stu|stu.user_id}.join(",") + ")"
|
||||||
|
student_works = @homework.student_works.where("user_id in #{user_ids}")
|
||||||
|
student_works.delete_all
|
||||||
student_work_projects.delete_all
|
student_work_projects.delete_all
|
||||||
members = params[:group_member_ids].split(',')
|
members = params[:group_member_ids].split(',')
|
||||||
for i in 1 .. members.count-1
|
for i in 1 .. members.count-1
|
||||||
stu_project = StudentWorkProject.new
|
stu_work = StudentWork.new(:name => @work.name, :description => @work.description,:user_id=> members[i].to_i, :homework_common_id => @homework.id, :project_id => @work.project_id, :late_penalty => @work.late_penalty,:work_status => 3, :commit_time => @work.commit_time)
|
||||||
stu_project.homework_common_id = @homework.id
|
if stu_work.save
|
||||||
stu_project.student_work_id = @work.id
|
stu_project = StudentWorkProject.new(:homework_common_id => @homework.id, :student_work_id => @work.id, :project_id => stu_work.project_id == 0 ? -1 : stu_work.project_id, :user_id => members[i].to_i, :is_leader => 0)
|
||||||
if @homework.homework_detail_group.base_on_project == 1
|
|
||||||
stu_project.project_id = @student_work_project.project_id
|
|
||||||
else @homework.homework_detail_group.base_on_project == 0
|
|
||||||
stu_project.project_id = -1
|
|
||||||
end
|
|
||||||
stu_project.user_id = members[i].to_i
|
|
||||||
stu_project.is_leader = 0
|
|
||||||
stu_project.save
|
stu_project.save
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
course_message = CourseMessage.new(:user_id =>User.current.id,:content=>"edit",:course_message_id=>@work.id,:course_id => @course.id,:course_message_type=>"StudentWork", :status => 9) #作品提交记录
|
course_message = CourseMessage.new(:user_id =>User.current.id,:content=>"edit",:course_message_id=>@work.id,:course_id => @course.id,:course_message_type=>"StudentWork", :status => 9) #作品提交记录
|
||||||
course_message.save
|
course_message.save
|
||||||
|
@ -735,26 +696,25 @@ class StudentWorkController < ApplicationController
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
if @homework.homework_type == 3
|
if @homework.homework_type == 3
|
||||||
if @work.destroy
|
|
||||||
if @homework.homework_detail_group.base_on_project == 1
|
|
||||||
pros = @work.student_work_projects.where("is_leader = 0")
|
pros = @work.student_work_projects.where("is_leader = 0")
|
||||||
pros.each do |pro|
|
user_ids = pros.empty? ? "(-1)" : "(" + pros.map{|stu|stu.user_id}.join(",") + ")"
|
||||||
pro.destroy
|
student_works = @homework.student_works.where("user_id in #{user_ids}")
|
||||||
end
|
student_works.delete_all
|
||||||
|
pros.delete_all
|
||||||
|
|
||||||
project = @work.student_work_projects.where("is_leader = 1").first
|
project = @work.student_work_projects.where("is_leader = 1").first
|
||||||
|
if @homework.homework_detail_group.base_on_project == 1
|
||||||
project.update_attributes(:student_work_id => nil)
|
project.update_attributes(:student_work_id => nil)
|
||||||
elsif @homework.homework_detail_group.base_on_project == 0
|
else
|
||||||
@work.student_work_projects.each do |pro2|
|
project.destroy
|
||||||
pro2.destroy
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
@work.destroy
|
||||||
else
|
else
|
||||||
@work.attachments.destroy_all
|
@work.attachments.destroy_all
|
||||||
@work.student_works_scores.destroy_all
|
@work.student_works_scores.destroy_all
|
||||||
@work.course_messages.destroy_all
|
@work.course_messages.destroy_all
|
||||||
@work.student_work_tests.destroy_all
|
@work.student_work_tests.destroy_all
|
||||||
@work.update_attributes(:work_status => 0, :name => "#{@homework.name}的作品提交", :description => nil, :late_penalty => 0, :commit_time => nil,:final_score => nil,:teacher_score => nil,:student_score => nil,:teaching_asistant_score => nil,:system_score => 0,:work_score => nil)
|
@work.update_attributes(:work_status => 0, :name => "#{@homework.name}的作品提交", :description => nil, :late_penalty => 0, :commit_time => nil,:final_score => nil,:teacher_score => nil,:student_score => nil,:teaching_asistant_score => nil,:system_score => 0,:work_score => nil, :project_id => 0)
|
||||||
@work.update_column("work_score",nil)
|
@work.update_column("work_score",nil)
|
||||||
end
|
end
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
|
@ -786,22 +746,21 @@ class StudentWorkController < ApplicationController
|
||||||
|
|
||||||
def retry_work
|
def retry_work
|
||||||
if @homework.homework_type == 3
|
if @homework.homework_type == 3
|
||||||
if @work.destroy
|
|
||||||
if @homework.homework_detail_group.base_on_project == 1
|
|
||||||
pros = @work.student_work_projects.where("is_leader = 0")
|
pros = @work.student_work_projects.where("is_leader = 0")
|
||||||
pros.each do |pro|
|
user_ids = pros.empty? ? "(-1)" : "(" + pros.map{|stu|stu.user_id}.join(",") + ")"
|
||||||
pro.destroy
|
student_works = @homework.student_works.where("user_id in #{user_ids}")
|
||||||
end
|
student_works.delete_all
|
||||||
|
pros.delete_all
|
||||||
|
|
||||||
project = @work.student_work_projects.where("is_leader = 1").first
|
project = @work.student_work_projects.where("is_leader = 1").first
|
||||||
|
if @homework.homework_detail_group.base_on_project == 1
|
||||||
project.update_attributes(:student_work_id => nil)
|
project.update_attributes(:student_work_id => nil)
|
||||||
elsif @homework.homework_detail_group.base_on_project == 0
|
else
|
||||||
@work.student_work_projects.each do |pro2|
|
project.destroy
|
||||||
pro2.destroy
|
|
||||||
end
|
end
|
||||||
end
|
@work.destroy
|
||||||
end
|
else
|
||||||
elsif @homework.homework_type == 1
|
@work.update_attributes(:work_status => 0, :name => "#{@homework.name}的作品提交", :description => nil, :late_penalty => 0, :commit_time => nil, :project_id => 0)
|
||||||
@work.update_attributes(:work_status => 0, :name => "#{@homework.name}的作品提交", :description => nil, :late_penalty => 0, :commit_time => nil)
|
|
||||||
@work.attachments.destroy_all
|
@work.attachments.destroy_all
|
||||||
@work.course_messages.destroy_all
|
@work.course_messages.destroy_all
|
||||||
end
|
end
|
||||||
|
@ -861,17 +820,29 @@ class StudentWorkController < ApplicationController
|
||||||
render_attachment_warning_if_needed(@new_score)
|
render_attachment_warning_if_needed(@new_score)
|
||||||
|
|
||||||
if @new_score.save
|
if @new_score.save
|
||||||
|
if @homework.homework_type == 3
|
||||||
|
@is_group_leader = !@work.student_work_projects.empty?
|
||||||
|
end
|
||||||
case @new_score.reviewer_role
|
case @new_score.reviewer_role
|
||||||
when 1 #教师评分:最后一个教师评分为最终评分
|
when 1 #教师评分:最后一个教师评分为最终评分
|
||||||
@work.teacher_score = @new_score.score
|
@work.teacher_score = @new_score.score
|
||||||
|
if @is_group_leader
|
||||||
|
add_score_to_member @work, @homework, 1, 'teacher_score', @new_score.score
|
||||||
|
end
|
||||||
when 2 #教辅评分 教辅评分显示平均分
|
when 2 #教辅评分 教辅评分显示平均分
|
||||||
#@work.teaching_asistant_score = @work.student_works_scores.where(:reviewer_role => 2).average(:score).try(:round, 2).to_f
|
#@work.teaching_asistant_score = @work.student_works_scores.where(:reviewer_role => 2).average(:score).try(:round, 2).to_f
|
||||||
ts_score = StudentWorksScore.find_by_sql("SELECT AVG(score) AS score FROM (SELECT * FROM (SELECT * FROM student_works_scores WHERE student_work_id = #{@work.id} AND reviewer_role = 2 AND score IS NOT NULL ORDER BY created_at DESC) AS t GROUP BY user_id) AS a")
|
ts_score = StudentWorksScore.find_by_sql("SELECT AVG(score) AS score FROM (SELECT * FROM (SELECT * FROM student_works_scores WHERE student_work_id = #{@work.id} AND reviewer_role = 2 AND score IS NOT NULL ORDER BY created_at DESC) AS t GROUP BY user_id) AS a")
|
||||||
@work.teaching_asistant_score = ts_score.first.score.nil? ? nil : ts_score.first.score.try(:round, 2).to_f
|
@work.teaching_asistant_score = ts_score.first.score.nil? ? nil : ts_score.first.score.try(:round, 2).to_f
|
||||||
|
if @is_group_leader
|
||||||
|
add_score_to_member @work, @homework, 2, 'teaching_asistant_score', @work.teaching_asistant_score
|
||||||
|
end
|
||||||
when 3 #学生评分 学生评分显示平均分
|
when 3 #学生评分 学生评分显示平均分
|
||||||
#@work.student_score = @work.student_works_scores.where(:reviewer_role => 3).average(:score).try(:round, 2).to_f
|
#@work.student_score = @work.student_works_scores.where(:reviewer_role => 3).average(:score).try(:round, 2).to_f
|
||||||
stu_score = StudentWorksScore.find_by_sql("SELECT AVG(score) AS score FROM (SELECT * FROM (SELECT * FROM student_works_scores WHERE student_work_id = #{@work.id} AND reviewer_role = 3 ORDER BY created_at DESC) AS t GROUP BY user_id) AS a")
|
stu_score = StudentWorksScore.find_by_sql("SELECT AVG(score) AS score FROM (SELECT * FROM (SELECT * FROM student_works_scores WHERE student_work_id = #{@work.id} AND reviewer_role = 3 ORDER BY created_at DESC) AS t GROUP BY user_id) AS a")
|
||||||
@work.student_score = stu_score.first.score.try(:round, 2).to_f
|
@work.student_score = stu_score.first.score.try(:round, 2).to_f
|
||||||
|
if @is_group_leader
|
||||||
|
add_score_to_member @work, @homework, 3, 'student_score', @work.student_score
|
||||||
|
end
|
||||||
end
|
end
|
||||||
@homework.update_column('updated_at', Time.now)
|
@homework.update_column('updated_at', Time.now)
|
||||||
update_course_activity(@homework.class,@homework.id)
|
update_course_activity(@homework.class,@homework.id)
|
||||||
|
@ -1096,9 +1067,13 @@ class StudentWorkController < ApplicationController
|
||||||
|
|
||||||
#创建作业的关联项目
|
#创建作业的关联项目
|
||||||
def student_work_project
|
def student_work_project
|
||||||
|
@work = @homework.student_works.where("user_id = #{User.current.id} and work_status = 0").first
|
||||||
|
if @work
|
||||||
|
@work.update_column('project_id', params[:projectName].to_i)
|
||||||
|
end
|
||||||
@project = StudentWorkProject.new
|
@project = StudentWorkProject.new
|
||||||
@project.homework_common_id = @homework.id
|
@project.homework_common_id = @homework.id
|
||||||
@project.project_id = (Project.find params[:projectName].to_i).id
|
@project.project_id = params[:projectName].to_i
|
||||||
@project.user_id = User.current.id
|
@project.user_id = User.current.id
|
||||||
@project.is_leader = 1
|
@project.is_leader = 1
|
||||||
if @project.save
|
if @project.save
|
||||||
|
@ -1139,7 +1114,7 @@ class StudentWorkController < ApplicationController
|
||||||
end
|
end
|
||||||
all_students = User.where("id in #{all_student_ids}")
|
all_students = User.where("id in #{all_student_ids}")
|
||||||
student_work_id = @homework.student_work_projects.where("user_id=? and student_work_id is not null",User.current.id).first.nil? ? -1 : @homework.student_work_projects.where("user_id=?",User.current.id).first.student_work_id
|
student_work_id = @homework.student_work_projects.where("user_id=? and student_work_id is not null",User.current.id).first.nil? ? -1 : @homework.student_work_projects.where("user_id=?",User.current.id).first.student_work_id
|
||||||
@commit_student_ids = @homework.student_work_projects.where("student_work_id != #{student_work_id}").map{|student| student.user_id}
|
@commit_student_ids = @homework.student_works.where("id != #{student_work_id}").map{|student| student.user_id}
|
||||||
@users = searchstudent_by_name all_students,name
|
@users = searchstudent_by_name all_students,name
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.js
|
format.js
|
||||||
|
@ -1147,6 +1122,10 @@ class StudentWorkController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def cancel_relate_project
|
def cancel_relate_project
|
||||||
|
@work = @homework.student_works.where("user_id = #{User.current.id} and work_status = 0").first
|
||||||
|
if @work
|
||||||
|
@work.update_column('project_id', 0)
|
||||||
|
end
|
||||||
relate_pro = StudentWorkProject.where("user_id = #{User.current.id} and homework_common_id = #{@homework.id}").first
|
relate_pro = StudentWorkProject.where("user_id = #{User.current.id} and homework_common_id = #{@homework.id}").first
|
||||||
if relate_pro.destroy
|
if relate_pro.destroy
|
||||||
@user_activity_id = params[:user_activity_id].to_i
|
@user_activity_id = params[:user_activity_id].to_i
|
||||||
|
@ -1402,7 +1381,7 @@ class StudentWorkController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def find_or_save_student_work(is_test)
|
def find_or_save_student_work(is_test)
|
||||||
student_work = StudentWork.where(homework_common_id: @homework.id, user_id: User.current.id).first
|
student_work = StudentWork.where(homework_common_id: @homework.id, user_id: User.current.id, is_test: is_test).first
|
||||||
if student_work.nil?
|
if student_work.nil?
|
||||||
@homework.student_works.build(
|
@homework.student_works.build(
|
||||||
name: params[:title],
|
name: params[:title],
|
||||||
|
@ -1413,7 +1392,7 @@ class StudentWorkController < ApplicationController
|
||||||
unless @homework.save
|
unless @homework.save
|
||||||
logger.debug @homework.errors.full_messages
|
logger.debug @homework.errors.full_messages
|
||||||
else
|
else
|
||||||
student_work = StudentWork.where(homework_common_id: @homework.id, user_id: User.current.id).first
|
student_work = StudentWork.where(homework_common_id: @homework.id, user_id: User.current.id, is_test: is_test).first
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
student_work
|
student_work
|
||||||
|
|
|
@ -983,7 +983,7 @@ class UsersController < ApplicationController
|
||||||
@user = User.current
|
@user = User.current
|
||||||
@homework = HomeworkCommon.find(params[:homework_id])
|
@homework = HomeworkCommon.find(params[:homework_id])
|
||||||
@is_test = params[:is_test] == 'true'
|
@is_test = params[:is_test] == 'true'
|
||||||
@student_work = StudentWork.where(homework_common_id: @homework.id, user_id: User.current.id).first
|
@student_work = StudentWork.where(homework_common_id: @homework.id, user_id: User.current.id, is_test: @is_test).first
|
||||||
if @student_work.nil?
|
if @student_work.nil?
|
||||||
@student_work = StudentWork.new
|
@student_work = StudentWork.new
|
||||||
end
|
end
|
||||||
|
@ -1052,7 +1052,7 @@ class UsersController < ApplicationController
|
||||||
else
|
else
|
||||||
homework.publish_time = params[:homework_common][:publish_time]
|
homework.publish_time = params[:homework_common][:publish_time]
|
||||||
end
|
end
|
||||||
homework.anonymous_comment = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment] : 0
|
homework.anonymous_comment = params[:homework_common][:anonymous_comment] ? params[:homework_common][:anonymous_comment].to_i : 1
|
||||||
homework.homework_type = params[:homework_type].to_i || 1
|
homework.homework_type = params[:homework_type].to_i || 1
|
||||||
homework.late_penalty = 10
|
homework.late_penalty = 10
|
||||||
homework.teacher_priority = 1
|
homework.teacher_priority = 1
|
||||||
|
@ -1660,56 +1660,71 @@ class UsersController < ApplicationController
|
||||||
course_types = "('Message','News','HomeworkCommon','Poll','Course','JournalsForMessage')"
|
course_types = "('Message','News','HomeworkCommon','Poll','Course','JournalsForMessage')"
|
||||||
project_types = "('Message','Issue','Project')"
|
project_types = "('Message','Issue','Project')"
|
||||||
principal_types = "JournalsForMessage"
|
principal_types = "JournalsForMessage"
|
||||||
|
container_type = ''
|
||||||
|
act_type = ''
|
||||||
if params[:type].present?
|
if params[:type].present?
|
||||||
case params[:type]
|
case params[:type]
|
||||||
when "course_homework"
|
when "course_homework"
|
||||||
@user_activities = UserActivity.where("container_type = 'Course' and container_id in #{user_course_ids} and act_type = 'HomeworkCommon'").order('updated_at desc').limit(10).offset(@page * 10)
|
container_type = 'Course'
|
||||||
|
act_type = 'HomeworkCommon'
|
||||||
when "course_news"
|
when "course_news"
|
||||||
@user_activities = UserActivity.where("container_type = 'Course' and container_id in #{user_course_ids} and act_type = 'News'").order('updated_at desc').limit(10).offset(@page * 10)
|
container_type = 'Course'
|
||||||
|
act_type = 'News'
|
||||||
when "course_message"
|
when "course_message"
|
||||||
@user_activities = UserActivity.where("container_type = 'Course' and container_id in #{user_course_ids} and act_type = 'Message'").order('updated_at desc').limit(10).offset(@page * 10)
|
container_type = 'Course'
|
||||||
|
act_type = 'Message'
|
||||||
when "course_poll"
|
when "course_poll"
|
||||||
@user_activities = UserActivity.where("container_type = 'Course' and container_id in #{user_course_ids} and act_type = 'Poll'").order('updated_at desc').limit(10).offset(@page * 10)
|
container_type = 'Course'
|
||||||
|
act_type = 'Poll'
|
||||||
when "course_journals"
|
when "course_journals"
|
||||||
@user_activities = UserActivity.where("container_type = 'Course' and container_id in #{user_course_ids} and act_type = 'JournalsForMessage'").order('updated_at desc').limit(10).offset(@page * 10)
|
container_type = 'Course'
|
||||||
|
act_type = 'JournalsForMessage'
|
||||||
when "project_issue"
|
when "project_issue"
|
||||||
@user_activities = UserActivity.where("container_type = 'Project' and container_id in #{user_project_ids} and act_type = 'Issue'").order('updated_at desc').limit(10).offset(@page * 10)
|
container_type = 'Project'
|
||||||
|
act_type = 'Issue'
|
||||||
when "project_message"
|
when "project_message"
|
||||||
@user_activities = UserActivity.where("container_type = 'Project' and container_id in #{user_project_ids} and act_type = 'Message'").order('updated_at desc').limit(10).offset(@page * 10)
|
container_type = 'Project'
|
||||||
|
act_type = 'Message'
|
||||||
when "user_journals"
|
when "user_journals"
|
||||||
@user_activities = UserActivity.where("container_type = 'Principal' and act_type= 'JournalsForMessage' and container_id = #{@user.id}").order('updated_at desc').limit(10).offset(@page * 10)
|
container_type = 'Principal'
|
||||||
|
act_type = 'JournalsForMessage'
|
||||||
when "current_user"
|
when "current_user"
|
||||||
@user_activities = UserActivity.where("user_id = #{@user.id} and ((container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}))").order('updated_at desc').limit(10).offset(@page * 10)
|
container_type = 'Principal'
|
||||||
else
|
act_type = 'Principal'
|
||||||
if @user == User.current
|
when "all"
|
||||||
blog_ids = "("+@user.blog.id.to_s+","+((User.watched_by(@user.id).count == 0 )? '0' :User.watched_by(@user.id).map{|u| u.blog.id}.join(','))+")"
|
container_type = 'all'
|
||||||
|
act_type = 'all'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if container_type != '' && container_type != 'all'
|
||||||
|
if container_type == 'Course'
|
||||||
|
sql = "container_type = '#{container_type}' and container_id in #{user_course_ids} and act_type = '#{act_type}'"
|
||||||
|
elsif container_type == 'Project'
|
||||||
|
sql = "container_type = '#{container_type}' and container_id in #{user_project_ids} and act_type = '#{act_type}'"
|
||||||
|
elsif container_type == 'Principal' && act_type == 'JournalsForMessage'
|
||||||
|
sql = "container_type = '#{container_type}' and act_type= '#{act_type}' and container_id = #{@user.id}"
|
||||||
|
elsif container_type == 'Principal' && act_type == 'Principal'
|
||||||
|
sql = "user_id = #{@user.id} and ((container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}))"
|
||||||
|
end
|
||||||
|
if User.current != @user
|
||||||
|
sql += " and user_id = #{@user.id}"
|
||||||
|
end
|
||||||
else
|
else
|
||||||
|
if User.current != @user
|
||||||
blog_ids = "("+@user.blog.id.to_s+")"
|
blog_ids = "("+@user.blog.id.to_s+")"
|
||||||
|
else
|
||||||
|
blog_ids = "("+@user.blog.id.to_s+","+((User.watched_by(@user.id).count == 0 )? '0' :User.watched_by(@user.id).map{|u| u.blog.id}.join(','))+")"
|
||||||
end
|
end
|
||||||
@user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})" +
|
sql = "(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})" +
|
||||||
"or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}) "+
|
"or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}) "+
|
||||||
"or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id}) " +
|
"or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id}) " +
|
||||||
"or (container_type = 'Blog' and act_type= 'BlogComment' and container_id in #{blog_ids})").order('updated_at desc').limit(10).offset(@page * 10)
|
"or (container_type = 'Blog' and act_type= 'BlogComment' and container_id in #{blog_ids})"
|
||||||
|
if container_type != 'all' && User.current != @user
|
||||||
|
sql = "user_id = #{@user.id} and(" + sql + ")"
|
||||||
end
|
end
|
||||||
else
|
|
||||||
# @user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types})or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id})").order('updated_at desc').limit(10).offset(@page * 10)
|
|
||||||
# blog_ids = "("+@user.blog.id.to_s+","+((User.watched_by(@user.id).count == 0 )? '0' :User.watched_by(@user.id).map{|u| u.blog.id}.join(','))+")"
|
|
||||||
# 减少数据库交互
|
|
||||||
if @user == User.current
|
|
||||||
watched_user_ids = User.watched_by(@user.id).count == 0 ? " " : ("," + User.watched_by(@user.id).map{|u| u.id.to_s }.join(','))
|
|
||||||
user_ids = "(" + @user.id.to_s + watched_user_ids + ")"
|
|
||||||
else
|
|
||||||
user_ids = "(" + @user.id.to_s + ")"
|
|
||||||
end
|
end
|
||||||
watched_user_blog_ids = Blog.select("id").where("author_id in #{user_ids}")
|
|
||||||
blog_ids = watched_user_blog_ids.empty? ? "(-1)" : "(" + watched_user_blog_ids.map { |blog| blog.id}.join(",") + ")"
|
|
||||||
|
|
||||||
@user_activities = UserActivity.where("(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})" +
|
@user_activities = UserActivity.where("#{sql}").order('updated_at desc').limit(10).offset(@page * 10)
|
||||||
"or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}) "+
|
|
||||||
"or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id}) " +
|
|
||||||
"or (container_type = 'Blog' and act_type= 'BlogComment' and container_id in #{blog_ids})").order('updated_at desc').limit(10).offset(@page * 10)
|
|
||||||
end
|
|
||||||
# @user_activities = paginateHelper @user_activities,500
|
|
||||||
@type = params[:type]
|
@type = params[:type]
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.js
|
format.js
|
||||||
|
@ -2141,17 +2156,16 @@ class UsersController < ApplicationController
|
||||||
@user = User.current
|
@user = User.current
|
||||||
if !params[:search].nil?
|
if !params[:search].nil?
|
||||||
search = "%#{params[:search].to_s.strip.downcase}%"
|
search = "%#{params[:search].to_s.strip.downcase}%"
|
||||||
@course = @user.courses.where(" #{Course.table_name}.id = #{params[:search].to_i } or #{Course.table_name}.name like :p",:p=>search)
|
@course = @user.courses.not_deleted.where(" #{Course.table_name}.id = #{params[:search].to_i } or #{Course.table_name}.name like :p",:p=>search)
|
||||||
.select { |course| @user.allowed_to?(:as_teacher,course) and course.is_delete == 0 }
|
|
||||||
else
|
else
|
||||||
@course = @user.courses
|
@course = @user.courses.not_deleted
|
||||||
.select { |course| @user.allowed_to?(:as_teacher,course) and course.is_delete == 0 }
|
|
||||||
end
|
end
|
||||||
@search = params[:search]
|
@search = params[:search]
|
||||||
@type = params[:type]
|
@type = params[:type]
|
||||||
#这里仅仅是传递需要发送的资源id
|
#这里仅仅是传递需要发送的资源id
|
||||||
@send_id = params[:send_id]
|
@send_id = params[:send_id]
|
||||||
@send_ids = params[:checkbox1] || params[:send_ids]
|
@send_ids = params[:checkbox1] || params[:send_ids]
|
||||||
|
@hidden_unproject = hidden_unproject_infos
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.js
|
format.js
|
||||||
end
|
end
|
||||||
|
@ -2162,7 +2176,7 @@ class UsersController < ApplicationController
|
||||||
@user = User.current
|
@user = User.current
|
||||||
if !params[:search].nil?
|
if !params[:search].nil?
|
||||||
search = "%#{params[:search].to_s.strip.downcase}%"
|
search = "%#{params[:search].to_s.strip.downcase}%"
|
||||||
@projects = @user.projects.where(" #{Project.table_name}.id = #{params[:search].to_i } or #{Project.table_name}.name like :p",:p=>search)
|
@projects = @user.projects.visible.where(" #{Project.table_name}.id = #{params[:search].to_i } or #{Project.table_name}.name like :p",:p=>search)
|
||||||
else
|
else
|
||||||
@projects = @user.projects.visible
|
@projects = @user.projects.visible
|
||||||
end
|
end
|
||||||
|
@ -2171,6 +2185,7 @@ class UsersController < ApplicationController
|
||||||
#这里仅仅是传递需要发送的资源id
|
#这里仅仅是传递需要发送的资源id
|
||||||
@send_id = params[:send_id]
|
@send_id = params[:send_id]
|
||||||
@send_ids = params[:checkbox1] || params[:send_ids] #搜索的时候 和 直接 用表格提交的时候的send_ids
|
@send_ids = params[:checkbox1] || params[:send_ids] #搜索的时候 和 直接 用表格提交的时候的send_ids
|
||||||
|
@hidden_unproject = hidden_unproject_infos
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.js
|
format.js
|
||||||
end
|
end
|
||||||
|
@ -2613,7 +2628,8 @@ class UsersController < ApplicationController
|
||||||
project_ids.each do |project_id|
|
project_ids.each do |project_id|
|
||||||
project = Project.find(project_id)
|
project = Project.find(project_id)
|
||||||
if project.news.map(&:id).exclude?(news.id)
|
if project.news.map(&:id).exclude?(news.id)
|
||||||
message = Message.create(:board_id => project.boards.first.id, :subject => news.title, :content => news.description, :author_id => User.current.id)
|
# message = Message.create(:board_id => project.boards.first.id, :subject => news.title, :content => news.description, :author_id => User.current.id)
|
||||||
|
message = News.create(:project_id => project.id, :title => news.title, :summary => news.summary, :description => news.description, :author_id => User.current.id, :created_on => Time.now )
|
||||||
# record forward to table forwards if new record is valid
|
# record forward to table forwards if new record is valid
|
||||||
if message.valid?
|
if message.valid?
|
||||||
news.forwards << Forward.new(:to_type => message.class.name, :to_id => message.id)
|
news.forwards << Forward.new(:to_type => message.class.name, :to_id => message.id)
|
||||||
|
@ -3334,6 +3350,7 @@ class UsersController < ApplicationController
|
||||||
#这里仅仅是传递需要发送的资源id
|
#这里仅仅是传递需要发送的资源id
|
||||||
@send_id = params[:send_id]
|
@send_id = params[:send_id]
|
||||||
@send_ids = params[:checkbox1] || params[:send_ids]
|
@send_ids = params[:checkbox1] || params[:send_ids]
|
||||||
|
@hidden_unproject = hidden_unproject_infos
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.js
|
format.js
|
||||||
end
|
end
|
||||||
|
@ -3450,11 +3467,15 @@ class UsersController < ApplicationController
|
||||||
@order, @c_sort, @type, @list_type = 1, 2, 1, 1
|
@order, @c_sort, @type, @list_type = 1, 2, 1, 1
|
||||||
#limit = 5
|
#limit = 5
|
||||||
|
|
||||||
@my_projects = @user.projects.visible.where("projects.user_id = #{@user.id}").select("projects.*,(SELECT MAX(updated_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS updatetime").order("updatetime DESC")
|
# 用户的所有项目
|
||||||
|
# @my_projects = @user.projects.visible.where("projects.user_id = #{@user.id}").select("projects.*,(SELECT MAX(updated_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS updatetime").order("updatetime DESC")
|
||||||
|
@my_projects = @user.projects.where("projects.user_id = #{@user.id}").select("projects.*,(SELECT MAX(updated_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS updatetime").order("updatetime DESC")
|
||||||
@my_projects_count = @my_projects.count
|
@my_projects_count = @my_projects.count
|
||||||
|
|
||||||
@my_joined_projects = @user.projects.visible.where("projects.user_id != #{@user.id}").select("projects.*,(SELECT MAX(updated_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS updatetime").order("updatetime DESC")
|
#@my_joined_projects = @user.projects.visible.where("projects.user_id != #{@user.id}").select("projects.*,(SELECT MAX(updated_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS updatetime").order("updatetime DESC")
|
||||||
|
@my_joined_projects = @user.projects.where("projects.user_id != #{@user.id}").select("projects.*,(SELECT MAX(updated_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS updatetime").order("updatetime DESC")
|
||||||
@my_joined_projects_count = @my_joined_projects.count
|
@my_joined_projects_count = @my_joined_projects.count
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html {render :layout => 'new_base_user'}
|
format.html {render :layout => 'new_base_user'}
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,13 +8,13 @@ class WechatsController < ActionController::Base
|
||||||
# default text responder when no other match
|
# default text responder when no other match
|
||||||
on :text do |request, content|
|
on :text do |request, content|
|
||||||
#邀请码
|
#邀请码
|
||||||
if join_class_request(request)
|
# if join_class_request(request)
|
||||||
sendBindClass(request, {invite_code: content})
|
# sendBindClass(request, {invite_code: content})
|
||||||
elsif join_project_request(request)
|
# elsif join_project_request(request)
|
||||||
sendBindProject(request, {invite_code: content})
|
# sendBindProject(request, {invite_code: content})
|
||||||
else
|
# else
|
||||||
request.reply.text "您的意见已收到,非常感谢~ \n更多问题可以通过以下方式联系我们:\n官方QQ群:173184401\n我们会认真聆听您的意见和建议。"
|
request.reply.text "您的意见已收到,非常感谢~ \n更多问题可以通过以下方式联系我们:\n官方QQ群:173184401\n我们会认真聆听您的意见和建议。"
|
||||||
end
|
# end
|
||||||
end
|
end
|
||||||
|
|
||||||
# When receive 'help', will trigger this responder
|
# When receive 'help', will trigger this responder
|
||||||
|
@ -167,6 +167,27 @@ class WechatsController < ActionController::Base
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
on :click, with: 'UNBIND' do |request, key|
|
||||||
|
uw = user_binded?(request[:FromUserName])
|
||||||
|
unless uw
|
||||||
|
request.reply.text "您还未绑定帐号"
|
||||||
|
else
|
||||||
|
#解除绑定
|
||||||
|
us = UsersService.new
|
||||||
|
us.wechat_unbind uw
|
||||||
|
|
||||||
|
tmpurl = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=#{Wechat.config.appid}&redirect_uri=#{ROOT_URL+'/wechat/user_activities'}&response_type=code&scope=snsapi_base&state=login&connect_redirect=1#wechat_redirect"
|
||||||
|
news = (1..1).each_with_object([]) { |n, memo| memo << { title: '重新绑定提醒',
|
||||||
|
content: "尊敬的用户,您已解除绑定。\n解除时间:#{format_time(Time.now)}\n点击进入重新绑定!"} }
|
||||||
|
request.reply.news(news) do |article, n, index| # article is return object
|
||||||
|
url = tmpurl
|
||||||
|
article.item title: "#{n[:title]}",
|
||||||
|
description: n[:content],
|
||||||
|
url: url
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def join_class_request(request)
|
def join_class_request(request)
|
||||||
openid = request[:FromUserName]
|
openid = request[:FromUserName]
|
||||||
wl = WechatLog.where("openid = '#{openid}' and request_raw like '%\"Event\":\"click\"%'").order('id desc').first
|
wl = WechatLog.where("openid = '#{openid}' and request_raw like '%\"Event\":\"click\"%'").order('id desc').first
|
||||||
|
@ -435,10 +456,20 @@ class WechatsController < ActionController::Base
|
||||||
|
|
||||||
session[:wechat_openid] = open_id
|
session[:wechat_openid] = open_id
|
||||||
if params[:code]
|
if params[:code]
|
||||||
# if params[:state].match("review_class_member") || params[:state].match("review_project_member")
|
if !(params[:state] == "invite_code" || params[:state] == "project_invite_code" || params[:state] == "blog_comment" || params[:state] == "course_notice" || params[:state] == "project_discussion" || params[:state] == "course_discussion" || params[:state] == "homework" || params[:state] == "issues" || params[:state] == "journal_for_message")
|
||||||
|
uw = user_binded?(open_id)
|
||||||
|
if uw
|
||||||
|
user = uw.user
|
||||||
|
lastname = user.lastname
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if lastname && lastname == ""
|
||||||
|
@path = '/edit_userinfo'
|
||||||
|
else
|
||||||
@path = params[:state].split('/')[0]
|
@path = params[:state].split('/')[0]
|
||||||
useridstr = params[:state].split('/')[1]
|
useridstr = params[:state].split('/')[1]
|
||||||
# end
|
|
||||||
if useridstr
|
if useridstr
|
||||||
redirect_to "/wechat/user_activities##{@path}?id=#{params[:id]}&#{useridstr}" and return
|
redirect_to "/wechat/user_activities##{@path}?id=#{params[:id]}&#{useridstr}" and return
|
||||||
elsif params[:id]
|
elsif params[:id]
|
||||||
|
@ -449,6 +480,7 @@ class WechatsController < ActionController::Base
|
||||||
# redirect_to "/wechat/user_activities##{@path}?id=#{params[:id]}" and return
|
# redirect_to "/wechat/user_activities##{@path}?id=#{params[:id]}" and return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
render 'wechats/user_activities', layout: nil
|
render 'wechats/user_activities', layout: nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -345,7 +345,11 @@ module ApplicationHelper
|
||||||
|
|
||||||
def link_to_isuue_user(user, options={})
|
def link_to_isuue_user(user, options={})
|
||||||
if user.is_a?(User)
|
if user.is_a?(User)
|
||||||
|
if options[:format]
|
||||||
name = h(user.name(options[:format]))
|
name = h(user.name(options[:format]))
|
||||||
|
else
|
||||||
|
name = h(user.show_name)
|
||||||
|
end
|
||||||
link_to name, {:controller=> 'users', :action => 'show', id: user.id, host: Setting.host_user}, :class => "pro_info_p"
|
link_to name, {:controller=> 'users', :action => 'show', id: user.id, host: Setting.host_user}, :class => "pro_info_p"
|
||||||
else
|
else
|
||||||
h(user.to_s)
|
h(user.to_s)
|
||||||
|
@ -417,13 +421,13 @@ module ApplicationHelper
|
||||||
end
|
end
|
||||||
# status_id:3、已解决 5、已关闭
|
# status_id:3、已解决 5、已关闭
|
||||||
if issue.status_id == 3
|
if issue.status_id == 3
|
||||||
s = link_to text, issue_path(issue), :class => "text_line_s", :title => title
|
s = link_to text, issue_path(issue), :class => "text_line_s fl", :title => title
|
||||||
elsif issue.status_id == 5
|
elsif issue.status_id == 5
|
||||||
s = link_to text, issue_path(issue), :class => "text_line_s del_line", :title => title
|
s = link_to text, issue_path(issue), :class => "text_line_s del_line fl", :title => title
|
||||||
else
|
else
|
||||||
s = link_to text, issue_path(issue), :class => "c_blue", :title => title
|
s = link_to text, issue_path(issue), :class => "c_blue fl", :title => title
|
||||||
end
|
end
|
||||||
s << h(": #{subject}") if subject
|
s << h("<span style='width:450px;display:inline-block;' class='hidden'>: #{subject}</span>".html_safe) if subject
|
||||||
s = h("#{issue.project} - ") + s if options[:project]
|
s = h("#{issue.project} - ") + s if options[:project]
|
||||||
s
|
s
|
||||||
end
|
end
|
||||||
|
@ -652,7 +656,7 @@ module ApplicationHelper
|
||||||
s << watcher_link(@project, User.current)#, ['whiteButton'])
|
s << watcher_link(@project, User.current)#, ['whiteButton'])
|
||||||
s << "</span>"
|
s << "</span>"
|
||||||
end
|
end
|
||||||
s << (render :partial => 'projects/project', :locals => {:project => project}).to_s
|
s << (render :partial => 'projects/tracker_project', :locals => {:project => project}).to_s
|
||||||
else
|
else
|
||||||
s << (render :partial => 'projects/course', :locals => {:project => project}).to_s
|
s << (render :partial => 'projects/course', :locals => {:project => project}).to_s
|
||||||
end
|
end
|
||||||
|
@ -832,16 +836,18 @@ module ApplicationHelper
|
||||||
atts.count > 0 ? true :false
|
atts.count > 0 ? true :false
|
||||||
end
|
end
|
||||||
|
|
||||||
# 必须是项目成,项目必须提交过代码
|
# 如果Pull Request数量为0就显示在更多中
|
||||||
|
def allow_show_pull_request project
|
||||||
|
g = Gitlab.client
|
||||||
|
count = g.merge_requests(project.gpid).count
|
||||||
|
end
|
||||||
|
|
||||||
|
# 必须是项目成员,项目必须提交过代码
|
||||||
def allow_pull_request project
|
def allow_pull_request project
|
||||||
return false if project.gpid.nil?
|
return 0 if project.gpid.nil?
|
||||||
g = Gitlab.client
|
g = Gitlab.client
|
||||||
count = g.user_static(project.gpid, :rev => "master").count
|
count = g.user_static(project.gpid, :rev => "master").count
|
||||||
if User.current.member_of?(project) && count > 0
|
count
|
||||||
true
|
|
||||||
else
|
|
||||||
false
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# 判断版本库是否初始为gitlab
|
# 判断版本库是否初始为gitlab
|
||||||
|
@ -919,6 +925,12 @@ module ApplicationHelper
|
||||||
s.html_safe
|
s.html_safe
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# 计算Pull Request的请求数目
|
||||||
|
def pull_request_count project
|
||||||
|
g = Gitlab.client
|
||||||
|
g.merge_requests(project.gpid).count
|
||||||
|
end
|
||||||
|
|
||||||
#项目成员列表复选框生成
|
#项目成员列表复选框生成
|
||||||
def project_member_check_box_tags_ex name, principals
|
def project_member_check_box_tags_ex name, principals
|
||||||
s = ''
|
s = ''
|
||||||
|
@ -976,7 +988,7 @@ module ApplicationHelper
|
||||||
groups = ''
|
groups = ''
|
||||||
collection.sort.each do |element|
|
collection.sort.each do |element|
|
||||||
selected_attribute = ' selected="selected"' if option_value_selected?(element, selected)
|
selected_attribute = ' selected="selected"' if option_value_selected?(element, selected)
|
||||||
(element.is_a?(Group) ? groups : s) << %(<option value="#{element.id}"#{selected_attribute}>#{h element.name}</option>)
|
(element.is_a?(Group) ? groups : s) << %(<option value="#{element.id}"#{selected_attribute}>#{h element.show_name}</option>)
|
||||||
end
|
end
|
||||||
unless groups.empty?
|
unless groups.empty?
|
||||||
s << %(<optgroup label="#{h(l(:label_group_plural))}">#{groups}</optgroup>)
|
s << %(<optgroup label="#{h(l(:label_group_plural))}">#{groups}</optgroup>)
|
||||||
|
@ -3248,6 +3260,16 @@ def get_all_children result, jour
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#获取该节点所在的帖子
|
||||||
|
def get_root_parent comment
|
||||||
|
while comment.parent
|
||||||
|
comment = comment.parent
|
||||||
|
end
|
||||||
|
comment
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#将有置顶属性的提到数组前面
|
#将有置顶属性的提到数组前面
|
||||||
def sort_by_sticky topics
|
def sort_by_sticky topics
|
||||||
tmpTopics = []
|
tmpTopics = []
|
||||||
|
@ -3414,6 +3436,43 @@ def get_hw_index(hw,is_teacher)
|
||||||
return index
|
return index
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get_hw_status homework_common
|
||||||
|
str = ""
|
||||||
|
if homework_common.homework_detail_manual
|
||||||
|
if homework_common.homework_detail_manual.comment_status == 0 && homework_common.publish_time.nil?
|
||||||
|
str += '<span class="grey_homework_btn_cir ml5">挂起</span>'
|
||||||
|
elsif homework_common.homework_detail_manual.comment_status == 0
|
||||||
|
str += '<span class="grey_homework_btn_cir ml5">未发布</span>'
|
||||||
|
elsif homework_common.homework_detail_manual.comment_status == 1
|
||||||
|
if homework_common.anonymous_comment == 0
|
||||||
|
str += '<span class="grey_homework_btn_cir ml5">未开启匿评</span>'
|
||||||
|
else
|
||||||
|
str += '<span class="grey_homework_btn_cir ml5">匿评已禁用</span>'
|
||||||
|
end
|
||||||
|
if Time.parse(homework_common.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")
|
||||||
|
str += '<span class="green_homework_btn_cir ml5">作品提交中</span>'
|
||||||
|
elsif Time.parse(homework_common.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d")
|
||||||
|
str += '<span class="red_homework_btn_cir ml5">作品补交中</span>'
|
||||||
|
end
|
||||||
|
elsif homework_common.homework_detail_manual.comment_status == 2
|
||||||
|
if homework_common.anonymous_comment == 0
|
||||||
|
str += '<span class="green_homework_btn_cir ml5">匿评中</span>'
|
||||||
|
else
|
||||||
|
str += '<span class="grey_homework_btn_cir ml5">匿评已禁用</span>'
|
||||||
|
end
|
||||||
|
str += '<span class="green_homework_btn_cir ml5" title="目前教师和教辅正在评阅">教师评阅中</span>'
|
||||||
|
elsif homework_common.homework_detail_manual.comment_status == 3
|
||||||
|
if homework_common.anonymous_comment == 0
|
||||||
|
str += '<span class="grey_homework_btn_cir ml5">匿评已结束</span>'
|
||||||
|
else
|
||||||
|
str += '<span class="grey_homework_btn_cir ml5">匿评已禁用</span>'
|
||||||
|
end
|
||||||
|
str += '<span class="green_homework_btn_cir ml5" title="目前教师和教辅正在评阅">教师评阅中</span>'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
str
|
||||||
|
end
|
||||||
|
|
||||||
def get_group_member_names work
|
def get_group_member_names work
|
||||||
result = ""
|
result = ""
|
||||||
unless work.nil?
|
unless work.nil?
|
||||||
|
@ -3472,3 +3531,21 @@ def get_forge_act_message(act, type)
|
||||||
format_time(forge_act.nil? ? act.created_on : forge_act.try(:updated_at))
|
format_time(forge_act.nil? ? act.created_on : forge_act.try(:updated_at))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#作业类型
|
||||||
|
def homework_type_option
|
||||||
|
type = []
|
||||||
|
option1 = []
|
||||||
|
option1 << "普通作业"
|
||||||
|
option1 << 1
|
||||||
|
option2 = []
|
||||||
|
option2 << "编程作业"
|
||||||
|
option2 << 2
|
||||||
|
option3 = []
|
||||||
|
option3 << "分组作业"
|
||||||
|
option3 << 3
|
||||||
|
type << option1
|
||||||
|
type << option2
|
||||||
|
type << option3
|
||||||
|
type
|
||||||
|
end
|
||||||
|
|
||||||
|
|
|
@ -63,6 +63,7 @@ module CoursesHelper
|
||||||
# searchTeacherAndAssistant(project).count
|
# searchTeacherAndAssistant(project).count
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# 统计数目
|
||||||
def show_nav?(count)
|
def show_nav?(count)
|
||||||
count == 0 ? true : false
|
count == 0 ? true : false
|
||||||
end
|
end
|
||||||
|
@ -192,18 +193,6 @@ module CoursesHelper
|
||||||
# garble count
|
# garble count
|
||||||
# end
|
# end
|
||||||
|
|
||||||
def homework_type_option
|
|
||||||
type = []
|
|
||||||
option1 = []
|
|
||||||
option2 = []
|
|
||||||
option1 << l(:label_task_submit_form_accessory)
|
|
||||||
option1 << 1
|
|
||||||
option2 << l(:label_task_submit_form_project)
|
|
||||||
option2 << 2
|
|
||||||
type << option1
|
|
||||||
type << option2
|
|
||||||
end
|
|
||||||
|
|
||||||
def proportion_option
|
def proportion_option
|
||||||
type = []
|
type = []
|
||||||
i = 0
|
i = 0
|
||||||
|
@ -807,11 +796,12 @@ module CoursesHelper
|
||||||
link.html_safe
|
link.html_safe
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# 可以查看到资源库的资源
|
||||||
def visable_attachemnts_incourse course
|
def visable_attachemnts_incourse course
|
||||||
return[] unless course
|
return[] unless course
|
||||||
result = []
|
result = []
|
||||||
course.attachments.each do |attachment|
|
course.attachments.each do |attachment|
|
||||||
if (attachment.is_public? && attachment.is_publish == 1) ||User.current == attachment.author ||User.current.allowed_to?(:as_teacher,course)|| (User.current.member_of_course?(course) && attachment.is_publish == 1) || User.current.admin?
|
if attachment.is_public? && attachment.is_publish == 1 || User.current == attachment.author || User.current.allowed_to?(:as_teacher,course) || (User.current.member_of_course?(course) && attachment.is_publish == 1) || User.current.admin?
|
||||||
result << attachment
|
result << attachment
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -111,9 +111,9 @@ module IssuesHelper
|
||||||
|
|
||||||
def principals_options_for_isuue_list(project)
|
def principals_options_for_isuue_list(project)
|
||||||
if User.current.member_of?(project)
|
if User.current.member_of?(project)
|
||||||
project.members.includes(:user).order("lower(users.login)").map{|c| [c.name, c.user_id]}.unshift(["<< #{l(:label_me)} >>", User.current.id]).unshift(["指派给", 0])
|
project.members.includes(:user).order("lower(users.login)").map{|c| [User.find(c.user_id).show_name, c.user_id]}.unshift(["<< #{l(:label_me)} >>", User.current.id]).unshift(["指派给", 0])
|
||||||
else
|
else
|
||||||
project.members.includes(:user).order("lower(users.login)").map{|c| [c.name, c.user_id]}.unshift(["指派给", 0])
|
project.members.includes(:user).order("lower(users.login)").map{|c| [User.find(c.user_id).show_name, c.user_id]}.unshift(["指派给", 0])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
module OrgMemberHelper
|
module OrgMemberHelper
|
||||||
include ApplicationHelper
|
include ApplicationHelper
|
||||||
|
|
||||||
def find_user_not_in_current_org_by_name org
|
def find_user_not_in_current_org_by_name org
|
||||||
if params[:q] && params[:q].lstrip.rstrip != ""
|
if params[:q] && params[:q].lstrip.rstrip != ""
|
||||||
scope = Principal.active.sorted.not_member_of_org(org).like(params[:q])
|
scope = Principal.active.sorted.not_member_of_org(org).like(params[:q])
|
||||||
|
|
|
@ -225,19 +225,6 @@ module ProjectsHelper
|
||||||
Project.tagged_with(tag_name).order('updated_on desc')
|
Project.tagged_with(tag_name).order('updated_on desc')
|
||||||
end
|
end
|
||||||
|
|
||||||
# added by fq
|
|
||||||
def homework_type_option
|
|
||||||
type = []
|
|
||||||
option1 = []
|
|
||||||
option2 = []
|
|
||||||
option1 << l(:label_task_submit_form_accessory)
|
|
||||||
option1 << 1
|
|
||||||
option2 << l(:label_task_submit_form_project)
|
|
||||||
option2 << 2
|
|
||||||
type << option1
|
|
||||||
type << option2
|
|
||||||
end
|
|
||||||
|
|
||||||
#是否启动互评下拉框
|
#是否启动互评下拉框
|
||||||
def is_evaluation_option
|
def is_evaluation_option
|
||||||
type = []
|
type = []
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
module SchoolHelper
|
module SchoolHelper
|
||||||
def schoolMember_num school
|
def schoolMember_num school
|
||||||
count = student_num(school) + teacher_num(school)
|
count = UserExtensions.where("school_id = #{school.id} or occupation = '#{school.name}'").count
|
||||||
count.to_s
|
count.to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -22,9 +22,13 @@ module StudentWorkHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
#获取指定用户对某一作业的评分结果
|
#获取指定用户对某一作业的评分结果
|
||||||
def student_work_score work,user
|
def student_work_score work,user,reviewer_role=0
|
||||||
|
if reviewer_role != 0
|
||||||
|
StudentWorksScore.where(:user_id => user.id,:student_work_id => work.id,:reviewer_role => reviewer_role).last
|
||||||
|
else
|
||||||
StudentWorksScore.where(:user_id => user.id,:student_work_id => work.id).last
|
StudentWorksScore.where(:user_id => user.id,:student_work_id => work.id).last
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
#获取指定评分的角色
|
#获取指定评分的角色
|
||||||
def student_work_score_role score
|
def student_work_score_role score
|
||||||
|
@ -154,4 +158,20 @@ module StudentWorkHelper
|
||||||
end
|
end
|
||||||
return status
|
return status
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def group_student_works student_work, homework
|
||||||
|
pros = student_work.student_work_projects.where("is_leader = 0")
|
||||||
|
user_ids = pros.empty? ? "(-1)" : "(" + pros.map{|stu|stu.user_id}.join(",") + ")"
|
||||||
|
student_works = homework.student_works.where("user_id in #{user_ids}")
|
||||||
|
return student_works
|
||||||
|
end
|
||||||
|
|
||||||
|
def add_score_to_member student_work, homework, role, score_type, score
|
||||||
|
student_works = group_student_works student_work, homework
|
||||||
|
student_works.each do |st_work|
|
||||||
|
if st_work.student_works_scores.where("reviewer_role = #{role} and score is not null").empty?
|
||||||
|
st_work.update_attribute("#{score_type}", score)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
|
@ -162,17 +162,17 @@ module UsersHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def current_time_and_term_resource course
|
def current_time_and_term_resource course
|
||||||
str = ""
|
str = course.syllabus.title + "<span class='fb'> · </span>"
|
||||||
term = cur_course_term_resource
|
term = cur_course_term_resource
|
||||||
name = course.name
|
name = course.name
|
||||||
if (course.time == course.end_time && course.term == course.end_term) || (course.end_term.nil? && course.end_time.nil?) || course.time > Time.now.year
|
if (course.time == course.end_time && course.term == course.end_term) || (course.end_term.nil? && course.end_time.nil?) || course.time > Time.now.year
|
||||||
str = name + "(" + course.time.to_s + course.term.to_s + ")"
|
str = str + name + "(" + course.time.to_s + course.term.to_s + ")"
|
||||||
elsif course.time == Time.now.year && set_term_value(cur_course_term) <= set_term_value(course.term)
|
elsif course.time == Time.now.year && set_term_value(cur_course_term) <= set_term_value(course.term)
|
||||||
str = name + "(" + course.time.to_s + course.term.to_s + ")"
|
str = str + name + "(" + course.time.to_s + course.term.to_s + ")"
|
||||||
elsif course.end_time < Time.now.year || (course.end_time == Time.now.year && set_term_value(cur_course_term) >= set_term_value(course.term))
|
elsif course.end_time < Time.now.year || (course.end_time == Time.now.year && set_term_value(cur_course_term) >= set_term_value(course.term))
|
||||||
str = name + "(" + course.end_time.to_s + course.end_term.to_s + ")"
|
str = str + name + "(" + course.end_time.to_s + course.end_term.to_s + ")"
|
||||||
else
|
else
|
||||||
str = name + "(" + Time.now.year.to_s + cur_course_term_resource.to_s + ")"
|
str = str + name + "(" + Time.now.year.to_s + cur_course_term_resource.to_s + ")"
|
||||||
end
|
end
|
||||||
str
|
str
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#coding=utf-8
|
#coding=utf-8
|
||||||
|
|
||||||
class AtMessage < ActiveRecord::Base
|
class AtMessage < ActiveRecord::Base
|
||||||
|
include ApplicationHelper
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
belongs_to :sender, class_name: "User", foreign_key: "sender_id"
|
belongs_to :sender, class_name: "User", foreign_key: "sender_id"
|
||||||
attr_accessible :at_message, :container, :viewed, :user_id, :sender_id
|
attr_accessible :at_message, :container, :viewed, :user_id, :sender_id
|
||||||
|
@ -10,7 +11,7 @@ class AtMessage < ActiveRecord::Base
|
||||||
has_many :message_alls, :class_name => 'MessageAll',:as =>:message, :dependent => :destroy
|
has_many :message_alls, :class_name => 'MessageAll',:as =>:message, :dependent => :destroy
|
||||||
validates :user_id, :sender_id, :at_message_id, :at_message_type, presence: true
|
validates :user_id, :sender_id, :at_message_id, :at_message_type, presence: true
|
||||||
|
|
||||||
after_create :add_user_message
|
after_create :add_user_message, :send_wechat_message
|
||||||
|
|
||||||
scope :unviewed, ->(type, id){
|
scope :unviewed, ->(type, id){
|
||||||
where(at_message_type: type, at_message_id:id, viewed: false)
|
where(at_message_type: type, at_message_id:id, viewed: false)
|
||||||
|
@ -34,6 +35,91 @@ class AtMessage < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#@的时候发微信模版消息通知被@的人
|
||||||
|
def send_wechat_message
|
||||||
|
shield_type = ""
|
||||||
|
container_id = 0
|
||||||
|
status = 0
|
||||||
|
type = ""
|
||||||
|
detail_id = 0
|
||||||
|
detail_title = ""
|
||||||
|
|
||||||
|
if defined? at_message.notes
|
||||||
|
detail_content = strip_html at_message.notes,30
|
||||||
|
elsif defined? at_message.content
|
||||||
|
detail_content = strip_html at_message.content,30
|
||||||
|
elsif defined? at_message.description
|
||||||
|
detail_content = strip_html at_message.description,30
|
||||||
|
end
|
||||||
|
|
||||||
|
user = self.user
|
||||||
|
|
||||||
|
topic = get_root_parent at_message
|
||||||
|
|
||||||
|
case at_message_type
|
||||||
|
when "Issue"
|
||||||
|
#新建issue
|
||||||
|
shield_type = "Project"
|
||||||
|
container_id = at_message.project.id
|
||||||
|
type = "issues"
|
||||||
|
detail_id = topic.id
|
||||||
|
detail_title = at_message.subject
|
||||||
|
when "Journal"
|
||||||
|
#issue回复
|
||||||
|
topic = get_root_parent at_message.journalized
|
||||||
|
shield_type = "Project"
|
||||||
|
container_id = at_message.journalized.project.id
|
||||||
|
type = "issues"
|
||||||
|
detail_id = topic.id
|
||||||
|
detail_title = at_message.journalized.subject
|
||||||
|
when 'Message'
|
||||||
|
if at_message.course
|
||||||
|
shield_type = "Course"
|
||||||
|
container_id = at_message.course.id
|
||||||
|
type = "course_discussion"
|
||||||
|
detail_id = topic.id
|
||||||
|
detail_title = at_message.subject
|
||||||
|
elsif at_message.project
|
||||||
|
shield_type = "Project"
|
||||||
|
container_id = at_message.project.id
|
||||||
|
type = "project_discussion"
|
||||||
|
detail_id = topic.id
|
||||||
|
detail_title = at_message.subject
|
||||||
|
else
|
||||||
|
status = -1
|
||||||
|
end
|
||||||
|
when 'JournalsForMessage'
|
||||||
|
if at_message.jour && defined? at_message.jour.course
|
||||||
|
#作业回复
|
||||||
|
shield_type = "Course"
|
||||||
|
container_id = at_message.jour.course.id
|
||||||
|
type = "homework"
|
||||||
|
detail_id = at_message.jour.id
|
||||||
|
detail_title = at_message.jour.name
|
||||||
|
else
|
||||||
|
type = "journal_for_message"
|
||||||
|
detail_id = topic.id
|
||||||
|
detail_title = topic.notes.nil? ? "" : topic.notes
|
||||||
|
end
|
||||||
|
else
|
||||||
|
status = -1
|
||||||
|
end
|
||||||
|
|
||||||
|
count = 0
|
||||||
|
|
||||||
|
detail_title = detail_title.gsub(/RE: /, '')
|
||||||
|
|
||||||
|
if container_id != 0
|
||||||
|
count = ShieldWechatMessage.where("container_type='User' and container_id=#{user.id} and shield_type='#{shield_type}' and shield_id=#{container_id}").count
|
||||||
|
end
|
||||||
|
if count == 0 && status == 0
|
||||||
|
message_title = self.sender.show_name+"@了您"
|
||||||
|
ws = WechatService.new
|
||||||
|
ws.at_notice user.id, type, detail_id, message_title, detail_title, format_time(Time.now), detail_content, "点击查看详情。",0
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
def subject
|
def subject
|
||||||
case at_message_type
|
case at_message_type
|
||||||
when "Issue"
|
when "Issue"
|
||||||
|
@ -98,8 +184,10 @@ class AtMessage < ActiveRecord::Base
|
||||||
when 'JournalsForMessage'
|
when 'JournalsForMessage'
|
||||||
if at_message.jour_type == 'Principal'
|
if at_message.jour_type == 'Principal'
|
||||||
{controller: :users, action: :user_messages, id: at_message.at_user}
|
{controller: :users, action: :user_messages, id: at_message.at_user}
|
||||||
else
|
elsif at_message.jour_type == 'HomeworkCommon'
|
||||||
{controller: :homework_common, action: :index, course: at_message.jour.course_id}
|
{controller: :homework_common, action: :index, course: at_message.jour.course_id}
|
||||||
|
elsif at_message.jour_type == 'Course'
|
||||||
|
{controller: :courses, action: :feedback, id: at_message.jour_id}
|
||||||
end
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
|
@ -77,7 +77,8 @@ class HomeworkCommon < ActiveRecord::Base
|
||||||
count = ShieldWechatMessage.where("container_type='User' and container_id=#{m.user_id} and shield_type='Course' and shield_id=#{self.course_id}").count
|
count = ShieldWechatMessage.where("container_type='User' and container_id=#{m.user_id} and shield_type='Course' and shield_id=#{self.course_id}").count
|
||||||
if count == 0
|
if count == 0
|
||||||
ws = WechatService.new
|
ws = WechatService.new
|
||||||
ws.homework_message_notice(m.user_id, "homework", self.id, "#{m.user.show_name},#{l(:label_new_homework_template)}", self.course.name, "新作业:"+ self.name.html_safe, "作业内容请点击“详情”查看。")
|
name = self.course.syllabus.nil? ? self.course.name : self.course.syllabus.title+" • "+self.course.name
|
||||||
|
ws.homework_message_notice(m.user_id, "homework", self.id, "#{m.user.show_name},#{l(:label_new_homework_template)}", name, "新作业:"+ self.name.html_safe, "作业内容请点击“详情”查看。")
|
||||||
end
|
end
|
||||||
# end
|
# end
|
||||||
end
|
end
|
||||||
|
|
|
@ -757,6 +757,7 @@ class Issue < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# 更新issue时,判断更新之前当前是否有自动更新的评论
|
||||||
def init_journal(user, notes = "")
|
def init_journal(user, notes = "")
|
||||||
@current_journal ||= Journal.new(:journalized => self, :user => user, :notes => notes)
|
@current_journal ||= Journal.new(:journalized => self, :user => user, :notes => notes)
|
||||||
if new_record?
|
if new_record?
|
||||||
|
@ -1454,8 +1455,18 @@ class Issue < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
# Callback on file attachment
|
# Callback on file attachment
|
||||||
|
# 在执行issue模块前 执行:当附件被添加时,产生评论
|
||||||
|
# 第一次创建issue时,@current_journal为nil,评论不产生
|
||||||
|
# 当附件名称重名时,也不产生评论
|
||||||
|
# 当更新isuue时,第一次上传的附件的已经存在,则不更新次附件评论
|
||||||
def attachment_added(obj)
|
def attachment_added(obj)
|
||||||
if @current_journal && @current_journal.user_id == obj.author_id && JournalDetail.find_all_by_value(obj.filename).count == 0
|
|
||||||
|
# 找出该issue评论表中,附件重名的个数
|
||||||
|
jor = Journal.where(:journalized_id => self.id)
|
||||||
|
jor_ids = jor.empty? ? "(-1)" : "(" + jor.map{|detail| detail.id}.join(",") + ")"
|
||||||
|
jor_details_count = JournalDetail.where("journal_id in #{jor_ids} and value = '#{obj.filename}'").count
|
||||||
|
|
||||||
|
if @current_journal && @current_journal.user_id == obj.author_id && jor_details_count == 0 && self.attachments.find_all_by_filename(obj.filename).count == 0
|
||||||
@current_journal.details << JournalDetail.new(:property => 'attachment', :prop_key => obj.id, :value => obj.filename)
|
@current_journal.details << JournalDetail.new(:property => 'attachment', :prop_key => obj.id, :value => obj.filename)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -62,7 +62,7 @@ class News < ActiveRecord::Base
|
||||||
:author_key => :author_id
|
:author_key => :author_id
|
||||||
acts_as_watchable
|
acts_as_watchable
|
||||||
|
|
||||||
after_create :act_as_activity,:act_as_forge_activity, :act_as_course_activity, :add_author_as_watcher, :send_mail, :add_news_count, :act_as_student_score, :act_as_system_message, :delay_news_send
|
after_create :act_as_forge_activity, :act_as_course_activity, :add_author_as_watcher, :send_mail, :add_news_count, :act_as_student_score, :act_as_system_message, :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
|
||||||
|
|
||||||
|
@ -140,19 +140,13 @@ class News < ActiveRecord::Base
|
||||||
Watcher.create(:watchable => self, :user => author)
|
Watcher.create(:watchable => self, :user => author)
|
||||||
end
|
end
|
||||||
|
|
||||||
## fq
|
|
||||||
def act_as_activity
|
|
||||||
self.acts << Activity.new(:user_id => self.author_id)
|
|
||||||
end
|
|
||||||
|
|
||||||
# Time 2015-02-27 15:48:17
|
# Time 2015-02-27 15:48:17
|
||||||
# Author lizanle
|
# Author lizanle
|
||||||
# Description 公用表中也要记录
|
# Description 公用表中也要记录
|
||||||
def act_as_forge_activity
|
def act_as_forge_activity
|
||||||
# 如果是project为空,那么是课程相关的,不需要保存
|
# 如果是project为空,那么是课程相关的,不需要保存
|
||||||
if self.project
|
if self.project
|
||||||
self.forge_acts << ForgeActivity.new(:user_id => self.author_id,
|
self.forge_acts << ForgeActivity.new(:user_id => self.author_id, :project_id => self.project.id)
|
||||||
:project_id => self.project.id)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -167,17 +161,17 @@ class News < ActiveRecord::Base
|
||||||
# 消息发送原则:除了消息的发布者,课程的其它成员都能收到消息提醒
|
# 消息发送原则:除了消息的发布者,课程的其它成员都能收到消息提醒
|
||||||
def act_as_system_message
|
def act_as_system_message
|
||||||
if self.course
|
if self.course
|
||||||
self.course.members.each do |m|
|
# self.course.members.each do |m|
|
||||||
if m.user_id != self.author_id
|
# if m.user_id != self.author_id
|
||||||
#self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.course_id, :viewed => false)
|
# #self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.course_id, :viewed => false)
|
||||||
count = ShieldWechatMessage.where("container_type='User' and container_id=#{m.user_id} and shield_type='Course' and shield_id=#{self.course_id}").count
|
# count = ShieldWechatMessage.where("container_type='User' and container_id=#{m.user_id} and shield_type='Course' and shield_id=#{self.course_id}").count
|
||||||
if count == 0
|
# if count == 0
|
||||||
ws = WechatService.new
|
# ws = WechatService.new
|
||||||
content = self.title
|
# content = self.title
|
||||||
ws.class_notice m.user_id, "course_notice", self.id, "#{l(:label_new_notice_template)}", self.course.name, self.author.show_name, format_time(self.created_on), content, "点击查看通知详情"
|
# ws.class_notice m.user_id, "course_notice", self.id, "#{l(:label_new_notice_template)}", self.course.name, self.author.show_name, format_time(self.created_on), content, "点击查看通知详情"
|
||||||
end
|
# end
|
||||||
end
|
# end
|
||||||
end
|
# end
|
||||||
else
|
else
|
||||||
if !self.project.nil?
|
if !self.project.nil?
|
||||||
self.project.members.each do |m|
|
self.project.members.each do |m|
|
||||||
|
@ -198,7 +192,7 @@ class News < ActiveRecord::Base
|
||||||
def contain_news_message
|
def contain_news_message
|
||||||
self.course.members.each do |m|
|
self.course.members.each do |m|
|
||||||
if m.user_id != self.author_id
|
if m.user_id != self.author_id
|
||||||
self.course_messages << CourseMessage.new(:user_id => user_id, :course_id => container_id, :viewed => false)
|
self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.course_id, :viewed => false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#学生提交作品表
|
#学生提交作品表 #work_status :0 未提交 1 已提交 2 迟交 3 分组作品复制的组员作品
|
||||||
class StudentWork < ActiveRecord::Base
|
class StudentWork < ActiveRecord::Base
|
||||||
attr_accessible :name, :description, :homework_common_id, :user_id, :final_score, :teacher_score, :student_score, :teaching_asistant_score, :system_score, :work_score, :project_id, :is_test, :simi_id, :simi_value, :work_status, :commit_time
|
attr_accessible :name, :description, :homework_common_id, :user_id, :final_score, :teacher_score, :student_score, :teaching_asistant_score, :system_score, :work_score, :project_id, :is_test, :simi_id, :simi_value, :work_status, :commit_time
|
||||||
|
|
||||||
|
@ -13,7 +13,8 @@ class StudentWork < ActiveRecord::Base
|
||||||
has_many :course_messages, :class_name =>'CourseMessage', :as => :course_message, :dependent => :destroy
|
has_many :course_messages, :class_name =>'CourseMessage', :as => :course_message, :dependent => :destroy
|
||||||
has_many :attachments, :dependent => :destroy
|
has_many :attachments, :dependent => :destroy
|
||||||
|
|
||||||
scope :has_committed, lambda{where("work_status != 0")}
|
scope :has_committed, lambda{where("work_status != 0 and work_status != 3")}
|
||||||
|
scope :no_copy, lambda{where("work_status != 3")}
|
||||||
|
|
||||||
before_destroy :delete_praise
|
before_destroy :delete_praise
|
||||||
before_save :set_program_score, :set_src
|
before_save :set_program_score, :set_src
|
||||||
|
@ -31,7 +32,7 @@ class StudentWork < ActiveRecord::Base
|
||||||
|
|
||||||
private
|
private
|
||||||
def set_program_score
|
def set_program_score
|
||||||
if homework_common.is_program_homework? #编程作业,学生提交作品后计算系统得分
|
if self.homework_common.is_program_homework? #编程作业,学生提交作品后计算系统得分
|
||||||
#根据最后一次测试计算得分
|
#根据最后一次测试计算得分
|
||||||
unless last_test
|
unless last_test
|
||||||
self.system_score = 0
|
self.system_score = 0
|
||||||
|
|
|
@ -1162,6 +1162,7 @@ class User < Principal
|
||||||
|
|
||||||
#为新注册用户发送留言
|
#为新注册用户发送留言
|
||||||
def add_new_jour
|
def add_new_jour
|
||||||
|
if Setting.find_by_name("hidden_non_project") && Setting.find_by_name("hidden_non_project").value != "0"
|
||||||
if Message.where("id=19504").any? and Message.where("id=19291").any? and Message.where("id=19292").any?
|
if Message.where("id=19504").any? and Message.where("id=19291").any? and Message.where("id=19292").any?
|
||||||
lead_message1 = Message.find(19292)
|
lead_message1 = Message.find(19292)
|
||||||
notes1 = lead_message1.content
|
notes1 = lead_message1.content
|
||||||
|
@ -1175,6 +1176,7 @@ class User < Principal
|
||||||
self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes3, :reply_id => 0, :status => true, :is_readed => false, :private => 0)
|
self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes3, :reply_id => 0, :status => true, :is_readed => false, :private => 0)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# 更新邮箱的同事,更新invite_lists表中的邮箱信息
|
# 更新邮箱的同事,更新invite_lists表中的邮箱信息
|
||||||
def update_invite_list
|
def update_invite_list
|
||||||
|
|
|
@ -79,7 +79,8 @@ class CoursesService
|
||||||
else
|
else
|
||||||
c = Course.find(course)
|
c = Course.find(course)
|
||||||
end
|
end
|
||||||
if current_user.nil? || !(current_user.admin? || c.is_public == 1 || (c.is_public == 0 && current_user.member_of_course?(c)))
|
# if current_user.nil? || !(current_user.admin? || c.is_public == 1 || (c.is_public == 0 && current_user.member_of_course?(c)))
|
||||||
|
if current_user.nil?
|
||||||
raise '403'
|
raise '403'
|
||||||
end
|
end
|
||||||
#@canShowCode = isCourseTeacher(User.current.id,course) && params[:role] != '1'
|
#@canShowCode = isCourseTeacher(User.current.id,course) && params[:role] != '1'
|
||||||
|
@ -331,7 +332,7 @@ class CoursesService
|
||||||
# unless (course.is_public == 1 || current_user.member_of_course?(course) || current_user.admin?)
|
# unless (course.is_public == 1 || current_user.member_of_course?(course) || current_user.admin?)
|
||||||
# raise '403'
|
# raise '403'
|
||||||
# end
|
# end
|
||||||
{:course => course,:work_unit => work_unit, :img_url => url_to_avatar(course),:current_user_is_member => current_user.nil? ? false : current_user.member_of_course?(course),:current_user_is_teacher => current_user.nil? ? false : is_course_teacher(current_user,course),:course_student_num => course ? course.student.count.to_s : 0}
|
{:course => course,:syllabus_title => course.syllabus.nil? ? "":course.syllabus.title ,:work_unit => work_unit, :img_url => url_to_avatar(course),:current_user_is_member => current_user.nil? ? false : current_user.member_of_course?(course),:current_user_is_teacher => current_user.nil? ? false : is_course_teacher(current_user,course),:course_student_num => course ? course.student.count.to_s : 0}
|
||||||
end
|
end
|
||||||
|
|
||||||
#创建课程
|
#创建课程
|
||||||
|
@ -458,8 +459,8 @@ class CoursesService
|
||||||
joined = StudentsForCourse.where('student_id = ? and course_id = ?', user.id, params[:object_id])
|
joined = StudentsForCourse.where('student_id = ? and course_id = ?', user.id, params[:object_id])
|
||||||
joined.each do |join|
|
joined.each do |join|
|
||||||
join.delete
|
join.delete
|
||||||
@state = 0
|
|
||||||
end
|
end
|
||||||
|
@state = 0
|
||||||
@state
|
@state
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -553,8 +554,10 @@ class CoursesService
|
||||||
uid = user.id
|
uid = user.id
|
||||||
type = "review_class_member"
|
type = "review_class_member"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
name = course.syllabus.nil? ? course.name : course.syllabus.title+" • "+course.name
|
||||||
ws = WechatService.new
|
ws = WechatService.new
|
||||||
ws.class_notice user.id, type, course.id, title, course.name, user.show_name, format_time(Time.now), content, remark,uid
|
ws.class_notice user.id, type, course.id, title,name, user.show_name, format_time(Time.now), content, remark,uid
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -649,8 +652,9 @@ class CoursesService
|
||||||
|
|
||||||
rolename = role_ids.include?("7") ? "助教" : "教师"
|
rolename = role_ids.include?("7") ? "助教" : "教师"
|
||||||
content = current_user.show_name + "申请以"+rolename+"身份加入班级,等待您的审批。"
|
content = current_user.show_name + "申请以"+rolename+"身份加入班级,等待您的审批。"
|
||||||
|
name = course.syllabus.nil? ? course.name : course.syllabus.title+" • "+course.name
|
||||||
ws = WechatService.new
|
ws = WechatService.new
|
||||||
ws.class_notice tea_user.id, "review_class_member", course.id, "班级成员审批通知。", course.name, tea_user.show_name, format_time(Time.now), content, "点击查看申请详情。",current_user.id
|
ws.class_notice tea_user.id, "review_class_member", course.id, "班级成员审批通知。", name, tea_user.show_name, format_time(Time.now), content, "点击查看申请详情。",current_user.id
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
#--------------------------------------------
|
#--------------------------------------------
|
||||||
|
@ -940,46 +944,36 @@ class CoursesService
|
||||||
:description => description, :homework_state => state,:open_anonymous_evaluation => open_anonymous_evaluation}
|
:description => description, :homework_state => state,:open_anonymous_evaluation => open_anonymous_evaluation}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def student_homework_score(groupid,course_id, nums, score_sort_by, sort_type = 'score')
|
||||||
def student_homework_score(groupid,course_id, nums, score_sort_by)
|
|
||||||
#teachers = find_course_teachers(@course)
|
|
||||||
#start_from = start_from * nums
|
|
||||||
sql_select = ""
|
sql_select = ""
|
||||||
if groupid == 0
|
if groupid == 0
|
||||||
if nums == 0
|
sql_select = "SELECT members.*,(
|
||||||
sql_select = "SELECT members.*, SUM(homework_attaches.score) as score FROM members, homework_attaches
|
SELECT SUM(student_works.work_score)
|
||||||
WHERE members.course_id = #{course_id} AND members.user_id in (SELECT students_for_courses.student_id FROM students_for_courses WHERE course_id = #{course_id}) AND members.user_id = homework_attaches.user_id
|
FROM student_works,homework_commons
|
||||||
AND homework_attaches.bid_id in (SELECT bid_id FROM homework_for_courses WHERE course_id = #{course_id}) GROUP BY members.user_id
|
WHERE student_works.homework_common_id = homework_commons.id
|
||||||
UNION all
|
AND homework_commons.course_id = course_id
|
||||||
SELECT members.*, 0 as score FROM members,homework_attaches,students_for_courses WHERE members.course_id = #{course_id} AND
|
AND student_works.user_id = members.user_id
|
||||||
students_for_courses.course_id = #{course_id} and members.user_id = students_for_courses.student_id AND
|
) AS score,(SELECT (message_num*2 + message_reply_num*1 + news_reply_num*1 + news_num*1 +
|
||||||
members.user_id NOT IN (SELECT homework_attaches.user_id FROM homework_attaches WHERE homework_attaches.bid_id in (SELECT bid_id FROM homework_for_courses WHERE course_id = #{course_id} )
|
resource_num*5 + journal_num*1 + homework_journal_num*1 ) FROM `course_contributor_scores` AS ccs WHERE ccs.course_id = #{course_id} AND ccs.user_id = members.user_id
|
||||||
)
|
) AS act_score
|
||||||
GROUP BY members.user_id ORDER BY score #{score_sort_by}"
|
FROM members
|
||||||
|
JOIN students_for_courses
|
||||||
|
ON students_for_courses.student_id = members.user_id AND students_for_courses.course_id = members.course_id
|
||||||
|
WHERE members.course_id = #{course_id} ORDER BY #{sort_type} #{score_sort_by}"
|
||||||
else
|
else
|
||||||
sql_select = "SELECT members.*, SUM(homework_attaches.score) as score FROM members, homework_attaches
|
sql_select = "SELECT members.*,(
|
||||||
WHERE members.course_id = #{course_id} AND members.user_id in (SELECT students_for_courses.student_id FROM students_for_courses WHERE course_id = #{course_id}) AND members.user_id = homework_attaches.user_id
|
SELECT SUM(student_works.work_score)
|
||||||
AND homework_attaches.bid_id in (SELECT bid_id FROM homework_for_courses WHERE course_id = #{course_id}) GROUP BY members.user_id
|
FROM student_works,homework_commons
|
||||||
UNION all
|
WHERE student_works.homework_common_id = homework_commons.id
|
||||||
SELECT members.*, 0 as score FROM members,homework_attaches,students_for_courses WHERE members.course_id = #{course_id} AND
|
AND homework_commons.course_id = #{course_id}
|
||||||
students_for_courses.course_id = #{course_id} and members.user_id = students_for_courses.student_id AND
|
AND student_works.user_id = members.user_id
|
||||||
members.user_id NOT IN (SELECT homework_attaches.user_id FROM homework_attaches WHERE homework_attaches.bid_id in (SELECT bid_id FROM homework_for_courses WHERE course_id = #{course_id} )
|
) AS score,(SELECT (message_num*2 + message_reply_num*1 + news_reply_num*1 + news_num*1 +
|
||||||
)
|
resource_num*5 + journal_num*1 + homework_journal_num*1 ) FROM `course_contributor_scores` AS ccs WHERE ccs.course_id = #{course_id} AND ccs.user_id = members.user_id
|
||||||
GROUP BY members.user_id ORDER BY score #{score_sort_by} " #limit #{start_from}, #{nums}"
|
) AS act_score
|
||||||
|
FROM members
|
||||||
end
|
JOIN students_for_courses
|
||||||
else
|
ON students_for_courses.student_id = members.user_id AND students_for_courses.course_id = members.course_id
|
||||||
sql_select = "SELECT members.*, SUM(homework_attaches.score) as score FROM members, homework_attaches
|
WHERE members.course_id = #{course_id} AND members.course_group_id = #{groupid} ORDER BY #{sort_type} #{score_sort_by}"
|
||||||
WHERE members.course_id = #{course_id} AND members.user_id in (SELECT students_for_courses.student_id FROM students_for_courses WHERE course_id = #{course_id}) AND members.user_id = homework_attaches.user_id
|
|
||||||
and members.course_group_id = #{groupid} AND homework_attaches.bid_id in (SELECT bid_id FROM homework_for_courses WHERE course_id = #{course_id})
|
|
||||||
GROUP BY members.user_id
|
|
||||||
UNION all
|
|
||||||
SELECT members.*, 0 as score FROM members,homework_attaches,students_for_courses WHERE members.course_id = #{course_id}
|
|
||||||
and members.course_group_id = #{groupid} AND
|
|
||||||
students_for_courses.course_id = #{course_id} and members.user_id = students_for_courses.student_id AND
|
|
||||||
members.user_id NOT IN (SELECT homework_attaches.user_id FROM homework_attaches WHERE homework_attaches.bid_id in (SELECT bid_id FROM homework_for_courses WHERE course_id = #{course_id} )
|
|
||||||
)
|
|
||||||
GROUP BY members.user_id ORDER BY score #{score_sort_by}"
|
|
||||||
end
|
end
|
||||||
sql = ActiveRecord::Base.connection()
|
sql = ActiveRecord::Base.connection()
|
||||||
homework_scores = Member.find_by_sql(sql_select)
|
homework_scores = Member.find_by_sql(sql_select)
|
||||||
|
@ -1284,5 +1278,35 @@ class CoursesService
|
||||||
status
|
status
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#删除班级成员
|
||||||
|
def delete_course_member course,user_id,current_user
|
||||||
|
if current_user.nil?
|
||||||
|
state = -1
|
||||||
|
return state
|
||||||
|
end
|
||||||
|
|
||||||
|
member = course.members.where("user_id=?",user_id).first
|
||||||
|
|
||||||
|
if member != nil
|
||||||
|
member.destroy
|
||||||
|
user_admin = CourseInfos.where("user_id = ? and course_id = ?", member.user_id, course.id)
|
||||||
|
if user_admin.size > 0
|
||||||
|
user_admin.each do |user|
|
||||||
|
user.destroy
|
||||||
|
end
|
||||||
|
end
|
||||||
|
joined = StudentsForCourse.where('student_id = ? and course_id = ?', member.user_id,course.id)
|
||||||
|
joined.each do |join|
|
||||||
|
join.delete
|
||||||
|
end
|
||||||
|
roles = Role.givable.all[3..5]
|
||||||
|
#移出课程发送消息
|
||||||
|
CourseMessage.create(:user_id => member.user_id, :course_id => course.id, :course_message_type => "RemoveFromCourse", :viewed => false, :course_message_id => current_user.id)
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -355,4 +355,67 @@ class ProjectsService
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
#删除项目成员
|
||||||
|
def project_delete_member project,user_id,current_user
|
||||||
|
if current_user.nil?
|
||||||
|
state = -1
|
||||||
|
return state
|
||||||
|
end
|
||||||
|
|
||||||
|
member = project.members.where("user_id=?",user_id).first
|
||||||
|
|
||||||
|
if member != nil
|
||||||
|
member.destroy
|
||||||
|
# end
|
||||||
|
user_admin = ProjectInfo.where("user_id = ? and project_id = ?", member.user_id, project.id)
|
||||||
|
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 => current_user.id)
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
return 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def exit_project project,user
|
||||||
|
if user.nil?
|
||||||
|
state = -1
|
||||||
|
return state
|
||||||
|
end
|
||||||
|
|
||||||
|
if project.user_id == user.id
|
||||||
|
state = -2
|
||||||
|
return state
|
||||||
|
end
|
||||||
|
|
||||||
|
members = Member.where(:user_id => user.id, :project_id=>project.id).first
|
||||||
|
if members != nil
|
||||||
|
members.destroy
|
||||||
|
# 移出的时候删除申请消息,不需要删除消息,所以不必要关联删除
|
||||||
|
applied_projects = AppliedProject.where(:project_id => project.id, :user_id => members.user_id).first
|
||||||
|
unless applied_projects.nil?
|
||||||
|
applied_projects.delete
|
||||||
|
end
|
||||||
|
state = 0
|
||||||
|
else
|
||||||
|
state = -3
|
||||||
|
end
|
||||||
|
return state
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -69,7 +69,8 @@ class SyllabusesService
|
||||||
if count == 0
|
if count == 0
|
||||||
ws = WechatService.new
|
ws = WechatService.new
|
||||||
title = "恭喜您创建班级成功。"
|
title = "恭喜您创建班级成功。"
|
||||||
ws.create_class_notice user.id, "create_course_notice", course.id,title, course.name, user.show_name, 1, "点击查看班级详情。"
|
name = course.syllabus.nil? ? course.name : course.syllabus.title+" • "+course.name
|
||||||
|
ws.create_class_notice user.id, "create_course_notice", course.id,title, name, user.show_name, 1, "点击查看班级详情。"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#coding=utf-8
|
||||||
class UsersService
|
class UsersService
|
||||||
include ApplicationHelper
|
include ApplicationHelper
|
||||||
include AccountHelper
|
include AccountHelper
|
||||||
|
@ -319,8 +320,22 @@ class UsersService
|
||||||
my_jours_arr
|
my_jours_arr
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def wechat_unbind uw
|
||||||
|
user = uw.user
|
||||||
|
|
||||||
|
#发重新绑定的微信模版消息
|
||||||
|
|
||||||
|
type = "login"
|
||||||
|
title = "尊敬的用户,您已解除绑定。"
|
||||||
|
key1 = "个人原因"
|
||||||
|
remark = "点击进入重新绑定。"
|
||||||
|
|
||||||
|
ws = WechatService.new
|
||||||
|
ws.rebind_notice user.id, type, user.id, title, key1,format_time(Time.now), remark
|
||||||
|
|
||||||
|
uw.user_id = nil
|
||||||
|
uw.delete
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -432,4 +432,54 @@ class WechatService
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def at_notice(user_id, type, id, first, key1, key2,key3,remark="",uid=0)
|
||||||
|
uw = UserWechat.where(user_id: user_id).first
|
||||||
|
unless uw.nil?
|
||||||
|
data = three_keys_template uw.openid,Wechat.config.at_notice, type, id, first, key1, key2, key3, remark,uid
|
||||||
|
begin
|
||||||
|
req = Wechat.api.template_message_send Wechat::Message.to(uw.openid).template(data)
|
||||||
|
rescue Exception => e
|
||||||
|
Rails.logger.error "[at_notice] ===> #{e}"
|
||||||
|
end
|
||||||
|
Rails.logger.info "send over. #{req}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def rebind_notice(user_id, type, id, first, key1, key2,remark="")
|
||||||
|
uw = UserWechat.where(user_id: user_id).first
|
||||||
|
unless uw.nil?
|
||||||
|
data = {
|
||||||
|
touser:uw.openid,
|
||||||
|
template_id:Wechat.config.rebind_notice,
|
||||||
|
url:Wechat.config.auto_openid_url_1+Wechat.config.auto_openid_url_2+"login"+Wechat.config.auto_openid_url_3,
|
||||||
|
topcolor:"#FF0000",
|
||||||
|
data:{
|
||||||
|
first: {
|
||||||
|
value:first,
|
||||||
|
color:"#707070"
|
||||||
|
},
|
||||||
|
keyword1:{
|
||||||
|
value:key1,
|
||||||
|
color:"#707070"
|
||||||
|
},
|
||||||
|
keyword2:{
|
||||||
|
value:key2,
|
||||||
|
color:"#707070"
|
||||||
|
},
|
||||||
|
remark:{
|
||||||
|
value:remark,
|
||||||
|
color:"#707070"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#data = three_keys_template uw.openid,Wechat.config.create_class_notice, type, id, first, key1, key2, key3, remark
|
||||||
|
begin
|
||||||
|
req = Wechat.api.template_message_send Wechat::Message.to(uw.openid).template(data)
|
||||||
|
rescue Exception => e
|
||||||
|
Rails.logger.error "[rebind_notice] ===> #{e}"
|
||||||
|
end
|
||||||
|
Rails.logger.info "send over. #{req}"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
|
@ -62,9 +62,9 @@
|
||||||
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title='<%=strip_html(journal.notes) %>'>
|
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title='<%=strip_html(journal.notes) %>'>
|
||||||
<%case journal.jour_type %>
|
<%case journal.jour_type %>
|
||||||
<% when 'Principal' %>
|
<% when 'Principal' %>
|
||||||
<%= link_to(strip_html(journal.notes), feedback_path(journal.jour_id)) %>
|
<%= link_to(journal.m_parent_id.nil? ? strip_html(journal.notes) : 'RE: ' + strip_html(journal.notes), feedback_path(journal.jour_id)) %>
|
||||||
<% when 'Course' %>
|
<% when 'Course' %>
|
||||||
<%= link_to(strip_html(journal.notes), course_feedback_path(journal.jour_id)) %>
|
<%= link_to(journal.m_parent_id.nil? ? strip_html(journal.notes) : 'RE: ' + strip_html(journal.notes), course_feedback_path(journal.jour_id)) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</td>
|
</td>
|
||||||
<td class="center">
|
<td class="center">
|
||||||
|
|
|
@ -64,7 +64,6 @@
|
||||||
<td class="buttons">
|
<td class="buttons">
|
||||||
<%= link_to(l(:button_archive), { :controller => 'projects', :action => 'archive', :id => project, :status => params[:status] }, :data => {:confirm => l(:text_are_you_sure)}, :method => :post, :class => 'icon icon-lock') unless project.archived? %>
|
<%= link_to(l(:button_archive), { :controller => 'projects', :action => 'archive', :id => project, :status => params[:status] }, :data => {:confirm => l(:text_are_you_sure)}, :method => :post, :class => 'icon icon-lock') unless project.archived? %>
|
||||||
<%= link_to(l(:button_unarchive), { :controller => 'projects', :action => 'unarchive', :id => project, :status => params[:status] }, :method => :post, :class => 'icon icon-unlock') if project.archived? && (project.parent.nil? || !project.parent.archived?) %>
|
<%= link_to(l(:button_unarchive), { :controller => 'projects', :action => 'unarchive', :id => project, :status => params[:status] }, :method => :post, :class => 'icon icon-unlock') if project.archived? && (project.parent.nil? || !project.parent.archived?) %>
|
||||||
<%= link_to(l(:button_copy), { :controller => 'projects', :action => 'copy', :id => project }, :class => 'icon icon-copy') %>
|
|
||||||
<%= link_to(l(:button_delete), project_path(project), :method => :delete, :class => 'icon icon-del', :onClick=>"delcfm()" ) %>
|
<%= link_to(l(:button_delete), project_path(project), :method => :delete, :class => 'icon icon-del', :onClick=>"delcfm()" ) %>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -20,8 +20,8 @@
|
||||||
<th style="width: 100px;">
|
<th style="width: 100px;">
|
||||||
学校名称
|
学校名称
|
||||||
</th>
|
</th>
|
||||||
<th style="width: 35px;">
|
<th style="width: 35px;" class = "<%= @order == 'num' ? (@sort == 'desc' ? 'st_up' : (@sort == 'asc' ? 'st_down' : '')) : '' %>">
|
||||||
用户数
|
<%= link_to '用户数', admin_schools_path(:sort=> @sort == "desc" ? 'asc' : 'desc', :order => 'num') %>
|
||||||
</th>
|
</th>
|
||||||
<th style="width: 90px;">
|
<th style="width: 90px;">
|
||||||
创建时间
|
创建时间
|
||||||
|
|
|
@ -58,7 +58,7 @@
|
||||||
<%= format_date(syllabus.created_at) %>
|
<%= format_date(syllabus.created_at) %>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<% courses = syllabus.courses %>
|
<% courses = syllabus.courses.not_deleted %>
|
||||||
<% courses.each do |course| %>
|
<% courses.each do |course| %>
|
||||||
<tr class="even">
|
<tr class="even">
|
||||||
<td style="text-align: center;">
|
<td style="text-align: center;">
|
||||||
|
|
|
@ -9,8 +9,9 @@
|
||||||
<span class="postAttSize">(
|
<span class="postAttSize">(
|
||||||
<%= number_to_human_size attachment.filesize %>)
|
<%= number_to_human_size attachment.filesize %>)
|
||||||
</span>
|
</span>
|
||||||
<span class="author" title="<%= attachment.author%>">
|
<% user_name = attachment.author.show_name.empty? ? attachment.author : attachment.author.show_name %>
|
||||||
<%= link_to h(truncate(attachment.author.name, length: 15, omission: '...')),user_path(attachment.author),:class => "c_orange" %>,
|
<span class="author" title="<%= user_name %>">
|
||||||
|
<%= link_to h(truncate(user_name, length: 15, omission: '...')),user_path(attachment.author),:class => "linkBlue2" %>,
|
||||||
<%= format_time(attachment.created_on) %>
|
<%= format_time(attachment.created_on) %>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -91,8 +91,8 @@
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if options[:author] %>
|
<% if options[:author] %>
|
||||||
<span class="author" title="<%= attachment.author%>">
|
<span class="author" title="<%= attachment.author.show_name%>">
|
||||||
<%= link_to h(truncate(attachment.author.name, length: 10, omission: '...')),user_path(attachment.author),:class => "link-blue" %>,
|
<%= link_to h(truncate(attachment.author.show_name, length: 10, omission: '...')),user_path(attachment.author),:class => "link-blue" %>,
|
||||||
<%= format_time(attachment.created_on) %>
|
<%= format_time(attachment.created_on) %>
|
||||||
</span>
|
</span>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -1,16 +1,18 @@
|
||||||
<% if @attachment.container_type == 'Course' %>
|
<% if @attachment.container_type == 'Course' %>
|
||||||
$("#is_public_<%= @attachment.id %>").html("<%= escape_javascript(link_to (@attachment.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid=>@attachment.id,:newtype=>(@attachment.is_public? ? 0:1)),
|
$("#is_public_<%= @attachment.id %>").html("<%= escape_javascript(link_to (@attachment.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid=>@attachment.id, :course_id => @attachment.container_id, :tag_name => @tag_name, :other => @other,:newtype=>(@attachment.is_public? ? 0:1)),
|
||||||
:remote=>true,:class=>"postOptionLink",:method => :post) %>");
|
:remote=>true,:class=>"postOptionLink",:method => :post) %>");
|
||||||
|
$("#tip_attachment_count").html("<%= escape_javascript( render :partial => 'files/tip_attachment_count') %>");
|
||||||
<% elsif @attachment.container_type == 'Project' %>
|
<% elsif @attachment.container_type == 'Project' %>
|
||||||
$("#is_public_<%= @attachment.id %>").html("<%= escape_javascript(link_to (@attachment.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid => @attachment.id, :newtype => (@attachment.is_public? ? 0:1)),
|
$("#is_public_<%= @attachment.id %>").html("<%= escape_javascript(link_to (@attachment.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid => @attachment.id, :project_id => @attachment.container_id, :tag_name => @tag_name, :other => @other ,:newtype => (@attachment.is_public? ? 0:1)),
|
||||||
:remote => true, :class => "postOptionLink", :method => :post) %>");
|
:remote => true, :class => "postOptionLink", :method => :post) %>");
|
||||||
|
$("#tip_attachment_count").html("<%= escape_javascript( render :partial => 'files/tip_attachment_count') %>");
|
||||||
|
|
||||||
<% else %>
|
<% else %>
|
||||||
$("#is_public_<%= @attachment.id %>").html("<%= escape_javascript(link_to (@attachment.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid=>@attachment.id,:newtype=>(@attachment.is_public? ? 0:1)),
|
$("#is_public_<%= @attachment.id %>").html("<%= escape_javascript(link_to (@attachment.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid=>@attachment.id,:newtype=>(@attachment.is_public? ? 0:1)),
|
||||||
:remote=>true,:class=>"postOptionLink",:method => :post) %>");
|
:remote=>true,:class=>"postOptionLink",:method => :post) %>");
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if @attachment.is_public? %>
|
<% if @attachment.is_public? %>
|
||||||
$("#image_private_<%= @attachment.id%>").html('')
|
$("#image_private_<%= @attachment.id%>").html('')
|
||||||
<%else%>
|
<%else%>
|
||||||
$("#image_private_<%= @attachment.id%>").html('<span class="img_private ml5">私有</span>')
|
$("#image_private_<%= @attachment.id%>").html('<span class="img_private ml5">私有</span>')
|
||||||
<% end %>
|
<% end %>
|
|
@ -1,4 +1,4 @@
|
||||||
<% if @is_direct == '1' && (@source_type=='User'|| @source_type == 'Course' || @source_type == 'Project') %>
|
<% if @is_direct == '1' && (@source_type=='User'|| @source_type == 'Course' || @source_type == 'Project' || @source_type == 'Organization') %>
|
||||||
var imgSpan = $("img[nhname='avatar_image']");
|
var imgSpan = $("img[nhname='avatar_image']");
|
||||||
imgSpan.attr({"src":'<%= "#{@urlfile.to_s}?#{Time.now.to_i}" %>'});
|
imgSpan.attr({"src":'<%= "#{@urlfile.to_s}?#{Time.now.to_i}" %>'});
|
||||||
<% else %>
|
<% else %>
|
||||||
|
|
|
@ -134,7 +134,7 @@
|
||||||
<div class="homepagePostReplyPortrait">
|
<div class="homepagePostReplyPortrait">
|
||||||
<%= link_to image_tag(url_to_avatar(comment.creator_user), :width => 33, :height => 33, :alt => "用户头像"), user_url_in_org(comment.creator_user.id) %>
|
<%= link_to image_tag(url_to_avatar(comment.creator_user), :width => 33, :height => 33, :alt => "用户头像"), user_url_in_org(comment.creator_user.id) %>
|
||||||
</div>
|
</div>
|
||||||
<div class="homepagePostReplyDes">
|
<div class="homepagePostReplyDes" onmouseover="$('#delete_reply_<%=comment.id%>').show();" onmouseout="$('#delete_reply_<%=comment.id%>').hide();">
|
||||||
<%= render :partial => 'users/message_contents', :locals => {:comment => comment}%>
|
<%= render :partial => 'users/message_contents', :locals => {:comment => comment}%>
|
||||||
|
|
||||||
<% if !comment.content_detail.blank? %>
|
<% if !comment.content_detail.blank? %>
|
||||||
|
@ -161,7 +161,8 @@
|
||||||
l(:button_delete),
|
l(:button_delete),
|
||||||
{:controller => 'blog_comments', :action => 'destroy', :id => comment.id},
|
{:controller => 'blog_comments', :action => 'destroy', :id => comment.id},
|
||||||
:method => :delete,
|
:method => :delete,
|
||||||
:class => 'fr mr20',
|
:id => "delete_reply_#{comment.id}",
|
||||||
|
:class => 'fr mr20 undis',
|
||||||
:data => {:confirm => l(:text_are_you_sure)},
|
:data => {:confirm => l(:text_are_you_sure)},
|
||||||
:title => l(:button_delete)
|
:title => l(:button_delete)
|
||||||
) %>
|
) %>
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
div.talk_new .ke-container{margin-left:2px;}
|
div.talk_new .ke-container{margin-left:2px;}
|
||||||
.break_word {width:100%;}
|
|
||||||
</style>
|
</style>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
//头部导航
|
//头部导航
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
|
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
div.talk_new .ke-container{margin-left:2px;}
|
div.talk_new .ke-container{margin-left:2px;}
|
||||||
.break_word {width:100%;}
|
|
||||||
</style>
|
</style>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
//头部导航
|
//头部导航
|
||||||
|
|
|
@ -54,7 +54,7 @@
|
||||||
<li class="ml45 mb10">
|
<li class="ml45 mb10">
|
||||||
<label><span class="c_red">*</span> <%= l(:label_tags_syllabus_name)%> :</label>
|
<label><span class="c_red">*</span> <%= l(:label_tags_syllabus_name)%> :</label>
|
||||||
<%= select_tag :syllabus_id,options_for_select(course_syllabus_option,@course.syllabus_id), {:id=>"new_syllabus_id", :class=>"syllabus_input"} %>
|
<%= select_tag :syllabus_id,options_for_select(course_syllabus_option,@course.syllabus_id), {:id=>"new_syllabus_id", :class=>"syllabus_input"} %>
|
||||||
<span class="c_red" id="new_syllabus_notice">如果列表中没有对应的课程,请您先<%=link_to '创建课程', new_syllabus_path(),:target => '_blank', :class => 'ml5 green_btn_share c_white'%></span>
|
<span class="c_red" id="new_syllabus_notice">如果列表中没有对应的课程,请您先<%=link_to '创建课程', new_syllabus_path(),:target => '_blank', :class => 'ml5 green_btn_share c_white'%>,然后【刷新】</span>
|
||||||
</li>
|
</li>
|
||||||
<li class="ml45">
|
<li class="ml45">
|
||||||
<label><span class="c_red">*</span> <%= l(:label_tags_course_name)%> :</label>
|
<label><span class="c_red">*</span> <%= l(:label_tags_course_name)%> :</label>
|
||||||
|
|
|
@ -11,27 +11,27 @@
|
||||||
$("#relateProject,.relatePInfo").mouseout(function(){
|
$("#relateProject,.relatePInfo").mouseout(function(){
|
||||||
$(".relatePInfo").css("display","none");
|
$(".relatePInfo").css("display","none");
|
||||||
})
|
})
|
||||||
$(".homepagePostPortrait").mouseover(function(){
|
// $(".homepagePostPortrait").mouseover(function(){
|
||||||
onImage = true;
|
// onImage = true;
|
||||||
$(this).children(".userCard").css("display","block");
|
// $(this).children(".userCard").css("display","block");
|
||||||
})
|
// })
|
||||||
$(".homepagePostPortrait").mouseout(function(){
|
// $(".homepagePostPortrait").mouseout(function(){
|
||||||
var cur = $(this);
|
// var cur = $(this);
|
||||||
onImage = false;
|
// onImage = false;
|
||||||
setTimeout(function(){
|
// setTimeout(function(){
|
||||||
if (onUserCard == false && onImage == false){
|
// if (onUserCard == false && onImage == false){
|
||||||
$(cur).children(".userCard").css("display", "none");
|
// $(cur).children(".userCard").css("display", "none");
|
||||||
}
|
// }
|
||||||
}, 500);
|
// }, 500);
|
||||||
})
|
// })
|
||||||
$(".userCard").mouseover(function(){
|
// $(".userCard").mouseover(function(){
|
||||||
onUserCard = true;
|
// onUserCard = true;
|
||||||
$(this).css("display","block");
|
// $(this).css("display","block");
|
||||||
})
|
// })
|
||||||
$(".userCard").mouseout(function(){
|
// $(".userCard").mouseout(function(){
|
||||||
onUserCard = false;
|
// onUserCard = false;
|
||||||
$(this).css("display","none");
|
// $(this).css("display","none");
|
||||||
})
|
// });
|
||||||
$(".coursesLineGrey").mouseover(function(){
|
$(".coursesLineGrey").mouseover(function(){
|
||||||
$(this).css("color","#ffffff");
|
$(this).css("color","#ffffff");
|
||||||
})
|
})
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<div class="ping_dispic">
|
<div class="ping_dispic">
|
||||||
<%= link_to image_tag(url_to_avatar(journal.user),:width => '46',:height => '46'), user_path(journal.user) %>
|
<%= link_to image_tag(url_to_avatar(journal.user),:width => '46',:height => '46'), user_path(journal.user) %>
|
||||||
</div>
|
</div>
|
||||||
<div class="ping_discon upload_img" style="width: 610px;">
|
<div class="ping_discon upload_img" style="width: 610px;" onmouseover="$('#delete_reply_<%=journal.id %>').show();" onmouseout="$('#delete_reply_<%=journal.id %>').hide();">
|
||||||
<div class="ping_distop f14">
|
<div class="ping_distop f14">
|
||||||
<!-- <a style=" font-weight:bold; color:#15bccf; margin-right:30px; background:none;" target="_blank" href="#">gugu01</a> -->
|
<!-- <a style=" font-weight:bold; color:#15bccf; margin-right:30px; background:none;" target="_blank" href="#">gugu01</a> -->
|
||||||
<span>
|
<span>
|
||||||
|
@ -28,17 +28,17 @@
|
||||||
<span id="reply_praise_count_<%=journal.id %>">
|
<span id="reply_praise_count_<%=journal.id %>">
|
||||||
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>journal, :user_activity_id=>journal.id,:type=>"reply"}%>
|
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>journal, :user_activity_id=>journal.id,:type=>"reply"}%>
|
||||||
</span>
|
</span>
|
||||||
<% if journal.user == User.current|| User.current.admin? || (@course && User.current.allowed_to?(:as_teacher,@course)) %>
|
|
||||||
<%= link_to(l(:label_bid_respond_delete),
|
|
||||||
{:controller => 'words', :action => 'destroy', :object_id => journal, :user_id => @user},
|
|
||||||
:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete',
|
|
||||||
:class => "delete", :title => l(:button_delete)) %>
|
|
||||||
<% end %>
|
|
||||||
<% if reply_allow %>
|
<% if reply_allow %>
|
||||||
<%#= link_to l(:label_bid_respond_quote),'',
|
<%#= link_to l(:label_bid_respond_quote),'',
|
||||||
{:focus => 'project_respond',:nhname=>"reply_btn", :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea')); $('##{ids} textarea') ;return false;"} %>
|
{:focus => 'project_respond',:nhname=>"reply_btn", :onclick => "toggleAndSettingWordsVal($('##{ids}'), $('##{ids} textarea')); $('##{ids} textarea') ;return false;"} %>
|
||||||
<%= link_to l(:label_bid_respond_quote),'javascript:;',{:nhname=>"reply_btn"} %>
|
<%= link_to l(:label_bid_respond_quote),'javascript:;',{:nhname=>"reply_btn"} %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<% if journal.user == User.current|| User.current.admin? || (@course && User.current.allowed_to?(:as_teacher,@course)) %>
|
||||||
|
<%= link_to(l(:label_bid_respond_delete),
|
||||||
|
{:controller => 'words', :action => 'destroy', :object_id => journal, :user_id => @user},
|
||||||
|
:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :id => "delete_reply_#{journal.id}",
|
||||||
|
:class => "delete undis", :title => l(:button_delete)) %>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
<% ids = 'project_respond_form_'+ journal.id.to_s%>
|
<% ids = 'project_respond_form_'+ journal.id.to_s%>
|
||||||
|
|
|
@ -54,11 +54,11 @@
|
||||||
</a>
|
</a>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<%= link_to("#{l(:label_bidding_user_studentname)}:<span >#{member.user.show_name}</span>".html_safe,user_path(member.user)) %>
|
<%= link_to("#{l(:label_bidding_user_studentname)}:<span class='hidden st_info_block'>#{member.user.show_name}</span>".html_safe,user_path(member.user)) %>
|
||||||
</li>
|
</li>
|
||||||
<br/>
|
<br/>
|
||||||
<% unless member.user.user_extensions.student_id == ''%>
|
<% unless member.user.user_extensions.student_id == ''%>
|
||||||
<li><%= link_to("#{l(:label_bidding_user_studentcode)}:<span >#{member.user.user_extensions.student_id}</span>".html_safe,user_path(member.user)) %></li>
|
<li><%= link_to("#{l(:label_bidding_user_studentcode)}:<span class='hidden st_info_block'>#{member.user.user_extensions.student_id}</span>".html_safe,user_path(member.user)) %></li>
|
||||||
<% end%>
|
<% end%>
|
||||||
</ul>
|
</ul>
|
||||||
<% unless @course.course_groups.empty? %>
|
<% unless @course.course_groups.empty? %>
|
||||||
|
|
|
@ -4,7 +4,12 @@
|
||||||
<% exc_course.each_with_index do |e_course, i| %>
|
<% exc_course.each_with_index do |e_course, i| %>
|
||||||
<li>
|
<li>
|
||||||
<span class="sy_sq_orange fl mr5 mt5"><%= i+1 %></span>
|
<span class="sy_sq_orange fl mr5 mt5"><%= i+1 %></span>
|
||||||
<%=link_to e_course.name, course_path(e_course.id), :class => "sy_class_ltitle fl mb10" %>
|
<div class="fl" style="width:185px;">
|
||||||
|
<%= link_to e_course.syllabus.title, syllabus_path(e_course.syllabus_id), :target => '_blank', :class => "sy_class_ltitle"%>
|
||||||
|
<font class="fb c_grey">·</font>
|
||||||
|
<%=link_to e_course.name, course_path(e_course.id), :class => "sy_class_ltitle mb10" %>
|
||||||
|
</div>
|
||||||
|
<div class="cl"></div>
|
||||||
<p class="sy_cgrey ml20">
|
<p class="sy_cgrey ml20">
|
||||||
<% homework_count = e_course.homework_commons.where("publish_time <= '#{Date.today}'").count %>
|
<% homework_count = e_course.homework_commons.where("publish_time <= '#{Date.today}'").count %>
|
||||||
<% if homework_count > 0 %>
|
<% if homework_count > 0 %>
|
||||||
|
|
|
@ -45,9 +45,13 @@
|
||||||
<%= link_to( "", new_exercise_path(:course_id => @course.id), :class => 'sy_class_add', :title =>"新建试卷") if is_teacher %>
|
<%= link_to( "", new_exercise_path(:course_id => @course.id), :class => 'sy_class_add', :title =>"新建试卷") if is_teacher %>
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<% if (User.current.logged? && @course.open_student == 1) || (User.current.member_of_course?(@course)) || User.current.admin? %>
|
||||||
|
<li>
|
||||||
|
<%=link_to "分班", course_member_path(@course, :role => 2) %>
|
||||||
|
</li>
|
||||||
|
<% end %>
|
||||||
<% if show_nav?(0) %>
|
<% if show_nav?(0) %>
|
||||||
<li>
|
<li>
|
||||||
<a href="<%=statistics_course_course_path(@course) %>">统计</a>
|
<a href="<%=statistics_course_course_path(@course) %>">统计</a>
|
||||||
<!--<a href="javascript:void(0);" class="sy_class_add"></a>-->
|
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
|
@ -8,7 +8,7 @@
|
||||||
<label><span class="c_red">*</span> <%= l(:label_tags_syllabus_name)%> :</label>
|
<label><span class="c_red">*</span> <%= l(:label_tags_syllabus_name)%> :</label>
|
||||||
<% if @syllabus.nil? %>
|
<% if @syllabus.nil? %>
|
||||||
<%= select_tag :syllabus_id,options_for_select(course_syllabus_option,@course.syllabus_id), {:id=>"new_syllabus_id", :class=>"syllabus_input"} %>
|
<%= select_tag :syllabus_id,options_for_select(course_syllabus_option,@course.syllabus_id), {:id=>"new_syllabus_id", :class=>"syllabus_input"} %>
|
||||||
<span class="c_red" id="new_syllabus_notice">如果列表中没有对应的课程,请您先<%=link_to '创建课程', new_syllabus_path(),:target => '_blank', :class => 'ml5 green_btn_share c_white'%></span>
|
<span class="c_red" id="new_syllabus_notice">如果列表中没有对应的课程,请您先<%=link_to '创建课程', new_syllabus_path(),:target => '_blank', :class => 'ml5 green_btn_share c_white'%>,然后【刷新】</span>
|
||||||
<% else %>
|
<% else %>
|
||||||
<span><%=@syllabus.title %></span>
|
<span><%=@syllabus.title %></span>
|
||||||
<input style="display: none;" name="syllabus_id" value="<%=@syllabus.id %>" />
|
<input style="display: none;" name="syllabus_id" value="<%=@syllabus.id %>" />
|
||||||
|
@ -17,10 +17,13 @@
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
<li class="ml45">
|
<li class="ml45">
|
||||||
<label><span class="c_red">*</span> <%= l(:label_tags_course_name)%> :</label>
|
<label><span class="c_red">*</span> <%= l(:label_tags_course_name)%> :</label>
|
||||||
<input type="text" name="course[name]" id="new_course_name" class="courses_input" maxlength="100" placeholder="例如:软件工程计算机系A班" onkeyup="regex_course_name('new');">
|
<input type="text" name="course[name]" id="new_course_name" class="courses_input" maxlength="100" placeholder="例如:计算机系2016秋季A班" onkeyup="regex_course_name('new');">
|
||||||
<span class="c_red" id="new_course_name_notice" style="display: none;">班级名称不能为空且至少有两个字符</span>
|
<span class="c_red" id="new_course_name_notice" style="display: none;">班级名称不能为空且至少有两个字符</span>
|
||||||
</li>
|
</li>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
|
<li class="ml125 mb5 fontGrey3"><span class="success-icon mr25">正确示例:计算机系2016秋季A班</span></li>
|
||||||
|
<li class="ml125 mb10 fontGrey3"><span class="error-icon">错误示例:软件工程 - 计算机系2016秋季A班</span></li>
|
||||||
|
<li class="ml125 mt10 mb10 fontGrey2" style="max-width: 544px;">班级是一个由教师、助教(教辅)和学生组成的临时的教学群体,在规定的时间内(如一个学期)完成一门课程规定的教学任务。本质上,一门课程就是一个教学计划。</li>
|
||||||
<li class="ml45">
|
<li class="ml45">
|
||||||
<label><span class="c_red">*</span> <%= l(:label_class_period)%> :</label>
|
<label><span class="c_red">*</span> <%= l(:label_class_period)%> :</label>
|
||||||
<input type="text" name="class_period" id="new_class_period" class="hwork_input02" onkeyup="regex_course_class_period('new');" placeholder="例如:54" maxlength="6">
|
<input type="text" name="class_period" id="new_class_period" class="hwork_input02" onkeyup="regex_course_class_period('new');" placeholder="例如:54" maxlength="6">
|
||||||
|
@ -73,7 +76,7 @@
|
||||||
<span class="c_grey">(选中后允许学生上传班级资源,否则不允许)</span>
|
<span class="c_grey">(选中后允许学生上传班级资源,否则不允许)</span>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
</li>
|
</li>
|
||||||
<li class=" ml90" >
|
<li class=" ml30" >
|
||||||
<a href="javascript:void(0)" class="blue_btn fl c_white" onclick="submit_new_course();" >提交</a>
|
<a href="javascript:void(0)" class="blue_btn fl c_white" onclick="submit_new_course();" >提交</a>
|
||||||
<%= link_to "取消",user_activities_path(User.current.id),:class => "grey_btn fl c_white ml10"%>
|
<%= link_to "取消",user_activities_path(User.current.id),:class => "grey_btn fl c_white ml10"%>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
|
|
|
@ -32,8 +32,8 @@
|
||||||
</li>
|
</li>
|
||||||
<li class="ml45 mb10">
|
<li class="ml45 mb10">
|
||||||
<label><span class="c_red">*</span> <%= l(:label_tags_syllabus_name)%> :</label>
|
<label><span class="c_red">*</span> <%= l(:label_tags_syllabus_name)%> :</label>
|
||||||
<%= select_tag :syllabus_id,options_for_select(course_syllabus_option,@course.syllabus_id), {:id=>"edit_syllabus_id", :class=>"syllabus_input", :style=>'width:280px'} %>
|
<%= select_tag :syllabus_id,options_for_select(course_syllabus_option,@course.syllabus_id), {:id=>"edit_syllabus_id", :class=>"syllabus_input", :style=>'width:210px'} %>
|
||||||
<span class="c_red" id="edit_syllabus_notice">如果列表中没有对应的课程,请您先<%=link_to '创建课程', new_syllabus_path(),:target => '_blank', :class => 'ml5 green_btn_share c_white'%></span>
|
<span class="c_red" id="edit_syllabus_notice">如果列表中没有对应的课程,请您先<%=link_to '创建课程', new_syllabus_path(),:target => '_blank', :class => 'ml5 green_btn_share c_white'%>,然后【刷新】</span>
|
||||||
</li>
|
</li>
|
||||||
<li class="ml45">
|
<li class="ml45">
|
||||||
<label><span class="c_red">*</span> <%= l(:label_tags_course_name)%> :</label>
|
<label><span class="c_red">*</span> <%= l(:label_tags_course_name)%> :</label>
|
||||||
|
|
|
@ -218,8 +218,12 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<div class="ur_buttons">
|
<div class="ur_buttons">
|
||||||
|
<% if exercise.time == -1 %>
|
||||||
<%= link_to "保存",commit_exercise_exercise_path(exercise,:save => 1),:id=>"exercise_submit_btn", :method => :post,:class => "ur_button_submit",:format => 'js',:remote=>true %>
|
<%= link_to "保存",commit_exercise_exercise_path(exercise,:save => 1),:id=>"exercise_submit_btn", :method => :post,:class => "ur_button_submit",:format => 'js',:remote=>true %>
|
||||||
<%= link_to "提交",commit_exercise_exercise_path(exercise), :data => {:confirm => "您确定要提交吗?"},:id=>"exercise_submit_btn", :method => :post,:class => "ur_button_submit",:style => "margin-left:20px;",:format => 'js',:remote=>true %>
|
<%= link_to "提交",commit_exercise_exercise_path(exercise), :data => {:confirm => "您确定要提交吗?"},:id=>"exercise_submit_btn", :method => :post,:class => "ur_button_submit",:style => "margin-left:20px;",:format => 'js',:remote=>true %>
|
||||||
|
<% else %>
|
||||||
|
<%= link_to "提交",commit_exercise_exercise_path(exercise), :data => {:confirm => "您确定要提交吗?"},:id=>"exercise_submit_btn", :method => :post,:class => "ur_button_submit",:style => "margin-left:84px;",:format => 'js',:remote=>true %>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
<!--contentbox end-->
|
<!--contentbox end-->
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
<tr class="b_grey hworkH30">
|
<tr class="b_grey hworkH30">
|
||||||
<th class="hworkList30 pl5 pr5"><span class="c_dark f14 fb">序号</span></th>
|
<th class="hworkList30 pl5 pr5"><span class="c_dark f14 fb">序号</span></th>
|
||||||
<th class="hworkList50"> </th>
|
<th class="hworkList50"> </th>
|
||||||
<th class="hworkList60"><span class="c_dark f14 fb">姓名</span></th>
|
<th class="hworkList130"><span class="c_dark f14 fb">姓名</span></th>
|
||||||
<th class="hworkList80"><span class="c_dark f14 fb">学号</span></th>
|
<th class="hworkList130"><span class="c_dark f14 fb">学号</span></th>
|
||||||
<th class="hworkList80"><span class="c_dark f14 fb">班级</span></th>
|
<th class="hworkList130"><span class="c_dark f14 fb">班级</span></th>
|
||||||
<th width="230"> </th>
|
<th width="60"> </th>
|
||||||
<th class="hworkList130">
|
<th class="hworkList130">
|
||||||
<%= link_to "时间",'',:class => "c_dark f14 fb" ,:remote => true%>
|
<%= link_to "时间",'',:class => "c_dark f14 fb" ,:remote => true%>
|
||||||
</th>
|
</th>
|
||||||
|
@ -17,19 +17,19 @@
|
||||||
<% @exercise_users_list.each_with_index do |exercise, index|%>
|
<% @exercise_users_list.each_with_index do |exercise, index|%>
|
||||||
<tr class="hworkListRow" id="student_work_<%= exercise.id%>">
|
<tr class="hworkListRow" id="student_work_<%= exercise.id%>">
|
||||||
<td class="pl5 pr5" style="text-align:center;"><%=index + 1 %></td>
|
<td class="pl5 pr5" style="text-align:center;"><%=index + 1 %></td>
|
||||||
<td class="hworkPortrait pr10 float-none">
|
<td class="hworkPortrait float-none">
|
||||||
<%= link_to(image_tag(url_to_avatar(exercise.user),:width =>"40",:height => "40",:style => "display:block;", :class => "mt15"),user_activities_path(exercise.user)) %>
|
<%= link_to(image_tag(url_to_avatar(exercise.user),:width =>"40",:height => "40",:style => "display:block;", :class => "mt15"),user_activities_path(exercise.user)) %>
|
||||||
</td>
|
</td>
|
||||||
<td class="hworkStName student_work_<%= exercise.id%>" title="姓名" id="student_name_<%= exercise.id%>" style="cursor:pointer;">
|
<td class="hworkStName130 pr10 student_work_<%= exercise.id%>" title="姓名" id="student_name_<%= exercise.id%>" style="cursor:pointer;">
|
||||||
<%=exercise.user.show_name %>
|
<%=exercise.user.show_name %>
|
||||||
</td>
|
</td>
|
||||||
<td class="hworkStID student_work_<%= exercise.id%> pl15 pr10 float-none" title="学号" id="student_id_<%= exercise.id%>" style="cursor:pointer;">
|
<td class="hworkStID130 pr10 student_work_<%= exercise.id%> float-none" title="学号" id="student_id_<%= exercise.id%>" style="cursor:pointer;">
|
||||||
<span class="hidden fl" style="width:80px;"><%= exercise.user.user_extensions.nil? ? "--" : exercise.user.user_extensions.student_id%></span>
|
<span class="hidden fl" style="width:130px;"><%= exercise.user.user_extensions.nil? ? "--" : exercise.user.user_extensions.student_id%></span>
|
||||||
</td>
|
</td>
|
||||||
<td class="hworkStID student_work_<%= exercise.id%> float-none" title="班级" id="student_class_<%= exercise.id%>" style="cursor:pointer;">
|
<td class="hworkStID130 student_work_<%= exercise.id%> float-none" title="班级" id="student_class_<%= exercise.id%>" style="cursor:pointer;">
|
||||||
--
|
--
|
||||||
</td>
|
</td>
|
||||||
<td width="230"> </td>
|
<td width="60"> </td>
|
||||||
<td class="hworkList130 c_grey">
|
<td class="hworkList130 c_grey">
|
||||||
<% if exercise.created_at%>
|
<% if exercise.created_at%>
|
||||||
<%= Time.parse(format_time(exercise.created_at)).strftime("%m-%d %H:%M")%>
|
<%= Time.parse(format_time(exercise.created_at)).strftime("%m-%d %H:%M")%>
|
||||||
|
@ -45,13 +45,13 @@
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
$(function(){
|
||||||
|
<% if Time.parse(h(@exercise.end_time)).strftime("%Y-%m-%d-%H-%M-%S") <= Time.now.strftime("%Y-%m-%d-%H-%M-%S") %>
|
||||||
$(".student_work_<%= exercise.id%>").mouseenter(function(){
|
$(".student_work_<%= exercise.id%>").mouseenter(function(){
|
||||||
$("#work_click_<%= exercise.id%>").show();
|
$("#work_click_<%= exercise.id%>").show();
|
||||||
}).mouseleave(function(){
|
}).mouseleave(function(){
|
||||||
$("#work_click_<%= exercise.id%>").hide();
|
$("#work_click_<%= exercise.id%>").hide();
|
||||||
}).mouse;
|
}).mouse;
|
||||||
$(function(){
|
|
||||||
<% if Time.parse(h(@exercise.end_time)).strftime("%Y-%m-%d-%H-%M-%S") <= Time.now.strftime("%Y-%m-%d-%H-%M-%S") %>
|
|
||||||
$("#student_name_<%= exercise.id%>,#student_id_<%= exercise.id%>,#student_class_<%= exercise.id%>").on('click',function() {
|
$("#student_name_<%= exercise.id%>,#student_id_<%= exercise.id%>,#student_class_<%= exercise.id%>").on('click',function() {
|
||||||
window.location.href = '<%=show_student_result_exercise_path(@exercise,:user_id => exercise.user_id) %>';
|
window.location.href = '<%=show_student_result_exercise_path(@exercise,:user_id => exercise.user_id) %>';
|
||||||
});
|
});
|
||||||
|
|
|
@ -115,22 +115,23 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
<div class="re_con_top">
|
<div class="re_con_top">
|
||||||
<!--<p class="f_l fontBlue f_b f_14" id="tip_attachment_count">-->
|
<p class="f_l fontBlue f_b f_14" id="tip_attachment_count">
|
||||||
<!--<%#= render :partial => "files/tip_attachment_count" %>-->
|
<%= render :partial => "files/tip_attachment_count" %>
|
||||||
<!--</p>-->
|
</p>
|
||||||
<p class="f_l fontBlue f_b f_14">共有 <span id="attachment_count"><%= @all_attachments.count%></span> 个资源</p>
|
|
||||||
<p class="f_r" style="color: #808080" id="course_filter_order">
|
<p class="f_r" style="color: #808080" id="course_filter_order">
|
||||||
<%= render :partial => 'course_file_filter_order', :locals => {:remote => @is_remote, :sort => @sort, :order => @order} %>
|
<%= render :partial => 'course_file_filter_order', :locals => {:remote => @is_remote, :sort => @sort, :order => @order} %>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
<!--<div class="resource_tip_box fontGrey2">-->
|
<% if !User.current.member_of_course?(@course) && show_attachment_tip(@course.id, "Course") %>
|
||||||
<!--<em></em>-->
|
<div class="resource_tip_box fontGrey2">
|
||||||
<!--<span></span>-->
|
<em></em>
|
||||||
<!--<p class="mb5">私有资源:<br/>仅对本班级成员可见</p>-->
|
<span></span>
|
||||||
<!--<p>公共资源:<br/>对所有用户可见</p>-->
|
<p class="mb5">私有资源:<br/>仅对本班级成员可见</p>
|
||||||
<!--</div>-->
|
<p>公共资源:<br/>对所有用户可见</p>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<div id="course_list">
|
<div id="course_list">
|
||||||
<%= render :partial => 'course_list',:locals => {course: @course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments} %>
|
<%= render :partial => 'course_list',:locals => {course: @course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments} %>
|
||||||
|
|
|
@ -63,7 +63,11 @@
|
||||||
<li class="homepagePostSettingIcon">
|
<li class="homepagePostSettingIcon">
|
||||||
<% if (delete_allowed || User.current.id == file.author_id) && file.container_id == org_subfield.id && file.container_type == "OrgSubfield" %>
|
<% if (delete_allowed || User.current.id == file.author_id) && file.container_id == org_subfield.id && file.container_type == "OrgSubfield" %>
|
||||||
<ul class="homepagePostSettiongText">
|
<ul class="homepagePostSettiongText">
|
||||||
|
<% if hidden_unproject_infos %>
|
||||||
<li><%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %></li>
|
<li><%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %></li>
|
||||||
|
<% else %>
|
||||||
|
<li><%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send_hidden('#{file.id}','#{User.current.id}','file')") %></li>
|
||||||
|
<% end %>
|
||||||
<li><%= link_to '更新版本',attachments_versions_path(file),:class => "postOptionLink",:remote=>true %></li>
|
<li><%= link_to '更新版本',attachments_versions_path(file),:class => "postOptionLink",:remote=>true %></li>
|
||||||
<% if file.container.try(:organization).try(:is_public?) %>
|
<% if file.container.try(:organization).try(:is_public?) %>
|
||||||
<li>
|
<li>
|
||||||
|
|
|
@ -85,10 +85,9 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
<div class="re_con_top">
|
<div class="re_con_top">
|
||||||
<!--<p class="f_l fontBlue f_b f_14" id="tip_attachment_count">-->
|
<p class="f_l fontBlue f_b f_14" id="tip_attachment_count">
|
||||||
<!--<%#= render :partial => "files/tip_attachment_count" %>-->
|
<%= render :partial => "files/tip_attachment_count" %>
|
||||||
<!--</p>-->
|
</p>
|
||||||
<p class="f_l fontBlue f_b f_14">共有 <span id="attachment_count"><%= @all_attachments.count%></span> 个资源</p>
|
|
||||||
<p class="f_r" style="color: #808080">
|
<p class="f_r" style="color: #808080">
|
||||||
<% if @order == "asc" %>
|
<% if @order == "asc" %>
|
||||||
按 <%= link_to "时间",params.merge(:sort=>"created_on:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"created_on"} %> /
|
按 <%= link_to "时间",params.merge(:sort=>"created_on:desc"),:class => "f_b c_grey",:remote => @is_remote %><%= render partial: 'files/arrow_show',locals: { sort: @sort,order:@order,current:"created_on"} %> /
|
||||||
|
@ -103,14 +102,14 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
<%# if !User.current.member_of?(@project) && show_attachment_tip(@project.id, "Project") %>
|
<% if !User.current.member_of?(@project) && show_attachment_tip(@project.id, "Project") %>
|
||||||
<!--<div class="resource_tip_box fontGrey2">-->
|
<div class="resource_tip_box fontGrey2">
|
||||||
<!--<em></em>-->
|
<em></em>
|
||||||
<!--<span></span>-->
|
<span></span>
|
||||||
<!--<p class="mb5">私有资源:<br/>仅对本项目成员可见</p>-->
|
<p class="mb5">私有资源:<br/>仅对本项目成员可见</p>
|
||||||
<!--<p>公共资源:<br/>对所有用户可见</p>-->
|
<p>公共资源:<br/>对所有用户可见</p>
|
||||||
<!--</div>-->
|
</div>
|
||||||
<%# end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<div id="course_list">
|
<div id="course_list">
|
||||||
<%= render :partial => 'project_list',:locals => {project: @project, all_attachments: @all_attachments, sort:@sort, order:@order, project_attachments:@obj_attachments} %>
|
<%= render :partial => 'project_list',:locals => {project: @project, all_attachments: @all_attachments, sort:@sort, order:@order, project_attachments:@obj_attachments} %>
|
||||||
|
|
|
@ -70,7 +70,11 @@
|
||||||
<% if @course.is_public? %>
|
<% if @course.is_public? %>
|
||||||
<li>
|
<li>
|
||||||
<span id="is_public_<%= file.id %>">
|
<span id="is_public_<%= file.id %>">
|
||||||
<%= link_to (file.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid=>file.id,:newtype=>(file.is_public? ? 0:1)),:remote=>true,:class=>"postOptionLink",:method => :post %>
|
<% if params[:tag_name].blank? %>
|
||||||
|
<%= link_to (file.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid => file.id, :newtype=>(file.is_public? ? 0:1), :course_id => @course.id), :remote=>true,:class=>"postOptionLink",:method => :post %>
|
||||||
|
<% else %>
|
||||||
|
<%= link_to (file.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid => file.id, :newtype=>(file.is_public? ? 0:1), :tag_name => params[:tag_name].force_encoding("UTF-8"), :course_id => @course.id, :other => params[:other]), :remote=>true,:class=>"postOptionLink",:method => :post %>
|
||||||
|
<% end %>
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
<%end%>
|
<%end%>
|
||||||
|
|
|
@ -1,15 +1,18 @@
|
||||||
共有 <span id="attachment_count"><%= @tip_all_attachments %></span> 个资源
|
共有 <span id="attachment_count"><%= @tip_all_attachments %></span> 个资源
|
||||||
<span id="attachment_count_public" class="fontGrey2 ml10" style="font-weight: normal;">公共资源:<%= @tip_all_public_attachments %>个</span>
|
<% if @tip_all_private_attachments != 0 %>
|
||||||
<% if @project %>
|
<span id="attachment_count_public" class="fontGrey2 ml10" style="font-weight: normal;">公共资源:<%= @tip_all_public_attachments %>个</span>
|
||||||
|
<% if @project %>
|
||||||
<% if !User.current.member_of?(@project) && params[:tag_name] %>
|
<% if !User.current.member_of?(@project) && params[:tag_name] %>
|
||||||
<span id="attachment_count_private" class="fontGrey2 ml10" style="font-weight: normal;">私有资源:0个</span>
|
<span id="attachment_count_private" class="fontGrey2 ml10" style="font-weight: normal;">私有资源:0个</span>
|
||||||
<% else %>
|
<% else %>
|
||||||
<span id="attachment_count_private" class="fontGrey2 ml10" style="font-weight: normal;">私有资源:<%= @tip_all_private_attachments %>个</span>
|
<span id="attachment_count_private" class="fontGrey2 ml10" style="font-weight: normal;">私有资源:<%= @tip_all_private_attachments %>个</span>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% elsif @course %>
|
<% elsif @course %>
|
||||||
<% if !User.current.member_of_course?(@course) && params[:tag_name] %>
|
<% if !User.current.member_of_course?(@course) && params[:tag_name] %>
|
||||||
<span id="attachment_count_private" class="fontGrey2 ml10" style="font-weight: normal;">私有资源:0个</span>
|
<span id="attachment_count_private" class="fontGrey2 ml10" style="font-weight: normal;">私有资源:0个</span>
|
||||||
<% else %>
|
<% else %>
|
||||||
<span id="attachment_count_private" class="fontGrey2 ml10" style="font-weight: normal;">私有资源:<%= @tip_all_private_attachments %>个</span>
|
<span id="attachment_count_private" class="fontGrey2 ml10" style="font-weight: normal;">私有资源:<%= @tip_all_private_attachments %>个</span>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -4,12 +4,25 @@
|
||||||
<% if User.current.admin? || ((is_project_manager?(User.current, project) || file.author_id == User.current.id) && project_contains_attachment?(project, file)) %>
|
<% if User.current.admin? || ((is_project_manager?(User.current, project) || file.author_id == User.current.id) && project_contains_attachment?(project, file)) %>
|
||||||
<% if User.current.admin? || ((delete_allowed || User.current.id == file.author_id) && file.container_id == project.id && file.container_type == "Project") %>
|
<% if User.current.admin? || ((delete_allowed || User.current.id == file.author_id) && file.container_id == project.id && file.container_type == "Project") %>
|
||||||
<ul class="homepagePostSettiongText">
|
<ul class="homepagePostSettiongText">
|
||||||
|
<% if hidden_unproject_infos %>
|
||||||
<li><%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %></li>
|
<li><%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %></li>
|
||||||
<li><%= link_to '更新版本',attachments_versions_path(file),:class => "postOptionLink",:remote=>true %></li>
|
<% else %>
|
||||||
|
<li><%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send_hidden('#{file.id}','#{User.current.id}','file')") %></li>
|
||||||
|
<% end %>
|
||||||
|
<% if params[:tag_name].blank? %>
|
||||||
|
<li><%= link_to '更新版本',attachments_versions_path(file, :project_id => project.id), :class => "postOptionLink", :remote => true %></li>
|
||||||
|
<% else %>
|
||||||
|
<li><%= link_to '更新版本',attachments_versions_path(file, :tag_name => params[:tag_name].force_encoding("UTF-8"), :project_id => project.id, :other => params[:other]),:class => "postOptionLink",:remote=>true %></li>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<% if project.is_public? %>
|
<% if project.is_public? %>
|
||||||
<li>
|
<li>
|
||||||
<span id="is_public_<%= file.id %>">
|
<span id="is_public_<%= file.id %>">
|
||||||
<%= link_to (file.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid => file.id, :newtype=>(file.is_public? ? 0:1)), :remote=>true,:class=>"postOptionLink",:method => :post %>
|
<% if params[:tag_name].blank? %>
|
||||||
|
<%= link_to (file.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid => file.id, :newtype=>(file.is_public? ? 0:1), :project_id => project.id), :remote=>true,:class=>"postOptionLink",:method => :post %>
|
||||||
|
<% else %>
|
||||||
|
<%= link_to (file.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid => file.id, :newtype=>(file.is_public? ? 0:1), :tag_name => params[:tag_name].force_encoding("UTF-8"), :project_id => project.id, :other => params[:other]), :remote=>true,:class=>"postOptionLink",:method => :post %>
|
||||||
|
<% end %>
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
@ -20,7 +33,11 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<ul class="resourceSendO">
|
<ul class="resourceSendO">
|
||||||
|
<% if hidden_unproject_infos %>
|
||||||
<li><%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %></li>
|
<li><%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send('#{file.id}','#{User.current.id}','file')") %></li>
|
||||||
|
<% else %>
|
||||||
|
<li><%= link_to("发 送".html_safe, 'javascript:void(0)',:class => "postOptionLink2",:onclick=>"show_send_hidden('#{file.id}','#{User.current.id}','file')") %></li>
|
||||||
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
|
||||||
$("#resource_list").html("<%= escape_javascript( render :partial => 'files/course_file',:locals => {course:@course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments} )%>");
|
$("#resource_list").html("<%= escape_javascript( render :partial => 'files/course_file',:locals => {course:@course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments} )%>");
|
||||||
$("#pages").html('<%= pagination_links_full @feedback_pages, @feedback_count, :per_page_links => false, :remote => true, :flag => true %>');
|
$("#pages").html('<%= pagination_links_full @feedback_pages, @feedback_count, :per_page_links => false, :remote => true, :flag => true %>');
|
||||||
|
$("#tip_attachment_count").html("<%= escape_javascript( render :partial => 'files/tip_attachment_count') %>");
|
|
@ -1,8 +1,8 @@
|
||||||
<% if @course %>
|
<% if @course %>
|
||||||
$("#resource_list").html("<%= escape_javascript( render :partial => 'files/course_file',:locals => {course:@course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments} )%>");
|
$("#resource_list").html("<%= escape_javascript( render :partial => 'files/course_file',:locals => {course:@course,all_attachments: @all_attachments,sort:@sort,order:@order,curse_attachments:@obj_attachments} )%>");
|
||||||
$("#pages").html('<%= pagination_links_full @feedback_pages, @feedback_count, :per_page_links => false, :remote => true, :flag => true %>');
|
$("#pages").html('<%= pagination_links_full @feedback_pages, @feedback_count, :per_page_links => false, :remote => true, :flag => true %>');
|
||||||
<% else %>
|
<% else %>
|
||||||
$("#resource_list").html("<%= escape_javascript( render :partial => 'files/project_file',:locals => {project:@project, all_attachments:@all_attachments, sort:@sort, order:@order, project_attachments:@obj_attachments}) %>");
|
$("#resource_list").html("<%= escape_javascript( render :partial => 'files/project_file',:locals => {project:@project, all_attachments:@all_attachments, sort:@sort, order:@order, project_attachments:@obj_attachments}) %>");
|
||||||
// $("#tip_attachment_count").html("<%#= escape_javascript( render :partial => 'files/tip_attachment_count') %>");
|
$("#tip_attachment_count").html("<%= escape_javascript( render :partial => 'files/tip_attachment_count') %>");
|
||||||
$("#pages").html('<%= pagination_links_full @feedback_pages, @feedback_count, :per_page_links => false, :remote => true, :flag => true %>');
|
$("#pages").html('<%= pagination_links_full @feedback_pages, @feedback_count, :per_page_links => false, :remote => true, :flag => true %>');
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -11,7 +11,8 @@
|
||||||
<%#= link_to forum.name.gsub(/(\r\n|\s+)/,'<br/>'), forum_path(forum),:class=>"f16 linkBlue" %>
|
<%#= link_to forum.name.gsub(/(\r\n|\s+)/,'<br/>'), forum_path(forum),:class=>"f16 linkBlue" %>
|
||||||
</div>
|
</div>
|
||||||
<div class="postDes"><%= textAreailizable forum.description%></div>
|
<div class="postDes"><%= textAreailizable forum.description%></div>
|
||||||
<div class="postCreater">创建者:<a href="<%= user_path( forum.creator)%>" class="linkGrey2" target="_blank"><%= forum.creator.name %></a></div>
|
<% user_name = forum.creator.show_name.empty? ? forum.creator.name : forum.creator.show_name %>
|
||||||
|
<div class="postCreater">创建者:<a href="<%= user_path( forum.creator)%>" class="linkGrey2" target="_blank"><%= user_name %></a></div>
|
||||||
<div class="postDate">创建时间:<%= format_date(forum.created_at) %></div>
|
<div class="postDate">创建时间:<%= format_date(forum.created_at) %></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="postStatics">
|
<div class="postStatics">
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
</div>
|
</div>
|
||||||
<% author = topic.last_reply.try(:author)%>
|
<% author = topic.last_reply.try(:author)%>
|
||||||
<% if author%>
|
<% if author%>
|
||||||
<div class="postDetailCreater">最后回复:<a href="<%= user_path(author) %>" class="linkBlue2" target="_blank"><%= author.name%></a></div>
|
<div class="postDetailCreater">最后回复:<a href="<%= user_path(author) %>" class="linkBlue2" target="_blank"><%= author.show_name%></a></div>
|
||||||
<div class="postDetailDate"><%= format_date(topic.last_reply.created_at)%></div>
|
<div class="postDetailDate"><%= format_date(topic.last_reply.created_at)%></div>
|
||||||
<% end%>
|
<% end%>
|
||||||
<span class=" fr " style="color: #888888; font-size: 12px;">更新时间:<%= format_date(topic.updated_at)%></span>
|
<span class=" fr " style="color: #888888; font-size: 12px;">更新时间:<%= format_date(topic.updated_at)%></span>
|
||||||
|
|
|
@ -74,7 +74,6 @@
|
||||||
});
|
});
|
||||||
function check_and_submit(doc){
|
function check_and_submit(doc){
|
||||||
$("#error").html('').hide();
|
$("#error").html('').hide();
|
||||||
check_forum_name();
|
|
||||||
if( $("textarea[name='forum[name]']").val().trim() == "" && $("textarea[name='forum[description]']").val().trim() != "" ){
|
if( $("textarea[name='forum[name]']").val().trim() == "" && $("textarea[name='forum[description]']").val().trim() != "" ){
|
||||||
$("#error").html("名称不能为空").show();
|
$("#error").html("名称不能为空").show();
|
||||||
return;
|
return;
|
||||||
|
@ -98,7 +97,6 @@
|
||||||
'<%= check_forum_name_forums_path %>',
|
'<%= check_forum_name_forums_path %>',
|
||||||
{"forum_name":encodeURIComponent(name)},
|
{"forum_name":encodeURIComponent(name)},
|
||||||
function(data){
|
function(data){
|
||||||
|
|
||||||
if( data == 'true'){
|
if( data == 'true'){
|
||||||
$("#error").html("贴吧名称已经存在").show();
|
$("#error").html("贴吧名称已经存在").show();
|
||||||
check_pass = false;
|
check_pass = false;
|
||||||
|
|
|
@ -41,6 +41,20 @@
|
||||||
|
|
||||||
<!-- 老师身份才可以发布作业 -->
|
<!-- 老师身份才可以发布作业 -->
|
||||||
<div class="HomeWork mb10 ml10" nhname='homework_common_form'>
|
<div class="HomeWork mb10 ml10" nhname='homework_common_form'>
|
||||||
|
<% committed_work_count = @homework.student_works.has_committed.count %>
|
||||||
|
<% stu_pro_count = @homework.student_work_projects.count %>
|
||||||
|
<% if committed_work_count != 0 %>
|
||||||
|
<% if @homework.homework_type == 1 %>
|
||||||
|
<p class="c_red mb5">已有<%=committed_work_count %>个学生提交作品,不允许再修改作业类型。</p>
|
||||||
|
<% elsif @homework.homework_type == 2 %>
|
||||||
|
<p class="c_red mb5">已有<%=committed_work_count %>个学生提交作品,不允许再修改作业类型和测试集。</p>
|
||||||
|
<% elsif @homework.homework_type == 3 %>
|
||||||
|
<p class="c_red mb5">已有<%=committed_work_count %>个学生提交作品,不允许再修改作业类型和分组设置。</p>
|
||||||
|
<% end %>
|
||||||
|
<% elsif stu_pro_count != 0 && @homework.homework_type == 3 %>
|
||||||
|
<p class="c_red mb5">已有<%=stu_pro_count %>个学生关联项目,不允许再修改作业类型。</p>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<%= form_for @homework do |f| %>
|
<%= form_for @homework do |f| %>
|
||||||
<input type="text" name="is_in_course" class="none" value="<%= @is_in_course%>"/>
|
<input type="text" name="is_in_course" class="none" value="<%= @is_in_course%>"/>
|
||||||
<input type="text" name="course_activity" class="none" value="<%= @course_activity%>"/>
|
<input type="text" name="course_activity" class="none" value="<%= @course_activity%>"/>
|
||||||
|
|
|
@ -3,13 +3,13 @@
|
||||||
$("#homework_name").val("");
|
$("#homework_name").val("");
|
||||||
$("#homework_publish_time").val("");
|
$("#homework_publish_time").val("");
|
||||||
$("#homework_end_time").val("");
|
$("#homework_end_time").val("");
|
||||||
document.getElementById("anonymous_comment").checked = true;
|
|
||||||
$("#course_id").val($("#option_select").val());
|
$("#course_id").val($("#option_select").val());
|
||||||
|
$("#homeworkSetting").addClass("undis");
|
||||||
|
$("#homeworkSetting").html("");
|
||||||
$("#homework_attachments").html("<%= escape_javascript(render :partial => 'users/user_homework_attachment', :locals => { :container => HomeworkCommon.new,:has_program => true,:has_group => true})%>");
|
$("#homework_attachments").html("<%= escape_javascript(render :partial => 'users/user_homework_attachment', :locals => { :container => HomeworkCommon.new,:has_program => true,:has_group => true})%>");
|
||||||
//homework_description_editor.html("");
|
//homework_description_editor.html("");
|
||||||
$("#homework_name_span").text("");
|
$("#homework_name_span").text("");
|
||||||
$("#homework_end_time_span").text("");
|
$("#homework_end_time_span").text("");
|
||||||
$("#homework_end_time_span").text("");
|
|
||||||
$("#homework_course_id_span").text("");
|
$("#homework_course_id_span").text("");
|
||||||
$("#homework_editor").toggle();
|
$("#homework_editor").toggle();
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
<span class='<%= "#{get_issue_priority(@issue.priority_id)[0]} " %>'><%= get_issue_priority(@issue.priority_id)[1] %></span></p>
|
<span class='<%= "#{get_issue_priority(@issue.priority_id)[0]} " %>'><%= get_issue_priority(@issue.priority_id)[1] %></span></p>
|
||||||
<br>
|
<br>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
由<%=link_to @issue.author, user_path(@issue.author), :class => "link-blue" %>添加于 <%= format_time(@issue.created_on).html_safe %>
|
由<%=link_to @issue.author.show_name, user_path(@issue.author), :class => "link-blue" %>添加于 <%= format_time(@issue.created_on).html_safe %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!--talk_txt end-->
|
<!--talk_txt end-->
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<%= import_ke(enable_at: true, prettify: false, init_activity: false) %>
|
<%= import_ke(enable_at: true, prettify: false, init_activity: false) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%= labelled_form_for @issue, :html => {:id => 'issue-form', :multipart => true, :remote => true} do |f| %>
|
<%= labelled_form_for @issue, :html => {:id => 'issue-form', :multipart => true} do |f| %>
|
||||||
<%= error_messages_for 'issue', 'time_entry' %>
|
<%= error_messages_for 'issue', 'time_entry' %>
|
||||||
<%= render :partial => 'conflict' if @conflict %>
|
<%= render :partial => 'conflict' if @conflict %>
|
||||||
<!--编辑的整个属性-->
|
<!--编辑的整个属性-->
|
||||||
|
|
|
@ -78,5 +78,12 @@
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
<%= call_hook(:view_issues_form_details_bottom, {:issue => @issue, :form => f}) %>
|
<%= call_hook(:view_issues_form_details_bottom, {:issue => @issue, :form => f}) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<a href="javascript:void(0);" onclick="issue_desc_editor.sync();$('#issue-form').submit();" class="blue_btn fl ml80"> 确定</a>
|
<a href="javascript:void(0);" onclick="issue_desc_editor.sync();$('#issue-form').submit();" class="blue_btn fl ml80" id="issue_confirm"> 确定</a>
|
||||||
<a href="javascript:void(0);" onclick="issueDetailShow();" class="grey_btn fl mr50 ml10" > 取消 </a>
|
<% if params[:action] == "new" %>
|
||||||
|
<% if @copy_from %>
|
||||||
|
<%= link_to "取消", issue_path(@copy_from), :class => "grey_btn fl mr50 ml10" %>
|
||||||
|
<% end %>
|
||||||
|
<% else %>
|
||||||
|
<a href="javascript:void(0);" onclick="issueDetailShow();" class="grey_btn fl mr50 ml10" > 取消 </a>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
<div class="homepagePostReplyPortrait" >
|
<div class="homepagePostReplyPortrait" >
|
||||||
<%= link_to image_tag(url_to_avatar(comment.user), :width => "33", :height => "33"), user_path(comment.user_id), :alt => "用户头像" %>
|
<%= link_to image_tag(url_to_avatar(comment.user), :width => "33", :height => "33"), user_path(comment.user_id), :alt => "用户头像" %>
|
||||||
</div>
|
</div>
|
||||||
<div class="homepagePostReplyDes">
|
<div class="homepagePostReplyDes" onmouseover="$('#delete_reply_<%=comment.id %>').show();" onmouseout="$('#delete_reply_<%=comment.id %>').hide();">
|
||||||
<%= render :partial => 'users/news_contents', :locals => {:comment => comment}%>
|
<%= render :partial => 'users/news_contents', :locals => {:comment => comment}%>
|
||||||
|
|
||||||
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= comment.id %>">
|
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= comment.id %>">
|
||||||
|
@ -40,7 +40,8 @@
|
||||||
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,
|
||||||
:class => 'fr mr20',
|
:id => "delete_reply_#{comment.id}",
|
||||||
|
:class => 'fr mr20 undis',
|
||||||
:data => {:confirm => l(:text_are_you_sure)},
|
:data => {:confirm => l(:text_are_you_sure)},
|
||||||
:title => l(:button_delete)
|
:title => l(:button_delete)
|
||||||
) if comment.user_id == User.current.id %>
|
) if comment.user_id == User.current.id %>
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
$("#reply_div_<%= @issue.id %>").html("<%= escape_javascript(render :partial => 'issues/issue_replies', :locals => {:issue => @issue}) %>");
|
/* $("#reply_div_<%#= @issue.id %>").html("<%#= escape_javascript(render :partial => 'issues/issue_replies', :locals => {:issue => @issue}) %>");
|
||||||
$("#issue_detail_show").html('<%= escape_javascript(render :partial => 'issues/detail') %>')
|
$("#issue_detail_show").html('<%#= escape_javascript(render :partial => 'issues/detail') %>');
|
||||||
$("#issue_edit_show").html('<%= escape_javascript(render :partial => 'issues/edit') %>')
|
$("#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}) %>");
|
$("#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 %>");
|
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,
|
||||||
|
@ -17,5 +19,5 @@ issue_desc_editor = KindEditor.create('#issue_description',
|
||||||
"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)}) %>");
|
// $("#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,12 +1,14 @@
|
||||||
<% if @saved %>
|
<% if @saved %>
|
||||||
$("#issue_detail").replaceWith('<%= escape_javascript(render :partial => 'issues/detail') %>')
|
/*$("#issue_detail").replaceWith('<%#= escape_javascript(render :partial => 'issues/detail') %>');
|
||||||
$("#issue_edit").replaceWith('<%= escape_javascript(render :partial => 'issues/edit') %>')
|
$("#issue_edit").replaceWith('<%#= escape_javascript(render :partial => 'issues/edit') %>');
|
||||||
|
|
||||||
$("#issue_detail").show();
|
$("#issue_detail").show();
|
||||||
$("#issue_edit").hide();
|
$("#issue_edit").hide();
|
||||||
$("#reply_div_<%= @issue.id %>").html("<%= escape_javascript(render :partial => 'issues/issue_replies', :locals => {:issue => @issue,:replies_all_i=>0}) %>");
|
|
||||||
sd_create_editor_from_data(<%= @issue.id%>, null, "100%","<%=@issue.class.name%>");
|
$("#reply_div_<%#= @issue.id %>").html("<%#= escape_javascript(render :partial => 'issues/issue_replies', :locals => {:issue => @issue,:replies_all_i=>0}) %>");
|
||||||
$(".homepagePostReplyBannerCount").html('回复(<%= @issue.journals.count %>)')
|
sd_create_editor_from_data(<%#= @issue.id%>, null, "100%","<%#=@issue.class.name%>");
|
||||||
|
$(".homepagePostReplyBannerCount").html('<%#= escape_javascript(render :partial => 'issues/issue_reply_banner') %>');*/
|
||||||
|
location.reload();
|
||||||
//edit里的编辑器貌似显示不出来,所以手动js生成。
|
//edit里的编辑器貌似显示不出来,所以手动js生成。
|
||||||
issue_desc_editor = KindEditor.create('#issue_description',
|
issue_desc_editor = KindEditor.create('#issue_description',
|
||||||
{"width":"85%",
|
{"width":"85%",
|
||||||
|
@ -31,6 +33,7 @@ issue_desc_editor = KindEditor.create('#issue_description',
|
||||||
// "allowFileManager":true,
|
// "allowFileManager":true,
|
||||||
// "uploadJson":"/kindeditor/upload",
|
// "uploadJson":"/kindeditor/upload",
|
||||||
// "fileManagerJson":"/kindeditor/filemanager"});
|
// "fileManagerJson":"/kindeditor/filemanager"});
|
||||||
|
|
||||||
<%else%>
|
<%else%>
|
||||||
alert('<%= @issue.errors.full_messages[0].to_s%>')
|
alert('<%= @issue.errors.full_messages[0].to_s%>')
|
||||||
<%end %>
|
<%end %>
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
<li class="sy_class_setting_icon">
|
<li class="sy_class_setting_icon">
|
||||||
<ul class="sy_class_setting_text">
|
<ul class="sy_class_setting_text">
|
||||||
<li><%= link_to @course.is_public == 0 ? "设为公开" : "设为私有", {:controller => 'courses', :action => 'private_or_public', :id => @course},:remote=>true,:confirm=>"您确定要设置为"+(@course.is_public == 0 ? "公开" : "私有")+"吗", :class => "sy_class_option" %></li>
|
<li><%= link_to @course.is_public == 0 ? "设为公开" : "设为私有", {:controller => 'courses', :action => 'private_or_public', :id => @course},:remote=>true,:confirm=>"您确定要设置为"+(@course.is_public == 0 ? "公开" : "私有")+"吗", :class => "sy_class_option" %></li>
|
||||||
<li><%= link_to "复制班级", copy_course_course_path(@course.id),:remote=>true, :class => "sy_class_option" %></li>
|
<!--<li><%#= link_to "复制班级", copy_course_course_path(@course.id),:remote=>true, :class => "sy_class_option" %></li>-->
|
||||||
<% if @course.syllabus %>
|
<% if @course.syllabus %>
|
||||||
<li><%= link_to "进入课程", syllabus_path(@course.syllabus), :class => "sy_class_option", :target => "_blank" %></li>
|
<li><%= link_to "进入课程", syllabus_path(@course.syllabus), :class => "sy_class_option", :target => "_blank" %></li>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
@ -31,7 +31,7 @@
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
<div class="sy_class_logo fl">
|
<div class="sy_class_logo fl">
|
||||||
<div class="pr" style="width: 96px; height:96px;">
|
<div class="pr" style="width: 96px; height:96px;">
|
||||||
<% if User.current.logged? && (User.current == @course.teacher || User.current.admin?)%>
|
<% if is_teacher%>
|
||||||
<%=link_to image_tag(url_to_avatar(@course),width:"96", height: "96", :id=>'nh_source_tx'), my_clear_user_avatar_temp_path(:course => @course.id), :remote => true%>
|
<%=link_to image_tag(url_to_avatar(@course),width:"96", height: "96", :id=>'nh_source_tx'), my_clear_user_avatar_temp_path(:course => @course.id), :remote => true%>
|
||||||
<div class="homepageEditProfile undis">
|
<div class="homepageEditProfile undis">
|
||||||
<%=link_to '', my_clear_user_avatar_temp_path(:course => @course.id), :class => 'homepageEditProfileIcon', :title => '点击编辑头像', :remote => true %>
|
<%=link_to '', my_clear_user_avatar_temp_path(:course => @course.id), :class => 'homepageEditProfileIcon', :title => '点击编辑头像', :remote => true %>
|
||||||
|
@ -54,7 +54,11 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="sy_class_info fl ml15">
|
<div class="sy_class_info fl ml15">
|
||||||
<div class="sy_class_titbox">
|
<div class="sy_class_titbox">
|
||||||
<h3 class="fl sy_class_title"><%=@course.name %></h3>
|
<h3 class="fl sy_class_title">
|
||||||
|
<%= link_to @course.syllabus.title, syllabus_path(@course.syllabus_id), :class =>'c_dark', :target => '_blank'%>
|
||||||
|
<font class="fb">·</font>
|
||||||
|
<%=@course.name %>
|
||||||
|
</h3>
|
||||||
<span class="<%= @course.is_public == 0 ? 'hw_icon_private' : 'hw_icon_open' %> fl mr20 mt3"></span>
|
<span class="<%= @course.is_public == 0 ? 'hw_icon_private' : 'hw_icon_open' %> fl mr20 mt3"></span>
|
||||||
<p class="sy_cgrey fl mt3">
|
<p class="sy_cgrey fl mt3">
|
||||||
<span class=" mr15">教师:<%= course_teacher_link teacher_num %></span>
|
<span class=" mr15">教师:<%= course_teacher_link teacher_num %></span>
|
||||||
|
@ -85,3 +89,11 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
|
<% if is_teacher %>
|
||||||
|
<div class="invite_code_tip_box fontGrey2">
|
||||||
|
<em></em>
|
||||||
|
<span></span>
|
||||||
|
<p class="mt10 mb5">请将邀请码告诉学生和教辅</p>
|
||||||
|
<p class="mb10">他们可以主动加入班级</p>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
|
@ -4,7 +4,9 @@
|
||||||
<li class="fl"><a href="javascript:void(0);" disabled="true" class="f_grey mw20" target="_blank"><%= l(:label_about_us)%></a>|</li>
|
<li class="fl"><a href="javascript:void(0);" disabled="true" class="f_grey mw20" target="_blank"><%= l(:label_about_us)%></a>|</li>
|
||||||
<li class="fl"><a href="javascript:void(0);" disabled="true" class="f_grey mw20" target="_blank">服务协议</a>|</li>
|
<li class="fl"><a href="javascript:void(0);" disabled="true" class="f_grey mw20" target="_blank">服务协议</a>|</li>
|
||||||
<li class="fl" style="display: none"><span class="f_grey mw20" title="暂未开放"><%= l(:label_recruitment_information)%></span>|</li>
|
<li class="fl" style="display: none"><span class="f_grey mw20" title="暂未开放"><%= l(:label_recruitment_information)%></span>|</li>
|
||||||
|
<% if hidden_unproject_infos %>
|
||||||
<li class="fl"><%= link_to l(:label_surpport_group), "javascript:void(0);", :class => "f_grey mw20", :target=>"_blank" %>|</li>
|
<li class="fl"><%= link_to l(:label_surpport_group), "javascript:void(0);", :class => "f_grey mw20", :target=>"_blank" %>|</li>
|
||||||
|
<% end %>
|
||||||
<li class="fl"><a href="javascript:void(0);" disabled="true" class="f_grey mw20" target="_blank"><%= l(:label_forums)%></a></li>
|
<li class="fl"><a href="javascript:void(0);" disabled="true" class="f_grey mw20" target="_blank"><%= l(:label_forums)%></a></li>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -14,8 +14,11 @@
|
||||||
<li class="navHomepageMenu fl">
|
<li class="navHomepageMenu fl">
|
||||||
<%= link_to "题库", user_homeworks_user_path(User.current), :class => "c_white f16 db p10"%>
|
<%= link_to "题库", user_homeworks_user_path(User.current), :class => "c_white f16 db p10"%>
|
||||||
</li>
|
</li>
|
||||||
<li class="navHomepageMenu fl mr30">
|
<!--<li class="navHomepageMenu fl mr30">-->
|
||||||
<%= link_to "帮助中心", "https://#{Setting.host_name}/forums/1/memos/1168", :class =>"c_white f16 db p10" %>
|
<!--<%#= link_to "帮助中心", "https://#{Setting.host_name}/forums/1/memos/1168", :class =>"c_white f16 db p10" %>-->
|
||||||
|
<!--</li>-->
|
||||||
|
<li class="navHomepageMenu fl mr40">
|
||||||
|
<a href="<%= forums_path(:reorder_complex=>'desc')%>" target="_blank" class="c_white f16 db p10" > 贴吧交流</a>
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -10,12 +10,14 @@
|
||||||
<li class="navHomepageMenu fl">
|
<li class="navHomepageMenu fl">
|
||||||
<a href ="javascript:void(0);" disabled="true" class="c_white f16 db p10">资源库</a>
|
<a href ="javascript:void(0);" disabled="true" class="c_white f16 db p10">资源库</a>
|
||||||
</li>
|
</li>
|
||||||
|
<% if hidden_unproject_infos %>
|
||||||
<li class="navHomepageMenu fl">
|
<li class="navHomepageMenu fl">
|
||||||
<a href ="javascript:void(0);" disabled="true" class="c_white f16 db p10">题库</a>
|
<a href ="javascript:void(0);" disabled="true" class="c_white f16 db p10">题库</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="navHomepageMenu fl mr30">
|
<li class="navHomepageMenu fl mr30">
|
||||||
<a href ="javascript:void(0);" disabled="true" class="c_white f16 db p10">帮助中心</a>
|
<a href ="javascript:void(0);" disabled="true" class="c_white f16 db p10">帮助中心</a>
|
||||||
</li>
|
</li>
|
||||||
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="fl" id="navHomepageSearch">
|
<div class="fl" id="navHomepageSearch">
|
||||||
|
@ -36,7 +38,7 @@
|
||||||
<a href ="javascript:void(0);" disabled="true"><%= image_tag(url_to_avatar(User.current),:width =>"40",:height => "40",:alt=>"头像", :id => "nh_user_logo", :class => "portraitRadius") %></a>
|
<a href ="javascript:void(0);" disabled="true"><%= image_tag(url_to_avatar(User.current),:width =>"40",:height => "40",:alt=>"头像", :id => "nh_user_logo", :class => "portraitRadius") %></a>
|
||||||
<ul class="topnav_login_list none" id="topnav_login_list">
|
<ul class="topnav_login_list none" id="topnav_login_list">
|
||||||
<li>
|
<li>
|
||||||
<a href ="javascript:void(0);" class="menuGrey" disabled="true">修改资料</a>
|
<%= link_to "修改资料", my_account_path(:tip => 1), :class => "menuGrey"%>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href ="javascript:void(0);" class="menuGrey" disabled="true">我的组织</a>
|
<a href ="javascript:void(0);" class="menuGrey" disabled="true">我的组织</a>
|
||||||
|
@ -46,7 +48,7 @@
|
||||||
</li>
|
</li>
|
||||||
<!--<li><a href="javascript:void(0);" class="menuGrey">账号设置</a> </li>-->
|
<!--<li><a href="javascript:void(0);" class="menuGrey">账号设置</a> </li>-->
|
||||||
<li>
|
<li>
|
||||||
<%= link_to "退出",logout_url_without_domain,:class => "menuGrey",:method => "post"%>
|
<%= link_to "退出", logout_url_without_domain, :class => "menuGrey", :method => "post"%>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
|
|
@ -1,41 +1,51 @@
|
||||||
<%= javascript_include_tag "feedback" %>
|
<%= javascript_include_tag "feedback" %>
|
||||||
|
|
||||||
<div class="scrollsidebar" id="scrollsidebar">
|
<div class="scrollsidebar pr" id="scrollsidebar">
|
||||||
<div class="side_content">
|
<div class="side_content">
|
||||||
<div class="side_list">
|
<div class="side_list">
|
||||||
<div class="qr-code-border borderBottomNone"><img src="/images/wechat/trustie_QR.jpg" width="150" style="display:block;" /> </div>
|
<div style="background-color:#fff; padding:10px 0; border:1px solid #aaa; border-bottom:none;">
|
||||||
<div class="side_title">
|
<span class="fontGrey3 f14 ml40" style="vertical-align:top;">问题和建议</span>
|
||||||
<a title="<%= l(:button_hide) %>" class="close_btn">
|
<span class="hide-side-bar side-bar-circle fr mt3 mr10" title="关闭"><span class="side-bar-content">×</span></span>
|
||||||
<span>
|
<span class="close_btn side-bar-circle fr mt3 mr10" title="隐藏"><span class="side-bar-content" style="left:4px;">›</span></span>
|
||||||
</span>
|
|
||||||
</a>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="side_center">
|
<div style="background-color:#fff; border-left:1px solid #aaa; border-right:1px solid #aaa;">
|
||||||
<div class="custom_service">
|
<div class="custom_service tac">
|
||||||
<% get_memo %>
|
<% get_memo %>
|
||||||
<%= form_for(@new_memo, :url => create_feedback_forum_path(@public_forum)) do |f| %>
|
<%= form_for(@new_memo, :url => create_feedback_forum_path(@public_forum)) do |f| %>
|
||||||
<%= f.text_area :subject, :id=>"subject", :class => "opnionText", :placeholder => l(:label_feedback_tips) %>
|
<%= f.text_area :subject, :id=>"subject", :class => "opnionText mb5", :placeholder => l(:label_feedback_tips) %>
|
||||||
<%= f.hidden_field :content,:id => 'hidden', :required => true , :value => l(:label_feedback_value) %>
|
<%= f.hidden_field :content,:id => 'hidden', :required => true , :value => l(:label_feedback_value) %>
|
||||||
<label class="c_grey">您还能输入<span id="textCount" class="c_orange">50</span>个字符</label>
|
<span class="c_grey fl ml10">还能输入<span id="textCount" class="c_orange">50</span>个字符</span>
|
||||||
<a href="javascript:void(0);" class="opnionButton" style=" color:#fff;height:21px" id="" onclick="f_submit();">
|
<a href="javascript:void(0);" class="linkBlue f14 fr mr10" style="height:21px;" id="" onclick="f_submit();">
|
||||||
<%= l(:label_submit)%>
|
<%= l(:label_submit)%>
|
||||||
</a>
|
</a>
|
||||||
|
<div class="cl"></div>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<div class="mt5" style="color: #269ac9;cursor: default">
|
</div>
|
||||||
|
<div style="background-color:#fff; border:1px solid #aaa; border-top:none; padding-top:5px;">
|
||||||
|
<div class="fl mt5 ml10 tac">
|
||||||
<!--<a target="hiddentab" href="http://wpa.qq.com/msgrd?v=1&uin=1554253403&site=qq&menu=yes" style="color: #269ac9;">-->
|
<!--<a target="hiddentab" href="http://wpa.qq.com/msgrd?v=1&uin=1554253403&site=qq&menu=yes" style="color: #269ac9;">-->
|
||||||
<%#= l(:label_technical_support) %>
|
<%#= l(:label_technical_support) %>
|
||||||
<!--白 羽</a> http://shang.qq.com/wpa/qunwpa?idkey=4fe2d63a4527cddce038f04f0b1d728a62082074fb4a74870a5444ee1a6910ad-->
|
<!--白 羽</a> http://shang.qq.com/wpa/qunwpa?idkey=4fe2d63a4527cddce038f04f0b1d728a62082074fb4a74870a5444ee1a6910ad-->
|
||||||
<!--<p style="text-align: center"> 请加入师姐师兄答疑群</p> <p style="text-align: center"></p>-->
|
<!--<p style="text-align: center"> 请加入师姐师兄答疑群</p> <p style="text-align: center"></p>-->
|
||||||
<!--<a href="mqqapi://card/show_pslcard?src_type=internal&version=1&uin=173184401&card_type=group&source=qrcode">QQ群号:173184401</a>-->
|
<!--<a href="mqqapi://card/show_pslcard?src_type=internal&version=1&uin=173184401&card_type=group&source=qrcode">QQ群号:173184401</a>-->
|
||||||
<a target="_blank" href="http://shang.qq.com/wpa/qunwpa?idkey=fb938b1f6f991fc100f3d32b6ef38b7888dd4097c71d0eb8b239eaa8749a6afd"><img border="0" src="https://pub.idqqimg.com/wpa/images/group.png" alt="Trustie师姐师兄答疑群" title="Trustie师姐师兄答疑群"></a>
|
<a target="_blank" href="http://shang.qq.com/wpa/qunwpa?idkey=fb938b1f6f991fc100f3d32b6ef38b7888dd4097c71d0eb8b239eaa8749a6afd"><img src="/images/QQ_Logo.png" width="30" style="cursor:default; border:1px solid #ddd; padding:20px; cursor:pointer;" /></a>
|
||||||
|
<p class="fontGrey3" style="padding-bottom:10px; padding-top:3px;">加入QQ群</p>
|
||||||
|
</div>
|
||||||
|
<div class="fr mr10 tac">
|
||||||
|
<img src="/images/wechat/trustie_QR.jpg" width="80" style="display:inline-block; margin-right:-5px;" /><p class="fontGrey3" style="padding-bottom:10px;">关注官方微信</p>
|
||||||
|
</div>
|
||||||
|
<div class="cl"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="side_bottom"></div>
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class="show_btn tac">
|
||||||
|
<div style=" border:1px solid #aaa;">
|
||||||
|
<div style="height:79px;">
|
||||||
|
<img src="/images/dialog.png" width="18" class="mt10 mb5" />
|
||||||
|
<span class="f14 fontBlue">提<br />问</span>
|
||||||
|
</div>
|
||||||
|
<span class="closeSidebar f16">×</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="show_btn">
|
|
||||||
<span><%= l(:label_submit)%></span>
|
|
||||||
<a href="javascript:void(0)" class="closeSidebar"></a>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -128,7 +128,7 @@
|
||||||
<li><a href="<%=issue_path(:id => ma.forge_message.id) %>" target="_blank" title="<%=ma.forge_message.author.show_name %> <%= ma.forge_message.tracker_id == 5 ? "发布的周报:":"指派给你的问题:"%><%= ma.forge_message.subject%> 截止时间快到了!"><span class="shadowbox_news_user"><%=ma.forge_message.author.show_name %> </span><%= ma.forge_message.tracker_id == 5 ? "发布的周报:":"指派给你的问题:"%><%= ma.forge_message.subject%> 截止时间快到了!</a></li>
|
<li><a href="<%=issue_path(:id => ma.forge_message.id) %>" target="_blank" title="<%=ma.forge_message.author.show_name %> <%= ma.forge_message.tracker_id == 5 ? "发布的周报:":"指派给你的问题:"%><%= ma.forge_message.subject%> 截止时间快到了!"><span class="shadowbox_news_user"><%=ma.forge_message.author.show_name %> </span><%= ma.forge_message.tracker_id == 5 ? "发布的周报:":"指派给你的问题:"%><%= ma.forge_message.subject%> 截止时间快到了!</a></li>
|
||||||
<% elsif ma.forge_message_type == "Issue" && ma.status != 1 %>
|
<% elsif ma.forge_message_type == "Issue" && ma.status != 1 %>
|
||||||
<li><a href="<%=issue_path(:id => ma.forge_message.id) %>" target="_blank" title="<%=ma.forge_message.author.show_name %> <%= ma.forge_message.tracker_id == 5 ? "发布了周报:":"指派了问题给你:"%><%= ma.forge_message.subject%>"><span class="shadowbox_news_user"><%=ma.forge_message.author.show_name %> </span><%= ma.forge_message.tracker_id == 5 ? "发布了周报:":"指派了问题给你:"%><%= ma.forge_message.subject%></a></li>
|
<li><a href="<%=issue_path(:id => ma.forge_message.id) %>" target="_blank" title="<%=ma.forge_message.author.show_name %> <%= ma.forge_message.tracker_id == 5 ? "发布了周报:":"指派了问题给你:"%><%= ma.forge_message.subject%>"><span class="shadowbox_news_user"><%=ma.forge_message.author.show_name %> </span><%= ma.forge_message.tracker_id == 5 ? "发布了周报:":"指派了问题给你:"%><%= ma.forge_message.subject%></a></li>
|
||||||
<% elsif ma.forge_message_type == "Journal" %>
|
<% elsif ma.forge_message_type == "Journal" && ma.forge_message %>
|
||||||
<li><a href="<%=issue_path(:id => ma.forge_message.journalized_id) %>" target="_blank" title="<%=ma.forge_message.user.show_name %> 更新了问题状态:<%= ma.forge_message.journalized.subject%>"><span class="shadowbox_news_user"><%=ma.forge_message.user.show_name %> </span>更新了问题状态:<%= ma.forge_message.journalized.subject%></a></li>
|
<li><a href="<%=issue_path(:id => ma.forge_message.journalized_id) %>" target="_blank" title="<%=ma.forge_message.user.show_name %> 更新了问题状态:<%= ma.forge_message.journalized.subject%>"><span class="shadowbox_news_user"><%=ma.forge_message.user.show_name %> </span>更新了问题状态:<%= ma.forge_message.journalized.subject%></a></li>
|
||||||
<% elsif ma.forge_message_type == "Message" %>
|
<% elsif ma.forge_message_type == "Message" %>
|
||||||
<li><a href="<%=board_message_path(ma.forge_message.board_id, ma.forge_message.parent_id ? ma.forge_message.parent_id : ma.forge_message.id) %>" target="_blank" title="<%=ma.forge_message.author.show_name %> <%= ma.forge_message.parent_id.nil? ? "发布了项目帖子:" : "评论了项目帖子:" %><%= ma.forge_message.subject%>"><span class="shadowbox_news_user"><%=ma.forge_message.author.show_name %> </span><%= ma.forge_message.parent_id.nil? ? "发布了项目帖子:" : "评论了项目帖子:" %><%= ma.forge_message.subject%></a></li>
|
<li><a href="<%=board_message_path(ma.forge_message.board_id, ma.forge_message.parent_id ? ma.forge_message.parent_id : ma.forge_message.id) %>" target="_blank" title="<%=ma.forge_message.author.show_name %> <%= ma.forge_message.parent_id.nil? ? "发布了项目帖子:" : "评论了项目帖子:" %><%= ma.forge_message.subject%>"><span class="shadowbox_news_user"><%=ma.forge_message.author.show_name %> </span><%= ma.forge_message.parent_id.nil? ? "发布了项目帖子:" : "评论了项目帖子:" %><%= ma.forge_message.subject%></a></li>
|
||||||
|
@ -138,7 +138,7 @@
|
||||||
<li><a href="<%=news_path(ma.forge_message.commented.id) %>" target="_blank" title="<%=ma.forge_message.author.show_name %> 评论了新闻:<%= ma.forge_message.commented.title%>"><span class="shadowbox_news_user"><%=ma.forge_message.author.show_name %> </span>评论了新闻:<%= ma.forge_message.commented.title%></a></li>
|
<li><a href="<%=news_path(ma.forge_message.commented.id) %>" target="_blank" title="<%=ma.forge_message.author.show_name %> 评论了新闻:<%= ma.forge_message.commented.title%>"><span class="shadowbox_news_user"><%=ma.forge_message.author.show_name %> </span>评论了新闻:<%= ma.forge_message.commented.title%></a></li>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% elsif ma.class == MemoMessage %>
|
<% elsif ma.class == MemoMessage %>
|
||||||
<% if ma.memo_type == "Memo" %>
|
<% if ma.memo_type == "Memo" && !ma.memo.nil? && !ma.memo.author.nil? %>
|
||||||
<li><a href="<%=forum_memo_path(ma.memo.forum_id, ma.memo.parent_id ? ma.memo.parent_id: ma.memo.id) %>" target="_blank" title="<%=ma.memo.author.show_name %> <%= ma.memo.parent_id.nil? ? "在贴吧发布帖子:" : "回复了贴吧帖子:" %><%= ma.memo.parent_id.nil? ? ma.memo.subject : message_content(ma.memo.content)%>"><span class="shadowbox_news_user"><%=ma.memo.author.show_name %> </span><%= ma.memo.parent_id.nil? ? "在贴吧发布帖子:" : "回复了贴吧帖子:" %><%= ma.memo.parent_id.nil? ? ma.memo.subject : message_content(ma.memo.content)%></a></li>
|
<li><a href="<%=forum_memo_path(ma.memo.forum_id, ma.memo.parent_id ? ma.memo.parent_id: ma.memo.id) %>" target="_blank" title="<%=ma.memo.author.show_name %> <%= ma.memo.parent_id.nil? ? "在贴吧发布帖子:" : "回复了贴吧帖子:" %><%= ma.memo.parent_id.nil? ? ma.memo.subject : message_content(ma.memo.content)%>"><span class="shadowbox_news_user"><%=ma.memo.author.show_name %> </span><%= ma.memo.parent_id.nil? ? "在贴吧发布帖子:" : "回复了贴吧帖子:" %><%= ma.memo.parent_id.nil? ? ma.memo.subject : message_content(ma.memo.content)%></a></li>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% elsif ma.class == UserFeedbackMessage %>
|
<% elsif ma.class == UserFeedbackMessage %>
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<p style="position:relative; display:inline;"><% if syllabus.eng_name && !syllabus.eng_name.empty? %>
|
<p style="position:relative; display:inline;"><% if syllabus.eng_name && !syllabus.eng_name.empty? %>
|
||||||
<span><%=syllabus.eng_name %></span>
|
<span><%=syllabus.eng_name %></span>
|
||||||
<% else%>
|
<% else%>
|
||||||
<span style="color: #888">课程英文名称</span>
|
<span style="color: #888"></span>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if User.current == syllabus.user || User.current.admin? %>
|
<% if User.current == syllabus.user || User.current.admin? %>
|
||||||
<%= link_to image_tag("../images/signature_edit.png",width:"12px", height: "12px"), "javascript:void(0);",:id => "syllabus_edit_ng_name_png", :style => "width:15px; position:absolute; right: -20px; top: 5px;", :class => "none", :onclick => "show_edit_eng_name('#{syllabus.eng_name}');"%>
|
<%= link_to image_tag("../images/signature_edit.png",width:"12px", height: "12px"), "javascript:void(0);",:id => "syllabus_edit_ng_name_png", :style => "width:15px; position:absolute; right: -20px; top: 5px;", :class => "none", :onclick => "show_edit_eng_name('#{syllabus.eng_name}');", :title => '编辑课程英文名称'%>
|
||||||
<% end %>
|
<% end %>
|
||||||
</p>
|
</p>
|
|
@ -8,7 +8,7 @@
|
||||||
<li >
|
<li >
|
||||||
<%= link_to image_tag(url_to_avatar(teacher), :width => "60", :height => "60", :class => "sy_teachers_img fl mr15"), user_path(teacher), :target => "_blank", :alt => "用户头像" %>
|
<%= link_to image_tag(url_to_avatar(teacher), :width => "60", :height => "60", :class => "sy_teachers_img fl mr15"), user_path(teacher), :target => "_blank", :alt => "用户头像" %>
|
||||||
<div class="sy_teachers_txt fl">
|
<div class="sy_teachers_txt fl">
|
||||||
<%= link_to teacher.show_name, user_path(teacher), :class => "sy_teachers_name", :target => "_blank" %>
|
<%= link_to teacher.show_name, user_path(teacher), :class => "sy_teachers_name hidden", :target => "_blank", :title => teacher.show_name %>
|
||||||
<span class="sy_teachers_span">
|
<span class="sy_teachers_span">
|
||||||
<% if teacher.user_extensions && teacher.user_extensions.identity %>
|
<% if teacher.user_extensions && teacher.user_extensions.identity %>
|
||||||
<%= get_user_roll teacher %>
|
<%= get_user_roll teacher %>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<h2 style="position:relative; display:inline;">课程名称:<%=syllabus.title %>
|
<h2 style="position:relative; display:inline;">
|
||||||
|
<%=syllabus.title %>
|
||||||
<% if User.current == syllabus.user || User.current.admin? %>
|
<% if User.current == syllabus.user || User.current.admin? %>
|
||||||
<%= link_to image_tag("../images/signature_edit.png",width:"12px", height: "12px"), "javascript:void(0);",:id => "syllabus_edit_title_png", :class => "none", :style => "width:15px; position:absolute; right: -20px; top: 15px;", :onclick => "show_edit_title('#{syllabus.title}');"%>
|
<%= link_to image_tag("../images/signature_edit.png",width:"12px", height: "12px"), "javascript:void(0);",:id => "syllabus_edit_title_png", :class => "none", :style => "width:15px; position:absolute; right: -20px; top: 15px;", :onclick => "show_edit_title('#{syllabus.title}');", :title => '编辑课程名称'%>
|
||||||
<% end %>
|
<% end %>
|
||||||
</h2>
|
</h2>
|
||||||
|
|
|
@ -4,8 +4,11 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="fl">
|
<div class="fl">
|
||||||
<ul>
|
<ul>
|
||||||
|
<!--<li class="navHomepageMenu fl mr40">-->
|
||||||
|
<!--<%#= link_to "帮助中心", "https://#{Setting.host_name}/forums/1/memos/1168", :class =>"c_white f16 db p10" %>-->
|
||||||
|
<!--</li>-->
|
||||||
<li class="navHomepageMenu fl mr40">
|
<li class="navHomepageMenu fl mr40">
|
||||||
<%= link_to "帮助中心", "https://#{Setting.host_name}/forums/1/memos/1168", :class =>"c_white f16 db p10" %>
|
<a href="<%= forums_path(:reorder_complex=>'desc')%>" target="_blank" class="c_white f16 db p10" > 贴吧交流</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue