Refactored tmpl_var generation for mailing admin a bit so that they are created in sane places.
This commit is contained in:
parent
646112da91
commit
03410dd343
2 changed files with 30 additions and 22 deletions
|
|
@ -165,6 +165,27 @@ sub getStatusLine {
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------------
|
||||||
|
sub getViewVars {
|
||||||
|
my $self = shift;
|
||||||
|
my $url = $self->session->url;
|
||||||
|
|
||||||
|
my $state = $self->get('state');
|
||||||
|
my $baseParams = sprintf 'newsletter=mailing;id=%s', $self->getId;
|
||||||
|
|
||||||
|
return {
|
||||||
|
%{ $self->get },
|
||||||
|
status => $self->getStatusLine,
|
||||||
|
"is$state" => 1,
|
||||||
|
sendTestUrl => $url->page("$baseParams;func=sendTestEmails" ),
|
||||||
|
sendUrl => $url->page("$baseParams;func=sendBatch" ),
|
||||||
|
editUrl => $url->page("$baseParams;func=edit" ),
|
||||||
|
deleteUrl => $url->page("$baseParams;func=delete" ),
|
||||||
|
previewUrl => $url->page("$baseParams;func=previewEmail" ),
|
||||||
|
cancelUrl => $url->page("$baseParams;func=cancel" ),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
#----------------------------------------------------------------------------
|
#----------------------------------------------------------------------------
|
||||||
sub queueTestEmails {
|
sub queueTestEmails {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
|
|
|
||||||
|
|
@ -126,48 +126,35 @@ sub www_view {
|
||||||
|
|
||||||
return $self->www_settings unless $self->configurationComplete;
|
return $self->www_settings unless $self->configurationComplete;
|
||||||
|
|
||||||
my $mailables = $self->getMailables;
|
my $mailableAssets = $self->getMailables;
|
||||||
|
|
||||||
my @newsletterLoop;
|
my @newsletterLoop;
|
||||||
foreach my $mailing ( @{ $mailables } ) {
|
foreach my $asset ( @{ $mailableAssets } ) {
|
||||||
my $mailingId = $mailing->getId;
|
my $assetId = $asset->getId;
|
||||||
|
|
||||||
my @issues;
|
my @issues;
|
||||||
foreach my $issue ( @{ $mailing->getIssues } ) {
|
foreach my $issue ( @{ $asset->getIssues } ) {
|
||||||
my $issueId = $issue->getId;
|
my $issueId = $issue->getId;
|
||||||
|
|
||||||
my @mailings;
|
my @mailings;
|
||||||
my $it = WebGUI::Mailing->getAllIterator( $session, { sequenceKeyValue => $issueId } );
|
my $it = WebGUI::Mailing->getAllIterator( $session, { sequenceKeyValue => $issueId } );
|
||||||
while ( my $mailing = $it->() ) {
|
while ( my $mailing = $it->() ) {
|
||||||
my $state = $mailing->get('state');
|
push @mailings, $mailing->getViewVars;
|
||||||
push @mailings, {
|
|
||||||
%{ $mailing->get },
|
|
||||||
status => $mailing->getStatusLine,
|
|
||||||
"is$state" => 1,
|
|
||||||
sendTestUrl => $url->page('newsletter=mailing;func=sendTestEmails;id='.$mailing->getId ),
|
|
||||||
sendUrl => $url->page('newsletter=mailing;func=sendBatch;id='.$mailing->getId ),
|
|
||||||
editUrl => $url->page('newsletter=mailing;func=edit;id='.$mailing->getId ),
|
|
||||||
deleteUrl => $url->page('newsletter=mailing;func=delete;id='.$mailing->getId ),
|
|
||||||
previewUrl => $url->page('newsletter=mailing;func=previewEmail;id='.$mailing->getId ),
|
|
||||||
cancelUrl => $url->page('newsletter=mailing;func=cancel;id='.$mailing->getId ),
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
push @issues, {
|
push @issues, {
|
||||||
%{ $issue->get },
|
%{ $issue->get },
|
||||||
url => $issue->getUrl,
|
url => $issue->getUrl,
|
||||||
createMailingUrl => $url->page("newsletter=manage;func=createMailing;assetId=$mailingId;issueId=$issueId"),
|
createMailingUrl => $url->page("newsletter=manage;func=createMailing;assetId=$assetId;issueId=$issueId"),
|
||||||
editUrl => $issue->getUrl( 'func=edit' ),
|
editUrl => $issue->getUrl( 'func=edit' ),
|
||||||
sendUrl => '',
|
|
||||||
sendTestUrl => '',
|
|
||||||
mailing_loop => \@mailings,
|
mailing_loop => \@mailings,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
push @newsletterLoop, {
|
push @newsletterLoop, {
|
||||||
%{ $mailing->get },
|
%{ $asset->get },
|
||||||
url => $mailing->getUrl,
|
url => $asset->getUrl,
|
||||||
editUrl => $mailing->getUrl( 'func=edit' ),
|
editUrl => $asset->getUrl( 'func=edit' ),
|
||||||
issue_loop => \@issues,
|
issue_loop => \@issues,
|
||||||
issueCount => scalar( @issues ),
|
issueCount => scalar( @issues ),
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue