Display only last Y posts if thread has more than X posts in total.

svn path=/trunk/boinc/; revision=8925
This commit is contained in:
Janus B. Kristensen 2005-11-24 16:36:12 +00:00
parent bfbd0d6bd1
commit 96f82f3a4f
3 changed files with 23 additions and 2 deletions

View File

@ -293,6 +293,12 @@ function update_8_26_2005() {
function update_9_22_2005() {
do_query("update user set country='Macedonia' where country='Macedonia, The Former Yugoslav Republic of'");
}
//update_10_25_2004();
function update_11_24_2005(){
do_query("ALTER TABLE `forum_preferences` ADD `minimum_wrap_postcount` INT DEFAULT '100' NOT NULL AFTER `high_rating_threshold` ,
ADD `display_wrap_postcount` INT DEFAULT '75' NOT NULL AFTER `minimum_wrap_postcount`");
}
//update_11_24_2005();
?>

View File

@ -56,6 +56,8 @@ $ignore_sticky_posts = ($HTTP_POST_VARS["forum_ignore_sticky_posts"]!="");
$low_rating_threshold = intval($HTTP_POST_VARS["forum_low_rating_threshold"]);
$high_rating_threshold = intval($HTTP_POST_VARS["forum_high_rating_threshold"]);
$add_user_to_filter = ($HTTP_POST_VARS["add_user_to_filter"]!="");
$minimum_wrap_postcount = intval($HTTP_POST_VARS["forum_minimum_wrap_postcount"]);
$display_wrap_postcount = intval($HTTP_POST_VARS["forum_display_wrap_postcount"]);
$no_signature_by_default=($HTTP_POST_VARS["signature_enable"]=="");
$signature = sanitize_html(stripslashes($HTTP_POST_VARS["signature"]));
@ -94,6 +96,10 @@ for ($i=1;$i<sizeof($ignored_users);$i++){
}
}
if ($minimum_wrap_postcount<0) $minimum_wrap_postcount=0;
if ($display_wrap_postcount>$minimum_wrap_postcount) $display_wrap_postcount=round($minimum_wrap_postcount/2);
if ($display_wrap_postcount<5) $display_wrap_postcount=5;
$result = mysql_query(
"update forum_preferences set
avatar_type='".$avatar_type."',
@ -109,7 +115,9 @@ $result = mysql_query(
hide_signatures='".$hide_signatures."',
low_rating_threshold='".$low_rating_threshold."',
ignorelist='".$real_ignorelist."',
high_rating_threshold='".$high_rating_threshold."'
high_rating_threshold='".$high_rating_threshold."',
minimum_wrap_postcount='".$minimum_wrap_postcount."',
display_wrap_postcount='".$display_wrap_postcount."'
where userid=$user->id"
);
if ($result) {

View File

@ -66,6 +66,9 @@ if ($user->images_as_links==1){$forum_image_as_link="checked=\"checked\"";} else
if ($user->jump_to_unread==1){$forum_jump_to_unread="checked=\"checked\"";} else {$forum_jump_to_unread="";}
if ($user->ignore_sticky_posts==1){$forum_ignore_sticky_posts="checked=\"checked\"";} else {$forum_ignore_sticky_posts="";}
$forum_minimum_wrap_postcount = intval($user->minimum_wrap_postcount);
$forum_display_wrap_postcount = intval($user->display_wrap_postcount);
row2("Display and Behavior".
"<br><font size=-2>How to treat links and images in the forum<br>and how to act on unread posts</font>",
"<table><tr><td>
@ -73,6 +76,10 @@ row2("Display and Behavior".
<input type=\"checkbox\" name=\"forum_link_externally\" ".$forum_link_externally."> Open links in new window/tab<br>
<input type=\"checkbox\" name=\"forum_jump_to_unread\" ".$forum_jump_to_unread."> Jump to first new post in thread automatically<br>
<input type=\"checkbox\" name=\"forum_ignore_sticky_posts\" ".$forum_ignore_sticky_posts.">Do not reorder sticky posts<br>
<br />
<input type=\"text\" name=\"forum_minimum_wrap_postcount\" style=\"width: 30px;\" value=\"".$forum_minimum_wrap_postcount."\"> If a thread contains more than this number of posts<br />
<input type=\"text\" name=\"forum_display_wrap_postcount\" style=\"width: 30px;\" value=\"".$forum_display_wrap_postcount."\"> only display the first one and this many of the last ones<br />
</td></tr></table>"
);