Browse Source

Move another confirm dialog to jquery.on() handler

Signed-off-by: Suki <[email protected]>
Suki 11 years ago
parent
commit
a02dfef0d3
2 changed files with 6 additions and 2 deletions
  1. 5 1
      Sources/ReportedPosts.php
  2. 1 1
      Themes/default/ReportedPosts.template.php

+ 5 - 1
Sources/ReportedPosts.php

@@ -138,6 +138,9 @@ function ShowReports()
 	// Show a confirmation if the user wants to disregard a report.
 	if (!$context['view_closed'])
 		addInlineJavascript('
+	$(\'.delete_message\').on(\'click\', function(){
+			return confirm('. JavaScriptEscape($txt['mc_reportedp_delete_confirm']) .');
+	});
 	$(\'.report_ignore\').on(\'click\', function(){
 		// Need to make sure to only show this when ignoring.
 		if ($(this).data(\'ignore\') == \'1\'){
@@ -408,6 +411,8 @@ function EditComment()
 
 	$comment = array();
 
+	checkSession();
+
 	// The report ID is a must.
 	if (empty($_REQUEST['rid']))
 		fatal_lang_error('mc_reportedp_none_found');
@@ -430,7 +435,6 @@ function EditComment()
 
 	if (isset($_REQUEST['save']) && isset($_POST['edit_comment']) && !empty($_POST['mod_comment']))
 	{
-		checkSession();
 		validateToken('mod-reportC-edit');
 
 		$edited_comment = trim($smcFunc['htmlspecialchars']($_POST['mod_comment']));

+ 1 - 1
Themes/default/ReportedPosts.template.php

@@ -69,7 +69,7 @@ function template_reported_posts()
 		// Delete message button.
 		if (!$report['closed'] && (is_array($context['report_remove_any_boards']) && in_array($report['topic']['id_board'], $context['report_remove_any_boards'])))
 			echo '
-					<li><a href="', $scripturl, '?action=deletemsg;topic=', $report['topic']['id'] ,'.0;msg=', $report['topic']['id_msg'] ,';modcenter;', $context['session_var'], '=', $context['session_id'], '" onclick="return confirm(\'' , $txt['mc_reportedp_delete_confirm'] , '\');">', $delete_button, '</a></li>';
+					<li><a href="', $scripturl, '?action=deletemsg;topic=', $report['topic']['id'] ,'.0;msg=', $report['topic']['id_msg'] ,';modcenter;', $context['session_var'], '=', $context['session_id'], '" class="delete_message">', $delete_button, '</a></li>';
 
 		// Ban this user button.
 		if (!$report['closed'] && !empty($context['report_manage_bans']))