diff --git a/checkin_notes b/checkin_notes index ef2eab40d0..fdc50c91ed 100644 --- a/checkin_notes +++ b/checkin_notes @@ -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 diff --git a/db/schema.sql b/db/schema.sql index 00eb09ae91..9ff310a51a 100644 --- a/db/schema.sql +++ b/db/schema.sql @@ -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 diff --git a/html/inc/news.inc b/html/inc/news.inc index 112b141651..881d256385 100644 --- a/html/inc/news.inc +++ b/html/inc/news.inc @@ -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) { diff --git a/html/user/forum_thread.php b/html/user/forum_thread.php index 7fb74d19e6..030185cd2e 100644 --- a/html/user/forum_thread.php +++ b/html/user/forum_thread.php @@ -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 "
"; + 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 "
"; + 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 "