- user web: add a feature allowing project admins to control

whether news items are exported as notices.
    The creator of a news item is shown a "Don't export" or "Export"
    button on the thread page.
    By default, news items are exported.


svn path=/trunk/boinc/; revision=23119
This commit is contained in:
David Anderson 2011-02-28 19:02:59 +00:00
parent 732866b8aa
commit 0bc1a36451
6 changed files with 64 additions and 15 deletions

View File

@ -1201,3 +1201,20 @@ David 26 Feb 2011
trickle_echo.cpp
validator.cpp
Makefile.am
David 26 Feb 2011
- user web: add a feature allowing project admins to control
whether news items are exported as notices.
The creator of a news item is shown a "Don't export" or "Export"
button on the thread page.
By default, news items are exported.
db/
schema.sql
html/
inc/
news.inc
user/
forum_thread.php
notices.php
forum_thread_status.php

View File

@ -407,6 +407,8 @@ create table thread (
owner integer not null,
-- user ID of creator
status integer not null,
-- whether a question has been answered
-- News forum: it set, don't export as notice
title varchar(254) not null,
timestamp integer not null,
-- time of last new or modified post

View File

@ -55,6 +55,15 @@ function news_forum() {
return BoincForum::lookup("parent_type=0 and title = '$forum_name'");
}
function is_news_forum($forum) {
if (defined("NEWS_FORUM_NAME")) {
$forum_name = NEWS_FORUM_NAME;
} else {
$forum_name = "News";
}
return $forum->parent_type == 0 && ($forum->title === $forum_name);
}
function show_news($start, $count) {
$forum = news_forum();
if (!$forum) {

View File

@ -21,6 +21,7 @@
require_once('../inc/util.inc');
require_once('../inc/forum.inc');
require_once('../inc/news.inc');
check_get_args(array("id", "sort", "nowrap", "filter"));
@ -122,21 +123,21 @@ if ($forum->parent_type == 0) {
if ($thread->owner == $logged_in_user->id){
if ($thread->replies !=0) {
// Show a "this question has been answered" to the author
echo "<div class=\"helpdesk_note\">
<form action=\"forum_thread_status.php\"><input type=\"hidden\" name=\"id\" value=\"".$thread->id."\">
<input type=\"submit\" value=\"".tra("My question was answered")."\">
</form>
" . tra("If your question has been adequately answered please click here to close it!") . "
</div>"
;
echo "<p>";
show_button(
"forum_thread_status.php?id=$thread->id&action=set",
tra("My question was answered"),
tra("Click here if your question has been adequately answered")
);
}
} else {
// and a "I also got this question" to everyone else if they havent already told so
echo "<div class=\"helpdesk_note\">
<form action=\"forum_thread_vote.php\"><input type=\"hidden\" name=\"id\" value=\"".$thread->id."\">
<input type=\"submit\" value=\"".tra("I've also got this question")."\">
</form>
</div>";
// and a "I also got this question" to everyone else
echo "<p>";
show_button(
"forum_thread_vote.php?id=$thread->id",
tra("I've also got this question"),
tra("I've also got this question")
);
}
}
}
@ -236,6 +237,24 @@ if (is_moderator($logged_in_user, $forum)) {
);
}
// let admins decide whether a news item should be exported as notice
//
if (is_news_forum($forum) && ($logged_in_user->id == $thread->owner)) {
if ($thread->status) {
show_button(
"forum_thread_status.php?action=clear&id=$thread->id",
"Export",
"Export this news item as a Notice"
);
} else {
show_button(
"forum_thread_status.php?action=set&id=$thread->id",
"Don't export",
"Don't export this news item as a Notice"
);
}
}
// Display a box that allows the user to select sorting of the posts
echo "</td><td align=\"right\">
<input type=\"hidden\" name=\"id\" value=\"", $thread->id, "\">" .

View File

@ -23,10 +23,12 @@
require_once('../inc/forum.inc');
check_get_args(array("id"));
check_get_args(array("id", "action"));
$threadid = get_int('id');
$thread = BoincThread::lookup_id($threadid);
if (!$thread) error_page("no such thread");
$logged_in_user = get_logged_in_user();
$owner = BoincUser::lookup_id($thread->owner);

View File

@ -72,7 +72,7 @@ $notifies = BoincNotify::enum("userid = $userid $since_clause");
$forum = news_forum();
if ($forum) {
$threads = BoincThread::enum(
"forum = $forum->id and hidden=0 $since_clause"
"forum = $forum->id and hidden=0 and status=0 $since_clause"
);
}