Template confirm mutation screen.

This commit is contained in:
Martin Kamerbeek 2010-11-18 15:21:44 +01:00
parent b9aaf63ec2
commit 745addd5d1
5 changed files with 66 additions and 15 deletions

View file

@ -87,6 +87,13 @@ sub definition {
namespace => 'Subscriber/NoMutationEmail', namespace => 'Subscriber/NoMutationEmail',
tab => 'subscription', tab => 'subscription',
}, },
confirmMutationTemplateId => {
fieldType => 'template',
defaultValue => 'WUk-wEhGiF8dcEogrJfrfg',
label => $i18n->get( 'confirm mutation template' ),
namespace => 'Subscriber/MutationConfirmation',
tab => 'subscription',
}
); );
push( @{ $definition }, { push( @{ $definition }, {
@ -527,21 +534,30 @@ sub www_confirmMutation {
] ]
); );
my $var = {
message => $i18n->get( 'wrong code' ),
returnUrl => $self->getUrl,
isSuccess => 0,
"is$type" => 1,
};
if ( $userId ) { if ( $userId ) {
$self->logConfirmation( $code ); $self->logConfirmation( $code );
if ( $type eq 'subscribe' ) { if ( $type eq 'subscribe' ) {
$self->getSubscriptionGroup->addUsers( [ $userId ] ); $self->getSubscriptionGroup->addUsers( [ $userId ] );
return $self->processStyle( sprintf $i18n->get( 'subscription successful'), $self->getUrl );
$var->{ message } = sprintf $i18n->get( 'subscription successful'), $self->getUrl;
$var->{ isSuccess } = 1;
} }
elsif ( $type eq 'unsubscribe' ) { elsif ( $type eq 'unsubscribe' ) {
$self->getSubscriptionGroup->deleteUsers( [ $userId ] ); $self->getSubscriptionGroup->deleteUsers( [ $userId ] );
return $self->processStyle( sprintf $i18n->get( 'unsubscription successful' ), $self->getUrl );
$var->{ message } = sprintf $i18n->get( 'unsubscription successful' ), $self->getUrl;
$var->{ isSuccess } = 1;
} }
} }
return $self->processStyle( $i18n->get( 'wrong code' ) ); return $self->processTemplate( $var, $self->get('confirmMutationTemplateId') );
} }
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------

View file

@ -54,14 +54,17 @@ our $I18N = {
}, },
'subscription successful' => { 'subscription successful' => {
message => 'Uw inschrijving is geslaagd. <a href="%s">Terug naar de site</a>', message => 'Uw inschrijving is geslaagd.',
}, },
'unsubscription successful' => { 'unsubscription successful' => {
message => 'Uw uitschrijving is geslaagd. <a href="%s">Terug naar de site</a>', message => 'Uw uitschrijving is geslaagd.',
}, },
'wrong code' => { 'wrong code' => {
message => 'De verificatiecode in de link is onbekend, al gebruikt of verlopen. Als u zich wilt in- of uitschrijven probeer dit dan opnieuw of neem contact op met de websitebeheerders.', message => 'De verificatiecode in de link is onbekend, al gebruikt of verlopen. Als u zich wilt in- of uitschrijven probeer dit dan opnieuw of neem contact op met de websitebeheerders.',
}, },
'confirm mutation template' => {
message => 'Mutatie bevestigings template',
},
}; };
1; 1;

View file

@ -34,7 +34,6 @@ our $I18N = {
message => 'Subscription', message => 'Subscription',
}, },
'subscribe' => { 'subscribe' => {
message => 'Subscribe', message => 'Subscribe',
}, },
@ -54,15 +53,18 @@ our $I18N = {
}, },
'subscription successful' => { 'subscription successful' => {
message => 'You are succesfully subscribed. <a href="%s">Back to site</a>', message => 'You are succesfully subscribed.',
}, },
'unsubscription successful' => { 'unsubscription successful' => {
message => 'You are succesfully unsubscribed. <a href="%s">Back to site</a>', message => 'You are succesfully unsubscribed.',
}, },
'wrong code' => { 'wrong code' => {
message => 'The verification code you supplied is either unknown, already used or expired. Please try again to (un)subscribe or contact the site administrators.', message => 'The verification code you supplied is either unknown, already used or expired. Please try again to (un)subscribe or contact the site administrators.',
}, },
'confirm mutation template' => {
message => 'Mutation confirmation template',
},
}; };
1; 1;

View file

@ -34,9 +34,39 @@ renamespaceTemplates( $session );
addSpecialStateTable( $session ); addSpecialStateTable( $session );
addListNameColumn( $session ); addListNameColumn( $session );
addRegistrationSteps( $session ); addRegistrationSteps( $session );
addConfirmationTemplateColumn( $session );
finish($session); finish($session);
#----------------------------------------------------------------------------
sub addConfirmationTemplateColumn {
my $session = shift;
my $db = $session->db;
print "\tAdding column for mutation confirmation template...";
my $hasColumn = $db->quickScalar( 'show columns from assetAspectSubscriber where Field = ?', [
'confirmMutationTemplateId',
] );
unless ( $hasColumn ) {
$db->write(
'alter table assetAspectSubscriber add column confirmMutationTemplateId char(22) binary not null default ?',
[
'WUk-wEhGiF8dcEogrJfrfg',
]
);
$db->write(
'update assetAspectSubscriber set confirmMutationTemplateId=? where confirmMutationTemplateId is null',
[
'WUk-wEhGiF8dcEogrJfrfg',
]
);
}
print "Done.\n";
}
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
sub addListNameColumn { sub addListNameColumn {