解决课程作业500问题
This commit is contained in:
parent
22376f5c08
commit
1cfa8326aa
|
@ -442,12 +442,7 @@ class Attachment < ActiveRecord::Base
|
||||||
|
|
||||||
|
|
||||||
def self.attach_filesex(obj, attachments,attachment_type)
|
def self.attach_filesex(obj, attachments,attachment_type)
|
||||||
if obj.is_public?
|
result = obj.save_attachmentsex(attachments, User.current,attachment_type)
|
||||||
public_status = true
|
|
||||||
else
|
|
||||||
public_status = false
|
|
||||||
end
|
|
||||||
result = obj.save_attachmentsex(attachments, User.current,attachment_type, public_status)
|
|
||||||
obj.attach_saved_attachments
|
obj.attach_saved_attachments
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
|
@ -93,13 +93,13 @@ module Redmine
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def save_attachmentsex(attachments, author=User.current,attachment_type, public_status)
|
def save_attachmentsex(attachments, author=User.current,attachment_type)
|
||||||
@curattachment_type = attachment_type
|
@curattachment_type = attachment_type
|
||||||
result = save_attachments(attachments,author, public_status)
|
result = save_attachments(attachments,author)
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
||||||
def save_attachments(attachments, author=User.current,public_status)
|
def save_attachments(attachments, author=User.current)
|
||||||
# 清除临时文件
|
# 清除临时文件
|
||||||
if attachments
|
if attachments
|
||||||
tempAttach = attachments[:dummy]
|
tempAttach = attachments[:dummy]
|
||||||
|
@ -140,16 +140,12 @@ module Redmine
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if public_status
|
|
||||||
if a && !attachment['is_public_checkbox']
|
if a && !attachment['is_public_checkbox']
|
||||||
a.is_public = false
|
a.is_public = false
|
||||||
elsif a && attachment['is_public_checkbox']
|
elsif a && attachment['is_public_checkbox']
|
||||||
a.is_public = true
|
a.is_public = true
|
||||||
end
|
end
|
||||||
else
|
|
||||||
a.is_public = false
|
|
||||||
end
|
|
||||||
|
|
||||||
set_attachment_public(a) if a
|
set_attachment_public(a) if a
|
||||||
next unless a
|
next unless a
|
||||||
a.description = attachment['description'].to_s.strip
|
a.description = attachment['description'].to_s.strip
|
||||||
|
|
Loading…
Reference in New Issue