adding usability enhancements

This commit is contained in:
JT Smith 2005-01-29 17:36:02 +00:00
parent ae67e0b0ac
commit 514f84bffb
2 changed files with 28 additions and 16 deletions

View file

@ -845,6 +845,25 @@ sub getAssetsInTrash {
#-------------------------------------------------------------------
=head2 getContainer ()
Returns a reference to the container asset. If this asset is a container it returns a reference to itself. If this asset is not attached to a container it returns its parent.
=cut
sub getContainer {
my $self = shift;
if (WebGUI::Utility::isIn(ref $self, @{$session{config}{assetContainers}})) {
return $self;
} else {
$session{asset} = $self->getParent;
return $self->getParent;
}
}
#-------------------------------------------------------------------
=head2 getEditForm ( )
@ -2065,6 +2084,7 @@ sub www_add {
startDate => $self->get("startDate"),
endDate => $self->get("endDate")
);
$properties{isHidden} = 1 unless (WebGUI::Utility::isIn(ref $session{form}{class}, @{$session{config}{assetContainers}}));
my $newAsset = WebGUI::Asset->newByDynamicClass("new",$session{form}{class},\%properties);
return $newAsset->www_edit();
}
@ -2082,7 +2102,7 @@ sub www_copy {
return $self->getAdminConsole->render(WebGUI::Privilege::insufficient()) unless $self->canEdit;
my $newAsset = $self->duplicate;
$newAsset->cut;
return "";
return $self->getContainer->www_view;
}
#-------------------------------------------------------------------
@ -2204,7 +2224,7 @@ sub www_demote {
my $self = shift;
return $self->getAdminConsole->render(WebGUI::Privilege::insufficient()) unless $self->canEdit;
$self->demote;
return "";
return $self->getContainer->www_view;
}
#-------------------------------------------------------------------
@ -2941,7 +2961,7 @@ sub www_promote {
my $self = shift;
return $self->getAdminConsole->render(WebGUI::Privilege::insufficient()) unless $self->canEdit;
$self->promote;
return "";
return $self->getContainer->www_view;
}

View file

@ -142,7 +142,7 @@ sub getUiLevel {
#-------------------------------------------------------------------
sub view {
my $self = shift;
my $children = $self->getLineage( ["children"], { returnObjects=>1 });
my $children = $self->getLineage( ["children"], { returnObjects=>1, excludeClasses=>["WebGUI::Asset::Wobject::Layout"] });
my %vars;
# I'm sure there's a more efficient way to do this. We'll figure it out someday.
my @positions = split(/\./,$self->get("contentPositions"));
@ -165,19 +165,11 @@ sub view {
}
# deal with unplaced children
foreach my $child (@{$children}) {
if (ref $child eq "WebGUI::Asset::Wobject::Layout") {
push(@{$vars{"sublayout_loop"}}, {
id => $child->getId,
url => $child->getUrl,
title => $child->get("title")
unless (isIn($child->getId, @found)) {
push(@{$vars{"position1_loop"}},{
id=>$child->getId,
content=>$child->view
});
} else {
unless (isIn($child->getId, @found)) {
push(@{$vars{"position1_loop"}},{
id=>$child->getId,
content=>$child->view
});
}
}
}
$vars{showAdmin} = ($session{var}{adminOn} && $self->canEdit);