eZ Community » Forums » Suggestions » Expandable/expanded info in treemenu...
expandshrink

Expandable/expanded info in treemenu operator results

Expandable/expanded info in treemenu operator results

Saturday 14 April 2007 3:03:31 pm

I'm currently developing a design that will solely rely on left menu as its primary navigation tool. Let's say it is a complex, multilevel structure that consists of objects of two classes: my_page and my_comment, the first of which will be included by treemenu operator, the second of which will be left out and not be visible in the actual menu (a classical 'page and its comments' combination).

I want the menu to comply with the best tree-like menu practices by means of:
- implementation of structured HTML list element,
- highlighting current item,
- highlighting selected items,
- level indentation,
- providing information about <b>expandable</b>/<b>expanded</b> elements with use of additional design elements (either with +/- or right-arrow/down-arrow images).

As far as I can figure it out, all but the last one are quite 'easy' to achieve since the result of treemenu operator provides us with all necessary parameters for each node. While the 'expanded' information can also be arranged - basically, it is equal or close to selected items information - there isn't any 'is_expandable' information. There is 'has_children' attribute, but that's not exactly what we need since there may be many my_pages that do contain my_comment child nodes, but no my_page objects whatsoever.

Is it possible to calculate the 'is_expandable' information? Of course it is. For each node in the treemenu operator result array, that isn't expanded and does have child nodes, we can investigate the node attribute, find the list of its children and then check if any of them constitutes my_page class. The problem is that according to the documentation, the 'children' attribute of ezcontentobjecttreenode object is not pre-fetched, which means that lots of additional fetching will have to be done, depending on the complexity of the menu.

In other words: it is possible to tell eZ publish: some nodes I want in the menu, some nodes I don't. Since I have told the system, that I only wanted objects of my_page class, wouldn't it be a good idea to get it calculated just as if there were no other nodes in the system? 'has_children' parameter isn't as useful as would 'has_the_right_children' be blunk.gif Emoticon

Has anyone similar thoughts on this? How do you deal with this problem? Maybe I am missing something? Some other operator? Some configuration detail?

Any suggestions/explanations would be appreciated.

Maybe little illustration to my 'novel' happy.gif Emoticon
Here's a sample structure [<i>with class information</i>]:

My site [<i>my_root</i>] (id.101)
+ About me [<i>my_page</i>] (id.102)
+ What I do [<i>my_page</i>] (id.103)
++ eZ publish [<i>my_page</i>] (id.104)
++ Multimedia [<i>my_page</i>] (id.105)
+ My portfolio [<i>my_page</i>] (id.106)
++ eZ publish [<i>my_page</i>] (id.107)
+++ Small Corporation [<i>my_project</i>] (id.108)
+++ Very Big Corporation [<i>my_project</i>] (id.109)
++ Multimedia [<i>my_page</i>] (id.110)
+++ Some Corporation [<i>my_project</i>] (id.111)
+++ Huge Corporation [<i>my_project</i>] (id.112)
+++ Little business [<i>my_project</i>] (id.113)

...and the fetch:

{def
$myMenuRoot=2
$myMenu=treemenu(
  is_set($module_result.node_id)|choose($myMenuRoot, $module_result.node_id),
  ezini('MenuContentSettings', 'LeftIdentifierList', 'menu.ini'),
  0,
  5
)}

Let's say LeftIdentifierList contains <b>my_root</b> and <b>my_page</b> classes.

<b>Example 1:</b>
Current location: My site / What I do
Result:

<b>My site</b> [<i>my_root</i>] (id.101)
+ About me [<i>my_page</i>] (id.102)
<b>+ What I do</b> [<i>my_page</i>] (id.103)
++ eZ publish [<i>my_page</i>] (id.104)
++ Multimedia [<i>my_page</i>] (id.105)
+ My portfolio [<i>my_page</i>] (id.106)

Nodes 104 and 105 don't have child sub-nodes so there is no problem. However, node 106 has my_page class child objects, so it would be nice if we could indicate: My portfolio <b>is_expandable</b>.

<b>Example 2:</b>
Current location: My site / My Portfolio / eZ publish
Result:

<b>My site</b> [<i>my_root</i>] (id.101)
+ About me [<i>my_page</i>] (id.102)
+ What I do [<i>my_page</i>] (id.103)
<b>+ My portfolio</b> [<i>my_page</i>] (id.106)
<b>++ eZ publish</b> [<i>my_page</i>] (id.107)
++ Multimedia [<i>my_page</i>] (id.110)

Here's where situation gets much worse. We do know that 103 node is expandable, we've just been there, so it would be nice to suggest with 'expandable' representation that it's content hasn't disappeared all of the sudden. Next, our 107 node contains project elements, but we don't want to consider them menu elements (otherwise has_children information would be exactly what we need).

Modified on Saturday 14 April 2007 3:05:18 pm by Piotr Karaƛ

No reply yet!

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from