71 |
71 |
custom_field_values = issue.visible_custom_field_values.reject {|value| value.custom_field.full_width_layout?}
|
72 |
72 |
half = (custom_field_values.size / 2.0).ceil
|
73 |
73 |
custom_field_values.each_with_index do |custom_value, i|
|
74 |
|
(i < half ? left : right) << [custom_value.custom_field.name, show_value(custom_value, false)]
|
|
74 |
(i < half ? left : right) << [custom_value.custom_field.name, show_value(custom_value, true)]
|
75 |
75 |
end
|
76 |
76 |
|
77 |
77 |
if pdf.get_rtl
|
... | ... | |
96 |
96 |
heights << pdf.get_string_height(35, item ? "#{item.first}:" : "")
|
97 |
97 |
pdf.SetFontStyle('',9)
|
98 |
98 |
item = left[i]
|
99 |
|
heights << pdf.get_string_height(60, item ? item.last.to_s : "")
|
|
99 |
unless item.nil?
|
|
100 |
heightitem = item.map {|e| e.dup unless e.nil? }
|
|
101 |
heightitem.map {|text| text.to_s.gsub!(/(<td .+>\n)|(<\/td>\n)|(<table>\n)|(<\/table>\n)|(<tr>)|(<\/tr>)|(<strong>)|(<\/strong>)|(<p>)|(<\/p>)|(<ol>\n)| (\t{2,}) /, "") }
|
|
102 |
end
|
|
103 |
heights << pdf.get_string_height(60, heightitem ? heightitem.last.to_s : "")
|
100 |
104 |
item = right[i]
|
101 |
|
heights << pdf.get_string_height(60, item ? item.last.to_s : "")
|
|
105 |
unless item.nil?
|
|
106 |
heightitem = item.map {|e| e.dup unless e.nil? }
|
|
107 |
heightitem.map {|text| text.to_s.gsub!(/(<td .+>\n)|(<\/td>\n)|(<table>\n)|(<\/table>\n)|(<tr>)|(<\/tr>)|(<strong>)|(<\/strong>)|(<p>)|(<\/p>)|(<ol>\n)| (\t{2,}) /, "")}
|
|
108 |
end
|
|
109 |
heights << pdf.get_string_height(60, heightitem ? heightitem.last.to_s : "")
|
102 |
110 |
height = heights.max
|
103 |
111 |
|
104 |
112 |
item = left[i]
|
105 |
113 |
pdf.SetFontStyle('B',9)
|
106 |
114 |
pdf.RDMMultiCell(35, height, item ? "#{item.first}:" : "", (i == 0 ? border_first_top : border_first), '', 0, 0)
|
107 |
115 |
pdf.SetFontStyle('',9)
|
108 |
|
pdf.RDMMultiCell(60, height, item ? item.last.to_s : "", (i == 0 ? border_last_top : border_last), '', 0, 0)
|
109 |
|
|
|
116 |
pdf.RDMwriteFormattedCell(60, height, '', '', item ? item.last.to_s : "", issue.attachments,(i == 0 ? border_last_top : border_last), 0)
|
|
117 |
|
110 |
118 |
item = right[i]
|
111 |
119 |
pdf.SetFontStyle('B',9)
|
112 |
120 |
pdf.RDMMultiCell(35, height, item ? "#{item.first}:" : "", (i == 0 ? border_first_top : border_first), '', 0, 0)
|
113 |
121 |
pdf.SetFontStyle('',9)
|
114 |
|
pdf.RDMMultiCell(60, height, item ? item.last.to_s : "", (i == 0 ? border_last_top : border_last), '', 0, 2)
|
|
122 |
pdf.RDMwriteFormattedCell(60, height, '', '', item ? item.last.to_s : "", issue.attachments, (i == 0 ? border_last_top : border_last), 2)
|
115 |
123 |
|
116 |
124 |
pdf.set_x(base_x)
|
117 |
125 |
end
|
... | ... | |
132 |
140 |
|
133 |
141 |
custom_field_values = issue.visible_custom_field_values.select {|value| value.custom_field.full_width_layout?}
|
134 |
142 |
custom_field_values.each do |value|
|
135 |
|
text = show_value(value, false)
|
|
143 |
text = show_value(value, true)
|
136 |
144 |
next if text.blank?
|
137 |
145 |
|
138 |
146 |
pdf.SetFontStyle('B',9)
|
139 |
147 |
pdf.RDMCell(35+155, 5, value.custom_field.name, "LRT", 1)
|
140 |
148 |
pdf.SetFontStyle('',9)
|
141 |
|
pdf.RDMwriteHTMLCell(35+155, 5, '', '', text, issue.attachments, "LRB")
|
|
149 |
pdf.RDMwriteFormattedCell(35+155, 5, '', '', text, issue.attachments, "LRB")
|
142 |
150 |
end
|
143 |
151 |
|
144 |
152 |
unless issue.leaf?
|
... | ... | |
338 |
346 |
if query.has_column?(:description) && issue.description?
|
339 |
347 |
pdf.set_x(10)
|
340 |
348 |
pdf.set_auto_page_break(true, bottom_margin)
|
341 |
|
pdf.RDMwriteHTMLCell(0, 5, 10, '', issue.description.to_s, issue.attachments, "LRBT")
|
|
349 |
pdf.RDMwriteFormattedCell(0, 5, 10, '', textilizable(issue, :description), issue.attachments, "LRBT")
|
342 |
350 |
pdf.set_auto_page_break(false)
|
343 |
351 |
end
|
344 |
352 |
|
... | ... | |
371 |
379 |
query.inline_columns.collect do |column|
|
372 |
380 |
s = if column.is_a?(QueryCustomFieldColumn)
|
373 |
381 |
cv = issue.visible_custom_field_values.detect {|v| v.custom_field_id == column.custom_field.id}
|
374 |
|
show_value(cv, false)
|
|
382 |
show_value(cv, true )
|
375 |
383 |
else
|
376 |
384 |
value = issue.send(column.name)
|
377 |
385 |
case column.name
|
... | ... | |
519 |
527 |
def get_issues_to_pdf_write_cells(pdf, col_values, col_widths, head=false)
|
520 |
528 |
heights = []
|
521 |
529 |
col_values.each_with_index do |column, i|
|
522 |
|
heights << pdf.get_string_height(col_widths[i], head ? column.caption : column)
|
|
530 |
unless head
|
|
531 |
heightcolumn = column.dup unless column.nil?
|
|
532 |
heightcolumn = heightcolumn.to_s.gsub(/(<td .+>\n)|(<\/td>\n)|(<table>\n)|(<\/table>\n)|(<tr>)|(<\/tr>)|(<strong>)|(<\/strong>)|(<p>)|(<\/p>)|(<ol>\n)| (\t{2,}) /, "")
|
|
533 |
end
|
|
534 |
heights << pdf.get_string_height(col_widths[i], head ? column.caption : heightcolumn)
|
523 |
535 |
end
|
524 |
536 |
return heights.max
|
525 |
537 |
end
|
... | ... | |
527 |
539 |
# Renders MultiCells and returns the maximum height used
|
528 |
540 |
def issues_to_pdf_write_cells(pdf, col_values, col_widths, row_height, head=false)
|
529 |
541 |
col_values.each_with_index do |column, i|
|
530 |
|
pdf.RDMMultiCell(col_widths[i], row_height, head ? column.caption : column.strip, 1, '', 1, 0)
|
|
542 |
pdf.RDMwriteFormattedCell(col_widths[i], row_height, '', '', head ? column.caption : column.strip, [], 1, 0, 1)
|
531 |
543 |
end
|
532 |
544 |
end
|
533 |
545 |
|