Project

General

Profile

Feature #5634 » pdf.rb_r7782.patch

Jun NAITOH, 2011-11-12 00:35

View differences:

lib/redmine/export/pdf.rb (作業コピー)
286 286
        pdf.footer_date = format_date(Date.today)
287 287
        pdf.AddPage
288 288
        pdf.SetFontStyle('B',11)
289
        pdf.RDMMultiCell(190,5,
290
             "#{issue.project} - #{issue.tracker} # #{issue.id}: #{issue.subject}")
289
        buf = "#{issue.project} - #{issue.tracker} # #{issue.id}"
290
        pdf.RDMMultiCell(190, 5, buf)
291 291
        pdf.Ln
292
        pdf.SetFontStyle('',8)
293
        base_x = pdf.GetX
294
        i = 1
295
        issue.ancestors.each do |ancestor|
296
          pdf.SetX(base_x + i)
297
          buf = "#{ancestor.tracker} # #{ancestor.id} (#{ancestor.status.to_s}): #{ancestor.subject}"
298
          pdf.RDMMultiCell(190 - i, 5, buf)
299
          i += 1 if i < 35
300
        end
301
        pdf.Ln
292 302

  
293 303
        pdf.SetFontStyle('B',9)
294 304
        pdf.RDMCell(35,5, l(:field_status) + ":","LT")
......
351 361
        pdf.RDMwriteHTMLCell(35+155, 5, 0, 0,
352 362
            Redmine::WikiFormatting.to_html(
353 363
              Setting.text_formatting, issue.description.to_s),"LRB")
364

  
365
        # for CJK
366
        truncate_length = ( l(:general_pdf_encoding).upcase == "UTF-8" ? 80 : 60 )
367

  
368
        pdf.SetFontStyle('B',9)
369
        pdf.RDMCell(35+155,5, l(:label_subtask_plural) + ":", "LTR")
354 370
        pdf.Ln
371
        issue_list(issue.descendants.sort_by(&:lft)) do |child, level|
372
          buf = truncate("#{child.tracker} # #{child.id}: #{child.subject}",
373
                         :length => truncate_length)
374
          level = 10 if level >= 10
375
          pdf.SetFontStyle('',8)
376
          pdf.RDMCell(35+135,5, (level >=1 ? "  " * level : "") + buf, "L")
377
          pdf.SetFontStyle('B',8)
378
          pdf.RDMCell(20,5, child.status.to_s, "R")
379
          pdf.Ln
380
        end
381
        pdf.SetFontStyle('B',9)
382
        pdf.RDMCell(35+155,5, l(:label_related_issues) + ":", "LTR")
383
        pdf.Ln
355 384

  
385
        # for CJK
386
        truncate_length = ( l(:general_pdf_encoding).upcase == "UTF-8" ? 80 : 60 )
387

  
388
        issue.relations.select { |r| r.other_issue(issue).visible? }.each do |relation|
389
          buf = ""
390
          buf += "#{l(relation.label_for(issue))} "
391
          if relation.delay && relation.delay != 0
392
            buf += "(#{l('datetime.distance_in_words.x_days', :count => relation.delay)}) "
393
          end
394
          if Setting.cross_project_issue_relations?
395
            buf += "#{relation.other_issue(issue).project} - "
396
          end
397
          buf += "#{relation.other_issue(issue).tracker}" +
398
                 " # #{relation.other_issue(issue).id}: #{relation.other_issue(issue).subject}"
399
          buf = truncate(buf, :length => truncate_length)
400
          pdf.SetFontStyle('', 8)
401
          pdf.RDMCell(35+155-50,5, buf, "L")
402
          pdf.SetFontStyle('B',8)
403
          pdf.RDMCell(10,5, relation.other_issue(issue).status.to_s, "")
404
          pdf.RDMCell(20,5, format_date(relation.other_issue(issue).start_date), "")
405
          pdf.RDMCell(20,5, format_date(relation.other_issue(issue).due_date), "R")
406
          pdf.Ln
407
        end
408
        pdf.RDMCell(190,5, "", "T")
409
        pdf.Ln
410

  
356 411
        if issue.changesets.any? &&
357 412
             User.current.allowed_to?(:view_changesets, issue.project)
358 413
          pdf.SetFontStyle('B',9)
(6-6/6)