From 0ed0f154597d2b0bd7fe1acb6873dbf477ee6710 Mon Sep 17 00:00:00 2001 From: Matthew Wilson Date: Thu, 25 Aug 2005 07:58:32 +0000 Subject: [PATCH] [ 1256718 ] Assets disappear after changing page layout --- docs/changelog/6.x.x.txt | 5 ++--- lib/WebGUI/Asset/Wobject/Layout.pm | 22 +++++++++++++++++----- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/docs/changelog/6.x.x.txt b/docs/changelog/6.x.x.txt index b090da596..182603278 100644 --- a/docs/changelog/6.x.x.txt +++ b/docs/changelog/6.x.x.txt @@ -3,8 +3,6 @@ - fix [ 1267548 ] can't add metadata field (midellaq) - fix [ 1265788 ] SyndicatedContent *not working* in 6.7.x - fix [ 1266285 ] 6.7.1 - UserProfile Fields Time error (Len Kranendonk) - -======= - fix [ 1245765 ] Missing 'page not found' crashes settings - fix [ 1263934 ] 6.6.5 Import Scripts Asset URLs - fix [ 1260760 ] Default endDate in asset table too high for FreeBSD @@ -19,7 +17,8 @@ - fix [ 1248040 ] plainblack forum search not showing dates - fix [ 1265771 ] assets that were formerly packages are still on packageList - fix [ 1177447 ] deployPackage does not retain content pos. (mwilson) ->>>>>>> 1.450 + - fix [ 1256718 ] Assets disappear after changing page layout (mwilson) + 6.7.1 - fix [ 1251608 ] can't login diff --git a/lib/WebGUI/Asset/Wobject/Layout.pm b/lib/WebGUI/Asset/Wobject/Layout.pm index 59da3819d..20ccbb24e 100644 --- a/lib/WebGUI/Asset/Wobject/Layout.pm +++ b/lib/WebGUI/Asset/Wobject/Layout.pm @@ -143,17 +143,29 @@ sub view { my @positions = split(/\./,$self->get("contentPositions")); my @hidden = split("\n",$self->getValue("assetsToHide")); my $i = 1; + my $template= WebGUI::Asset->newByDynamicClass($self->get("templateId"))->get("template"); + my $numPositions = 1; + foreach my $j (2..15) { + $numPositions = $j if $template =~ m/position${j}\_loop/; + } my @found; foreach my $position (@positions) { my @assets = split(",",$position); foreach my $asset (@assets) { foreach my $child (@{$children}) { if ($asset eq $child->getId) { - unless (isIn($asset,@hidden)) { - push(@{$vars{"position".$i."_loop"}},{ - id=>$child->getId, - content=>$child->view - }) if $child->canView; + unless (isIn($asset,@hidden) || !($child->canView)) { + if ($i > $numPositions) { + push(@{$vars{"position1_loop"}},{ + id=>$child->getId, + content=>$child->view + }); + } else { + push(@{$vars{"position".$i."_loop"}},{ + id=>$child->getId, + content=>$child->view + }); + } } push(@found, $child->getId); }