[daisy] Hierarchical document structure visible in navigation tree
Bruno Dumon
bruno at outerthought.org
Mon Jan 7 11:40:56 CST 2008
On Mon, 2008-01-07 at 17:55 +0100, ccmail wrote:
> Bruno Dumon wrote:
> >
> > I think that what you're asking is possible is right now, though I'm not
> > sure I understood you correctly.
> >
> > You can have both the selection list and the navigation tree build up
> > dynamically from documents.
> >
> > I think you already wrote before that the selection list is working:
> >
> >
> > > I've already figured out that it's happening when such a field is marked
> > > as hierarchical. If I set it as non-hierarchical then it's working:
> > > field value selection list is showing hierarchical list of possible
> > > entries.
> > >
> >
> >
>
> Unfortunatelly I was not right when I've wrote that :-/. The problem
> is that if I create link field (let's call it ParentLink) with
> parent-linked selection type (but NOT hierarchical) and add it to
> MyTreeDocType it works in terms of seeing proper tree-like structure
> in list-box while editing an instance of MyTreeDoc. The thing is that
> query
> select $ParentLink, name where documentType = 'MyTreeDoc'
> is not working correctly (ie. how I'd like it to work) in the
> navigation tree. If my document structure (as defined by parent-links)
> looks like this:
> my root doc
> chapter 1
> chapter 1.1
> chapter 2
> chapter 3
>
> then this query results in something like this appearing in the
> navigation tree:
> [null]
> my root doc
> chapter 1
> chapter 1.1---- start old suggestion ----
> my root doc
> chapter 1
> chapter 2
> chapter 3
> So it's showing all documents under particular document's parent node
> but without taking parent's hierarchy into account. It's only grouping
> by parent, but not following full hierarchy... In other words - query
> gets set of pairs parent:document_name, groups by parent and displays
> it in a tree being maximum one level deep.
>
> And when I make ParentLink hierarchical then I'm getting exception
> thrown at me when attempting to add/edit instance of a document....
>
> I see three options:
> 1. what I try to achive is not possible :(
> 2. I'm doing something wrong while defining hierarchical
> link-based field (how to amend it?)
> 3. I'm doing something wrong in creating navigation descriptor
> (how to make it work?)
I think I'm starting to understand what you want to do.
I had already started writing the following which I'm leaving here for
reference:
---- start old suggestion ----
Hmm, maybe what you are missing is that you need two field types and two
document types: one set for the selection list, another for the actual
content documents.
This example of the knowledge base site (http://cocoondev.org/kb/) might
help:
http://svn.cocoondev.org/viewsvn/site/src/main/dsy-exp/info/schema.xml?revision=4537&view=markup
The schema you see there is an XML syntax from the export/import tool, I
think you can readily understand it.
There you will see:
* field type KnowlegeBaseCategoryParent and document type
KnowledgeBaseCategory used for building the selection list content
* field type KnowledgeBaseCategory (confusingly the same name as the
earlier document type) and document type KnowledgeBaseArticle for the
actual content
So the field type used in the actual content documents should be
hierarchical, while the field type used to link the selection list nodes
together not.
---- end old suggestion ----
But now I'm starting to understand that maybe you don't want to organize
your documents in some distinct classification, but rather have the
documents be the classification itself. And in that case, there's indeed
no way (I think) to insert that as a hierarchy in the navigation tree.
The navigation tree would need to support something similar to the
parent-linked selection list construct. Though note that in such case
you wouldn't be able to define the order of items within a parent
(unless you'd introduce some 'position' field and sort on that). But
then it probably becomes easier again to manually define the navigation
tree.
--
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno at outerthought.org bruno at apache.org
More information about the daisy
mailing list