summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMarius Balteanu <marius.balteanu@zitec.com>2021-09-06 19:22:50 +0000
committerMarius Balteanu <marius.balteanu@zitec.com>2021-09-06 19:22:50 +0000
commit326a1b4dd2e0c877beb1023fa3d6d943bb0275e4 (patch)
treec22dc72bf1416bdf7ecb3fc9b4654dd530e86e5d /lib
parentfdf949a50927fc1bf5a6d0226e43aca1f73e7ee4 (diff)
downloadredmine-326a1b4dd2e0c877beb1023fa3d6d943bb0275e4.tar.gz
redmine-326a1b4dd2e0c877beb1023fa3d6d943bb0275e4.zip
Interpret thumbnail macro in description, notes and formatted custom fields in issues list PDF export (35683).
Patch by Jens Krämer. git-svn-id: http://svn.redmine.org/redmine/trunk@21213 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib')
-rw-r--r--lib/redmine/export/pdf.rb4
-rw-r--r--lib/redmine/export/pdf/issues_pdf_helper.rb40
2 files changed, 25 insertions, 19 deletions
diff --git a/lib/redmine/export/pdf.rb b/lib/redmine/export/pdf.rb
index 7e6252b3f..cba4167b4 100644
--- a/lib/redmine/export/pdf.rb
+++ b/lib/redmine/export/pdf.rb
@@ -104,6 +104,10 @@ module Redmine
atta = RDMPdfEncoding.attach(@attachments, attrname, "UTF-8")
if atta
return atta.diskfile
+ elsif %r{/attachments/download/(?<id>[^/]+)/} =~ attrname and
+ atta = @attachments.find{|a| a.id.to_s == id} and
+ atta.readable? and atta.visible?
+ return atta.diskfile
elsif %r{/attachments/thumbnail/(?<id>[^/]+)/(?<size>\d+)} =~ attrname and
atta = @attachments.find{|a| a.id.to_s == id} and
atta.readable? and atta.visible?
diff --git a/lib/redmine/export/pdf/issues_pdf_helper.rb b/lib/redmine/export/pdf/issues_pdf_helper.rb
index 98c7347ab..7fda6ad36 100644
--- a/lib/redmine/export/pdf/issues_pdf_helper.rb
+++ b/lib/redmine/export/pdf/issues_pdf_helper.rb
@@ -122,14 +122,7 @@ module Redmine
# Set resize image scale
pdf.set_image_scale(1.6)
- text =
- textilizable(
- issue, :description,
- :only_path => false,
- :edit_section_links => false,
- :headings => false,
- :inline_attachments => false
- )
+ text = pdf_format_text(issue, :description)
pdf.RDMwriteFormattedCell(35+155, 5, '', '', text, issue.attachments, "LRB")
custom_field_values = issue.visible_custom_field_values.select {|value| value.custom_field.full_width_layout?}
@@ -232,14 +225,7 @@ module Redmine
if journal.notes?
pdf.ln unless journal.details.empty?
pdf.SetFontStyle('', 8)
- text =
- textilizable(
- journal, :notes,
- :only_path => false,
- :edit_section_links => false,
- :headings => false,
- :inline_attachments => false
- )
+ text = pdf_format_text(journal, :notes)
pdf.RDMwriteFormattedCell(190, 5, '', '', text, issue.attachments, "")
end
pdf.ln
@@ -347,14 +333,17 @@ module Redmine
pdf.set_y(base_y + max_height)
query.block_columns.each do |column|
+ is_html = false
if column.is_a?(QueryCustomFieldColumn)
cv =
issue.visible_custom_field_values.detect do |v|
v.custom_field_id == column.custom_field.id
end
- text = show_value(cv, false)
+ is_html = cv.custom_field.full_text_formatting?
+ text = show_value(cv, is_html)
else
- text = issue.send(column.name)
+ text = pdf_format_text issue, column.name.to_sym
+ is_html = true
end
next if text.blank?
@@ -363,7 +352,11 @@ module Redmine
pdf.SetFontStyle('B', 9)
pdf.RDMCell(0, 5, column.caption, "LRT", 1)
pdf.SetFontStyle('', 9)
- pdf.RDMwriteHTMLCell(0, 5, '', '', text, [], "LRB")
+ if is_html
+ pdf.RDMwriteFormattedCell(0, 5, '', '', text, issue.attachments, "LRB")
+ else
+ pdf.RDMwriteHTMLCell(0, 5, '', '', text, [], "LRB")
+ end
pdf.set_auto_page_break(false)
end
end
@@ -375,6 +368,15 @@ module Redmine
pdf.output
end
+ def pdf_format_text(object, attribute)
+ textilizable(object, attribute,
+ :only_path => false,
+ :edit_section_links => false,
+ :headings => false,
+ :inline_attachments => false
+ )
+ end
+
def is_cjk?
case current_language.to_s.downcase
when 'ja', 'zh-tw', 'zh', 'ko'