Merge branch 'develop' into cxt_course

Conflicts:
	app/views/exercise/_student_table.html.erb
	db/schema.rb
This commit is contained in:
Tim 2016-09-09 13:30:10 +08:00
commit b796ac3b53
83 changed files with 3655 additions and 2925 deletions

View File

@ -50,10 +50,10 @@ gem 'elasticsearch-model'
gem 'elasticsearch-rails'
#rails 3.2.22.2 bug
gem "test-unit", "~>3.0"
# gem "test-unit", "~>3.0"
### profile
gem 'oneapm_rpm'
# gem 'oneapm_rpm'
group :development do
gem 'grape-swagger'

View File

@ -89,11 +89,15 @@ module Mobile
tip = 0 #0班级1项目
type = params[:type]
result = 1
#0回复 1回复的回复
reply_type = params[:reply_type]
update_id = 0
if params[:content]!="" && current_user
case type
when "HomeworkCommon"
homework_common = HomeworkCommon.find(params[:id])
#如果是私有的 并且不是成员则不能回复
# is_public = homework_common.course.is_public
# if is_public == 0 && !current_user.member_of_course?(homework_common.course)
@ -106,15 +110,29 @@ module Mobile
# result = 2
# end
# end
feedback = HomeworkCommon.add_homework_jour(current_user, params[:content], params[:id])
if (feedback.errors.empty?)
homework_common.update_column(:updated_at, Time.now)
result = 2
if reply_type == nil || reply_type == 0
homework_common = HomeworkCommon.find(params[:id])
feedback = HomeworkCommon.add_homework_jour(current_user, params[:content], params[:id])
if (feedback.errors.empty?)
homework_common.update_column(:updated_at, Time.now)
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
when "News"
news = News.find(params[:id])
# if news.project
# if news.project.is_public == false && !current_user.member_of?(news.project)
# status = -1
@ -126,19 +144,28 @@ module Mobile
# tip = 0
# end
# end
if status == 0
comment = Comment.new
comment.comments = params[:content]
comment.author = current_user
if news.comments << comment
result = 2
if reply_type == nil || reply_type == 0
news = News.find(params[:id])
comment = Comment.new
comment.comments = params[:content]
comment.author = current_user
if news.comments << comment
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
when "Message"
message = Message.find(params[:id])
board = Board.find(message.board_id)
# if message.project
# if message.project.is_public == false && !current_user.member_of?(message.project)
# status = -1
@ -152,20 +179,26 @@ module Mobile
# end
if status == 0
topic = message.root
reply = Message.new
reply.author = current_user
reply.board = board
reply.content = params[:content]
reply.parent_id = params[:id]
reply.subject = "RE: #{topic.subject}"
if topic.children << reply
result = 2
end
# if reply_type == nil || reply_type == 0
message = Message.find(params[:id])
board = Board.find(message.board_id)
topic = message.root
reply = Message.new
reply.author = current_user
reply.board = board
reply.content = params[:content]
reply.parent_id = params[:id]
reply.subject = "RE: #{topic.subject}"
if message.children << reply
result = 2
update_id = topic.id
end
# else
#二级回复
# end
end
when "JournalsForMessage"
jour = JournalsForMessage.find params[:id]
# if jour.jour_type == "Project"
# if jour.project.is_public == false && !current_user.member_of?(jour.project)
# status = -1
@ -179,64 +212,108 @@ module Mobile
# end
if status == 0
parent_id = params[:id]
author_id = current_user.id
reply_user_id = jour.user_id
reply_id = params[:id]
content = params[:content]
options = {:user_id => author_id,
:status => true,
:m_parent_id => parent_id,
:m_reply_id => reply_id,
:reply_id => reply_user_id,
:notes => content,
:is_readed => false}
jfm = jour.user.add_jour(nil, nil, nil, options)
if jfm.errors.empty?
(JournalsForMessage.find parent_id).update_attribute(:updated_on,Time.now)
result = 2
end
# if reply_type == nil || reply_type == 0
jour = JournalsForMessage.find(params[:id]).root
parent_id = params[:id]
author_id = current_user.id
reply_user_id = jour.user_id
reply_id = params[:id]
content = params[:content]
options = {:user_id => author_id,
:status => true,
:m_parent_id => parent_id,
:m_reply_id => reply_id,
:reply_id => reply_user_id,
:notes => content,
:is_readed => false}
jfm = jour.user.add_jour(nil, nil, nil, options)
if jfm.errors.empty?
(JournalsForMessage.find parent_id).update_attribute(:updated_on,Time.now)
result = 2
update_id = jour.id
end
# else
#二级回复
# end
end
when 'Issue'
issue = Issue.find params[:id]
# if issue.project.is_public == false && !current_user.member_of?(issue.project)
# status = -1
# tip = 1
# end
if status == 0
is_jour = Journal.new
is_jour.user_id = current_user.id
is_jour.notes = params[:content]
is_jour.journalized = issue
if is_jour.save
result = 2
if reply_type == nil || reply_type == 0
issue = Issue.find params[:id]
is_jour = Journal.new
is_jour.user_id = current_user.id
is_jour.notes = params[:content]
is_jour.journalized = issue
if is_jour.save
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
when 'BlogComment'
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}"
if blog.children << blogComment
result = 2
if reply_type == nil || reply_type == 0
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}"
if blog.children << blogComment
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
if result == 2
update_course_activity_api(type,params[:id])
update_user_activity_api(type,params[:id])
update_org_activity_api(type,params[:id])
update_forge_activity_api(type,params[:id])
update_principal_activity_api(type,params[:id])
update_course_activity_api(type,update_id)
update_user_activity_api(type,update_id)
update_org_activity_api(type,update_id)
update_forge_activity_api(type,update_id)
update_principal_activity_api(type,update_id)
end
else
result = 3
end
present :result, result
present :status, status
present :act_id, update_id
present :tip, tip
present :subscribe,subscribe
end

View File

@ -4,6 +4,61 @@ module Mobile
class Users < Grape::API
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 "查询是否已绑定"
params do
requires :openid, type: String, desc: 'wechat openid'
@ -221,6 +276,73 @@ module Mobile
present :data,my_jours,with:Mobile::Entities::Jours
present :status,0
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

View File

@ -30,15 +30,24 @@ module Mobile
u.nil? ? "" : u.show_name
when :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
expose :id
#头像
user_expose :login
user_expose :lastname
#邮箱地址
user_expose :mail
expose :nickname
#真名
user_expose :img_url
@ -51,8 +60,6 @@ module Mobile
#我的二维码
#工作单位
user_expose :work_unit
#邮箱地址
user_expose :mail
#地区
user_expose :location
#签名

View File

@ -183,6 +183,7 @@ class IssuesController < ApplicationController
end
end
# 用户发布新issue
def create
call_hook(:controller_issues_new_before_save, { :params => params, :issue => @issue })
@issue.save_attachments(params[:attachments] || (params[:issue] && params[:issue][:uploads]))
@ -225,6 +226,7 @@ class IssuesController < ApplicationController
end
def edit
# 修改实例变量的值
return unless update_issue_from_params
respond_to do |format|
@ -233,6 +235,7 @@ class IssuesController < ApplicationController
end
end
# 用户编辑更改issue
def update
if params[:issue_detail]
issue = Issue.find(params[:id])
@ -240,6 +243,7 @@ class IssuesController < ApplicationController
@saved = update_user_issue_detail(issue, params)
return
else
# 修改实例变量的值
return unless update_issue_from_params
@issue.save_attachments(params[:attachments] || (params[:issue] && params[:issue][:uploads]))
saved = false
@ -575,6 +579,7 @@ class IssuesController < ApplicationController
@time_entry = TimeEntry.new(:issue => @issue, :project => @issue.project)
@time_entry.attributes = params[:time_entry]
# 更新issue状态时journal表产生记录返回@current_journal
@issue.init_journal(User.current)
issue_attributes = params[:issue]

View File

@ -8,18 +8,33 @@ class OrgMemberController < ApplicationController
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
@org = Organization.find(params[:org])
@organization = Organization.find(params[:org])
if params[:membership].nil?
@fail_hint = l(:label_blank_user_lists_for_org)
else
member_ids = params[:membership][:user_ids]
role_id = params[:orgRole]
member_ids.each do |user_id|
member = OrgMember.create(:user_id=>user_id, :created_at => Time.now)
@org.org_members << member
member = OrgMember.create(:user_id => user_id, :created_at => Time.now)
@organization.org_members << member
OrgMemberRole.create(:org_member_id => member.id, :role_id => role_id)
end
@members = (@organization.org_members).sort
@members = paginateHelper @members, 20
end
respond_to do |format|
format.js
@ -32,7 +47,11 @@ class OrgMemberController < ApplicationController
@member_role = @member.org_member_roles[0]
@member_role.role_id = params[:org_member][:role_ids][0]
@member_role.save
@org = @member.organization
@organization = @member.organization
# 成员编辑角色后分页
@members = (@organization.org_members).sort
@members = paginateHelper @members, 20
respond_to do |format|
format.js
end
@ -44,8 +63,10 @@ class OrgMemberController < ApplicationController
def destroy
member = OrgMember.find(params[:id])
@org = member.organization
@organization = member.organization
member.destroy
@members = (@organization.org_members).sort
@members = paginateHelper @members, 20
respond_to do |format|
format.js
end

View File

@ -421,6 +421,8 @@ class OrganizationsController < ApplicationController
@organization = Organization.find(params[:id])
if User.current.admin? || User.current.admin_of_org?(@organization)
@members = OrgMember.where(:organization_id => @organization.id).all.sort
@members = paginateHelper @members, 20
else
render_403
end
@ -451,10 +453,11 @@ class OrganizationsController < ApplicationController
def members
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
render_403
end
@members = paginateHelper @members, 20
end
def more_org_projects

View File

@ -580,6 +580,7 @@ class ProjectsController < ApplicationController
end
end
@members = paginateHelper @members
end
def update_message_status(user, project)

View File

@ -410,11 +410,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 @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'
@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
@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
@show_all = true
elsif User.current.member_of_course?(@course)
@ -476,11 +476,11 @@ class StudentWorkController < ApplicationController
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 @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'
@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
@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").order("#{@order} #{@b_sort}"),@name
end
@show_all = true
elsif User.current.member_of_course?(@course)
@ -613,33 +613,21 @@ class StudentWorkController < ApplicationController
student_work.work_status = 1
end
if student_work.save
if @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1
@student_work_project.student_work_id = student_work.id
@student_work_project.save
members = params[:group_member_ids].split(',')
for i in 1 .. 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 = @student_work_project.project_id
stu_project.user_id = members[i].to_i
stu_project.is_leader = 0
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.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
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
for i in 1 .. members.count-1
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)
if stu_work.save
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.save
end
stu_project.save
end
end
@homework.update_column(:updated_at, Time.now)
@ -687,20 +675,17 @@ class StudentWorkController < ApplicationController
if @homework.homework_type == 3
@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)
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
members = params[:group_member_ids].split(',')
for i in 1 .. members.count-1
stu_project = StudentWorkProject.new
stu_project.homework_common_id = @homework.id
stu_project.student_work_id = @work.id
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
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)
if stu_work.save
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)
stu_project.save
end
stu_project.user_id = members[i].to_i
stu_project.is_leader = 0
stu_project.save
end
end
@ -735,26 +720,25 @@ class StudentWorkController < ApplicationController
def destroy
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.each do |pro|
pro.destroy
end
project = @work.student_work_projects.where("is_leader = 1").first
project.update_attributes(:student_work_id => nil)
elsif @homework.homework_detail_group.base_on_project == 0
@work.student_work_projects.each do |pro2|
pro2.destroy
end
end
pros = @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}")
student_works.delete_all
pros.delete_all
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)
else
project.destroy
end
@work.destroy
else
@work.attachments.destroy_all
@work.student_works_scores.destroy_all
@work.course_messages.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)
end
respond_to do |format|
@ -786,22 +770,21 @@ class StudentWorkController < ApplicationController
def retry_work
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.each do |pro|
pro.destroy
end
project = @work.student_work_projects.where("is_leader = 1").first
project.update_attributes(:student_work_id => nil)
elsif @homework.homework_detail_group.base_on_project == 0
@work.student_work_projects.each do |pro2|
pro2.destroy
end
end
pros = @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}")
student_works.delete_all
pros.delete_all
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)
else
project.destroy
end
elsif @homework.homework_type == 1
@work.update_attributes(:work_status => 0, :name => "#{@homework.name}的作品提交", :description => nil, :late_penalty => 0, :commit_time => nil)
@work.destroy
else
@work.update_attributes(:work_status => 0, :name => "#{@homework.name}的作品提交", :description => nil, :late_penalty => 0, :commit_time => nil, :project_id => 0)
@work.attachments.destroy_all
@work.course_messages.destroy_all
end
@ -1096,9 +1079,13 @@ class StudentWorkController < ApplicationController
#创建作业的关联项目
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.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.is_leader = 1
if @project.save
@ -1139,7 +1126,7 @@ class StudentWorkController < ApplicationController
end
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
@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
respond_to do |format|
format.js
@ -1147,6 +1134,10 @@ class StudentWorkController < ApplicationController
end
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
if relate_pro.destroy
@user_activity_id = params[:user_activity_id].to_i
@ -1586,6 +1577,10 @@ class StudentWorkController < ApplicationController
end
end
end
if homework.homework_type == 3
student_works = group_student_works student_work, homework
student_works.update_all(:final_score => student_work.final_score,:teacher_score => student_work.teacher_score,:student_score => student_work.student_score,:teaching_asistant_score => student_work.teaching_asistant_score,:work_score => student_work.work_score)
end
end
end
end

View File

@ -2630,7 +2630,8 @@ class UsersController < ApplicationController
project_ids.each do |project_id|
project = Project.find(project_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
if message.valid?
news.forwards << Forward.new(:to_type => message.class.name, :to_id => message.id)
@ -3468,11 +3469,15 @@ class UsersController < ApplicationController
@order, @c_sort, @type, @list_type = 1, 2, 1, 1
#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_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
respond_to do |format|
format.html {render :layout => 'new_base_user'}
end

View File

@ -167,6 +167,27 @@ class WechatsController < ActionController::Base
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)
openid = request[:FromUserName]
wl = WechatLog.where("openid = '#{openid}' and request_raw like '%\"Event\":\"click\"%'").order('id desc').first

View File

@ -1,5 +1,6 @@
module OrgMemberHelper
include ApplicationHelper
def find_user_not_in_current_org_by_name org
if params[:q] && params[:q].lstrip.rstrip != ""
scope = Principal.active.sorted.not_member_of_org(org).like(params[:q])

View File

@ -158,4 +158,11 @@ module StudentWorkHelper
end
return status
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
end

View File

@ -757,6 +757,7 @@ class Issue < ActiveRecord::Base
end
end
# 更新issue时判断更新之前当前是否有自动更新的评论
def init_journal(user, notes = "")
@current_journal ||= Journal.new(:journalized => self, :user => user, :notes => notes)
if new_record?
@ -1454,8 +1455,18 @@ class Issue < ActiveRecord::Base
end
# Callback on file attachment
# 在执行issue模块前 执行:当附件被添加时,产生评论
# 第一次创建issue时@current_journal为nil评论不产生
# 当附件名称重名时,也不产生评论
# 当更新isuue时第一次上传的附件的已经存在则不更新次附件评论
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)
end

View File

@ -1,4 +1,4 @@
#学生提交作品表
#学生提交作品表 #work_status :0 未提交 1 已提交 2 迟交 3 分组作品复制的组员作品
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
@ -13,7 +13,8 @@ class StudentWork < ActiveRecord::Base
has_many :course_messages, :class_name =>'CourseMessage', :as => :course_message, :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_save :set_program_score, :set_src
@ -31,7 +32,7 @@ class StudentWork < ActiveRecord::Base
private
def set_program_score
if homework_common.is_program_homework? #编程作业,学生提交作品后计算系统得分
if self.homework_common.is_program_homework? #编程作业,学生提交作品后计算系统得分
#根据最后一次测试计算得分
unless last_test
self.system_score = 0
@ -169,6 +170,12 @@ class StudentWork < ActiveRecord::Base
end
end
end
if homework.homework_type == 3
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}")
student_works.update_all(:final_score => student_work.final_score,:teacher_score => student_work.teacher_score,:student_score => student_work.student_score,:teaching_asistant_score => student_work.teaching_asistant_score,:work_score => student_work.work_score)
end
end
end

View File

@ -941,46 +941,36 @@ class CoursesService
:description => description, :homework_state => state,:open_anonymous_evaluation => open_anonymous_evaluation}
end
def student_homework_score(groupid,course_id, nums, score_sort_by)
#teachers = find_course_teachers(@course)
#start_from = start_from * nums
def student_homework_score(groupid,course_id, nums, score_sort_by, sort_type = 'score')
sql_select = ""
if groupid == 0
if nums == 0
sql_select = "SELECT members.*, SUM(homework_attaches.score) as score FROM members, homework_attaches
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 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
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}"
else
sql_select = "SELECT members.*, SUM(homework_attaches.score) as score FROM members, homework_attaches
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 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
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} " #limit #{start_from}, #{nums}"
end
sql_select = "SELECT members.*,(
SELECT SUM(student_works.work_score)
FROM student_works,homework_commons
WHERE student_works.homework_common_id = homework_commons.id
AND homework_commons.course_id = course_id
AND student_works.user_id = members.user_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
) AS act_score
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
sql_select = "SELECT members.*, SUM(homework_attaches.score) as score FROM members, homework_attaches
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}"
sql_select = "SELECT members.*,(
SELECT SUM(student_works.work_score)
FROM student_works,homework_commons
WHERE student_works.homework_common_id = homework_commons.id
AND homework_commons.course_id = #{course_id}
AND student_works.user_id = members.user_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
) AS act_score
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} AND members.course_group_id = #{groupid} ORDER BY #{sort_type} #{score_sort_by}"
end
sql = ActiveRecord::Base.connection()
homework_scores = Member.find_by_sql(sql_select)

View File

@ -1,3 +1,4 @@
#coding=utf-8
class UsersService
include ApplicationHelper
include AccountHelper
@ -319,8 +320,22 @@ class UsersService
my_jours_arr
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

View File

@ -445,4 +445,41 @@ class WechatService
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

View File

@ -62,9 +62,9 @@
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" title='<%=strip_html(journal.notes) %>'>
<%case journal.jour_type %>
<% 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' %>
<%= 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 %>
</td>
<td class="center">

View File

@ -1,193 +1,192 @@
<style type="text/css">
div.talk_new .ke-container{margin-left:2px;}
.break_word {width:100%;}
</style>
<script type="text/javascript">
//头部导航
var menuids=["TopUserNav"] //Enter id(s) of SuckerTree UL menus, separated by commas
function buildsubmenus(){
for (var i=0; i<menuids.length; i++){
var div = document.getElementById(menuids[i]);
if(div == undefined)continue;
var ultags=div.getElementsByTagName("ul");
for (var t=0; t<ultags.length; t++){
ultags[t].parentNode.getElementsByTagName("a")[0].className="subfolderstyle";
ultags[t].parentNode.onmouseover=function(){
this.getElementsByTagName("ul")[0].style.display="block";
}
ultags[t].parentNode.onmouseout=function(){
this.getElementsByTagName("ul")[0].style.display="none";
}
}
}
}
if (window.addEventListener)
window.addEventListener("load", buildsubmenus, false)
else if (window.attachEvent)
window.attachEvent("onload", buildsubmenus)
</script>
<%= import_ke(enable_at: false, prettify: false) %>
<%= render :partial => 'blogs/article_list', :locals => {:blog=>@user.blog,:topics => @topics, :page => 0, :user => @user} %>
<script type="text/javascript">//侧导航
function nh_check_field(params){
var result=true;
if(params.subject!=undefined){
if($.trim(params.subject.val()) == ""){
params.subjectmsg.html('主题不能为空');
params.subjectmsg.css({color:'#ff0000'});
result=false;
}else{
params.subjectmsg.html('填写正确');
params.subjectmsg.css({color:'#008000'});
}
params.subjectmsg.show();
}
if(params.content!=undefined){
if(params.content.isEmpty()){
result=false;
}
if(params.content.html()!=params.textarea.html() || params.issubmit==true){
params.textarea.html(params.content.html());
params.content.sync(); //用上面那句ie11提交到服务器居然木有值
if(params.content.isEmpty()){
params.contentmsg.html('内容不能为空');
params.contentmsg.css({color:'#ff0000'});
}else{
params.contentmsg.html('填写正确');
params.contentmsg.css({color:'#008000'});
}
params.contentmsg.show();
}
}
return result;
}
function nh_init_board(params){
//发帖/编辑/回复按钮的click
params.showbtn.click(function(){
params.textarea.removeAttr('placeholder');
if(params.textarea.data('init') == undefined){
//初始化编辑器
var editor = params.kindutil.create(params.textarea, {
// allowPreviewEmoticons : false,
// allowImageUpload : false,
autoHeightMode : true,
resizeType : 1,minWidth:"1px",width:"560px",height:"150px",
allowFileManager:true,uploadJson:"/kindeditor/upload",
fileManagerJson:"/kindeditor/filemanager",
afterChange:function(){//按键事件
nh_check_field({content:this,contentmsg:params.contentmsg,textarea:params.textarea});
// var edit = this.edit;
// var body = edit.doc.body;
// edit.iframe.height(minHeight);
// this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight) + 30, minHeight));
},
afterCreate:function(){
this.loadPlugin("autoheight");
var userAgent = navigator.userAgent.toLowerCase();
if(/trident/.test(userAgent)){
$("div.talk_new .ke-container").css({'margin-left':'0px'});
}
// var toolbar = $("div[class='ke-toolbar']",params.about_talk);
// $(".ke-outline>.ke-toolbar-icon",toolbar).append('表情');
// params.toolbar_container.append(toolbar);
}
}).loadPlugin('paste');
//主题输入框按键事件
params.inputsubject.keyup(function(){
nh_check_field({subject:params.inputsubject,subjectmsg:params.subjectmsg});
})
//表单提交
params.form.submit(function(){
var is_checked = nh_check_field({
issubmit:true,
subject:params.inputsubject,
subjectmsg:params.subjectmsg,
content:editor,
contentmsg:params.contentmsg,
textarea:params.textarea
});
if(is_checked){
//return true 居然不提交 fuck your sister
$(this)[0].submit();
// return true;
}
return false;
});
//提交按钮click
params.submitbtn.click(function(){
params.form.submit();
});
//取消按钮click
params.cancelbtn.click(function(){
params.about_talk.toggle();//显示/隐藏编辑区
if(params.about_talk.is(':hidden')){//隐藏时reset表单数据
params.form[0].reset();
if(params.type=='reply'){
params.textarea.empty();
}else{
params.textarea.html(params.init_content_val.val());
}
var str = params.textarea.html();
str=str.replace(new RegExp(/&lt;/g),'<');
str=str.replace(new RegExp(/&gt;/g),'>');
editor.html(str);
params.subjectmsg.hide();
params.contentmsg.hide();
if(params.quote_show!=undefined)params.quote_show.empty();
if(params.quote_input!=undefined)params.quote_input.empty();
}else{
if(params.type=='reply'){
params.textarea.show();
params.textarea.focus();
params.textarea.hide();
//params.jumphref.attr('href','#'+params.form.attr('id'));
//params.jumphref[0].click();
}else{
params.textarea.show();
params.textarea.focus();
params.textarea.hide();
// params.inputsubject.focus();
}
}
});
params.textarea.data('init','1');//标记为已经初始化
}
params.cancelbtn.click();//显示/隐藏编辑区
});
if(params.type == 'reply'){
params.showbtn_child.click(function(){
if(params.textarea.data('init') == undefined){
params.showbtn.click();
}else{
params.cancelbtn.click();
if(params.about_talk.is(':hidden')){
params.cancelbtn.click();
}
}
var parent_topic_id = $(this).data('topic-id');
if(parent_topic_id!=undefined)$("input[name='parent_topic']",params.form).val(parent_topic_id);
var ref_str = params.get_ref_str_call($(this));
params.quote_show.html(ref_str);
params.quote_input.html(ref_str);
});
}
}
</script>
<script type="text/javascript">
$(function(){
setTimeout(function(){
elocalStorage(message_content_editor,'blog_<%=User.current.id %>');
}, 10000);
});
</script>
<style type="text/css">
div.talk_new .ke-container{margin-left:2px;}
</style>
<script type="text/javascript">
//头部导航
var menuids=["TopUserNav"] //Enter id(s) of SuckerTree UL menus, separated by commas
function buildsubmenus(){
for (var i=0; i<menuids.length; i++){
var div = document.getElementById(menuids[i]);
if(div == undefined)continue;
var ultags=div.getElementsByTagName("ul");
for (var t=0; t<ultags.length; t++){
ultags[t].parentNode.getElementsByTagName("a")[0].className="subfolderstyle";
ultags[t].parentNode.onmouseover=function(){
this.getElementsByTagName("ul")[0].style.display="block";
}
ultags[t].parentNode.onmouseout=function(){
this.getElementsByTagName("ul")[0].style.display="none";
}
}
}
}
if (window.addEventListener)
window.addEventListener("load", buildsubmenus, false)
else if (window.attachEvent)
window.attachEvent("onload", buildsubmenus)
</script>
<%= import_ke(enable_at: false, prettify: false) %>
<%= render :partial => 'blogs/article_list', :locals => {:blog=>@user.blog,:topics => @topics, :page => 0, :user => @user} %>
<script type="text/javascript">//侧导航
function nh_check_field(params){
var result=true;
if(params.subject!=undefined){
if($.trim(params.subject.val()) == ""){
params.subjectmsg.html('主题不能为空');
params.subjectmsg.css({color:'#ff0000'});
result=false;
}else{
params.subjectmsg.html('填写正确');
params.subjectmsg.css({color:'#008000'});
}
params.subjectmsg.show();
}
if(params.content!=undefined){
if(params.content.isEmpty()){
result=false;
}
if(params.content.html()!=params.textarea.html() || params.issubmit==true){
params.textarea.html(params.content.html());
params.content.sync(); //用上面那句ie11提交到服务器居然木有值
if(params.content.isEmpty()){
params.contentmsg.html('内容不能为空');
params.contentmsg.css({color:'#ff0000'});
}else{
params.contentmsg.html('填写正确');
params.contentmsg.css({color:'#008000'});
}
params.contentmsg.show();
}
}
return result;
}
function nh_init_board(params){
//发帖/编辑/回复按钮的click
params.showbtn.click(function(){
params.textarea.removeAttr('placeholder');
if(params.textarea.data('init') == undefined){
//初始化编辑器
var editor = params.kindutil.create(params.textarea, {
// allowPreviewEmoticons : false,
// allowImageUpload : false,
autoHeightMode : true,
resizeType : 1,minWidth:"1px",width:"560px",height:"150px",
allowFileManager:true,uploadJson:"/kindeditor/upload",
fileManagerJson:"/kindeditor/filemanager",
afterChange:function(){//按键事件
nh_check_field({content:this,contentmsg:params.contentmsg,textarea:params.textarea});
// var edit = this.edit;
// var body = edit.doc.body;
// edit.iframe.height(minHeight);
// this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight) + 30, minHeight));
},
afterCreate:function(){
this.loadPlugin("autoheight");
var userAgent = navigator.userAgent.toLowerCase();
if(/trident/.test(userAgent)){
$("div.talk_new .ke-container").css({'margin-left':'0px'});
}
// var toolbar = $("div[class='ke-toolbar']",params.about_talk);
// $(".ke-outline>.ke-toolbar-icon",toolbar).append('表情');
// params.toolbar_container.append(toolbar);
}
}).loadPlugin('paste');
//主题输入框按键事件
params.inputsubject.keyup(function(){
nh_check_field({subject:params.inputsubject,subjectmsg:params.subjectmsg});
})
//表单提交
params.form.submit(function(){
var is_checked = nh_check_field({
issubmit:true,
subject:params.inputsubject,
subjectmsg:params.subjectmsg,
content:editor,
contentmsg:params.contentmsg,
textarea:params.textarea
});
if(is_checked){
//return true 居然不提交 fuck your sister
$(this)[0].submit();
// return true;
}
return false;
});
//提交按钮click
params.submitbtn.click(function(){
params.form.submit();
});
//取消按钮click
params.cancelbtn.click(function(){
params.about_talk.toggle();//显示/隐藏编辑区
if(params.about_talk.is(':hidden')){//隐藏时reset表单数据
params.form[0].reset();
if(params.type=='reply'){
params.textarea.empty();
}else{
params.textarea.html(params.init_content_val.val());
}
var str = params.textarea.html();
str=str.replace(new RegExp(/&lt;/g),'<');
str=str.replace(new RegExp(/&gt;/g),'>');
editor.html(str);
params.subjectmsg.hide();
params.contentmsg.hide();
if(params.quote_show!=undefined)params.quote_show.empty();
if(params.quote_input!=undefined)params.quote_input.empty();
}else{
if(params.type=='reply'){
params.textarea.show();
params.textarea.focus();
params.textarea.hide();
//params.jumphref.attr('href','#'+params.form.attr('id'));
//params.jumphref[0].click();
}else{
params.textarea.show();
params.textarea.focus();
params.textarea.hide();
// params.inputsubject.focus();
}
}
});
params.textarea.data('init','1');//标记为已经初始化
}
params.cancelbtn.click();//显示/隐藏编辑区
});
if(params.type == 'reply'){
params.showbtn_child.click(function(){
if(params.textarea.data('init') == undefined){
params.showbtn.click();
}else{
params.cancelbtn.click();
if(params.about_talk.is(':hidden')){
params.cancelbtn.click();
}
}
var parent_topic_id = $(this).data('topic-id');
if(parent_topic_id!=undefined)$("input[name='parent_topic']",params.form).val(parent_topic_id);
var ref_str = params.get_ref_str_call($(this));
params.quote_show.html(ref_str);
params.quote_input.html(ref_str);
});
}
}
</script>
<script type="text/javascript">
$(function(){
setTimeout(function(){
elocalStorage(message_content_editor,'blog_<%=User.current.id %>');
}, 10000);
});
</script>

View File

@ -1,7 +1,6 @@
<style type="text/css">
div.talk_new .ke-container{margin-left:2px;}
.break_word {width:100%;}
</style>
<script type="text/javascript">
//头部导航

View File

@ -23,9 +23,9 @@
<td class="hworkStName130 pr10 student_work_<%= exercise.id%>" title="姓名" id="student_name_<%= exercise.id%>" style="cursor:pointer;">
<%=exercise.user.show_name %>
</td>
<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:130px;"><%= exercise.user.user_extensions.nil? ? "--" : exercise.user.user_extensions.student_id%></span>
</td>
<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:130px;"><%= exercise.user.user_extensions.nil? ? "--" : exercise.user.user_extensions.student_id%></span>
</td>
<td class="hworkStID130 student_work_<%= exercise.id%> float-none" title="班级" id="student_class_<%= exercise.id%>" style="cursor:pointer;">
--
</td>

View File

@ -74,7 +74,6 @@
});
function check_and_submit(doc){
$("#error").html('').hide();
check_forum_name();
if( $("textarea[name='forum[name]']").val().trim() == "" && $("textarea[name='forum[description]']").val().trim() != "" ){
$("#error").html("名称不能为空").show();
return;
@ -98,7 +97,6 @@
'<%= check_forum_name_forums_path %>',
{"forum_name":encodeURIComponent(name)},
function(data){
if( data == 'true'){
$("#error").html("贴吧名称已经存在").show();
check_pass = false;

View File

@ -78,5 +78,5 @@
<div class="cl"></div>
<%= call_hook(:view_issues_form_details_bottom, {:issue => @issue, :form => f}) %>
<% 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();location.reload()" class="blue_btn fl ml80" id="issue_confirm"> 确定</a>
<a href="javascript:void(0);" onclick="issueDetailShow();" class="grey_btn fl mr50 ml10" > 取消 </a>

View File

@ -14,8 +14,11 @@
<li class="navHomepageMenu fl">
<%= link_to "题库", user_homeworks_user_path(User.current), :class => "c_white f16 db p10"%>
</li>
<li class="navHomepageMenu fl mr30">
<%= link_to "帮助中心", "https://#{Setting.host_name}/forums/1/memos/1168", :class =>"c_white f16 db p10" %>
<!--<li class="navHomepageMenu fl mr30">-->
<!--<%#= 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>
<% end %>
</ul>

View File

@ -38,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>
<ul class="topnav_login_list none" id="topnav_login_list">
<li>
<a href ="javascript:void(0);" class="menuGrey" disabled="true">修改资料</a>
<%= link_to "修改资料", my_account_path(:tip => 1), :class => "menuGrey"%>
</li>
<li>
<a href ="javascript:void(0);" class="menuGrey" disabled="true">我的组织</a>
@ -48,7 +48,7 @@
</li>
<!--<li><a href="javascript:void(0);" class="menuGrey">账号设置</a> </li>-->
<li>
<%= link_to "退出",logout_url_without_domain,:class => "menuGrey",:method => "post"%>
<%= link_to "退出", logout_url_without_domain, :class => "menuGrey", :method => "post"%>
</li>
</ul>
</li>

View File

@ -4,8 +4,11 @@
</div>
<div class="fl">
<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">
<%= 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>
</ul>
</div>

View File

@ -103,7 +103,7 @@
<div class="homepageLeft mt10" id="LSide">
<div class="user_leftinfo mb10">
<% if User.current.logged?%>
<a href ="javascript:void(0);" disabled="true" class="user_leftinfo_img"><%= image_tag(url_to_avatar(@user),width:"74", height: "74", :id=>'nh_user_tx')%></a>
<a href ="javascript:void(0);" disabled="true" class="user_leftinfo_img"><%= image_tag(url_to_avatar(@user), width:"74", height: "74", :id=>'nh_user_tx')%></a>
<% else %>
<img src="images/user/male.jpg" width="74" height="74" />
<% end %>
@ -112,7 +112,7 @@
<% end %>
<div class="user_info_inner">
<div class=" user_leftinfo_namebox" >
<a href="javascript:void(0);" class="user_leftinfo_name"><%=@user.show_name %></a>
<a href="javascript:void(0);" class="user_leftinfo_name"><%= @user.show_name %></a>
<% if @user.user_extensions && @user.user_extensions.identity %>
<span class="user_cirbtn_yellow" ><%= get_user_roll @user %></span>
<% end%>
@ -123,7 +123,7 @@
<%= render :partial => 'layouts/user_brief_introduction', :locals => {:user => @user} %>
</div>
</div>
<textarea class="homepageSignatureTextarea none" placeholder="请编辑签名" id="user_brief_introduction_edit" onblur="edit_user_introduction('<%= edit_brief_introduction_user_path(@user.id)%>');"><%= @user.user_extensions.brief_introduction %></textarea>
<textarea class="homepageSignatureTextarea none" placeholder="请编辑签名" id="user_brief_introduction_edit" onblur="edit_user_introduction('<%= edit_brief_introduction_user_path(@user.id) %>');"><%= @user.user_extensions.brief_introduction %></textarea>
</div>
<ul class="user_atten clear">
<li>

View File

@ -90,7 +90,7 @@
</div>
<div class="homepagePostReplyDes">
<div class="homepagePostReplyPublisher"><a href="<%=user_path(reply.author)%>" class="newsBlue mr10 f14"><%= reply.author.name%></a><%= format_date(reply.created_at) %></div>
<div class="homepagePostReplyContent" id="activity_description_<%= reply.id %>"><%= h reply.content%></div>
<div class="homepagePostReplyContent" id="activity_description_<%= reply.id %>"><%= h reply.content.html_safe%></div>
</div>
<script type="text/javascript">
$(function(){

View File

@ -70,15 +70,15 @@
</select>
<span nhname="tag" nh_tag_1="true" style='display:none;'>
<% if !User.current.user_extensions.nil? && !User.current.user_extensions.student_id.nil? %>
<%= text_field_tag :no, User.current.user_extensions.student_id, :placeholder => l(:label_account_identity_studentID),:style=>"width:127px;" %>
<%= text_field_tag :no, User.current.user_extensions.student_id, :placeholder => l(:label_account_identity_studentID),:style => "width:127px;" %>
<% else %>
<%= text_field_tag :no, nil, :placeholder => l(:label_account_identity_studentID),:style=>"60px" %></span>
<%= text_field_tag :no, nil, :placeholder => l(:label_account_identity_studentID), :style => "60px" %></span>
<% end %>
</span>
<span id="identity_hint" style="display: none"></span>
</li>
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" style="display:none;"><%= text_field_tag :lastname,@user.lastname+@user.firstname,:no_label=>true, :required => true,:nh_required=>"1",:class=>"w210" %><span id="last_name_notice" class="none c_red">姓名不能为空</span>
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" style="display:none;"><%= text_field_tag :lastname, @user.lastname+@user.firstname, :no_label => true, :required => true, :nh_required => "1",:class => "w210" %><span id="last_name_notice" class="none c_red">姓名不能为空</span>
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" style="display:none;">
<% if User.current.user_extensions && User.current.user_extensions.gender && User.current.user_extensions.gender == 1 %>
@ -90,6 +90,7 @@
</li>
<li nhname="tag" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" style="display:none;">
<!-- 基本资料页面单位审核显示 -->
<% if User.current.user_extensions.nil? %>
<input nhname="tag" autocomplete="off" maxlength="36" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" id="province" name="province" style="display: none;" class="w210 fl" type="text" placeholder="--请搜索您所在的高校(单位)--" >
<input nhname="tag" nh_tag_4="true" id="occupation" name="occupation" style="display: none;" class="w210" type="text" value="" placeholder=" --请选择您所属的单位--"/>
@ -98,13 +99,14 @@
<span id="hint" style="color: #7f7f7f;display: none"><a id="school_num" href="javascript:void(0)" style="color: red" ></a><a id="search_condition" href="javascript:void(0)"></a></span>
</p>
<!--<input nhname="tag" nh_tag_0="true" nh_tag_1="true" id="occupation_name" type="text" style="display: none;width:117px;" readonly/>-->
<!-- 从业者选择单位名称 -->
<% elsif User.current.user_extensions.identity == 3 || User.current.user_extensions.identity == 2 %>
<% if User.current.user_extensions.school_id.nil? %>
<input nhname="tag" autocomplete="off" maxlength="36" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" id="province" name="province" style="display: none;" class="w210 fl" type="text" placeholder="--请搜索您所在的高校(单位)--" >
<input nhname="tag" nh_tag_4="true" id="occupation" name="occupation" style="display: none;" class="w210" type="text" value="<%= @user.user_extensions.occupation %>" />
<% else %>
<input nhname="tag" autocomplete="off" maxlength="36" nh_tag_0="true" nh_tag_1="true" nh_tag_3="true" id="province" name="province" style="display: none;" class="w210 fl" type="text"value="<%= User.current.user_extensions.school %>" >
<input nhname="tag" nh_tag_4="true" id="occupation" name="occupation" style="display: none;" class="w210" type="text" value="<%= @user.user_extensions.occupation %>" />
<input nhname="tag" nh_tag_4="true" id="occupation" name="occupation" style="display: none;" class="w210" type="text" value="<%= @user.user_extensions.school.id %>" /> <!-- 单位名称的test框选中下拉列表框的id -->
<% end %>
<p class="fl ml10">
<!-- <span id="errortip" class="icons_warning fl mt5" style="display: none;"></span> -->
@ -605,12 +607,15 @@
});
});
// 基本资料页面提交表单时,判断身份与单位是否合法
function my_account_form_submit(){
if($("#userIdentity").val() == -1 ) {
$("#identity_hint").html('<span style="color:red">请选择身份</span>').show();
e.stopImmediatePropagation();
e.stopImmediatePropagation(); // 阻止事件冒泡
return;
}
// 单位或高校必须从下拉列表中选择
if( $("input[name='province']").val().trim() != '' && $("input[name='occupation']").val().trim() == ''){ //学校名字和id不对的话
$("#hint").html('<span style="color:red">单位名称必须是从下拉列表中选择的,不能手动修改</span>').show();
e.stopImmediatePropagation();

View File

@ -1,8 +1,9 @@
<% if @fail_hint %>
alert("<%= @fail_hint %>");
<% else %>
$("#org_member_list").html('<%= escape_javascript( render :partial=>"organizations/org_member_list",:locals=> {:members=>@org.org_members}) %>');
// 组织添加成员后,同步刷新成员列表,左侧成员数
$("#org_member_list").html('<%= escape_javascript( render :partial => "organizations/org_member_list", :locals => {:members => @members}) %>');
$("#principals_for_new_member").html('');
$("#org_members_count_id").html("<%= @org.org_members.count %>");
$("#org_members_count_id").html("<%= @organization.org_members.count %>");
$("#not_org_member_search").val("");
<% end %>

View File

@ -1,3 +1,4 @@
// 删除成员后,同步刷新成员列表与左侧成员显示数
$("#org_members_count_id").html("");
$("#org_members_count_id").html("<%= @org.org_members.count %>")
$("#org_member_list").html('<%= escape_javascript( render :partial=>"organizations/org_member_list",:locals=> {:members=>@org.org_members}) %>');
$("#org_members_count_id").html("<%= @organization.org_members.count %>");
$("#org_member_list").html('<%= escape_javascript( render :partial => "organizations/org_member_list", :locals=> {:members => @members}) %>');

View File

@ -1,3 +1,4 @@
// 组织成员删除后,同步刷新成员数和成员列表
$("#org_members_count_id").html("");
$("#org_members_count_id").html("<%= @org.org_members.count %>")
$("#org_member_list").html('<%= escape_javascript( render :partial=>"organizations/org_member_list",:locals=> {:members=>@org.org_members}) %>');
$("#org_members_count_id").html("<%= @organization.org_members.count %>");
$("#org_member_list").html('<%= escape_javascript( render :partial => "organizations/org_member_list", :locals => {:members => @members}) %>');

View File

@ -1,23 +1,23 @@
<% if @org%>
<% if @org %>
var checked = $("#principals_for_new_member input:checked").size();
if(checked > 0)
{
alert('翻页或搜索后将丢失当前选择的用户数据!');
}
<% if @flag == "true"%>
<%# if @flag == "true"%>
// $('#principals_for_new_member').html('<%#= escape_javascript(find_user_not_in_current_org_by_name(@org)) %>');
<%# else%>
$('#principals_for_new_member').html('<%= escape_javascript(find_user_not_in_current_org_by_name(@org)) %>');
<% else%>
$('#principals_for_new_member').html('<%= escape_javascript(find_user_not_in_current_org_by_name(@org)) %>');
<% end%>
<%# end%>
<%end%>
var collection=$("#principals_for_new_member").children("#principals").children("label");
collection.css("text-overflow","ellipsis");
collection.css("white-space","nowrap");
collection.css("width","200px");
collection.css("overflow","hidden");
for(i=0;i<collection.length;i++){ //增加悬浮显示
var label=collection[i];
var text=$(label).text();
$(label).attr("title",text);
<% end %>
var collection = $("#principals_for_new_member").children("#principals").children("label");
collection.css("text-overflow", "ellipsis");
collection.css("white-space", "nowrap");
collection.css("width", "200px");
collection.css("overflow", "hidden");
for(i = 0; i < collection.length; i++){ //增加悬浮显示
var label = collection[i];
var text = $(label).text();
$(label).attr("title", text);
}

View File

@ -0,0 +1,4 @@
<% if @organization %>
// 局部更新组织页面子模块 id = org_member_list
$('#org_member_list').html("<%= escape_javascript(render :partial => 'organizations/org_member_list', :locals => {:members => @members}) %>");
<% end %>

View File

@ -1 +1,2 @@
$("#org_member_list").html('<%= escape_javascript( render :partial=>"organizations/org_member_list",:locals=> {:members=>@org.org_members}) %>');
// 编辑成员列表角色后,刷新成员列表
$("#org_member_list").html('<%= escape_javascript( render :partial => "organizations/org_member_list",:locals => {:members => @members}) %>');

View File

@ -103,22 +103,20 @@
<%= link_to "#{field.name}", show_org_subfield_organization_path(:id => organization.id, :sub_dir_name => field.subfield_subdomain_dir.name), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %>
<% end %>
<% else %>
<%= link_to "#{field.name}", organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %>
<!-- link_to "#{field.name}", organization_path(organization, :org_subfield_id => field.id), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" -->
<a href = "javascript:void(0);" class = "homepageMenuText" onclick = "$('#PostDomain_<%= field.id %>').slideToggle();"><%= field.name %></a>
<% end %>
<% if User.current.logged? and User.current.admin_of_org?(organization) %>
<%=link_to "", new_organization_org_document_comment_path(organization, :field_id => field.id), :method => "get", :class => "homepageMenuSetting fr", :title => "发布帖子" %>
<% end %>
</div>
<div class="<%= (field.sub_domains.count == 0) ? 'homepageLeftMenuCourses':'homepageLeftMenuCourses borderBottomNone' %>" id="PostDomain_<%= field.id %>" style="display:none;">
<div class="homepageLeftMenuCourses" id="PostDomain_<%= field.id %>" style="display:<%= field.sub_domains.count == 0 ? 'none' : '' %>">
<ul>
<%= render :partial => 'organizations/org_subdomain',:locals=>{:subdomains => field.sub_domains.reorder('priority').uniq, :org_subfield_id => field.id} %>
<%= render :partial => 'organizations/org_subdomain',:locals => {:subdomains => field.sub_domains.reorder('priority').uniq, :org_subfield_id => field.id} %>
</ul>
</div>
<% unless (field.sub_domains.count == 0 || !if_hidden_subdomain(field)) %>
<li class="homepageLeftMenuMore" id="sub_domain_jiantou_<%= field %>">
<a href="javascript:void(0);" class="homepageLeftMenuMoreIcon" onclick="$('#PostDomain_<%= field.id %>').slideToggle();" style="border-bottom: 1px solid #ddd;"></a>
</li>
<% end %>
<% elsif field.field_type == "Comptec" %>
<div class="homepageLeftMenuBlock">
<%= link_to "#{field.name}", teachers_organization_path(organization, :org_subfield_id => field.id, :type => "#{User.current.admin? ? "" : "famous"}"), :class => "homepageMenuText homepageMenuControl hidden", :onclick => "$('#homepageLeftMenuPost').slideToggle();" %>

View File

@ -22,10 +22,10 @@
<% end %>
<%= hidden_field_tag 'membership[role_ids][]', '' %>
<div class="pt5">
<a href="javascript:void(0)" class="org_member_btn" onclick="$('#org-member-<%= member.id%>-roles-form').submit();" style="margin-right: 10px;">
<a href="javascript:void(0)" class="org_member_btn" onclick = "$('#org-member-<%= member.id%>-roles-form').submit();" style="margin-right: 10px;">
<%= l(:button_change)%>
</a>
<a href="javascript:void(0)" class="org_member_btn" onclick="$('#org-member-<%= member.id%>-roles-form').hide();$(this).parent().parent().parent().parent().height(18)">
<a href="javascript:void(0)" class="org_member_btn" onclick = "$('#org-member-<%= member.id%>-roles-form').hide();$(this).parent().parent().parent().parent().height(18)">
<%= l(:button_cancel)%>
</a>
</div>
@ -34,8 +34,15 @@
<% if ( (User.current.id == member.organization.creator_id || User.current.admin_of_org?(member.organization) ) && member.user_id != member.organization.creator_id )%>
<a href="javascript:void(0);" style="color: #0781B4;margin-left: 10px;float: left" onclick="$(this).parent().height();$('#org-member-<%= member.id%>-roles-form').show();">编辑</a>
<a href="javascript:void(0)" style = "color: #0781B4;margin-left: 10px;float: left" onclick = "ifDeleteOrgMember('<%= member.id %>','<%= username %>')" >删除</a>
<%#= link_to '删除', Setting.protocol + "://" + Setting.host_name + "/org_member/" + member.id.to_s,:method=>'delete',:style=>'color: #0781B4;margin-left: 30px;float: left',:confirm=>'您确定要删除么?', :remote => true %><% end %>
<%#= link_to '删除', Setting.protocol + "://" + Setting.host_name + "/org_member/" + member.id.to_s,:method=>'delete',:style=>'color: #0781B4;margin-left: 30px;float: left',:confirm=>'您确定要删除么?', :remote => true %>
<% end %>
<div class="cl"></div>
</ul>
<div class="cl"></div>
<% end %>
<% end %>
<ul class="wlist">
<!-- 组织配置页面,成员子页面单独分页 -->
<%= pagination_links_full(@obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true){ |text, parameters, options|
link_to text, org_member_paging_org_member_index_path( parameters.merge(:flag => true, :org => @organization.id, :format => 'js')), :remote => true
} %>
</ul>

View File

@ -24,7 +24,7 @@
<% end%>
<ul class="wlist">
<%#= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true%>
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => false, :flag => true %>
</ul>
<div class="cl"></div>
</div>

View File

@ -4,7 +4,7 @@
<%= link_to image_tag(url_to_avatar(activity.author), :width => "50", :height => "50"), user_url_in_org(activity.author_id), :alt => "用户头像" %>
<%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
</div>
<div class="homepagePostDes">
<div class="homepagePostDes" >
<div class="homepagePostTo break_word">
<% if activity.try(:author).try(:realname) == ' ' %>
<%= link_to activity.try(:author), user_url_in_org(activity.author_id), :class => "newsBlue mr15" %>

View File

@ -1,7 +1,7 @@
<% if !@org_name.blank? %>
<%if @check == false %>
$checkName = false
<% if @config_page%>
$checkName = false;
<% if @config_page %>
$("#check_name_hint").html('<span class="c_red">名字不能重复<span>').show();
<% else%>
$("#organization_name_notice").html('<span class="c_red">名字不能重复<span>').show();
@ -10,7 +10,7 @@
<% else %>
$checkName = true;
<% if @config_page%>
<% if @config_page %>
$("#check_name_hint").html('<span class="c_green">名字可以使用</span>').show();
<% else%>

View File

@ -1,12 +1,14 @@
<script>
function g(o){return document.getElementById(o);}
function HoverLi(n){
//如果有N个标签,就将i<=N;
//如果有N个标签,就将i<=N;
for(var i=1;i<=3;i++){
g('orgSetting_'+i).className='orgSettingOp';
g('orgContent_'+i).className='undis';}
g('orgContent_'+i).className='undis';
}
g('orgContent_'+n).className='dis ml15 mr15';
g('orgSetting_'+n).className='orgSettingOp orgOpActive';}
g('orgSetting_'+n).className='orgSettingOp orgOpActive';
}
//如果要做成点击后再转到请将<li>中的onmouseover 改成 onclick;
//]]>
$checkName = true;
@ -16,7 +18,7 @@
return false ;
}
$.get(
'<%= check_uniq_organizations_path%>'+'?org_name='+$("#organization_name").val().trim()+"&config_page=Y" + "&org_id="+id
'<%= check_uniq_organizations_path %>'+'?org_name='+$("#organization_name").val().trim()+"&config_page=Y" + "&org_id="+id
)
}
function update_org(id, old_value, input_value){
@ -94,7 +96,7 @@
<!--<input id="allow_set_excellent_teachers" type="checkbox" style="margin-top:5px;" name="organization[allow_teacher]" <%#= @organization.allow_teacher==1 ? 'checked': ''%> class="ml3" />-->
<!--</div>-->
<!--<%# end %>-->
<a href="javascript:void(0);" class="saveBtn ml80 db fl" onclick="update_org('<%=@organization.id %>','<%= @organization.name %>', $('#organization_name'));">保存</a>
<a href="javascript:void(0);" class="saveBtn ml80 db fl" onclick = "update_org('<%=@organization.id %>', '<%= @organization.name %>', $('#organization_name'));">保存</a>
<% end %>
</div>
<div class="undis ml15 mr15" id="orgContent_2">
@ -105,16 +107,16 @@
<div class="cl"></div>
</ul>
<div id="org_member_list">
<%= render :partial=>"org_member_list",:locals=> {:members=>@organization.org_members} %>
<%= render :partial => "org_member_list", :locals => {:members => @members} %>
</div>
</div>
<div class="fl ml10 orgMemContainer">
<div class="orgMemberAdd">
<p class="fontBlue fb mb5">添加成员</p>
<%= form_tag url_for(:controller => 'org_member', :action => 'create', :org => @organization),:id=>'org_member_add_form',:remote=>true do |f|%>
<%= form_tag url_for(:controller => 'org_member', :action => 'create', :org => @organization),:id => 'org_member_add_form', :remote => true do |f|%>
<input type="text" id="not_org_member_search" name="orgAddSearch" placeholder="支持姓名、邮箱、登录名搜索" class="orgAddSearch mb20" />
<%# if @organization.secdomain_name.nil? %>
<%= javascript_tag "observeSearchfield('not_org_member_search', null, '#{ escape_javascript "/org_member/org_member_autocomplete?" + {:org=> @organization.id}.to_query }')" %>
<%= javascript_tag "observeSearchfield('not_org_member_search', null, '#{ escape_javascript "/org_member/org_member_autocomplete?" + {:org => @organization.id}.to_query }')" %>
<%#= javascript_tag "observeSearchfield('not_org_member_search', null, '#{url_for(:controller => 'organizations', :action => 'org_member_autocomplete', :org=> @organization.id)}')" %>
<%# else %>
<%#= javascript_tag "observeSearchfield('not_org_member_search', null, '#{ escape_javascript secdomain_with_protocol(@organization.secdomain_name) + "/org_member/org_member_autocomplete?" + {:org=> @organization.id}.to_query }')" %>
@ -143,7 +145,7 @@
<div class="undis ml15 mr15" id="orgContent_3">
<!--新增二级栏目-->
<div>
<%= form_tag url_for(:controller => 'org_subfields', :action => 'create', :organization_id => @organization.id), :id=> 'add_subfield_form',:remote => true do %>
<%= form_tag url_for(:controller => 'org_subfields', :action => 'create', :organization_id => @organization.id), :id => 'add_subfield_form',:remote => true do %>
<span class="fontGrey3 fb mb5 mr10" >新增一级栏目</span>
<input type="text" id="subfield_name" name="name" placeholder="栏目名称" class="orgAddSearch mb10" />
<div class="mb10">
@ -178,6 +180,7 @@
<%= render :partial => 'organizations/subfield_list', :locals => {:subfields => subfield_to_addmin?(@organization)} %>
</div>
</div>
</div>
<script>
function add_org_subfield(){
@ -245,4 +248,5 @@
$this.bind('blur', reset);
});
}
</script>
</script>

