diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb
index 059bcbe91..4939d1798 100644
--- a/app/controllers/attachments_controller.rb
+++ b/app/controllers/attachments_controller.rb
@@ -70,14 +70,37 @@ class AttachmentsController < ApplicationController
file.downcase.end_with?(".pdf")
end
+ def upload_atta
+ @course = Course.find params[:course_id]
+ end
+
def batch_setting
@course = Course.find params[:course_id]
@attachments = @course.attachments.reorder("created_on desc")
- @limit = 10
+ @all_attachment_ids = @attachments.map(&:id).join(",")
+ @limit = 8
@attachment_count = @attachments.count
@attachment_pages = Paginator.new @attachment_count, @limit, params['page'] || 1
@offset ||= @attachment_pages.offset
- @attachments = paginateHelper @attachments,10
+ @attachments = paginateHelper @attachments, @limit
+ end
+
+ def resource_batch_setting
+ @course = Course.find params[:course_id]
+ attachments = Attachment.where(:id => params[:choose_ids].split(','))
+ if params[:is_delete] && params[:is_delete] == "1"
+ attachments.each do |attachment|
+ attachment.container.attachments.delete(attachment)
+ end
+ else
+ unless params[:publish_time] == ""
+ attachments.update_all(:publish_time => params[:publish_time], :is_publish => 0)
+ end
+ if params[:is_public]
+ attachments.update_all(:is_public => 1)
+ end
+ end
+ redirect_to course_files_path(@course)
end
def direct_download
diff --git a/app/views/attachments/_batch_setting.html.erb b/app/views/attachments/_batch_setting.html.erb
index de09aef37..ebb834e98 100644
--- a/app/views/attachments/_batch_setting.html.erb
+++ b/app/views/attachments/_batch_setting.html.erb
@@ -1,116 +1,124 @@
+