Mercurial > hg > soundsoftware-site
comparison lib/redmine/export/pdf.rb @ 1517:dffacf8a6908 redmine-2.5
Update to Redmine SVN revision 13367 on 2.5-stable branch
author | Chris Cannam |
---|---|
date | Tue, 09 Sep 2014 09:29:00 +0100 |
parents | e248c7af89ec |
children |
comparison
equal
deleted
inserted
replaced
1516:b450a9d58aed | 1517:dffacf8a6908 |
---|---|
255 # fetch row values | 255 # fetch row values |
256 def fetch_row_values(issue, query, level) | 256 def fetch_row_values(issue, query, level) |
257 query.inline_columns.collect do |column| | 257 query.inline_columns.collect do |column| |
258 s = if column.is_a?(QueryCustomFieldColumn) | 258 s = if column.is_a?(QueryCustomFieldColumn) |
259 cv = issue.visible_custom_field_values.detect {|v| v.custom_field_id == column.custom_field.id} | 259 cv = issue.visible_custom_field_values.detect {|v| v.custom_field_id == column.custom_field.id} |
260 show_value(cv) | 260 show_value(cv, false) |
261 else | 261 else |
262 value = issue.send(column.name) | 262 value = issue.send(column.name) |
263 if column.name == :subject | 263 if column.name == :subject |
264 value = " " * level + value | 264 value = " " * level + value |
265 end | 265 end |
571 right << nil | 571 right << nil |
572 end | 572 end |
573 | 573 |
574 half = (issue.visible_custom_field_values.size / 2.0).ceil | 574 half = (issue.visible_custom_field_values.size / 2.0).ceil |
575 issue.visible_custom_field_values.each_with_index do |custom_value, i| | 575 issue.visible_custom_field_values.each_with_index do |custom_value, i| |
576 (i < half ? left : right) << [custom_value.custom_field.name, show_value(custom_value)] | 576 (i < half ? left : right) << [custom_value.custom_field.name, show_value(custom_value, false)] |
577 end | 577 end |
578 | 578 |
579 rows = left.size > right.size ? left.size : right.size | 579 rows = left.size > right.size ? left.size : right.size |
580 rows.times do |i| | 580 rows.times do |i| |
581 item = left[i] | 581 item = left[i] |
602 issue.description.to_s, issue.attachments, "LRB") | 602 issue.description.to_s, issue.attachments, "LRB") |
603 | 603 |
604 unless issue.leaf? | 604 unless issue.leaf? |
605 # for CJK | 605 # for CJK |
606 truncate_length = ( l(:general_pdf_encoding).upcase == "UTF-8" ? 90 : 65 ) | 606 truncate_length = ( l(:general_pdf_encoding).upcase == "UTF-8" ? 90 : 65 ) |
607 | |
608 pdf.SetFontStyle('B',9) | 607 pdf.SetFontStyle('B',9) |
609 pdf.RDMCell(35+155,5, l(:label_subtask_plural) + ":", "LTR") | 608 pdf.RDMCell(35+155,5, l(:label_subtask_plural) + ":", "LTR") |
610 pdf.Ln | 609 pdf.Ln |
611 issue_list(issue.descendants.visible.sort_by(&:lft)) do |child, level| | 610 issue_list(issue.descendants.visible.sort_by(&:lft)) do |child, level| |
612 buf = truncate("#{child.tracker} # #{child.id}: #{child.subject}", | 611 buf = "#{child.tracker} # #{child.id}: #{child.subject}". |
613 :length => truncate_length) | 612 truncate(truncate_length) |
614 level = 10 if level >= 10 | 613 level = 10 if level >= 10 |
615 pdf.SetFontStyle('',8) | 614 pdf.SetFontStyle('',8) |
616 pdf.RDMCell(35+135,5, (level >=1 ? " " * level : "") + buf, "L") | 615 pdf.RDMCell(35+135,5, (level >=1 ? " " * level : "") + buf, "L") |
617 pdf.SetFontStyle('B',8) | 616 pdf.SetFontStyle('B',8) |
618 pdf.RDMCell(20,5, child.status.to_s, "R") | 617 pdf.RDMCell(20,5, child.status.to_s, "R") |
622 | 621 |
623 relations = issue.relations.select { |r| r.other_issue(issue).visible? } | 622 relations = issue.relations.select { |r| r.other_issue(issue).visible? } |
624 unless relations.empty? | 623 unless relations.empty? |
625 # for CJK | 624 # for CJK |
626 truncate_length = ( l(:general_pdf_encoding).upcase == "UTF-8" ? 80 : 60 ) | 625 truncate_length = ( l(:general_pdf_encoding).upcase == "UTF-8" ? 80 : 60 ) |
627 | |
628 pdf.SetFontStyle('B',9) | 626 pdf.SetFontStyle('B',9) |
629 pdf.RDMCell(35+155,5, l(:label_related_issues) + ":", "LTR") | 627 pdf.RDMCell(35+155,5, l(:label_related_issues) + ":", "LTR") |
630 pdf.Ln | 628 pdf.Ln |
631 relations.each do |relation| | 629 relations.each do |relation| |
632 buf = "" | 630 buf = "" |
637 if Setting.cross_project_issue_relations? | 635 if Setting.cross_project_issue_relations? |
638 buf += "#{relation.other_issue(issue).project} - " | 636 buf += "#{relation.other_issue(issue).project} - " |
639 end | 637 end |
640 buf += "#{relation.other_issue(issue).tracker}" + | 638 buf += "#{relation.other_issue(issue).tracker}" + |
641 " # #{relation.other_issue(issue).id}: #{relation.other_issue(issue).subject}" | 639 " # #{relation.other_issue(issue).id}: #{relation.other_issue(issue).subject}" |
642 buf = truncate(buf, :length => truncate_length) | 640 buf = buf.truncate(truncate_length) |
643 pdf.SetFontStyle('', 8) | 641 pdf.SetFontStyle('', 8) |
644 pdf.RDMCell(35+155-60, 5, buf, "L") | 642 pdf.RDMCell(35+155-60, 5, buf, "L") |
645 pdf.SetFontStyle('B',8) | 643 pdf.SetFontStyle('B',8) |
646 pdf.RDMCell(20,5, relation.other_issue(issue).status.to_s, "") | 644 pdf.RDMCell(20,5, relation.other_issue(issue).status.to_s, "") |
647 pdf.RDMCell(20,5, format_date(relation.other_issue(issue).start_date), "") | 645 pdf.RDMCell(20,5, format_date(relation.other_issue(issue).start_date), "") |