[ 1477611 ] 6.99: Edit/Manage buttons appear multiple times

This commit is contained in:
JT Smith 2006-04-28 20:11:32 +00:00
parent 29e4effdb9
commit ac8f720f87
2 changed files with 5 additions and 33 deletions

View file

@ -102,7 +102,6 @@ sub toHtml {
}
}
$self->set("options", $templateList);
$self->setManageIcons();
return $self->SUPER::toHtml();
}
@ -115,21 +114,6 @@ Renders the form field to HTML as a table row complete with labels, subtext, hov
=cut
sub toHtmlWithWrapper {
my $self = shift;
$self->setManageIcons();
return $self->SUPER::toHtmlWithWrapper;
}
#-------------------------------------------------------------------
=head2 setManageIcons ( )
Adds code to the extras field of the form so that buttons for managing or
editing the template show up if the user is allowed to do that.
=cut
sub setManageIcons {
my $self = shift;
my $template = WebGUI::Asset::Template->new($self->session,$self->get('value'));
if (defined $template && $template->canEdit) {
@ -141,6 +125,7 @@ sub setManageIcons {
$buttons .= $self->session->icon->manage("func=manageAssets",$template->getParent->get("url"));
$self->set("subtext",$buttons . $self->get("subtext"));
}
return $self->SUPER::toHtmlWithWrapper;
}
1;

View file

@ -103,7 +103,6 @@ sub toHtml {
my $workflowList = WebGUI::Workflow->getList($self->session, $self->get("type"));
$workflowList->{""} = "None" if ($self->get("none"));
$self->set("options", $workflowList);
$self->setManageIcons();
return $self->SUPER::toHtml();
}
@ -117,24 +116,12 @@ Renders the form field to HTML as a table row complete with labels, subtext, hov
sub toHtmlWithWrapper {
my $self = shift;
$self->setManageIcons();
my $returnUrl = ";proceed=goBackToPage;returnUrl=".$self->session->url->escape($self->session->asset->getUrl) if $self->session->asset;
my $buttons = $self->session->icon->edit("op=editWorkflow;workflowId=".$self->get("value").$returnUrl) if ($self->get("value"));
$buttons .= $self->session->icon->manage("op=manageWorkflows".$returnUrl);
$self->set("subtext",$buttons . $self->get("subtext"));
return $self->SUPER::toHtmlWithWrapper;
}
#-------------------------------------------------------------------
=head2 setManageIcons ( )
Adds code to the subtext field of the form so that buttons for managing or editing the template show up if the user is allowed to do that.
=cut
sub setManageIcons {
my $self = shift;
my $returnUrl = ";proceed=goBackToPage;returnUrl=".$self->session->url->escape($self->session->asset->getUrl) if $self->session->asset;
my $buttons = $self->session->icon->edit("op=editWorkflow;workflowId=".$self->get("workflowId").$returnUrl) if ($self->get("workflowId"));
$buttons .= $self->session->icon->manage("op=manageWorkflows".$returnUrl);
$self->set("subtext",$buttons . $self->get("subtext"));
}
1;