remove trailing white-spaces lib/redmine/export/pdf.rb.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5663 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
2711f4c745
commit
479d9380a7
|
@ -1,18 +1,18 @@
|
|||
# encoding: utf-8
|
||||
#
|
||||
# Redmine - project management software
|
||||
# Copyright (C) 2006-2009 Jean-Philippe Lang
|
||||
# Copyright (C) 2006-2011 Jean-Philippe Lang
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
#
|
||||
# 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.
|
||||
|
@ -28,11 +28,11 @@ module Redmine
|
|||
module PDF
|
||||
include ActionView::Helpers::TextHelper
|
||||
include ActionView::Helpers::NumberHelper
|
||||
|
||||
|
||||
class ITCPDF < TCPDF
|
||||
include Redmine::I18n
|
||||
attr_accessor :footer_date
|
||||
|
||||
|
||||
def initialize(lang)
|
||||
super()
|
||||
set_language_if_valid lang
|
||||
|
@ -41,11 +41,11 @@ module Redmine
|
|||
SetCreator(Redmine::Info.app_name)
|
||||
SetFont(@font_for_content)
|
||||
end
|
||||
|
||||
|
||||
def SetFontStyle(style, size)
|
||||
SetFont(@font_for_content, style, size)
|
||||
end
|
||||
|
||||
|
||||
def SetTitle(txt)
|
||||
txt = begin
|
||||
utf16txt = Iconv.conv('UTF-16BE', 'UTF-8', txt)
|
||||
|
@ -57,7 +57,7 @@ module Redmine
|
|||
end || ''
|
||||
super(txt)
|
||||
end
|
||||
|
||||
|
||||
def textstring(s)
|
||||
# Format a text string
|
||||
if s =~ /^</ # This means the string is hex-dumped.
|
||||
|
@ -66,10 +66,10 @@ module Redmine
|
|||
return '('+escape(s)+')'
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
alias RDMCell Cell
|
||||
alias RDMMultiCell MultiCell
|
||||
|
||||
|
||||
def Footer
|
||||
SetFont(@font_for_footer, 'I', 8)
|
||||
SetY(-15)
|
||||
|
@ -224,7 +224,7 @@ module Redmine
|
|||
pdf.SetFontStyle('B',11)
|
||||
pdf.RDMCell(190,10, title)
|
||||
pdf.Ln
|
||||
|
||||
|
||||
# headers
|
||||
pdf.SetFontStyle('B',8)
|
||||
pdf.SetFillColor(230, 230, 230)
|
||||
|
@ -241,7 +241,7 @@ module Redmine
|
|||
issues_to_pdf_write_cells(pdf, query.columns, col_width, row_height, true)
|
||||
issues_to_pdf_draw_borders(pdf, base_x, base_y, base_y + max_height, col_id_width, col_width)
|
||||
pdf.SetY(base_y + max_height);
|
||||
|
||||
|
||||
# rows
|
||||
pdf.SetFontStyle('',8)
|
||||
pdf.SetFillColor(255, 255, 255)
|
||||
|
@ -250,7 +250,7 @@ module Redmine
|
|||
if query.grouped? &&
|
||||
(group = query.group_by_column.value(issue)) != previous_group
|
||||
pdf.SetFontStyle('B',9)
|
||||
pdf.RDMCell(277, row_height,
|
||||
pdf.RDMCell(277, row_height,
|
||||
(group.blank? ? 'None' : group.to_s) + " (#{query.issue_count_by_group[group]})",
|
||||
1, 1, 'L')
|
||||
pdf.SetFontStyle('',8)
|
||||
|
@ -273,14 +273,14 @@ module Redmine
|
|||
end
|
||||
s.to_s
|
||||
end
|
||||
|
||||
|
||||
# render it off-page to find the max height used
|
||||
base_x = pdf.GetX
|
||||
base_y = pdf.GetY
|
||||
pdf.SetY(2 * page_height)
|
||||
max_height = issues_to_pdf_write_cells(pdf, col_values, col_width, row_height)
|
||||
pdf.SetXY(base_x, base_y)
|
||||
|
||||
|
||||
# make new page if it doesn't fit on the current one
|
||||
space_left = page_height - base_y - bottom_margin
|
||||
if max_height > space_left
|
||||
|
@ -295,14 +295,14 @@ module Redmine
|
|||
issues_to_pdf_draw_borders(pdf, base_x, base_y, base_y + max_height, col_id_width, col_width)
|
||||
pdf.SetY(base_y + max_height);
|
||||
end
|
||||
|
||||
|
||||
if issues.size == Setting.issues_export_limit.to_i
|
||||
pdf.SetFontStyle('B',10)
|
||||
pdf.RDMCell(0, row_height, '...')
|
||||
end
|
||||
pdf.Output
|
||||
end
|
||||
|
||||
|
||||
# Renders MultiCells and returns the maximum height used
|
||||
def issues_to_pdf_write_cells(pdf, col_values, col_widths, row_height, head=false)
|
||||
base_y = pdf.GetY
|
||||
|
@ -319,7 +319,7 @@ module Redmine
|
|||
end
|
||||
return max_height
|
||||
end
|
||||
|
||||
|
||||
# Draw lines to close the row (MultiCell border drawing in not uniform)
|
||||
def issues_to_pdf_draw_borders(pdf, top_x, top_y, lower_y, id_width, col_widths)
|
||||
col_x = top_x + id_width
|
||||
|
@ -331,7 +331,7 @@ module Redmine
|
|||
pdf.Line(top_x, top_y, top_x, lower_y) # left border
|
||||
pdf.Line(top_x, lower_y, col_x, lower_y) # bottom border
|
||||
end
|
||||
|
||||
|
||||
# Returns a PDF string of a single issue
|
||||
def issue_to_pdf(issue)
|
||||
if l(:general_pdf_encoding).upcase != 'UTF-8'
|
||||
|
@ -343,7 +343,7 @@ module Redmine
|
|||
pdf.alias_nb_pages
|
||||
pdf.footer_date = format_date(Date.today)
|
||||
pdf.AddPage
|
||||
pdf.SetFontStyle('B',11)
|
||||
pdf.SetFontStyle('B',11)
|
||||
pdf.RDMMultiCell(190,5, "#{issue.project} - #{issue.tracker} # #{issue.id}: #{issue.subject}")
|
||||
pdf.Ln
|
||||
|
||||
|
@ -358,7 +358,7 @@ module Redmine
|
|||
pdf.SetFontStyle('',9)
|
||||
pdf.RDMCell(60,5, issue.priority.to_s,"RT")
|
||||
pdf.Ln
|
||||
|
||||
|
||||
pdf.SetFontStyle('B',9)
|
||||
pdf.RDMCell(35,5, l(:field_author) + ":","L")
|
||||
pdf.SetFontStyle('',9)
|
||||
|
@ -367,8 +367,8 @@ module Redmine
|
|||
pdf.RDMCell(35,5, l(:field_category) + ":","L")
|
||||
pdf.SetFontStyle('',9)
|
||||
pdf.RDMCell(60,5, issue.category.to_s,"R")
|
||||
pdf.Ln
|
||||
|
||||
pdf.Ln
|
||||
|
||||
pdf.SetFontStyle('B',9)
|
||||
pdf.RDMCell(35,5, l(:field_created_on) + ":","L")
|
||||
pdf.SetFontStyle('',9)
|
||||
|
@ -378,7 +378,7 @@ module Redmine
|
|||
pdf.SetFontStyle('',9)
|
||||
pdf.RDMCell(60,5, issue.assigned_to.to_s,"R")
|
||||
pdf.Ln
|
||||
|
||||
|
||||
pdf.SetFontStyle('B',9)
|
||||
pdf.RDMCell(35,5, l(:field_updated_on) + ":","LB")
|
||||
pdf.SetFontStyle('',9)
|
||||
|
@ -388,14 +388,14 @@ module Redmine
|
|||
pdf.SetFontStyle('',9)
|
||||
pdf.RDMCell(60,5, format_date(issue.due_date),"RB")
|
||||
pdf.Ln
|
||||
|
||||
|
||||
for custom_value in issue.custom_field_values
|
||||
pdf.SetFontStyle('B',9)
|
||||
pdf.RDMCell(35,5, custom_value.custom_field.name + ":","L")
|
||||
pdf.SetFontStyle('',9)
|
||||
pdf.RDMMultiCell(155,5, (show_value custom_value),"R")
|
||||
end
|
||||
|
||||
|
||||
pdf.SetFontStyle('B',9)
|
||||
pdf.RDMCell(35,5, l(:field_subject) + ":","LT")
|
||||
pdf.SetFontStyle('',9)
|
||||
|
@ -409,7 +409,7 @@ module Redmine
|
|||
pdf.Line(pdf.GetX, y0, pdf.GetX, pdf.GetY)
|
||||
pdf.Line(pdf.GetX, pdf.GetY, pdf.GetX + 190, pdf.GetY)
|
||||
pdf.Ln
|
||||
|
||||
|
||||
if issue.changesets.any? &&
|
||||
User.current.allowed_to?(:view_changesets, issue.project)
|
||||
pdf.SetFontStyle('B',9)
|
||||
|
@ -423,14 +423,14 @@ module Redmine
|
|||
unless changeset.comments.blank?
|
||||
pdf.SetFontStyle('',8)
|
||||
pdf.RDMMultiCell(190,5, changeset.comments.to_s)
|
||||
end
|
||||
end
|
||||
pdf.Ln
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
pdf.SetFontStyle('B',9)
|
||||
pdf.RDMCell(190,5, l(:label_history), "B")
|
||||
pdf.Ln
|
||||
pdf.Ln
|
||||
for journal in issue.journals.find(
|
||||
:all, :include => [:user, :details],
|
||||
:order => "#{Journal.table_name}.created_on ASC")
|
||||
|
@ -446,7 +446,7 @@ module Redmine
|
|||
pdf.Ln unless journal.details.empty?
|
||||
pdf.SetFontStyle('',8)
|
||||
pdf.RDMMultiCell(190,5, journal.notes.to_s)
|
||||
end
|
||||
end
|
||||
pdf.Ln
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue