diff --git a/lib/WebGUI/Navigation.pm b/lib/WebGUI/Navigation.pm index fc072e56e..bac2cd19b 100644 --- a/lib/WebGUI/Navigation.pm +++ b/lib/WebGUI/Navigation.pm @@ -226,7 +226,8 @@ sub build { my $cache = WebGUI::Cache->new($self->{_identifier}.'-'.$session{page}{pageId}, "Navigation-".$session{config}{configFile}); my $cacheContent = $cache->get; - my @page_loop; + my (@page_loop, $lastPage, %unfolded); + tie %unfolded, "Tie::IxHash"; unless (defined $cacheContent) { # The loop was not cached @@ -257,6 +258,7 @@ sub build { $pageData->{"page.isHidden"} = $page->{'hideFromNavigation'}; $pageData->{"page.isSystem"} = (($page->{'pageId'} < 1000 && $page->{'pageId'} > 1) || $page->{'pageId'} == 0); + # indent my $indent = 0; @@ -304,16 +306,30 @@ sub build { (($page->{'lft'} > $currentPage->get('lft')) && ($page->{'rgt'} < $currentPage->get('rgt'))) || (($page->{'lft'} < $currentPage->get('lft')) && ($page->{'rgt'} > $currentPage->get('rgt'))); # Some information about my mother + + my $mother = WebGUI::Page->getPage($page->{parentId}); if ($page->{parentId} > 0) { - my $mother = WebGUI::Page->getPage($page->{parentId}); foreach (qw(title urlizedTitle parentId pageId)) { $pageData->{"page.mother.$_"} = $mother->get($_); } } + + $pageData->{"page.isLeftMost"} = (($page->{'lft'} - 1) == $mother->get('lft')); + $pageData->{"page.isRightMost"} = (($page->{'rgt'} + 1) == $mother->get('rgt')); + my $depthDiff = ($lastPage) ? ($lastPage->{'page.absDepth'} - $pageData->{'page.absDepth'}) : 0; + if ($depthDiff > 0) { + $pageData->{"page.depthDiff"} = $depthDiff if ($depthDiff > 0); + $pageData->{"page.depthDiffIs".$depthDiff} = 1; + push(@{$pageData->{"page.depthDiff_loop"}},{}) for(1..$depthDiff); + } + # Some information about my depth $pageData->{"page.depthIs".$pageData->{"page.absDepth"}} = 1; - $pageData->{"page.relativeDepthIs".$pageData->{"page.absDepth"}} = 1; + $pageData->{"page.relativeDepthIs".$pageData->{"page.relDepth"}} = 1; + # We need a copy of the last page for the depthDiffLoop + $lastPage = $pageData; + # Store $pageData in page_loop. Mind the order. if ($self->{_reverse}) { unshift(@page_loop, $pageData); @@ -338,9 +354,14 @@ sub build { # Check privileges if ($pageData->{"page.isViewable"} || $self->{_showUnprivilegedPages}) { push (@{$var->{page_loop}}, $pageData); + push (@{$unfolded{$pageData->{"page.parentId"}}}, $pageData); } } + foreach (values %unfolded) { + push(@{$var->{unfolded_page_loop}}, @{$_}); + } + # Configure button $var->{'config.button'} = $self->_getEditButton(); diff --git a/lib/WebGUI/i18n/English/WebGUI.pm b/lib/WebGUI/i18n/English/WebGUI.pm index 92ed6669a..0d57ecd1c 100644 --- a/lib/WebGUI/i18n/English/WebGUI.pm +++ b/lib/WebGUI/i18n/English/WebGUI.pm @@ -6977,6 +6977,7 @@ Following a guide like the above will help you get good ranking on search engine

indent
A number representing the loop count.

page.isRoot
A condition indication whether this page is a root page.

page.isTop
A condition indication whether this page is a top page (daughter of root).

+

page.inCurrentRoot
This condition is true if this page is a descendant of the root page of the current page

page.hasDaughter
A condition indication whether this page has a daughter. In other words: It evaluates to true if this page is a mother.

page.isMyDaughter
A condition indication whether this page is a daughter of current page.

page.isMyMother
A condition indication whether this page is the mother of current page.

@@ -6986,7 +6987,13 @@ Following a guide like the above will help you get good ranking on search engine

page.mother.parentId
The parentId of the mother of this page.

page.depthIs1 , page.depthIs2 , page.depthIs3 , page.depthIs4 , page.depthIsN
A condition indicating whether the depth of this page is N. This variable is useful if you want to style a certain level.

<tmpl_if page.depthIs1>
   <img src="level1.gif">
<tmpl_else>
   <img src="defaultBullet.gif">
</tmpl_if>

-

page.relativeDepthIs1 , page.relativeDepthIs2 , page.relativeDepthIs3 , page.relativeDepthIsN
A condition indicating whether the relative depth of this page is N.

+

page.relativeDepthIs1 , page.relativeDepthIs2 , page.relativeDepthIs3 , page.relativeDepthIsN
A condition indicating whether the relative depth of this page is N.

+

page.isLeftMost
This property is true if this page is the first within this level. Ie. has no left sister.

+

page.isRightMost
This property is true if this page is the last within this level. Ie. has no right sister.

+

page.depthDiff
The difference in depth of this page and the page processed before it. This only has a value when you go up in depth. If you go down, this would be always 1 and going down a level can be detected with page.isLeftMost.

+

page.depthDiffIs1, page.depthDiffIs2, page.depthDiffIs3, page.depthDiffIsN
True if the page.depthDiff variable is N.

+

page.depthDiff_loop
A loop that runs page.depthDiff times. This loop contains no loop variables.

+

unfolded_page_loop
This loop contains the same data as page_loop but the order is different. page_loop returns it's pages in a nested order: the pages are returned in a hierarchical order. unfolded_page_loop, however, returns it's pages in an unfolded manner: it's returned pages are grouped by parent id. You'll probably need page_loop, but there are (CSS) menus that need unfolded_page_loop to work properly.

 

|, lastUpdated => 1078207966 },