class TaskJuggler::RTFReport

This class is a specialized RichTextFunctionHandler that includes a report into the RichText output for supported formats.

Public Class Methods

new(project, sourceFileInfo = nil) click to toggle source
# File lib/taskjuggler/RichText/RTFReport.rb, line 22
def initialize(project, sourceFileInfo = nil)
  @project = project
  super('report', sourceFileInfo)
  @blockFunction = true
end

Public Instance Methods

to_html(args) click to toggle source

Return a HTML tree for the report.

# File lib/taskjuggler/RichText/RTFReport.rb, line 34
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
  # Detect recursive nesting
  found = false
  @project.reportContexts.each do |c|
    if c.report == report
      found = true
      break
    end
  end
  if found
    stack = ""
    @project.reportContexts.each do |context|
      stack += ' -> ' unless stack.empty?
      stack += '[ ' if context.report == report
      stack += context.report.fullId
    end
    stack += " -> #{report.fullId} ] ..."
    error('rtp_report_recursion',
          "Recursive nesting of reports detected: #{stack}")
    return nil
  end

  # Create a new context for the report.
  @project.reportContexts.push(ReportContext.new(@project, report))
  # Generate the report with the new context
  report.generateIntermediateFormat
  html = report.to_html
  @project.reportContexts.pop

  html
end
to_s(args) click to toggle source

Not supported for this function

# File lib/taskjuggler/RichText/RTFReport.rb, line 29
def to_s(args)
  ''
end
to_tagged(args) click to toggle source

Not supported for this function.

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