- web: include "reason" field in emails for thread moderation

svn path=/trunk/boinc/; revision=15553
This commit is contained in:
David Anderson 2008-07-06 22:30:10 +00:00
parent 520142d475
commit a054467f9b
5 changed files with 96 additions and 54 deletions

View File

@ -5193,7 +5193,7 @@ David 26 June 2008
David 26 June 2008
- back-end code: fix compiler warnings (and maybe bugs);
to some retentive code cleanup
do some retentive code cleanup
sched/
feeder.C
@ -5307,7 +5307,7 @@ David 1 July 2008
handle_request.C
server_types.C
Eric 1 July 2008
Eric 1 July 2008
- client: Fixes ticket Fixes ticket #537. Forces use of small
files in zlib.h and when /proc filesystem is used on solaris.
@ -5488,3 +5488,13 @@ David 4 July 2008
util.inc
user/
create_profile.php
David 6 July 2008
- web: include "reason" field in emails for thread moderation
html/
inc/
forum_email.inc
user/
forum_moderate_thread.php
forum_modearte_thread_action.php

View File

@ -126,8 +126,8 @@ function show_create() {
<br>
And check out:
<ul>
<li> <a href=trac/wiki/BoltIntro>Bolt</a> (software for web-based education and training)</a>
<li> <a href=trac/wiki/BossaIntro>Bossa</a> (software for distributed thinking projects)</a>
<li> <a href=trac/wiki/BoltIntro>Bolt</a>: software for web-based education and training</a>
<li> <a href=trac/wiki/BossaIntro>Bossa</a>: software for distributed thinking projects</a>
</ul>
</td></tr>
";

View File

@ -52,13 +52,13 @@ function send_moderation_email($forum, $post, $thread, $explanation, $action) {
$subject = PROJECT." moderation notice";
$body = "Your post [ID $post->id] in thread \"$thread->title\"
$body = "Your post [ID $post->id] in thread '$thread->title'
".URL_BASE."forum_thread.php?id=$thread->id#$post->id
has been $action by moderator $moderator->name (ID $moderator->id).
$explanation
The content of your post:
".$post->content."
$post->content
For further information and assistance with ".PROJECT." go to ".MASTER_URL;
@ -72,34 +72,31 @@ Subject: $subject
$body
";
$subject = PROJECT.": post $action in \"$thread->title\"";
$subject = PROJECT.": post $action in '$thread->title'";
$success &= mail_report_list($forum, $subject, $body);
return $success;
}
//////////////////// thread hidden/unhidden ///////////
//
function send_thread_moderation_email($forum, $thread, $message, $action) {
$moderator=get_logged_in_user();
function send_thread_moderation_email(
$forum, $thread, $message, $action_name, $explanation
) {
$moderator = get_logged_in_user();
$user = BoincUser::lookup_id($thread->owner);
$body = "";
$subject = PROJECT." forum moderation notice";
$body = PROJECT." notification:
This email is sent to inform you that one of your threads in the forum has been affected by moderation in ".PROJECT.":
Thread: ".$thread->title."
Link: ".MASTER_URL."forum_thread.php?id=".$thread->id."
Moderator: ".$moderator->name." (".$moderator->id.")
Action: ".$action."
The moderator gave this explanation to why your thread was moderated:
".$message;
$body .= "
$body = "Your thread '$thread->title'
".URL_BASE."forum_thread.php?id=$thread->id
has been $action_name
by moderator $moderator->name (ID $moderator->id).
$explanation
For further information and assistance with ".PROJECT." go to ".MASTER_URL;
$success = mail_report_list($forum, "THREAD ".$action." REPORT: ".$thread->title, $body);
$subject = "THREAD $action REPORT: $thread->title";
$success = mail_report_list($forum, $subject, $body);
$success &= send_email($user, $subject, $body);
return $success;
}
@ -128,20 +125,20 @@ function send_report_post_email($user, $forum, $thread, $post, $message) {
$body = "";
$owner = BoincUser::lookup_id($post->user);
$subject = PROJECT." post in '".$thread->title."' reported as offensive";
$subject = PROJECT." post in '$thread->title' reported as offensive";
$body = PROJECT." notification:
This email is sent to inform you that one of the posts in the forum was reported as offensive in ".PROJECT.":
Thread: ".$thread->title."
Post: ".$post->id." by ".$owner->id." (".$owner->name.")
Reporting User: ".$user->id." (".$user->name.")
Link: ".URL_BASE."forum_thread.php?id=".$thread->id."#".$post->id."
A post in the ".PROJECT." forums was reported as offensive.
Thread: $thread->title
Post: $post->id by $owner->id ($owner->name)
Reporting User: $user->id ($user->name)
Link: ".URL_BASE."forum_thread.php?id=$thread->id#$post->id
The reporting user gave this explanation to why the post was reported:
".$message."
Comments from reporting user:
$message
This was the contents of the post:
".$post->content."
Contents of the post:
$post->content
For further information and assistance with ".PROJECT." go to ".MASTER_URL;
@ -209,5 +206,4 @@ able to resume posting at that time.
$success &= mail_report_list($forum, "A banishment vote for ".$user->name." has been started.", $body);
return $success;
}
?>

View File

@ -15,12 +15,11 @@ if (!is_moderator($logged_in_user, $forum)) {
error_page("not authorized");
}
page_head('Moderate');
page_head("Moderate thread '$thread->title'");
echo "<form action=forum_moderate_thread_action.php?thread=$thread->id method=POST>\n";
echo form_tokens($logged_in_user->authenticator);
start_table();
row1("Moderate thread");
$action = get_str('action');
switch ($action) {
@ -46,13 +45,14 @@ case 'move':
$categories = BoincCategory::enum();
foreach ($categories as $category) {
$forums = BoincForum::enum("category=$category->id");
foreach ($forums as $forum) {
$selectbox .= '<option value="'.$forum->id.'">'.$forum->title.'</option>';
foreach ($forums as $f) {
$selectbox .= '<option value="'.$f->id.'">'.$f->title.'</option>';
}
}
$selectbox .= '</option>';
row2("Destination forum:", $selectbox);
row2("Current forum", $forum->title);
row2("Destination forum", $selectbox);
break;
case 'title':
echo "<input type=hidden name=action value=title>";
@ -64,7 +64,7 @@ default:
error_page("Unknown action");
}
row2("Reason<br>Mailed if nonempty",
row2("Reason<br><span class=note>Mailed if nonempty</span>",
"<textarea rows=10 cols=80 name=\"reason\"></textarea>"
);

View File

@ -20,38 +20,74 @@ if (!is_moderator($logged_in_user, $forum)) {
error_page("You are not authorized to moderate this post.");
}
if ($action=="hide") {
$cat = post_int("category"); // TODO - store this somewhere
$explanation = "";
$cat = post_int("category", true);
if ($cat) {
$explanation .= "Reason: ";
switch ($cat) {
case 1: $explanation .= "obscene"; break;
case 2: $explanation .= "flame/hate mail"; break;
case 3: $explanation .= "commercial spam"; break;
case 4: $explanation .= "other"; break;
}
$explanation .= "\n";
}
$comment = post_str('reason', true);
if ($comment) {
$explanation .= "Moderator comment: $comment\n";
}
switch ($action) {
case "hide":
$result = hide_thread($thread, $forum);
} elseif ($action=="unhide"){
$action_name = "hidden";
break;
case "unhide":
$result = unhide_thread($thread, $forum);
} elseif ($action=="sticky"){
$action_name = "unhidden";
break;
case "sticky":
$result = $thread->update("sticky=1");
} elseif ($action=="desticky"){
$action_name = "made sticky";
break;
case "desticky":
$result = $thread->update("sticky=0");
} elseif ($action == "lock") {
$action_name = "made non-sticky";
break;
case "lock":
$result = $thread->update("locked=1");
} elseif ($action == "unlock") {
$action_name = "locked";
break;
case "unlock":
$result = $thread->update("locked=0");
} elseif ($action=="move"){
$action_name = "unlocked";
break;
case "move":
if ($forum->parent_type != 0) error_page("No");
$fid = post_int('forumid');
$new_forum = BoincForum::lookup_id($fid);
$result = move_thread($thread, $forum, $new_forum);
} elseif ($action=="title"){
$action_name = "moved from $forum->title to $new_forum->title";
break;
case "title":
$title = post_str('newtitle');
$result = $thread->update("title='$title'");
} else {
$action_name = "renamed from '$thread->title' to '$title'";
break;
default:
error_page("Unknown action ");
}
if ($result) {
$reason = post_str('reason', true);
if (!$reason) $reason = "None given";
send_thread_moderation_email($forum, $thread, $reason, $action);
header('Location: forum_thread.php?id='.$thread->id);
} else {
if (!$result) {
error_page("Moderation failed");
}
$reason = post_str('reason', true);
if (!$reason) $reason = "None given";
send_thread_moderation_email(
$forum, $thread, $reason, $action_name, $explanation
);
header('Location: forum_thread.php?id='.$thread->id);
?>