##// END OF EJS Templates
remove trailing white-spaces lib/redmine/export/pdf.rb....
Toshi MARUYAMA -
r5543:479d9380a7ec
parent child
Show More
@@ -1,18 +1,18
1 1 # encoding: utf-8
2 2 #
3 3 # Redmine - project management software
4 # Copyright (C) 2006-2009 Jean-Philippe Lang
4 # Copyright (C) 2006-2011 Jean-Philippe Lang
5 5 #
6 6 # This program is free software; you can redistribute it and/or
7 7 # modify it under the terms of the GNU General Public License
8 8 # as published by the Free Software Foundation; either version 2
9 9 # of the License, or (at your option) any later version.
10 #
10 #
11 11 # This program is distributed in the hope that it will be useful,
12 12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 14 # GNU General Public License for more details.
15 #
15 #
16 16 # You should have received a copy of the GNU General Public License
17 17 # along with this program; if not, write to the Free Software
18 18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -28,11 +28,11 module Redmine
28 28 module PDF
29 29 include ActionView::Helpers::TextHelper
30 30 include ActionView::Helpers::NumberHelper
31
31
32 32 class ITCPDF < TCPDF
33 33 include Redmine::I18n
34 34 attr_accessor :footer_date
35
35
36 36 def initialize(lang)
37 37 super()
38 38 set_language_if_valid lang
@@ -41,11 +41,11 module Redmine
41 41 SetCreator(Redmine::Info.app_name)
42 42 SetFont(@font_for_content)
43 43 end
44
44
45 45 def SetFontStyle(style, size)
46 46 SetFont(@font_for_content, style, size)
47 47 end
48
48
49 49 def SetTitle(txt)
50 50 txt = begin
51 51 utf16txt = Iconv.conv('UTF-16BE', 'UTF-8', txt)
@@ -57,7 +57,7 module Redmine
57 57 end || ''
58 58 super(txt)
59 59 end
60
60
61 61 def textstring(s)
62 62 # Format a text string
63 63 if s =~ /^</ # This means the string is hex-dumped.
@@ -66,10 +66,10 module Redmine
66 66 return '('+escape(s)+')'
67 67 end
68 68 end
69
69
70 70 alias RDMCell Cell
71 71 alias RDMMultiCell MultiCell
72
72
73 73 def Footer
74 74 SetFont(@font_for_footer, 'I', 8)
75 75 SetY(-15)
@@ -224,7 +224,7 module Redmine
224 224 pdf.SetFontStyle('B',11)
225 225 pdf.RDMCell(190,10, title)
226 226 pdf.Ln
227
227
228 228 # headers
229 229 pdf.SetFontStyle('B',8)
230 230 pdf.SetFillColor(230, 230, 230)
@@ -241,7 +241,7 module Redmine
241 241 issues_to_pdf_write_cells(pdf, query.columns, col_width, row_height, true)
242 242 issues_to_pdf_draw_borders(pdf, base_x, base_y, base_y + max_height, col_id_width, col_width)
243 243 pdf.SetY(base_y + max_height);
244
244
245 245 # rows
246 246 pdf.SetFontStyle('',8)
247 247 pdf.SetFillColor(255, 255, 255)
@@ -250,7 +250,7 module Redmine
250 250 if query.grouped? &&
251 251 (group = query.group_by_column.value(issue)) != previous_group
252 252 pdf.SetFontStyle('B',9)
253 pdf.RDMCell(277, row_height,
253 pdf.RDMCell(277, row_height,
254 254 (group.blank? ? 'None' : group.to_s) + " (#{query.issue_count_by_group[group]})",
255 255 1, 1, 'L')
256 256 pdf.SetFontStyle('',8)
@@ -273,14 +273,14 module Redmine
273 273 end
274 274 s.to_s
275 275 end
276
276
277 277 # render it off-page to find the max height used
278 278 base_x = pdf.GetX
279 279 base_y = pdf.GetY
280 280 pdf.SetY(2 * page_height)
281 281 max_height = issues_to_pdf_write_cells(pdf, col_values, col_width, row_height)
282 282 pdf.SetXY(base_x, base_y)
283
283
284 284 # make new page if it doesn't fit on the current one
285 285 space_left = page_height - base_y - bottom_margin
286 286 if max_height > space_left
@@ -295,14 +295,14 module Redmine
295 295 issues_to_pdf_draw_borders(pdf, base_x, base_y, base_y + max_height, col_id_width, col_width)
296 296 pdf.SetY(base_y + max_height);
297 297 end
298
298
299 299 if issues.size == Setting.issues_export_limit.to_i
300 300 pdf.SetFontStyle('B',10)
301 301 pdf.RDMCell(0, row_height, '...')
302 302 end
303 303 pdf.Output
304 304 end
305
305
306 306 # Renders MultiCells and returns the maximum height used
307 307 def issues_to_pdf_write_cells(pdf, col_values, col_widths, row_height, head=false)
308 308 base_y = pdf.GetY
@@ -319,7 +319,7 module Redmine
319 319 end
320 320 return max_height
321 321 end
322
322
323 323 # Draw lines to close the row (MultiCell border drawing in not uniform)
324 324 def issues_to_pdf_draw_borders(pdf, top_x, top_y, lower_y, id_width, col_widths)
325 325 col_x = top_x + id_width
@@ -331,7 +331,7 module Redmine
331 331 pdf.Line(top_x, top_y, top_x, lower_y) # left border
332 332 pdf.Line(top_x, lower_y, col_x, lower_y) # bottom border
333 333 end
334
334
335 335 # Returns a PDF string of a single issue
336 336 def issue_to_pdf(issue)
337 337 if l(:general_pdf_encoding).upcase != 'UTF-8'
@@ -343,7 +343,7 module Redmine
343 343 pdf.alias_nb_pages
344 344 pdf.footer_date = format_date(Date.today)
345 345 pdf.AddPage
346 pdf.SetFontStyle('B',11)
346 pdf.SetFontStyle('B',11)
347 347 pdf.RDMMultiCell(190,5, "#{issue.project} - #{issue.tracker} # #{issue.id}: #{issue.subject}")
348 348 pdf.Ln
349 349
@@ -358,7 +358,7 module Redmine
358 358 pdf.SetFontStyle('',9)
359 359 pdf.RDMCell(60,5, issue.priority.to_s,"RT")
360 360 pdf.Ln
361
361
362 362 pdf.SetFontStyle('B',9)
363 363 pdf.RDMCell(35,5, l(:field_author) + ":","L")
364 364 pdf.SetFontStyle('',9)
@@ -367,8 +367,8 module Redmine
367 367 pdf.RDMCell(35,5, l(:field_category) + ":","L")
368 368 pdf.SetFontStyle('',9)
369 369 pdf.RDMCell(60,5, issue.category.to_s,"R")
370 pdf.Ln
371
370 pdf.Ln
371
372 372 pdf.SetFontStyle('B',9)
373 373 pdf.RDMCell(35,5, l(:field_created_on) + ":","L")
374 374 pdf.SetFontStyle('',9)
@@ -378,7 +378,7 module Redmine
378 378 pdf.SetFontStyle('',9)
379 379 pdf.RDMCell(60,5, issue.assigned_to.to_s,"R")
380 380 pdf.Ln
381
381
382 382 pdf.SetFontStyle('B',9)
383 383 pdf.RDMCell(35,5, l(:field_updated_on) + ":","LB")
384 384 pdf.SetFontStyle('',9)
@@ -388,14 +388,14 module Redmine
388 388 pdf.SetFontStyle('',9)
389 389 pdf.RDMCell(60,5, format_date(issue.due_date),"RB")
390 390 pdf.Ln
391
391
392 392 for custom_value in issue.custom_field_values
393 393 pdf.SetFontStyle('B',9)
394 394 pdf.RDMCell(35,5, custom_value.custom_field.name + ":","L")
395 395 pdf.SetFontStyle('',9)
396 396 pdf.RDMMultiCell(155,5, (show_value custom_value),"R")
397 397 end
398
398
399 399 pdf.SetFontStyle('B',9)
400 400 pdf.RDMCell(35,5, l(:field_subject) + ":","LT")
401 401 pdf.SetFontStyle('',9)
@@ -409,7 +409,7 module Redmine
409 409 pdf.Line(pdf.GetX, y0, pdf.GetX, pdf.GetY)
410 410 pdf.Line(pdf.GetX, pdf.GetY, pdf.GetX + 190, pdf.GetY)
411 411 pdf.Ln
412
412
413 413 if issue.changesets.any? &&
414 414 User.current.allowed_to?(:view_changesets, issue.project)
415 415 pdf.SetFontStyle('B',9)
@@ -423,14 +423,14 module Redmine
423 423 unless changeset.comments.blank?
424 424 pdf.SetFontStyle('',8)
425 425 pdf.RDMMultiCell(190,5, changeset.comments.to_s)
426 end
426 end
427 427 pdf.Ln
428 428 end
429 429 end
430
430
431 431 pdf.SetFontStyle('B',9)
432 432 pdf.RDMCell(190,5, l(:label_history), "B")
433 pdf.Ln
433 pdf.Ln
434 434 for journal in issue.journals.find(
435 435 :all, :include => [:user, :details],
436 436 :order => "#{Journal.table_name}.created_on ASC")
@@ -446,7 +446,7 module Redmine
446 446 pdf.Ln unless journal.details.empty?
447 447 pdf.SetFontStyle('',8)
448 448 pdf.RDMMultiCell(190,5, journal.notes.to_s)
449 end
449 end
450 450 pdf.Ln
451 451 end
452 452
General Comments 0
You need to be logged in to leave comments. Login now