Browse Source

Show a confirmation message when finished the newsletter process
fix #1410

Signed-off-by: Suki <[email protected]>

Suki 11 years ago
parent
commit
f5c10d405f

+ 11 - 3
Sources/ManageNews.php

@@ -311,6 +311,9 @@ function SelectMailingMembers()
 {
 	global $txt, $context, $modSettings, $smcFunc;
 
+	// Is there any confirm message?
+	$context['newsletter_sent'] = isset($_SESSION['newsletter_sent']) ? $_SESSION['newsletter_sent'] : '';
+
 	$context['page_title'] = $txt['admin_newsletters'];
 
 	$context['sub_template'] = 'email_members';
@@ -682,7 +685,7 @@ function ComposeMailing()
  * Called by ?action=admin;area=news;sa=mailingsend
  * Requires the send_mail permission.
  * Redirects to itself when more batches need to be sent.
- * Redirects to ?action=admin after everything has been sent.
+ * Redirects to ?action=admin;area=news;sa=mailingmembers after everything has been sent.
  *
  * @param bool $clean_only = false; if set, it will only clean the variables, put them in context, then return.
  * @uses the ManageNews template and email_members_send sub template.
@@ -937,7 +940,11 @@ function SendMailing($clean_only = false)
 
 		// If we've not got a query then we must be done!
 		if ($sendQuery == '()')
-			redirectexit('action=admin');
+		{
+			// Set a confirmation message.
+			$_SESSION['newsletter_sent'] = 'queue_done';
+			redirectexit('action=admin;area=news;sa=mailingmembers');
+		}
 
 		// Anything to exclude?
 		if (!empty($context['recipients']['exclude_groups']) && in_array(0, $context['recipients']['exclude_groups']))
@@ -1019,7 +1026,8 @@ function SendMailing($clean_only = false)
 	{
 		// Log this into the admin log.
 		logAction('newsletter', array(), 'admin');
-		redirectexit('action=admin');
+		$_SESSION['newsletter_sent'] = 'queue_done';
+		redirectexit('action=admin;area=news;sa=mailingmembers');
 	}
 
 	// Working out progress is a black art of sorts.

+ 5 - 0
Themes/default/ManageNews.template.php

@@ -14,6 +14,11 @@ function template_email_members()
 {
 	global $context, $settings, $txt, $scripturl;
 
+	// Are we done sending the newsletter?
+	if (!empty($context['newsletter_sent']))
+		echo '
+	<div class="infobox">', $txt['admin_news_newsletter_'. $context['newsletter_sent']] ,'</div>';
+
 	echo '
 	<div id="admincenter">
 		<form action="', $scripturl, '?action=admin;area=news;sa=mailingcompose" method="post" id="admin_newsletters" class="flow_hidden" accept-charset="', $context['character_set'], '">

+ 1 - 0
Themes/default/languages/Admin.english.php

@@ -607,6 +607,7 @@ $txt['could_not_language_backup'] = 'A backup could not be made before removing
 $txt['advanced'] = 'Advanced';
 $txt['simple'] = 'Simple';
 
+$txt['admin_news_newsletter_queue_done'] = 'The newsletter has been added to the main queue successfully.';
 $txt['admin_news_select_recipients'] = 'Please select who should receive a copy of the newsletter';
 $txt['admin_news_select_group'] = 'Membergroups';
 $txt['admin_news_select_group_desc'] = 'Select the groups to receive this newsletter.';