Project

General

Profile

Feature #35683 » 0001-interpret-thumbnail-macro-in-description-notes-and-f.patch

Jens Krämer, 2021-08-25 11:51

View differences:

lib/redmine/export/pdf.rb
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?
lib/redmine/export/pdf/issues_pdf_helper.rb
# 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?}
......
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
......
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?
......
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
......
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'
(3-3/3)