[ 1256718 ] Assets disappear after changing page layout

This commit is contained in:
Matthew Wilson 2005-08-25 07:58:32 +00:00
parent 320235bfec
commit 0ed0f15459
2 changed files with 19 additions and 8 deletions

View file

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