修改《私有资源公共资源中不显示》
This commit is contained in:
parent
03d855f5d5
commit
200561da92
|
@ -1820,9 +1820,38 @@ class UsersController < ApplicationController
|
|||
else
|
||||
@flag = false
|
||||
end
|
||||
@order, @b_sort = params[:order] || "created_on", params[:sort] || "asc"
|
||||
@score = @b_sort == "desc" ? "asc" : "desc"
|
||||
user_project_ids = User.current.projects.map {|p| p.id}
|
||||
user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源
|
||||
@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")
|
||||
if(params[:type].blank? || params[:type] == "1") # 我的资源
|
||||
# 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源
|
||||
if params[:status] == "2"
|
||||
@attachments = get_course_resources(params[:id], user_course_ids, @order, @score)
|
||||
elsif params[:status] == "3"
|
||||
@attachments = get_project_resources(params[:id], user_project_ids, @order, @score)
|
||||
elsif params[:status] == "4"
|
||||
@attachments = get_attch_resources(params[:id], @order, @score)
|
||||
elsif params[:status] == "5"
|
||||
@attachments = get_principal_resources(params[:id], @order, @score)
|
||||
else
|
||||
# 公共资源库:所有公开资源或者我上传的私有资源
|
||||
@attachments = get_my_resources(params[:id], user_course_ids, user_project_ids, @order, @score)
|
||||
end
|
||||
elsif params[:type] == "6" # 公共资源
|
||||
if params[:status] == "2"
|
||||
@attachments = get_course_resources_public( user_course_ids, @order, @score)
|
||||
elsif params[:status] == "3"
|
||||
@attachments = get_project_resources_public(user_project_ids, @order, @score)
|
||||
elsif params[:status] == "4"
|
||||
@attachments = get_attch_resources_public(@order, @score)
|
||||
elsif params[:status] == "5"
|
||||
@attachments = get_principal_resources_public(@order, @score)
|
||||
else
|
||||
# 公共资源库:所有公开资源或者我上传的私有资源
|
||||
@attachments = get_public_resources(user_course_ids, user_project_ids, params[:order], @score)
|
||||
end
|
||||
end
|
||||
@type = params[:type]
|
||||
@limit = 25
|
||||
@path = user_resource_user_path(User.current, :type => @type)
|
||||
|
@ -1932,9 +1961,39 @@ class UsersController < ApplicationController
|
|||
else
|
||||
@flag=true
|
||||
end
|
||||
@order, @b_sort = params[:order] || "created_on", params[:sort] || "asc"
|
||||
@score = @b_sort == "desc" ? "asc" : "desc"
|
||||
user_project_ids = User.current.projects.map {|p| p.id}
|
||||
user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源
|
||||
@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")
|
||||
if(params[:type].blank? || params[:type] == "1") # 我的资源
|
||||
# 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源
|
||||
if params[:status] == "2"
|
||||
@attachments = get_course_resources(params[:id], user_course_ids, @order, @score)
|
||||
elsif params[:status] == "3"
|
||||
@attachments = get_project_resources(params[:id], user_project_ids, @order, @score)
|
||||
elsif params[:status] == "4"
|
||||
@attachments = get_attch_resources(params[:id], @order, @score)
|
||||
elsif params[:status] == "5"
|
||||
@attachments = get_principal_resources(params[:id], @order, @score)
|
||||
else
|
||||
# 公共资源库:所有公开资源或者我上传的私有资源
|
||||
@attachments = get_my_resources(params[:id], user_course_ids, user_project_ids, @order, @score)
|
||||
end
|
||||
elsif params[:type] == "6" # 公共资源
|
||||
if params[:status] == "2"
|
||||
@attachments = get_course_resources_public( user_course_ids, @order, @score)
|
||||
elsif params[:status] == "3"
|
||||
@attachments = get_project_resources_public(user_project_ids, @order, @score)
|
||||
elsif params[:status] == "4"
|
||||
@attachments = get_attch_resources_public(@order, @score)
|
||||
elsif params[:status] == "5"
|
||||
@attachments = get_principal_resources_public(@order, @score)
|
||||
else
|
||||
# 公共资源库:所有公开资源或者我上传的私有资源
|
||||
@attachments = get_public_resources(user_course_ids, user_project_ids, params[:order], @score)
|
||||
end
|
||||
end
|
||||
@status = params[:status]
|
||||
@type = params[:type]
|
||||
@limit = 25
|
||||
@path = user_resource_user_path(User.current, :type => @type)
|
||||
|
@ -2031,9 +2090,38 @@ class UsersController < ApplicationController
|
|||
else
|
||||
@flag=true
|
||||
end
|
||||
@order, @b_sort = params[:order] || "created_on", params[:sort] || "asc"
|
||||
@score = @b_sort == "desc" ? "asc" : "desc"
|
||||
user_project_ids = User.current.projects.map {|p| p.id}
|
||||
user_course_ids = User.current.courses.map { |c| c.id} #我的资源库的话,那么应该是我上传的所有资源 加上 我加入的课程的所有资源
|
||||
@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")
|
||||
if(params[:type].blank? || params[:type] == "1") # 我的资源
|
||||
# 修正:我的资源库的话,那么应该是我上传的所有资源加上,我加入的课程、项目、组织的所有资源
|
||||
if params[:status] == "2"
|
||||
@attachments = get_course_resources(params[:id], user_course_ids, @order, @score)
|
||||
elsif params[:status] == "3"
|
||||
@attachments = get_project_resources(params[:id], user_project_ids, @order, @score)
|
||||
elsif params[:status] == "4"
|
||||
@attachments = get_attch_resources(params[:id], @order, @score)
|
||||
elsif params[:status] == "5"
|
||||
@attachments = get_principal_resources(params[:id], @order, @score)
|
||||
else
|
||||
# 公共资源库:所有公开资源或者我上传的私有资源
|
||||
@attachments = get_my_resources(params[:id], user_course_ids, user_project_ids, @order, @score)
|
||||
end
|
||||
elsif params[:type] == "6" # 公共资源
|
||||
if params[:status] == "2"
|
||||
@attachments = get_course_resources_public( user_course_ids, @order, @score)
|
||||
elsif params[:status] == "3"
|
||||
@attachments = get_project_resources_public(user_project_ids, @order, @score)
|
||||
elsif params[:status] == "4"
|
||||
@attachments = get_attch_resources_public(@order, @score)
|
||||
elsif params[:status] == "5"
|
||||
@attachments = get_principal_resources_public(@order, @score)
|
||||
else
|
||||
# 公共资源库:所有公开资源或者我上传的私有资源
|
||||
@attachments = get_public_resources(user_course_ids, user_project_ids, params[:order], @score)
|
||||
end
|
||||
end
|
||||
@type = params[:type]
|
||||
@limit = 25
|
||||
@path = user_resource_user_path(User.current, :type => @type)
|
||||
|
|
Loading…
Reference in New Issue