elofgren: Make the status message shown after sending a newsletter always include the # of emails sent.

(merged from branches/gsoc)


git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@42003 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2007-09-16 01:04:10 +00:00
parent b784ccc5e7
commit 170c5b1fba
2 changed files with 15 additions and 15 deletions

View File

@ -106,17 +106,17 @@ class NewsletterEmailProcess extends BatchProcess {
} else {
$resent = false;
}
$this->newsletter->SentDate = 'now';
$this->newsletter->Status = 'Send';
$this->newsletter->write();
$message = "statusMessage('Sent " . count( $this->objects ) . " emails successfully','good');";
if( $resent )
return $message."resent_ok( '{$this->nlType->ID}', '{$this->newsletter->ID}' )";
else
return $message."draft_sent_ok( '{$this->nlType->ID}', '{$this->newsletter->ID}' )";
$this->newsletter->SentDate = 'now';
$this->newsletter->Status = 'Send';
$this->newsletter->write();
// Call the success message JS function with the Newsletter information
if( $resent ) {
return "resent_ok( '{$this->nlType->ID}', '{$this->newsletter->ID}', '".count( $this->objects )."' )";
} else {
return "draft_sent_ok( '{$this->nlType->ID}', '{$this->newsletter->ID}', '".count( $this->objects )."' )";
}
}
}
?>

View File

@ -213,7 +213,7 @@ SiteTreeNode.prototype.getPageFromServer = function() {
$('Form_EditForm').getPageFromServer(newPageID, type, otherID, openTabName);
};
function draft_sent_ok( newsletterID, draftID ) {
function draft_sent_ok( newsletterID, draftID, numEmails ) {
var draftsListNode = $('drafts_' + newsletterID);
var sentListNode = $('sent_' + newsletterID);
var draftNode = $('draft_' + newsletterID + '_' + draftID );
@ -221,11 +221,11 @@ function draft_sent_ok( newsletterID, draftID ) {
draftsListNode.removeTreeNode( draftNode );
draftNode.id = 'sent_' + newsletterID + '_' + draftID;
sentListNode.appendTreeNode( draftNode, null );
statusMessage('Sent email to mailing list', 'good');
statusMessage('Sent newsletter to mailing list. Sent ' + numEmails + ' emails successfully.', 'good');
}
function resent_ok( newsletterID, sentID ) {
statusMessage('Resent email to mailing list', 'good');
function resent_ok( newsletterID, sentID, numEmails ) {
statusMessage('Resent newsletter to mailing list. Sent ' + numEmails + ' emails successfully.', 'good');
}
function reloadSiteTree() {