|
|
|
@ -1856,6 +1856,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,
|
|
|
|
@ -1872,6 +1876,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,
|
|
|
|
@ -1885,6 +1893,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,
|
|
|
|
@ -1900,6 +1912,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,
|
|
|
|
@ -1916,6 +1932,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,
|
|
|
|
@ -1932,6 +1952,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,
|
|
|
|
|