Patch #30026 » issues_pdf_helper.rb-redmine-3.4.6_3rd.patch
| issues_pdf_helper.rb (Arbeitskopie) | ||
|---|---|---|
|
custom_field_values = issue.visible_custom_field_values.reject {|value| value.custom_field.full_width_layout?}
|
||
|
half = (custom_field_values.size / 2.0).ceil
|
||
|
custom_field_values.each_with_index do |custom_value, i|
|
||
|
(i < half ? left : right) << [custom_value.custom_field.name, show_value(custom_value, false)]
|
||
|
(i < half ? left : right) << [custom_value.custom_field.name, show_value(custom_value, true)]
|
||
|
end
|
||
|
|
||
|
if pdf.get_rtl
|
||
| ... | ... | |
|
heights << pdf.get_string_height(35, item ? "#{item.first}:" : "")
|
||
|
pdf.SetFontStyle('',9)
|
||
|
item = left[i]
|
||
|
heights << pdf.get_string_height(60, item ? item.last.to_s : "")
|
||
|
unless item.nil?
|
||
|
heightitem = item.map {|e| e.dup unless e.nil? }
|
||
|
heightitem.map {|text| text.to_s.gsub!(/(<td .+>\n)|(<\/td>\n)|(<table>\n)|(<\/table>\n)|(<tr>\n)|(<\/tr>)|(<strong>)|(<\/strong>)|(<p>)|(<\/p>)|(<ol>\n)| (\t{2,}) /, "") }
|
||
|
end
|
||
|
heights << pdf.get_string_height(60, heightitem ? heightitem.last.to_s : "")
|
||
|
item = right[i]
|
||
|
heights << pdf.get_string_height(60, item ? item.last.to_s : "")
|
||
|
unless item.nil?
|
||
|
heightitem = item.map {|e| e.dup unless e.nil? }
|
||
|
heightitem.map {|text| text.to_s.gsub!(/(<td .+>\n)|(<\/td>\n)|(<table>\n)|(<\/table>\n)|(<tr>\n)|(<\/tr>)|(<strong>)|(<\/strong>)|(<p>)|(<\/p>)|(<ol>\n)| (\t{2,}) /, "")}
|
||
|
end
|
||
|
heights << pdf.get_string_height(60, heightitem ? heightitem.last.to_s : "")
|
||
|
height = heights.max
|
||
|
|
||
|
item = left[i]
|
||
|
pdf.SetFontStyle('B',9)
|
||
|
pdf.RDMMultiCell(35, height, item ? "#{item.first}:" : "", (i == 0 ? border_first_top : border_first), '', 0, 0)
|
||
|
pdf.SetFontStyle('',9)
|
||
|
pdf.RDMMultiCell(60, height, item ? item.last.to_s : "", (i == 0 ? border_last_top : border_last), '', 0, 0)
|
||
|
|
||
|
pdf.RDMwriteFormattedCell(60, height, '', '', item ? item.last.to_s : "", issue.attachments,(i == 0 ? border_last_top : border_last), 0)
|
||
|
|
||
|
item = right[i]
|
||
|
pdf.SetFontStyle('B',9)
|
||
|
pdf.RDMMultiCell(35, height, item ? "#{item.first}:" : "", (i == 0 ? border_first_top : border_first), '', 0, 0)
|
||
|
pdf.SetFontStyle('',9)
|
||
|
pdf.RDMMultiCell(60, height, item ? item.last.to_s : "", (i == 0 ? border_last_top : border_last), '', 0, 2)
|
||
|
pdf.RDMwriteFormattedCell(60, height, '', '', item ? item.last.to_s : "", issue.attachments, (i == 0 ? border_last_top : border_last), 2)
|
||
|
|
||
|
pdf.set_x(base_x)
|
||
|
end
|
||
| ... | ... | |
|
|
||
|
custom_field_values = issue.visible_custom_field_values.select {|value| value.custom_field.full_width_layout?}
|
||
|
custom_field_values.each do |value|
|
||
|
text = show_value(value, false)
|
||
|
text = show_value(value, true)
|
||
|
next if text.blank?
|
||
|
|
||
|
pdf.SetFontStyle('B',9)
|
||
|
pdf.RDMCell(35+155, 5, value.custom_field.name, "LRT", 1)
|
||
|
pdf.SetFontStyle('',9)
|
||
|
pdf.RDMwriteHTMLCell(35+155, 5, '', '', text, issue.attachments, "LRB")
|
||
|
pdf.RDMwriteFormattedCell(35+155, 5, '', '', text, issue.attachments, "LRB")
|
||
|
end
|
||
|
|
||
|
unless issue.leaf?
|
||
| ... | ... | |
|
if query.has_column?(:description) && issue.description?
|
||
|
pdf.set_x(10)
|
||
|
pdf.set_auto_page_break(true, bottom_margin)
|
||
|
pdf.RDMwriteHTMLCell(0, 5, 10, '', issue.description.to_s, issue.attachments, "LRBT")
|
||
|
pdf.RDMwriteFormattedCell(0, 5, 10, '', textilizable(issue, :description), issue.attachments, "LRBT")
|
||
|
pdf.set_auto_page_break(false)
|
||
|
end
|
||
|
|
||
| ... | ... | |
|
query.inline_columns.collect do |column|
|
||
|
s = if column.is_a?(QueryCustomFieldColumn)
|
||
|
cv = issue.visible_custom_field_values.detect {|v| v.custom_field_id == column.custom_field.id}
|
||
|
show_value(cv, false)
|
||
|
show_value(cv, true )
|
||
|
else
|
||
|
value = issue.send(column.name)
|
||
|
case column.name
|
||
| ... | ... | |
|
def get_issues_to_pdf_write_cells(pdf, col_values, col_widths, head=false)
|
||
|
heights = []
|
||
|
col_values.each_with_index do |column, i|
|
||
|
heights << pdf.get_string_height(col_widths[i], head ? column.caption : column)
|
||
|
heights << pdf.get_string_height(col_widths[i], head ? column.caption : textilizable(column))
|
||
|
end
|
||
|
return heights.max
|
||
|
end
|
||
| ... | ... | |
|
# Renders MultiCells and returns the maximum height used
|
||
|
def issues_to_pdf_write_cells(pdf, col_values, col_widths, row_height, head=false)
|
||
|
col_values.each_with_index do |column, i|
|
||
|
pdf.RDMMultiCell(col_widths[i], row_height, head ? column.caption : column.strip, 1, '', 1, 0)
|
||
|
pdf.RDMwriteFormattedCell(col_widths[i], row_height, '', '', head ? column.caption : column.strip, [], 1, 0, 1)
|
||
|
end
|
||
|
end
|
||
|
|
||