##// END OF EJS Templates
Merged r11693 from trunk (#13630)....
Etienne Massip -
r11465:e189641e8c15
parent child
Show More
@@ -380,7 +380,7 module Redmine
380 380 col_width
381 381 end
382 382
383 def render_table_header(pdf, query, col_width, row_height, col_id_width, table_width)
383 def render_table_header(pdf, query, col_width, row_height, table_width)
384 384 # headers
385 385 pdf.SetFontStyle('B',8)
386 386 pdf.SetFillColor(230, 230, 230)
@@ -389,13 +389,12 module Redmine
389 389 base_x = pdf.GetX
390 390 base_y = pdf.GetY
391 391 max_height = issues_to_pdf_write_cells(pdf, query.inline_columns, col_width, row_height, true)
392 pdf.Rect(base_x, base_y, table_width + col_id_width, max_height, 'FD');
392 pdf.Rect(base_x, base_y, table_width, max_height, 'FD');
393 393 pdf.SetXY(base_x, base_y);
394 394
395 395 # write the cells on page
396 pdf.RDMCell(col_id_width, row_height, "#", "T", 0, 'C', 1)
397 396 issues_to_pdf_write_cells(pdf, query.inline_columns, col_width, row_height, true)
398 issues_to_pdf_draw_borders(pdf, base_x, base_y, base_y + max_height, col_id_width, col_width)
397 issues_to_pdf_draw_borders(pdf, base_x, base_y, base_y + max_height, col_width)
399 398 pdf.SetY(base_y + max_height);
400 399
401 400 # rows
@@ -417,22 +416,22 module Redmine
417 416 # Landscape A4 = 210 x 297 mm
418 417 page_height = 210
419 418 page_width = 297
419 left_margin = 10
420 420 right_margin = 10
421 421 bottom_margin = 20
422 col_id_width = 10
423 422 row_height = 4
424 423
425 424 # column widths
426 table_width = page_width - right_margin - 10 # fixed left margin
425 table_width = page_width - right_margin - left_margin
427 426 col_width = []
428 427 unless query.inline_columns.empty?
429 col_width = calc_col_width(issues, query, table_width - col_id_width, pdf)
428 col_width = calc_col_width(issues, query, table_width, pdf)
430 429 table_width = col_width.inject(0) {|s,v| s += v}
431 430 end
432 431
433 432 # use full width if the description is displayed
434 433 if table_width > 0 && query.has_column?(:description)
435 col_width = col_width.map {|w| w = w * (page_width - right_margin - 10 - col_id_width) / table_width}
434 col_width = col_width.map {|w| w * (page_width - right_margin - left_margin) / table_width}
436 435 table_width = col_width.inject(0) {|s,v| s += v}
437 436 end
438 437
@@ -440,7 +439,7 module Redmine
440 439 pdf.SetFontStyle('B',11)
441 440 pdf.RDMCell(190,10, title)
442 441 pdf.Ln
443 render_table_header(pdf, query, col_width, row_height, col_id_width, table_width)
442 render_table_header(pdf, query, col_width, row_height, table_width)
444 443 previous_group = false
445 444 issue_list(issues) do |issue, level|
446 445 if query.grouped? &&
@@ -449,7 +448,7 module Redmine
449 448 group_label = group.blank? ? 'None' : group.to_s.dup
450 449 group_label << " (#{query.issue_count_by_group[group]})"
451 450 pdf.Bookmark group_label, 0, -1
452 pdf.RDMCell(table_width + col_id_width, row_height * 2, group_label, 1, 1, 'L')
451 pdf.RDMCell(table_width, row_height * 2, group_label, 1, 1, 'L')
453 452 pdf.SetFontStyle('',8)
454 453 previous_group = group
455 454 end
@@ -468,15 +467,14 module Redmine
468 467 space_left = page_height - base_y - bottom_margin
469 468 if max_height > space_left
470 469 pdf.AddPage("L")
471 render_table_header(pdf, query, col_width, row_height, col_id_width, table_width)
470 render_table_header(pdf, query, col_width, row_height, table_width)
472 471 base_x = pdf.GetX
473 472 base_y = pdf.GetY
474 473 end
475 474
476 475 # write the cells on page
477 pdf.RDMCell(col_id_width, row_height, issue.id.to_s, "T", 0, 'C', 1)
478 476 issues_to_pdf_write_cells(pdf, col_values, col_width, row_height)
479 issues_to_pdf_draw_borders(pdf, base_x, base_y, base_y + max_height, col_id_width, col_width)
477 issues_to_pdf_draw_borders(pdf, base_x, base_y, base_y + max_height, col_width)
480 478 pdf.SetY(base_y + max_height);
481 479
482 480 if query.has_column?(:description) && issue.description?
@@ -513,9 +511,8 module Redmine
513 511 end
514 512
515 513 # Draw lines to close the row (MultiCell border drawing in not uniform)
516 def issues_to_pdf_draw_borders(pdf, top_x, top_y, lower_y,
517 id_width, col_widths)
518 col_x = top_x + id_width
514 def issues_to_pdf_draw_borders(pdf, top_x, top_y, lower_y, col_widths)
515 col_x = top_x
519 516 pdf.Line(col_x, top_y, col_x, lower_y) # id right border
520 517 col_widths.each do |width|
521 518 col_x += width
General Comments 0
You need to be logged in to leave comments. Login now