Internationalized system messages.
This commit is contained in:
parent
bcb265e188
commit
2490e166d3
15 changed files with 422 additions and 79 deletions
|
|
@ -8,6 +8,7 @@ use WebGUI::Mailing::Admin;
|
|||
|
||||
use base 'WebGUI::Crud';
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
sub canCancel {
|
||||
my $self = shift;
|
||||
|
||||
|
|
@ -15,6 +16,7 @@ sub canCancel {
|
|||
return 0;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
sub cancel {
|
||||
my $self = shift;
|
||||
|
||||
|
|
@ -28,6 +30,7 @@ sub cancel {
|
|||
return;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
sub crud_definition {
|
||||
my $class = shift;
|
||||
my $session = shift;
|
||||
|
|
@ -68,6 +71,7 @@ sub crud_definition {
|
|||
return $definition;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
sub delete {
|
||||
my $self = shift;
|
||||
|
||||
|
|
@ -76,6 +80,7 @@ sub delete {
|
|||
return $self->SUPER::delete;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
sub deleteQueuedEmails {
|
||||
my $self = shift;
|
||||
|
||||
|
|
@ -87,6 +92,7 @@ sub deleteQueuedEmails {
|
|||
return;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
sub getAsset {
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
|
|
@ -96,6 +102,7 @@ sub getAsset {
|
|||
return $asset;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
sub getQueuedEmailIterator {
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
|
|
@ -103,6 +110,7 @@ sub getQueuedEmailIterator {
|
|||
return WebGUI::Mailing::Email->getQueued( $session, $self->getId );
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
sub getNextInSendQueue {
|
||||
my $class = shift;
|
||||
my $session = shift;
|
||||
|
|
@ -119,6 +127,7 @@ sub getNextInSendQueue {
|
|||
return $it->();
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
sub getStatusLine {
|
||||
my $self = shift;
|
||||
my $db = $self->session->db;
|
||||
|
|
@ -147,6 +156,7 @@ sub getStatusLine {
|
|||
return $output;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
sub queueTestEmails {
|
||||
my $self = shift;
|
||||
my $to = shift;
|
||||
|
|
@ -168,6 +178,7 @@ sub queueTestEmails {
|
|||
return;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
sub queueEmails {
|
||||
my $self = shift;
|
||||
my $userIds = shift;
|
||||
|
|
@ -187,6 +198,7 @@ sub queueEmails {
|
|||
return;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
sub sendQueuedEmails {
|
||||
my $self = shift;
|
||||
my $timeLimit = shift;
|
||||
|
|
@ -208,17 +220,24 @@ sub sendQueuedEmails {
|
|||
return 1;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
sub www_cancel {
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
my $admin = WebGUI::Mailing::Admin->new( $session );
|
||||
my $i18n = WebGUI::International->new( $session, 'MailingManager' );
|
||||
|
||||
return 'Cannot cancel mailing ['.$self->getId.']' unless $self->canCancel;
|
||||
return $admin->adminConsole->render(
|
||||
sprintf( $i18n->get( 'cannot cancel mailing' ), $self->getId ),
|
||||
$i18n->get( 'error' )
|
||||
) unless $self->canCancel;
|
||||
|
||||
$self->cancel;
|
||||
|
||||
return WebGUI::Mailing::Admin->new($session)->www_view;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
sub www_delete {
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
|
|
@ -228,9 +247,11 @@ sub www_delete {
|
|||
return WebGUI::Mailing::Admin->new($session)->www_view;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
sub www_edit {
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
my $i18n = WebGUI::International->new( $session, 'MailingManager' );
|
||||
|
||||
my $f = WebGUI::HTMLForm->new( $session );
|
||||
$f->hidden(
|
||||
|
|
@ -258,7 +279,7 @@ sub www_edit {
|
|||
|
||||
$f->submit;
|
||||
|
||||
return WebGUI::Mailing::Admin->new($session)->getAdminConsole->render( $f->print, 'Configure mailing' );
|
||||
return WebGUI::Mailing::Admin->new($session)->getAdminConsole->render( $f->print, $i18n->get('configure mailing') );
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
|
@ -274,9 +295,10 @@ sub www_previewContent {
|
|||
|
||||
#----------------------------------------------------------------------------
|
||||
sub www_previewEmail {
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
my ( $form, $url ) = $session->quick( 'form', 'url' );
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
my ( $form, $url ) = $session->quick( 'form', 'url' );
|
||||
my $i18n = WebGUI::International->new( $session, 'MailingManager' );
|
||||
|
||||
my $asset = $self->getAsset;
|
||||
my %recipients =
|
||||
|
|
@ -300,8 +322,8 @@ sub www_previewEmail {
|
|||
options => \%recipients,
|
||||
value => $userId,
|
||||
} )
|
||||
. WebGUI::Form::submit( $session, { value => 'Switch' } )
|
||||
. " <a href=\"$manageUrl\">Return to newsletter manager</a>"
|
||||
. WebGUI::Form::submit( $session, { value => $i18n->get( 'switch user') } )
|
||||
. " <a href=\"$manageUrl\">" . $i18n->get( 'return to manager' ) . "</a>"
|
||||
. WebGUI::Form::formFooter( $session );
|
||||
|
||||
return <<EOHTML;
|
||||
|
|
@ -318,6 +340,7 @@ sub www_previewEmail {
|
|||
EOHTML
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
sub www_editSave {
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
|
|
@ -337,9 +360,11 @@ sub www_editSave {
|
|||
return WebGUI::Mailing::Admin->new( $session )->www_view;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
sub www_sendBatch {
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
my $i18n = WebGUI::International->new( $session, 'MailingManager' );
|
||||
|
||||
my $f = WebGUI::HTMLForm->new( $session );
|
||||
$f->hidden(
|
||||
|
|
@ -356,13 +381,14 @@ sub www_sendBatch {
|
|||
);
|
||||
$f->dateTime(
|
||||
name => 'schedule',
|
||||
label => 'Send batch at',
|
||||
label => $i18n->get( 'send mailing at' ),
|
||||
);
|
||||
$f->submit;
|
||||
|
||||
return WebGUI::Mailing::Admin->new($session)->getAdminConsole->render( $f->print, 'Send batch' );
|
||||
return WebGUI::Mailing::Admin->new($session)->getAdminConsole->render( $f->print, $i18n->get('schedule mailing') );
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
sub www_sendBatchConfirm {
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
|
|
@ -386,12 +412,15 @@ sub www_sendBatchConfirm {
|
|||
return WebGUI::Mailing::Admin->new( $session )->www_view;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
sub www_sendTestEmails {
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
my $i18n = WebGUI::International->new( $session, 'MailingManager' );
|
||||
|
||||
|
||||
my $asset = WebGUI::Asset->newByDynamicClass( $session, $self->get('assetId') );
|
||||
croak "Cannot instaciate asset " . $self->get('assetId') unless $asset;
|
||||
croak "Cannot instanciate asset " . $self->get('assetId') unless $asset;
|
||||
|
||||
my $userIds = $asset->getRecipients;
|
||||
|
||||
|
|
@ -418,26 +447,26 @@ sub www_sendTestEmails {
|
|||
);
|
||||
$f->email(
|
||||
name => 'to',
|
||||
label => 'Send emails to test address',
|
||||
label => $i18n->get( 'test recipient' ),
|
||||
);
|
||||
$f->selectList(
|
||||
name => 'userIds',
|
||||
label => 'Generate test emails for user(s)',
|
||||
label => $i18n->get( 'test users' ),
|
||||
size => 10,
|
||||
multiple=> 1,
|
||||
options => \%options,
|
||||
);
|
||||
$f->submit( 'Send' );
|
||||
$f->submit( $i18n->get('send test mails') );
|
||||
|
||||
return $f->print;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
sub www_sendTestEmailsConfirm {
|
||||
my $self = shift;
|
||||
my $session = $self->session;
|
||||
my $form = $session->form;
|
||||
|
||||
# my $to = $form->email( 'to' );
|
||||
my $to = $form->get( 'to' );
|
||||
my @userIds = $form->selectList( 'userIds' );
|
||||
|
||||
|
|
@ -446,7 +475,5 @@ sub www_sendTestEmailsConfirm {
|
|||
return WebGUI::Mailing::Admin->new( $session )->www_view;
|
||||
}
|
||||
|
||||
|
||||
|
||||
1;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue