diff --git a/docs/changelog/6.x.x.txt b/docs/changelog/6.x.x.txt index c0ad5a06b..6b2bdaa51 100644 --- a/docs/changelog/6.x.x.txt +++ b/docs/changelog/6.x.x.txt @@ -5,6 +5,8 @@ - bugfix [1041937] List Roots broken - bugfix [1042680] collateralImport.pl --folderId - Fixed typo in Wobjects/IndexedSearch.pm + - Navigation template variable rename, added template variables for + basepage.hasDaughter, page.inRoot. 6.2.7 diff --git a/docs/upgrades/upgrade_6.2.7-6.3.0.pl b/docs/upgrades/upgrade_6.2.7-6.3.0.pl new file mode 100644 index 000000000..345ec274e --- /dev/null +++ b/docs/upgrades/upgrade_6.2.7-6.3.0.pl @@ -0,0 +1,37 @@ +#!/usr/bin/perl + +use lib "../../lib"; +use Getopt::Long; +use strict; +use WebGUI::Id; +use WebGUI::Page; +use WebGUI::Session; +use WebGUI::SQL; +use WebGUI::URL; + + +my $configFile; +my $quiet; + +GetOptions( + 'configFile=s'=>\$configFile, + 'quiet'=>\$quiet +); + +WebGUI::Session::open("../..",$configFile); + +print "\tFixing navigation template variables.\n" unless ($quiet); +my $sth = WebGUI::SQL->read("select * from template where namespace in ('Navigation')"); +while (my $data = $sth->hashRef) { + $data->{template} =~ s/page.current/basepage/ig; + $data->{template} =~ s/isMy/is/ig; + $data->{template} =~ s/isCurrent/isBasepage/ig; + $data->{template} =~ s/inCurrentRoot/inBranch/ig; + WebGUI::SQL->write("update template set template=".quote($data->{template})." where namespace=".quote($data->{namespace})." and templateId=".quote($data->{templateId})); +} +$sth->finish; + + +WebGUI::Session::close(); + + diff --git a/lib/WebGUI/Navigation.pm b/lib/WebGUI/Navigation.pm index 42ec5574d..2810dc5a6 100644 --- a/lib/WebGUI/Navigation.pm +++ b/lib/WebGUI/Navigation.pm @@ -228,11 +228,13 @@ sub build { my (@page_loop, $lastPage, %unfolded); tie %unfolded, "Tie::IxHash"; - # Store current page properties in template var - my $currentPage = WebGUI::Page->getPage(); - foreach my $property (@interestingPageProperties) { - $var->{'page.current.'.$property} = $currentPage->get($property); - } + # Store current page properties in template var + my $currentPage = WebGUI::Page->getPage(); + my $currentRoot = $currentPage->getWebGUIRoot(); + foreach my $property (@interestingPageProperties) { + $var->{'basepage.'.$property} = $currentPage->get($property); + } + $var->{'basepage.hasDaughters'} = $currentPage->hasDaughter(); unless (defined $cacheContent && ! $session{url}{siteURL}) { # Never use cache if an alternate site url is specified. # The loop was not cached @@ -268,7 +270,7 @@ sub build { $pageData->{"page.url"} =~ s/http:/https:/; } $pageData->{"page.relDepth"} = $pageData->{"page.absDepth"} - $startPageDepth; - $pageData->{"page.isCurrent"} = ($page->{'pageId'} eq $session{page}{pageId}); + $pageData->{"page.isBasepage"} = ($page->{'pageId'} eq $session{page}{pageId}); $pageData->{"page.isHidden"} = $page->{'hideFromNavigation'}; # indent @@ -297,32 +299,36 @@ sub build { $pageData->{"page.isRoot"} = (! $page->{'parentId'}); $pageData->{"page.isTop"} = ($pageData->{"page.absDepth"} == 2); $pageData->{"page.hasDaughter"} = ($page->{'nestedSetRight'} - $page->{'nestedSetLeft'} > 1); - $pageData->{"page.isMyDaughter"} = ($page->{'parentId'} eq $currentPage->get('pageId')); - $pageData->{"page.isMyMother"} = ($page->{'pageId'} eq $currentPage->get('parentId')); + $pageData->{"page.isDaughter"} = ($page->{'parentId'} eq $currentPage->get('pageId')); + $pageData->{"page.isMother"} = ($page->{'pageId'} eq $currentPage->get('parentId')); - $pageData->{"page.isMyAncestor"} + $pageData->{"page.isAncestor"} = (($page->{'nestedSetLeft'} < $currentPage->get('nestedSetLeft')) && ($page->{'nestedSetRight'} > $currentPage->get('nestedSetRight'))); - $pageData->{"page.isMyDescendent"} + $pageData->{"page.isDescendent"} = (($page->{'nestedSetLeft'} > $currentPage->get('nestedSetLeft')) && ($page->{'nestedSetRight'} < $currentPage->get('nestedSetRight'))); + $pageData->{"page.inRoot"} + = (($page->{'nestedSetLeft'} > $currentRoot->get('nestedSetLeft')) + && ($page->{'nestedSetRight'} < $currentRoot->get('nestedSetRight'))); + # Some information about my mother my $mother = WebGUI::Page->getPage($page->{parentId}); if ($page->{parentId} ne "0") { foreach (qw(title urlizedTitle parentId pageId)) { $pageData->{"page.mother.$_"} = $mother->get($_); } - $pageData->{"page.isMySister"} + $pageData->{"page.isSister"} = (($mother->get("pageId") eq $currentPage->get("parentId")) - && !$pageData->{"page.isCurrent"}); + && !$pageData->{"page.isBasepage"}); } - $pageData->{"page.inCurrentRoot"} - = ($pageData->{"page.isMyAncestor"} - || $pageData->{"page.isMyDescendent"} - || $pageData->{"page.isMySister"} - || $pageData->{"page.isCurrent"}); + $pageData->{"page.inBranch"} + = ($pageData->{"page.isAncestor"} + || $pageData->{"page.isDescendent"} + || $pageData->{"page.isSister"} + || $pageData->{"page.isBasepage"}); $pageData->{"page.isLeftMost"} = (($page->{'nestedSetLeft'} - 1) == $mother->get('nestedSetLeft')); $pageData->{"page.isRightMost"} = (($page->{'nestedSetRight'} + 1) == $mother->get('nestedSetRight')); @@ -344,7 +350,6 @@ sub build { if ($self->{_reverse}) { unshift(@page_loop, $pageData); } else { - push(@page_loop, $pageData); } } diff --git a/lib/WebGUI/i18n/English/WebGUI.pm b/lib/WebGUI/i18n/English/WebGUI.pm index e83295298..c00d59d74 100644 --- a/lib/WebGUI/i18n/English/WebGUI.pm +++ b/lib/WebGUI/i18n/English/WebGUI.pm @@ -1042,11 +1042,11 @@ A condition indicating whether the thread layout is threaded.
thread.layout.isNested
-A condition indicationg whether the thread layout is nested.
+A condition indicating whether the thread layout is nested.
thread.layout.isFlat
-A condition indicationg whether the thread layout is flat.
+A condition indicating whether the thread layout is flat.
thread.subscribe.url
@@ -1187,7 +1187,7 @@ The description of this forum as passed by the calling object.
|,
- lastUpdated => 1068919471
+ lastUpdated => 1097356661
},
'485' => {
@@ -5491,15 +5491,16 @@ A comment.
'1097' => {
message => q|config.button
A "Edit / Manage" button for this navigation item.
-
page.current.menuTitle
The pageId of the current page.
page.current.title
The title of the current page.
page.current.urlizedTitle
The URL of the current page.
page.current.pageId
The pageId of the current page.
page.current.parentId
The parentId of the current page.
page.current.ownerId
The ownerId of the current page.
page.current.synopsis
The synopsis of the current page.
page.current.newWindow
A conditional indicating whether the current page should be opened in a new window.
page.current.encryptLogin
A conditional indicating whether the current page should be served over SSL.
basepage.menuTitle
The pageId of the base page.
basepage.title
The title of the base page.
basepage.urlizedTitle
The URL of the base page.
basepage.pageId
The pageId of the base page.
basepage.parentId
The parentId of the base page.
basepage.ownerId
The ownerId of the base page.
basepage.synopsis
The synopsis of the base page.
basepage.newWindow
A conditional indicating whether the base page should be opened in a new window.
basepage.encryptLogin
A conditional indicating whether the base page should be served over SSL.
basepage.hasDaughters
A conditional indicating whether the base page has daughters.
page_loop
A loop containing page information in nested, hierarchial order.
unfolded_page_loop
This loop contains the same data as page_loop but the order is different. unfolded_page_loop returns it's pages in an unfolded manner; grouped by parent id. You'll probably need page_loop, but there are (CSS) menus that need unfolded_page_loop to work properly.
Both page_loop and unfolded_page_loop have the following @@ -5520,19 +5521,21 @@ loop variables:
page.isHidden
A conditional indicating whether this page is a hidden page.
(Note: This variable is only visible if "Show hidden pages" is switched on.)
page.isSystem
A conditional indicating whether this page is a system page (Trash, Clipboard, etc).
(Note: This variable is only visible if "Show system pages" is switched on.)
page.isViewable
A conditional indicating whether the user has permission to view it.
(Note: This variable is only visible if "Show unprivileged pages" is switched on.)
page.indent
A variable containing the indent for current page. The default indent is three spaces. Use the page.indent_loop if you need a more flexible indent.
page.indent
A variable containing the indent for the current page. The default indent is three spaces. Use the page.indent_loop if you need a more flexible indent.
page.indent_loop
A loop that runs page.relDepth times.
-indent
A number representing the loop count.
page.isRoot
A conditional indication whether this page is a root page.
page.isTop
A conditional indication whether this page is a top page (daughter of root).
page.inCurrentRoot
This conditional is true if this page is a descendant of the root page of the current page
page.hasDaughter
A conditional indication whether this page has a daughter. In other words: It evaluates to true if this page is a mother.
page.isCurrent
A conditional indicating whether this page is the current page.
page.isMyAncestor
A conditional indication whether this page is an ancestor of current page.
page.isMyDaughter
A conditional indication whether this page is a daughter of current page.
page.isMyMother
A conditional indication whether this page is the mother of current page.
page.isMySister
A conditional indication whether this page is the sister of current page.
page.isRoot
A conditional indicating whether this page is a root page.
page.isTop
A conditional indicating whether this page is a top page (daughter of root).
page.inRoot
This conditional is true if this page is a descendant of the root page of the base page.
page.hasDaughter
A conditional indicating whether this page has a daughter. In other words: It evaluates to true if this page is a mother.
page.isBasepage
A conditional indicating whether this page is the base page.
page.isAncestor
A conditional indicating whether this page is an ancestor of the base page.
page.isDescendent
A conditional indicating whether this page is a descendent of the base page.
page.isDaughter
A conditional indicating whether this page is a daughter of the base page.
page.isMother
A conditional indicating whether this page is the mother of the base page.
page.isSister
A conditional indicating whether this page is the sister of the base page.
page.inBranch
A conditional that is the logical OR of isAncestor, isisSister, isBasepage and isDescendent.
page.mother.*
These variables will be undefined if the page is a root.
page.mother.title
The title of the mother of this page.
page.mother.urlizedTitle
The urlized title of the mother of this page.
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.
|, - lastUpdated => 1097208584 + lastUpdated => 1097642669 }, '893' => {