From b461d45f6b6fdfb291b2e02c7850ce97a654df1e Mon Sep 17 00:00:00 2001 From: JT Smith Date: Sat, 4 Sep 2004 01:00:00 +0000 Subject: [PATCH] fixed nav bug --- docs/changelog/6.x.x.txt | 1 + docs/upgrades/upgrade_6.1.1-6.2.0.sql | 1 - lib/WebGUI/Navigation.pm | 32 +++++++++++++-------------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/docs/changelog/6.x.x.txt b/docs/changelog/6.x.x.txt index 9f86bc288..e6b612d37 100644 --- a/docs/changelog/6.x.x.txt +++ b/docs/changelog/6.x.x.txt @@ -98,6 +98,7 @@ - bugfix [ 1014337 ] WSClient->new error: templateId field missing in database - bugfix [ 991782 ] More Fault Tolerent upgrade_5.9.9-6.0.0.pl + - Minor performance enhancements to Navigation system. diff --git a/docs/upgrades/upgrade_6.1.1-6.2.0.sql b/docs/upgrades/upgrade_6.1.1-6.2.0.sql index 1a139000b..9fdf86eb8 100644 --- a/docs/upgrades/upgrade_6.1.1-6.2.0.sql +++ b/docs/upgrades/upgrade_6.1.1-6.2.0.sql @@ -255,7 +255,6 @@ alter table userSessionScratch change sessionId sessionId char(22) not null; alter table users change referringAffiliate referringAffiliate char(22) not null; alter table page change lft nestedSetLeft int(11); alter table page change rgt nestedSetRight int(11); -alter table page change id id char(22); delete from incrementer where incrementerId in ("messageLogId","profileCategoryId","templateId","navigationId","passiveProfileLogId","metaData_fieldId","userId","collateralId","pageId","databaseLinkId", "DataForm_entryId", "DataForm_fieldId", "DataForm_tabId", "EventsCalendar_eventId", "EventsCalendar_recurringId", "FileManager_fileId", "forumId", "forumPostId", "forumThreadId", "groupId", "languageId", "Product_benefitId", "Product_featureId", "Product_specificationId", "replacementId", "Survey_answerId", "Survey_id", "Survey_questionId", "Survey_responseId", "USS_id", "USS_submissionId", "wobjectId"); alter table forum change postsPerPage threadsPerPage int(11) default 30; alter table forum add postsPerPage int(11) default 10 after threadsPerPage; diff --git a/lib/WebGUI/Navigation.pm b/lib/WebGUI/Navigation.pm index 85866772c..de573302c 100644 --- a/lib/WebGUI/Navigation.pm +++ b/lib/WebGUI/Navigation.pm @@ -225,7 +225,6 @@ sub build { my $cache = WebGUI::Cache->new($self->{_identifier}.'-'.$session{page}{pageId}, "Navigation-".$session{config}{configFile}); my $cacheContent = $cache->get unless $session{var}{adminOn}; - my (@page_loop, $lastPage, %unfolded); tie %unfolded, "Tie::IxHash"; @@ -242,22 +241,35 @@ sub build { WebGUI::ErrorHandler::warn("Error in WebGUI::Navigation::build while trying to execute $method".$@); } if (@pages) { - my $startPageDepth = ($p->ancestors); + my $startPageDepth = $p->get("depth")+1; my $maxDepth = $startPageDepth + $self->{_depth}; my $minDepth = $startPageDepth - $self->{_depth}; foreach my $page (@pages) { my $pageData = {}; + $pageData->{"page.absDepth"} = $page->{'depth'} + 1; + $pageData->{"page.isSystem"} = $page->{isSystem}; + + # Check if in depth range + next if ($pageData->{"page.absDepth"} > $maxDepth || $pageData->{"page.absDepth"} < $minDepth); + + # Check stopAtLevel + next if ($pageData->{"page.absDepth"} < $self->{_stopAtLevel}); + + # Check showSystemPages + next if (! $self->{_showSystemPages} && $pageData->{"page.isSystem"}); + + # Deal with hidden pages, don't ever hide pages if admin mode is on + next if(($page->{'hideFromNavigation'} && ! $self->{_showHiddenPages}) && (! $session{var}{adminOn})); + # Initial page info $pageData->{"page.url"} = WebGUI::URL::gateway($page->{'urlizedTitle'}); if ($page->{'encryptPage'}) { $pageData->{"page.url"} =~ s/http:/https:/; } - $pageData->{"page.absDepth"} = $page->{'depth'} + 1; $pageData->{"page.relDepth"} = $pageData->{"page.absDepth"} - $startPageDepth; $pageData->{"page.isCurrent"} = ($page->{'pageId'} eq $session{page}{pageId}); $pageData->{"page.isHidden"} = $page->{'hideFromNavigation'}; - $pageData->{"page.isSystem"} = $page->{isSystem}; # indent my $indent = 0; @@ -278,18 +290,6 @@ sub build { push(@{$pageData->{"page.indent_loop"}},{'indent'=>$_}) for(1..$indent); $pageData->{"page.indent"} = "   " x $indent; - # Check if in depth range - next if ($pageData->{"page.absDepth"} > $maxDepth || $pageData->{"page.absDepth"} < $minDepth); - - # Check stopAtLevel - next if ($pageData->{"page.absDepth"} < $self->{_stopAtLevel}); - - # Check showSystemPages - next if (! $self->{_showSystemPages} && $pageData->{"page.isSystem"}); - - # Deal with hidden pages, don't ever hide pages if admin mode is on - next if(($page->{'hideFromNavigation'} && ! $self->{_showHiddenPages}) && (! $session{var}{adminOn})); - # Put page properties in $pageData hashref foreach my $property (@interestingPageProperties) { $pageData->{"page.".$property} = $page->{$property};