Change dispatching mechanism of NL content handler

This commit is contained in:
Martin Kamerbeek 2010-05-06 16:20:18 +02:00
parent 450f56f639
commit 643a63c568

View file

@ -3,18 +3,34 @@ package WebGUI::Content::NewsletterManager;
use strict;
use warnings;
use WebGUI::Pluggable;
sub handler {
my $session = shift;
my $form = $session->form;
return unless $form->get('newsletter') eq 'manage';
my $module = $form->get('newsletter');
my $class =
$module eq 'manage' ? 'WebGUI::Newsletter::Admin'
: $module eq 'mailing' ? 'WebGUI::Mailing'
: return
;
# return unless $form->get('newsletter') eq 'manage';
my $func = 'www_' . ( $form->get('func') || 'view' );
my $id = $form->get('id');
my $nl = WebGUI::Newsletter::Admin->new( $session );
return unless $nl->can( $func );
my $object = WebGUI::Pluggable::instanciate( $class, 'new', [ $session, $id ] );
return $object->$func if $object->can( $func );
return $nl->$func;
return;
# my $nl = WebGUI::Newsletter::Admin->new( $session );
# return unless $nl->can( $func );
#
# return $nl->$func;
}
1;