|
|
|
@ -1617,12 +1617,12 @@ class UsersController < ApplicationController
|
|
|
|
|
@flag = true
|
|
|
|
|
if params[:send_id].present?
|
|
|
|
|
send_id = params[:send_id]
|
|
|
|
|
subfield_id = params[:subfield_id]
|
|
|
|
|
subfield_id = params[:subfield]
|
|
|
|
|
if subfield_id.nil?
|
|
|
|
|
@flag = false
|
|
|
|
|
end
|
|
|
|
|
ori = Attachment.find_by_id(send_id)
|
|
|
|
|
unless org_id.nil?
|
|
|
|
|
unless subfield_id.nil?
|
|
|
|
|
attach_copied_obj = ori.copy
|
|
|
|
|
attach_copied_obj.tag_list.add(ori.tag_list) # tag关联
|
|
|
|
|
attach_copied_obj.container = OrgSubfield.find(subfield_id)
|
|
|
|
@ -1635,33 +1635,31 @@ class UsersController < ApplicationController
|
|
|
|
|
end
|
|
|
|
|
elsif params[:send_ids].present?
|
|
|
|
|
send_ids = params[:send_ids].split(" ")
|
|
|
|
|
project_ids = params[:projects_ids]
|
|
|
|
|
if project_ids.nil?
|
|
|
|
|
subfield_id = params[:subfield]
|
|
|
|
|
if subfield_id.nil?
|
|
|
|
|
@flag = false
|
|
|
|
|
end
|
|
|
|
|
send_ids.each do |send_id|
|
|
|
|
|
|
|
|
|
|
ori = Attachment.find_by_id(send_id)
|
|
|
|
|
unless project_ids.nil?
|
|
|
|
|
project_ids.each do |project_id|
|
|
|
|
|
unless subfield_id.nil?
|
|
|
|
|
next if ori.blank?
|
|
|
|
|
attach_copied_obj = ori.copy
|
|
|
|
|
attach_copied_obj.tag_list.add(ori.tag_list) # tag关联
|
|
|
|
|
attach_copied_obj.container = Project.find(project_id)
|
|
|
|
|
attach_copied_obj.container = OrgSubfield.find(subfield_id)
|
|
|
|
|
attach_copied_obj.created_on = Time.now
|
|
|
|
|
attach_copied_obj.author_id = User.current.id
|
|
|
|
|
if attach_copied_obj.attachtype == nil
|
|
|
|
|
attach_copied_obj.attachtype = 1
|
|
|
|
|
end
|
|
|
|
|
attach_copied_obj.save
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
@flag=true
|
|
|
|
|
end
|
|
|
|
|
user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源
|
|
|
|
|
@attachments = Attachment.where("(author_id = #{params[:id]} and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
|
|
|
|
|
@attachments = Attachment.where("(author_id = #{params[:id]} and container_type in('Project','OrgSubfield','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) "+
|
|
|
|
|
"or (container_type = 'Course' and container_id in (#{user_course_ids.empty? ? '0': user_course_ids.join(',')}))").order("created_on desc")
|
|
|
|
|
@type = params[:type]
|
|
|
|
|
@limit = 25
|
|
|
|
|