[daisy] Get complete navigation Tree
Bruno Dumon
bruno at outerthought.org
Wed May 7 22:47:14 CEST 2008
If you retrieve the navigation tree via the Publisher instead of
directly from the NavigationManager, you can easily retrieve additional
information for each document node in the navigation tree (the Publisher
internally also uses the NavigationManager API to get the navigation
tree, but gives some additional convenience functionality).
This will however require some changes to your current solution:
* instead of using the NavigationManager API, construct a publisher
request to get the navigation tree
* slightly adjust your XSLT. The navigation XML will be the same, but it
will be wrapped inside a p:publisherResponse element
Once you've made this change, you can get the additional information by
nesting a p:document instruction in the p:navigationTree instruction:
<p:navigationTree>
<p:navigationDocument id="338-DSY"/>
<p:document>
<p:annotatedDocument/>
</p:document>
</p:navigationTree>
This is explained at:
http://cocoondev.org/daisydocs-2_2/373-cd/194-cd/424-cd.html
If you need more detail, here it is:
Scrap the current flowscript code which uses the NavigationManager
component.
A simple example of constructing a publisher request, and styling the
result of the publisher request can be found in the "publishdoc" sample,
which can be found next to the navaggregator sample.
You can start by copying that publishdoc example, and:
* Modify the pubreq.xml: remove the p:document and add the
p:navigationTree similar to the example above
- I would leave out the p:document at first
- you can use expressions to dynamically retrieve the navigation
tree ID from the siteconf, if desired, like this:
<p:navigationDocument id="${pageContext.siteConf.navigationDocId}" branch="${pageContext.siteConf.branchId}" language="${pageContext.siteConf.languageId}"/>
* Modify the "result" pipeline in the sitemap, start out again with
just the map:generate and <map:serialize type="xml"/> to see you get the
correct XML. Later on add the XSLT.
For your question of passing the sitename to the JX: pass the
pageContext to the JX (as is done in the publishdoc sample), and then
${pageContext.siteConf.name} should do it. You can look at the
SiteConf.java file in the source code to see what's available on the
siteConf object.
Maybe once you get all this working you can write a tutorial on the wiki
so others can benefit from it.
Good luck :-)
On Wed, 2008-05-07 at 14:22 -0400, Sieranski, Greg wrote:
> I was able to take all of this and get everything running perfectly! I
> was wondering if you had any thoughts on how I could get the last
> modified time of the documents in the navigation? We also have more than
> one site i.e. foo.com/a/ foo.com/b/ and I was wondering if there is a
> way to get the sitename and pass that through the viewdata to the jx?
> Any thoughts on these two issues would be greatly appreciated.
>
--
Bruno Dumon http://outerthought.org/
Outerthought http://www.daisycms.org/
bruno at outerthought.org http://www.kauriproject.org/
More information about the daisy
mailing list