diff --git a/lib/WebGUI/AssetAspect/Subscriber.pm b/lib/WebGUI/AssetAspect/Subscriber.pm index 204ffbd..e02f616 100644 --- a/lib/WebGUI/AssetAspect/Subscriber.pm +++ b/lib/WebGUI/AssetAspect/Subscriber.pm @@ -87,6 +87,13 @@ sub definition { namespace => 'Subscriber/NoMutationEmail', tab => 'subscription', }, + confirmMutationTemplateId => { + fieldType => 'template', + defaultValue => 'WUk-wEhGiF8dcEogrJfrfg', + label => $i18n->get( 'confirm mutation template' ), + namespace => 'Subscriber/MutationConfirmation', + tab => 'subscription', + } ); 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 ) { $self->logConfirmation( $code ); if ( $type eq 'subscribe' ) { $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' ) { $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') ); } #---------------------------------------------------------------------------- diff --git a/lib/WebGUI/i18n/Dutch/AssetAspect_Subscriber.pm b/lib/WebGUI/i18n/Dutch/AssetAspect_Subscriber.pm index ee759a2..e6e8995 100644 --- a/lib/WebGUI/i18n/Dutch/AssetAspect_Subscriber.pm +++ b/lib/WebGUI/i18n/Dutch/AssetAspect_Subscriber.pm @@ -3,7 +3,7 @@ package WebGUI::i18n::Dutch::AssetAspect_Subscriber; use strict; our $I18N = { - 'Subscription group' => { + 'Subscription group' => { message => 'Abonnee groep', }, 'Enable subscription' => { @@ -24,7 +24,7 @@ our $I18N = { 'confirmation email template' => { message => 'Verificatie email: sjabloon', }, - 'no mutation subject' => { + 'no mutation subject' => { message => 'Geen wijziging email: onderwerp', }, 'no mutation template' => { @@ -52,16 +52,19 @@ our $I18N = { 'anonnymous not allowed' => { message => 'Anonieme inschrijvingen zijn niet toegestaan. Log in om in- of uit te schrijven.', }, - + 'subscription successful' => { - message => 'Uw inschrijving is geslaagd. Terug naar de site', + message => 'Uw inschrijving is geslaagd.', }, 'unsubscription successful' => { - message => 'Uw uitschrijving is geslaagd. Terug naar de site', + message => 'Uw uitschrijving is geslaagd.', }, '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.', }, + 'confirm mutation template' => { + message => 'Mutatie bevestigings template', + }, }; 1; diff --git a/lib/WebGUI/i18n/English/AssetAspect_Subscriber.pm b/lib/WebGUI/i18n/English/AssetAspect_Subscriber.pm index f330260..cc5b9e5 100644 --- a/lib/WebGUI/i18n/English/AssetAspect_Subscriber.pm +++ b/lib/WebGUI/i18n/English/AssetAspect_Subscriber.pm @@ -3,7 +3,7 @@ package WebGUI::i18n::English::AssetAspect_Subscriber; use strict; our $I18N = { - 'Subscription group' => { + 'Subscription group' => { message => 'Subscription group', }, 'Enable subscription' => { @@ -24,7 +24,7 @@ our $I18N = { 'confirmation email template' => { message => 'Confirmation email template', }, - 'no mutation subject' => { + 'no mutation subject' => { message => 'No mutation email subject', }, 'no mutation template' => { @@ -34,7 +34,6 @@ our $I18N = { message => 'Subscription', }, - 'subscribe' => { message => 'Subscribe', }, @@ -52,17 +51,20 @@ our $I18N = { 'anonnymous not allowed' => { message => 'Anonymous subscription is not allowed. Please log in to (un)subscribe', }, - + 'subscription successful' => { - message => 'You are succesfully subscribed. Back to site', + message => 'You are succesfully subscribed.', }, 'unsubscription successful' => { - message => 'You are succesfully unsubscribed. Back to site', + message => 'You are succesfully unsubscribed.', }, '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.', }, + 'confirm mutation template' => { + message => 'Mutation confirmation template', + }, }; 1; diff --git a/sbin/install_newsletter.pl b/sbin/install_newsletter.pl index 2d07aea..ced5510 100644 --- a/sbin/install_newsletter.pl +++ b/sbin/install_newsletter.pl @@ -34,9 +34,39 @@ renamespaceTemplates( $session ); addSpecialStateTable( $session ); addListNameColumn( $session ); addRegistrationSteps( $session ); +addConfirmationTemplateColumn( $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 { diff --git a/sbin/packages/root_import_personalnewsletter.wgpkg b/sbin/packages/root_import_personalnewsletter.wgpkg index a96e715..badf6e3 100644 Binary files a/sbin/packages/root_import_personalnewsletter.wgpkg and b/sbin/packages/root_import_personalnewsletter.wgpkg differ