mirror of https://github.com/BOINC/boinc.git
Forum thread locking
svn path=/trunk/boinc/; revision=11514
This commit is contained in:
parent
ee86f31a9d
commit
67b3f9a911
|
@ -12506,3 +12506,20 @@ David 9 Nov 2006
|
|||
cpu_sched.C
|
||||
cs_prefs.C
|
||||
cs_scheduler.C
|
||||
|
||||
Rytis 10 Nov 2006
|
||||
- User web: forum thread locking.
|
||||
|
||||
NOTE: requires DB update.
|
||||
|
||||
html/
|
||||
inc/
|
||||
forum.inc
|
||||
forum_thread.inc
|
||||
user/
|
||||
forum_forum.php
|
||||
forum_reply.php
|
||||
forum_moderate_thread_action.php
|
||||
forum_thread.php
|
||||
ops/
|
||||
db_update.php
|
|
@ -33,7 +33,11 @@ define("EXCERPT_LENGTH", "120");
|
|||
|
||||
define('NEW_IMAGE', 'img/unread_post.png');
|
||||
define('NEW_IMAGE_STICKY', 'img/unread_sticky.png');
|
||||
define('STICKY_IMAGE', 'img/sticky_post.png');
|
||||
define('NEW_IMAGE_LOCKED', 'img/unread_locked.png');
|
||||
define('NEW_IMAGE_STICKY_LOCKED', 'img/unread_sticky_locked.png');
|
||||
define('IMAGE_STICKY', 'img/sticky_post.png');
|
||||
define('IMAGE_LOCKED', 'img/locked_post.png');
|
||||
define('IMAGE_STICKY_LOCKED', 'img/sticky_locked_post.png');
|
||||
define('NEW_IMAGE_HEIGHT','15');
|
||||
define('EMPHASIZE_IMAGE', 'img/emphasized_post.png');
|
||||
define('EMPHASIZE_IMAGE_HEIGHT','15');
|
||||
|
|
|
@ -124,6 +124,21 @@ class Thread {
|
|||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return thread lock state.
|
||||
**/
|
||||
function isLocked(){
|
||||
return $this->dbObj->locked;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update thread lock state.
|
||||
**/
|
||||
function setLocked($bool){
|
||||
$result = $this->dbhandler->updateThread($this, "locked", $bool?1:0);
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return even more fields from the thread
|
||||
**/
|
||||
|
|
|
@ -342,6 +342,10 @@ function update_10_26_2006() {
|
|||
do_query("ALTER TABLE team ADD INDEX team_userid (userid)");
|
||||
}
|
||||
|
||||
//update_10_26_2006();
|
||||
function update_11_10_2006() {
|
||||
do_query("ALTER TABLE `thread` ADD `locked` SMALLINT NOT NULL DEFAULT '0'");
|
||||
}
|
||||
|
||||
//update_11_10_2006();
|
||||
|
||||
?>
|
||||
|
|
|
@ -26,7 +26,7 @@ if (!$sort_style) {
|
|||
} else {
|
||||
// set the sort style
|
||||
if ($user){
|
||||
$user->setForumSortStyle($sort_style);
|
||||
$user->setForumSortStyle($sort_style);
|
||||
} else {
|
||||
list($old_style,$thread_style)=explode("|",$_COOKIE['sorting']);
|
||||
setcookie('sorting', implode("|",array($sort_style,$thread_style)), time()+3600*24*365);
|
||||
|
@ -115,15 +115,33 @@ function show_forum($forum, $start, $sort_style, $user) {
|
|||
if ($thread->isHidden()) {
|
||||
echo "X";
|
||||
}
|
||||
if ($unread && !$thread->isSticky()) {
|
||||
echo "<img src=\"".NEW_IMAGE."\" alt=\"Unread post(s)\">";
|
||||
}
|
||||
elseif($unread) {
|
||||
echo "<img src=\"".NEW_IMAGE_STICKY."\" alt=\"Unread post(s)\">";
|
||||
}
|
||||
elseif($thread->isSticky()) {
|
||||
echo "<img src=\"".STICKY_IMAGE."\" alt=\"Sticky\">";
|
||||
}
|
||||
if ($unread) {
|
||||
if ($thread->isSticky()) {
|
||||
if ($thread->isLocked()) {
|
||||
echo "<img src=\"".NEW_IMAGE_STICKY_LOCKED."\" alt=\"Unread post(s), sticky, thread locked\">";
|
||||
} else {
|
||||
echo "<img src=\"".NEW_IMAGE_STICKY."\" alt=\"Unread post(s), sticky\">";
|
||||
}
|
||||
} else {
|
||||
if ($thread->isLocked()) {
|
||||
echo "<img src=\"".NEW_IMAGE_LOCKED."\" alt=\"Unread post(s), thread locked\">";
|
||||
} else {
|
||||
echo "<img src=\"".NEW_IMAGE."\" alt=\"Unread post(s)\">";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($thread->isSticky()) {
|
||||
if ($thread->isLocked()) {
|
||||
echo "<img src=\"".IMAGE_STICKY_LOCKED."\" alt=\"Sticky, thread locked\">";
|
||||
} else {
|
||||
echo "<img src=\"".IMAGE_STICKY."\" alt=\"Sticky\">";
|
||||
}
|
||||
} else {
|
||||
if ($thread->isLocked()) {
|
||||
echo "<img src=\"".IMAGE_LOCKED."\" alt=\"Thread locked\">";
|
||||
}
|
||||
}
|
||||
}
|
||||
echo "</nobr></td>";
|
||||
|
||||
$titlelength = 48;
|
||||
|
|
|
@ -38,6 +38,10 @@ if ($action=="hide"){
|
|||
$result = $thread->setSticky(true);
|
||||
} elseif ($action=="desticky"){
|
||||
$result = $thread->setSticky(false);
|
||||
} elseif ($action == "lock") {
|
||||
$result = $thread->setLocked(true);
|
||||
} elseif ($action == "unlock") {
|
||||
$result = $thread->setLocked(false);
|
||||
} elseif ($action=="move"){
|
||||
$forum = new Forum(post_int('forumid'));
|
||||
$result = $thread->moveTo($forum);
|
||||
|
|
|
@ -14,6 +14,12 @@ $logged_in_user = re_get_logged_in_user(true);
|
|||
check_banished($logged_in_user);
|
||||
|
||||
$thread = new Thread (get_int('thread'));
|
||||
|
||||
if ($thread->isLocked() && !$logged_in_user->isSpecialUser(S_MODERATOR)
|
||||
&& !$logged_in_user->isSpecialUser(S_ADMIN)) {
|
||||
error_page("This thread is locked. Only forum moderators and administrators are allowed to post there.");
|
||||
}
|
||||
|
||||
$forum = $thread->getForum();
|
||||
$category = $forum->getCategory();
|
||||
|
||||
|
|
|
@ -92,7 +92,10 @@ if (($thread->isHidden()) && $logged_in_user && (!$logged_in_user->isSpecialUser
|
|||
<table width=\"100%\" cellspacing=0 cellpadding=0>
|
||||
<tr>
|
||||
<td align=\"left\">";
|
||||
echo $reply_text = "<a href=\"forum_reply.php?thread=".$thread->getID()."#input\">".tr(FORUM_THREAD_REPLY)."</a><br>";
|
||||
|
||||
if (!$thread->isLocked() || ($logged_in_user && $logged_in_user->isSpecialUser(S_MODERATOR))) {
|
||||
echo $reply_text = "<a href=\"forum_reply.php?thread=".$thread->getID()."#input\">".tr(FORUM_THREAD_REPLY)."</a><br>";
|
||||
}
|
||||
|
||||
if ($is_subscribed) {
|
||||
echo tr(FORUM_THREAD_SUBSCRIBED)." ";
|
||||
|
@ -103,16 +106,21 @@ if (($thread->isHidden()) && $logged_in_user && (!$logged_in_user->isSpecialUser
|
|||
|
||||
//If the logged in user is moderator enable some extra features
|
||||
if ($logged_in_user && $logged_in_user->isSpecialUser(S_MODERATOR)){
|
||||
if ($thread->isHidden()){
|
||||
echo "<br /><a href=\"forum_moderate_thread_action.php?action=unhide&thread=".$thread->getID()."\">Un-Delete this thread</a>";
|
||||
} else {
|
||||
echo "<br /><a href=\"forum_moderate_thread.php?action=hide&thread=".$thread->getID()."\">Delete this thread</a>";
|
||||
}
|
||||
if($thread->isSticky()){
|
||||
echo "<br /><a href=\"forum_moderate_thread_action.php?action=desticky&thread=".$thread->getID()."\">De-sticky this thread</a>";
|
||||
} else {
|
||||
echo "<br /><a href=\"forum_moderate_thread_action.php?action=sticky&thread=".$thread->getID()."\">Make this thread sticky</a>";
|
||||
}
|
||||
if ($thread->isHidden()){
|
||||
echo "<br /><a href=\"forum_moderate_thread_action.php?action=unhide&thread=".$thread->getID()."\">Un-Delete this thread</a>";
|
||||
} else {
|
||||
echo "<br /><a href=\"forum_moderate_thread.php?action=hide&thread=".$thread->getID()."\">Delete this thread</a>";
|
||||
}
|
||||
if ($thread->isSticky()){
|
||||
echo "<br /><a href=\"forum_moderate_thread_action.php?action=desticky&thread=".$thread->getID()."\">De-sticky this thread</a>";
|
||||
} else {
|
||||
echo "<br /><a href=\"forum_moderate_thread_action.php?action=sticky&thread=".$thread->getID()."\">Make this thread sticky</a>";
|
||||
}
|
||||
if ($thread->isLocked()) {
|
||||
echo "<br /><a href=\"forum_moderate_thread_action.php?action=unlock&thread=".$thread->getID()."\">Unlock thread</a>";
|
||||
} else {
|
||||
echo "<br /><a href=\"forum_moderate_thread_action.php?action=lock&thread=".$thread->getID()."\">Lock thread</a>";
|
||||
}
|
||||
echo "<br /><a href=\"forum_moderate_thread.php?action=move&thread=".$thread->getID()."\">Move this thread</a>";
|
||||
echo "<br /><a href=\"forum_moderate_thread.php?action=title&thread=".$thread->getID()."\">Edit thread title</a>";
|
||||
}
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 211 B |
Binary file not shown.
After Width: | Height: | Size: 373 B |
Binary file not shown.
After Width: | Height: | Size: 213 B |
Binary file not shown.
After Width: | Height: | Size: 399 B |
Loading…
Reference in New Issue