@ -618,7 +618,7 @@ class UsersController < ApplicationController
end
if ( params [ :type ] . blank? || params [ :type ] == " 1 " ) #全部
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 " )
elsif params [ :type ] == " 2 " #课程资源
user_course_ids = User . current . courses . map { | c | c . id }
@ -1326,12 +1326,12 @@ class UsersController < ApplicationController
if ( params [ :type ] . blank? || params [ :type ] == " 1 " ) #全部
if User . current . id . to_i == params [ :id ] . to_i
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 " )
else
user_course_ids = User . find ( params [ :id ] ) . courses . visible . map { | c | c . id } #Ta的资源库的话, 应该是他上传的公开资源 加上 他加入的所有我可见课程里的公开资源
@attachments = Attachment . where ( " (author_id = #{ params [ :id ] } and is_public = 1 " +
" and container_type in('Project',' Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) " +
" and container_type in('Project',' OrgSubfield',' Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) " +
" or (container_type = 'Course' and is_public = 1 and container_id in ( #{ user_course_ids . empty? ? '0' : user_course_ids . join ( ',' ) } )) " ) . order ( " created_on desc " )
end
elsif params [ :type ] == " 2 " #课程资源
@ -1388,12 +1388,12 @@ class UsersController < ApplicationController
if ( params [ :type ] . nil? || params [ :type ] . blank? || params [ :type ] == " 1 " || params [ :type ] == 'all' ) #全部
if User . current . id . to_i == params [ :id ] . to_i
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 " )
else
user_course_ids = User . find ( params [ :id ] ) . courses . visible . map { | c | c . id } #Ta的资源库的话, 应该是他上传的公开资源 加上 他加入的所有我可见课程里的公开资源
@attachments = Attachment . where ( " (author_id = #{ params [ :id ] } and is_public = 1 " +
" and container_type in('Project',' Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) " +
" and container_type in('Project',' OrgSubfield',' Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) " +
" or (container_type = 'Course' and is_public = 1 and container_id in ( #{ user_course_ids . empty? ? '0' : user_course_ids . join ( ',' ) } )) " ) . order ( " created_on desc " )
end
elsif params [ :type ] == " 2 " #课程资源
@ -1529,7 +1529,7 @@ class UsersController < ApplicationController
@flag = false
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
@ -1597,7 +1597,7 @@ class UsersController < ApplicationController
@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
@ -1673,9 +1673,6 @@ class UsersController < ApplicationController
respond_to do | format |
format . js
end
respond_to do | format |
format . js
end
end
def change_org_subfield
@ -1894,12 +1891,12 @@ class UsersController < ApplicationController
if ( params [ :type ] . blank? || params [ :type ] == " 1 " ) #全部
if User . current . id . to_i == params [ :id ] . to_i
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 " )
else
user_course_ids = User . find ( params [ :id ] ) . courses . visible . map { | c | c . id } #Ta的资源库的话, 应该是他上传的公开资源 加上 他加入的所有我可见课程里的公开资源
@attachments = Attachment . where ( " (author_id = #{ params [ :id ] } and is_public = 1 " +
" and container_type in('Project',' Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) " +
" and container_type in('Project',' OrgSubfield',' Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon')) " +
" or (container_type = 'Course' and is_public = 1 and container_id in ( #{ user_course_ids . empty? ? '0' : user_course_ids . join ( ',' ) } )) " ) . order ( " created_on desc " )
end
elsif params [ :type ] == " 2 " #课程资源