Renamed Navigation template variables and provided upgrade script.

Added Navigation template variables page.inRoot and basepage.hasDaughters
Updated Help documentation and changelog.
This commit is contained in:
Colin Kuskie 2004-10-13 04:41:14 +00:00
parent 5a00148928
commit f9f773a785
4 changed files with 88 additions and 41 deletions

View file

@ -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

View file

@ -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();

View file

@ -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);
}
}

View file

@ -1042,11 +1042,11 @@ A condition indicating whether the thread layout is threaded.
<p>
<b>thread.layout.isNested</b><br>
A condition indicationg whether the thread layout is nested.
A condition indicating whether the thread layout is nested.
<p>
<b>thread.layout.isFlat</b><br>
A condition indicationg whether the thread layout is flat.
A condition indicating whether the thread layout is flat.
<p>
<b>thread.subscribe.url</b><br>
@ -1187,7 +1187,7 @@ The description of this forum as passed by the calling object.
<p>
|,
lastUpdated => 1068919471
lastUpdated => 1097356661
},
'485' => {
@ -5491,15 +5491,16 @@ A comment.
'1097' => {
message => q|<STRONG>config.button</STRONG>&nbsp;<BR>A "Edit / Manage" button for this navigation item.<BR>
<P><STRONG>page.current.menuTitle</STRONG><BR>The pageId of the current page.</P>
<P><STRONG>page.current.title</STRONG><BR>The title of the current page.</P>
<P><STRONG>page.current.urlizedTitle</STRONG><BR>The URL of the current page.</P>
<P><STRONG>page.current.pageId</STRONG><BR>The pageId of the current page.</P>
<P><STRONG>page.current.parentId</STRONG><BR>The parentId of the current page.</P>
<P><STRONG>page.current.ownerId</STRONG><BR>The ownerId of the current page.</P>
<P><STRONG>page.current.synopsis</STRONG><BR>The synopsis of the current page.</P>
<P><STRONG>page.current.newWindow</STRONG><BR>A conditional indicating whether the current page should be opened in a new window.</P>
<P><STRONG>page.current.encryptLogin</STRONG><BR>A conditional indicating whether the current page should be served over SSL.</P>
<P><STRONG>basepage.menuTitle</STRONG><BR>The pageId of the base page.</P>
<P><STRONG>basepage.title</STRONG><BR>The title of the base page.</P>
<P><STRONG>basepage.urlizedTitle</STRONG><BR>The URL of the base page.</P>
<P><STRONG>basepage.pageId</STRONG><BR>The pageId of the base page.</P>
<P><STRONG>basepage.parentId</STRONG><BR>The parentId of the base page.</P>
<P><STRONG>basepage.ownerId</STRONG><BR>The ownerId of the base page.</P>
<P><STRONG>basepage.synopsis</STRONG><BR>The synopsis of the base page.</P>
<P><STRONG>basepage.newWindow</STRONG><BR>A conditional indicating whether the base page should be opened in a new window.</P>
<P><STRONG>basepage.encryptLogin</STRONG><BR>A conditional indicating whether the base page should be served over SSL.</P>
<P><STRONG>basepage.hasDaughters</STRONG><BR>A conditional indicating whether the base page has daughters.</P>
<P><STRONG>page_loop</STRONG><BR>A loop containing page information in nested, hierarchial order.</P>
<P><STRONG>unfolded_page_loop</STRONG><BR>This loop contains the same data as <STRONG>page_loop</STRONG> but the order is different. <STRONG>unfolded_page_loop</STRONG> returns it's pages in an unfolded manner; 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>Both <STRONG>page_loop</STRONG> and <STRONG>unfolded_page_loop</STRONG> have the following
@ -5520,19 +5521,21 @@ loop variables:</p>
<P><STRONG>page.isHidden</STRONG><BR>A conditional indicating whether this page is a hidden page.<BR><EM>(Note: This variable is only visible if "Show hidden pages" is switched on.)</EM></P>
<P><STRONG>page.isSystem</STRONG><BR>A conditional indicating whether this page is a system page (Trash, Clipboard, etc).<BR><EM>(Note: This variable is only visible if "Show system pages" is switched on.)</EM></P>
<P><STRONG>page.isViewable</STRONG><BR>A conditional indicating whether the user has permission to view it.<BR><EM>(Note: This variable is only visible if "Show unprivileged pages" is switched on.)</EM></P>
<P><STRONG>page.indent</STRONG><BR>A variable containing the indent for current page. The default indent is three spaces. Use the <STRONG>page.indent_loop</STRONG> if you need a more flexible indent.</P>
<P><STRONG>page.indent</STRONG><BR>A variable containing the indent for the current page. The default indent is three spaces. Use the <STRONG>page.indent_loop</STRONG> if you need a more flexible indent.</P>
<P><STRONG>page.indent_loop</STRONG><BR>A loop that runs <STRONG>page.relDepth</STRONG> times.</P>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<P><STRONG>indent</STRONG><BR>A number representing the loop count. </P></BLOCKQUOTE>
<P dir=ltr><STRONG>page.isRoot</STRONG><BR>A conditional indication whether this page is a root page.</P>
<P dir=ltr><STRONG>page.isTop</STRONG><BR>A conditional indication whether this page is a top page (daughter of root).</P>
<P dir=ltr><STRONG>page.inCurrentRoot</STRONG><BR>This conditional 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 conditional 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.isCurrent</STRONG><BR>A conditional indicating whether this page is the current page.</P>
<P dir=ltr><STRONG>page.isMyAncestor</STRONG><BR>A conditional indication whether this page is an ancestor of current page.</P>
<P dir=ltr><STRONG>page.isMyDaughter</STRONG><BR>A conditional indication whether this page is a daughter of current page.</P>
<P dir=ltr><STRONG>page.isMyMother</STRONG><BR>A conditional indication whether this page is the mother of current page.</P>
<P dir=ltr><STRONG>page.isMySister</STRONG><BR>A conditional indication whether this page is the sister of current page.</P>
<P dir=ltr><STRONG>page.isRoot</STRONG><BR>A conditional indicating whether this page is a root page.</P>
<P dir=ltr><STRONG>page.isTop</STRONG><BR>A conditional indicating whether this page is a top page (daughter of root).</P>
<P dir=ltr><STRONG>page.inRoot</STRONG><BR>This conditional is true if this page is a descendant of the root page of the base page.</P>
<P dir=ltr><STRONG>page.hasDaughter</STRONG><BR>A conditional indicating 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.isBasepage</STRONG><BR>A conditional indicating whether this page is the base page.</P>
<P dir=ltr><STRONG>page.isAncestor</STRONG><BR>A conditional indicating whether this page is an ancestor of the base page.</P>
<P dir=ltr><STRONG>page.isDescendent</STRONG><BR>A conditional indicating whether this page is a descendent of the base page.</P>
<P dir=ltr><STRONG>page.isDaughter</STRONG><BR>A conditional indicating whether this page is a daughter of the base page.</P>
<P dir=ltr><STRONG>page.isMother</STRONG><BR>A conditional indicating whether this page is the mother of the base page.</P>
<P dir=ltr><STRONG>page.isSister</STRONG><BR>A conditional indicating whether this page is the sister of the base page.</P>
<P dir=ltr><STRONG>page.inBranch</STRONG><BR>A conditional that is the logical OR of <STRONG>isAncestor</STRONG>, <STRONG>isisSister</STRONG>, <STRONG>isBasepage</STRONG> and <STRONG>isDescendent</STRONG>.</P>
<P dir=ltr><STRONG>page.mother.*</STRONG><BR>These variables will be undefined if the page is a root.</P>
<P dir=ltr><STRONG>page.mother.title</STRONG><BR>The title of the mother of this page.</P>
<P dir=ltr><STRONG>page.mother.urlizedTitle</STRONG><BR>The urlized title of the mother of this page.</P>
@ -5547,7 +5550,7 @@ loop variables:</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 dir=ltr>&nbsp;</P>|,
lastUpdated => 1097208584
lastUpdated => 1097642669
},
'893' => {