Class: TaskJuggler::RTFReportLink

Inherits:
RTFWithQuerySupport show all
Defined in:
lib/taskjuggler/RichText/RTFReportLink.rb

Overview

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

Instance Attribute Summary

Attributes inherited from RichTextFunctionHandler

#blockFunction, #function

Instance Method Summary collapse

Methods inherited from RTFWithQuerySupport

#setQuery

Methods included from MessageHandler

#critical, #debug, #error, #fatal, #info, #warning

Constructor Details

#initialize(project, sourceFileInfo = nil) ⇒ RTFReportLink

Returns a new instance of RTFReportLink.



26
27
28
29
30
31
# File 'lib/taskjuggler/RichText/RTFReportLink.rb', line 26

def initialize(project, sourceFileInfo = nil)
  @project = project
  super('reportlink', sourceFileInfo)
  @blockFunction = false
  @query = nil
end

Instance Method Details

#to_html(args) ⇒ Object

Return a HTML tree for the report.



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/taskjuggler/RichText/RTFReportLink.rb', line 41

def to_html(args)
  report = checkArgs(args)

  # 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

#to_s(args) ⇒ Object

Not supported for this function



34
35
36
37
38
# File 'lib/taskjuggler/RichText/RTFReportLink.rb', line 34

def to_s(args)
  report = checkArgs(args)

  report.name
end

#to_tagged(args) ⇒ Object

Not supported for this function.



65
66
67
# File 'lib/taskjuggler/RichText/RTFReportLink.rb', line 65

def to_tagged(args)
  nil
end