附件引用
This commit is contained in:
parent
9beaa62d6d
commit
dfddb30ca3
|
@ -1658,6 +1658,9 @@ class UsersController < ApplicationController
|
||||||
attach_copied_obj.attachtype = 4
|
attach_copied_obj.attachtype = 4
|
||||||
end
|
end
|
||||||
if attach_copied_obj.save
|
if attach_copied_obj.save
|
||||||
|
# 更新引用次数
|
||||||
|
quotes = ori.quotes.to_i + 1
|
||||||
|
ori.update_attribute(:quotes, quotes) unless ori.nil?
|
||||||
ori.forwards << Forward.new(:to_type => attach_copied_obj.class.name, :to_id => attach_copied_obj.id,:created_at => Time.now)
|
ori.forwards << Forward.new(:to_type => attach_copied_obj.class.name, :to_id => attach_copied_obj.id,:created_at => Time.now)
|
||||||
end
|
end
|
||||||
@save_message = attach_copied_obj.errors.full_messages
|
@save_message = attach_copied_obj.errors.full_messages
|
||||||
|
@ -1670,10 +1673,11 @@ class UsersController < ApplicationController
|
||||||
@flag = false
|
@flag = false
|
||||||
end
|
end
|
||||||
send_ids.each do |send_id|
|
send_ids.each do |send_id|
|
||||||
|
quotes = 0
|
||||||
ori = Attachment.find_by_id(send_id)
|
ori = Attachment.find_by_id(send_id)
|
||||||
|
|
||||||
unless course_ids.nil?
|
unless course_ids.nil?
|
||||||
course_ids.each do |id|
|
course_ids.each do |id|
|
||||||
|
quotes = 0
|
||||||
next if ori.blank?
|
next if ori.blank?
|
||||||
@exist = false
|
@exist = false
|
||||||
Course.find(id).attachments.each do |att| #如果课程中包含该资源
|
Course.find(id).attachments.each do |att| #如果课程中包含该资源
|
||||||
|
@ -1696,6 +1700,9 @@ class UsersController < ApplicationController
|
||||||
attach_copied_obj.attachtype = 4
|
attach_copied_obj.attachtype = 4
|
||||||
end
|
end
|
||||||
if attach_copied_obj.save
|
if attach_copied_obj.save
|
||||||
|
# 更新引用次数
|
||||||
|
quotes = ori.quotes.to_i + 1
|
||||||
|
ori.update_attribute(:quotes, quotes) unless ori.nil?
|
||||||
ori.forwards << Forward.new(:to_type => attach_copied_obj.class.name, :to_id => attach_copied_obj.id,:created_at => Time.now)
|
ori.forwards << Forward.new(:to_type => attach_copied_obj.class.name, :to_id => attach_copied_obj.id,:created_at => Time.now)
|
||||||
end
|
end
|
||||||
@save_message = attach_copied_obj.errors.full_messages
|
@save_message = attach_copied_obj.errors.full_messages
|
||||||
|
@ -1756,6 +1763,9 @@ class UsersController < ApplicationController
|
||||||
attach_copied_obj.attachtype = 1
|
attach_copied_obj.attachtype = 1
|
||||||
end
|
end
|
||||||
if attach_copied_obj.save
|
if attach_copied_obj.save
|
||||||
|
# 更新引用次数
|
||||||
|
quotes = ori.quotes.to_i + 1
|
||||||
|
ori.update_attribute(:quotes, quotes) unless ori.nil?
|
||||||
ori.forwards << Forward.new(:to_type => attach_copied_obj.class.name, :to_id => attach_copied_obj.id,:created_at => Time.now)
|
ori.forwards << Forward.new(:to_type => attach_copied_obj.class.name, :to_id => attach_copied_obj.id,:created_at => Time.now)
|
||||||
end
|
end
|
||||||
unless Project.find(project_id).project_score.nil?
|
unless Project.find(project_id).project_score.nil?
|
||||||
|
@ -1771,10 +1781,11 @@ class UsersController < ApplicationController
|
||||||
@flag = false
|
@flag = false
|
||||||
end
|
end
|
||||||
send_ids.each do |send_id|
|
send_ids.each do |send_id|
|
||||||
|
quotes = 0
|
||||||
ori = Attachment.find_by_id(send_id)
|
ori = Attachment.find_by_id(send_id)
|
||||||
unless project_ids.nil?
|
unless project_ids.nil?
|
||||||
project_ids.each do |project_id|
|
project_ids.each do |project_id|
|
||||||
|
quotes = 0
|
||||||
next if ori.blank?
|
next if ori.blank?
|
||||||
@exist = false
|
@exist = false
|
||||||
Project.find(project_id).attachments.each do |att| #如果课程中包含该资源
|
Project.find(project_id).attachments.each do |att| #如果课程中包含该资源
|
||||||
|
@ -1797,6 +1808,9 @@ class UsersController < ApplicationController
|
||||||
attach_copied_obj.attachtype = 1
|
attach_copied_obj.attachtype = 1
|
||||||
end
|
end
|
||||||
if attach_copied_obj.save
|
if attach_copied_obj.save
|
||||||
|
# 更新引用次数
|
||||||
|
quotes = ori.quotes.to_i + 1
|
||||||
|
ori.update_attribute(:quotes, quotes) unless ori.nil?
|
||||||
ori.forwards << Forward.new(:to_type => attach_copied_obj.class.name, :to_id => attach_copied_obj.id,:created_at => Time.now)
|
ori.forwards << Forward.new(:to_type => attach_copied_obj.class.name, :to_id => attach_copied_obj.id,:created_at => Time.now)
|
||||||
end
|
end
|
||||||
unless Project.find(project_id).project_score.nil?
|
unless Project.find(project_id).project_score.nil?
|
||||||
|
@ -1856,6 +1870,9 @@ class UsersController < ApplicationController
|
||||||
attach_copied_obj.attachtype = 1
|
attach_copied_obj.attachtype = 1
|
||||||
end
|
end
|
||||||
if attach_copied_obj.save
|
if attach_copied_obj.save
|
||||||
|
# 更新引用次数
|
||||||
|
quotes = ori.quotes.to_i + 1
|
||||||
|
ori.update_attribute(:quotes, quotes) unless ori.nil?
|
||||||
ori.forwards << Forward.new(:to_type => attach_copied_obj.class.name, :to_id => attach_copied_obj.id,:created_at => Time.now)
|
ori.forwards << Forward.new(:to_type => attach_copied_obj.class.name, :to_id => attach_copied_obj.id,:created_at => Time.now)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1867,7 +1884,7 @@ class UsersController < ApplicationController
|
||||||
@flag = false
|
@flag = false
|
||||||
end
|
end
|
||||||
send_ids.each do |send_id|
|
send_ids.each do |send_id|
|
||||||
|
quotes = 0
|
||||||
ori = Attachment.find_by_id(send_id)
|
ori = Attachment.find_by_id(send_id)
|
||||||
unless subfield_id.nil?
|
unless subfield_id.nil?
|
||||||
next if ori.blank?
|
next if ori.blank?
|
||||||
|
@ -1892,6 +1909,9 @@ class UsersController < ApplicationController
|
||||||
attach_copied_obj.attachtype = 1
|
attach_copied_obj.attachtype = 1
|
||||||
end
|
end
|
||||||
if attach_copied_obj.save
|
if attach_copied_obj.save
|
||||||
|
# 更新引用次数
|
||||||
|
quotes = ori.quotes.to_i + 1
|
||||||
|
ori.update_attribute(:quotes, quotes) unless ori.nil?
|
||||||
ori.forwards << Forward.new(:to_type => attach_copied_obj.class.name, :to_id => attach_copied_obj.id,:created_at => Time.now)
|
ori.forwards << Forward.new(:to_type => attach_copied_obj.class.name, :to_id => attach_copied_obj.id,:created_at => Time.now)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue