Class TaskJuggler::RTFReportLink
In: lib/taskjuggler/RichText/RTFReportLink.rb
Parent: RTFWithQuerySupport

This class is a specialized RichTextFunctionHandler that generates a link to another report. It‘s not available on all output formats.

Methods

new   to_html   to_s   to_tagged  

Public Class methods

[Source]

# File lib/taskjuggler/RichText/RTFReportLink.rb, line 25
    def initialize(project, sourceFileInfo = nil)
      @project = project
      super('reportlink', sourceFileInfo)
      @blockFunction = false
      @query = nil
    end

Public Instance methods

Return a HTML tree for the report.

[Source]

# File lib/taskjuggler/RichText/RTFReportLink.rb, line 38
    def to_html(args)
      if args.nil? || (id = args['id']).nil?
        error('rtp_report_id',
              "Argument 'id' missing to specify the report to be used.")
        return nil
      end
      unless (report = @project.report(id))
        error('rtp_report_unknown_id', "Unknown report #{id}")
        return nil
      end

      # The URL for interactive reports is different than for static reports.
      if report.interactive?
        # The project and report ID must be provided as query.
        url = "taskjuggler?project=#{@project['projectid']};" +
              "report=#{report.fullId}"

        if args['attributes']
          qEx = SimpleQueryExpander.new(args['attributes'], @query,
                                        @sourceFileInfo)
          url += ";attributes=" + URLParameter.encode(qEx.expand)
        end
      else
        # The report name just gets a '.html' extension.
        url = report.name + ".html"
      end
      a = XMLElement.new('a', 'href'=> url)
      a << XMLText.new(report.name)
      a
    end

Not supported for this function

[Source]

# File lib/taskjuggler/RichText/RTFReportLink.rb, line 33
    def to_s(args)
      ''
    end

Not supported for this function.

[Source]

# File lib/taskjuggler/RichText/RTFReportLink.rb, line 70
    def to_tagged(args)
      nil
    end

[Validate]