Adding basic per instance mailing configuration.
This commit is contained in:
parent
f8cb8cd05a
commit
04f39ebc19
5 changed files with 104 additions and 8 deletions
|
|
@ -28,6 +28,7 @@ sub crud_definition {
|
|||
},
|
||||
configuration => {
|
||||
fieldType => 'textarea',
|
||||
serialize => 1,
|
||||
},
|
||||
sendDate => {
|
||||
fieldType => 'dateTime',
|
||||
|
|
@ -122,6 +123,68 @@ sub queueEmails {
|
|||
|
||||
return;
|
||||
}
|
||||
|
||||
sub www_delete {
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
|
||||
$self->delete;
|
||||
|
||||
return WebGUI::Mailing::Admin->new($session)->www_view;
|
||||
}
|
||||
|
||||
sub www_edit {
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
|
||||
my $f = WebGUI::HTMLForm->new( $session );
|
||||
$f->hidden(
|
||||
name => 'newsletter',
|
||||
value => 'mailing',
|
||||
);
|
||||
$f->hidden(
|
||||
name => 'func',
|
||||
value => 'editSave',
|
||||
);
|
||||
$f->hidden(
|
||||
name => 'id',
|
||||
value => $self->getId,
|
||||
);
|
||||
|
||||
my %fields = %{ $self->getAsset->getMailingProperties };
|
||||
my $configuration = $self->get('configuration') || {};
|
||||
while ( my( $name, $properties ) = each %fields ) {
|
||||
$f->dynamicField(
|
||||
name => $name,
|
||||
%{ $properties },
|
||||
value => $configuration->{ $name },
|
||||
);
|
||||
}
|
||||
|
||||
$f->submit;
|
||||
|
||||
return WebGUI::Mailing::Admin->new($session)->getAdminConsole->render( $f->print, 'Configure mailing' );
|
||||
}
|
||||
|
||||
sub www_editSave {
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
my $form = $session->form;
|
||||
|
||||
my %fields = %{ $self->getAsset->getMailingProperties };
|
||||
my $configuration = {};
|
||||
while ( my( $name, $properties ) = each %fields ) {
|
||||
my $value = $form->process( $name, $properties->{ fieldType }, $properties->{ defaultValue } );
|
||||
|
||||
$configuration->{ $name } = $value;
|
||||
}
|
||||
|
||||
#### TODO: Add error checking and required fields?
|
||||
$self->update( { configuration => $configuration } );
|
||||
|
||||
return WebGUI::Mailing::Admin->new( $session )->www_view;
|
||||
}
|
||||
|
||||
sub www_sendBatch {
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue