@ -86,19 +86,20 @@ class FilesController < ApplicationController
else
else
@result = find_course_attache q , @course , sort
@result = find_course_attache q , @course , sort
@result = visable_attachemnts @result
@result = visable_attachemnts @result
# @searched_attach = paginateHelper @result,10
# @searched_attach = paginateHelper @result,10
@tag_list = get_course_tag_list @course
@tag_list = get_course_tag_list @course
end
end
@all_attachments = @result
@all_attachments = @result
get_attachment_for_tip ( @all_attachments )
@limit = 10
@limit = 10
@feedback_count = @all_attachments . count
@feedback_count = @all_attachments . count
@feedback_pages = Paginator . new @feedback_count , @limit , params [ 'page' ]
@feedback_pages = Paginator . new @feedback_count , @limit , params [ 'page' ]
@offset || = @feedback_pages . offset
@offset || = @feedback_pages . offset
#@curse_attachments_all = @all_attachments[@offset, @limit]
#@curse_attachments_all = @all_attachments[@offset, @limit]
@obj_attachments = paginateHelper @all_attachments , 10
@obj_attachments = paginateHelper @all_attachments , 10
#rescue Exception => e
#rescue Exception => e
# #render 'stores'
# #render 'stores'
# redirect_to search_course_files_url
# redirect_to search_course_files_url
end
end
end
end
@ -164,6 +165,7 @@ class FilesController < ApplicationController
end
end
@all_attachments = @project_attachment_result
@all_attachments = @project_attachment_result
get_attachment_for_tip ( @all_attachments )
@limit = 10
@limit = 10
@feedback_count = @all_attachments . count
@feedback_count = @all_attachments . count
@feedback_pages = Paginator . new @feedback_count , @limit , params [ 'page' ]
@feedback_pages = Paginator . new @feedback_count , @limit , params [ 'page' ]
@ -176,52 +178,52 @@ class FilesController < ApplicationController
end
end
end
end
def search_files_in_subfield
def search_files_in_subfield
sort = " "
sort = " "
@sort = " "
@sort = " "
@order = " "
@order = " "
@is_remote = true
@is_remote = true
@q = params [ :name ] . strip
@q = params [ :name ] . strip
if params [ :sort ]
if params [ :sort ]
order_by = params [ :sort ] . split ( " : " )
order_by = params [ :sort ] . split ( " : " )
@sort = order_by [ 0 ]
@sort = order_by [ 0 ]
if order_by . count > 1
if order_by . count > 1
@order = order_by [ 1 ]
@order = order_by [ 1 ]
end
sort = " #{ @sort } #{ @order } "
end
end
# show_attachments [@course]
sort = " #{ @sort } #{ @order } "
begin
end
q = " % #{ params [ :name ] . strip } % "
# show_attachments [@course]
#(redirect_to stores_url, :notice => l(:label_sumbit_empty);return) if params[:name].blank?
begin
if params [ :insite ]
q = " % #{ params [ :name ] . strip } % "
if q == " %% "
#(redirect_to stores_url, :notice => l(:label_sumbit_empty);return) if params[:name].blank?
@result = [ ]
if params [ :insite ]
@searched_attach = paginateHelper @result , 10
if q == " %% "
else
@result = [ ]
@result = find_public_attache q , sort
@searched_attach = paginateHelper @result , 10
@result = visable_attachemnts_insite @result , @org_subfield
@searched_attach = paginateHelper @result , 10
end
else
else
@result = find_ org_subfield_attache q , @org_subfield , sort
@result = find_public_attache q , sort
@result = visable_attachemnts @result
@result = visable_attachemnts_insite @result , @org_subfield
@searched_attach = paginateHelper @result , 10
@searched_attach = paginateHelper @result , 10
@tag_list = attachment_tag_list @result
end
end
#rescue Exception => e
else
# #render 'stores'
@result = find_org_subfield_attache q , @org_subfield , sort
# redirect_to search_course_files_url
@result = visable_attachemnts @result
@searched_attach = paginateHelper @result , 10
@tag_list = attachment_tag_list @result
end
end
@page = params [ :page ] || 1
#rescue Exception => e
# #render 'stores'
# redirect_to search_course_files_url
end
end
@page = params [ :page ] || 1
end
def find_course_attache keywords , course , sort = " "
def find_course_attache keywords , course , sort = " "
if sort == " "
if sort == " "
sort = " created_on DESC "
sort = " created_on DESC "
end
end
if keywords != " %% "
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
else
resultSet = Attachment . where ( " attachments.container_type = 'Course' And attachments.container_id = ' #{ course . id } ' " ) . reorder ( sort )
resultSet = Attachment . where ( " attachments.container_type = 'Course' And attachments.container_id = ' #{ course . id } ' " ) . reorder ( sort )
end
end
@ -250,7 +252,7 @@ class FilesController < ApplicationController
else
else
resultSet = Attachment . where ( " attachments.container_type = 'Project' And attachments.container_id = ' #{ project . id } ' " ) . reorder ( sort )
resultSet = Attachment . where ( " attachments.container_type = 'Project' And attachments.container_id = ' #{ project . id } ' " ) . reorder ( sort )
end
end
end
end
def find_public_attache keywords , sort = " "
def find_public_attache keywords , sort = " "
# StoresController#search 将每条文件都查出来,再次进行判断过滤。---> resultSet.to_a.map
# StoresController#search 将每条文件都查出来,再次进行判断过滤。---> resultSet.to_a.map
@ -260,7 +262,7 @@ class FilesController < ApplicationController
sort = " created_on DESC "
sort = " created_on DESC "
end
end
resultSet = Attachment . where ( " attachments.container_type IS NOT NULL AND attachments.copy_from IS NULL AND filename LIKE :like " , like : " % #{ keywords } % " ) .
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
end
def index
def index
@ -325,7 +327,7 @@ class FilesController < ApplicationController
@containers = [ Project . includes ( :attachments ) . reorder ( sort ) . find ( @project . id ) ]
@containers = [ Project . includes ( :attachments ) . reorder ( sort ) . find ( @project . id ) ]
show_attachments @containers
show_attachments @containers
# get_attachment_for_tip(@all_attachments )
get_attachment_for_tip ( @all_attachments )
@tag_list = attachment_tag_list @all_attachments
@tag_list = attachment_tag_list @all_attachments
@ -355,7 +357,7 @@ class FilesController < ApplicationController
when " quotes "
when " quotes "
attribute = " quotes "
attribute = " quotes "
else
else
attribute = " created_on "
attribute = " created_on "
end
end
@sort = order_by [ 0 ]
@sort = order_by [ 0 ]
@order = order_by [ 1 ]
@order = order_by [ 1 ]
@ -378,7 +380,7 @@ class FilesController < ApplicationController
@containers = [ Course . includes ( :attachments ) . reorder ( sort ) . find ( @course . id ) ]
@containers = [ Course . includes ( :attachments ) . reorder ( sort ) . find ( @course . id ) ]
show_attachments @containers
show_attachments @containers
# get_attachment_for_tip(@all_attachments )
get_attachment_for_tip ( @all_attachments )
@tag_list = attachment_tag_list @all_attachments
@tag_list = attachment_tag_list @all_attachments
@ -501,228 +503,228 @@ class FilesController < ApplicationController
end
end
def create
def create
if params [ :add_tag ]
if params [ :add_tag ]
@addTag = true
@addTag = true
#render :back
#render :back
tag_saveEx
tag_saveEx
#render :text =>"success"
#render :text =>"success"
respond_to do | format |
respond_to do | format |
format . js
format . js
end
end
else
else
#modify by nwb
#modify by nwb
if @project
if @project
@addTag = false
@addTag = false
if params [ :in_project_toolbar ]
if params [ :in_project_toolbar ]
@in_project_toolbar = params [ :in_project_toolbar ]
@in_project_toolbar = params [ :in_project_toolbar ]
end
end
attachments = Attachment . attach_filesex ( @project , params [ :attachments ] , params [ :attachment_type ] )
attachments = Attachment . attach_filesex ( @project , params [ :attachments ] , params [ :attachment_type ] )
if ! attachments . empty? && ! attachments [ :files ] . blank? && Setting . notified_events . include? ( 'file_added' )
if ! attachments . empty? && ! attachments [ :files ] . blank? && Setting . notified_events . include? ( 'file_added' )
# 发送邮件
# 发送邮件
Mailer . run . attachments_added ( attachments [ :files ] )
Mailer . run . attachments_added ( attachments [ :files ] )
# 生成动态
# 生成动态
attachments [ :files ] . each do | file |
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 " )
ForgeActivity . create ( :user_id = > User . current . id , :project_id = > @project . id , :forge_act_id = > file . id , :forge_act_type = > " Attachment " )
end
end
# 更新资源总数, 根据上传的附件数累加
# 更新资源总数, 根据上传的附件数累加
@project . project_score . update_attribute ( :attach_num , @project . project_score . attach_num + attachments [ :files ] . count ) unless @project . project_score . nil?
@project . project_score . update_attribute ( :attach_num , @project . project_score . attach_num + attachments [ :files ] . count ) unless @project . project_score . nil?
end
end
# end
# end
if params [ :project_attachment_type ] && params [ :project_attachment_type ] . is_a? ( Array )
if params [ :project_attachment_type ] && params [ :project_attachment_type ] . is_a? ( Array )
params [ :project_attachment_type ] . each do | type |
params [ :project_attachment_type ] . each do | type |
tag_name = get_project_tag_name_by_type_nmuber type
tag_name = get_project_tag_name_by_type_nmuber type
if ! attachments . empty? && attachments [ :files ] && tag_name != " "
if ! attachments . empty? && attachments [ :files ] && tag_name != " "
attachments [ :files ] . each do | attachment |
attachments [ :files ] . each do | attachment |
attachment . tag_list . add ( tag_name )
attachment . tag_list . add ( tag_name )
attachment . description = params [ :description ]
attachment . description = params [ :description ]
attachment . save
attachment . save
end
end
end
end
end
end
else
else
if params [ :project_attachment_type ] && params [ :project_attachment_type ] != " 6 "
if params [ :project_attachment_type ] && params [ :project_attachment_type ] != " 6 "
tag_name = get_project_tag_name_by_type_nmuber params [ :project_attachment_type ]
tag_name = get_project_tag_name_by_type_nmuber params [ :project_attachment_type ]
if ! attachments . empty? && attachments [ :files ] && tag_name != " "
if ! attachments . empty? && attachments [ :files ] && tag_name != " "
attachments [ :files ] . each do | attachment |
attachments [ :files ] . each do | attachment |
attachment . tag_list . add ( tag_name )
attachment . tag_list . add ( tag_name )
attachment . description = params [ :description ]
attachment . description = params [ :description ]
attachment . save
attachment . save
end
end
end
end
end
end
end
end
# TODO: 临时用 nyan
# TODO: 临时用 nyan
sort_init 'created_on' , 'desc'
sort_init 'created_on' , 'desc'
sort_update 'created_on' = > " #{ Attachment . table_name } .created_on " ,
sort_update 'created_on' = > " #{ Attachment . table_name } .created_on " ,
'filename' = > " #{ Attachment . table_name } .filename " ,
'filename' = > " #{ Attachment . table_name } .filename " ,
'size' = > " #{ Attachment . table_name } .filesize " ,
'size' = > " #{ Attachment . table_name } .filesize " ,
'downloads' = > " #{ Attachment . table_name } .downloads "
'downloads' = > " #{ Attachment . table_name } .downloads "
@containers = [ Project . includes ( :attachments ) . reorder ( " #{ Attachment . table_name } .created_on DESC " ) . find ( @project . id ) ]
@containers = [ Project . includes ( :attachments ) . reorder ( " #{ Attachment . table_name } .created_on DESC " ) . find ( @project . id ) ]
show_attachments @containers
show_attachments @containers
@tag_list = attachment_tag_list @all_attachments
@tag_list = attachment_tag_list @all_attachments
@attachtype = 0
@attachtype = 0
@contenttype = 0
@contenttype = 0
respond_to do | format |
respond_to do | format |
format . js
format . js
format . html {
format . html {
redirect_to project_files_url ( @project )
redirect_to project_files_url ( @project )
}
}
end
end
elsif @course
elsif @course
@addTag = false
@addTag = false
if params [ :in_course_toolbar ]
if params [ :in_course_toolbar ]
@in_course_toolbar = params [ :in_course_toolbar ]
@in_course_toolbar = params [ :in_course_toolbar ]
end
end
attachments = Attachment . attach_filesex ( @course , params [ :attachments ] , params [ :attachment_type ] )
attachments = Attachment . attach_filesex ( @course , params [ :attachments ] , params [ :attachment_type ] )
if ! attachments . empty? && ! attachments [ :files ] . blank? && Setting . notified_events . include? ( 'file_added' )
if ! attachments . empty? && ! attachments [ :files ] . blank? && Setting . notified_events . include? ( 'file_added' )
Mailer . run . attachments_added ( attachments [ :files ] )
Mailer . run . attachments_added ( attachments [ :files ] )
end
end
if ! attachments . empty? && attachments [ :files ]
if ! attachments . empty? && attachments [ :files ]
attachments [ :files ] . each do | attachment |
attachments [ :files ] . each do | attachment |
if params [ :publish_time ]
if params [ :publish_time ]
if params [ :publish_time ] == " "
if params [ :publish_time ] == " "
attachment . publish_time = Date . today
attachment . publish_time = Date . today
else
else
attachment . publish_time = params [ :publish_time ]
attachment . publish_time = params [ :publish_time ]
end
end
else
else
attachment . publish_time = Date . today
attachment . publish_time = Date . today
end
end
if attachment . publish_time > Date . today
if attachment . publish_time > Date . today
attachment . is_publish = 0
attachment . is_publish = 0
end
end
attachment . description = params [ :description ]
attachment . description = params [ :description ]
attachment . save
attachment . save
end
end
end
end
if params [ :course_attachment_type ] && params [ :course_attachment_type ] . is_a? ( Array )
if params [ :course_attachment_type ] && params [ :course_attachment_type ] . is_a? ( Array )
params [ :course_attachment_type ] . each do | type |
params [ :course_attachment_type ] . each do | type |
tag_name = get_tag_name_by_type_number type
tag_name = get_tag_name_by_type_number type
if ! attachments . empty? && attachments [ :files ] && tag_name != " "
if ! attachments . empty? && attachments [ :files ] && tag_name != " "
attachments [ :files ] . each do | attachment |
attachments [ :files ] . each do | attachment |
attachment . tag_list . add ( tag_name )
attachment . tag_list . add ( tag_name )
attachment . save
attachment . save
end
end
end
end
end
end
else
else
if params [ :course_attachment_type ] && params [ :course_attachment_type ] != " 5 "
if params [ :course_attachment_type ] && params [ :course_attachment_type ] != " 5 "
tag_name = get_tag_name_by_type_number params [ :course_attachment_type ]
tag_name = get_tag_name_by_type_number params [ :course_attachment_type ]
if ! attachments . empty? && attachments [ :files ] && tag_name != " "
if ! attachments . empty? && attachments [ :files ] && tag_name != " "
attachments [ :files ] . each do | attachment |
attachments [ :files ] . each do | attachment |
attachment . tag_list . add ( tag_name )
attachment . tag_list . add ( tag_name )
attachment . save
attachment . save
end
end
end
end
end
end
end
end
# 更新课程英雄榜得分
# 更新课程英雄榜得分
course_member_score ( @course . id , attachments [ :files ] . first . author_id , " Attachment " )
course_member_score ( @course . id , attachments [ :files ] . first . author_id , " Attachment " )
# end
# end
# end
# end
# TODO: 临时用 nyan
# TODO: 临时用 nyan
sort_init 'created_on' , 'desc'
sort_init 'created_on' , 'desc'
sort_update 'created_on' = > " #{ Attachment . table_name } .created_on " ,
sort_update 'created_on' = > " #{ Attachment . table_name } .created_on " ,
'filename' = > " #{ Attachment . table_name } .filename " ,
'filename' = > " #{ Attachment . table_name } .filename " ,
'size' = > " #{ Attachment . table_name } .filesize " ,
'size' = > " #{ Attachment . table_name } .filesize " ,
'downloads' = > " #{ Attachment . table_name } .downloads "
'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
show_attachments @containers
@tag_list = attachment_tag_list @all_attachments
@tag_list = attachment_tag_list @all_attachments
@attachtype = 0
@attachtype = 0
@contenttype = 0
@contenttype = 0
respond_to do | format |
respond_to do | format |
format . js
format . js
format . html {
format . html {
redirect_to course_files_url ( @course )
redirect_to course_files_url ( @course )
}
}
end
end
elsif @org_subfield
elsif @org_subfield
@addTag = false
@addTag = false
attachments = Attachment . attach_filesex ( @org_subfield , params [ :attachments ] , params [ :org_subfield_attachment_type ] )
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 )
if params [ :org_subfield_attachment_type ] && params [ :org_subfield_attachment_type ] . is_a? ( Array )
params [ :org_subfield_attachment_type ] . each do | type |
params [ :org_subfield_attachment_type ] . each do | type |
tag_name = get_tag_name_by_type_number type
tag_name = get_tag_name_by_type_number type
if ! attachments . empty? && attachments [ :files ] && tag_name != " "
if ! attachments . empty? && attachments [ :files ] && tag_name != " "
attachments [ :files ] . each do | attachment |
attachments [ :files ] . each do | attachment |
attachment . tag_list . add ( tag_name )
attachment . tag_list . add ( tag_name )
attachment . description = params [ :description ]
attachment . description = params [ :description ]
attachment . save
attachment . save
end
end
end
end
end
end
else
else
if params [ :org_subfield_attachment_type ] && params [ :org_subfield_attachment_type ] != " 5 "
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 ]
tag_name = get_tag_name_by_type_number params [ :org_subfield_attachment_type ]
if ! attachments . empty? && attachments [ :files ] && tag_name != " "
if ! attachments . empty? && attachments [ :files ] && tag_name != " "
attachments [ :files ] . each do | attachment |
attachments [ :files ] . each do | attachment |
attachment . tag_list . add ( tag_name )
attachment . tag_list . add ( tag_name )
attachment . description = params [ :description ]
attachment . description = params [ :description ]
attachment . save
attachment . save
end
end
end
end
end
end
end
end
# TODO: 临时用 nyan
# TODO: 临时用 nyan
sort_init 'created_on' , 'desc'
sort_init 'created_on' , 'desc'
sort_update 'created_on' = > " #{ Attachment . table_name } .created_on " ,
sort_update 'created_on' = > " #{ Attachment . table_name } .created_on " ,
'filename' = > " #{ Attachment . table_name } .filename " ,
'filename' = > " #{ Attachment . table_name } .filename " ,
'size' = > " #{ Attachment . table_name } .filesize " ,
'size' = > " #{ Attachment . table_name } .filesize " ,
'downloads' = > " #{ Attachment . table_name } .downloads "
'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
show_attachments @containers
@tag_list = attachment_tag_list @all_attachments
@tag_list = attachment_tag_list @all_attachments
@attachtype = 0
@attachtype = 0
@contenttype = 0
@contenttype = 0
respond_to do | format |
respond_to do | format |
format . js
format . js
# format.html {
# format.html {
# redirect_to org_subfield_files_url(@org_subfield)
# redirect_to org_subfield_files_url(@org_subfield)
# }
# }
end
end
# 组织添加附件,为了修改图片
# 组织添加附件,为了修改图片
elsif params [ :organization_id ]
elsif params [ :organization_id ]
@organization = Organization . find ( params [ :organization_id ] )
@organization = Organization . find ( params [ :organization_id ] )
@addTag = false
@addTag = false
# atttchment_type = 0为logo 1为banner
# atttchment_type = 0为logo 1为banner
if params [ :logo ]
if params [ :logo ]
attachments = Attachment . attach_filesex ( @organization , params [ :attachments ] , false )
attachments = Attachment . attach_filesex ( @organization , params [ :attachments ] , false )
else
else
attachments = Attachment . attach_filesex ( @organization , params [ :attachments ] , true )
attachments = Attachment . attach_filesex ( @organization , params [ :attachments ] , true )
end
end
# TODO: 临时用 nyan
# TODO: 临时用 nyan
sort_init 'created_on' , 'desc'
sort_init 'created_on' , 'desc'
sort_update 'created_on' = > " #{ Attachment . table_name } .created_on " ,
sort_update 'created_on' = > " #{ Attachment . table_name } .created_on " ,
'filename' = > " #{ Attachment . table_name } .filename " ,
'filename' = > " #{ Attachment . table_name } .filename " ,
'size' = > " #{ Attachment . table_name } .filesize " ,
'size' = > " #{ Attachment . table_name } .filesize " ,
'downloads' = > " #{ Attachment . table_name } .downloads "
'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
show_attachments @containers
@tag_list = attachment_tag_list @all_attachments
@tag_list = attachment_tag_list @all_attachments
@attachtype = 0
@attachtype = 0
@contenttype = 0
@contenttype = 0
respond_to do | format |
respond_to do | format |
format . js
format . js
# format.html {
# format.html {
# redirect_to org_subfield_files_url(@org_subfield)
# redirect_to org_subfield_files_url(@org_subfield)
# }
# }
end
end
end
end
end
end
end
end
def get_project_tag_name_by_type_nmuber type
def get_project_tag_name_by_type_nmuber type
@ -798,7 +800,7 @@ class FilesController < ApplicationController
else
else
#捕获异常
#捕获异常
end
end
end
end
# 返回指定资源类型的资源列表
# 返回指定资源类型的资源列表
# added by nwb
# added by nwb
@ -842,27 +844,27 @@ class FilesController < ApplicationController
end
end
end
end
if @project
if @project
@isproject = true
@isproject = true
@containers = [ Project . includes ( :attachments ) . reorder ( " #{ Attachment . table_name } .created_on DESC " ) . find ( @project . id ) ]
@containers = [ Project . includes ( :attachments ) . reorder ( " #{ Attachment . table_name } .created_on DESC " ) . find ( @project . id ) ]
@containers += @project . versions . includes ( :attachments ) . reorder ( sort ) . all
@containers += @project . versions . includes ( :attachments ) . reorder ( sort ) . all
show_attachments @containers
show_attachments @containers
@attachtype = params [ :type ] . to_i
@attachtype = params [ :type ] . to_i
@contenttype = params [ :contentType ] . to_s
@contenttype = params [ :contentType ] . to_s
respond_to do | format |
respond_to do | format |
format . js
format . js
format . html {
format . html {
render :layout = > 'base_projects'
render :layout = > 'base_projects'
}
}
end
end
elsif @course
elsif @course
@isproject = false
@isproject = false
@containers = [ Course . includes ( :attachments ) . reorder ( sort ) . find ( @course . id ) ]
@containers = [ Course . includes ( :attachments ) . reorder ( sort ) . find ( @course . id ) ]
show_attachments @containers
show_attachments @containers
@attachtype = params [ :type ] . to_i
@attachtype = params [ :type ] . to_i
@contenttype = params [ :contentType ] . to_s
@contenttype = params [ :contentType ] . to_s
# render layout: 'base_courses'
# render layout: 'base_courses'
@left_nav_type = 5
@left_nav_type = 5
respond_to do | format |
respond_to do | format |
format . js
format . js
@ -870,19 +872,19 @@ class FilesController < ApplicationController
render :layout = > 'base_courses'
render :layout = > 'base_courses'
}
}
end
end
else
else
show_attachments @containers
show_attachments @containers
@attachtype = params [ :type ] . to_i
@attachtype = params [ :type ] . to_i
@contenttype = params [ :contentType ] . to_s
@contenttype = params [ :contentType ] . to_s
respond_to do | format |
respond_to do | format |
format . js
format . js
format . html
format . html
end
end
end
end
end
end
#查找指定TAG的按条件过滤的资源列表, 只有课程内搜索有此功能
#查找指定TAG的按条件过滤的资源列表, 只有课程内搜索有此功能
def search_tag_attachment
def search_tag_attachment
@q , @tag_name , @order = params [ :q ] , params [ :tag_name ]
@q , @tag_name , @order = params [ :q ] , params [ :tag_name ]
@is_remote = true
@is_remote = true