Make NewslettCollaboration templatable, and add concept of recent issues.
This commit is contained in:
parent
e82b8fe088
commit
218ebbbad6
4 changed files with 147 additions and 48 deletions
|
|
@ -151,11 +151,13 @@ sub isSubscribed {
|
|||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
sub getSubscriptionForm {
|
||||
sub appendSubscriptionFormVars {
|
||||
my $self = shift;
|
||||
my $var = shift || {};
|
||||
my $session = $self->session;
|
||||
my $i18n = WebGUI::International->new( $session, 'Asset_NewsletterCollection' );
|
||||
|
||||
# Setup form controls
|
||||
my $formHeader =
|
||||
WebGUI::Form::formHeader( $session, { action => $self->getUrl } )
|
||||
. WebGUI::Form::hidden( $session, { name => 'func', value => 'processSubscription' } )
|
||||
|
|
@ -167,20 +169,28 @@ sub getSubscriptionForm {
|
|||
my $emailBox = WebGUI::Form::email( $session, { name => 'email', value => '' } );
|
||||
my $formFooter = WebGUI::Form::formFooter( $session );
|
||||
|
||||
my $output = '';
|
||||
# Compose default subscription form for current user
|
||||
my $form = '';
|
||||
if ( $session->user->isRegistered ) {
|
||||
$output .= $subscribeButton if $self->canSubscribe;
|
||||
$output .= $unsubscribeButton if $self->canUnsubscribe;
|
||||
|
||||
return unless $output;
|
||||
return $formHeader . $output . $formFooter;
|
||||
$form .= $subscribeButton if $self->canSubscribe;
|
||||
$form .= $unsubscribeButton if $self->canUnsubscribe;
|
||||
}
|
||||
#### TODO: anonymousAllowed
|
||||
else {
|
||||
return $formHeader . $emailBox . $subscribeButton . $unsubscribeButton . $formFooter;
|
||||
elsif ( $self->get('allowAnonymousSubscription') ) {
|
||||
$form = $emailBox . $subscribeButton . $unsubscribeButton;
|
||||
}
|
||||
|
||||
return;
|
||||
# Setup tmpl_vars
|
||||
$var->{ subscriptionForm_form } = "$formHeader $form $formFooter" if $form;
|
||||
$var->{ subscriptionForm_header } = $formHeader;
|
||||
$var->{ subscriptionForm_footer } = $formFooter;
|
||||
$var->{ subscriptionForm_subscribeButton } = $subscribeButton;
|
||||
$var->{ subscriptionForm_unsubscribeButton } = $unsubscribeButton;
|
||||
$var->{ subscrittionForm_emailBox } = $emailBox;
|
||||
$var->{ user_canSubscribe } = $self->canSubscribe;
|
||||
$var->{ user_canUnsubscribe } = $self->canUnsubscribe;
|
||||
$var->{ user_isRegistered } = $session->user->isRegistered;
|
||||
|
||||
return $var;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue