ソースを参照

Add a nice edit and delete link for each comment
#1248

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

Suki 10 年 前
コミット
fe228e589e

+ 2 - 1
Sources/ModerationCenter.php

@@ -948,7 +948,7 @@ function ModReport()
 				array('id_task')
 			);
 
-			// Redirect to prevent double submittion.
+			// Redirect to prevent double submission.
 			redirectexit($scripturl . '?action=moderate;area=reports;report=' . $_REQUEST['report']);
 		}
 	}
@@ -1024,6 +1024,7 @@ function ModReport()
 			'id' => $row['id_comment'],
 			'message' => parse_bbc($row['body']),
 			'time' => timeformat($row['log_time']),
+			'can_edit' => allowedTo('admin_forum') || (($user_info['id'] == $row['id_member']) && allowedTo('moderate_forum')),
 			'member' => array(
 				'id' => $row['id_member'],
 				'name' => $row['moderator'],

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

@@ -538,7 +538,7 @@ function template_viewmodreport()
 
 	foreach ($context['report']['mod_comments'] as $comment)
 		echo
-					'<p>', $comment['member']['link'], ': ', $comment['message'], ' <em class="smalltext">(', $comment['time'], ')</em></p>';
+					'<p>', $comment['member']['link'], ': ', $comment['message'], ' <em class="smalltext">(', $comment['time'], ')</em>', ($comment['can_edit'] ? '><span class="floatright"><a href="' . $scripturl . '?moderate;area=reports;report='. $context['report']['id'] .';mid='. $comment['id'] .';edit">'. $txt['mc_reportedp_comment_edit'] .'</a> | <a href="' . $scripturl . '?moderate;area=reports;report='. $context['report']['id'] .';mid='. $comment['id'] .';delete">'. $txt['mc_reportedp_comment_delete'] .'</a></span>' : '') ,'</p>';
 
 	echo '
 					<textarea rows="2" cols="60" style="' . (isBrowser('is_ie8') ? 'width: 635px; max-width: 60%; min-width: 60%' : 'width: 60%') . ';" name="mod_comment"></textarea>

+ 2 - 1
Themes/default/languages/ModerationCenter.english.php

@@ -37,7 +37,8 @@ $txt['mc_reportedp_by'] = 'by';
 $txt['mc_reportedp_reported_by'] = 'Reported By';
 $txt['mc_reportedp_last_reported'] = 'Last Reported';
 $txt['mc_reportedp_none_found'] = 'No Reports Found';
-
+$txt['mc_reportedp_comment_edit'] = 'Edit';
+$txt['mc_reportedp_comment_delete'] = 'Delete';
 $txt['mc_reportedp_details'] = 'Details';
 $txt['mc_reportedp_close'] = 'Close';
 $txt['mc_reportedp_open'] = 'Open';