diff --git a/app/api/mobile/apis/courses.rb b/app/api/mobile/apis/courses.rb
index bfd559402..cbf8f4986 100644
--- a/app/api/mobile/apis/courses.rb
+++ b/app/api/mobile/apis/courses.rb
@@ -540,6 +540,7 @@ module Mobile
present :status, 0
else
present :status, -1
+ present :message, "该用户已不在班级中"
end
end
@@ -568,17 +569,26 @@ module Mobile
roles_id << 10
end
-
c = Course.find("#{params[:id]}")
- #7教辅 9教师 10学生
- if c.tea_id == params[:user_id] || c.tea_id != current_user.id || roles_id.length <= 0
- present :status, -1
- else
+ my_member = c.member_principals.where("users.id=#{current_user.id}").first
+ rolesids = []
+ my_member.roles.each do |role|
+ rolesids << role.id
+ end
+
+ #7教辅 9教师 10学生
+ if c.tea_id == params[:user_id] || roles_id.length <= 0
+ present :status, -1
+ present :message,"修改失败"
+ elsif rolesids.include?(3) || rolesids.include?(7) || rolesids.include?(9)
cs = CoursesService.new
status = cs.modify_user_course_role params,roles_id
present :status, status
+ else
+ present :status, -1
+ present :message,"修改失败"
end
end
@@ -661,6 +671,85 @@ module Mobile
end
+ desc "删除班级成员"
+ params do
+ requires :id, type: Integer
+ requires :token, type: String
+ requires :user_id, type: Integer
+ end
+ post ':id/deletemember' do
+ authenticate!
+
+ status = -1
+
+ if(current_user.id != params[:user_id].to_i)
+ #权限
+ c = Course.find("#{params[:id]}")
+ if c.tea_id != params[:user_id].to_i
+
+ my_member = c.member_principals.where("users.id=#{current_user.id}").first
+
+ roles_ids = []
+ my_member.roles.each do |role|
+ roles_ids << role.id
+ end
+
+ if my_member && (roles_ids.include?(3) || roles_ids.include?(7) || roles_ids.include?(9) )
+ #删除该成员
+ cs = CoursesService.new
+ status = cs.delete_course_member(c,params[:user_id].to_i,current_user)
+ else
+ status = -2
+ end
+ else
+ status = -3
+ end
+ else
+ status = -4
+ end
+
+ out = {status: status}
+ message = case status
+ when 0; "删除成功"
+ when -1; "您还未登录"
+ when -2; "对不起您没有权限"
+ when -3; "不能删除班级管理员"
+ when -4; "不能删除自己"
+ when 1; "该用户不在该班级中"
+ else; "未知错误,请稍后再试"
+ end
+ out.merge(message: message)
+ end
+
+ desc "退出班级"
+ params do
+ requires :id, type: Integer
+ requires :token, type: String
+ end
+ post ':id/quit' do
+ authenticate!
+
+ #管理员不能退
+ cs = CoursesService.new
+ c = Course.find("#{params[:id]}")
+
+ user = current_user
+
+ if c.tea_id != user.id
+ status = cs.exit_course({:object_id => params[:id]}, user)
+ else
+ status = 3
+ end
+ out = {status: status}
+ message = case status
+ when 0; "退出班级成功"
+ when 1; "您不是该班级成员"
+ when 2; "您还未登录"
+ when 3; "管理员不能退出班级"
+ else; "未知错误,请稍后再试"
+ end
+ out.merge(message: message)
+ end
end
end
end
diff --git a/app/api/mobile/apis/projects.rb b/app/api/mobile/apis/projects.rb
index 2202fbd13..ecd850fd8 100644
--- a/app/api/mobile/apis/projects.rb
+++ b/app/api/mobile/apis/projects.rb
@@ -127,6 +127,7 @@ module Mobile
present :status, 0
else
present :status, -1
+ present :message, "该用户已不在项目中"
end
end
@@ -268,6 +269,81 @@ module Mobile
present :status, 0
end
+
+ desc "删除项目成员"
+ params do
+ requires :id, type: Integer
+ requires :token, type: String
+ requires :user_id, type: Integer
+ end
+ post ':id/deletemember' do
+ authenticate!
+
+ status = -1
+
+ if(current_user.id != params[:user_id].to_i)
+ #权限
+ project = Project.find("#{params[:id]}")
+ if project.user_id != params[:user_id].to_i
+
+ my_member = project.member_principals.where("users.id=#{current_user.id}").first
+
+ roles_ids = []
+ my_member.roles.each do |role|
+ roles_ids << role.id
+ end
+
+ if my_member && roles_ids.include?(3)
+ #删除该成员
+ ps = ProjectsService.new
+ status = ps.project_delete_member(project,params[:user_id].to_i,current_user)
+ else
+ status = -2
+ end
+ else
+ status = -3
+ end
+ else
+ status = -4
+ end
+
+ out = {status: status}
+ message = case status
+ when 0; "删除成功"
+ when 1; "该用户不在该项目中"
+ when -1; "您还未登录"
+ when -2; "您没有权限"
+ when -3; "不能删除项目创建者"
+ when -4; "不能删除自己"
+ else; "未知错误,请稍后再试"
+ end
+ out.merge(message: message)
+ end
+
+ desc "退出项目"
+ params do
+ requires :id, type: Integer
+ requires :token, type: String
+ end
+ post ':id/quit' do
+ authenticate!
+
+ project = Project.find("#{params[:id]}")
+
+ ps = ProjectsService.new
+ status = ps.exit_project(project,current_user)
+
+ out = {status: status}
+ message = case status
+ when 0; "退出项目成功"
+ when -3; "您不是该项目成员"
+ when -1; "您还未登录"
+ when -2; "项目创建者不能退出项目"
+ else; "未知错误,请稍后再试"
+ end
+ out.merge(message: message)
+ end
+
end
end
end
diff --git a/app/api/mobile/entities/activity.rb b/app/api/mobile/entities/activity.rb
index a56deaad3..9deeec58e 100644
--- a/app/api/mobile/entities/activity.rb
+++ b/app/api/mobile/entities/activity.rb
@@ -73,6 +73,12 @@ module Mobile
elsif ac.container_type == "Blog"
"发表博客"
end
+ when :course_project_id
+ if ac.container_type == "Course"
+ ac.container_id
+ elsif ac.container_type == "Project"
+ ac.container_id
+ end
when :activity_type_name
if ac.container_type == "Course"
case ac.act_type
@@ -137,6 +143,7 @@ module Mobile
act_expose :subject #标题
act_expose :description #描述
act_expose :latest_update #最新更新时间
+ act_expose :course_project_id #课程/项目ID
act_expose :course_project_name #课程/项目名字
act_expose :activity_type_name #课程问答区/项目缺陷等
expose :has_praise , if: lambda { |instance, options| options[:user] } do |instance, options|
diff --git a/app/api/mobile/entities/issue.rb b/app/api/mobile/entities/issue.rb
index e3dbb5023..a46e10da5 100644
--- a/app/api/mobile/entities/issue.rb
+++ b/app/api/mobile/entities/issue.rb
@@ -52,6 +52,10 @@ module Mobile
time_from_now issue.created_on
when :act_id
issue.id
+ when :act_type
+ 'Journal'
+ when :praise_count
+ get_activity_praise_num(issue)
end
end
end
diff --git a/app/api/mobile/entities/news.rb b/app/api/mobile/entities/news.rb
index a64081d8a..d8c4dcab3 100644
--- a/app/api/mobile/entities/news.rb
+++ b/app/api/mobile/entities/news.rb
@@ -36,6 +36,10 @@ module Mobile
time_from_now f.created_on
when :act_id
f.id
+ when :praise_count
+ get_activity_praise_num(f)
+ when :act_type
+ 'Comment'
end
elsif f.is_a?(Hash) && !f.key?(field)
diff --git a/app/api/mobile/entities/project.rb b/app/api/mobile/entities/project.rb
index 8da151b42..eef7a9c92 100644
--- a/app/api/mobile/entities/project.rb
+++ b/app/api/mobile/entities/project.rb
@@ -3,6 +3,7 @@ module Mobile
class Project < Grape::Entity
expose :name
expose :id
+ expose :is_public
expose :user_id
expose :invite_code
expose :qrcode
diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb
index 7ec532d79..5d1345f24 100644
--- a/app/controllers/attachments_controller.rb
+++ b/app/controllers/attachments_controller.rb
@@ -1,3 +1,4 @@
+#encoding: utf-8
# Redmine - project management software
# Copyright (C) 2006-2013 Jean-Philippe Lang
#
@@ -203,16 +204,51 @@ class AttachmentsController < ApplicationController
@attachment.save
@newfiledense = filedense
end
- if @project
-
- elsif @course
-
+ if @attachment.container_type == "Project" || @attachment.container_type == "Course"
+ tip_attachment_update
end
+
respond_to do |format|
format.js
end
end
+ def tip_attachment_update
+ if params[:course_id]
+ @tip_all_attachments = Attachment.where(:container_type => "Course", :container_id => params[:course_id])
+ @tip_all_public_attachments = Attachment.where(:container_type => "Course", :container_id => params[:course_id], :is_public => 1)
+ @tip_all_private_attachments = Attachment.where(:container_type => "Course", :container_id => params[:course_id], :is_public => 0)
+ @course = Course.find(params[:course_id])
+ elsif params[:project_id]
+ @tip_all_attachments = Attachment.where(:container_type => "Project", :container_id => params[:project_id])
+ @tip_all_public_attachments = Attachment.where(:container_type => "Project", :container_id => params[:project_id], :is_public => 1)
+ @tip_all_private_attachments = Attachment.where(:container_type => "Project", :container_id => params[:project_id], :is_public => 0)
+ @project = Project.find(params[:project_id])
+ end
+ @tag_name = params[:tag_name]
+ @other = params[:other]
+ unless @tag_name.blank?
+ if @other
+ if @project
+ @tip_all_attachments = @tip_all_attachments.select{|attachment| !attachment.tag_list.include?('软件版本') && !attachment.tag_list.include?('文档') && !attachment.tag_list.include?('代码') && !attachment.tag_list.include?('媒体') && !attachment.tag_list.include?('论文') }
+ @tip_all_public_attachments = @tip_all_public_attachments.select{|attachment| !attachment.tag_list.include?('软件版本') && !attachment.tag_list.include?('文档') && !attachment.tag_list.include?('代码') && !attachment.tag_list.include?('媒体') && !attachment.tag_list.include?('论文') }
+ @tip_all_private_attachments = @tip_all_private_attachments.select{|attachment| !attachment.tag_list.include?('软件版本') && !attachment.tag_list.include?('文档') && !attachment.tag_list.include?('代码') && !attachment.tag_list.include?('媒体') && !attachment.tag_list.include?('论文') }
+ elsif @course
+ @tip_all_attachments = @tip_all_attachments.select{|attachment| !attachment.tag_list.include?('课件') && !attachment.tag_list.include?('软件') && !attachment.tag_list.include?('媒体') && !attachment.tag_list.include?('代码') && !attachment.tag_list.include?('论文') }
+ @tip_all_public_attachments = @tip_all_public_attachments.select{|attachment| !attachment.tag_list.include?('课件') && !attachment.tag_list.include?('软件') && !attachment.tag_list.include?('媒体') && !attachment.tag_list.include?('代码') && !attachment.tag_list.include?('论文') }
+ @tip_all_private_attachments = @tip_all_private_attachments.select{|attachment| !attachment.tag_list.include?('课件') && !attachment.tag_list.include?('软件') && !attachment.tag_list.include?('媒体') && !attachment.tag_list.include?('代码') && !attachment.tag_list.include?('论文') }
+ end
+ else
+ @tip_all_attachments = @tip_all_attachments.select{|attachment| attachment.tag_list.include?(@tag_name)}
+ @tip_all_public_attachments = @tip_all_public_attachments.select{|attachment| attachment.tag_list.include?(@tag_name)}
+ @tip_all_private_attachments = @tip_all_private_attachments.select{|attachment| attachment.tag_list.include?(@tag_name)}
+ end
+ end
+ @tip_all_attachments = @tip_all_attachments.count
+ @tip_all_public_attachments = @tip_all_public_attachments.count
+ @tip_all_private_attachments = @tip_all_private_attachments.count
+ end
+
def thumbnail
if @attachment.thumbnailable? && thumbnail = @attachment.thumbnail(:size => params[:size])
if stale?(:etag => thumbnail)
@@ -281,6 +317,7 @@ class AttachmentsController < ApplicationController
@attachment.delete
@flag = true
end
+ # tip_attachment_update
respond_to do |format|
format.js
diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb
index 2614b6271..e542d1e1d 100644
--- a/app/controllers/courses_controller.rb
+++ b/app/controllers/courses_controller.rb
@@ -331,7 +331,7 @@ class CoursesController < ApplicationController
@all_members = searchTeacherAndAssistant(@course)
@members = @all_members
when '2'
- if @course.open_student == 1 || User.current.member_of_course?(@course)
+ if @course.open_student == 1 || User.current.member_of_course?(@course) || User.current.admin?
@subPage_title = l :label_student_list
page = params[:page].nil? ? 0 : (params['page'].to_i - 1)
@all_members = student_homework_score(0,page, 10,@score_sort_by,@sort_type)
diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb
index 988768414..7318a4dc2 100644
--- a/app/controllers/files_controller.rb
+++ b/app/controllers/files_controller.rb
@@ -86,19 +86,20 @@ class FilesController < ApplicationController
else
@result = find_course_attache q,@course,sort
@result = visable_attachemnts @result
- # @searched_attach = paginateHelper @result,10
+ # @searched_attach = paginateHelper @result,10
@tag_list = get_course_tag_list @course
end
@all_attachments = @result
+ get_attachment_for_tip(@all_attachments)
@limit = 10
@feedback_count = @all_attachments.count
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
@offset ||= @feedback_pages.offset
#@curse_attachments_all = @all_attachments[@offset, @limit]
@obj_attachments = paginateHelper @all_attachments,10
- #rescue Exception => e
- # #render 'stores'
- # redirect_to search_course_files_url
+ #rescue Exception => e
+ # #render 'stores'
+ # redirect_to search_course_files_url
end
end
@@ -164,6 +165,7 @@ class FilesController < ApplicationController
end
@all_attachments = @project_attachment_result
+ get_attachment_for_tip(@all_attachments)
@limit = 10
@feedback_count = @all_attachments.count
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
@@ -176,52 +178,52 @@ class FilesController < ApplicationController
end
end
- def search_files_in_subfield
- sort = ""
- @sort = ""
- @order = ""
- @is_remote = true
- @q = params[:name].strip
- if params[:sort]
- order_by = params[:sort].split(":")
- @sort = order_by[0]
- if order_by.count > 1
- @order = order_by[1]
- end
- sort = "#{@sort} #{@order}"
+ def search_files_in_subfield
+ sort = ""
+ @sort = ""
+ @order = ""
+ @is_remote = true
+ @q = params[:name].strip
+ if params[:sort]
+ order_by = params[:sort].split(":")
+ @sort = order_by[0]
+ if order_by.count > 1
+ @order = order_by[1]
end
- # show_attachments [@course]
- begin
- q = "%#{params[:name].strip}%"
- #(redirect_to stores_url, :notice => l(:label_sumbit_empty);return) if params[:name].blank?
- if params[:insite]
- if q == "%%"
- @result = []
- @searched_attach = paginateHelper @result,10
- else
- @result = find_public_attache q,sort
- @result = visable_attachemnts_insite @result,@org_subfield
- @searched_attach = paginateHelper @result,10
- end
- else
- @result = find_org_subfield_attache q,@org_subfield,sort
- @result = visable_attachemnts @result
- @searched_attach = paginateHelper @result,10
- @tag_list = attachment_tag_list @result
- end
- #rescue Exception => e
- # #render 'stores'
- # redirect_to search_course_files_url
- end
- @page = params[:page] || 1
+ sort = "#{@sort} #{@order}"
end
+ # show_attachments [@course]
+ begin
+ q = "%#{params[:name].strip}%"
+ #(redirect_to stores_url, :notice => l(:label_sumbit_empty);return) if params[:name].blank?
+ if params[:insite]
+ if q == "%%"
+ @result = []
+ @searched_attach = paginateHelper @result,10
+ else
+ @result = find_public_attache q,sort
+ @result = visable_attachemnts_insite @result,@org_subfield
+ @searched_attach = paginateHelper @result,10
+ end
+ else
+ @result = find_org_subfield_attache q,@org_subfield,sort
+ @result = visable_attachemnts @result
+ @searched_attach = paginateHelper @result,10
+ @tag_list = attachment_tag_list @result
+ end
+ #rescue Exception => e
+ # #render 'stores'
+ # redirect_to search_course_files_url
+ end
+ @page = params[:page] || 1
+ end
def find_course_attache keywords,course,sort = ""
if sort == ""
sort = "created_on DESC"
end
if keywords != "%%"
- resultSet = Attachment.where("attachments.container_type = 'Course' And attachments.container_id = '#{course.id}' AND filename LIKE :like ", like: "%#{keywords}%").reorder(sort)
+ resultSet = Attachment.where("attachments.container_type = 'Course' And attachments.container_id = '#{course.id}' AND filename LIKE :like ", like: "%#{keywords}%").reorder(sort)
else
resultSet = Attachment.where("attachments.container_type = 'Course' And attachments.container_id = '#{course.id}' "). reorder(sort)
end
@@ -250,7 +252,7 @@ class FilesController < ApplicationController
else
resultSet = Attachment.where("attachments.container_type = 'Project' And attachments.container_id = '#{project.id}' "). reorder(sort)
end
- end
+ end
def find_public_attache keywords,sort = ""
# StoresController#search 将每条文件都查出来,再次进行判断过滤。---> resultSet.to_a.map
@@ -260,7 +262,7 @@ class FilesController < ApplicationController
sort = "created_on DESC"
end
resultSet = Attachment.where("attachments.container_type IS NOT NULL AND attachments.copy_from IS NULL AND filename LIKE :like ", like: "%#{keywords}%").
- reorder(sort)
+ reorder(sort)
end
def index
@@ -325,7 +327,7 @@ class FilesController < ApplicationController
@containers = [ Project.includes(:attachments).reorder(sort).find(@project.id)]
show_attachments @containers
- # get_attachment_for_tip(@all_attachments)
+ get_attachment_for_tip(@all_attachments)
@tag_list = attachment_tag_list @all_attachments
@@ -355,7 +357,7 @@ class FilesController < ApplicationController
when "quotes"
attribute = "quotes"
else
- attribute = "created_on"
+ attribute = "created_on"
end
@sort = order_by[0]
@order = order_by[1]
@@ -378,7 +380,7 @@ class FilesController < ApplicationController
@containers = [ Course.includes(:attachments).reorder(sort).find(@course.id)]
show_attachments @containers
- # get_attachment_for_tip(@all_attachments)
+ get_attachment_for_tip(@all_attachments)
@tag_list = attachment_tag_list @all_attachments
@@ -501,228 +503,228 @@ class FilesController < ApplicationController
end
def create
- if params[:add_tag]
- @addTag=true
- #render :back
+ if params[:add_tag]
+ @addTag=true
+ #render :back
tag_saveEx
#render :text =>"success"
respond_to do |format|
- format.js
- end
- else
- #modify by nwb
- if @project
- @addTag=false
- if params[:in_project_toolbar]
- @in_project_toolbar = params[:in_project_toolbar]
- end
- attachments = Attachment.attach_filesex(@project, params[:attachments], params[:attachment_type])
- if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added')
- # 发送邮件
- Mailer.run.attachments_added(attachments[:files])
- # 生成动态
- attachments[:files].each do |file|
- ForgeActivity.create(:user_id => User.current.id, :project_id => @project.id, :forge_act_id => file.id, :forge_act_type => "Attachment")
- end
- # 更新资源总数, 根据上传的附件数累加
- @project.project_score.update_attribute(:attach_num, @project.project_score.attach_num + attachments[:files].count) unless @project.project_score.nil?
- end
- # end
- if params[:project_attachment_type] && params[:project_attachment_type].is_a?(Array)
- params[:project_attachment_type].each do |type|
- tag_name = get_project_tag_name_by_type_nmuber type
- if !attachments.empty? && attachments[:files] && tag_name != ""
- attachments[:files].each do |attachment|
- attachment.tag_list.add(tag_name)
- attachment.description = params[:description]
- attachment.save
- end
- end
- end
- else
- if params[:project_attachment_type] && params[:project_attachment_type] != "6"
- tag_name = get_project_tag_name_by_type_nmuber params[:project_attachment_type]
- if !attachments.empty? && attachments[:files] && tag_name != ""
- attachments[:files].each do |attachment|
- attachment.tag_list.add(tag_name)
- attachment.description = params[:description]
- attachment.save
- end
- end
- end
- end
- # TODO: 临时用 nyan
- sort_init 'created_on', 'desc'
- sort_update 'created_on' => "#{Attachment.table_name}.created_on",
- 'filename' => "#{Attachment.table_name}.filename",
- 'size' => "#{Attachment.table_name}.filesize",
- 'downloads' => "#{Attachment.table_name}.downloads"
+ format.js
+ end
+ else
+ #modify by nwb
+ if @project
+ @addTag=false
+ if params[:in_project_toolbar]
+ @in_project_toolbar = params[:in_project_toolbar]
+ end
+ attachments = Attachment.attach_filesex(@project, params[:attachments], params[:attachment_type])
+ if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added')
+ # 发送邮件
+ Mailer.run.attachments_added(attachments[:files])
+ # 生成动态
+ attachments[:files].each do |file|
+ ForgeActivity.create(:user_id => User.current.id, :project_id => @project.id, :forge_act_id => file.id, :forge_act_type => "Attachment")
+ end
+ # 更新资源总数, 根据上传的附件数累加
+ @project.project_score.update_attribute(:attach_num, @project.project_score.attach_num + attachments[:files].count) unless @project.project_score.nil?
+ end
+ # end
+ if params[:project_attachment_type] && params[:project_attachment_type].is_a?(Array)
+ params[:project_attachment_type].each do |type|
+ tag_name = get_project_tag_name_by_type_nmuber type
+ if !attachments.empty? && attachments[:files] && tag_name != ""
+ attachments[:files].each do |attachment|
+ attachment.tag_list.add(tag_name)
+ attachment.description = params[:description]
+ attachment.save
+ end
+ end
+ end
+ else
+ if params[:project_attachment_type] && params[:project_attachment_type] != "6"
+ tag_name = get_project_tag_name_by_type_nmuber params[:project_attachment_type]
+ if !attachments.empty? && attachments[:files] && tag_name != ""
+ attachments[:files].each do |attachment|
+ attachment.tag_list.add(tag_name)
+ attachment.description = params[:description]
+ attachment.save
+ end
+ end
+ end
+ end
+ # TODO: 临时用 nyan
+ sort_init 'created_on', 'desc'
+ sort_update 'created_on' => "#{Attachment.table_name}.created_on",
+ 'filename' => "#{Attachment.table_name}.filename",
+ 'size' => "#{Attachment.table_name}.filesize",
+ 'downloads' => "#{Attachment.table_name}.downloads"
- @containers = [Project.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@project.id)]
- show_attachments @containers
- @tag_list = attachment_tag_list @all_attachments
- @attachtype = 0
- @contenttype = 0
- respond_to do |format|
- format.js
- format.html {
- redirect_to project_files_url(@project)
- }
- end
- elsif @course
- @addTag=false
- if params[:in_course_toolbar]
- @in_course_toolbar = params[:in_course_toolbar]
- end
- attachments = Attachment.attach_filesex(@course, params[:attachments], params[:attachment_type])
+ @containers = [Project.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@project.id)]
+ show_attachments @containers
+ @tag_list = attachment_tag_list @all_attachments
+ @attachtype = 0
+ @contenttype = 0
+ respond_to do |format|
+ format.js
+ format.html {
+ redirect_to project_files_url(@project)
+ }
+ end
+ elsif @course
+ @addTag=false
+ if params[:in_course_toolbar]
+ @in_course_toolbar = params[:in_course_toolbar]
+ end
+ attachments = Attachment.attach_filesex(@course, params[:attachments], params[:attachment_type])
- if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added')
- Mailer.run.attachments_added(attachments[:files])
- end
- if !attachments.empty? && attachments[:files]
- attachments[:files].each do |attachment|
- if params[:publish_time]
- if params[:publish_time] == ""
- attachment.publish_time = Date.today
- else
- attachment.publish_time = params[:publish_time]
- end
- else
- attachment.publish_time = Date.today
- end
- if attachment.publish_time > Date.today
- attachment.is_publish = 0
- end
- attachment.description = params[:description]
- attachment.save
- end
- end
- if params[:course_attachment_type] && params[:course_attachment_type].is_a?(Array)
- params[:course_attachment_type].each do |type|
- tag_name = get_tag_name_by_type_number type
- if !attachments.empty? && attachments[:files] && tag_name != ""
- attachments[:files].each do |attachment|
- attachment.tag_list.add(tag_name)
- attachment.save
- end
- end
- end
- else
- if params[:course_attachment_type] && params[:course_attachment_type] != "5"
- tag_name = get_tag_name_by_type_number params[:course_attachment_type]
- if !attachments.empty? && attachments[:files] && tag_name != ""
- attachments[:files].each do |attachment|
- attachment.tag_list.add(tag_name)
- attachment.save
- end
- end
- end
- end
- # 更新课程英雄榜得分
- course_member_score(@course.id, attachments[:files].first.author_id, "Attachment")
- # end
- # end
- # TODO: 临时用 nyan
- sort_init 'created_on', 'desc'
- sort_update 'created_on' => "#{Attachment.table_name}.created_on",
- 'filename' => "#{Attachment.table_name}.filename",
- 'size' => "#{Attachment.table_name}.filesize",
- 'downloads' => "#{Attachment.table_name}.downloads"
+ if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added')
+ Mailer.run.attachments_added(attachments[:files])
+ end
+ if !attachments.empty? && attachments[:files]
+ attachments[:files].each do |attachment|
+ if params[:publish_time]
+ if params[:publish_time] == ""
+ attachment.publish_time = Date.today
+ else
+ attachment.publish_time = params[:publish_time]
+ end
+ else
+ attachment.publish_time = Date.today
+ end
+ if attachment.publish_time > Date.today
+ attachment.is_publish = 0
+ end
+ attachment.description = params[:description]
+ attachment.save
+ end
+ end
+ if params[:course_attachment_type] && params[:course_attachment_type].is_a?(Array)
+ params[:course_attachment_type].each do |type|
+ tag_name = get_tag_name_by_type_number type
+ if !attachments.empty? && attachments[:files] && tag_name != ""
+ attachments[:files].each do |attachment|
+ attachment.tag_list.add(tag_name)
+ attachment.save
+ end
+ end
+ end
+ else
+ if params[:course_attachment_type] && params[:course_attachment_type] != "5"
+ tag_name = get_tag_name_by_type_number params[:course_attachment_type]
+ if !attachments.empty? && attachments[:files] && tag_name != ""
+ attachments[:files].each do |attachment|
+ attachment.tag_list.add(tag_name)
+ attachment.save
+ end
+ end
+ end
+ end
+ # 更新课程英雄榜得分
+ course_member_score(@course.id, attachments[:files].first.author_id, "Attachment")
+ # end
+ # end
+ # TODO: 临时用 nyan
+ sort_init 'created_on', 'desc'
+ sort_update 'created_on' => "#{Attachment.table_name}.created_on",
+ 'filename' => "#{Attachment.table_name}.filename",
+ 'size' => "#{Attachment.table_name}.filesize",
+ 'downloads' => "#{Attachment.table_name}.downloads"
- @containers = [Course.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@course.id)]
+ @containers = [Course.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@course.id)]
- show_attachments @containers
- @tag_list = attachment_tag_list @all_attachments
+ show_attachments @containers
+ @tag_list = attachment_tag_list @all_attachments
- @attachtype = 0
- @contenttype = 0
+ @attachtype = 0
+ @contenttype = 0
- respond_to do |format|
- format.js
- format.html {
- redirect_to course_files_url(@course)
- }
- end
- elsif @org_subfield
- @addTag=false
- attachments = Attachment.attach_filesex(@org_subfield, params[:attachments], params[:org_subfield_attachment_type])
+ respond_to do |format|
+ format.js
+ format.html {
+ redirect_to course_files_url(@course)
+ }
+ end
+ elsif @org_subfield
+ @addTag=false
+ attachments = Attachment.attach_filesex(@org_subfield, params[:attachments], params[:org_subfield_attachment_type])
- if params[:org_subfield_attachment_type] && params[:org_subfield_attachment_type].is_a?(Array)
- params[:org_subfield_attachment_type].each do |type|
- tag_name = get_tag_name_by_type_number type
- if !attachments.empty? && attachments[:files] && tag_name != ""
- attachments[:files].each do |attachment|
- attachment.tag_list.add(tag_name)
- attachment.description = params[:description]
- attachment.save
- end
- end
- end
- else
- if params[:org_subfield_attachment_type] && params[:org_subfield_attachment_type] != "5"
- tag_name = get_tag_name_by_type_number params[:org_subfield_attachment_type]
- if !attachments.empty? && attachments[:files] && tag_name != ""
- attachments[:files].each do |attachment|
- attachment.tag_list.add(tag_name)
- attachment.description = params[:description]
- attachment.save
- end
- end
- end
- end
+ if params[:org_subfield_attachment_type] && params[:org_subfield_attachment_type].is_a?(Array)
+ params[:org_subfield_attachment_type].each do |type|
+ tag_name = get_tag_name_by_type_number type
+ if !attachments.empty? && attachments[:files] && tag_name != ""
+ attachments[:files].each do |attachment|
+ attachment.tag_list.add(tag_name)
+ attachment.description = params[:description]
+ attachment.save
+ end
+ end
+ end
+ else
+ if params[:org_subfield_attachment_type] && params[:org_subfield_attachment_type] != "5"
+ tag_name = get_tag_name_by_type_number params[:org_subfield_attachment_type]
+ if !attachments.empty? && attachments[:files] && tag_name != ""
+ attachments[:files].each do |attachment|
+ attachment.tag_list.add(tag_name)
+ attachment.description = params[:description]
+ attachment.save
+ end
+ end
+ end
+ end
- # TODO: 临时用 nyan
- sort_init 'created_on', 'desc'
- sort_update 'created_on' => "#{Attachment.table_name}.created_on",
- 'filename' => "#{Attachment.table_name}.filename",
- 'size' => "#{Attachment.table_name}.filesize",
- 'downloads' => "#{Attachment.table_name}.downloads"
+ # TODO: 临时用 nyan
+ sort_init 'created_on', 'desc'
+ sort_update 'created_on' => "#{Attachment.table_name}.created_on",
+ 'filename' => "#{Attachment.table_name}.filename",
+ 'size' => "#{Attachment.table_name}.filesize",
+ 'downloads' => "#{Attachment.table_name}.downloads"
- @containers = [OrgSubfield.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@org_subfield.id)]
+ @containers = [OrgSubfield.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@org_subfield.id)]
- show_attachments @containers
- @tag_list = attachment_tag_list @all_attachments
- @attachtype = 0
- @contenttype = 0
+ show_attachments @containers
+ @tag_list = attachment_tag_list @all_attachments
+ @attachtype = 0
+ @contenttype = 0
- respond_to do |format|
- format.js
- # format.html {
- # redirect_to org_subfield_files_url(@org_subfield)
- # }
- end
- # 组织添加附件,为了修改图片
- elsif params[:organization_id]
- @organization = Organization.find(params[:organization_id])
- @addTag=false
- # atttchment_type = 0为logo 1为banner
- if params[:logo]
- attachments = Attachment.attach_filesex(@organization, params[:attachments], false)
- else
- attachments = Attachment.attach_filesex(@organization, params[:attachments], true)
- end
- # TODO: 临时用 nyan
- sort_init 'created_on', 'desc'
- sort_update 'created_on' => "#{Attachment.table_name}.created_on",
- 'filename' => "#{Attachment.table_name}.filename",
- 'size' => "#{Attachment.table_name}.filesize",
- 'downloads' => "#{Attachment.table_name}.downloads"
+ respond_to do |format|
+ format.js
+ # format.html {
+ # redirect_to org_subfield_files_url(@org_subfield)
+ # }
+ end
+ # 组织添加附件,为了修改图片
+ elsif params[:organization_id]
+ @organization = Organization.find(params[:organization_id])
+ @addTag=false
+ # atttchment_type = 0为logo 1为banner
+ if params[:logo]
+ attachments = Attachment.attach_filesex(@organization, params[:attachments], false)
+ else
+ attachments = Attachment.attach_filesex(@organization, params[:attachments], true)
+ end
+ # TODO: 临时用 nyan
+ sort_init 'created_on', 'desc'
+ sort_update 'created_on' => "#{Attachment.table_name}.created_on",
+ 'filename' => "#{Attachment.table_name}.filename",
+ 'size' => "#{Attachment.table_name}.filesize",
+ 'downloads' => "#{Attachment.table_name}.downloads"
- @containers = [Organization.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@organization.id)]
+ @containers = [Organization.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@organization.id)]
- show_attachments @containers
- @tag_list = attachment_tag_list @all_attachments
- @attachtype = 0
- @contenttype = 0
+ show_attachments @containers
+ @tag_list = attachment_tag_list @all_attachments
+ @attachtype = 0
+ @contenttype = 0
- respond_to do |format|
- format.js
- # format.html {
- # redirect_to org_subfield_files_url(@org_subfield)
- # }
- end
- end
- end
+ respond_to do |format|
+ format.js
+ # format.html {
+ # redirect_to org_subfield_files_url(@org_subfield)
+ # }
+ end
+ end
+ end
end
def get_project_tag_name_by_type_nmuber type
@@ -798,13 +800,13 @@ class FilesController < ApplicationController
else
#捕获异常
end
- end
+ end
# 返回指定资源类型的资源列表
# added by nwb
def getattachtype
- sort_init 'created_on', 'desc'
- sort_update 'created_on' => "#{Attachment.table_name}.created_on",
+ sort_init 'created_on', 'desc'
+ sort_update 'created_on' => "#{Attachment.table_name}.created_on",
'filename' => "#{Attachment.table_name}.filename",
'size' => "#{Attachment.table_name}.filesize",
'downloads' => "#{Attachment.table_name}.downloads"
@@ -842,27 +844,27 @@ class FilesController < ApplicationController
end
end
- if @project
- @isproject = true
- @containers = [ Project.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@project.id)]
- @containers += @project.versions.includes(:attachments).reorder(sort).all
- show_attachments @containers
- @attachtype = params[:type].to_i
- @contenttype = params[:contentType].to_s
+ if @project
+ @isproject = true
+ @containers = [ Project.includes(:attachments).reorder("#{Attachment.table_name}.created_on DESC").find(@project.id)]
+ @containers += @project.versions.includes(:attachments).reorder(sort).all
+ show_attachments @containers
+ @attachtype = params[:type].to_i
+ @contenttype = params[:contentType].to_s
respond_to do |format|
format.js
- format.html {
- render :layout => 'base_projects'
- }
+ format.html {
+ render :layout => 'base_projects'
+ }
end
- elsif @course
+ elsif @course
@isproject = false
@containers = [ Course.includes(:attachments).reorder(sort).find(@course.id)]
show_attachments @containers
@attachtype = params[:type].to_i
@contenttype = params[:contentType].to_s
- # render layout: 'base_courses'
+ # render layout: 'base_courses'
@left_nav_type = 5
respond_to do |format|
format.js
@@ -870,19 +872,19 @@ class FilesController < ApplicationController
render :layout => 'base_courses'
}
end
- else
- show_attachments @containers
- @attachtype = params[:type].to_i
- @contenttype = params[:contentType].to_s
+ else
+ show_attachments @containers
+ @attachtype = params[:type].to_i
+ @contenttype = params[:contentType].to_s
- respond_to do |format|
+ respond_to do |format|
format.js
format.html
- end
- end
+ end
+ end
end
- #查找指定TAG的按条件过滤的资源列表,只有课程内搜索有此功能
+ #查找指定TAG的按条件过滤的资源列表,只有课程内搜索有此功能
def search_tag_attachment
@q,@tag_name,@order = params[:q],params[:tag_name]
@is_remote = true
diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb
index caf0b4bda..b97699058 100644
--- a/app/controllers/issues_controller.rb
+++ b/app/controllers/issues_controller.rb
@@ -196,8 +196,9 @@ class IssuesController < ApplicationController
priority_id = params[:issue][:priority_id]
ps = ProjectsService.new
- ps.send_wechat_project_issue_notice senduser,@issue.project,issue_id,issue_title,priority_id
-
+ if senduser.id != User.current.id
+ ps.send_wechat_project_issue_notice senduser,@issue.project,issue_id,issue_title,priority_id
+ end
call_hook(:controller_issues_new_after_save, { :params => params, :issue => @issue})
respond_to do |format|
format.html {
@@ -589,19 +590,19 @@ class IssuesController < ApplicationController
return false
end
end
- @issue.safe_attributes = issue_attributes
senduser = User.find(params[:issue][:assigned_to_id])
- if senduser.id != User.current.id
+ if senduser.id != User.current.id && @issue.assigned_to_id != params[:issue][:assigned_to_id].to_i
issue_id = @issue.id
issue_title = params[:issue][:subject]
priority_id = params[:issue][:priority_id]
-
ps = ProjectsService.new
ps.send_wechat_project_issue_notice senduser,@issue.project,issue_id,issue_title,priority_id
end
+ @issue.safe_attributes = issue_attributes
+
@priorities = IssuePriority.active
@allowed_statuses = @issue.new_statuses_allowed_to(User.current)
true
diff --git a/app/controllers/quality_analysis_controller.rb b/app/controllers/quality_analysis_controller.rb
index 3a9eff0ce..365889640 100644
--- a/app/controllers/quality_analysis_controller.rb
+++ b/app/controllers/quality_analysis_controller.rb
@@ -16,8 +16,8 @@ class QualityAnalysisController < ApplicationController
end
# params 说明:{identifier:版本库名}
+ # type: 1 新的分析 2 重新分析
def create
- logger.info("11111111111111111111111111111")
begin
user_name = User.find(params[:user_id]).try(:login)
identifier = params[:identifier]
@@ -30,98 +30,98 @@ class QualityAnalysisController < ApplicationController
# 考虑到历史数据:有些用户创建类job但是build失败,即sonar没有结果,这个时候需要把job删除,并且删掉quality_analyses表数据
# 如果不要这句则需要迁移数据
@sonar_address = Redmine::Configuration['sonar_address']
- projects_date = open(@sonar_address + "/api/projects/index").read
- arr = JSON.parse(projects_date).map {|m| m["nm"]} # eg: ["Hjqreturn:cc_rep", "Hjqreturn:putong", "Hjqreturn:sonar_rep2", "shitou:sonar_rep"]
- quality_an = QualityAnalysis.where(:sonar_name => sonar_name).first
- if @client_jenkins.job.exists?(job_name) && QualityAnalysis.where(:sonar_name => sonar_name).select{|qa| arr.include?(qa.sonar_name)}.blank?
- aa = @client_jenkins.job.delete("#{job_name}")
- quality_an.delete unless quality_an.blank?
- end
+ # projects_date = open(@sonar_address + "/api/projects/index").read
+ # arr = JSON.parse(projects_date).map {|m| m["nm"]} # eg: ["Hjqreturn:cc_rep", "Hjqreturn:putong", "Hjqreturn:sonar_rep2", "shitou:sonar_rep"]
+ quality_an = QualityAnalysis.where(:sonar_name => sonar_name)
+ # if @client_jenkins.job.exists?(job_name) && QualityAnalysis.where(:sonar_name => sonar_name).select{|qa| arr.include?(qa.sonar_name)}.blank?
+ # aa = @client_jenkins.job.delete("#{job_name}")
+ # quality_an.delete unless quality_an.blank?
+ # end
+
+ # type 1的时候之所以判断job是否存在,为了防止特殊情况,正常情况是不会出现的
+ # 重新分析的时候需要删除以前的分析结果
+ @client_jenkins.job.delete("#{job_name}") if @client_jenkins.job.exists?(job_name)
+ quality_an.delete_all unless quality_an.blank?
# Checks if the given job exists in Jenkins.
- unless @client_jenkins.job.exists?(job_name)
- @g = Gitlab.client
- branch = params[:branch]
- language = swith_language_type(params[:language])
- path = params[:path].blank? ? "./" : params[:path]
- # qa = QualityAnalysis.where(:project_id => @project.id, :author_login => user_name).first
- version = quality_an.nil? ? 1 : quality_an.sonar_version + 1
- properties = "sonar.projectKey=#{sonar_name}
+ @g = Gitlab.client
+ branch = params[:branch]
+ language = swith_language_type(params[:language])
+ path = params[:path].blank? ? "./" : params[:path]
+ # qa = QualityAnalysis.where(:project_id => @project.id, :author_login => user_name).first
+ version = 1
+ properties = "sonar.projectKey=#{sonar_name}
sonar.projectName=#{sonar_name}
sonar.projectVersion=#{version}
sonar.sources=#{path}
sonar.language=#{language.downcase}
sonar.sourceEncoding=utf-8"
- git_url = @gitlab_address.to_s+"/"+@project.owner.to_s+"/"+ identifier + "."+"git"
+ git_url = @gitlab_address.to_s+"/"+@project.owner.to_s+"/"+ identifier + "."+"git"
- # 替换配置文件
- @doc = Nokogiri::XML(File.open(File.join(Rails.root, 'tmp', 'config.xml')))
- @doc.at_xpath("//hudson.plugins.git.UserRemoteConfig/url").content = git_url
- @doc.at_xpath("//hudson.plugins.git.BranchSpec/name").content = "*/#{branch}"
- @doc.at_xpath("//hudson.plugins.sonar.SonarRunnerBuilder/properties").content = properties # sonar-properties
+ # 替换配置文件
+ @doc = Nokogiri::XML(File.open(File.join(Rails.root, 'tmp', 'config.xml')))
+ @doc.at_xpath("//hudson.plugins.git.UserRemoteConfig/url").content = git_url
+ @doc.at_xpath("//hudson.plugins.git.BranchSpec/name").content = "*/#{branch}"
+ @doc.at_xpath("//hudson.plugins.sonar.SonarRunnerBuilder/properties").content = properties # sonar-properties
- # jenkins job创建
- jenkins_job = @client_jenkins.job.create("#{job_name}", @doc.to_xml)
- logger.info("Jenkins status of create ==> #{jenkins_job}")
+ # jenkins job创建
+ jenkins_job = @client_jenkins.job.create("#{job_name}", @doc.to_xml)
- # 将地址作为hook值添加到gitlab
- @g.add_project_hook(@project.gpid, @jenkins_address + "/project/#{job_name}")
- # job创建完成后自动运行job,如果运行成功则返回‘200’
- code = @client_jenkins.job.build("#{job_name}")
- logger.error("build result ==> #{code}")
+ # 将地址作为hook值添加到gitlab
+ # @g.add_project_hook(@project.gpid, @jenkins_address + "/project/#{job_name}")
+ # job创建完成后自动运行job,如果运行成功则返回‘200’
+ code = @client_jenkins.job.build("#{job_name}")
- # 判断调用sonar分析是否成功
- # 等待启动时间处理, 最长时间为30分钟
- for i in 0..360 do
- sleep(5)
- @current_build_status = @client_jenkins.job.get_current_build_status("#{job_name}")
- if (@current_build_status == "success" || @current_build_status == "failure")
+ # 判断调用sonar分析是否成功
+ # 等待启动时间处理, 最长时间为30分钟
+ for i in 0..360 do
+ sleep(5)
+ @current_build_status = @client_jenkins.job.get_current_build_status("#{job_name}")
+ if (@current_build_status == "success" || @current_build_status == "failure")
+ break
+ if i == 360
+ @build_console_result = false
break
- if i == 360
- @build_console_result = false
- break
- end
- end
- end
-
- # sonar 缓冲,sonar生成数据
- sleep(10)
-
- # 获取sonar output结果
- console_build = @client_jenkins.job.get_console_output("#{job_name}", build_num = 0, start = 0, mode = 'text')["output"]
- logger.info("@current_build_status is ==> #{@current_build_status}")
-
- # 两种情况需要删除job:
- # 1/创建成功但是build失败则删除job
- # 2/creat和build成功,调用sonar启动失败则删除job
- # 错误信息存储需存到Trustie数据库,否则一旦job删除则无法获取这些信息
- if jenkins_job == '200' && code != '201'
- @client_jenkins.job.delete("#{job_name}")
- else
- if @current_build_status == "failure"
- reg_console = /Exception:.*?\r/.match(console_build)
- output = reg_console[0].gsub("\r", "") unless reg_console.nil?
- se = SonarError.where(:jenkins_job_name => job_name).first
- se.nil? ? SonarError.create(:project_id => @project.id, :jenkins_job_name => job_name, :output => output) : se.update_column(:output, output)
- @client_jenkins.job.delete("#{job_name}")
- elsif @current_build_status == "success"
- if quality_an.blank?
- QualityAnalysis.create(:project_id => @project.id, :author_login => user_name, :rep_identifier => identifier,
- :sonar_version => version, :path => path, :branch => branch, :language => language, :sonar_name => "#{user_name}:#{rep_id}")
- else
- qa.update_attribute(:sonar_version, version)
- end
- end
- end
-
- respond_to do |format|
- if @current_build_status == "success"
- format.html{redirect_to project_quality_analysis_path(:project_id => @project.id, :resource_id => sonar_name, :branch => branch, :current_build_status => @current_build_status, :job_name => job_name)}
- elsif @current_build_status == "failure"
- format.html{redirect_to error_list_project_quality_analysi_path(:project_id => @project.id, :job_name => job_name)}
end
end
end
+
+ # sonar 缓冲,sonar生成数据
+ sleep(10)
+
+ # 获取sonar output结果
+ console_build = @client_jenkins.job.get_console_output("#{job_name}", build_num = 0, start = 0, mode = 'text')["output"]
+ logger.info("@current_build_status is ==> #{@current_build_status}")
+
+ # 两种情况需要删除job:
+ # 1/创建成功但是build失败则删除job
+ # 2/creat和build成功,调用sonar启动失败则删除job
+ # 错误信息存储需存到Trustie数据库,否则一旦job删除则无法获取这些信息
+ if jenkins_job == '200' && code != '201'
+ @client_jenkins.job.delete("#{job_name}")
+ else
+ if @current_build_status == "failure"
+ reg_console = /Exception:.*?\r/.match(console_build)
+ output = reg_console[0].gsub("\r", "") unless reg_console.nil?
+ se = SonarError.where(:jenkins_job_name => job_name).first
+ se.nil? ? SonarError.create(:project_id => @project.id, :jenkins_job_name => job_name, :output => output) : se.update_column(:output, output)
+ @client_jenkins.job.delete("#{job_name}")
+ elsif @current_build_status == "success"
+ if quality_an.blank?
+ QualityAnalysis.create(:project_id => @project.id, :author_login => user_name, :rep_identifier => identifier,
+ :sonar_version => version, :path => path, :branch => branch, :language => language, :sonar_name => "#{user_name}:#{rep_id}")
+ end
+ end
+ end
+
+ respond_to do |format|
+ if @current_build_status == "success"
+ format.html{redirect_to project_quality_analysis_path(:project_id => @project.id, :resource_id => sonar_name, :branch => branch, :current_build_status => @current_build_status, :job_name => job_name)}
+ elsif @current_build_status == "failure"
+ format.html{redirect_to error_list_project_quality_analysi_path(:project_id => @project.id, :job_name => job_name)}
+ end
+ end
+
rescue => e
@message = e.message
logger.error("######################====>#{e.message}")
@@ -302,10 +302,8 @@ class QualityAnalysisController < ApplicationController
@jenkins_address = Redmine::Configuration['jenkins_address']
jenkins_username = Redmine::Configuration['jenkins_username']
jenkins_password = Redmine::Configuration['jenkins_password']
- logger.info("22222222222222222222222222222222")
# connect jenkins
@client_jenkins = JenkinsApi::Client.new(:server_url => @jenkins_address, :username => jenkins_username, :password => jenkins_password)
- logger.info("333333333333333333333333333333")
rescue => e
logger.error("failed to connect Jenkins ==> #{e}")
end
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 3afc784e7..5aab1df49 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -1704,7 +1704,7 @@ class UsersController < ApplicationController
sql = "user_id = #{@user.id} and ((container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}) or (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types}))"
end
if User.current != @user
- sql += "and user_id = #{@user.id}"
+ sql += " and user_id = #{@user.id}"
end
else
if User.current != @user
@@ -2214,6 +2214,7 @@ class UsersController < ApplicationController
#这里仅仅是传递需要发送的资源id
@send_id = params[:send_id]
@send_ids = params[:checkbox1] || params[:send_ids]
+ @hidden_unproject = hidden_unproject_infos
respond_to do |format|
format.js
end
@@ -2233,6 +2234,7 @@ class UsersController < ApplicationController
#这里仅仅是传递需要发送的资源id
@send_id = params[:send_id]
@send_ids = params[:checkbox1] || params[:send_ids] #搜索的时候 和 直接 用表格提交的时候的send_ids
+ @hidden_unproject = hidden_unproject_infos
respond_to do |format|
format.js
end
@@ -3396,6 +3398,7 @@ class UsersController < ApplicationController
#这里仅仅是传递需要发送的资源id
@send_id = params[:send_id]
@send_ids = params[:checkbox1] || params[:send_ids]
+ @hidden_unproject = hidden_unproject_infos
respond_to do |format|
format.js
end
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 1ff7fc2d9..3c125a185 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -37,6 +37,13 @@ module ApplicationHelper
# super
# end
+ # 隐藏项目以外的信息
+ # return: true 显示,false 不显示
+ def hidden_unproject_infos
+ hidden_info = Setting.find_by_name("hidden_non_project")
+ (hidden_info && hidden_info.value == "1") ? true : false
+ end
+
# 通过系统外部邮箱查找用户,如果用户不存在则用邮箱替换
def get_user_by_mail mail
user = User.find_by_mail(mail)
@@ -830,11 +837,7 @@ module ApplicationHelper
return false if project.gpid.nil?
g = Gitlab.client
count = g.user_static(project.gpid, :rev => "master").count
- if User.current.member_of?(project) && count > 0
- true
- else
- false
- end
+ count
end
# 判断版本库是否初始为gitlab
@@ -3241,6 +3244,16 @@ def get_all_children result, jour
result
end
+#获取该节点所在的帖子
+def get_root_parent comment
+ while comment.parent
+ comment = comment.parent
+ end
+ comment
+end
+
+
+
#将有置顶属性的提到数组前面
def sort_by_sticky topics
tmpTopics = []
diff --git a/app/models/at_message.rb b/app/models/at_message.rb
index 5ca2de507..5a175fe76 100644
--- a/app/models/at_message.rb
+++ b/app/models/at_message.rb
@@ -1,6 +1,7 @@
#coding=utf-8
class AtMessage < ActiveRecord::Base
+ include ApplicationHelper
belongs_to :user
belongs_to :sender, class_name: "User", foreign_key: "sender_id"
attr_accessible :at_message, :container, :viewed, :user_id, :sender_id
@@ -10,7 +11,7 @@ class AtMessage < ActiveRecord::Base
has_many :message_alls, :class_name => 'MessageAll',:as =>:message, :dependent => :destroy
validates :user_id, :sender_id, :at_message_id, :at_message_type, presence: true
- after_create :add_user_message
+ after_create :add_user_message, :send_wechat_message
scope :unviewed, ->(type, id){
where(at_message_type: type, at_message_id:id, viewed: false)
@@ -34,6 +35,91 @@ class AtMessage < ActiveRecord::Base
end
end
+ #@的时候发微信模版消息通知被@的人
+ def send_wechat_message
+ shield_type = ""
+ container_id = 0
+ status = 0
+ type = ""
+ detail_id = 0
+ detail_title = ""
+
+ if defined? at_message.notes
+ detail_content = strip_html at_message.notes,30
+ elsif defined? at_message.content
+ detail_content = strip_html at_message.content,30
+ elsif defined? at_message.description
+ detail_content = strip_html at_message.description,30
+ end
+
+ user = self.user
+
+ topic = get_root_parent at_message
+
+ case at_message_type
+ when "Issue"
+ #新建issue
+ shield_type = "Project"
+ container_id = at_message.project.id
+ type = "issues"
+ detail_id = topic.id
+ detail_title = at_message.subject
+ when "Journal"
+ #issue回复
+ topic = get_root_parent at_message.journalized
+ shield_type = "Project"
+ container_id = at_message.journalized.project.id
+ type = "issues"
+ detail_id = topic.id
+ detail_title = at_message.journalized.subject
+ when 'Message'
+ if at_message.course
+ shield_type = "Course"
+ container_id = at_message.course.id
+ type = "course_discussion"
+ detail_id = topic.id
+ detail_title = at_message.subject
+ elsif at_message.project
+ shield_type = "Project"
+ container_id = at_message.project.id
+ type = "project_discussion"
+ detail_id = topic.id
+ detail_title = at_message.subject
+ else
+ status = -1
+ end
+ when 'JournalsForMessage'
+ if at_message.jour && at_message.jour.course
+ #作业回复
+ shield_type = "Course"
+ container_id = at_message.jour.course.id
+ type = "homework"
+ detail_id = at_message.jour.id
+ detail_title = at_message.jour.name
+ else
+ type = "journal_for_message"
+ detail_id = topic.id
+ detail_title = at_message.subject
+ end
+ else
+ status = -1
+ end
+
+ count = 0
+
+ detail_title = detail_title.gsub(/RE: /, '')
+
+ if container_id != 0
+ count = ShieldWechatMessage.where("container_type='User' and container_id=#{user.id} and shield_type='#{shield_type}' and shield_id=#{container_id}").count
+ end
+ if count == 0 && status == 0
+ message_title = self.sender.show_name+"@了您"
+ ws = WechatService.new
+ ws.at_notice user.id, type, detail_id, message_title, detail_title, format_time(Time.now), detail_content, "点击查看详情。",0
+ end
+
+ end
+
def subject
case at_message_type
when "Issue"
diff --git a/app/models/tracker.rb b/app/models/tracker.rb
index af56d23bf..4ef18b7b0 100644
--- a/app/models/tracker.rb
+++ b/app/models/tracker.rb
@@ -34,7 +34,7 @@ class Tracker < ActiveRecord::Base
end
has_and_belongs_to_many :projects
- has_and_belongs_to_many :courses
+ # has_and_belongs_to_many :courses
has_and_belongs_to_many :custom_fields, :class_name => 'IssueCustomField', :join_table => "#{table_name_prefix}custom_fields_trackers#{table_name_suffix}", :association_foreign_key => 'custom_field_id'
acts_as_list
diff --git a/app/models/user.rb b/app/models/user.rb
index b863c1f70..f2b2b6824 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -1162,18 +1162,20 @@ class User < Principal
#为新注册用户发送留言
def add_new_jour
- if Message.where("id=19504").any? and Message.where("id=19291").any? and Message.where("id=19292").any?
- lead_message1 = Message.find(19292)
- notes1 = lead_message1.content
- lead_message2 = Message.find(19291)
- notes2 = lead_message2.content
- lead_message3 = Message.find(19504)
- notes3 = lead_message3.content
- #user_id 默认为课程使者创建
- self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes1, :reply_id => 0, :status => true, :is_readed => false, :private => 0)
- self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes2, :reply_id => 0, :status => true, :is_readed => false, :private => 0)
- self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes3, :reply_id => 0, :status => true, :is_readed => false, :private => 0)
- end
+ if Setting.find_by_name("hidden_non_project") && Setting.find_by_name("hidden_non_project").value != "0"
+ if Message.where("id=19504").any? and Message.where("id=19291").any? and Message.where("id=19292").any?
+ lead_message1 = Message.find(19292)
+ notes1 = lead_message1.content
+ lead_message2 = Message.find(19291)
+ notes2 = lead_message2.content
+ lead_message3 = Message.find(19504)
+ notes3 = lead_message3.content
+ #user_id 默认为课程使者创建
+ self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes1, :reply_id => 0, :status => true, :is_readed => false, :private => 0)
+ self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes2, :reply_id => 0, :status => true, :is_readed => false, :private => 0)
+ self.journals_for_messages << JournalsForMessage.new(:user_id => 1, :notes => notes3, :reply_id => 0, :status => true, :is_readed => false, :private => 0)
+ end
+ end
end
# 更新邮箱的同事,更新invite_lists表中的邮箱信息
diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb
index 7d574bada..f184fa923 100644
--- a/app/services/courses_service.rb
+++ b/app/services/courses_service.rb
@@ -79,7 +79,8 @@ class CoursesService
else
c = Course.find(course)
end
- if current_user.nil? || !(current_user.admin? || c.is_public == 1 || (c.is_public == 0 && current_user.member_of_course?(c)))
+ # if current_user.nil? || !(current_user.admin? || c.is_public == 1 || (c.is_public == 0 && current_user.member_of_course?(c)))
+ if current_user.nil?
raise '403'
end
#@canShowCode = isCourseTeacher(User.current.id,course) && params[:role] != '1'
@@ -458,8 +459,8 @@ class CoursesService
joined = StudentsForCourse.where('student_id = ? and course_id = ?', user.id, params[:object_id])
joined.each do |join|
join.delete
- @state = 0
end
+ @state = 0
@state
end
@@ -1284,5 +1285,35 @@ class CoursesService
status
end
+ #删除班级成员
+ def delete_course_member course,user_id,current_user
+ if current_user.nil?
+ state = -1
+ return state
+ end
+
+ member = course.members.where("user_id=?",user_id).first
+
+ if member != nil
+ member.destroy
+ user_admin = CourseInfos.where("user_id = ? and course_id = ?", member.user_id, course.id)
+ if user_admin.size > 0
+ user_admin.each do |user|
+ user.destroy
+ end
+ end
+ joined = StudentsForCourse.where('student_id = ? and course_id = ?', member.user_id,course.id)
+ joined.each do |join|
+ join.delete
+ end
+ roles = Role.givable.all[3..5]
+ #移出课程发送消息
+ CourseMessage.create(:user_id => member.user_id, :course_id => course.id, :course_message_type => "RemoveFromCourse", :viewed => false, :course_message_id => current_user.id)
+ return 0
+ else
+ return 1
+ end
+ end
+
end
diff --git a/app/services/projects_service.rb b/app/services/projects_service.rb
index fc7f25d1f..f3679aa22 100644
--- a/app/services/projects_service.rb
+++ b/app/services/projects_service.rb
@@ -355,4 +355,67 @@ class ProjectsService
end
end
+ #删除项目成员
+ def project_delete_member project,user_id,current_user
+ if current_user.nil?
+ state = -1
+ return state
+ end
+
+ member = project.members.where("user_id=?",user_id).first
+
+ if member != nil
+ member.destroy
+ # end
+ user_admin = ProjectInfo.where("user_id = ? and project_id = ?", member.user_id, project.id)
+ if user_admin.size > 0
+ user_admin.each do |user|
+ user.destroy
+ end
+ end
+ user_grade = UserGrade.where("user_id = ? and project_id = ?", member.user_id, project.id)
+ if user_grade.size > 0
+ user_grade.each do |grade|
+ grade.destroy
+ end
+ end
+ # 移出的时候删除申请消息,不需要删除消息,所以不必要关联删除
+ applied_projects = AppliedProject.where(:project_id => project.id, :user_id => member.user_id).first
+ unless applied_projects.nil?
+ applied_projects.delete
+ end
+ #移出项目发送消息
+ ForgeMessage.create(:user_id => member.user_id, :project_id => project.id, :forge_message_type => "RemoveFromProject", :viewed => false, :forge_message_id => current_user.id)
+ return 0
+ else
+ return 1
+ end
+ end
+
+ def exit_project project,user
+ if user.nil?
+ state = -1
+ return state
+ end
+
+ if project.user_id == user.id
+ state = -2
+ return state
+ end
+
+ members = Member.where(:user_id => user.id, :project_id=>project.id).first
+ if members != nil
+ members.destroy
+ # 移出的时候删除申请消息,不需要删除消息,所以不必要关联删除
+ applied_projects = AppliedProject.where(:project_id => project.id, :user_id => members.user_id).first
+ unless applied_projects.nil?
+ applied_projects.delete
+ end
+ state = 0
+ else
+ state = -3
+ end
+ return state
+ end
+
end
diff --git a/app/services/wechat_service.rb b/app/services/wechat_service.rb
index 423676983..8adc1392f 100644
--- a/app/services/wechat_service.rb
+++ b/app/services/wechat_service.rb
@@ -432,4 +432,17 @@ class WechatService
end
end
+ def at_notice(user_id, type, id, first, key1, key2,key3,remark="",uid=0)
+ uw = UserWechat.where(user_id: user_id).first
+ unless uw.nil?
+ data = three_keys_template uw.openid,Wechat.config.at_notice, type, id, first, key1, key2, key3, remark,uid
+ begin
+ req = Wechat.api.template_message_send Wechat::Message.to(uw.openid).template(data)
+ rescue Exception => e
+ Rails.logger.error "[at_notice] ===> #{e}"
+ end
+ Rails.logger.info "send over. #{req}"
+ end
+ end
+
end
\ No newline at end of file
diff --git a/app/views/attachments/update_file_dense.js.erb b/app/views/attachments/update_file_dense.js.erb
index 7709ee288..635fbe8bf 100644
--- a/app/views/attachments/update_file_dense.js.erb
+++ b/app/views/attachments/update_file_dense.js.erb
@@ -1,16 +1,18 @@
<% if @attachment.container_type == 'Course' %>
-$("#is_public_<%= @attachment.id %>").html("<%= escape_javascript(link_to (@attachment.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid=>@attachment.id,:newtype=>(@attachment.is_public? ? 0:1)),
+ $("#is_public_<%= @attachment.id %>").html("<%= escape_javascript(link_to (@attachment.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid=>@attachment.id, :course_id => @attachment.container_id, :tag_name => @tag_name, :other => @other,:newtype=>(@attachment.is_public? ? 0:1)),
:remote=>true,:class=>"postOptionLink",:method => :post) %>");
+ $("#tip_attachment_count").html("<%= escape_javascript( render :partial => 'files/tip_attachment_count') %>");
<% elsif @attachment.container_type == 'Project' %>
- $("#is_public_<%= @attachment.id %>").html("<%= escape_javascript(link_to (@attachment.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid => @attachment.id, :newtype => (@attachment.is_public? ? 0:1)),
+ $("#is_public_<%= @attachment.id %>").html("<%= escape_javascript(link_to (@attachment.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid => @attachment.id, :project_id => @attachment.container_id, :tag_name => @tag_name, :other => @other ,:newtype => (@attachment.is_public? ? 0:1)),
:remote => true, :class => "postOptionLink", :method => :post) %>");
+ $("#tip_attachment_count").html("<%= escape_javascript( render :partial => 'files/tip_attachment_count') %>");
<% else %>
-$("#is_public_<%= @attachment.id %>").html("<%= escape_javascript(link_to (@attachment.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid=>@attachment.id,:newtype=>(@attachment.is_public? ? 0:1)),
+ $("#is_public_<%= @attachment.id %>").html("<%= escape_javascript(link_to (@attachment.is_public? ? "设为私有":"设为公开"), update_file_dense_attachments_path(:attachmentid=>@attachment.id,:newtype=>(@attachment.is_public? ? 0:1)),
:remote=>true,:class=>"postOptionLink",:method => :post) %>");
<% end %>
<% if @attachment.is_public? %>
$("#image_private_<%= @attachment.id%>").html('')
<%else%>
-$("#image_private_<%= @attachment.id%>").html('私有 ')
+ $("#image_private_<%= @attachment.id%>").html('私有 ')
<% end %>
\ No newline at end of file
diff --git a/app/views/courses/_new_member_list.html.erb b/app/views/courses/_new_member_list.html.erb
index 720dfceea..08df18175 100644
--- a/app/views/courses/_new_member_list.html.erb
+++ b/app/views/courses/_new_member_list.html.erb
@@ -54,11 +54,11 @@
- <%= link_to("#{l(:label_bidding_user_studentname)}:#{member.user.show_name} ".html_safe,user_path(member.user)) %>
+ <%= link_to("#{l(:label_bidding_user_studentname)}:#{member.user.show_name} ".html_safe,user_path(member.user)) %>
<% unless member.user.user_extensions.student_id == ''%>
- <%= link_to("#{l(:label_bidding_user_studentcode)}:#{member.user.user_extensions.student_id} ".html_safe,user_path(member.user)) %>
+ <%= link_to("#{l(:label_bidding_user_studentcode)}:#{member.user.user_extensions.student_id} ".html_safe,user_path(member.user)) %>
<% end%>
<% unless @course.course_groups.empty? %>
diff --git a/app/views/files/_course_file.html.erb b/app/views/files/_course_file.html.erb
index b5a15bc1f..045eec6f7 100644
--- a/app/views/files/_course_file.html.erb
+++ b/app/views/files/_course_file.html.erb
@@ -1,9 +1,9 @@
+<% if hidden_unproject_infos %>
+ <%= render :partial => 'layouts/new_feedback' %>
+<% end %>
-123
-<%= render :partial => 'layouts/new_feedback' %>
<%= l(:label_loading) %>
diff --git a/app/views/layouts/base_syllabus.html.erb b/app/views/layouts/base_syllabus.html.erb
index b29c24fe6..9bd4a25c0 100644
--- a/app/views/layouts/base_syllabus.html.erb
+++ b/app/views/layouts/base_syllabus.html.erb
@@ -1,148 +1,157 @@
-
-
-
-
- <%= h html_title %>
-
-
- <%= csrf_meta_tag %>
- <%= favicon %>
- <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common','css/public','css/structure','css/courses','css/popup','prettify','syllabus','sy_public',:media => 'all'%>
- <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
- <%= javascript_heads %>
- <%= javascript_include_tag "bootstrap","avatars","course",'attachments','prettify','syllabus','cookie'%>
- <%= heads_for_theme %>
- <%= call_hook :view_layouts_base_html_head %>
- <%= yield :header_tags -%>
-
-
-
-
-
-
-
-<% is_current_user = User.current.logged?%>
-
- <% if User.current.logged? %>
- <%= render :partial => 'layouts/logined_header' %>
- <% else%>
- <%= render :partial => 'layouts/unlogin_header' %>
- <% end%>
-
-
-
-
-
-
- <%=render :partial => 'layouts/syllabus_info' %>
-
-
-
-
-
- <%= yield %>
-
-
-
- <%= render :partial => 'layouts/syllabus_base_info', :locals => {:syllabus => @syllabus} %>
-
-
- <%= render :partial => 'layouts/syllabus_teacher_list', :locals => {:syllabus => @syllabus} %>
-
-
-
-
-
-
-
-<%= render :partial => 'layouts/footer' %>
-
-
-
-
- <%= l(:label_loading) %>
-
-
-
-
+
+
+
+
+ <%= h html_title %>
+
+
+ <%= csrf_meta_tag %>
+ <%= favicon %>
+ <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2','css/common','css/public','css/structure','css/courses','css/popup','prettify','syllabus','sy_public',:media => 'all'%>
+ <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
+ <%= javascript_heads %>
+ <%= javascript_include_tag "bootstrap","avatars","course",'attachments','prettify','syllabus','cookie'%>
+ <%= heads_for_theme %>
+ <%= call_hook :view_layouts_base_html_head %>
+ <%= yield :header_tags -%>
+
+
+
+
+
+
+
+<% is_current_user = User.current.logged?%>
+
+ <% if User.current.logged? %>
+ <%= render :partial => 'layouts/logined_header' %>
+ <% else%>
+ <%= render :partial => 'layouts/unlogin_header' %>
+ <% end%>
+
+
+
+
+ 位置:
+ <%= link_to User.current, user_path(User.current.id), :class => 'sy_cgrey', :target => '_blank' %>
+ >
+ <%= link_to '课程', user_courselist_user_path(User.current.id), :class => "sy_cgrey", :target => '_blank' %>
+ >
+ <%= link_to @syllabus.title, syllabus_path(@syllabus.id), :class => "sy_cgrey" %>
+
+
+
+
+
+ <%=render :partial => 'layouts/syllabus_info' %>
+
+
+
+
+
+ <%= yield %>
+
+
+
+ <%= render :partial => 'layouts/syllabus_base_info', :locals => {:syllabus => @syllabus} %>
+
+
+ <%= render :partial => 'layouts/syllabus_teacher_list', :locals => {:syllabus => @syllabus} %>
+
+
+
+
+
+
+
+<%= render :partial => 'layouts/footer' %>
+
+
+
+
+ <%= l(:label_loading) %>
+
+
+
+
diff --git a/app/views/layouts/base_users_new.html.erb b/app/views/layouts/base_users_new.html.erb
index c1f6a5644..976de8235 100644
--- a/app/views/layouts/base_users_new.html.erb
+++ b/app/views/layouts/base_users_new.html.erb
@@ -298,6 +298,7 @@
+
<%= render :partial => 'layouts/new_feedback' %>
diff --git a/app/views/layouts/new_base.html.erb b/app/views/layouts/new_base.html.erb
index e9703a943..d28171f5f 100644
--- a/app/views/layouts/new_base.html.erb
+++ b/app/views/layouts/new_base.html.erb
@@ -59,7 +59,9 @@
<%= render :partial => 'layouts/footer' %>
-<%= render :partial => 'layouts/new_feedback' %>
+<% if hidden_unproject_infos %>
+ <%= render :partial => 'layouts/new_feedback' %>
+<% end %>
<%= l(:label_loading) %>
diff --git a/app/views/layouts/new_base_user.html.erb b/app/views/layouts/new_base_user.html.erb
index 2d927b6fe..1127288ae 100644
--- a/app/views/layouts/new_base_user.html.erb
+++ b/app/views/layouts/new_base_user.html.erb
@@ -159,9 +159,7 @@
- <% hidden_courses = Setting.find_by_name("hidden_courses") %>
- <% unvisiable = hidden_courses && hidden_courses.value == "1"%>
- <% if !unvisiable %>
+ <% if hidden_unproject_infos %>
<%= link_to '班级',{:controller => "users", :action => "user_courselist", :id => @user.id}, :id => "user_course_list" %>
@@ -224,7 +222,9 @@
<%= yield %>
- <%= render :partial => 'layouts/new_feedback' %>
+ <% if hidden_unproject_infos %>
+ <%= render :partial => 'layouts/new_feedback' %>
+ <% end %>
<%= render :partial => 'layouts/footer' %>
diff --git a/app/views/layouts/new_base_user_show.html.erb b/app/views/layouts/new_base_user_show.html.erb
index a1b911d09..a0e335938 100644
--- a/app/views/layouts/new_base_user_show.html.erb
+++ b/app/views/layouts/new_base_user_show.html.erb
@@ -152,9 +152,7 @@
- <% hidden_courses = Setting.find_by_name("hidden_courses") %>
- <% unvisiable = hidden_courses && hidden_courses.value == "1"%>
- <% if !unvisiable %>
+ <% if hidden_unproject_infos %>
课程
@@ -233,7 +231,9 @@
<%= yield %>
- <%= render :partial => 'layouts/forbidden_new_feedback' %>
+ <% if hidden_unproject_infos %>
+ <%= render :partial => 'layouts/forbidden_new_feedback' %>
+ <% end %>
<%= render :partial => 'layouts/footer_show' %>
diff --git a/app/views/messages/_course_show.html.erb b/app/views/messages/_course_show.html.erb
index 760e0ea24..95c9b7df1 100644
--- a/app/views/messages/_course_show.html.erb
+++ b/app/views/messages/_course_show.html.erb
@@ -42,7 +42,6 @@
- <% if @topic.author.id == User.current.id %>
<%= link_to(
l(:button_edit),
@@ -59,7 +58,6 @@
:class => 'postOptionLink'
) if @message.course_destroyable_by?(User.current) %>
- <% end %>
<%= link_to "发送", "javascript:void(0);", :onclick => "show_send(#{@message.id}, #{User.current.id}, 'message');", :class => "postOptionLink" %>
diff --git a/app/views/messages/_project_show.html.erb b/app/views/messages/_project_show.html.erb
index 92474b6c5..d39761bcc 100644
--- a/app/views/messages/_project_show.html.erb
+++ b/app/views/messages/_project_show.html.erb
@@ -104,19 +104,20 @@
-
-
- <%= link_to(l(:button_edit), {:action => 'edit', :id => @topic}, :class => 'postOptionLink') if @message.editable_by?(User.current) %>
-
- <% if @topic.author.id == User.current.id %>
-
- <%= link_to(l(:button_delete), {:action => 'destroy', :id => @topic},:method => :post,
- :data => {:confirm => l(:text_are_you_sure)},
- :class => 'postOptionLink'
- ) if @message.destroyable_by?(User.current) %>
-
+
+ <%= link_to(l(:button_edit), {:action => 'edit', :id => @topic}, :class => 'postOptionLink') if @message.editable_by?(User.current) %>
+
+
+ <%= link_to(l(:button_delete), {:action => 'destroy', :id => @topic},:method => :post,
+ :data => {:confirm => l(:text_are_you_sure)},
+ :class => 'postOptionLink'
+ ) if @message.destroyable_by?(User.current) %>
+
+ <% if hidden_unproject_infos %>
+ <%= link_to "发送", "javascript:void(0);", :onclick => "show_send(#{@message.id},#{User.current.id},'message');", :class => 'postOptionLink' %>
+ <% else %>
+ <%= link_to "发送", "javascript:void(0);", :onclick => "show_send_hidden(#{@message.id},#{User.current.id},'message');", :class => 'postOptionLink' %>
<% end %>
- <%= link_to "发送", "javascript:void(0);", :onclick => "show_send(#{@message.id},#{User.current.id},'message');", :class => 'postOptionLink' %>
@@ -199,7 +200,7 @@
:class => 'fr mr20 undis',
:data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete)
- ) if reply.course_destroyable_by?(User.current) %>
+ ) if reply.destroyable_by?(User.current) %>
diff --git a/app/views/news/_course_show.html.erb b/app/views/news/_course_show.html.erb
index c8068e425..7fb6bad7f 100644
--- a/app/views/news/_course_show.html.erb
+++ b/app/views/news/_course_show.html.erb
@@ -82,7 +82,7 @@
- <%= render :partial => 'news/news_all_replies' %>
+ <%= render :partial => 'news/news_all_replies', :locals => {:object => @course} %>
\ No newline at end of file
diff --git a/app/views/users/_courses_list.html.erb b/app/views/users/_courses_list.html.erb
index ab6c8ff81..d79215f9a 100644
--- a/app/views/users/_courses_list.html.erb
+++ b/app/views/users/_courses_list.html.erb
@@ -10,7 +10,7 @@
diff --git a/app/views/users/_message_replies.html.erb b/app/views/users/_message_replies.html.erb
index 673fae303..669aea26c 100644
--- a/app/views/users/_message_replies.html.erb
+++ b/app/views/users/_message_replies.html.erb
@@ -33,7 +33,7 @@
:title => l(:button_reply)) %>
- <% if comment.course_destroyable_by?(User.current) %>
+ <% if comment.course_destroyable_by?(User.current) || comment.destroyable_by?(User.current) %>
<%= link_to(
l(:button_delete),
delete_board_message_path(comment,:board_id =>comment.board.id, :user_activity_id => user_activity_id, :activity_id => activity_id, :is_course => is_course, :is_board => is_board),
diff --git a/app/views/users/_news_replies.html.erb b/app/views/users/_news_replies.html.erb
index 5ab4ec031..138efd16e 100644
--- a/app/views/users/_news_replies.html.erb
+++ b/app/views/users/_news_replies.html.erb
@@ -56,8 +56,9 @@
:title => l(:button_reply)) %>
- <%= link_to('删除', {:controller => 'comments', :action => 'destroy', :id=>activity_id, :comment_id => comment, :user_activity_id => user_activity_id},
- :id => "delete_reply_#{activity_id}_#{comment.id}",:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "fr mr20 undis", :title => l(:button_delete)) if News.find(activity_id).author == User.current %>
+ <% news = News.find(activity_id) %>
+ <%= link_to('删除', {:controller => 'comments', :action => 'destroy', :id => activity_id, :comment_id => comment, :user_activity_id => user_activity_id},
+ :id => "delete_reply_#{activity_id}_#{comment.id}",:remote => true, :confirm => l(:text_are_you_sure), :method => 'delete', :class => "fr mr20 undis", :title => l(:button_delete)) if (User.current.allowed_to?(:manage_news, news.course) || User.current.allowed_to?(:manage_news, news.project)) %>
<% elsif type == 'Issue' %>
<%= link_to(
diff --git a/app/views/users/_project_issue.html.erb b/app/views/users/_project_issue.html.erb
index 7b3509f2c..131354df0 100644
--- a/app/views/users/_project_issue.html.erb
+++ b/app/views/users/_project_issue.html.erb
@@ -80,7 +80,7 @@
<%# 局部刷新:修改xissue属性 %>
- <% if User.current.member_of?(activity.project) %>
+ <% if User.current.member_of?(activity.project) && !activity.nil? && !activity.status.nil? %>
<% unless params[:action] == "index" %>
<%= render :partial => 'users/project_issue_detail', :locals => {:activity => activity} %>
diff --git a/app/views/users/_project_message.html.erb b/app/views/users/_project_message.html.erb
index afc45efde..5ee3ff0ba 100644
--- a/app/views/users/_project_message.html.erb
+++ b/app/views/users/_project_message.html.erb
@@ -68,7 +68,11 @@
) if activity.destroyable_by?(User.current) %>
<% end %>
-
<%= link_to "发送", "javascript:void(0);", :onclick => "show_send(#{activity.id}, #{User.current.id}, 'message');", :class => "postOptionLink" %>
+ <% if hidden_unproject_infos %>
+
<%= link_to "发送", "javascript:void(0);", :onclick => "show_send(#{activity.id}, #{User.current.id}, 'message');", :class => "postOptionLink" %>
+ <% else %>
+
<%= link_to "发送", "javascript:void(0);", :onclick => "show_send_hidden(#{activity.id}, #{User.current.id}, 'message');", :class => "postOptionLink" %>
+ <% end %>
diff --git a/app/views/users/_project_news.html.erb b/app/views/users/_project_news.html.erb
index 4c7ec2b04..284f5b821 100644
--- a/app/views/users/_project_news.html.erb
+++ b/app/views/users/_project_news.html.erb
@@ -35,7 +35,12 @@
<% if User.current.logged? %>
- <%= link_to("发送", 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}',#{User.current.id},'news')") %>
+ <% if hidden_unproject_infos %>
+ <%= link_to("发送", 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send('#{activity.id}',#{User.current.id},'news')") %>
+ <% else %>
+ <%= link_to("发送", 'javascript:void(0)',:class => "postOptionLink",:onclick=>"show_send_hidden('#{activity.id}',#{User.current.id},'news')") %>
+ <% end %>
+
<%= link_to(
l(:button_edit),
diff --git a/app/views/users/_resource_share_for_orgs.html.erb b/app/views/users/_resource_share_for_orgs.html.erb
index 36d1c774f..b5aafcb7e 100644
--- a/app/views/users/_resource_share_for_orgs.html.erb
+++ b/app/views/users/_resource_share_for_orgs.html.erb
@@ -4,11 +4,18 @@
<% unless send_ids.blank? %>
<% send_ids = send_ids.class == String ? send_ids : send_ids.join(",") %>
<% end %>
-
- 班级
- 项目
- 组织
-
+ <% if @hidden_unproject %>
+
+ 班级
+ 项目
+ 组织
+
+ <% else %>
+
+ 项目
+ 组织
+
+ <% end %>
<%= form_tag search_user_org_user_path(user, :type => @type),:method => 'get',
:remote=>true,:id=>'search_user_org_form' do %>
diff --git a/app/views/users/_resource_share_for_project_popup.html.erb b/app/views/users/_resource_share_for_project_popup.html.erb
index b521bcb90..41133a91e 100644
--- a/app/views/users/_resource_share_for_project_popup.html.erb
+++ b/app/views/users/_resource_share_for_project_popup.html.erb
@@ -5,11 +5,18 @@
<% unless send_ids.blank? %>
<% send_ids = send_ids.class == String ? send_ids : send_ids.join(",") %>
<% end %>
-
- 班级
- 项目
- 组织
-
+ <% if @hidden_unproject %>
+
+ 班级
+ 项目
+ 组织
+
+ <% else %>
+
+ 项目
+ 组织
+
+ <% end %>
diff --git a/app/views/users/_resources_list.html.erb b/app/views/users/_resources_list.html.erb
index 3f5138107..77a2386fe 100644
--- a/app/views/users/_resources_list.html.erb
+++ b/app/views/users/_resources_list.html.erb
@@ -87,6 +87,33 @@
}
+ function show_send_hidden(){
+ $("#contextMenu").hide();
+ document.oncontextmenu = function() {return true;}
+ line.children().css("background-color",'white');
+ id = line.children().last().html();
+ user_id = line.children().eq(5).html();
+ allow = line.children().eq(13).html();
+ if( allow == 0){
+ alert('您无权发送私有资源')
+ }else{
+ if (lastSendType === '2'){ //如果已经发送过一次了,那么就应该沿用上次发送的类型。
+ $.ajax({
+ type: 'get',
+ url: '<%= search_user_project_user_path(User.current.id) %>' + "?send_id=" + id + "&type=<%= @type %>",
+ data:{send_type:'file'}
+ });
+ }else{
+ $.ajax({
+ type: 'get',
+ url: '<%= search_user_project_user_path(User.current.id)%>' + "?send_id=" + id + "&type=<%= @type %>",
+ data:{send_type:'file'}
+ });
+ }
+ }
+
+ }
+
function batch_send(){
if($("#resources_list_form").serialize() == ""){
alert('暂时不支持多页选择,您当前页没有选择任何资源');
@@ -121,6 +148,35 @@
}
}
+// 隐藏非项目信息特用
+ function batch_send_hidden(){
+ if($("#resources_list_form").serialize() == ""){
+ alert('暂时不支持多页选择,您当前页没有选择任何资源');
+ return ;
+ }
+ if (lastSendType === '1'){
+ $.ajax({
+ type: 'get',
+ url: '<%= search_user_project_user_path(User.current.id) %>' + '?' + $("#resources_list_form").serialize() + "&type=<%= @type %>",
+ data:{send_type:'file'}
+ });
+ }else if (lastSendType === '2'){
+ $.ajax({
+ type: 'get',
+ url: '<%= search_user_org_user_path(User.current.id) %>' + '?' + $("#resources_list_form").serialize() + "&type=<%= @type %>",
+ data:{send_type:'file'}
+ });
+ }
+ else{
+ $.ajax({
+ type: 'get',
+ url: '<%= search_user_project_user_path(User.current.id)%>' + '?'+ $("#resources_list_form").serialize() + "&type=<%= @type %>",
+ data:{send_type:'file'}
+ });
+
+ }
+ }
+
function preview(){
$("#contextMenu").hide();
document.oncontextmenu = function() {return true;}
diff --git a/app/views/users/_selector_for_messages.html.erb b/app/views/users/_selector_for_messages.html.erb
index 3727e4a1d..1e2e40e06 100644
--- a/app/views/users/_selector_for_messages.html.erb
+++ b/app/views/users/_selector_for_messages.html.erb
@@ -3,6 +3,7 @@
+ <% if hidden_unproject_infos %>
课程消息
@@ -12,7 +13,7 @@
<%= link_to "班级问卷", user_message_path(User.current, :type => 'poll'), :class => "homepagePostTypeQuiz postTypeGrey" %>
-
+ <% end %>
+ <% if hidden_unproject_infos %>
@@ -34,7 +36,18 @@
<%= link_to "用户留言",user_message_path(User.current, :type => 'user_feedback'), :class => "homepageTypeUMessage postTypeGrey" %>
-
+ <% else %>
+
+
+ 更多
+ <%= link_to "所有消息",user_message_path(User.current), :class => "resourcesTypeAll postTypeGrey" %>
+ <%= link_to "未读消息", user_message_path(User.current, :type => 'unviewed'), :class => "homepageTypeUnread postTypeGrey" %>
+ <%= link_to "系统消息", user_system_messages_path(User.current, :type => 'system_messages'), :class => "homepageTypeSystem postTypeGrey" %>
+ <%= link_to "贴吧帖子", user_message_path(User.current, :type => 'forum'), :class => "homepageTypePost postTypeGrey" %>
+ <%= link_to "用户留言",user_message_path(User.current, :type => 'user_feedback'), :class => "homepageTypeUMessage postTypeGrey" %>
+
+
+ <% end %>
diff --git a/app/views/users/_send_part.html.erb b/app/views/users/_send_part.html.erb
new file mode 100644
index 000000000..b47386da8
--- /dev/null
+++ b/app/views/users/_send_part.html.erb
@@ -0,0 +1,12 @@
+<% if @hidden_unproject %>
+
+ 班级
+ 项目
+ 组织
+
+<% else %>
+
+ 项目
+ 组织
+
+<% end %>
\ No newline at end of file
diff --git a/app/views/users/_share_message_to_org.html.erb b/app/views/users/_share_message_to_org.html.erb
index 37575a8d5..8c1d81140 100644
--- a/app/views/users/_share_message_to_org.html.erb
+++ b/app/views/users/_share_message_to_org.html.erb
@@ -1,11 +1,18 @@
发送到
-
- 班级
- 项目
- 组织
-
+ <% if @hidden_unproject %>
+
+ 班级
+ 项目
+ 组织
+
+ <% else %>
+
+ 项目
+ 组织
+
+ <% end %>
<%= form_tag search_user_org_user_path(user),:method => 'get',
:remote=>true,:id=>'search_user_org_form' do %>
diff --git a/app/views/users/_share_message_to_project.html.erb b/app/views/users/_share_message_to_project.html.erb
index 89b36e22a..21abd85de 100644
--- a/app/views/users/_share_message_to_project.html.erb
+++ b/app/views/users/_share_message_to_project.html.erb
@@ -2,11 +2,18 @@
发送到
-
- 班级
- 项目
- 组织
-
+ <% if @hidden_unproject %>
+
+ 班级
+ 项目
+ 组织
+
+ <% else %>
+
+ 项目
+ 组织
+
+ <% end %>
diff --git a/app/views/users/_share_news_to_org.html.erb b/app/views/users/_share_news_to_org.html.erb
index 85d5e7104..c40e05199 100644
--- a/app/views/users/_share_news_to_org.html.erb
+++ b/app/views/users/_share_news_to_org.html.erb
@@ -1,11 +1,18 @@
发送到
-
- 班级
- 项目
- 组织
-
+ <% if @hidden_unproject %>
+
+ 班级
+ 项目
+ 组织
+
+ <% else %>
+
+ 项目
+ 组织
+
+ <% end %>
<%= form_tag search_user_org_user_path(user),:method => 'get',
:remote=>true,:id=>'search_user_org_form' do %>
diff --git a/app/views/users/_share_news_to_project.html.erb b/app/views/users/_share_news_to_project.html.erb
index d4c293304..c9c60198f 100644
--- a/app/views/users/_share_news_to_project.html.erb
+++ b/app/views/users/_share_news_to_project.html.erb
@@ -2,11 +2,18 @@
发送到
-
- 班级
- 项目
- 组织
-
+ <% if @hidden_unproject %>
+
+ 班级
+ 项目
+ 组织
+
+ <% else %>
+
+ 项目
+ 组织
+
+ <% end %>
diff --git a/app/views/users/_user_course_list.html.erb b/app/views/users/_user_course_list.html.erb
index 9013c41f4..f757b170b 100644
--- a/app/views/users/_user_course_list.html.erb
+++ b/app/views/users/_user_course_list.html.erb
@@ -23,7 +23,7 @@
:style => 'color:#000',:id => "show_course_#{course.id}", :target => '_blank', :title => (course.is_public? ? "公开班级:":"私有班级:")+course.name+"("+current_time_and_term(course)+")"%>
<% teacher = User.where("id=?",course.tea_id).first%>
- <%='主讲老师:'+(teacher.try(:realname) != " " ? teacher.lastname + teacher.firstname : teacher.try(:login)) %>
+ <%='创建老师:'+(teacher.try(:realname) != " " ? teacher.lastname + teacher.firstname : teacher.try(:login)) %>
diff --git a/app/views/users/_user_message_forge.html.erb b/app/views/users/_user_message_forge.html.erb
index d08396e16..09f399cc9 100644
--- a/app/views/users/_user_message_forge.html.erb
+++ b/app/views/users/_user_message_forge.html.erb
@@ -1,4 +1,4 @@
-<% if ma.class == ForgeMessage && ma.forge_message %>
+<% if ma.class == ForgeMessage %>
<% if ma.forge_message_type == "AppliedProject" %>
<% end %>
<% end %>
- <% if ma.forge_message_type == "Journal" %>
+ <% if ma.forge_message_type == "Journal" && ma.forge_message %>
<%=link_to image_tag(url_to_avatar(ma.forge_message.user), :width => "30", :height => "30"), user_path(ma.forge_message.user), :target => '_blank' %>
diff --git a/app/views/users/_user_resource_info.html.erb b/app/views/users/_user_resource_info.html.erb
index e00489193..d3b169a17 100644
--- a/app/views/users/_user_resource_info.html.erb
+++ b/app/views/users/_user_resource_info.html.erb
@@ -23,9 +23,15 @@
删除
-
+ <% if hidden_unproject_infos %>
+
+ <% else %>
+
+ <% end %>
选择 0 个资源
@@ -45,7 +51,11 @@
预览
重命名
-
发送
+ <% if hidden_unproject_infos %>
+
发送
+ <% else %>
+
发送
+ <% end %>
删除
diff --git a/app/views/users/_user_resource_type_filter.html.erb b/app/views/users/_user_resource_type_filter.html.erb
index 633e52472..2322c87cb 100644
--- a/app/views/users/_user_resource_type_filter.html.erb
+++ b/app/views/users/_user_resource_type_filter.html.erb
@@ -4,10 +4,12 @@
全部
-
- 班级资源
- <%#= link_to '课程资源' ,user_resource_user_path(:id => @user.id, :type => 2), id="resource_type_course", :remote => true, :method => 'get', :class=> 'homepagePostTypeAssignment postTypeGrey' %>
-
+ <% if hidden_unproject_infos %>
+
+ 班级资源
+ <%#= link_to '课程资源' ,user_resource_user_path(:id => @user.id, :type => 2), id="resource_type_course", :remote => true, :method => 'get', :class=> 'homepagePostTypeAssignment postTypeGrey' %>
+
+ <% end %>
项目资源
<%#= link_to '项目资源' ,user_resource_user_path(:id => @user.id, :type => 3), id="resource_type_project", :remote => true, :method => 'get', :class => 'homepagePostTypeQuiz postTypeGrey' %>
diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb
index 30fc85dc0..5ae593ddf 100644
--- a/app/views/users/show.html.erb
+++ b/app/views/users/show.html.erb
@@ -7,9 +7,7 @@
- <% hidden_courses = Setting.find_by_name("hidden_courses") %>
- <% unvisiable = hidden_courses && hidden_courses.value == "1"%>
- <% if !unvisiable %>
+ <% if hidden_unproject_infos %>
课程动态
<%= link_to "作业动态", {:controller => "users", :action => "show", :type => "course_homework"}, :class => "homepagePostTypeAssignment postTypeGrey"%>
diff --git a/app/views/users/user_resource.html.erb b/app/views/users/user_resource.html.erb
index ee2ea7e4f..6c0e067db 100644
--- a/app/views/users/user_resource.html.erb
+++ b/app/views/users/user_resource.html.erb
@@ -8,12 +8,6 @@
function remote_get_resources(user_id,type){
}
- $(document).ready(function(){
- $(".resource-switch").click(function(){
- $(".resource-switch").children().removeClass("resource-tab-active");
- $(this).children().addClass("resource-tab-active");
- });
- });
function remote_search(){
$("#resource_search_form").submit();
}
@@ -75,5 +69,10 @@
-
+
diff --git a/config/menu.yml.production b/config/menu.yml.production
index 55318e811..8929d002e 100644
--- a/config/menu.yml.production
+++ b/config/menu.yml.production
@@ -22,14 +22,6 @@ button:
-
name: "更多"
sub_button:
- -
- 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=join_class#wechat_redirect"
- -
- 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=join_project#wechat_redirect"
-
type: "view"
name: "历史推文"
diff --git a/config/menu.yml.test b/config/menu.yml.test
index 45e23aaf3..303b30c26 100644
--- a/config/menu.yml.test
+++ b/config/menu.yml.test
@@ -22,14 +22,6 @@ button:
-
name: "更多"
sub_button:
- -
- 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=join_class#wechat_redirect"
- -
- 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=join_project#wechat_redirect"
-
type: "view"
name: "历史推文"
diff --git a/config/wechat.yml.template b/config/wechat.yml.template
index adda8e7e8..8ca6ac237 100644
--- a/config/wechat.yml.template
+++ b/config/wechat.yml.template
@@ -25,6 +25,7 @@ default: &default
project_review_notice: "kdb-8UlMjTc3z51Qcf8g2vY4i_nE4OGKZAucdQma_2E"
join_project_notice: "TtXvy0XMIQyCgpnXHhoB8t-x0QIfy-78gAJXsGf9afg"
project_issue_notice: "HP8JejOnkzmvFopTarc0l1Tp4bU9qnxzdH27x3186lI"
+ at_notice: "U3kqzgriCaqkPI9qX0NDQOInJ5hiwHCz6wgTsPysSx4"
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="
diff --git a/config/wechat.yml.test b/config/wechat.yml.test
index 8c0dafc2f..12cee4751 100644
--- a/config/wechat.yml.test
+++ b/config/wechat.yml.test
@@ -25,6 +25,7 @@ default: &default
project_review_notice: "ip192wVXTav3qchgUn9_7B6lFfTlCZjwL7A1tncTOuc"
join_project_notice: "3KnMQEMUCmQWkB5JvzrpmguEwnN8bvUHUdpOTudxv_M"
project_issue_notice: "HAF2aCta7BtnaOd_cotGvU4tErGWwCd9I9aiClFN7w8"
+ at_notice: "p4HfyZQuF8O5bP_44RbbJS30SGojLJAuZEqp34iB4JU"
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="
diff --git a/db/migrate/20160511055221_merge_two_homeworks.rb b/db/migrate/20160511055221_merge_two_homeworks.rb
index a30bc983b..42aabbbd9 100644
--- a/db/migrate/20160511055221_merge_two_homeworks.rb
+++ b/db/migrate/20160511055221_merge_two_homeworks.rb
@@ -6,13 +6,17 @@ class MergeTwoHomeworks < ActiveRecord::Migration
work.update_column('homework_common_id', 3463)
end
end
- homework = HomeworkCommon.find 3387
- homework.destroy if homework
- stu_works = StudentWork.where("homework_common_id = 3387")
- stu_work_ids = stu_works.empty? ? "(-1)" : "(" + stu_works.map{|work| work.id}.join(',') + ")"
- stu_work_tests = StudentWorkTest.where("student_work_id in #{stu_work_ids}")
- stu_work_tests.destroy_all if stu_work_tests
- stu_works.destroy_all if stu_works
+ begin
+ homework = HomeworkCommon.find 3387
+ homework.destroy if homework
+ stu_works = StudentWork.where("homework_common_id = 3387")
+ stu_work_ids = stu_works.empty? ? "(-1)" : "(" + stu_works.map{|work| work.id}.join(',') + ")"
+ stu_work_tests = StudentWorkTest.where("student_work_id in #{stu_work_ids}")
+ stu_work_tests.destroy_all if stu_work_tests
+ stu_works.destroy_all if stu_works
+ rescue Exception => e
+ puts e
+ end
end
def down
diff --git a/public/assets/wechat/activities.html b/public/assets/wechat/activities.html
index 506dcc724..2d45f4d17 100644
--- a/public/assets/wechat/activities.html
+++ b/public/assets/wechat/activities.html
@@ -40,7 +40,7 @@
- 来源: {{act.course_project_name}}
+ 来源: {{act.course_project_name}}
赞
{{act.praise_count}}
@@ -75,7 +75,7 @@
- 来源: {{act.course_project_name}}
+ 来源: {{act.course_project_name}}
赞
{{act.praise_count}}
@@ -111,7 +111,7 @@
- 来源: {{act.course_project_name}}
+ 来源: {{act.course_project_name}}
赞
{{act.praise_count}}
@@ -147,7 +147,7 @@
- 来源: {{act.course_project_name}}
+ 来源: {{act.course_project_name}}
@@ -236,7 +236,7 @@
- 来源: {{act.course_project_name}}
+ 来源: {{act.course_project_name}}
赞
{{act.praise_count}}
@@ -272,7 +272,7 @@
- 来源: {{act.course_project_name}}
+ 来源: {{act.course_project_name}}
赞
{{act.praise_count}}
@@ -405,7 +405,7 @@
- 来源: {{act.course_project_name}}
+ 来源: {{act.course_project_name}}
赞
{{act.praise_count}}
@@ -440,7 +440,7 @@
- 来源: {{act.course_project_name}}
+ 来源: {{act.course_project_name}}
赞
{{act.praise_count}}
@@ -476,7 +476,7 @@
- 来源: {{act.course_project_name}}
+ 来源: {{act.course_project_name}}
赞
{{act.praise_count}}
@@ -492,6 +492,42 @@
+
+
+
+
+
+
+
+
{{act.author.real_name}}
+
+
+
+
{{act.latest_update}}
+
+
【问卷】{{act.subject|safeHtml}}
+
+
+
+
+
来源: {{act.course_project_name}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- 来源: {{act.course_project_name}}
+ 来源: {{act.course_project_name}}
赞
{{act.praise_count}}
@@ -572,7 +608,7 @@
- 来源: {{act.course_project_name}}
+ 来源: {{act.course_project_name}}
赞
{{act.praise_count}}
diff --git a/public/assets/wechat/app.html b/public/assets/wechat/app.html
index 5ab1dcb5a..fdd4d3276 100644
--- a/public/assets/wechat/app.html
+++ b/public/assets/wechat/app.html
@@ -40,6 +40,7 @@
+
diff --git a/public/assets/wechat/blog_detail.html b/public/assets/wechat/blog_detail.html
index daeec493d..570bfb797 100644
--- a/public/assets/wechat/blog_detail.html
+++ b/public/assets/wechat/blog_detail.html
@@ -1,6 +1,14 @@
+
@@ -25,7 +33,7 @@
{{blog.praise_count}}
{{blog.praise_count}}
-
-
+
+
+
赞
+
{{journal.praise_count}}
+
{{journal.praise_count}}
+
diff --git a/public/assets/wechat/class.html b/public/assets/wechat/class.html
index 9b69916c8..f81b4f5f0 100644
--- a/public/assets/wechat/class.html
+++ b/public/assets/wechat/class.html
@@ -1,277 +1,282 @@
-
-
-
{{course.name}} 邀请码
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
{{act.author.real_name}}
-
-
-
-
{{act.latest_update}}
-
-
【作业】{{act.subject|safeHtml}}
-
-
-
迟交扣分:{{act.homework_common_detail.late_penalty}}分 匿评开启时间:{{act.homework_common_detail.evaluation_start}}
-
缺评扣分:{{act.homework_common_detail.absence_penalty}}分/作品 匿评关闭时间:{{act.homework_common_detail.evaluation_end}}
-
-
-
-
-
-
赞
-
{{act.praise_count}}
-
{{act.praise_count}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
{{act.author.real_name}}
-
-
-
-
{{act.latest_update}}
-
-
【通知】{{act.subject|safeHtml}}
-
-
-
-
-
-
赞
-
{{act.praise_count}}
-
{{act.praise_count}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
{{act.author.real_name}}
-
-
-
-
{{act.latest_update}}
-
-
【帖子】{{act.subject|safeHtml}}
-
-
-
-
-
-
-
赞
-
{{act.praise_count}}
-
{{act.praise_count}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
{{act.author.real_name}}
-
-
-
-
{{act.latest_update}}
-
-
【问卷】{{act.subject|safeHtml}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
{{act.author.real_name}} 创建了{{act.course_project_name}} | 班级
-
{{act.latest_update}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
{{r.filename}} 发送
-
暂无课件,
- 请登录Trustie网站,在PC浏览器中上传课件。
-
-
-
授课老师
-
-
-
{{teacher.name}}
-
-
管理员
-
助教
-
-
-
-
-
{{reviewer.name}}
-
待审批 ▶
-
-
-
-
-
我的同学
-
-
-
-
-
{{r.homework_name}} 发送
-
暂无作业,
- 请登录Trustie网站,在PC浏览器中上传作业。
-
-
-
-
-
{{r.exercise_name}} 发送
-
暂无测验,
- 请登录Trustie网站,在PC浏览器中上传测验。
-
-
-
-
+
+
+
{{course.name}} 邀请码
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{{act.author.real_name}}
+
+
+
+
{{act.latest_update}}
+
+
【作业】{{act.subject|safeHtml}}
+
+
+
迟交扣分:{{act.homework_common_detail.late_penalty}}分 匿评开启时间:{{act.homework_common_detail.evaluation_start}}
+
缺评扣分:{{act.homework_common_detail.absence_penalty}}分/作品 匿评关闭时间:{{act.homework_common_detail.evaluation_end}}
+
+
+
+
+
+
赞
+
{{act.praise_count}}
+
{{act.praise_count}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{{act.author.real_name}}
+
+
+
+
{{act.latest_update}}
+
+
【通知】{{act.subject|safeHtml}}
+
+
+
+
+
+
赞
+
{{act.praise_count}}
+
{{act.praise_count}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{{act.author.real_name}}
+
+
+
+
{{act.latest_update}}
+
+
【帖子】{{act.subject|safeHtml}}
+
+
+
+
+
+
+
赞
+
{{act.praise_count}}
+
{{act.praise_count}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{{act.author.real_name}}
+
+
+
+
{{act.latest_update}}
+
+
【问卷】{{act.subject|safeHtml}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{{act.author.real_name}} 创建了{{act.course_project_name}} | 班级
+
{{act.latest_update}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{{r.filename}} 发送
+
暂无课件,
+ 请登录Trustie网站,在PC浏览器中上传课件。
+
+
+
授课老师
+
+
+
{{teacher.name}}
+
+
管理员
+
助教
+
+
+
+
+
{{reviewer.name}}
+
待审批 ▶
+
+
+
+
+
我的同学
+
+
+
+
+
+
+
{{r.homework_name}} 发送
+
暂无作业,
+ 请登录Trustie网站,在PC浏览器中上传作业。
+
+
+
+
+
{{r.exercise_name}} 发送
+
暂无测验,
+ 请登录Trustie网站,在PC浏览器中上传测验。
+
+
+
+
+
diff --git a/public/assets/wechat/course_discussion.html b/public/assets/wechat/course_discussion.html
index 7c822bde4..a3f6ae496 100644
--- a/public/assets/wechat/course_discussion.html
+++ b/public/assets/wechat/course_discussion.html
@@ -1,6 +1,14 @@
+
@@ -24,7 +32,7 @@
{{discussion.praise_count}}
{{discussion.praise_count}}
-
-
+
+
+
赞
+
{{journal.praise_count}}
+
{{journal.praise_count}}
+
diff --git a/public/assets/wechat/course_notice.html b/public/assets/wechat/course_notice.html
index af9f22da1..33e8e77be 100644
--- a/public/assets/wechat/course_notice.html
+++ b/public/assets/wechat/course_notice.html
@@ -1,6 +1,14 @@
+
@@ -23,7 +31,7 @@
{{news.praise_count}}
{{news.praise_count}}
-
-
+
+
+
赞
+
{{journal.praise_count}}
+
{{journal.praise_count}}
+
diff --git a/public/assets/wechat/edit_class_member.html b/public/assets/wechat/edit_class_member.html
index f27ab76cb..d06eba89b 100644
--- a/public/assets/wechat/edit_class_member.html
+++ b/public/assets/wechat/edit_class_member.html
@@ -1,19 +1,24 @@
-
-
-
-
角色变更
-
{{current_edit_member.user.realname == "" ? current_edit_member.user.name : current_edit_member.user.realname}}
-
角色
-
-
-
-
-
-
+
+
+
+
成员管理
+
{{current_edit_member.user.realname == "" ? current_edit_member.user.name : current_edit_member.user.realname}}
+
角色变更
+
+
删除成员
+
+
+
+
+
+
+
diff --git a/public/assets/wechat/edit_project_member.html b/public/assets/wechat/edit_project_member.html
index 51294f43e..eb15b074a 100644
--- a/public/assets/wechat/edit_project_member.html
+++ b/public/assets/wechat/edit_project_member.html
@@ -1,21 +1,25 @@
-
-
-
-
角色变更
-
{{current_edit_member.user.real_name == "" ? current_edit_member.user.name : current_edit_member.user.real_name}}
-
角色
-
-
-
-
-
-
-
-
+
+
+
+
成员管理
+
{{current_edit_member.user.real_name == "" ? current_edit_member.user.name : current_edit_member.user.real_name}}
+
角色变更
+
+
删除成员
+
+
+
+
+
+
+
+
diff --git a/public/assets/wechat/homework_detail.html b/public/assets/wechat/homework_detail.html
index 6ead09e69..bf2a89f35 100644
--- a/public/assets/wechat/homework_detail.html
+++ b/public/assets/wechat/homework_detail.html
@@ -1,6 +1,14 @@
+
@@ -28,7 +36,7 @@
{{homework.praise_count}}
{{homework.praise_count}}
-
-
+
+
+
赞
+
{{journal.praise_count}}
+
{{journal.praise_count}}
+
diff --git a/public/assets/wechat/issue_detail.html b/public/assets/wechat/issue_detail.html
index c10d15ddb..5b55ebba0 100644
--- a/public/assets/wechat/issue_detail.html
+++ b/public/assets/wechat/issue_detail.html
@@ -1,6 +1,14 @@
+
@@ -29,7 +37,7 @@
{{issue.praise_count}}
{{issue.praise_count}}
-
-
+
+
+
赞
+
{{journal.praise_count}}
+
{{journal.praise_count}}
+
diff --git a/public/assets/wechat/join_class.html b/public/assets/wechat/join_class.html
index b5733e584..ad43db3a7 100644
--- a/public/assets/wechat/join_class.html
+++ b/public/assets/wechat/join_class.html
@@ -13,6 +13,7 @@
提示
+ • 邀请码在创建班级时产生,请向班级老师获取
• 教师、助教角色需要班级管理员审批
• 学生角色无需管理员审批
diff --git a/public/assets/wechat/join_project.html b/public/assets/wechat/join_project.html
index 61be93cfd..fe8600999 100644
--- a/public/assets/wechat/join_project.html
+++ b/public/assets/wechat/join_project.html
@@ -12,6 +12,7 @@
提示
+ • 邀请码在创建项目时产生,请向项目管理员获取
• 管理人员、开发人员角色需要项目管理员审批
• 报告人员角色无需管理员审批
diff --git a/public/assets/wechat/jour_message_detail.html b/public/assets/wechat/jour_message_detail.html
index 41f7290e5..5b06a22aa 100644
--- a/public/assets/wechat/jour_message_detail.html
+++ b/public/assets/wechat/jour_message_detail.html
@@ -1,5 +1,13 @@
+
@@ -23,7 +31,7 @@
{{message.praise_count}}
{{message.praise_count}}
-
-
+
+
+
赞
+
{{journal.praise_count}}
+
{{journal.praise_count}}
+
diff --git a/public/assets/wechat/project.html b/public/assets/wechat/project.html
index 5b460ecad..89cbb1418 100644
--- a/public/assets/wechat/project.html
+++ b/public/assets/wechat/project.html
@@ -1,144 +1,148 @@
-
-
-
{{project.name}} 邀请码
-
-
-
-
-
-
-
-
-
-
-
-
-
{{act.author.real_name}}
-
-
-
-
{{act.latest_update}}
-
-
【问题】{{act.subject|safeHtml}}
-
-
-
状态:{{act.issue_detail.issue_status}} 优先级:{{act.issue_detail.issue_priority}}
-
指派给:{{act.issue_detail.issue_assigned_to}} 完成度:{{act.issue_detail.done_ratio}}%
-
-
-
-
-
-
赞
-
{{act.praise_count}}
-
{{act.praise_count}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
{{act.author.real_name}}
-
-
-
-
{{act.latest_update}}
-
-
【帖子】{{act.subject|safeHtml}}
-
-
-
-
-
-
赞
-
{{act.praise_count}}
-
{{act.praise_count}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
{{act.author.real_name}} 创建了{{act.course_project_name}} | 项目
-
{{act.latest_update}}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
管理人员({{project_master_members.length}})
-
-
{{master.user.real_name == "" ? master.user.name : master.user.real_name }}
-
-
-
-
-
{{user.real_name == "" ? user.name : user.real_name }}
-
待审批 ▶
-
-
-
-
开发人员({{project_develop_members.length}})
-
-
{{develop.user.real_name == "" ? develop.user.name : develop.user.real_name}}
-
-
-
-
-
{{user.real_name == "" ? user.name : user.real_name}}
-
待审批 ▶
-
-
-
报告人员({{project_report_members.length}})
-
-
{{report.user.real_name == "" ? report.user.name : report.user.real_name}}
-
-
-
-
-
-
-
+
+
+
{{project.name}} 邀请码
+
+
+
+
+
+
+
+
+
+
+
+
+
{{act.author.real_name}}
+
+
+
+
{{act.latest_update}}
+
+
【问题】{{act.subject|safeHtml}}
+
+
+
状态:{{act.issue_detail.issue_status}} 优先级:{{act.issue_detail.issue_priority}}
+
指派给:{{act.issue_detail.issue_assigned_to}} 完成度:{{act.issue_detail.done_ratio}}%
+
+
+
+
+
+
赞
+
{{act.praise_count}}
+
{{act.praise_count}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{{act.author.real_name}}
+
+
+
+
{{act.latest_update}}
+
+
【帖子】{{act.subject|safeHtml}}
+
+
+
+
+
+
赞
+
{{act.praise_count}}
+
{{act.praise_count}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{{act.author.real_name}} 创建了{{act.course_project_name}} | 项目
+
{{act.latest_update}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
管理人员({{project_master_members.length}})
+
+
{{master.user.real_name == "" ? master.user.name : master.user.real_name }}
+
+
+
+
+
{{user.real_name == "" ? user.name : user.real_name }}
+
待审批 ▶
+
+
+
+
开发人员({{project_develop_members.length}})
+
+
{{develop.user.real_name == "" ? develop.user.name : develop.user.real_name}}
+
+
+
+
+
{{user.real_name == "" ? user.name : user.real_name}}
+
待审批 ▶
+
+
+
报告人员({{project_report_members.length}})
+
+
{{report.user.real_name == "" ? report.user.name : report.user.real_name}}
+
+
+
+
+
+
+
+
+
diff --git a/public/assets/wechat/project_discussion.html b/public/assets/wechat/project_discussion.html
index 4557ba55f..e0ee87d78 100644
--- a/public/assets/wechat/project_discussion.html
+++ b/public/assets/wechat/project_discussion.html
@@ -1,6 +1,14 @@
+
@@ -24,7 +32,7 @@
{{discussion.praise_count}}
{{discussion.praise_count}}
-
-
+
+
+
赞
+
{{journal.praise_count}}
+
{{journal.praise_count}}
+
diff --git a/public/images/syllabus/icons_syllabus.png b/public/images/syllabus/icons_syllabus.png
index 4afdb729f..3b81336c4 100644
Binary files a/public/images/syllabus/icons_syllabus.png and b/public/images/syllabus/icons_syllabus.png differ
diff --git a/public/javascripts/application.js b/public/javascripts/application.js
index d527f6b0e..5f1194273 100644
--- a/public/javascripts/application.js
+++ b/public/javascripts/application.js
@@ -1153,6 +1153,31 @@ function show_send(id, user_id, send_type){
}
}
+//为了隐藏非项目功能
+//var sendType = '1';
+var lastSendType ;//初始为发送到我的项目
+function show_send_hidden(id, user_id, send_type){
+ if (lastSendType === '1'){ //如果已经发送过一次了,那么就应该沿用上次发送的类型。
+ $.ajax({
+ type: 'get',
+ url: '/users/' + user_id + '/search_user_project',
+ data:{send_id:id, send_type:send_type}
+ });
+ }else if( lastSendType == '2'){//组织
+ $.ajax({
+ type: 'get',
+ url: '/users/' + user_id + '/search_user_org',
+ data:{send_id:id, send_type:send_type}
+ });
+ }else{
+ $.ajax({
+ type: 'get',
+ url: '/users/' + user_id + '/search_user_project',
+ data:{send_id:id, send_type:send_type}
+ });
+ }
+}
+
//id 发送的id
//发送的id数组
//send_type:发送的类型,file对应文件,message对应帖子,news对应通知或新闻
@@ -1216,6 +1241,30 @@ function chooseSendType2(res_id,res_ids, user_id, send_type, type){
lastSendType = sendType;
}
+//隐藏项目其它信息特用
+function chooseSendType2hidden(res_id,res_ids, user_id, send_type, type){
+ console.log(res_ids);
+ sendType = $(".resourcesSendType").val();
+ if (sendType === lastSendType) {
+ return;
+ } else if(lastSendType != null) { //不是第一次点击的时候
+ if (sendType == '1') {
+ $.ajax({
+ type: 'get',
+ url: '/users/' + user_id + '/search_user_project' + '?' + "&type=" + type,
+ data:{send_id:res_id, send_ids:res_ids ,send_type:send_type}
+ });
+ }else if(sendType == '2'){
+ $.ajax({
+ type: 'get',
+ url: '/users/' + user_id + '/search_user_org' + '?' + "&type=" + type,
+ data:{send_id:res_id, send_ids:res_ids, send_type:send_type}
+ });
+ }
+ }
+ lastSendType = sendType;
+}
+
//组织新建和配置中,选择组织为私有后,disbled掉允许游客下载选项
function disable_down(source, des, hint){
if (source.attr("checked")){
diff --git a/public/javascripts/wechat/controllers/activity.js b/public/javascripts/wechat/controllers/activity.js
index 25ced0a17..c5a18e2f6 100644
--- a/public/javascripts/wechat/controllers/activity.js
+++ b/public/javascripts/wechat/controllers/activity.js
@@ -126,14 +126,14 @@ app.controller('ActivityController',
}
break;
}
- rms.save("tab_num",$scope.currentTab);
+ rms.save("activity_tab_num",$scope.currentTab);
}
- $scope.currentTab = rms.get('tab_num') || 1;
+ $scope.currentTab = rms.get('activity_tab_num') || 1;
if($scope.activities.length<=0){
- $scope.loadActData('tab_num',0);
+ $scope.loadActData($scope.currentTab,0);
} else {
$timeout(function(){
window.scrollTo(0, rms.get("yoffset"));
@@ -200,4 +200,40 @@ app.controller('ActivityController',
common.decreaseCommonPraise(act);
};
+
+
+ $scope.goClass = function(id){
+ rms.save("activities",[]);
+ rms.save("course_activities",[]);
+ rms.save("project_activities",[]);
+
+ rms.save('course_activities_page',0);
+ rms.save("course_has_more",false);
+ rms.save("course",null);
+ rms.save("tab_num",null);
+
+ rms.save("has_more",false);
+ rms.save("project_has_more",false);
+
+ $location.path("/class").search({id: id});
+ };
+
+ $scope.goProject = function(id){
+ rms.save("activities",[]);
+ rms.save("course_activities",[]);
+ rms.save("project_activities",[]);
+ rms.save('project_activities_page',0);
+ rms.save("project_has_more",false);
+ rms.save("project",null);
+ rms.save("project_master_members",[]);
+ rms.save("project_develop_members",[]);
+ rms.save("project_report_members",[]);
+ rms.save("review_master_members",[]);
+ rms.save("review_develop_members",[]);
+ rms.save('tab_num',null);
+ rms.save("has_more",false);
+ rms.save("course_has_more",false);
+
+ $location.path("/project").search({id: id});
+ };
}]);
\ No newline at end of file
diff --git a/public/javascripts/wechat/controllers/blog.js b/public/javascripts/wechat/controllers/blog.js
index 21c1cf345..d14156b1a 100644
--- a/public/javascripts/wechat/controllers/blog.js
+++ b/public/javascripts/wechat/controllers/blog.js
@@ -11,6 +11,11 @@ app.controller('BlogController',
loadCallback: function(data){
console.log(data.data);
+ if(data.status == -1){
+ $scope.showtip = true;
+ return;
+ }
+
//回复级别 0 一级回复 1 二级回复
replytype = data.type;
page = data.page;
diff --git a/public/javascripts/wechat/controllers/class.js b/public/javascripts/wechat/controllers/class.js
index a6fb0feed..1e9fbcb0e 100644
--- a/public/javascripts/wechat/controllers/class.js
+++ b/public/javascripts/wechat/controllers/class.js
@@ -23,10 +23,11 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location
}).then(function successCallback(response) {
console.log(response.data);
if(response.data.status == 0){
- vm.class_activities_page = response.data.page;
+ vm.course_activities_page = response.data.page;
if(response.data.page > 0)
{
vm.course_activities = vm.course_activities.concat(response.data.data);
+ vm.course_has_more = (response.data.count + response.data.page * 10) < response.data.all_count;
}
else{
vm.course_activities = response.data.data;
@@ -177,6 +178,8 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location
vm.myresource_sendIndex = rms.get('myresource_sendIndex') || 1;
vm.alertService = alertService.create();
+ //双弹框
+ vm.alertService_2 = alertService.create();
vm.invite = function(){
rms.save('course_activities_page',vm.course_activities_page);
@@ -244,6 +247,7 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location
vm.onSetting = function(user){
rms.save('current_edit_member', user);
+ rms.save("course",vm.course);
rms.save("tab_num",vm.currentTab);
$location.path("/edit_class_member").search({id: courseid,user_id: user.id});
};
@@ -251,6 +255,7 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location
vm.review = function(user){
rms.save('current_review_member', user);
rms.save('current_course', vm.course);
+ rms.save("course",vm.course);
rms.save("tab_num",vm.currentTab);
$location.path("/review_class_member").search({id: courseid,user_id: user.id});
};
@@ -323,6 +328,35 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location
rms.save("course",vm.course);
// $location.path('/'+type+'/'+act_id);
$location.path("/homework").search({id: id});
- }
+ };
+
+ vm.quit = function(){
+ vm.alertService_2.showMessage('提示', "是否确认退出班级",function(){
+ $http({
+ method: 'POST',
+ url: apiUrl + "courses/" + courseid+"/quit",
+ data:{token:auth.token()}
+ }).then(function successCallback(response) {
+ console.log(response.data);
+ if(response.data.status == 0){
+ vm.alertService.showMessage('提示', response.data.message,function(){
+ //确定
+ rms.save('course_activities_page',0);
+ rms.save("course_activities",[]);
+ rms.save("course_has_more",false);
+ rms.save("course",null);
+ rms.save("tab_num",null);
+ rms.save('syllabuses',[]);
+ $location.path("/class_list");
+ });
+ }
+ else{
+ vm.alertService.showMessage('提示', response.data.message);
+ }
+ });
+ });
+
+ };
+
}]);
\ No newline at end of file
diff --git a/public/javascripts/wechat/controllers/class_publishissue.js b/public/javascripts/wechat/controllers/class_publishissue.js
index 1cd7f1285..09b995bea 100644
--- a/public/javascripts/wechat/controllers/class_publishissue.js
+++ b/public/javascripts/wechat/controllers/class_publishissue.js
@@ -55,7 +55,7 @@ app.controller('ClassPublishIssueController', ['$scope', '$http', 'auth', 'confi
).then(function(response){
if(response.data.status == 0)
{
- vm.alertService.showMessage('提示', '您已成功发布问题',function(){
+ vm.alertService.showMessage('提示', '发布成功',function(){
rms.save('course_activities_page',0);
rms.save("course_activities",[]);
rms.save("course_has_more",false);
diff --git a/public/javascripts/wechat/controllers/class_publishnotice.js b/public/javascripts/wechat/controllers/class_publishnotice.js
index a0b9ab676..b900305c1 100644
--- a/public/javascripts/wechat/controllers/class_publishnotice.js
+++ b/public/javascripts/wechat/controllers/class_publishnotice.js
@@ -55,7 +55,7 @@ app.controller('ClassPublishNoticeController', ['$scope', '$http', 'auth', 'conf
).then(function(response){
if(response.data.status == 0)
{
- vm.alertService.showMessage('提示', '您已成功发布通知',function(){
+ vm.alertService.showMessage('提示', '发布成功',function(){
rms.save('course_activities_page',0);
rms.save("course_activities",[]);
rms.save("course_has_more",false);
diff --git a/public/javascripts/wechat/controllers/course_notice.js b/public/javascripts/wechat/controllers/course_notice.js
index 48ec19889..571078735 100644
--- a/public/javascripts/wechat/controllers/course_notice.js
+++ b/public/javascripts/wechat/controllers/course_notice.js
@@ -10,6 +10,11 @@ app.controller('CourseNoticeController', ['$scope', '$http', '$routeParams', 'au
loadCallback: function(data){
console.log(data.data);
+ if(data.status == -1){
+ $scope.showtip = true;
+ return;
+ }
+
//回复级别 0 一级回复 1 二级回复
replytype = data.type;
page = data.page;
diff --git a/public/javascripts/wechat/controllers/discussion.js b/public/javascripts/wechat/controllers/discussion.js
index 21e842d0f..5f6c098e7 100644
--- a/public/javascripts/wechat/controllers/discussion.js
+++ b/public/javascripts/wechat/controllers/discussion.js
@@ -9,6 +9,11 @@ app.controller('DiscussionController', ['$scope', '$http', '$routeParams', 'auth
loadCallback: function(data){
console.log(data.data);
+ if(data.status == -1){
+ $scope.showtip = true;
+ return;
+ }
+
//回复级别 0 一级回复 1 二级回复
replytype = data.type;
page = data.page;
diff --git a/public/javascripts/wechat/controllers/edit_class_member.js b/public/javascripts/wechat/controllers/edit_class_member.js
index e00e36f20..d872dac09 100644
--- a/public/javascripts/wechat/controllers/edit_class_member.js
+++ b/public/javascripts/wechat/controllers/edit_class_member.js
@@ -9,6 +9,8 @@ app.controller('EditClassMemberController', ['$scope', '$http', 'auth', 'config'
vm.current_edit_member = null;
vm.alertService = alertService.create();
+ //双弹框
+ vm.alertService_2 = alertService.create();
var course_id = $routeParams.id;
var user_id = $routeParams.user_id;
@@ -21,6 +23,8 @@ app.controller('EditClassMemberController', ['$scope', '$http', 'auth', 'config'
vm.tmpassistant = false; //教辅
vm.tmpstudent = false; //学生
+ vm.buttongrey = true;
+
if(!vm.current_edit_member){
$http.post(config.apiUrl+'courses/get_member_info', {
@@ -29,7 +33,9 @@ app.controller('EditClassMemberController', ['$scope', '$http', 'auth', 'config'
user_id:user_id
}).then(function(response){
if(response.data.status!=0){
- vm.alertService.showMessage('提示', response.data.message);
+ vm.alertService.showMessage('提示', response.data.message,function(){
+ $location.path("/class").search({id: course_id,tag:1});
+ });
} else {
console.log(response);
course_id = response.data.course_id;
@@ -62,36 +68,69 @@ app.controller('EditClassMemberController', ['$scope', '$http', 'auth', 'config'
window.history.back();
};
- vm.edit_member_role = function(){
- if((vm.teacher == vm.tmpteacher)&& (vm.assistant == vm.tmpassistant)&&(vm.student == vm.tmpstudent)){
- vm.alertService.showMessage('提示', "该用户当前已是该角色");
- return;
- }
+ vm.deleteMember = function(user_id){
+ vm.alertService_2.showMessage('提示', "是否确认删除成员",function(){
+ $http({
+ method: 'POST',
+ url: apiUrl + "courses/" + course_id+"/deletemember",
+ data:{token:auth.token(),user_id:user_id}
+ }).then(function successCallback(response) {
+ console.log(response.data);
- if((vm.teacher == false)&& (vm.assistant == false)&&(vm.student == false)){
- vm.alertService.showMessage('提示', "请至少选择一种角色");
- return;
- }
+ if(response.data.status == 0){
+ vm.alertService.showMessage('提示', response.data.message,function(){
+ //确定
+ $location.path("/class").search({id: course_id,tag:1});
+ });
+ }
+ else{
+ vm.alertService.showMessage('提示', response.data.message);
+ }
- $http.post(config.apiUrl+'courses/edit_member_role', {
- token: auth.token(),
- id: course_id,
- user_id:vm.current_edit_member.user.id,
- teacher_flag:vm.teacher,
- assistant_flag:vm.assistant,
- student_flag:vm.student
- }).then(function(response){
- if(response.data.status!=0){
- vm.alertService.showMessage('提示', response.data.message);
- } else {
- vm.alertService.showMessage('提示', '修改角色成功', function(){
-// window.history.back();
- $location.path("/class").search({id: course_id,tag:1});
- });
- }
+ });
});
};
+ vm.edit_member_role = function(){
+ if(vm.buttongrey == true){
+ return;
+ }
+
+ if(vm.current_edit_member.show){
+ //删除成员
+ vm.deleteMember(vm.current_edit_member.user.id);
+ }
+ else{
+ if((vm.teacher == vm.tmpteacher)&& (vm.assistant == vm.tmpassistant)&&(vm.student == vm.tmpstudent)){
+ vm.alertService.showMessage('提示', "该用户当前已是该角色");
+ return;
+ }
+
+ if((vm.teacher == false)&& (vm.assistant == false)&&(vm.student == false)){
+ vm.alertService.showMessage('提示', "请至少选择一种角色");
+ return;
+ }
+
+ $http.post(config.apiUrl+'courses/edit_member_role', {
+ token: auth.token(),
+ id: course_id,
+ user_id:vm.current_edit_member.user.id,
+ teacher_flag:vm.teacher,
+ assistant_flag:vm.assistant,
+ student_flag:vm.student
+ }).then(function(response){
+ if(response.data.status!=0){
+ vm.alertService.showMessage('提示', response.data.message);
+ } else {
+ vm.alertService.showMessage('提示', '修改角色成功', function(){
+// window.history.back();
+ $location.path("/class").search({id: course_id,tag:1});
+ });
+ }
+ });
+ }
+ };
+
vm.selectRole = function(role_id){
if (role_id == 7){
if(!vm.teacher){
@@ -106,6 +145,28 @@ app.controller('EditClassMemberController', ['$scope', '$http', 'auth', 'config'
else if (role_id == 10){
vm.student = !vm.student;
}
- }
+
+ if((vm.teacher == vm.tmpteacher)&& (vm.assistant == vm.tmpassistant)&&(vm.student == vm.tmpstudent)){
+ vm.buttongrey = true;
+ }
+ else{
+ vm.buttongrey = false;
+ }
+
+ if((vm.teacher == false)&& (vm.assistant == false)&&(vm.student == false)){
+ vm.buttongrey = true;
+ }
+
+ };
+
+ vm.clickChangeRole = function(){
+ vm.current_edit_member.show = !vm.current_edit_member.show;
+ if((vm.teacher == vm.tmpteacher)&& (vm.assistant == vm.tmpassistant)&&(vm.student == vm.tmpstudent)){
+ vm.buttongrey = true;
+ }
+ else{
+ vm.buttongrey = false;
+ }
+ };
}] );
\ No newline at end of file
diff --git a/public/javascripts/wechat/controllers/edit_project_member.js b/public/javascripts/wechat/controllers/edit_project_member.js
index 511db35bb..b8ecb447d 100644
--- a/public/javascripts/wechat/controllers/edit_project_member.js
+++ b/public/javascripts/wechat/controllers/edit_project_member.js
@@ -10,9 +10,14 @@ app.controller('EditProjectMemberController', ['$scope', '$http', 'auth', 'confi
vm.current_edit_member = null;
vm.alertService = alertService.create();
+ //双弹框
+ vm.alertService_2 = alertService.create();
var project_id = $routeParams.id;
var user_id = $routeParams.user_id;
+
+ vm.buttongrey = true;
+
if(!vm.current_edit_member){
$http.post(config.apiUrl+'projects/get_member_info', {
token: auth.token(),
@@ -20,7 +25,20 @@ app.controller('EditProjectMemberController', ['$scope', '$http', 'auth', 'confi
user_id:user_id
}).then(function(response){
if(response.data.status!=0){
- vm.alertService.showMessage('提示', response.data.message);
+ vm.alertService.showMessage('提示', response.data.message,function(){
+ rms.save('project_activities_page',0);
+ rms.save("project_activities",[]);
+ rms.save("project_has_more",false);
+ rms.save("project",null);
+ rms.save("project_master_members",[]);
+ rms.save("project_develop_members",[]);
+ rms.save("project_report_members",[]);
+ rms.save("review_master_members",[]);
+ rms.save("review_develop_members",[]);
+ rms.save('tab_num',null);
+// window.history.back();
+ $location.path("/project").search({id: project_id,tag:1});
+ });
} else {
project_id = response.data.project_id;
user_id = response.data.user_id;
@@ -40,42 +58,104 @@ app.controller('EditProjectMemberController', ['$scope', '$http', 'auth', 'confi
window.history.back();
};
+ vm.deleteMember = function(user_id){
+ vm.alertService_2.showMessage('提示', "是否确认删除成员",function(){
+ $http({
+ method: 'POST',
+ url: apiUrl + "projects/" + project_id+"/deletemember",
+ data:{token:auth.token(),user_id:user_id}
+ }).then(function successCallback(response) {
+ console.log(response.data);
+
+ if(response.data.status == 0){
+ vm.alertService.showMessage('提示', response.data.message,function(){
+ //确定
+ rms.save('project_activities_page',0);
+ rms.save("project_activities",[]);
+ rms.save("project_has_more",false);
+ rms.save("project",null);
+ rms.save("project_master_members",[]);
+ rms.save("project_develop_members",[]);
+ rms.save("project_report_members",[]);
+ rms.save("review_master_members",[]);
+ rms.save("review_develop_members",[]);
+ rms.save('tab_num',null);
+// window.history.back();
+ $location.path("/project").search({id: project_id,tag:1});
+
+ });
+ }
+ else{
+ vm.alertService.showMessage('提示', response.data.message);
+ }
+
+ });
+
+ });
+ };
+
vm.edit_member_role = function(){
- if(vm.current_roles_id == vm.current_edit_member.roles_id){
- vm.alertService.showMessage('提示', "该用户当前已是该角色");
+ if(vm.buttongrey == true){
return;
}
- $http.post(config.apiUrl+'projects/edit_member_role', {
- token: auth.token(),
- id: project_id,
- user_id:vm.current_edit_member.user.id,
- role_id:vm.current_edit_member.roles_id
- }).then(function(response){
- if(response.data.status!=0){
- vm.alertService.showMessage('提示', response.data.message);
- } else {
- vm.alertService.showMessage('提示', '修改角色成功', function(){
- rms.save('project_activities_page',0);
- rms.save("project_activities",[]);
- rms.save("project_has_more",false);
- rms.save("project",null);
- rms.save("project_master_members",[]);
- rms.save("project_develop_members",[]);
- rms.save("project_report_members",[]);
- rms.save("review_master_members",[]);
- rms.save("review_develop_members",[]);
- rms.save('tab_num',null);
-// window.history.back();
- $location.path("/project").search({id: project_id,tag:1});
- });
+ if(vm.current_edit_member.show){
+ //删除成员
+ vm.deleteMember(vm.current_edit_member.user.id);
+ }
+ else{
+ if(vm.current_roles_id == vm.current_edit_member.roles_id){
+ vm.alertService.showMessage('提示', "该用户当前已是该角色");
+ return;
}
- });
+ $http.post(config.apiUrl+'projects/edit_member_role', {
+ token: auth.token(),
+ id: project_id,
+ user_id:vm.current_edit_member.user.id,
+ role_id:vm.current_edit_member.roles_id
+ }).then(function(response){
+ if(response.data.status!=0){
+ vm.alertService.showMessage('提示', response.data.message);
+ } else {
+ vm.alertService.showMessage('提示', '修改角色成功', function(){
+ rms.save('project_activities_page',0);
+ rms.save("project_activities",[]);
+ rms.save("project_has_more",false);
+ rms.save("project",null);
+ rms.save("project_master_members",[]);
+ rms.save("project_develop_members",[]);
+ rms.save("project_report_members",[]);
+ rms.save("review_master_members",[]);
+ rms.save("review_develop_members",[]);
+ rms.save('tab_num',null);
+// window.history.back();
+ $location.path("/project").search({id: project_id,tag:1});
+ });
+ }
+ });
+ }
};
vm.selectRole = function(role_id){
vm.current_edit_member.roles_id = role_id;
- }
+
+ if(vm.current_roles_id == vm.current_edit_member.roles_id){
+ vm.buttongrey = true;
+ }
+ else{
+ vm.buttongrey = false;
+ }
+ };
+
+ vm.clickChangeRole = function(){
+ vm.current_edit_member.show = !vm.current_edit_member.show;
+ if(vm.current_roles_id == vm.current_edit_member.roles_id){
+ vm.buttongrey = true;
+ }
+ else{
+ vm.buttongrey = false;
+ }
+ };
}] );
\ No newline at end of file
diff --git a/public/javascripts/wechat/controllers/homework.js b/public/javascripts/wechat/controllers/homework.js
index f61f2be1d..381d04810 100644
--- a/public/javascripts/wechat/controllers/homework.js
+++ b/public/javascripts/wechat/controllers/homework.js
@@ -9,6 +9,11 @@ app.controller('HomeworkController', ['$scope', '$http', '$routeParams', 'auth',
loadCallback: function(data){
console.log(data.data);
+ if(data.status == -1){
+ $scope.showtip = true;
+ return;
+ }
+
//回复级别 0 一级回复 1 二级回复
replytype = data.type;
page = data.page;
diff --git a/public/javascripts/wechat/controllers/issue.js b/public/javascripts/wechat/controllers/issue.js
index 91db1d535..b580da465 100644
--- a/public/javascripts/wechat/controllers/issue.js
+++ b/public/javascripts/wechat/controllers/issue.js
@@ -9,6 +9,11 @@ app.controller('IssueController', ['$scope', '$http', '$routeParams', 'auth', 'c
loadCallback: function(data){
console.log(data.data);
+ if(data.status == -1){
+ $scope.showtip = true;
+ return;
+ }
+
//回复级别 0 一级回复 1 二级回复
replytype = data.type;
page = data.page;
diff --git a/public/javascripts/wechat/controllers/join_class.js b/public/javascripts/wechat/controllers/join_class.js
index 1a9710bc1..006fa0b59 100644
--- a/public/javascripts/wechat/controllers/join_class.js
+++ b/public/javascripts/wechat/controllers/join_class.js
@@ -21,7 +21,9 @@ app.controller('JoinClassController', ['$scope', '$http', 'auth', 'config', 'ale
// window.history.back();
// });
if(tag){
- window.history.back();
+ rms.save('syllabuses',[]);
+ $location.path("/class_list");
+// window.history.back();
}
else{
wx.closeWindow();
@@ -55,6 +57,7 @@ app.controller('JoinClassController', ['$scope', '$http', 'auth', 'config', 'ale
}).then(function(response){
if(response.data.status == 0){
vm.alertService.showMessage('提示', response.data.message,function(){
+ rms.save('syllabuses',[]);
$location.path("/class_list");
});
} else {
diff --git a/public/javascripts/wechat/controllers/join_project.js b/public/javascripts/wechat/controllers/join_project.js
index d942e8859..2e8f9a269 100644
--- a/public/javascripts/wechat/controllers/join_project.js
+++ b/public/javascripts/wechat/controllers/join_project.js
@@ -15,7 +15,9 @@ app.controller('JoinProjectController', ['$scope', '$http', 'auth', 'config', 'a
vm.cancel = function(){
if(tag){
- window.history.back();
+// window.history.back();
+ rms.save('projects',[]);
+ $location.path("/project_list");
}
else{
wx.closeWindow();
@@ -47,6 +49,7 @@ app.controller('JoinProjectController', ['$scope', '$http', 'auth', 'config', 'a
}).then(function(response){
if(response.data.status == 0){
vm.alertService.showMessage('提示', response.data.message,function(){
+ rms.save('projects',[]);
$location.path("/project_list");
});
} else {
diff --git a/public/javascripts/wechat/controllers/journals.js b/public/javascripts/wechat/controllers/journals.js
index 0570e695f..a768fe5fb 100644
--- a/public/javascripts/wechat/controllers/journals.js
+++ b/public/javascripts/wechat/controllers/journals.js
@@ -8,6 +8,11 @@ app.controller('JournalsController', ['$scope', '$http', '$routeParams', 'auth',
loadCallback: function(data){
console.log(data.data);
+ if(data.status == -1){
+ $scope.showtip = true;
+ return;
+ }
+
//回复级别 0 一级回复 1 二级回复
replytype = data.type;
page = data.page;
diff --git a/public/javascripts/wechat/controllers/project.js b/public/javascripts/wechat/controllers/project.js
index c45696668..7b93b891a 100644
--- a/public/javascripts/wechat/controllers/project.js
+++ b/public/javascripts/wechat/controllers/project.js
@@ -30,6 +30,8 @@ app.controller('ProjectController', ['$scope', 'config','$http','$timeout', 'aut
// vm.project_members_has_more = rms.get("project_members_has_more");
vm.alertService = alertService.create();
+ //双弹框
+ vm.alertService_2 = alertService.create();
//跳入邀请界面
vm.invite = function(){
@@ -61,6 +63,7 @@ app.controller('ProjectController', ['$scope', 'config','$http','$timeout', 'aut
if(response.data.page > 0)
{
vm.project_activities = vm.project_activities.concat(response.data.data);
+ vm.project_has_more = (response.data.count + response.data.page * 10) < response.data.all_count;
}
else{
vm.project_activities = response.data.data;
@@ -253,4 +256,38 @@ app.controller('ProjectController', ['$scope', 'config','$http','$timeout', 'aut
$location.path("/project_publishnote").search({id:projectid});
};
+ vm.quit = function(){
+ vm.alertService_2.showMessage('提示', "是否确认退出项目",function(){
+ $http({
+ method: 'POST',
+ url: apiUrl + "projects/" + projectid+"/quit",
+ data:{token:auth.token()}
+ }).then(function successCallback(response) {
+ console.log(response.data);
+ if(response.data.status == 0){
+ vm.alertService.showMessage('提示', response.data.message,function(){
+ //确定
+ rms.save('project_activities_page',0);
+ rms.save("project_activities",[]);
+ rms.save("project_has_more",false);
+ rms.save("project",null);
+ rms.save("project_master_members",[]);
+ rms.save("project_develop_members",[]);
+ rms.save("project_report_members",[]);
+ rms.save("review_master_members",[]);
+ rms.save("review_develop_members",[]);
+
+ rms.save('tab_num',null);
+ rms.save('projects',[]);
+ $location.path("/project_list");
+ });
+ }
+ else{
+ vm.alertService.showMessage('提示', response.data.message);
+ }
+ });
+ });
+
+ };
+
}]);
\ No newline at end of file
diff --git a/public/javascripts/wechat/controllers/project_publishnote.js b/public/javascripts/wechat/controllers/project_publishnote.js
index 231faaea6..f39b32827 100644
--- a/public/javascripts/wechat/controllers/project_publishnote.js
+++ b/public/javascripts/wechat/controllers/project_publishnote.js
@@ -56,7 +56,7 @@ app.controller('ProjectPublishNoteController', ['$scope', '$http', 'auth', 'conf
).then(function(response){
if(response.data.status == 0)
{
- vm.alertService.showMessage('提示', '您已成功发布帖子',function(){
+ vm.alertService.showMessage('提示', '发布成功',function(){
rms.save('project_activities_page',0);
rms.save("project_activities",[]);
rms.save("project_has_more",false);
diff --git a/public/javascripts/wechat/directives/iphone_recognize.js b/public/javascripts/wechat/directives/iphone_recognize.js
index 66014e71a..44fb5136a 100644
--- a/public/javascripts/wechat/directives/iphone_recognize.js
+++ b/public/javascripts/wechat/directives/iphone_recognize.js
@@ -7,21 +7,30 @@ app.directive('iphoneRecognize',["$timeout",function(timer){
scope: {},
link: function(scope, element){
timer(function(){
- var userAgent = navigator.userAgent;
var contentHeight = $(".post-container").height();
- if (/ipad|iphone|mac/i.test(navigator.userAgent)){
- $("#postInput1").bind('focus',function(){
- element.css({"position":"relative","padding":"1px 0"});
- $(".post-wrapper").css("margin-bottom","0");
- $("#all_homework_reply").css("margin-bottom","0");
- window.scrollTo(0,contentHeight);
- });
- $("#postInput1").bind('blur',function(){
- element.css("position","fixed");
- $(".post-wrapper").css("margin-bottom","10px");
- $("#all_homework_reply").css("margin-bottom","50px");
- });
- }
+ var toBottom = function(){
+ element.css({"position":"absolute","padding":"1px 0","marginBottom":"-50px"});
+ $(".post-wrapper").css({"marginBottom":"0","position":"relative"});
+ $("#all_homework_reply,#all_blog_reply,#all_course_message_reply,#all_message_reply").css("marginBottom","0");
+ window.scrollTo(0,contentHeight)
+ };
+ if (/ipad|iphone|mac/i.test(navigator.userAgent)){
+ $("#postInput1").bind('focus',function(){
+ setTimeout(function(){
+ toBottom();
+ },200);
+ });
+ $("#postInput1,#replyBlock").bind("click",function(){
+ setTimeout(function(){
+ toBottom();
+ },200);
+ });
+ $("#postInput1").bind('blur',function(){
+ element.css({"position":"fixed","marginBottom":"0"});
+ $(".post-wrapper").css({"marginBottom":"10px","position":""});
+ $("#all_homework_reply,#all_blog_reply,#all_course_message_reply,#all_message_reply").css("marginBottom","52px");
+ });
+ }
})
}
}
diff --git a/public/javascripts/wechat/directives/submit_start.js b/public/javascripts/wechat/directives/submit_start.js
new file mode 100644
index 000000000..cbdc469ab
--- /dev/null
+++ b/public/javascripts/wechat/directives/submit_start.js
@@ -0,0 +1,17 @@
+/**
+ * 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");
+ });
+ })
+ }
+ }
+}]);
diff --git a/public/javascripts/wechat/others/factory.js b/public/javascripts/wechat/others/factory.js
index 6d887282b..d4e365321 100644
--- a/public/javascripts/wechat/others/factory.js
+++ b/public/javascripts/wechat/others/factory.js
@@ -111,6 +111,7 @@ app.factory('common', ['$http', 'auth', '$routeParams','rms','config','wx','$loc
}
var temp = data.comment.replace(/\n/g,' ');
+ temp = temp.replace(/^\:[a-z0-9_]+\:$/g, "[表情]");
var userInfo = {
type: type,
@@ -225,6 +226,10 @@ app.factory('common', ['$http', 'auth', '$routeParams','rms','config','wx','$loc
var loadData = function(id,replytype,page){
loadCommonData(id, args.type,replytype,page).then(function successCallback(response) {
console.log(response.data);
+ if(response.data.status == -1){
+ args.loadCallback(response.data);
+ return;
+ }
//--------------分享内容定制-------------
var tmptile = "分享动态";
var imgUrl = "";
diff --git a/public/stylesheets/css/courses.css b/public/stylesheets/css/courses.css
index 163f33338..7d0e6c866 100644
--- a/public/stylesheets/css/courses.css
+++ b/public/stylesheets/css/courses.css
@@ -536,4 +536,7 @@ a:hover.blueCir{ background:#3598db; color:#fff;}
/*20160520作品列表table*/
.hwork-table-wrap {width:720px; border-collapse:collapse; vertical-align:middle; table-layout:fixed;}
-.hwork-table-wrap th {font-size:14px; color:#2d2d2d; border-bottom:1px solid #e1e1e1; text-align:center;}
\ No newline at end of file
+.hwork-table-wrap th {font-size:14px; color:#2d2d2d; border-bottom:1px solid #e1e1e1; text-align:center;}
+
+/*20160901作品信息确认*/
+#worksDescription p {word-wrap:break-word;}
\ No newline at end of file
diff --git a/public/stylesheets/css/public.css b/public/stylesheets/css/public.css
index 378fb3ba9..9565a9e26 100644
--- a/public/stylesheets/css/public.css
+++ b/public/stylesheets/css/public.css
@@ -116,6 +116,7 @@ a.resourcesTypeUser {background:url(../images/homepage_icon.png) -178px -453px n
.softwareIcon {background:url(/images/hwork_icon.png) -5px -254px no-repeat; padding-left:23px;}
/*意见反馈*/
+.qr-code-border {border:2px solid #269ac9;}
html{ overflow-x:hidden;}
.scrollsidebar{ position: fixed; bottom:1px; right:1px; background:none; }
.side_content{width:154px; height:auto; overflow:hidden; float:left; }
@@ -750,6 +751,7 @@ a:hover.st_add{ color:#ff8e15;}
.classbox_on{ border:1px solid #f8df8c; background:#f6f098; padding:0 3px; float:left; margin-left:15px;}
.classbox_on a{ color:#716cad;}
.st_list_score {width:105px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; float:left; vertical-align:middle; font-size:12px; text-align:center;}
+.st_info_block {width:150px; display:inline-block; vertical-align:bottom;}
/* 创建作品 homework,项目配置 */
.hwork_new{ color:#4c4c4c;}
@@ -1385,7 +1387,7 @@ a.content-username:hover{ color:#297fb8;}
.orig_index{ float:right; color:#666; font-family:Arial; padding-right:5px;line-height:30px;}
.orig_user{ margin:10px 15px 10px 5px;}
.orig_user span{ color:#999; padding-right:5px;}
-.orig_content{padding:5px 0px 5px 0px;line-height:24px; color:#333; }
+.orig_content{padding:5px 0px 5px 0px;line-height:24px; color:#333; word-wrap:break-word; }
.orig_content img {max-width:100%;}
.orig_right{ width:80%; margin-top:5px;}
a.comment_ding_link{ height:24px;line-height:24px;display:inline-block;padding-left:2px;vertical-align:middle; color:#333; }
diff --git a/public/stylesheets/css/structure.css b/public/stylesheets/css/structure.css
index 729bf2f4a..31464673e 100644
--- a/public/stylesheets/css/structure.css
+++ b/public/stylesheets/css/structure.css
@@ -455,8 +455,8 @@ a.topnav_login_box:hover {color:#a1ebff;}
/*底部*/
#Footer{background-color:#ffffff; padding-bottom:15px; color:#666666;} /*margin-bottom:10px;*/
-.footerAboutContainer {width:auto; border-bottom:1px solid #efefef;}
-.footerAbout{ width:365px; margin:0 auto;height:35px; line-height:35px; padding-top: 10px;}
+.footerAboutContainer {width:auto; border-bottom:1px solid #efefef; text-align:center;}
+.footerAbout{margin:0 auto;height:35px; line-height:35px; padding-top: 10px; display:inline-block;}
.languageBox {width:55px; height:20px; margin-left:5px; outline:none; color:#666666; border:1px solid #d9d9d9;}
.departments{ width:855px; margin:5px auto;height:40px;line-height:40px;}
.departments li {height:40px; line-height:40px;}
@@ -499,7 +499,7 @@ a.user_leftinfo_img { display:block; width:80px; height:80px; margin:15px auto;}
.user_leftnav{ width:240px;}
.users_accordion li > a {
display: block;
- padding: 0 10px 0 32px;
+ padding: 0 25px 0 32px;
height:49px;
line-height:49px;
color: #333;
diff --git a/public/stylesheets/syllabus.css b/public/stylesheets/syllabus.css
index d6e7c19e9..f6a8e8e6e 100644
--- a/public/stylesheets/syllabus.css
+++ b/public/stylesheets/syllabus.css
@@ -74,8 +74,8 @@ input.syllabus_input_min{
/*课程大纲-课程列表*/
.icon_course{ background: url(../images/syllabus/icons_syllabus.png) 0 -35px no-repeat; width:18px; height:15px; display:block;}
-.icons_sy_open{background: url(../images/syllabus/icons_syllabus.png) 0 -53px no-repeat; width:20px; height:23px; display:block; cursor:pointer; }
-.icons_sy_close{background: url(../images/syllabus/icons_syllabus.png) -26px -53px no-repeat; width:20px; height:23px; display:block; }
+.icons_sy_open{background: url(../images/syllabus/icons_syllabus.png) 0 -50px no-repeat; width:20px; height:23px; display:block; cursor:pointer; }
+.icons_sy_close{background: url(../images/syllabus/icons_syllabus.png) -26px -52px no-repeat; width:20px; height:23px; display:block; }
.syllabus_courses_box {position:relative;}
.icons_sy_setting{background: url(../images/syllabus/icons_syllabus.png) -51px -33px no-repeat; width:20px; height:20px; display:block; position:absolute; right:10px; top:10px; }
.icons_sy_setting:hover{background: url(../images/syllabus/icons_syllabus.png) -25px -33px no-repeat; }
@@ -113,12 +113,13 @@ a.syllabus_class_title{ font-size:14px; color:#333; max-width:480px; margin-bott
/* 课程大纲头部 */
.sy_top{
background:#f5f5f5;
- width: 100%;
+ width: 1000px;
height: 138px;
+ margin: 0 auto;
}
.sy_top_con{
background: url(../images/sy/bg_sy.jpg) no-repeat;
- width: 1280px;
+ width: 1000px;
margin: 0 auto;
height: 108px;
text-align:center;