lib/reports/Navigator.rb in taskjuggler-0.0.5 vs lib/reports/Navigator.rb in taskjuggler-0.0.6
- old
+ new
@@ -125,27 +125,40 @@
end
# Generate an output format independant version of the navigator. This is
# a tree of NavigatorElement objects.
def generate(reports, reportRoot, parentElement)
- raise "Report context missing" unless @project.reportContext.report
+ reportDef = @project.reportContexts.last.report
+ raise "Report context missing" unless reportDef
+ interactive = false
reports.each do |report|
+ # The outermost (top-level) report determines whether the report
+ # should be rendered interactive or not.
+ interactive = report.interactive? unless interactive
+
hasURL = report.get('formats').include?(:html)
+ # Only generate menu entries for reports that are not the reportRoot,
+ # that are leaf reports and have an HTML output format.
next if (report.parent != reportRoot) ||
(report.leaf? && !hasURL)
label = report.get('title') || report.name
# Determine the URL for this element.
if hasURL
- url = report.name + '.html'
- url = normalizeURL(url, @project.reportContext.report.name)
+ if interactive
+ url = "/taskjuggler?project=#{report.project['projectid']};" +
+ "report=#{report.fullId}"
+ else
+ url = report.name + '.html'
+ url = normalizeURL(url, reportDef.name)
+ end
end
parentElement.elements <<
(element = NavigatorElement.new(parentElement, label, url))
- if report == @project.reportContext.report
+ if report == reportDef
element.currentUrl = url
# Mark this element and all its parents as current.
nEl = element
while nEl
nEl.current = true
@@ -170,10 +183,10 @@
def filterReports
list = PropertyList.new(@project.reports)
list.setSorting([[ 'seqno', true, -1 ]])
list.sort!
# Remove all reports that the user doesn't want to have include.
- query = @project.reportContext.query.dup
+ query = @project.reportContexts.last.query.dup
query.scopeProperty = nil
list.delete_if do |property|
query.property = property
@hideReport.eval(query)
end