- web: when creating an item in News forum,

show "Export as Notice?" checkbox, and default to off.


svn path=/trunk/boinc/; revision=23721
This commit is contained in:
David Anderson 2011-06-14 05:42:52 +00:00
parent 05ba632e2d
commit 61cbe110ef
4 changed files with 32 additions and 11 deletions

View File

@ -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

View File

@ -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

View File

@ -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);

View File

@ -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."<textarea name=\"content\" rows=\"12\" cols=\"80\" class=\"message_field\">".htmlspecialchars($content)."</textarea>"
);
@ -127,7 +128,10 @@ if (!$logged_in_user->prefs->no_signature_by_default) {
$enable_signature="";
}
row2("", "<input name=\"add_signature\" value=\"add_it\" ".$enable_signature." type=\"checkbox\">".tra("Add my signature to this post"));
if (is_news_forum($forum)) {
row2("", "<input name=export type=checkbox> Show this item as a Notice in the BOINC Manager<br><span class=note>Do so only for items likely to be of interest to all volunteers</span>");
}
row2("", "<input name=\"add_signature\" value=\"add_it\" ".$enable_signature." type=\"checkbox\"> ".tra("Add my signature to this post"));
row2("", "<input type=\"submit\" name=\"preview\" value=\"".tra("Preview")."\"> <input type=\"submit\" value=\"OK\">");