View File

@ -7,7 +7,7 @@
<%= render :partial => 'users/show_detail_info', :locals => {:user => user} %>
</div>
<div class="homepagePostDes">
<div class="homepagePostTo break_word">
<div class="homepagePostTo break_word" style="width:620px">
<% if user.try(:realname) == ' ' %>
<%= link_to user, user_path(user), :class => "newsBlue mr15" %>
<% else %>

View File

@ -24,4 +24,7 @@
</ul>
<div class="cl"></div>
</div>
</div>
</div>

View File

@ -5,7 +5,7 @@
<%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
</div>
<div class="homepagePostDes">
<div class="homepagePostTo break_word">
<div class="homepagePostTo break_word" style="width:620px">
<%= link_to activity.author.show_name, user_path(activity.author_id), :class => "newsBlue mr15" %>
TO
<%= link_to activity.project.name.to_s+" | 项目新闻", project_news_index_path(activity.project), :class => "newsBlue ml15" %>

View File

@ -1,5 +1,5 @@
<div class="project_r_h">
<h2 class="project_h2 fl"><%= @subPage_title%></h2>
<h2 class="project_h2 fl"><%= @subPage_title %></h2>
<% if is_project_manager?(User.current, @project) %>
<span class="fr f14 fontGrey2" style="height: 40px; line-height: 40px; margin-right: 15px;">
<%=link_to "成员管理", :controller => 'projects', :action => 'settings', :id => @project.id, :tab => 'members' %>

View File

@ -26,7 +26,11 @@
<%= link_to student_work.user.show_name,"javascript:void(0)" ,:title => student_work.user.show_name, :class => "StudentName break_word"%>
</div>
</td>
<% if student_work.project.is_public || User.current.member_of?(student_work.project) || User.current.admin? %>
<% if student_work.project_id == 0 || student_work.project_id.nil?%>
<td class="<%=@homework.anonymous_comment == 1 ? 'hworkPrName2' : 'hworkPrName'%> student_work_<%= student_work.id%>" title="该项目是私有的">
--
</td>
<% elsif student_work.project.is_public || User.current.member_of?(student_work.project) || User.current.admin? %>
<td class="<%=@homework.anonymous_comment == 1 ? 'hworkPrName2' : 'hworkPrName'%> student_work_<%= student_work.id%>" title="项目名称">
<%= link_to( student_work.project.name, project_path(student_work.project.id))%>
</td>

View File

@ -26,7 +26,11 @@
<%= link_to student_work.user.show_name,"javascript:void(0)" ,:title => student_work.user.show_name, :class => "linkGrey f14 StudentName break_word"%>
</div>
</td>
<% if student_work.project.is_public || User.current.member_of?(student_work.project) || User.current.admin? %>
<% if student_work.project_id == 0 || student_work.project_id.nil?%>
<td class="hworkPrName float-none mr10 student_work_<%= student_work.id%>" title="项目名称">
--
</td>
<% elsif student_work.project.is_public || User.current.member_of?(student_work.project) || User.current.admin? %>
<td class="hworkPrName float-none mr10 student_work_<%= student_work.id%>" title="项目名称">
<%= link_to( student_work.project.name, project_path(student_work.project.id))%>
</td>

View File

@ -46,13 +46,16 @@
<% if @homework.homework_detail_group.base_on_project == 1 %>
<li>
<span class="tit_fb"> 关联项目:</span>
<% if work.project.is_public || User.current.member_of?(work.project) || User.current.admin? %>
<% if work.project_id == 0 || work.project_id.nil? %>
<span>暂无</span>
<% elsif work.project.is_public || User.current.member_of?(work.project) || User.current.admin? %>
<%= link_to( work.project.name, project_path(work.project.id), :class => "linkBlue" )%>
<span class="ml5">(综合评分:<font class="c_red"><%=static_project_score(work.project.project_score).to_i %></font>)</span>
<% else %>
<span title ="该项目是私有的"><%=work.project.name %></span>
<span class="ml5">(综合评分:<font class="c_red"><%=static_project_score(work.project.project_score).to_i %></font>)</span>
<% end %>
<%#= link_to( work.project.name, project_path(work.project.id), :class => "linkBlue" )%>
<span class="ml5">(综合评分:<font class="c_red"><%=static_project_score(work.project.project_score).to_i %></font>)</span>
</li>
<% end %>
<% end%>

View File

@ -1,27 +1,29 @@
<div class="project_r_h02">
<h2 class="project_h2">新建课程</h2>
</div>
<div class="hwork_new">
<ul>
<%= labelled_form_for @syllabus do |f| %>
<li class="ml45">
<label><span class="c_red">*</span>&nbsp;课程名称&nbsp;&nbsp;</label>
<input type="text" name="title" id="new_syllabus_name" class="name_input" placeholder="例如:软件工程" maxlength="100" onkeyup="regex_syllabus_name();">
<span class="c_red" id="new_syllabus_name_notice" style="display: none;">课程名称不能为空且至少有两个字符</span>
</li>
<div class="cl"></div>
<li class="ml45">
<label><span class="c_white">*</span>&nbsp;<%= l(:label_tags_course_eng_name)%>&nbsp;&nbsp;</label>
<input type="text" name="eng_name" id="new_syllabus_eng_name" placeholder="例如Software Engineering" class="name_input" maxlength="100">
<!--<span class="c_red" id="new_course_class_period_notice" style="display: none;"></span>-->
</li>
<div class="cl"></div>
<li class=" ml90" >
<a href="javascript:void(0)" class="blue_btn fl c_white" onclick="submit_new_syllabus();" >提交</a>
<%= link_to "取消",user_activities_path(User.current.id),:class => "grey_btn fl c_white ml10"%>
<div class="cl"></div>
</li>
<% end%>
</ul>
</div><!--talknew end-->
<div class="project_r_h02">
<h2 class="project_h2">新建课程</h2>
</div>
<div class="hwork_new">
<ul>
<%= labelled_form_for @syllabus do |f| %>
<li class="ml45">
<label><span class="c_red">*</span>&nbsp;课程名称&nbsp;&nbsp;</label>
<input type="text" name="title" id="new_syllabus_name" class="name_input" placeholder="例如:软件工程" maxlength="100" onkeyup="regex_syllabus_name();">
<span class="c_red" id="new_syllabus_name_notice" style="display: none;">课程名称不能为空且至少有两个字符</span>
</li>
<div class="cl"></div>
<li class="ml125 fontGrey3"><span class="success-icon mr25">正确示例:软件工程</span><span class="error-icon">错误示例2016软件工程</span></li>
<li class="ml125 mt10 mb10 fontGrey2">课程是针对一个具体的学科方向开展的教学内容与进程安排<br/>本质上,一门课程就是一个教学计划</li>
<li class="ml45">
<label><span class="c_white">*</span>&nbsp;<%= l(:label_tags_course_eng_name)%>&nbsp;&nbsp;</label>
<input type="text" name="eng_name" id="new_syllabus_eng_name" placeholder="例如Software Engineering" class="name_input" maxlength="100">
<!--<span class="c_red" id="new_course_class_period_notice" style="display: none;"></span>-->
</li>
<div class="cl"></div>
<li class=" ml55" >
<a href="javascript:void(0)" class="blue_btn fl c_white" onclick="submit_new_syllabus();" >提交</a>
<%= link_to "取消",user_activities_path(User.current.id),:class => "grey_btn fl c_white ml10"%>
<div class="cl"></div>
</li>
<% end%>
</ul>
</div><!--talknew end-->
<div class="cl"></div>

View File

@ -5,7 +5,7 @@
<%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
</div>
<div class="homepagePostDes">
<div class="homepagePostTo break_word">
<div class="homepagePostTo break_word" style="width:620px">
<% if activity.try(:author).try(:realname) == ' ' %>
<%= link_to activity.try(:author), user_path(activity.author_id), :class => "newsBlue mr15" %>
<% else %>
@ -43,4 +43,4 @@
$(function(){
user_card_show_hide();
});
</script>
</script>

View File

@ -5,7 +5,7 @@
<%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
</div>
<div class="homepagePostDes">
<div class="homepagePostTo break_word">
<div class="homepagePostTo break_word" style="width:620px">
<% if activity.try(:author).try(:realname) == ' ' %>
<%= link_to activity.try(:author), user_path(activity.author_id), :class => "newsBlue mr15" %>
<% else %>

View File

@ -1,19 +1,25 @@
<div class="syllabus_category">
<% unless projects.empty? %>
<% if @type.to_i == 2 %>
<%= link_to "", {:controller => 'users', :action => 'sort_project_list', :id =>@user,:list_type => list_type, :type => @type, :sort => @c_sort, :order => 2 }, :class => "#{@c_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} fr", :style => "margin-right: 5px;", :remote => true %>
<%= link_to "", {:controller => 'users', :action => 'sort_project_list', :id => @user,:list_type => list_type, :type => @type, :sort => @c_sort, :order => 2 },
:class => "#{@c_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} fr", :style => "margin-right: 5px;", :remote => true %>
<% else %>
<%= link_to "", {:controller => 'users', :action => 'sort_project_list', :id =>@user,:list_type => list_type, :type => @type, :sort => @c_sort, :order => 2 }, :class => "sortdownbtn sort_no fr", :style => "margin-right: 5px;", :remote => true %>
<%= link_to "", {:controller => 'users', :action => 'sort_project_list', :id => @user,:list_type => list_type, :type => @type, :sort => @c_sort, :order => 2 },
:class => "sortdownbtn sort_no fr", :style => "margin-right: 5px;", :remote => true %>
<% end %>
<%= link_to "人气", {:controller => 'users', :action => 'sort_project_list', :id =>@user,:list_type => list_type, :type => @type, :sort => @c_sort, :order => 2 }, :class => "sortTxt fr", :remote => true %>
<%= link_to "人气", {:controller => 'users', :action => 'sort_project_list', :id => @user,:list_type => list_type, :type => @type, :sort => @c_sort, :order => 2 },
:class => "sortTxt fr", :remote => true %>
<% if @type.to_i == 1 %>
<%= link_to "", {:controller => 'users', :action => 'sort_project_list', :id =>@user,:list_type => list_type, :type => @type, :sort => @c_sort, :order => 1 }, :class => "#{@c_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} fr", :remote => true %>
<%= link_to "", {:controller => 'users', :action => 'sort_project_list', :id => @user,:list_type => list_type, :type => @type, :sort => @c_sort, :order => 1 },
:class => "#{@c_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} fr", :remote => true %>
<% else %>
<%= link_to "", {:controller => 'users', :action => 'sort_project_list', :id =>@user,:list_type => list_type, :type => @type, :sort => @c_sort, :order => 1 }, :class => "sortdownbtn sort_no fr", :remote => true %>
<%= link_to "", {:controller => 'users', :action => 'sort_project_list', :id => @user,:list_type => list_type, :type => @type, :sort => @c_sort, :order => 1 },
:class => "sortdownbtn sort_no fr", :remote => true %>
<% end %>
<%= link_to "时间", {:controller => 'users', :action => 'sort_project_list', :id =>@user,:list_type => list_type, :type => @type, :sort => @c_sort, :order => 1 }, :class => "sortTxt fr", :remote => true %>
<%= link_to "时间", {:controller => 'users', :action => 'sort_project_list', :id => @user,:list_type => list_type, :type => @type, :sort => @c_sort, :order => 1 },
:class => "sortTxt fr", :remote => true %>
<% end %>
<span class="grayTxt fl "><%=@user == User.current ? "我" : "他" %><%= list_type == 1 ? "创建" : "参与"%>的项目</span>
<span class="grayTxt fl "><%= @user == User.current ? "我" : "他" %><%= list_type == 1 ? "创建" : "参与"%>的项目</span>
<div class="cl"></div>
</div>
<div class="syllabus_courses_box" id="project_li_<%=list_type %>">
@ -21,7 +27,7 @@
<div class="icons_tishi"><img src="/images/sy/icons_tan.png" width="110" height="110" alt="" ></div>
<% if list_type == 1 %>
<p class="sy_tab_con_p"><%=@user == User.current ? "您" : "他" %>还没有创建项目~~<br />
<%= link_to "创建项目", new_project_path(:host=> Setting.host_name), :target => "_blank", :class => "sy_btn_green ml5 mt5" if @user == User.current %>
<%= link_to "创建项目", new_project_path(:host => Setting.host_name), :target => "_blank", :class => "sy_btn_green ml5 mt5" if @user == User.current %>
</p>
<% else %>
<p class="sy_tab_con_p"><%=@user == User.current ? "您" : "他" %>还没有加入项目~~<br />
@ -31,16 +37,18 @@
<% else %>
<% projects.each_with_index do |project, i| %>
<div class="syllabus_courses_list <%= i > 4 ? 'none' : ''%>" style="cursor: default;">
<% allow_visit = User.current.member_of?(project) || User.current.admin? || project.is_public == 1 %>
<div class="sy_courses_open">
<span id="collect_project_icon_<%=project.id %>">
<span id="collect_project_icon_<%= project.id %>">
<%=render :partial => 'collect_project', :locals => {:project => project} %>
</span>
<h3><%= link_to project.name, project_path(project.id,:host=>Setting.host_name), :target => '_blank', :class => "new_project_title fl",:id => "show_project_#{project.id}", :title => (project.is_public? ? "公开项目:":"私有项目:") + project.name%></h3>
<h3><%= link_to project.name, allow_visit ? project_path(project.id,:host=>Setting.host_name) : 'javascript:void(0)', :target => '_blank',
:class => "new_project_title fl",:id => "show_project_#{project.id}", :title => (allow_visit ? "#{project.name}" : "私有项目不可访问") %></h3>
<% unless project.is_public? %>
<span class="syllabus_class_private fl ml10 mt3 syllabus_class_property">私有</span>
<% end %>
<% projectUser = User.where("id=?",project.user_id).first %>
<%=link_to "<span class='fr grayTxt'>创建者:#{projectUser.try(:realname) != " " ? projectUser.lastname + projectUser.firstname : projectUser.try(:login)}</span>".html_safe, user_path(projectUser) %>
<%= link_to "<span class='fr grayTxt'>创建者:#{projectUser.try(:realname) != " " ? projectUser.lastname + projectUser.firstname : projectUser.try(:login)}</span>".html_safe, user_path(projectUser) %>
<div class="cl"></div>
</div>
<div>
@ -58,7 +66,8 @@
<% end %>
<% if count > 5 %>
<div class="syllabus_courses_list">
<p class="new_projectlist_more"><a id="project_more_<%=list_type %>" href="javascript:void(0);" data-count="<%= count %>" data-init="0" onclick="expand_projects('#project_more_<%=list_type %>', '#project_li_<%=list_type %>', <%=count%>);">共<%=count %>个项目,点击全部展开</a></p>
<p class="new_projectlist_more"><a id="project_more_<%=list_type %>" href="javascript:void(0);" data-count="<%= count %>" data-init="0" onclick="expand_projects('#project_more_<%=list_type %>',
'#project_li_<%=list_type %>', <%=count%>);">共<%=count %>个项目,点击全部展开</a></p>
</div>
<% end %>
<% end %>

