瀏覽代碼

Add a confirmation message when someone adds/deletes a mod note

Signed-off-by: Suki <[email protected]>
Suki 11 年之前
父節點
當前提交
8496c2e67e
共有 2 個文件被更改,包括 20 次插入2 次删除
  1. 9 0
      Sources/ModerationCenter.php
  2. 11 2
      Themes/default/ModerationCenter.template.php

+ 9 - 0
Sources/ModerationCenter.php

@@ -312,6 +312,9 @@ function ModBlockNotes()
 {
 	global $context, $smcFunc, $scripturl, $txt, $user_info;
 
+	$context['report_post_action'] = !empty($_SESSION['rc_confirmation']) ? $_SESSION['rc_confirmation'] : array();
+	unset($_SESSION['rc_confirmation']);
+
 	// Are we saving a note?
 	if (isset($_GET['modnote']) && isset($_POST['makenote']) && isset($_POST['new_note']))
 	{
@@ -339,6 +342,9 @@ function ModBlockNotes()
 			cache_put_data('moderator_notes_total', null, 240);
 		}
 
+		// Everything went better than expected!
+		$_SESSION['rc_confirmation'] = 'message_saved';
+
 		// Redirect otherwise people can resubmit.
 		redirectexit('action=moderate');
 	}
@@ -362,6 +368,9 @@ function ModBlockNotes()
 		cache_put_data('moderator_notes', null, 240);
 		cache_put_data('moderator_notes_total', null, 240);
 
+		// Tell them the message was deleted.
+		$_SESSION['rc_confirmation'] = 'message_deleted';
+
 		redirectexit('action=moderate');
 	}
 

+ 11 - 2
Themes/default/ModerationCenter.template.php

@@ -75,7 +75,7 @@ function template_group_requests_block()
 				</ul>
 			</div>
 		</div>
-		
+
 	<script><!-- // --><![CDATA[
 		var oGroupRequestsPanelToggle = new smc_Toggle({
 			bToggleEnabled: true,
@@ -141,7 +141,7 @@ function template_watched_users()
 				</ul>
 			</div>
 		</div>
-		
+
 	<script><!-- // --><![CDATA[
 		var oWatchedUsersToggle = new smc_Toggle({
 			bToggleEnabled: true,
@@ -180,6 +180,15 @@ function template_notes()
 {
 	global $context, $txt, $scripturl;
 
+	// Let them know the action was a success.
+	if (!empty($context['report_post_action']))
+	{
+		echo '
+			<div class="infobox">
+				', $txt['report_action_'. $context['report_post_action']], '
+			</div>';
+	}
+
 	echo '
 		<div class="modnotes">
 			<form action="', $scripturl, '?action=moderate;area=index;modnote" method="post">