|
|
|
@ -1592,7 +1592,9 @@ class UsersController < ApplicationController
|
|
|
|
|
if attach_copied_obj.attachtype == nil
|
|
|
|
|
attach_copied_obj.attachtype = 4
|
|
|
|
|
end
|
|
|
|
|
attach_copied_obj.save
|
|
|
|
|
if attach_copied_obj.save
|
|
|
|
|
ori.forwards << Forward.new(:to_type => attach_copied_obj.class.name, :to_id => attach_copied_obj.id,:created_at => Time.now)
|
|
|
|
|
end
|
|
|
|
|
@save_message = attach_copied_obj.errors.full_messages
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
@ -1628,7 +1630,9 @@ class UsersController < ApplicationController
|
|
|
|
|
if attach_copied_obj.attachtype == nil
|
|
|
|
|
attach_copied_obj.attachtype = 4
|
|
|
|
|
end
|
|
|
|
|
attach_copied_obj.save
|
|
|
|
|
if attach_copied_obj.save
|
|
|
|
|
ori.forwards << Forward.new(:to_type => attach_copied_obj.class.name, :to_id => attach_copied_obj.id,:created_at => Time.now)
|
|
|
|
|
end
|
|
|
|
|
@save_message = attach_copied_obj.errors.full_messages
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
@ -1686,7 +1690,9 @@ class UsersController < ApplicationController
|
|
|
|
|
if attach_copied_obj.attachtype == nil
|
|
|
|
|
attach_copied_obj.attachtype = 1
|
|
|
|
|
end
|
|
|
|
|
attach_copied_obj.save
|
|
|
|
|
if attach_copied_obj.save
|
|
|
|
|
ori.forwards << Forward.new(:to_type => attach_copied_obj.class.name, :to_id => attach_copied_obj.id,:created_at => Time.now)
|
|
|
|
|
end
|
|
|
|
|
unless Project.find(project_id).project_score.nil?
|
|
|
|
|
Project.find(project_id).project_score.update_attribute(:attach_num,
|
|
|
|
|
Project.find(project_id).project_score.attach_num + 1)
|
|
|
|
@ -1725,7 +1731,9 @@ class UsersController < ApplicationController
|
|
|
|
|
if attach_copied_obj.attachtype == nil
|
|
|
|
|
attach_copied_obj.attachtype = 1
|
|
|
|
|
end
|
|
|
|
|
attach_copied_obj.save
|
|
|
|
|
if attach_copied_obj.save
|
|
|
|
|
ori.forwards << Forward.new(:to_type => attach_copied_obj.class.name, :to_id => attach_copied_obj.id,:created_at => Time.now)
|
|
|
|
|
end
|
|
|
|
|
unless Project.find(project_id).project_score.nil?
|
|
|
|
|
Project.find(project_id).project_score.update_attribute(:attach_num, Project.find(project_id).project_score.attach_num + 1)
|
|
|
|
|
end
|
|
|
|
@ -1782,7 +1790,9 @@ class UsersController < ApplicationController
|
|
|
|
|
if attach_copied_obj.attachtype == nil
|
|
|
|
|
attach_copied_obj.attachtype = 1
|
|
|
|
|
end
|
|
|
|
|
attach_copied_obj.save
|
|
|
|
|
if attach_copied_obj.save
|
|
|
|
|
ori.forwards << Forward.new(:to_type => attach_copied_obj.class.name, :to_id => attach_copied_obj.id,:created_at => Time.now)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
elsif params[:send_ids].present?
|
|
|
|
@ -1816,7 +1826,9 @@ class UsersController < ApplicationController
|
|
|
|
|
if attach_copied_obj.attachtype == nil
|
|
|
|
|
attach_copied_obj.attachtype = 1
|
|
|
|
|
end
|
|
|
|
|
attach_copied_obj.save
|
|
|
|
|
if attach_copied_obj.save
|
|
|
|
|
ori.forwards << Forward.new(:to_type => attach_copied_obj.class.name, :to_id => attach_copied_obj.id,:created_at => Time.now)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
@ -1845,6 +1857,10 @@ class UsersController < ApplicationController
|
|
|
|
|
course_ids.each do |course_id|
|
|
|
|
|
if Course.find(course_id).news.map(&:id).exclude?(news.id)
|
|
|
|
|
course_news = News.create(:course_id => course_id.to_i, :title => news.title, :summary => news.summary, :description => news.description,:author_id => User.current.id, :created_on => Time.now,:project_id => -1)
|
|
|
|
|
#record forward to table forwards if new record is valid
|
|
|
|
|
if course_news.valid?
|
|
|
|
|
news.forwards << Forward.new(:to_type => course_news.class.name, :to_id => course_news.id)
|
|
|
|
|
end
|
|
|
|
|
news.attachments.each do |attach|
|
|
|
|
|
course_news.attachments << Attachment.new(:filename => attach.filename, :disk_filename => attach.disk_filename, :filesize => attach.filesize, :content_type => attach.content_type, :digest => attach.digest,
|
|
|
|
|
:downloads => 0, :author_id => User.current.id, :created_on => Time.now, :description => attach.description, :disk_directory => attach.disk_directory, :attachtype => attach.attachtype,
|
|
|
|
@ -1861,6 +1877,10 @@ class UsersController < ApplicationController
|
|
|
|
|
project = Project.find(project_id)
|
|
|
|
|
if project.news.map(&:id).exclude?(news.id)
|
|
|
|
|
message = Message.create(:board_id => project.boards.first.id, :subject => news.title, :content => news.description, :author_id => User.current.id)
|
|
|
|
|
# record forward to table forwards if new record is valid
|
|
|
|
|
if message.valid?
|
|
|
|
|
news.forwards << Forward.new(:to_type => message.class.name, :to_id => message.id)
|
|
|
|
|
end
|
|
|
|
|
news.attachments.each do |attach|
|
|
|
|
|
message.attachments << Attachment.new(:filename => attach.filename, :disk_filename => attach.disk_filename, :filesize => attach.filesize, :content_type => attach.content_type, :digest => attach.digest,
|
|
|
|
|
:downloads => 0, :author_id => User.current.id, :created_on => Time.now, :description => attach.description, :disk_directory => attach.disk_directory, :attachtype => attach.attachtype,
|
|
|
|
@ -1874,6 +1894,10 @@ class UsersController < ApplicationController
|
|
|
|
|
news = News.find(params[:send_id])
|
|
|
|
|
field_id = params[:subfield]
|
|
|
|
|
org_news = News.create(:org_subfield_id => field_id.to_i, :title => news.title, :summary => news.summary, :description => news.description,:author_id => User.current.id, :created_on => Time.now,:project_id => -1)
|
|
|
|
|
# record forward to table forwards if new record is valid
|
|
|
|
|
if org_news.valid?
|
|
|
|
|
news.forwards << Forward.new(:to_type => org_news.class.name, :to_id => org_news.id)
|
|
|
|
|
end
|
|
|
|
|
news.attachments.each do |attach|
|
|
|
|
|
org_news.attachments << Attachment.new(:filename => attach.filename, :disk_filename => attach.disk_filename, :filesize => attach.filesize, :content_type => attach.content_type, :digest => attach.digest,
|
|
|
|
|
:downloads => 0, :author_id => User.current.id, :created_on => Time.now, :description => attach.description, :disk_directory => attach.disk_directory, :attachtype => attach.attachtype,
|
|
|
|
@ -1889,6 +1913,10 @@ class UsersController < ApplicationController
|
|
|
|
|
course = Course.find(course_id)
|
|
|
|
|
if course.news.map(&:id).exclude?(@message.id)
|
|
|
|
|
message = Message.create(:board_id => course.boards.first.id, :subject => @message.subject, :content => @message.content, :author_id => User.current.id)
|
|
|
|
|
# record forward to table forwards if new record is valid
|
|
|
|
|
if message.valid?
|
|
|
|
|
@message.forwards << Forward.new(:to_type => message.class.name, :to_id => message.id)
|
|
|
|
|
end
|
|
|
|
|
@message.attachments.each do |attach|
|
|
|
|
|
message.attachments << Attachment.new(:filename => attach.filename, :disk_filename => attach.disk_filename, :filesize => attach.filesize, :content_type => attach.content_type, :digest => attach.digest,
|
|
|
|
|
:downloads => 0, :author_id => User.current.id, :created_on => Time.now, :description => attach.description, :disk_directory => attach.disk_directory, :attachtype => attach.attachtype,
|
|
|
|
@ -1905,6 +1933,10 @@ class UsersController < ApplicationController
|
|
|
|
|
project = Project.find(project_id)
|
|
|
|
|
if project.news.map(&:id).exclude?(@message.id)
|
|
|
|
|
message = Message.create(:board_id => project.boards.first.id, :subject => @message.subject, :content => @message.content, :author_id => User.current.id)
|
|
|
|
|
# record forward to table forwards if new record is valid
|
|
|
|
|
if message.valid?
|
|
|
|
|
@message.forwards << Forward.new(:to_type => message.class.name, :to_id => message.id)
|
|
|
|
|
end
|
|
|
|
|
@message.attachments.each do |attach|
|
|
|
|
|
message.attachments << Attachment.new(:filename => attach.filename, :disk_filename => attach.disk_filename, :filesize => attach.filesize, :content_type => attach.content_type, :digest => attach.digest,
|
|
|
|
|
:downloads => 0, :author_id => User.current.id, :created_on => Time.now, :description => attach.description, :disk_directory => attach.disk_directory, :attachtype => attach.attachtype,
|
|
|
|
@ -1921,6 +1953,10 @@ class UsersController < ApplicationController
|
|
|
|
|
@message.save
|
|
|
|
|
board = OrgSubfield.find(field_id).boards.first
|
|
|
|
|
mes = Message.create(:board_id => board.id, :subject => @message.subject, :content => @message.content, :author_id => User.current.id)
|
|
|
|
|
# record forward to table forwards if new record is valid
|
|
|
|
|
if mes.valid?
|
|
|
|
|
@message.forwards << Forward.new(:to_type => mes.class.name, :to_id => mes.id)
|
|
|
|
|
end
|
|
|
|
|
@message.attachments.each do |attach|
|
|
|
|
|
mes.attachments << Attachment.new(:filename => attach.filename, :disk_filename => attach.disk_filename, :filesize => attach.filesize, :content_type => attach.content_type, :digest => attach.digest,
|
|
|
|
|
:downloads => 0, :author_id => User.current.id, :created_on => Time.now, :description => attach.description, :disk_directory => attach.disk_directory, :attachtype => attach.attachtype,
|
|
|
|
|