View File

@ -5,7 +5,7 @@
<%= render :partial => 'users/show_detail_info', :locals => {:user => activity.author} %>
</div>
<div class="homepagePostDes">
<div class="homepagePostTo break_word">
<div class="homepagePostTo break_word" style="width:620px">
<%= link_to activity.author.show_name, user_path(activity.author_id), :class => "newsBlue mr15" %>
TO
<%= link_to activity.project.name.to_s+" | 项目讨论区",project_boards_path(activity.project), :class => "newsBlue ml15 mr5"%>

View File

@ -20,7 +20,7 @@
<%= hidden_field_tag(:send_ids, send_ids) %>
<input type="text" id="search_course_input" value="<%= @search %>" name="search" placeholder="输入班级ID或者名称搜索" class="searchResourcePopup" />
<script>
observeSearchfieldOnInput('search_course_input','<%= search_user_course_user_path(user)%>','<%= send_id %>','<%= send_ids%>','news')
observeSearchfieldOnInput('search_course_input', '<%= search_user_course_user_path(user)%>', '<%= send_id %>', '<%= send_ids%>', 'news')
</script>
<!--<a href="javascript:void(0);" class="searchIconPopup"></a>-->
<%= submit_tag '',:class=>'searchIcon2',:onfocus=>"this.blur();",:style=>'border-style:none' %>

View File

@ -30,3 +30,7 @@ button:
type: "click"
name: "联系我们"
key: "FEEDBACK"
-
type: "view"
name: "个人资料"
url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx8e1ab05163a28e37&redirect_uri=https://www.trustie.net/wechat/user_activities&response_type=code&scope=snsapi_base&state=edit_userinfo#wechat_redirect"

View File

@ -30,3 +30,7 @@ button:
type: "click"
name: "联系我们"
key: "FEEDBACK"
-
type: "view"
name: "个人资料"
url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=https://test.forge.trustie.net/wechat/user_activities&response_type=code&scope=snsapi_base&state=edit_userinfo#wechat_redirect"

View File

@ -116,6 +116,7 @@ RedmineApp::Application.routes.draw do
end
collection do
get 'org_member_autocomplete'
get 'org_member_paging'
get 'deleteOrgMember'
end
end

View File

@ -26,6 +26,7 @@ default: &default
join_project_notice: "TtXvy0XMIQyCgpnXHhoB8t-x0QIfy-78gAJXsGf9afg"
project_issue_notice: "HP8JejOnkzmvFopTarc0l1Tp4bU9qnxzdH27x3186lI"
at_notice: "U3kqzgriCaqkPI9qX0NDQOInJ5hiwHCz6wgTsPysSx4"
rebind_notice: "OYsiECfqUlHKlzF_X-pz_xsGh_vAAUunX0jYRdHlyFU"
auto_openid_url_1: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx8e1ab05163a28e37&redirect_uri=https://www.trustie.net/wechat/user_activities"
auto_openid_url_2: "&response_type=code&scope=snsapi_base&state="

View File

@ -26,6 +26,7 @@ default: &default
join_project_notice: "3KnMQEMUCmQWkB5JvzrpmguEwnN8bvUHUdpOTudxv_M"
project_issue_notice: "HAF2aCta7BtnaOd_cotGvU4tErGWwCd9I9aiClFN7w8"
at_notice: "p4HfyZQuF8O5bP_44RbbJS30SGojLJAuZEqp34iB4JU"
rebind_notice: "B97nOiW9cscB_d078I3k0jaPLHeJThTKUuxMoUnWZ2U"
auto_openid_url_1: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=https://test.forge.trustie.net/wechat/user_activities"
auto_openid_url_2: "&response_type=code&scope=snsapi_base&state="

View File

@ -0,0 +1,24 @@
class GroupHomeworkCopyWork < ActiveRecord::Migration
def up
homeworks = HomeworkCommon.where("homework_type = 3")
count = homeworks.count / 30 + 2
transaction do
for i in 1 ... count do i
homeworks.page(i).per(30).each do |homework|
homework.student_works.each do |stu|
stu.student_work_projects.each do |stu_pro|
if stu_pro.is_leader == 0
new_stu = StudentWork.new(:name => stu.name, :description => stu.description, :homework_common_id =>homework.id, :user_id => stu_pro.user_id, :final_score => stu.final_score, :teacher_score => stu.teacher_score, :student_score => stu.student_score, :teaching_asistant_score => stu.teaching_asistant_score,
:project_id => stu.project_id, :late_penalty => stu.late_penalty,:absence_penalty => stu.absence_penalty,:work_score => stu.work_score,:work_status => 3,:commit_time => stu.commit_time)
new_stu.save
end
end
end
end
end
end
end
def down
end
end

File diff suppressed because it is too large Load Diff

View File

@ -40,7 +40,7 @@
<script src="/javascripts/wechat/directives/input_focus.js"></script>
<script src="/javascripts/wechat/directives/at_delete_link.js"></script>
<script src="/javascripts/wechat/directives/iphone_recognize.js"></script>
<script src="/javascripts/wechat/directives/submit_start.js"></script>
<script src="/javascripts/wechat/directives/multi_reply.js"></script>
<script src="/javascripts/wechat/controllers/reg.js"></script>
<script src="/javascripts/wechat/controllers/login.js"></script>
<script src="/javascripts/wechat/controllers/activity.js"></script>

View File

@ -73,7 +73,17 @@
<div ng-if="journal.praise_count && !journal.has_praise" ng-click="addPraise(journal);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{journal.praise_count}}</span></div>
<div ng-if="journal.has_praise" ng-click="decreasePraise(journal);"><img src="/images/wechat/w_praised.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{journal.praise_count}}</span></div>
</div>
<div ng-click="clickReply(journal.act_id,blog)" class="fr mr25 f13 reply-icons multi-hide" >
<img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">回复</span>
</div>
<div class="cl"></div>
<div ng-show="journal.showinput" class="post-input-container multi-input-container ml40 mb10">
<div class="copy-input-container"><textarea class="copy-input"></textarea></div>
<textarea ng-focus="inputfocus(blog)" ng-blur="inputblur(blog)" input-auto type="text" class="post-reply-input" ng-model="journal.comment" placeholder="{{replytip}}" /></textarea>
<button ng-click="addReply(journal,1);journal.showinput = false;" ng-disabled="journal.disabled" ng-hide="journal.disabled" class="post-reply-submit fr border-radius">提交</button>
<button ng-disabled="journal.disabled" ng-hide="!journal.disabled" class="post-reply-submit bg-grey fr border-radius">提交</button>
<div class="cl"></div>
</div>
</div>
</div>
</div>
@ -82,13 +92,13 @@
</div>
</div>
<div ng-if="!blog.locked" id="post_input_1" class="post-input-wrap post-box-shadow" iphone-recognize>
<div ng-show="!blog.notshow" ng-if="!blog.locked" id="post_input_1" class="post-input-wrap post-box-shadow" iphone-recognize>
<div class="post-reply-row border-bottom-none">
<div class="post-input-container">
<div class="copy-input-container"><textarea class="copy-input"></textarea></div>
<textarea input-auto type="text" class="post-reply-input" id="postInput1" ng-model="formData.comment" placeholder="{{replytip}}" /></textarea>
<button ng-click="addReply(formData)" ng-disabled="formData.disabled" ng-hide="formData.disabled" class="post-reply-submit fr border-radius">提交</button>
<button ng-disabled="formData.disabled" ng-hide="!formData.disabled" class="post-reply-submit bg-grey fr border-radius">提交</button>
<textarea input-auto type="text" class="post-reply-input" id="postInput1" ng-model="blog.comment" placeholder="{{replytip}}" /></textarea>
<button ng-click="addReply(blog,0)" ng-disabled="blog.disabled" ng-hide="blog.disabled" class="post-reply-submit fr border-radius">提交</button>
<button ng-disabled="blog.disabled" ng-hide="!blog.disabled" class="post-reply-submit bg-grey fr border-radius">提交</button>
<div class="cl"></div>
</div>
</div>

View File

@ -71,7 +71,17 @@
<div ng-if="journal.praise_count && !journal.has_praise" ng-click="addPraise(journal);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{journal.praise_count}}</span></div>
<div ng-if="journal.has_praise" ng-click="decreasePraise(journal);"><img src="/images/wechat/w_praised.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{journal.praise_count}}</span></div>
</div>
<div ng-click="clickReply(journal.act_id,discussion)" class="fr mr25 f13 reply-icons multi-hide">
<a><img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">回复</span></a>
</div>
<div class="cl"></div>
<div ng-show="journal.showinput" class="post-input-container multi-input-container ml40 mb10">
<div class="copy-input-container"><textarea class="copy-input"></textarea></div>
<textarea ng-focus="inputfocus(discussion)" ng-blur="inputblur(discussion)" input-auto type="text" class="post-reply-input" ng-model="journal.comment" placeholder="{{replytip}}" /></textarea>
<button ng-click="addReply(journal,1);journal.showinput = false;" ng-disabled="journal.disabled" ng-hide="journal.disabled" class="post-reply-submit fr border-radius">提交</button>
<button ng-disabled="journal.disabled" ng-hide="!journal.disabled" class="post-reply-submit bg-grey fr border-radius">提交</button>
<div class="cl"></div>
</div>
</div>
</div>
<div ng-if="has_more">
@ -79,13 +89,13 @@
</div>
</div>
<div ng-if="!discussion.locked" id="post_input_1" class="post-input-wrap post-box-shadow" iphone-recognize>
<div ng-show="!discussion.notshow" ng-if="!discussion.locked" id="post_input_1" class="post-input-wrap post-box-shadow" iphone-recognize>
<div class="post-reply-row border-bottom-none">
<div class="post-input-container">
<div class="copy-input-container"><textarea class="copy-input"></textarea></div>
<textarea input-auto type="text" class="post-reply-input" id="postInput1" ng-model="formData.comment" placeholder="输入回复内容~" /></textarea>
<button ng-click="addReply(formData)" ng-disabled="formData.disabled" ng-hide="formData.disabled" class="post-reply-submit fr border-radius">提交</button>
<button ng-disabled="formData.disabled" ng-hide="!formData.disabled" class="post-reply-submit bg-grey fr border-radius">提交</button>
<textarea input-auto type="text" class="post-reply-input" id="postInput1" ng-model="discussion.comment" placeholder="输入回复内容~" /></textarea>
<button ng-click="addReply(discussion,0)" ng-disabled="discussion.disabled" ng-hide="discussion.disabled" class="post-reply-submit fr border-radius">提交</button>
<button ng-disabled="discussion.disabled" ng-hide="!discussion.disabled" class="post-reply-submit bg-grey fr border-radius">提交</button>
<div class="cl"></div>
</div>
</div>

View File

@ -86,7 +86,17 @@
<div ng-if="journal.praise_count && !journal.has_praise" ng-click="addPraise(journal);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{journal.praise_count}}</span></div>
<div ng-if="journal.has_praise" ng-click="decreasePraise(journal);"><img src="/images/wechat/w_praised.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{journal.praise_count}}</span></div>
</div>
<div ng-click="clickReply(journal.act_id,news)" class="fr mr25 f13 reply-icons multi-hide">
<a><img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">回复</span></a>
</div>
<div class="cl"></div>
<div ng-show="journal.showinput" class="post-input-container multi-input-container ml40 mb10">
<div class="copy-input-container"><textarea class="copy-input"></textarea></div>
<textarea ng-focus="inputfocus(news)" ng-blur="inputblur(news)" input-auto type="text" class="post-reply-input" ng-model="journal.comment" placeholder="{{replytip}}" /></textarea>
<button ng-click="addReply(journal,1);journal.showinput = false;" ng-disabled="journal.disabled" ng-hide="journal.disabled" class="post-reply-submit fr border-radius">提交</button>
<button ng-disabled="journal.disabled" ng-hide="!journal.disabled" class="post-reply-submit bg-grey fr border-radius">提交</button>
<div class="cl"></div>
</div>
</div>
</div>
<div ng-if="has_more">
@ -94,13 +104,13 @@
</div>
</div>
<div id="post_input_1" class="post-input-wrap post-box-shadow" iphone-recognize>
<div ng-show="!news.notshow" id="post_input_1" class="post-input-wrap post-box-shadow" iphone-recognize>
<div class="post-reply-row border-bottom-none">
<div class="post-input-container">
<div class="copy-input-container"><textarea class="copy-input"></textarea></div>
<textarea input-auto type="text" class="post-reply-input" id="postInput1" ng-model="formData.comment" placeholder="输入回复内容~" /></textarea>
<button ng-click="addReply(formData)" ng-disabled="formData.disabled" ng-hide="formData.disabled" class="post-reply-submit fr border-radius">提交</button>
<button ng-disabled="formData.disabled" ng-hide="!formData.disabled" class="post-reply-submit bg-grey fr border-radius">提交</button>
<textarea input-auto type="text" class="post-reply-input" id="postInput1" ng-model="news.comment" placeholder="输入回复内容~" /></textarea>
<button ng-click="addReply(news,0)" ng-disabled="news.disabled" ng-hide="news.disabled" class="post-reply-submit fr border-radius">提交</button>
<button ng-disabled="news.disabled" ng-hide="!news.disabled" class="post-reply-submit bg-grey fr border-radius">提交</button>
<div class="cl"></div>
</div>
</div>

View File

@ -0,0 +1,44 @@
<div class="post-container">
<div loading-spinner></div>
<div class="blue-title">编辑资料</div>
<div class="blank-row mt10">
<div class="upload-input-container img-circle fl ml10 mt4">
<!--<input class="upload-input" accept="image/*" multiple="" type="file">-->
<!--<input class="upload-input" type="file" capture="camera" accept="image/*" load-head>-->
<img ng-src="{{replaceUrl(user.img_url)}}" width="30" class="fl img-circle" style="position:absolute;" />
</div>
<span class="fl ml25">{{user.login}}</span><span ng-click="unbind()" class="fr f13 mr10 c-blue">解除绑定</span><div class="cl"></div></div>
<form name="regFrm" novalidate>
<div class="course-list-row f13 c-grey3 mt10"><span class="fl ml15 c-grey3">姓名</span><input class="new-class-input ml25" ng-model="lastname" placeholder="请输入您的姓名全称" maxlength="30" /></div>
<div class="course-list-row f13 c-grey3 mt10" style="height:auto;">
<div class="mt5" style="line-height:20px">
<span class="ml15 c-grey3">性别</span>
<span class="ml25"></span>
<span class="login-box fr mr10 mt2" ng-click="sex=0" ng-class="['login-box', 'fr', 'mr10', 'img-circle', {'checked': sex==0}]"></span>
</div>
<div class="mb5 mt5" style="line-height:20px;">
<span class="ml15 c-grey3"></span>
<span class="ml55"></span>
<span class="login-box fr mr10 mt2" ng-click="sex=1" ng-class="['login-box', 'fr', 'mr10', 'img-circle', {'checked': sex==1}]"></span>
</div>
</div>
<div class="course-list-row f13 c-grey3 mt10">
<span class="fl ml15 c-grey3">邮箱</span>
<input class="new-class-input ml25" type="email" name="email" ng-model="mail" placeholder="请输入您的邮箱地址" maxlength="60" />
<div ng-show="regFrm.$submitted || regFrm.email.$touched">
<span class="f12 c-red fl ml15" ng-show="regFrm.email.$error.required">电子邮箱地址不能为空</span>
<span class="f12 c-red fl ml15" ng-show="regFrm.email.$error.email">电子邮箱地址不合法</span>
</div>
</div>
<div class="bottom-tab-wrap mt10">
<a ng-click="cancel()" class="weixin-tab c-grey border-top">取消</a>
<a ng-click="confirm(regFrm)" ng-class="[{'btn-disabled':!regFrm.$valid} ]" class="weixin-tab link-blue2 border-top">确定</a>
</div>
</form>
<my-alert message="alertService_1.message" title="alertService_1.title" visible="alertService_1.visible" cb="alertService_1.cb"></my-alert>
<my-alert2 message="alertService_2.message" title="alertService_2.title" visible="alertService_2.visible" cb="alertService_2.cb"></my-alert2>
</div>

View File

@ -75,7 +75,17 @@
<div ng-if="journal.praise_count && !journal.has_praise" ng-click="addPraise(journal);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{journal.praise_count}}</span></div>
<div ng-if="journal.has_praise" ng-click="decreasePraise(journal);"><img src="/images/wechat/w_praised.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{journal.praise_count}}</span></div>
</div>
<div ng-click="clickReply(journal.act_id,homework)" class="fr mr25 f13 reply-icons multi-hide">
<a><img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">回复</span></a>
</div>
<div class="cl"></div>
<div ng-show="journal.showinput" class="post-input-container multi-input-container ml40 mb10">
<div class="copy-input-container"><textarea class="copy-input"></textarea></div>
<textarea ng-focus="inputfocus(homework)" ng-blur="inputblur(homework)" input-auto type="text" class="post-reply-input" ng-model="journal.comment" placeholder="{{replytip}}" /></textarea>
<button ng-click="addReply(journal,1);journal.showinput = false;" ng-disabled="journal.disabled" ng-hide="journal.disabled" class="post-reply-submit fr border-radius">提交</button>
<button ng-disabled="journal.disabled" ng-hide="!journal.disabled" class="post-reply-submit bg-grey fr border-radius">提交</button>
<div class="cl"></div>
</div>
</div>
</div>
<div ng-if="has_more">
@ -83,13 +93,13 @@
</div>
</div>
<div id="post_input_1" class="post-input-wrap post-box-shadow" iphone-recognize>
<div ng-show="!homework.notshow" id="post_input_1" class="post-input-wrap post-box-shadow" iphone-recognize>
<div class="post-reply-row border-bottom-none">
<div class="post-input-container">
<div class="copy-input-container"><textarea class="copy-input"></textarea></div>
<textarea input-auto type="text" class="post-reply-input" id="postInput1" ng-model="formData.comment" placeholder="{{replytip}}" /></textarea>
<button ng-click="addReply(formData)" ng-disabled="formData.disabled" ng-hide="formData.disabled" class="post-reply-submit fr border-radius">提交</button>
<button ng-disabled="formData.disabled" ng-hide="!formData.disabled" class="post-reply-submit bg-grey fr border-radius">提交</button>
<textarea input-auto type="text" class="post-reply-input" id="postInput1" ng-model="homework.comment" placeholder="{{replytip}}" /></textarea>
<button ng-click="addReply(homework,0)" ng-disabled="homework.disabled" ng-hide="homework.disabled" class="post-reply-submit fr border-radius">提交</button>
<button ng-disabled="homework.disabled" ng-hide="!homework.disabled" class="post-reply-submit bg-grey fr border-radius">提交</button>
<div class="cl"></div>
</div>
</div>

View File

@ -92,7 +92,17 @@
<div ng-if="journal.praise_count && !journal.has_praise" ng-click="addPraise(journal);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{journal.praise_count}}</span></div>
<div ng-if="journal.has_praise" ng-click="decreasePraise(journal);"><img src="/images/wechat/w_praised.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{journal.praise_count}}</span></div>
</div>
<div ng-click="clickReply(journal.act_id,issue)" class="fr mr25 f13 reply-icons multi-hide">
<a><img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">回复</span></a>
</div>
<div class="cl"></div>
<div ng-show="journal.showinput" class="post-input-container multi-input-container ml40 mb10">
<div class="copy-input-container"><textarea class="copy-input"></textarea></div>
<textarea ng-focus="inputfocus(issue)" ng-blur="inputblur(issue)" input-auto type="text" class="post-reply-input" ng-model="journal.comment" placeholder="{{replytip}}" /></textarea>
<button ng-click="addReply(journal,1);journal.showinput = false;" ng-disabled="journal.disabled" ng-hide="journal.disabled" class="post-reply-submit fr border-radius">提交</button>
<button ng-disabled="journal.disabled" ng-hide="!journal.disabled" class="post-reply-submit bg-grey fr border-radius">提交</button>
<div class="cl"></div>
</div>
</div>
</div>
<div ng-if="has_more">
@ -100,13 +110,13 @@
</div>
</div>
<div id="post_input_1" class="post-input-wrap post-box-shadow" iphone-recognize>
<div ng-show="!issue.notshow" id="post_input_1" class="post-input-wrap post-box-shadow" iphone-recognize>
<div class="post-reply-row border-bottom-none">
<div class="post-input-container">
<div class="copy-input-container"><textarea class="copy-input"></textarea></div>
<textarea input-auto type="text" class="post-reply-input" id="postInput1" ng-model="formData.comment" placeholder="输入回复内容~" /></textarea>
<button ng-click="addReply(formData)" ng-disabled="formData.disabled" ng-hide="formData.disabled" class="post-reply-submit fr border-radius">提交</button>
<button ng-disabled="formData.disabled" ng-hide="!formData.disabled" class="post-reply-submit bg-grey fr border-radius">提交</button>
<textarea input-auto type="text" class="post-reply-input" id="postInput1" ng-model="issue.comment" placeholder="输入回复内容~" /></textarea>
<button ng-click="addReply(issue,0)" ng-disabled="issue.disabled" ng-hide="issue.disabled" class="post-reply-submit fr border-radius">提交</button>
<button ng-disabled="issue.disabled" ng-hide="!issue.disabled" class="post-reply-submit bg-grey fr border-radius">提交</button>
<div class="cl"></div>
</div>
</div>

View File

@ -70,7 +70,17 @@
<div ng-if="journal.praise_count && !journal.has_praise" ng-click="addPraise(journal);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{journal.praise_count}}</span></div>
<div ng-if="journal.has_praise" ng-click="decreasePraise(journal);"><img src="/images/wechat/w_praised.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{journal.praise_count}}</span></div>
</div>
<div ng-click="clickReply(journal.act_id,message)" class="fr mr25 f13 reply-icons multi-hide">
<a><img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">回复</span></a>
</div>
<div class="cl"></div>
<div ng-show="journal.showinput" class="post-input-container multi-input-container ml40 mb10">
<div class="copy-input-container"><textarea class="copy-input"></textarea></div>
<textarea ng-focus="inputfocus(message)" ng-blur="inputblur(message)" input-auto type="text" class="post-reply-input" ng-model="journal.comment" placeholder="{{replytip}}" /></textarea>
<button ng-click="addReply(journal,1);journal.showinput = false;" ng-disabled="journal.disabled" ng-hide="journal.disabled" class="post-reply-submit fr border-radius">提交</button>
<button ng-disabled="journal.disabled" ng-hide="!journal.disabled" class="post-reply-submit bg-grey fr border-radius">提交</button>
<div class="cl"></div>
</div>
</div>
</div>
<div ng-if="has_more">
@ -78,13 +88,13 @@
</div>
</div>
<div id="post_input_1" class="post-input-wrap post-box-shadow" iphone-recognize>
<div ng-show="!message.notshow" id="post_input_1" class="post-input-wrap post-box-shadow" iphone-recognize>
<div class="post-reply-row border-bottom-none">
<div class="post-input-container">
<div class="copy-input-container"><textarea class="copy-input"></textarea></div>
<textarea input-auto type="text" class="post-reply-input" id="postInput1" ng-model="formData.comment" placeholder="输入回复内容~" /></textarea>
<button ng-click="addReply(formData)" ng-disabled="formData.disabled" ng-hide="formData.disabled" class="post-reply-submit fr border-radius">提交</button>
<button ng-disabled="formData.disabled" ng-hide="!formData.disabled" class="post-reply-submit bg-grey fr border-radius">提交</button>
<textarea input-auto type="text" class="post-reply-input" id="postInput1" ng-model="message.comment" placeholder="输入回复内容~" /></textarea>
<button ng-click="addReply(message,0)" ng-disabled="message.disabled" ng-hide="message.disabled" class="post-reply-submit fr border-radius">提交</button>
<button ng-disabled="message.disabled" ng-hide="!message.disabled" class="post-reply-submit bg-grey fr border-radius">提交</button>
<div class="cl"></div>
</div>
</div>

View File

@ -71,20 +71,30 @@
<div ng-if="journal.praise_count && !journal.has_praise" ng-click="addPraise(journal);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{journal.praise_count}}</span></div>
<div ng-if="journal.has_praise" ng-click="decreasePraise(journal);"><img src="/images/wechat/w_praised.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>{{journal.praise_count}}</span></div>
</div>
<div ng-click="clickReply(journal.act_id,discussion)" class="fr mr25 f13 reply-icons multi-hide">
<a><img src="/images/wechat/w_reply.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span style="vertical-align:top;">回复</span></a>
</div>
<div class="cl"></div>
<div ng-show="journal.showinput" class="post-input-container multi-input-container ml40 mb10">
<div class="copy-input-container"><textarea class="copy-input"></textarea></div>
<textarea ng-focus="inputfocus(discussion)" ng-blur="inputblur(discussion)" input-auto type="text" class="post-reply-input" ng-model="journal.comment" placeholder="{{replytip}}" /></textarea>
<button ng-click="addReply(journal,1);journal.showinput = false;" ng-disabled="journal.disabled" ng-hide="journal.disabled" class="post-reply-submit fr border-radius">提交</button>
<button ng-disabled="journal.disabled" ng-hide="!journal.disabled" class="post-reply-submit bg-grey fr border-radius">提交</button>
<div class="cl"></div>
</div>
</div>
</div>
<div ng-if="has_more">
<div id="more_reply" class="more-events mt10" ng-click="showMoreReply(0,discussion);">更多</div>
</div>
</div>
<div ng-if="!discussion.locked" id="post_input_1" class="post-input-wrap post-box-shadow" iphone-recognize>
<div ng-show="!discussion.notshow" ng-if="!discussion.locked" id="post_input_1" class="post-input-wrap post-box-shadow" iphone-recognize>
<div class="post-reply-row border-bottom-none">
<div class="post-input-container">
<div class="copy-input-container"><textarea class="copy-input"></textarea></div>
<textarea input-auto type="text" class="post-reply-input" id="postInput1" ng-model="formData.comment" placeholder="输入回复内容~" /></textarea>
<button ng-click="addReply(formData)" ng-disabled="formData.disabled" ng-hide="formData.disabled" class="post-reply-submit fr border-radius">提交</button>
<button ng-disabled="formData.disabled" ng-hide="!formData.disabled" class="post-reply-submit bg-grey fr border-radius">提交</button>
<textarea input-auto type="text" class="post-reply-input" id="postInput1" ng-model="discussion.comment" placeholder="输入回复内容~" /></textarea>
<button ng-click="addReply(discussion,0)" ng-disabled="discussion.disabled" ng-hide="discussion.disabled" class="post-reply-submit fr border-radius">提交</button>
<button ng-disabled="discussion.disabled" ng-hide="!discussion.disabled" class="post-reply-submit bg-grey fr border-radius">提交</button>
<div class="cl"></div>
</div>
</div>

