From efb7a004acb5f30531a79375827f0e7b13c27084 Mon Sep 17 00:00:00 2001 From: Martin Kamerbeek Date: Thu, 16 Dec 2010 13:39:15 +0100 Subject: [PATCH] Make subscribe buttons ie proof. --- lib/WebGUI/AssetAspect/Subscriber.pm | 34 ++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/lib/WebGUI/AssetAspect/Subscriber.pm b/lib/WebGUI/AssetAspect/Subscriber.pm index 13d2d08..f1c1750 100644 --- a/lib/WebGUI/AssetAspect/Subscriber.pm +++ b/lib/WebGUI/AssetAspect/Subscriber.pm @@ -203,12 +203,32 @@ sub appendSubscriptionFormVars { WebGUI::Form::formHeader( $session, { action => $self->getUrl } ) . WebGUI::Form::hidden( $session, { name => 'func', value => 'processSubscription' } ) ; - my $subscribeButton = - sprintf '', $i18n->get('subscribe'); - my $unsubscribeButton = - sprintf '', $i18n->get('unsubscribe'); - my $emailBox = WebGUI::Form::email( $session, { name => 'email', value => '' } ); my $formFooter = WebGUI::Form::formFooter( $session ); + my $subscribeButton = + $formHeader + . WebGUI::Form::hidden( $session, { name => 'action', value => 'subscribe' } ) + . WebGUI::Form::submit( $session, { value => $i18n->get('subscribe') } ) + . $formFooter + ; + my $unsubscribeButton = + $formHeader + . WebGUI::Form::hidden( $session, { name => 'action', value => 'unsubscribe' } ) + . WebGUI::Form::submit( $session, { value => $i18n->get('unsubscribe') } ) + . $formFooter + ; + my $emailBox = + $formHeader + . WebGUI::Form::email( $session, { name => 'email', value => '' } ) + . WebGUI::Form::radioList( $session, { + name => 'action', + options => { + subscribe => $i18n->get('subscribe'), + unsubscribe => $i18n->get('unsubscribe'), + } + } ) + . WebGUI::Form::submit( $session ) + . $formFooter + ; # Compose default subscription form for current user my $form = ''; @@ -217,11 +237,11 @@ sub appendSubscriptionFormVars { $form .= $unsubscribeButton if $self->canUnsubscribe; } elsif ( $self->get('allowAnonymousSubscription') ) { - $form = $emailBox . $subscribeButton . $unsubscribeButton; + $form = $emailBox; } # Setup tmpl_vars - $var->{ subscriptionForm_form } = "$formHeader $form $formFooter" if $form; + $var->{ subscriptionForm_form } = $form if $form; $var->{ subscriptionForm_header } = $formHeader; $var->{ subscriptionForm_footer } = $formFooter; $var->{ subscriptionForm_subscribeButton } = $subscribeButton;