|
|
|
@ -181,8 +181,8 @@ class FilesController < ApplicationController
|
|
|
|
|
attachment.delay_publish = @atta_delay_publish
|
|
|
|
|
attachment.publish_time = @atta_publish_time
|
|
|
|
|
attachment.unified_setting = @unified_setting
|
|
|
|
|
unless @unified_setting
|
|
|
|
|
|
|
|
|
|
if @unified_setting == 0
|
|
|
|
|
attachment_group_setting attachment, params[:group_settings]
|
|
|
|
|
end
|
|
|
|
|
# attachment.set_publish_time(publish_time) if is_unified_setting
|
|
|
|
|
# attachment.set_course_group_publish_time(@course, course_group_publish_times) if @course.course_groups.size > 0 && !is_unified_setting && publish_time.blank?
|
|
|
|
@ -226,6 +226,10 @@ class FilesController < ApplicationController
|
|
|
|
|
attach_copied_obj.is_publish = @atta_is_publish
|
|
|
|
|
attach_copied_obj.delay_publish = @atta_delay_publish
|
|
|
|
|
attach_copied_obj.publish_time = @atta_publish_time
|
|
|
|
|
attach_copied_obj.unified_setting = @unified_setting
|
|
|
|
|
if @unified_setting == 0
|
|
|
|
|
attachment_group_setting attach_copied_obj, params[:group_settings]
|
|
|
|
|
end
|
|
|
|
|
attach_copied_obj.course_second_category_id = course_second_category_id
|
|
|
|
|
attach_copied_obj.copy_from = ori.copy_from.nil? ? ori.id : ori.copy_from
|
|
|
|
|
if attach_copied_obj.attachtype == nil
|
|
|
|
@ -265,6 +269,10 @@ class FilesController < ApplicationController
|
|
|
|
|
@old_attachment.is_publish = @atta_is_publish
|
|
|
|
|
@old_attachment.delay_publish = @atta_delay_publish
|
|
|
|
|
@old_attachment.publish_time = @atta_publish_time
|
|
|
|
|
@old_attachment.unified_setting = @unified_setting
|
|
|
|
|
if @unified_setting == 0
|
|
|
|
|
attachment_group_setting @old_attachment, params[:group_settings]
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if params[:description] && !params[:description].strip.blank? && params[:description] != @old_attachment.description
|
|
|
|
|
@old_attachment.description = params[:description]
|
|
|
|
@ -376,4 +384,14 @@ class FilesController < ApplicationController
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def attachment_group_setting attachment, group_setting
|
|
|
|
|
create_atta_group_settings attachment
|
|
|
|
|
group_setting.each do |setting|
|
|
|
|
|
tip_exception("分班id不能为空") if setting[:group_id].length == 0
|
|
|
|
|
tip_exception("发布时间不能为空") if setting[:publish_time].blank?
|
|
|
|
|
AttachmentGroupSetting.where(attachment_id: attachment.id, course_group_id: setting[:group_id]).
|
|
|
|
|
update_all(publish_time: setting[:publish_time])
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|