View File

@ -550,8 +550,8 @@ function observeSearchfield(fieldId, targetId, url) {
dataType: 'jsonp',
data: {q: $this.val()},
success: function(data){ if(targetId) $('#'+targetId).html(data); },
beforeSend: function(){ $this.addClass('ajax-loading'); },
complete: function(){ $this.removeClass('ajax-loading'); }
beforeSend: function(){ $this.addClass('ajax-loading'); }, // 添加成员加载完成前,显示载入中
complete: function(){ $this.removeClass('ajax-loading'); } // 完成后,移除
});
}
};

View File

@ -1,4 +1,5 @@
//<2F><><EFBFBD><EFBFBD><EFBFBD>֯<EFBFBD><D6AF>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD><E1BDBB><EFBFBD><EFBFBD>
// 组织:新增成员
function submit_add_org_members(){
$("#org_member_add_form").submit();
}

View File

@ -0,0 +1,92 @@
app.controller('EditUserInfoController', ['$scope', 'config','$http', 'auth','$location','$routeParams','alertService','rms','common','$timeout','wx', function($scope, config, $http, auth, $location, $routeParams,alertService,rms,common,$timeout,wx){
// common.checkLogin();
$scope.replaceUrl = function(url){
return url;
};
var vm = $scope;
//单弹框
vm.alertService_1 = alertService.create();
//双弹框
vm.alertService_2 = alertService.create();
vm.getuserinfo = function(){
$http.get(config.apiUrl + 'users/get_userinfo?token='+auth.token()).then(
function(response) {
console.log(response.data);
vm.user = response.data.data;
vm.lastname = vm.user.lastname;
vm.mail = vm.user.mail;
vm.sex = vm.user.gender;
}
);
};
vm.getuserinfo();
vm.unbind = function(){
vm.alertService_2.showMessage('提示', '是否确认解除绑定', function() {
$http.post(config.apiUrl + "users/user_unbind",
{token: auth.token()}
).then(function (response) {
if (response.data.status == 0) {
vm.alertService_1.showMessage('提示', '解除绑定成功', function () {
wx.closeWindow();
});
}
else {
vm.alertService_1.showMessage('提示', response.data.message);
}
});
});
};
vm.cancel = function(){
vm.alertService_2.showMessage('提示', '是否确认取消', function() {
wx.closeWindow();
});
};
vm.confirm = function(frm){
frm.$setSubmitted();
console.log(frm);
if (!frm.$valid) {
console.log(frm.$error);
return;
}
if(vm.lastname == ""){
vm.alertService_1.showMessage('提示', '姓名不能为空');
return;
}
if(vm.mail == ""){
vm.alertService_1.showMessage('提示', '邮箱不能为空');
return;
}
// if(!(/\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i.test(vm.mail))){
// vm.alertService_1.showMessage('提示', '邮箱不合法');
// return;
// }
$http.post(config.apiUrl + "users/edit_userinfo",
{token: auth.token(),lastname: vm.lastname, sex: vm.sex, mail: vm.mail}
).then(function(response){
if(response.data.status == 0)
{
vm.alertService_1.showMessage('提示', '修改成功',function(){
wx.closeWindow();
});
}
else{
vm.alertService_1.showMessage('提示', response.data.message);
}
});
};
}]);

View File

@ -1,19 +1,40 @@
app.directive('inputAuto',function(){
return{
restrict: 'A',
scope: {},
link: function(scope, element){
var copyContainer = element.parent().children().children().eq(0);
var sendButton = element.next();
element.on('input',function(){
//console.log(sendButton);
copyContainer.html(element[0].value);
var textHeight = copyContainer[0].scrollHeight-10;
element.css('height', textHeight + 'px');
});
sendButton.on('click',function(){
element.css('height','18px');
});
}
}
});
//app.directive('inputAuto',function(){
// return{
// restrict: 'A',
// scope: {},
// link: function(scope, element){
// var copyContainer = element.parent().children().children().eq(0);
// var sendButton = element.next();
// element.on('input',function(){
// //console.log(sendButton);
// copyContainer.html(element[0].value);
// var textHeight = copyContainer[0].scrollHeight-10;
// element.css('height', textHeight + 'px');
// });
// sendButton.on('click',function(){
// element.css('height','18px');
// });
// }
// }
//});
app.directive('inputAuto',["$timeout",function(timer){
return{
restrict: 'A',
scope: {},
link: function(scope, element){
timer(function(){
$(".post-reply-input").bind("input",function(){
var copyInput = $(this).prev().children();
var sendButton = $(this).next();
copyInput.html($(this).val());
var textHeight = copyInput[0].scrollHeight-10;
$(this).css("height",textHeight + "px");
sendButton.click(function(){
$(this).prev().css("height","18px");
})
});
});
}
}
}]);

View File

@ -0,0 +1,35 @@
app.directive('loadHead',['$http','config','auth','$location','alertService',function($http,config,auth,$location,alertService){
return{
restrict: 'A',
scope: {},
link: function (scope, element, attrs) {
element.bind('change', function(){
var file = event.target.files[0];
//判断类型是不是图片
if (!/image\/\w+/.test(file.type)) {
alert("非图片");
return;
}
var reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = function (e) {
// alert(this.result);//base64
$http.post(config.apiUrl + "users/upload_head",
{token: auth.token(),imgdata:this.result}
).then(function (response) {
if(response.data.status == 0){
scope.$parent.alertService_1.showMessage('提示',"上传成功",function(){
scope.$parent.getuserinfo();
});
}
else{
scope.$parent.alertService_1.showMessage('提示',response.data.message);
}
});
}
});
}
}
}]);

View File

@ -0,0 +1,42 @@
/**
* Created by ttang on 2016/9/5.
*/
app.directive('multiReply',["$timeout",function(timer){
return{
restrict: 'A',
scope: {},
link: function(scope, element){
timer(function(){
$(".reply-icons").each(function(){
$(this).toggle(function(){
$(this).next().next().removeClass("undis");
$(this).next().next().focus();
},function(){
$(this).next().next().addClass("undis");
});
});
// $(".reply-icons").live("click",function(){
// if($(this).hasClass("multi-hide")){
// $(".multi-input-container").addClass("undis");
// $(".reply-icons").addClass("multi-hide");
// $(this).next().next().removeClass("undis");
// $(this).next().next().focus();
// $(this).removeClass("multi-hide");
// $(".post-reply-input").val("");
// }
// else{
// $(this).addClass("multi-hide");
// $(".post-input-container").addClass("undis");
// $(".post-reply-input").val("");
// $("#post_input_1, #post_input_1 .post-input-container").show();
// }
// });
// $(".post-reply-submit,#more_reply").click(function(){
// $(".reply-icons").addClass("multi-hide");
// $(".post-input-container").addClass("undis");
// $("#post_input_1, #post_input_1 .post-input-container").show();
// });
})
}
}
}]);

View File

@ -1,17 +0,0 @@
/**
* Created by ttang on 2016/8/31.
*/
app.directive('submitStart',["$timeout",function(timer){
return{
restrict: 'A',
scope: {},
link: function(scope, element){
timer(function(){
$("#manageDelete,.login-box").click(function(){
element.removeClass("bg-grey c-white");
element.addClass("link-blue2");
});
})
}
}
}]);

View File

@ -94,7 +94,7 @@ app.factory('rms', function(){
});
app.factory('common', ['$http', 'auth', '$routeParams','rms','config','wx','$location', function($http, auth, $routeParams,rms,config,wx,$location){
var addCommonReply = function(id, type, data,args, cb){
var addCommonReply = function(id, type, data,args,reply_type, cb){
//先判断有没有绑定
// $http.post(
// '/wechat/is_bind',
@ -111,12 +111,12 @@ app.factory('common', ['$http', 'auth', '$routeParams','rms','config','wx','$loc
}
var temp = data.comment.replace(/\n/g,'<br/>');
temp = temp.replace(/^\:[a-z0-9_]+\:$/g, "[表情]");
var userInfo = {
type: type,
content: temp,
token: auth.token()
token: auth.token(),
reply_type:reply_type
};
//回复按钮禁用
data.disabled = true;
@ -146,24 +146,26 @@ app.factory('common', ['$http', 'auth', '$routeParams','rms','config','wx','$loc
cb(response.data.subscribe);
}
var act_id = response.data.act_id;
//保证内外回复数一致
activities = rms.get("activities") || [];
course_activities = rms.get("course_activities") || [];
project_activities = rms.get("project_activities") || [];
for(var i in activities){
if(activities[i].act_id == id){
if(activities[i].act_id == act_id){
activities[i].reply_count += 1;
break;
}
}
for(var i in course_activities){
if(course_activities[i].act_id == id){
if(course_activities[i].act_id == act_id){
course_activities[i].reply_count += 1;
break;
}
}
for(var i in project_activities){
if(project_activities[i].act_id == id){
if(project_activities[i].act_id == act_id){
project_activities[i].reply_count += 1;
break;
}
@ -222,7 +224,7 @@ app.factory('common', ['$http', 'auth', '$routeParams','rms','config','wx','$loc
var init = function(args){
args.scope.replytip = "输入回复内容~";
args.scope.formData = {comment: ''};
// args.scope.formData = {comment: ''};
var loadData = function(id,replytype,page){
loadCommonData(id, args.type,replytype,page).then(function successCallback(response) {
console.log(response.data);
@ -304,10 +306,10 @@ app.factory('common', ['$http', 'auth', '$routeParams','rms','config','wx','$loc
};
loadData(args.id,0,0);
args.scope.addReply = function(data){
args.scope.addReply = function(data,reply_type){
console.log(data.comment);
addCommonReply(args.id, args.replyType, data,args, function(subscribe){
args.scope.formData = {comment: ''};
addCommonReply(data.act_id, args.replyType, data,args,reply_type, function(subscribe){
// args.scope.formData = {comment: ''};
if(subscribe == 0){
$location.path("/login_tip");
return;
@ -322,6 +324,27 @@ app.factory('common', ['$http', 'auth', '$routeParams','rms','config','wx','$loc
});
};
args.scope.inputfocus = function(data){
data.notshow = true;
};
args.scope.inputblur = function(data){
data.notshow = false;
};
args.scope.clickReply = function(act_id,data) {
allchidren = data.all_children;
for(var i in allchidren){
if(allchidren[i].act_id != act_id ){
allchidren[i].showinput = false;
}
else{
allchidren[i].showinput = !allchidren[i].showinput;
data.notshow = allchidren[i].showinput;
}
}
};
// 动态详情界面点赞与动态界面的数据要同步 保证进入详情点赞后出来显示一致
args.scope.addPraise = function(act){
activities = rms.get("activities") || [];

View File

@ -51,6 +51,7 @@ app.config(['$routeProvider',"$httpProvider", "$locationProvider",'config', func
.when('/review_project_member', makeRoute('review_project_member.html', 'ReviewProjectMemberController'))
.when('/project_publishnote', makeRoute('project_publishnote.html', 'ProjectPublishNoteController'))
.when('/login_tip', makeRoute('login_tip.html', 'LoginTipController'))
.when('/edit_userinfo', makeRoute('edit_userinfo.html', 'EditUserInfoController'))
.otherwise({
redirectTo: '/activites'
});

View File

@ -607,4 +607,8 @@ a:hover.sy_btn_blue{ background: #2788d0;}
.is_public_checkbox{margin-left: 15px;margin-right: 10px;}
.author_name{color: #3ca5c6 !important;}
.ke-container-default{max-width: 100%;}
.borderRadius {border-radius:5px;}
.borderRadius {border-radius:5px;}
/*状态提示图标*/
.success-icon {background:url("/images/icons_ziliao.png") 0 -28px no-repeat; padding-left:25px;}
.error-icon {background:url("/images/icons_ziliao.png") 0 -56px no-repeat; padding-left:25px;}

View File

@ -566,9 +566,9 @@ a:hover.sy_btn_orange{
a.sy_class_ltitle{display: block; font-size: 14px; width: 185px; color:#888; }
a:hover.sy_class_ltitle{ color:#333;}
.sy_cir_grey{
font-size:12px;
font-size:11px;
padding: 0 10px;
background: #dbdbdb;
background: #eee;
-webkit-border-radius: 15px;
-moz-border-radius: 15px;
border-radius: 15px;

View File

@ -257,4 +257,9 @@ a.underline {text-decoration:underline;}
/*发布帖子,通知*/
.full-width-wrap {padding:5px 15px; background-color:#fff; border-top:1px solid #ddd; border-bottom:1px solid #ddd;}
.full-width-textarea {width:100%; height:180px; line-height:18px; max-height:180px; border:none; resize:none; font-size:13px; color:#555; overflow-y:auto;}
.full-width-textarea {width:100%; height:180px; line-height:18px; max-height:180px; border:none; resize:none; font-size:13px; color:#555; overflow-y:auto;}
/*资料修改*/
.blank-row {width:100%; height:38px; line-height:38px; vertical-align:middle;}
.upload-input-container {width:30px; height:30px; border:1px solid #ddd; position:relative;}
.upload-input {width:30px; height:30px; position:absolute; z-index:1; opacity:0;}