diff --git a/checkin_notes b/checkin_notes index 83c9dde302..55af0a7b5a 100644 --- a/checkin_notes +++ b/checkin_notes @@ -3496,3 +3496,15 @@ David 12 Jun 2011 client/ cs_cmdline.cpp + +David 13 Jun 2011 + - web: when creating an item in News forum, + show "Export as Notice?" checkbox, and default to off. + + db/ + schema.sql + html/ + inc/ + forum.inc + user/ + forum_post.php diff --git a/db/schema.sql b/db/schema.sql index ae86b0c681..3a2cabb7af 100644 --- a/db/schema.sql +++ b/db/schema.sql @@ -410,7 +410,7 @@ create table thread ( -- user ID of creator status integer not null, -- whether a question has been answered - -- News forum: it set, don't export as notice + -- News forum: if 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/forum.inc b/html/inc/forum.inc index 35aaa2a1a1..5c2975f60d 100644 --- a/html/inc/forum.inc +++ b/html/inc/forum.inc @@ -19,6 +19,7 @@ require_once("../inc/forum_db.inc"); require_once("../inc/pm.inc"); require_once("../inc/team.inc"); +require_once("../inc/news.inc"); require_once("../inc/text_transform.inc"); define('THREADS_PER_PAGE', 50); @@ -791,12 +792,16 @@ function update_forum_timestamp($forum) { } } -function create_thread($title, $content, $user, $forum, $signature) { +function create_thread($title, $content, $user, $forum, $signature, $export) { $title = trim($title); $title = strip_tags($title); $title = mysql_real_escape_string($title); $now = time(); - $id = BoincThread::insert("(forum, owner, title, create_time, timestamp, replies) values ($forum->id, $user->id, '$title', $now, $now, -1)"); + $status = 0; + if (is_news_forum($forum) && !$export) { + $status = 1; + } + $id = BoincThread::insert("(forum, owner, title, create_time, timestamp, replies, status) values ($forum->id, $user->id, '$title', $now, $now, -1, $status)"); if (!$id) return null; $thread = BoincThread::lookup_id($id); create_post($content, 0, $user, $forum, $thread, $signature); diff --git a/html/user/forum_post.php b/html/user/forum_post.php index 0bed52c388..d9a1989cea 100644 --- a/html/user/forum_post.php +++ b/html/user/forum_post.php @@ -24,8 +24,9 @@ require_once('../inc/forum_email.inc'); require_once('../inc/forum.inc'); require_once('../inc/bbcode_html.inc'); require_once('../inc/akismet.inc'); +require_once('../inc/news.inc'); -check_get_args(array("id", "title", "force_title", "tnow", "ttok")); +check_get_args(array("id", "title", "force_title", "tnow", "ttok", "export")); $logged_in_user = get_logged_in_user(); BoincForumPrefs::lookup($logged_in_user); @@ -46,15 +47,16 @@ check_post_access($logged_in_user, $forum); $title = post_str("title", true); if (!$title) $title = get_str("title", true); $force_title = get_str("force_title", true); +$export = post_str("export", true); $content = post_str("content", true); $preview = post_str("preview", true); $warning = null; if ($content && $title && (!$preview)){ - if (post_str('add_signature',true)=="add_it"){ - $add_signature=true; // set a flag and concatenate later + if (post_str('add_signature', true) == "add_it"){ + $add_signature = true; // set a flag and concatenate later } else { - $add_signature=false; + $add_signature = false; } check_tokens($logged_in_user->authenticator); if (!akismet_check($logged_in_user, $content)) { @@ -64,7 +66,7 @@ if ($content && $title && (!$preview)){ $preview = tra("Preview"); } else { $thread = create_thread( - $title, $content, $logged_in_user, $forum, $add_signature + $title, $content, $logged_in_user, $forum, $add_signature, $export ); header('Location: forum_thread.php?id=' . $thread->id); } @@ -100,7 +102,7 @@ echo form_tokens($logged_in_user->authenticator); start_table(); -row1(tra("Create a new thread")); //New thread +row1(tra("Create a new thread")); $submit_help = ""; $body_help = ""; @@ -116,7 +118,6 @@ if ($force_title && $title){ ); } -//Message row2(tra("Message").html_info().post_warning().$body_help, $bbcode_html."" ); @@ -127,7 +128,10 @@ if (!$logged_in_user->prefs->no_signature_by_default) { $enable_signature=""; } -row2("", "".tra("Add my signature to this post")); +if (is_news_forum($forum)) { + row2("", " Show this item as a Notice in the BOINC Manager
Do so only for items likely to be of interest to all volunteers"); +} +row2("", " ".tra("Add my signature to this post")); row2("", " ");