Skip to content

Commit

Permalink
Change to moose methods. Need to be on the lookout for getValue calls.
Browse files Browse the repository at this point in the history
  • Loading branch information
perlDreamer committed Feb 4, 2010
1 parent a9f46c7 commit 722bad7
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions lib/WebGUI/Asset/Wobject/Layout.pm
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -117,10 +117,11 @@ sub getEditForm {
my $i18n = WebGUI::International->new($self->session,"Asset_Layout"); my $i18n = WebGUI::International->new($self->session,"Asset_Layout");


my ($templateId); my ($templateId);
if (($self->get("assetId") eq "new") && ($self->getParent->get('className') eq 'WebGUI::Asset::Wobject::Layout')) { if (($self->assetId eq "new") && ($self->getParent->isa('WebGUI::Asset::Wobject::Layout'))) {
$templateId = $self->getParent->getValue('templateId'); $templateId = $self->getParent->templateId;
} else { }
$templateId = $self->getValue('templateId'); else {
$templateId = $self->templateId;
} }
$tabform->getTab("display")->template( $tabform->getTab("display")->template(
-value=>$templateId, -value=>$templateId,
Expand All @@ -141,7 +142,7 @@ sub getEditForm {
else { else {
$tabform->getTab("display")->hidden( $tabform->getTab("display")->hidden(
name => 'mobileTemplateId', name => 'mobileTemplateId',
value => $self->getValue('mobileTemplateId'), value => $self->mobileTemplateId,
); );
} }


Expand All @@ -154,7 +155,7 @@ sub getEditForm {
-name => 'assetOrder', -name => 'assetOrder',
-label => $i18n->get('asset order label'), -label => $i18n->get('asset order label'),
-hoverHelp => $i18n->get('asset order hoverHelp'), -hoverHelp => $i18n->get('asset order hoverHelp'),
-value => $self->getValue('assetOrder'), -value => $self->assetOrder,
-options => \%assetOrder -options => \%assetOrder
); );
if ($self->get("assetId") eq "new") { if ($self->get("assetId") eq "new") {
Expand All @@ -166,7 +167,7 @@ sub getEditForm {
-value=>"view" -value=>"view"
); );
} else { } else {
my @assetsToHide = split("\n",$self->getValue("assetsToHide")); my @assetsToHide = split("\n",$self->assetsToHide);
my $children = $self->getLineage(["children"],{"returnObjects"=>1, excludeClasses=>["WebGUI::Asset::Wobject::Layout"]}); my $children = $self->getLineage(["children"],{"returnObjects"=>1, excludeClasses=>["WebGUI::Asset::Wobject::Layout"]});
my %childIds; my %childIds;
foreach my $child (@{$children}) { foreach my $child (@{$children}) {
Expand Down Expand Up @@ -201,13 +202,13 @@ sub prepareView {
my $templateId; my $templateId;


if ($session->style->useMobileStyle) { if ($session->style->useMobileStyle) {
$templateId = $self->get('mobileTemplateId'); $templateId = $self->mobileTemplateId;
} }
else { else {
$templateId = $self->get('templateId'); $templateId = $self->templateId;
} }


my $template = WebGUI::Asset->new($session,$templateId,"WebGUI::Asset::Template"); my $template = WebGUI::Asset->newById($session, $templateId);
if (!$template) { if (!$template) {
WebGUI::Error::ObjectNotFound::Template->throw( WebGUI::Error::ObjectNotFound::Template->throw(
error => qq{Template not found}, error => qq{Template not found},
Expand All @@ -218,7 +219,7 @@ sub prepareView {
$template->prepare( $self->getMetaDataAsTemplateVariables ); $template->prepare( $self->getMetaDataAsTemplateVariables );
$self->{_viewTemplate} = $template; $self->{_viewTemplate} = $template;


my $templateContent = $template->get("template"); my $templateContent = $template->template;
my $numPositions = 1; my $numPositions = 1;
while ($templateContent =~ /position(\d+)_loop/g) { while ($templateContent =~ /position(\d+)_loop/g) {
$numPositions = $1 $numPositions = $1
Expand All @@ -231,7 +232,7 @@ sub prepareView {
my $splitter = $self->{_viewSplitter} = $self->getSeparator; my $splitter = $self->{_viewSplitter} = $self->getSeparator;


my %hidden = map { $_ => 1 } my %hidden = map { $_ => 1 }
split "\n", $self->get("assetsToHide"); split "\n", $self->assetsToHide;


my %placeHolder; my %placeHolder;
my @children; my @children;
Expand All @@ -247,15 +248,15 @@ sub prepareView {
$placeHolder{$assetId} = $child; $placeHolder{$assetId} = $child;
push @children, { push @children, {
id => $assetId, id => $assetId,
isUncommitted => $child->get('status') eq 'pending', isUncommitted => $child->status eq 'pending',
content => $splitter . $assetId . '~~', content => $splitter . $assetId . '~~',
}; };
if ($vars{showAdmin}) { if ($vars{showAdmin}) {
$children[-1]->{'dragger.icon'} = sprintf '<div id="td%s_handle" class="dragable"><div class="dragTrigger dragTriggerWrap">%s</div></div>', $assetId, $session->icon->drag('class="dragTrigger"'); $children[-1]->{'dragger.icon'} = sprintf '<div id="td%s_handle" class="dragable"><div class="dragTrigger dragTriggerWrap">%s</div></div>', $assetId, $session->icon->drag('class="dragTrigger"');
}; };
} }


my @positions = split /\./, $self->get("contentPositions"); my @positions = split /\./, $self->contentPositions;
# cut positions off at the number we found in the template # cut positions off at the number we found in the template
$#positions = $numPositions - 1 $#positions = $numPositions - 1
if $numPositions < scalar @positions; if $numPositions < scalar @positions;
Expand All @@ -278,7 +279,7 @@ sub prepareView {
} }
# deal with unplaced children # deal with unplaced children
# Add children to the top or bottom of the first content position based on assetOrder setting # Add children to the top or bottom of the first content position based on assetOrder setting
if($self->getValue("assetOrder") eq "asc") { if($self->assetOrder eq "asc") {
push @{ $vars{"position1_loop"} }, @children; push @{ $vars{"position1_loop"} }, @children;
} }
else { else {
Expand Down

0 comments on commit 722bad7

Please sign in to comment.