2011-04-01 18:34:44 +04:00
|
|
|
# Redmine - project management software
|
2014-01-30 02:45:39 +04:00
|
|
|
# Copyright (C) 2006-2014 Jean-Philippe Lang
|
2011-04-01 18:34:44 +04:00
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU General Public License
|
|
|
|
# as published by the Free Software Foundation; either version 2
|
|
|
|
# of the License, or (at your option) any later version.
|
2011-08-30 17:07:12 +04:00
|
|
|
#
|
2011-04-01 18:34:44 +04:00
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
2011-08-30 17:07:12 +04:00
|
|
|
#
|
2011-04-01 18:34:44 +04:00
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
2010-04-28 19:54:46 +04:00
|
|
|
class GanttsController < ApplicationController
|
2010-11-08 01:38:10 +03:00
|
|
|
menu_item :gantt
|
2010-04-28 19:54:46 +04:00
|
|
|
before_filter :find_optional_project
|
|
|
|
|
|
|
|
rescue_from Query::StatementInvalid, :with => :query_statement_invalid
|
|
|
|
|
2010-09-10 07:09:02 +04:00
|
|
|
helper :gantt
|
2010-04-28 19:54:46 +04:00
|
|
|
helper :issues
|
|
|
|
helper :projects
|
|
|
|
helper :queries
|
|
|
|
include QueriesHelper
|
2010-04-29 19:19:19 +04:00
|
|
|
helper :sort
|
|
|
|
include SortHelper
|
2010-04-28 19:54:46 +04:00
|
|
|
include Redmine::Export::PDF
|
2011-08-30 17:07:12 +04:00
|
|
|
|
2010-04-28 19:54:46 +04:00
|
|
|
def show
|
|
|
|
@gantt = Redmine::Helpers::Gantt.new(params)
|
2010-09-10 07:09:02 +04:00
|
|
|
@gantt.project = @project
|
2010-04-28 19:54:46 +04:00
|
|
|
retrieve_query
|
|
|
|
@query.group_by = nil
|
2010-09-10 07:09:02 +04:00
|
|
|
@gantt.query = @query if @query.valid?
|
2011-08-30 17:07:12 +04:00
|
|
|
|
2010-04-28 19:54:46 +04:00
|
|
|
basename = (@project ? "#{@project.identifier}-" : '') + 'gantt'
|
2011-08-30 17:07:12 +04:00
|
|
|
|
2010-04-28 19:54:46 +04:00
|
|
|
respond_to do |format|
|
|
|
|
format.html { render :action => "show", :layout => !request.xhr? }
|
2010-09-10 07:09:02 +04:00
|
|
|
format.png { send_data(@gantt.to_image, :disposition => 'inline', :type => 'image/png', :filename => "#{basename}.png") } if @gantt.respond_to?('to_image')
|
|
|
|
format.pdf { send_data(@gantt.to_pdf, :type => 'application/pdf', :filename => "#{basename}.pdf") }
|
2010-04-28 19:54:46 +04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|