mirror of https://github.com/BOINC/boinc.git
- user web: show list of subscribed threads on forum index page
- user web: highlight subscribed threads using green background - user web: hyperlink thread titles in search results svn path=/trunk/boinc/; revision=14286
This commit is contained in:
parent
6c9c644da8
commit
8f6ce0b043
|
@ -11540,3 +11540,16 @@ David 21 Nov 2007
|
|||
user/
|
||||
team_delta.php
|
||||
team_admins.php
|
||||
|
||||
David 21 Nov 2007
|
||||
- user web: show list of subscribed threads on forum index page
|
||||
- user web: highlight subscribed threads using green background
|
||||
- user web: hyperlink thread titles in search results
|
||||
|
||||
html/
|
||||
inc/
|
||||
forum.inc
|
||||
user/
|
||||
forum_forum.php
|
||||
forum_index.php
|
||||
forum_search_action.php
|
||||
|
|
|
@ -118,7 +118,7 @@ function show_forum_header($user) {
|
|||
|
||||
// Output the forum/thread title.
|
||||
//
|
||||
function show_forum_title($category, $forum, $thread) {
|
||||
function show_forum_title($category, $forum, $thread, $link_thread=false) {
|
||||
if ($category) {
|
||||
$is_helpdesk = $category->is_helpdesk;
|
||||
} else {
|
||||
|
@ -135,11 +135,17 @@ function show_forum_title($category, $forum, $thread) {
|
|||
echo $forum->title;
|
||||
echo "</span>";
|
||||
} else if ($forum && $thread) {
|
||||
echo "<span class=title>";
|
||||
echo "<a href=\"$top_url\">$where</a> : ";
|
||||
|
||||
echo "<a href=\"forum_forum.php?id=".$forum->id."\">", $forum->title, "</a> : ";
|
||||
echo "<span class=title>
|
||||
<a href=\"$top_url\">$where</a> :
|
||||
<a href=\"forum_forum.php?id=".$forum->id."\">", $forum->title, "</a> :
|
||||
";
|
||||
if ($link_thread) {
|
||||
echo "<a href=forum_thread?id=$thread->id>";
|
||||
}
|
||||
echo cleanup_title($thread->title);
|
||||
if ($link_thread) {
|
||||
echo "</a>";
|
||||
}
|
||||
echo "</span>";
|
||||
} else {
|
||||
echo "Invalid input to show_forum_title<br>";
|
||||
|
@ -971,4 +977,43 @@ function is_moderator($user, $forum) {
|
|||
return false;
|
||||
}
|
||||
|
||||
function show_thread_and_context_header() {
|
||||
start_forum_table(array(tra("Thread"), tra("Posts"), tra("Author"), tra("Views"), "<nobr>".tra("Last post")."</nobr>"));
|
||||
}
|
||||
|
||||
// show a 1-line summary of thread and its forum.
|
||||
// Used for search results and subscription list
|
||||
//
|
||||
function show_thread_and_context($thread) {
|
||||
$thread_forum = BoincForum::lookup_id($thread->forum);
|
||||
if (!$thread_forum) continue;
|
||||
$owner = BoincUser::lookup_id($thread->owner);
|
||||
echo "<tr><td>\n";
|
||||
switch($thread_forum->parent_type) {
|
||||
case 0:
|
||||
$category = BoincCategory::lookup_id($thread_forum->category);
|
||||
show_forum_title($category, $thread_forum, $thread, true);
|
||||
break;
|
||||
case 1:
|
||||
show_team_forum_title($thread_forum, $thread);
|
||||
break;
|
||||
}
|
||||
echo '
|
||||
</td><td>'.($thread->replies+1).'</td>
|
||||
<td align="left"><div class="authorcol">'.user_links($owner).'</div></td>
|
||||
<td>'.$thread->views.'</td>
|
||||
<td style="text-align:right">'.time_diff_str($thread->timestamp, time()).'</td>
|
||||
</tr>
|
||||
';
|
||||
}
|
||||
|
||||
// see if thread is in subscription list
|
||||
//
|
||||
function is_subscribed($thread, $subs) {
|
||||
foreach ($subs as $sub) {
|
||||
if ($sub->threadid == $thread->id) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -100,6 +100,7 @@ function show_forum($forum, $start, $sort_style, $user) {
|
|||
start_forum_table(array("", tra("Threads"), tra("Posts"), tra("Author"), tra("Views"), "<nobr>".tra("Last post")."</nobr>"));
|
||||
|
||||
$sticky_first = !$user || !$user->prefs->ignore_sticky_posts;
|
||||
|
||||
// Show hidden threads if logged in user is a moderator
|
||||
//
|
||||
$show_hidden = is_moderator($user, $forum);
|
||||
|
@ -107,6 +108,10 @@ function show_forum($forum, $start, $sort_style, $user) {
|
|||
$forum->id, $start, THREADS_PER_PAGE,
|
||||
$sort_style, $show_hidden, $sticky_first
|
||||
);
|
||||
|
||||
if ($user) {
|
||||
$subs = BoincSubscription::enum("userid=$user->id");
|
||||
}
|
||||
|
||||
// Run through the list of threads, displaying each of them
|
||||
$n = 0; $i=0;
|
||||
|
@ -115,8 +120,8 @@ function show_forum($forum, $start, $sort_style, $user) {
|
|||
$unread = thread_is_unread($user, $thread);
|
||||
|
||||
//if ($thread->status==1){
|
||||
if (0) {
|
||||
// This is an answered helpdesk thread
|
||||
if ($user && is_subscribed($thread, $subs)) {
|
||||
echo '<tr class="row_hd'.$n.'">';
|
||||
} else {
|
||||
// Just a standard thread.
|
||||
|
|
|
@ -92,8 +92,22 @@ if ($user && $user->teamid) {
|
|||
show_forum_summary($forum);
|
||||
}
|
||||
}
|
||||
|
||||
end_table();
|
||||
|
||||
if ($user) {
|
||||
$subs = BoincSubscription::enum("userid=$user->id");
|
||||
if (count($subs)) {
|
||||
echo "<h3>Subscribed threads</h2>";
|
||||
show_thread_and_context_header();
|
||||
foreach ($subs as $sub) {
|
||||
$thread = BoincThread::lookup_id($sub->threadid);
|
||||
if ($thread->hidden) continue;
|
||||
show_thread_and_context($thread);
|
||||
}
|
||||
end_table();
|
||||
}
|
||||
}
|
||||
|
||||
page_tail();
|
||||
flush();
|
||||
BoincForumLogging::cleanup();
|
||||
|
|
|
@ -144,29 +144,10 @@ $threads = search_thread_titles($search_list, $forum, $user, $min_timestamp, rou
|
|||
// Display the threads while we search for posts
|
||||
if (count($threads)){
|
||||
echo "<h2>Thread titles matching your query:</h2>";
|
||||
start_forum_table(array(tra("Thread"), tra("Posts"), tra("Author"), tra("Views"), "<nobr>".tra("Last post")."</nobr>"));
|
||||
show_thread_and_context_header();
|
||||
foreach ($threads as $thread){
|
||||
if ($thread->hidden) continue;
|
||||
$thread_forum = BoincForum::lookup_id($thread->forum);
|
||||
if (!$thread_forum) continue;
|
||||
$owner = BoincUser::lookup_id($thread->owner);
|
||||
echo "<tr><td>\n";
|
||||
switch($thread_forum->parent_type) {
|
||||
case 0:
|
||||
$category = BoincCategory::lookup_id($thread_forum->parent);
|
||||
show_forum_title($category, $thread_forum, $thread);
|
||||
break;
|
||||
case 1:
|
||||
show_team_forum_title($thread_forum, $thread);
|
||||
break;
|
||||
}
|
||||
echo '
|
||||
</td><td>'.($thread->replies+1).'</td>
|
||||
<td align="left"><div class="authorcol">'.user_links($owner).'</div></td>
|
||||
<td>'.$thread->views.'</td>
|
||||
<td style="text-align:right">'.time_diff_str($thread->timestamp, time()).'</td>
|
||||
</tr>
|
||||
';
|
||||
show_thread_and_context($thread);
|
||||
}
|
||||
end_table();
|
||||
echo "<br /><br />";
|
||||
|
|
Loading…
Reference in New Issue