comparison app/controllers/files_controller.rb @ 1115:433d4f72a19b redmine-2.2

Update to Redmine SVN revision 11137 on 2.2-stable branch
author Chris Cannam
date Mon, 07 Jan 2013 12:01:42 +0000
parents cbce1fd3b1b7
children bb32da3bea34 622f24f53b42
comparison
equal deleted inserted replaced
929:5f33065ddc4b 1115:433d4f72a19b
1 # Redmine - project management software
2 # Copyright (C) 2006-2012 Jean-Philippe Lang
3 #
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
1 class FilesController < ApplicationController 18 class FilesController < ApplicationController
2 menu_item :files 19 menu_item :files
3 20
4 before_filter :find_project_by_project_id 21 before_filter :find_project_by_project_id
5 before_filter :authorize 22 before_filter :authorize
27 container = (params[:version_id].blank? ? @project : @project.versions.find_by_id(params[:version_id])) 44 container = (params[:version_id].blank? ? @project : @project.versions.find_by_id(params[:version_id]))
28 attachments = Attachment.attach_files(container, params[:attachments]) 45 attachments = Attachment.attach_files(container, params[:attachments])
29 render_attachment_warning_if_needed(container) 46 render_attachment_warning_if_needed(container)
30 47
31 if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added') 48 if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added')
32 Mailer.deliver_attachments_added(attachments[:files]) 49 Mailer.attachments_added(attachments[:files]).deliver
33 end 50 end
34 redirect_to project_files_path(@project) 51 redirect_to project_files_path(@project)
35 end 52 end
36 end 53 end