@ -93,6 +93,11 @@ class UsersController < ApplicationController
end
end
# 更新issue状态
def user_act_issue_assign_to
end
# 用户消息
# 说明: homework 发布作业; message: 讨论区; news: 新闻; poll: 问卷; works_reviewers: 作品评阅; works_reply:作品回复,exercise:课程测验
# issue: 问题; journal: 缺陷状态更新; forum: 公共贴吧: user_feedback: 用户留言; new_reply:新闻回复( comment)
@ -750,23 +755,17 @@ class UsersController < ApplicationController
if params [ :type ] . present?
case params [ :type ]
when " public "
jours = @user . journals_for_messages . where ( 'm_parent_id IS NULL and private = 0' ) . order ( 'created_on DESC' )
@jour_count = jours . count
@jour = jours . limit ( 10 ) . offset ( @page * 10 )
jours = @user . journals_for_messages . where ( 'm_parent_id IS NULL and private = 0' ) . order ( 'updated_on DESC' )
when " private "
jours = @user . journals_for_messages . where ( 'm_parent_id IS NULL and private = 1' ) . order ( 'created_on DESC' )
@jour_count = jours . count
@jour = jours . limit ( 10 ) . offset ( @page * 10 )
jours = @user . journals_for_messages . where ( 'm_parent_id IS NULL and private = 1' ) . order ( 'updated_on DESC' )
else
jours = @user . journals_for_messages . where ( 'm_parent_id IS NULL' ) . order ( 'created_on DESC' )
@jour_count = jours . count
@jour = jours . limit ( 10 ) . offset ( @page * 10 )
jours = @user . journals_for_messages . where ( 'm_parent_id IS NULL' ) . order ( 'updated_on DESC' )
end
else
jours = @user . journals_for_messages . where ( 'm_parent_id IS NULL' ) . order ( 'created_on DESC' )
@jour_count = jours . count
@jour = jours . limit ( 10 ) . offset ( @page * 10 )
jours = @user . journals_for_messages . where ( 'm_parent_id IS NULL' ) . order ( 'updated_on DESC' )
end
@jour_count = jours . count
@jour = jours . limit ( 10 ) . offset ( @page * 10 )
@type = params [ :type ]
if User . current == @user
jours . update_all ( :is_readed = > true , :status = > false )
@ -1628,6 +1627,9 @@ class UsersController < ApplicationController
attach_copied_obj . attachtype = 1
end
attach_copied_obj . save
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
end
end
elsif params [ :send_ids ] . present?
@ -1663,6 +1665,9 @@ class UsersController < ApplicationController
attach_copied_obj . attachtype = 1
end
attach_copied_obj . save
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
end
end
end
@ -1791,13 +1796,24 @@ class UsersController < ApplicationController
def share_news_to_project
news = News . find ( params [ :send_id ] )
project_ids = params [ :project_ids ]
# project_ids.each do |project_id|
# if Project.find(project_id).news.map(&:id).exclude?(news.id)
# project_news = News.create(:project_id => project_id.to_i, :title => news.title, :summary => news.summary, :description => news.description,:author_id => User.current.id, :created_on => Time.now)
# news.attachments.each do |attach|
# project_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,
# :is_public => attach.is_public, :quotes => 0)
# end
# end
# end
project_ids . each do | project_id |
if Project . find ( project_id ) . news . map ( & :id ) . exclude? ( news . id )
project_news = News . create ( :project_id = > project_id . to_i , :title = > news . title , :summary = > news . summary , :description = > news . description , :author_id = > User . current . id , :created_on = > Time . now )
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 )
news . attachments . each do | attach |
project_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 ,
:is_public = > attach . is_public , :quotes = > 0 )
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 ,
:is_public = > attach . is_public , :quotes = > 0 )
end
end
end