Improved robustness and reload protection.
This commit is contained in:
parent
a858e8fb44
commit
913b4710e9
2 changed files with 23 additions and 4 deletions
|
|
@ -21,7 +21,15 @@ sub handler {
|
||||||
my $func = 'www_' . ( $form->get('func') || 'view' );
|
my $func = 'www_' . ( $form->get('func') || 'view' );
|
||||||
my $id = $form->get('id');
|
my $id = $form->get('id');
|
||||||
|
|
||||||
my $object = WebGUI::Pluggable::instanciate( $class, 'new', [ $session, $id ] );
|
my $object = eval { WebGUI::Pluggable::instanciate( $class, 'new', [ $session, $id ] ) };
|
||||||
|
|
||||||
|
if ( $@ || !$object ) {
|
||||||
|
my $ac = WebGUI::AdminConsole->new( $session );
|
||||||
|
my $output = "Unable to instanciate object of class [$class] with id [$id] because: $@";
|
||||||
|
|
||||||
|
return $ac->render( $output, 'Error' );
|
||||||
|
};
|
||||||
|
|
||||||
return $object->$func if $object->can( $func );
|
return $object->$func if $object->can( $func );
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -376,6 +376,16 @@ sub www_cancel {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------------
|
||||||
|
sub redirectToManager {
|
||||||
|
my $self = shift;
|
||||||
|
my ( $http, $url ) = $self->session->quick( qw{http url} );
|
||||||
|
|
||||||
|
$http->setRedirect( $url->page('newsletter=manage') );
|
||||||
|
|
||||||
|
return 'redirect';
|
||||||
|
}
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
sub www_delete {
|
sub www_delete {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
|
|
@ -385,7 +395,7 @@ sub www_delete {
|
||||||
|
|
||||||
$self->delete;
|
$self->delete;
|
||||||
|
|
||||||
return WebGUI::Mailing::Admin->new($session)->www_view;
|
return $self->redirectToManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
|
|
@ -581,7 +591,9 @@ sub www_editSave {
|
||||||
#### TODO: Add error checking and required fields?
|
#### TODO: Add error checking and required fields?
|
||||||
$self->update( { configuration => $configuration } );
|
$self->update( { configuration => $configuration } );
|
||||||
|
|
||||||
return WebGUI::Mailing::Admin->new( $session )->www_view;
|
my $url = $session->url;
|
||||||
|
|
||||||
|
return $self->redirectToManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
|
|
@ -753,7 +765,6 @@ sub www_sendTestEmailsConfirm {
|
||||||
$i18n->get( 'send test mails' )
|
$i18n->get( 'send test mails' )
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue