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;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
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 {
|
||||
my $self = shift;
|
||||
|
|
|
|||
|
|
@ -126,48 +126,35 @@ sub www_view {
|
|||
|
||||
return $self->www_settings unless $self->configurationComplete;
|
||||
|
||||
my $mailables = $self->getMailables;
|
||||
my $mailableAssets = $self->getMailables;
|
||||
|
||||
my @newsletterLoop;
|
||||
foreach my $mailing ( @{ $mailables } ) {
|
||||
my $mailingId = $mailing->getId;
|
||||
foreach my $asset ( @{ $mailableAssets } ) {
|
||||
my $assetId = $asset->getId;
|
||||
|
||||
my @issues;
|
||||
foreach my $issue ( @{ $mailing->getIssues } ) {
|
||||
foreach my $issue ( @{ $asset->getIssues } ) {
|
||||
my $issueId = $issue->getId;
|
||||
|
||||
my @mailings;
|
||||
my $it = WebGUI::Mailing->getAllIterator( $session, { sequenceKeyValue => $issueId } );
|
||||
while ( my $mailing = $it->() ) {
|
||||
my $state = $mailing->get('state');
|
||||
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 @mailings, $mailing->getViewVars;
|
||||
};
|
||||
|
||||
push @issues, {
|
||||
%{ $issue->get },
|
||||
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' ),
|
||||
sendUrl => '',
|
||||
sendTestUrl => '',
|
||||
mailing_loop => \@mailings,
|
||||
};
|
||||
}
|
||||
|
||||
push @newsletterLoop, {
|
||||
%{ $mailing->get },
|
||||
url => $mailing->getUrl,
|
||||
editUrl => $mailing->getUrl( 'func=edit' ),
|
||||
%{ $asset->get },
|
||||
url => $asset->getUrl,
|
||||
editUrl => $asset->getUrl( 'func=edit' ),
|
||||
issue_loop => \@issues,
|
||||
issueCount => scalar( @issues ),
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue