PropertyTreeNode
The Report class holds the fundamental description and functionality to turn the scheduled project into a user readable form. A report may contain other reports.
Create a new report object.
# File lib/taskjuggler/reports/Report.rb, line 45 def initialize(project, id, name, parent) super(project.reports, id, name, parent) @messageHandler = MessageHandlerInstance.instance checkFileName(name) project.addReport(self) # The type specifier must be set for every report. It tells whether this # is a task, resource, text or other report. @typeSpec = nil # Reports don't really have any scenario specific attributes. But the # flag handling code assumes they are. To use flags, we need them as # well. @data = Array.new(@project.scenarioCount, nil) @project.scenarioCount.times do |i| ReportScenario.new(self, i, @scenarioAttributes[i]) end end
The generate function is where the action happens in this class. The report defined by all the class attributes and report elements is generated according the the requested output format(s). requestedFormats can be a list of formats that should be generated (e.
:html, :csv, etc.).
# File lib/taskjuggler/reports/Report.rb, line 68 def generate(requestedFormats = nil) oldTimeZone = TjTime.setTimeZone(get('timezone')) generateIntermediateFormat # We either generate the requested formats or the list of formats that # was specified in the report definition. (requestedFormats || get('formats')).each do |format| if @name.empty? error('empty_report_file_name', "Report #{@id} has output formats requested, but the " + "file name is empty.", sourceFileInfo) end case format when :iCal generateICal when :html generateHTML copyAuxiliaryFiles when :csv generateCSV when :ctags generateCTags when :niku generateNiku when :tjp generateTJP when :mspxml generateMspXml else raise 'Unknown report output format #{format}.' end end TjTime.setTimeZone(oldTimeZone) 0 end
Generate an output format agnostic version that can later be turned into the respective output formats.
# File lib/taskjuggler/reports/Report.rb, line 109 def generateIntermediateFormat if get('scenarios').empty? warning('all_scenarios_disabled', "The report #{fullId} has only disabled scenarios. The " + "report will possibly be empty.") end @content = nil case @typeSpec when :accountreport @content = AccountListRE.new(self) when :export @content = ExportRE.new(self) when :iCal @content = ICalReport.new(self) when :niku @content = NikuReport.new(self) when :resourcereport @content = ResourceListRE.new(self) when :tagfile @content = TagFile.new(self) when :textreport @content = TextReport.new(self) when :taskreport @content = TaskListRE.new(self) when :tracereport @content = TraceReport.new(self) when :statusSheet @content = StatusSheetReport.new(self) when :timeSheet @content = TimeSheetReport.new(self) else raise "Unknown report type" end # Most output format can be generated from a common intermediate # representation of the elements. We generate that IR first. @content.generateIntermediateFormat if @content end
Return true if the report should be rendered in the interactive version, false if not. The top-level report defines the output format and the interactive setting.
# File lib/taskjuggler/reports/Report.rb, line 157 def interactive? @project.reportContexts.first.report.get('interactive') end
Generated with the Darkfish Rdoc Generator 2.