Added extra template variables to deal with more (css) menutypes, and fixed a bug where page.reltiveDepthIs was actually absoluteDepth.
This commit is contained in:
parent
d7297b24bd
commit
c7b08bf91a
2 changed files with 32 additions and 4 deletions
|
|
@ -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();
|
||||
|
||||
|
|
|
|||
|
|
@ -6977,6 +6977,7 @@ Following a guide like the above will help you get good ranking on search engine
|
|||
<P><STRONG>indent</STRONG><BR>A number representing the loop count. </P></BLOCKQUOTE>
|
||||
<P dir=ltr><STRONG>page.isRoot</STRONG><BR>A condition indication whether this page is a root page.</P>
|
||||
<P dir=ltr><STRONG>page.isTop</STRONG><BR>A condition indication whether this page is a top page (daughter of root).</P>
|
||||
<P dir=ltr><STRONG>page.inCurrentRoot</STRONG><BR>This condition is true if this page is a descendant of the root page of the current page</P>
|
||||
<P dir=ltr><STRONG>page.hasDaughter</STRONG><BR>A condition indication whether this page has a daughter. In other words: It evaluates to true if this page is a mother.</P>
|
||||
<P dir=ltr><STRONG>page.isMyDaughter</STRONG><BR>A condition indication whether this page is a daughter of current page.</P>
|
||||
<P dir=ltr><STRONG>page.isMyMother<BR></STRONG>A condition indication whether this page is the mother of current page.</P>
|
||||
|
|
@ -6986,7 +6987,13 @@ Following a guide like the above will help you get good ranking on search engine
|
|||
<P dir=ltr><STRONG>page.mother.parentId</STRONG><BR>The parentId of the mother of this page.</P>
|
||||
<P dir=ltr><STRONG>page.depthIs1 , page.depthIs2 , page.depthIs3 , page.depthIs4 , page.depthIsN<BR></STRONG>A condition indicating whether the depth of this page is N. This variable is useful if you want to style a certain level.</P>
|
||||
<P dir=ltr><tmpl_if page.depthIs1><BR> <img src="level1.gif"><BR><tmpl_else><BR> <img src="defaultBullet.gif"><BR></tmpl_if></P>
|
||||
<P dir=ltr><STRONG>page.relativeDepthIs1 , page.relativeDepthIs2 , page.relativeDepthIs3 , page.relativeDepthIsN</STRONG><BR>A condition indicating whether the relative depth of this page is N.</P></BLOCKQUOTE>
|
||||
<P dir=ltr><STRONG>page.relativeDepthIs1 , page.relativeDepthIs2 , page.relativeDepthIs3 , page.relativeDepthIsN</STRONG><BR>A condition indicating whether the relative depth of this page is N.</P>
|
||||
<P dir=ltr><STRONG>page.isLeftMost</STRONG><BR>This property is true if this page is the first within this level. Ie. has no left sister.</P>
|
||||
<P dir=ltr><STRONG>page.isRightMost</STRONG><BR>This property is true if this page is the last within this level. Ie. has no right sister.</P>
|
||||
<P dir=ltr><STRONG>page.depthDiff</STRONG><BR>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 <STRONG>page.isLeftMost</STRONG>.</P>
|
||||
<P dir=ltr><STRONG>page.depthDiffIs1, page.depthDiffIs2, page.depthDiffIs3, page.depthDiffIsN</STRONG><BR>True if the <STRONG>page.depthDiff</STRONG> variable is N.</P>
|
||||
<P dir=ltr><STRONG>page.depthDiff_loop</STRONG><BR>A loop that runs <STRONG>page.depthDiff</STRONG> times. This loop contains no loop variables.</P></BLOCKQUOTE>
|
||||
<P><STRONG>unfolded_page_loop</STRONG><BR>This loop contains the same data as <STRONG>page_loop</STRONG> but the order is different. <STRONG>page_loop</STRONG> returns it's pages in a nested order: the pages are returned in a hierarchical order. <STRONG>unfolded_page_loop</STRONG>, however, returns it's pages in an unfolded manner: it's returned pages are grouped by parent id. You'll probably need <STRONG>page_loop</STRONG>, but there are (CSS) menus that need <STRONG>unfolded_page_loop</STRONG> to work properly.</P>
|
||||
<P dir=ltr> </P>|,
|
||||
lastUpdated => 1078207966
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue