Project

General

Profile

Defect #61 » gantt.rb_rfpdf115.patch

Jun NAITOH, 2011-03-27 09:34

View differences:

lib/redmine/helpers/gantt.rb 2011-03-07 14:44:40.000000000 -0500 → lib/redmine/helpers/gantt.rb 2011-03-23 20:09:43.000000000 -0400
512 512
      def to_pdf
513 513
        pdf = ::Redmine::Export::PDF::IFPDF.new(current_language)
514 514
        pdf.SetTitle("#{l(:label_gantt)} #{project}")
515
        pdf.AliasNbPages
515
        pdf.alias_nb_pages
516 516
        pdf.footer_date = format_date(Date.today)
517 517
        pdf.AddPage("L")
518 518
        pdf.SetFontStyle('B',12)
519 519
        pdf.SetX(15)
520
        pdf.Cell(PDF::LeftPaneWidth, 20, project.to_s)
520
        pdf.UTF8Cell(PDF::LeftPaneWidth, 20, project.to_s)
521 521
        pdf.Ln
522 522
        pdf.SetFontStyle('B',9)
523 523
        
......
552 552
          width = ((month_f >> 1) - month_f) * zoom 
553 553
          pdf.SetY(y_start)
554 554
          pdf.SetX(left)
555
          pdf.Cell(width, height, "#{month_f.year}-#{month_f.month}", "LTR", 0, "C")
555
          pdf.UTF8Cell(width, height, "#{month_f.year}-#{month_f.month}", "LTR", 0, "C")
556 556
          left = left + width
557 557
          month_f = month_f >> 1
558 558
        end  
......
570 570
            width = (7 - self.date_from.cwday + 1) * zoom-1
571 571
            pdf.SetY(y_start + header_heigth)
572 572
            pdf.SetX(left)
573
            pdf.Cell(width + 1, height, "", "LTR")
573
            pdf.UTF8Cell(width + 1, height, "", "LTR")
574 574
            left = left + width+1
575 575
          end
576 576
          while week_f <= self.date_to
577 577
            width = (week_f + 6 <= self.date_to) ? 7 * zoom : (self.date_to - week_f + 1) * zoom
578 578
            pdf.SetY(y_start + header_heigth)
579 579
            pdf.SetX(left)
580
            pdf.Cell(width, height, (width >= 5 ? week_f.cweek.to_s : ""), "LTR", 0, "C")
580
            pdf.UTF8Cell(width, height, (width >= 5 ? week_f.cweek.to_s : ""), "LTR", 0, "C")
581 581
            left = left + width
582 582
            week_f = week_f+7
583 583
          end
......
593 593
            width = zoom
594 594
            pdf.SetY(y_start + 2 * header_heigth)
595 595
            pdf.SetX(left)
596
            pdf.Cell(width, height, day_name(wday).first, "LTR", 0, "C")
596
            pdf.UTF8Cell(width, height, day_name(wday).first, "LTR", 0, "C")
597 597
            left = left + width
598 598
            wday = wday + 1
599 599
            wday = 1 if wday > 7
......
602 602
        
603 603
        pdf.SetY(y_start)
604 604
        pdf.SetX(15)
605
        pdf.Cell(subject_width+g_width-15, headers_heigth, "", 1)
605
        pdf.UTF8Cell(subject_width+g_width-15, headers_heigth, "", 1)
606 606
        
607 607
        # Tasks
608 608
        top = headers_heigth + y_start
......
722 722
        params[:pdf].SetX(15)
723 723
        
724 724
        char_limit = PDF::MaxCharactorsForSubject - params[:indent]
725
        params[:pdf].Cell(params[:subject_width]-15, 5, (" " * params[:indent]) +  subject.to_s.sub(/^(.{#{char_limit}}[^\s]*\s).*$/, '\1 (...)'), "LR")
725
        params[:pdf].UTF8Cell(params[:subject_width]-15, 5, (" " * params[:indent]) +  subject.to_s.sub(/^(.{#{char_limit}}[^\s]*\s).*$/, '\1 (...)'), "LR")
726 726
      
727 727
        params[:pdf].SetY(params[:top])
728 728
        params[:pdf].SetX(params[:subject_width])
729
        params[:pdf].Cell(params[:g_width], 5, "", "LR")
729
        params[:pdf].UTF8Cell(params[:g_width], 5, "", "LR")
730 730
      end
731 731
      
732 732
      def image_subject(params, subject, options={})
......
783 783
          params[:pdf].SetY(params[:top]+1.5)
784 784
          params[:pdf].SetX(params[:subject_width] + coords[:bar_start])
785 785
          params[:pdf].SetFillColor(200,200,200)
786
          params[:pdf].Cell(coords[:bar_end] - coords[:bar_start], height, "", 0, 0, "", 1)
786
          params[:pdf].UTF8Cell(coords[:bar_end] - coords[:bar_start], height, "", 0, 0, "", 1)
787 787
            
788 788
          if coords[:bar_late_end]
789 789
            params[:pdf].SetY(params[:top]+1.5)
790 790
            params[:pdf].SetX(params[:subject_width] + coords[:bar_start])
791 791
            params[:pdf].SetFillColor(255,100,100)
792
            params[:pdf].Cell(coords[:bar_late_end] - coords[:bar_start], height, "", 0, 0, "", 1)
792
            params[:pdf].UTF8Cell(coords[:bar_late_end] - coords[:bar_start], height, "", 0, 0, "", 1)
793 793
          end
794 794
          if coords[:bar_progress_end]
795 795
            params[:pdf].SetY(params[:top]+1.5)
796 796
            params[:pdf].SetX(params[:subject_width] + coords[:bar_start])
797 797
            params[:pdf].SetFillColor(90,200,90)
798
            params[:pdf].Cell(coords[:bar_progress_end] - coords[:bar_start], height, "", 0, 0, "", 1)
798
            params[:pdf].UTF8Cell(coords[:bar_progress_end] - coords[:bar_start], height, "", 0, 0, "", 1)
799 799
          end
800 800
        end
801 801
        # Renders the markers
......
804 804
            params[:pdf].SetY(params[:top] + 1)
805 805
            params[:pdf].SetX(params[:subject_width] + coords[:start] - 1)
806 806
            params[:pdf].SetFillColor(50,50,200)
807
            params[:pdf].Cell(2, 2, "", 0, 0, "", 1) 
807
            params[:pdf].UTF8Cell(2, 2, "", 0, 0, "", 1) 
808 808
          end
809 809
          if coords[:end]
810 810
            params[:pdf].SetY(params[:top] + 1)
811 811
            params[:pdf].SetX(params[:subject_width] + coords[:end] - 1)
812 812
            params[:pdf].SetFillColor(50,50,200)
813
            params[:pdf].Cell(2, 2, "", 0, 0, "", 1) 
813
            params[:pdf].UTF8Cell(2, 2, "", 0, 0, "", 1) 
814 814
          end
815 815
        end
816 816
        # Renders the label on the right
817 817
        if options[:label]
818 818
          params[:pdf].SetX(params[:subject_width] + (coords[:bar_end] || 0) + 5)
819
          params[:pdf].Cell(30, 2, options[:label])
819
          params[:pdf].UTF8Cell(30, 2, options[:label])
820 820
        end
821 821
      end
822 822

  
(22-22/46)