Index: issues_pdf_helper.rb
===================================================================
--- issues_pdf_helper.rb (Revision 178)
+++ issues_pdf_helper.rb (Arbeitskopie)
@@ -71,7 +71,7 @@
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
@@ -96,9 +96,17 @@
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!(/(
\n)|(<\/td>\n)|(\n)|(<\/table>\n)|()|(<\/tr>)|()|(<\/strong>)|()|(<\/p>)|( \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!(/(\n)|(<\/td>\n)|(\n)|(<\/table>\n)|()|(<\/tr>)|()|(<\/strong>)|()|(<\/p>)|( \n)| (\t{2,}) /, "")}
+ end
+ heights << pdf.get_string_height(60, heightitem ? heightitem.last.to_s : "")
height = heights.max
item = left[i]
@@ -105,13 +113,13 @@
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
@@ -132,13 +140,13 @@
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?
@@ -338,7 +346,7 @@
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
@@ -371,7 +379,7 @@
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
@@ -519,7 +527,11 @@
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)
+ unless head
+ heightcolumn = column.dup unless column.nil?
+ heightcolumn = heightcolumn.to_s.gsub(/(\n)|(<\/td>\n)|(\n)|(<\/table>\n)|()|(<\/tr>)|()|(<\/strong>)|()|(<\/p>)|( \n)| (\t{2,}) /, "")
+ end
+ heights << pdf.get_string_height(col_widths[i], head ? column.caption : heightcolumn)
end
return heights.max
end
@@ -527,7 +539,7 @@
# 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
| | |