Merged r3883, r3884 and r3885 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.0-stable@3886 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
52a12aaca8
commit
e771fc03bd
|
@ -37,7 +37,7 @@ class GanttsController < ApplicationController
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html { render :action => "show", :layout => !request.xhr? }
|
format.html { render :action => "show", :layout => !request.xhr? }
|
||||||
format.png { send_data(@gantt.to_image, :disposition => 'inline', :type => 'image/png', :filename => "#{basename}.png") } if @gantt.respond_to?('to_image')
|
format.png { send_data(@gantt.to_image(@project), :disposition => 'inline', :type => 'image/png', :filename => "#{basename}.png") } if @gantt.respond_to?('to_image')
|
||||||
format.pdf { send_data(gantt_to_pdf(@gantt, @project), :type => 'application/pdf', :filename => "#{basename}.pdf") }
|
format.pdf { send_data(gantt_to_pdf(@gantt, @project), :type => 'application/pdf', :filename => "#{basename}.pdf") }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -325,7 +325,7 @@ module Redmine
|
||||||
pdf.Ln
|
pdf.Ln
|
||||||
pdf.SetFontStyle('B',9)
|
pdf.SetFontStyle('B',9)
|
||||||
|
|
||||||
subject_width = 70
|
subject_width = 100
|
||||||
header_heigth = 5
|
header_heigth = 5
|
||||||
|
|
||||||
headers_heigth = header_heigth
|
headers_heigth = header_heigth
|
||||||
|
@ -341,7 +341,7 @@ module Redmine
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
g_width = 210
|
g_width = 280 - subject_width
|
||||||
zoom = (g_width) / (gantt.date_to - gantt.date_from + 1)
|
zoom = (g_width) / (gantt.date_to - gantt.date_from + 1)
|
||||||
g_height = 120
|
g_height = 120
|
||||||
t_height = g_height + headers_heigth
|
t_height = g_height + headers_heigth
|
||||||
|
@ -415,16 +415,19 @@ module Redmine
|
||||||
pdf.SetY(top)
|
pdf.SetY(top)
|
||||||
pdf.SetX(15)
|
pdf.SetX(15)
|
||||||
|
|
||||||
|
text = ""
|
||||||
if i.is_a? Issue
|
if i.is_a? Issue
|
||||||
pdf.Cell(subject_width-15, 5, "#{i.tracker} #{i.id}: #{i.subject}".sub(/^(.{30}[^\s]*\s).*$/, '\1 (...)'), "LR")
|
text = "#{i.tracker} #{i.id}: #{i.subject}"
|
||||||
else
|
else
|
||||||
pdf.Cell(subject_width-15, 5, "#{l(:label_version)}: #{i.name}", "LR")
|
text = i.name
|
||||||
end
|
end
|
||||||
|
text = "#{i.project} - #{text}" unless project && project == i.project
|
||||||
|
pdf.Cell(subject_width-15, 5, text, "LR")
|
||||||
|
|
||||||
pdf.SetY(top)
|
pdf.SetY(top + 0.2)
|
||||||
pdf.SetX(subject_width)
|
pdf.SetX(subject_width)
|
||||||
pdf.Cell(g_width, 5, "", "LR")
|
pdf.SetFillColor(255, 255, 255)
|
||||||
|
pdf.Cell(g_width, 4.6, "", "LR", 0, "", 1)
|
||||||
pdf.SetY(top+1.5)
|
pdf.SetY(top+1.5)
|
||||||
|
|
||||||
if i.is_a? Issue
|
if i.is_a? Issue
|
||||||
|
|
|
@ -91,12 +91,12 @@ module Redmine
|
||||||
|
|
||||||
# Generates a gantt image
|
# Generates a gantt image
|
||||||
# Only defined if RMagick is avalaible
|
# Only defined if RMagick is avalaible
|
||||||
def to_image(format='PNG')
|
def to_image(project, format='PNG')
|
||||||
date_to = (@date_from >> @months)-1
|
date_to = (@date_from >> @months)-1
|
||||||
show_weeks = @zoom > 1
|
show_weeks = @zoom > 1
|
||||||
show_days = @zoom > 2
|
show_days = @zoom > 2
|
||||||
|
|
||||||
subject_width = 320
|
subject_width = 400
|
||||||
header_heigth = 18
|
header_heigth = 18
|
||||||
# width of one day in pixels
|
# width of one day in pixels
|
||||||
zoom = @zoom*2
|
zoom = @zoom*2
|
||||||
|
@ -115,7 +115,14 @@ module Redmine
|
||||||
gc.stroke('transparent')
|
gc.stroke('transparent')
|
||||||
gc.stroke_width(1)
|
gc.stroke_width(1)
|
||||||
events.each do |i|
|
events.each do |i|
|
||||||
gc.text(4, top + 2, (i.is_a?(Issue) ? i.subject : i.name))
|
text = ""
|
||||||
|
if i.is_a? Issue
|
||||||
|
text = "#{i.tracker} #{i.id}: #{i.subject}"
|
||||||
|
else
|
||||||
|
text = i.name
|
||||||
|
end
|
||||||
|
text = "#{i.project} - #{text}" unless project && project == i.project
|
||||||
|
gc.text(4, top + 2, text)
|
||||||
top = top + 20
|
top = top + 20
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue