diff --git a/checkin_notes b/checkin_notes index 0467f30857..22a8595ff5 100644 --- a/checkin_notes +++ b/checkin_notes @@ -10960,3 +10960,23 @@ David 15 Nov 2007 html/user/ white.css + +David 15 Nov 2007 + - user web: factor out code for forum header (search forum and PM info) + into a separate function. + Don't show subtitle bar for categories with no name. + Rename search_post_titles() to search_post_content() + + html/ + inc/ + forum.inc + user/ + forum_edit.php + forum_forum.php + forum_help_desk.php + forum_index.php + forum_post.php + forum_reply.php + forum_search_action.php + forum_subscribe.php + forum_thread.php diff --git a/html/inc/forum.inc b/html/inc/forum.inc index e8e207c7ba..9c2b871651 100644 --- a/html/inc/forum.inc +++ b/html/inc/forum.inc @@ -88,38 +88,36 @@ $special_user_bitfield[S_VOLUNTEER]="Volunteer developer"; $special_user_bitfield[S_VOLUNTEER_TESTER]="Volunteer tester"; $special_user_bitfield[S_SCIENTIST]="Project scientist"; -// Output the forum/thread title. - -function show_forum_title($user, $category, $forum, $thread, $extended) { - if ($extended) { - start_table_noborder(); - echo "\n"; - - // Search - echo "
- - - - -
- Advanced search -
- "; +// show a banner with search form on left and PM info on right +// +function show_forum_header($user) { + start_table_noborder(); + echo "\n"; + + // Search + echo "
+ + + + +
+ Advanced search +
+ "; + echo "\n"; + + if ($user) { + echo "\n"; + echo "

", pm_notification($user); echo "\n"; - - // Custom stuff for logged in user - if ($user) { - echo "\n"; - - // Private messages - echo "

", pm_notification($user); - - echo "\n"; - } - echo "\n"; - end_table(); } + echo "\n"; + end_table(); +} +// Output the forum/thread title. +// +function show_forum_title($category, $forum, $thread) { echo "

\n"; if ($category) { $is_helpdesk = $category->is_helpdesk; @@ -815,9 +813,8 @@ function get_thread_posts($threadid, $sort_style, $show_hidden_posts) { return BoincPost::enum($sql); } -// Searches for ALL the keywords in the $keyword_list array, -// optionally filters by forum or user if specified. -// If time is given, only posts newer than that are returned. +// Searches for the keywords in the $keyword_list array in thread titles. +// Optionally filters by forum, user, time, or hidden if specified. // function search_thread_titles( $keyword_list, $forum="", $user="", $time="", $limit=200, @@ -868,11 +865,10 @@ function search_thread_titles( return BoincThread::enum($query); } -// Searches for ALL the keywords in the $keyword_list array, -// optionally filters by forum or user if specified. -// If time is given, only posts newer than that are returned. +// Searches for the keywords in the $keyword_list array in post bodies. +// optionally filters by forum, time, hidden, or user if specified. // -function search_post_titles( +function search_post_content( $keyword_list, $forum="", $user="", $time="", $limit=200, $sort_style=CREATE_TIME_NEW, $show_hidden = false ){ diff --git a/html/user/forum_edit.php b/html/user/forum_edit.php index e5a738d83a..c91fa5bbf6 100644 --- a/html/user/forum_edit.php +++ b/html/user/forum_edit.php @@ -72,7 +72,8 @@ page_head('Forum'); $forum = BoincForum::lookup_id($thread->forum); $category = BoincCategory::lookup_id($forum->category); -show_forum_title($logged_in_user, $category, $forum, $thread, true); +show_forum_header($logged_in_user); +show_forum_title($category, $forum, $thread); if ($preview == tra("Preview")) { $options = null; diff --git a/html/user/forum_forum.php b/html/user/forum_forum.php index b586bf82bf..ea8a85c269 100644 --- a/html/user/forum_forum.php +++ b/html/user/forum_forum.php @@ -46,7 +46,8 @@ if ($category->is_helpdesk){ // Allow users with a linktab-browser to get some useful links echo ''; -show_forum_title($user, $category, $forum, NULL, true); +show_forum_header($user); +show_forum_title($category, $forum, NULL); echo ' diff --git a/html/user/forum_help_desk.php b/html/user/forum_help_desk.php index 0490623903..395dba568f 100644 --- a/html/user/forum_help_desk.php +++ b/html/user/forum_help_desk.php @@ -4,7 +4,7 @@ require_once('../inc/forum.inc'); require_once('../inc/util.inc'); require_once('../inc/time.inc'); -get_logged_in_user(false); +$user = get_logged_in_user(false); page_head("Questions and answers"); @@ -14,16 +14,23 @@ echo "

BOINC Online Help.

"; -show_forum_title(null, null, null, null, false); -start_forum_table(array("Topic", "# Questions", "Last post")); +show_forum_header($user); $categories = BoincCategory::enum("is_helpdesk=1 order by orderID"); +$first = true; foreach ($categories as $category) { - echo " - - - - "; + if ($first) { + $first = false; + show_forum_title($category, null, null); + start_forum_table(array("Topic", "# Questions", "Last post")); + } + if (strlen($category->name)) { + echo " + + + + "; + } $forums = BoincForum::enum("category=$category->id order by orderID"); foreach ($forums as $forum) { diff --git a/html/user/forum_index.php b/html/user/forum_index.php index a0d8ddd8c3..6ffc660983 100644 --- a/html/user/forum_index.php +++ b/html/user/forum_index.php @@ -47,16 +47,25 @@ echo "

"; -show_forum_title($user, NULL, NULL, NULL, true); -start_forum_table(array(tra("Topic"), tra("Threads"), tra("Posts"), tra("Last post"))); +show_forum_header($user); $categories = BoincCategory::enum("is_helpdesk=0 order by orderID"); +$first = true; foreach ($categories as $category) { - echo ' - + if ($first) { + $first = false; + show_forum_title($category, NULL, NULL); + start_forum_table( + array(tra("Topic"), tra("Threads"), tra("Posts"), tra("Last post")) + ); + } + if (strlen($category->name)) { + echo ' + - - '; + + '; + } $forums = BoincForum::enum("parent_type=0 and category=$category->id order by orderID"); foreach ($forums as $forum) { echo forum_summary($forum); diff --git a/html/user/forum_post.php b/html/user/forum_post.php index cdf6d15abd..b2e1abcf40 100644 --- a/html/user/forum_post.php +++ b/html/user/forum_post.php @@ -58,7 +58,8 @@ if ($content && $title && (!$preview)){ page_head('Create new thread'); $category = BoincCategory::lookup_id($forum->category); -show_forum_title($logged_in_user, $category, $forum, null, true); +show_forum_header($logged_in_user); +show_forum_title($category, $forum, null); if ($preview == tra("Preview")) { $options = null; diff --git a/html/user/forum_reply.php b/html/user/forum_reply.php index 78822816fe..e63be803dc 100644 --- a/html/user/forum_reply.php +++ b/html/user/forum_reply.php @@ -88,7 +88,8 @@ if ($content && (!$preview)){ page_head(tra("Message boards")); -show_forum_title($logged_in_user, $category, $forum, $thread, true); +show_forum_header($logged_in_user); +show_forum_title($category, $forum, $thread); if ($preview == tra("Preview")) { $options = new output_options; diff --git a/html/user/forum_search_action.php b/html/user/forum_search_action.php index 93c4b692ab..f7db2e3dbf 100644 --- a/html/user/forum_search_action.php +++ b/html/user/forum_search_action.php @@ -36,7 +36,7 @@ if ($search_author) { $user = BoincUser::lookup_id($search_author); } -// First search thread titles, if we get a hit there it's probablyrelevant +// First search thread titles; if we get a hit there it's probably relevant // $threads = search_thread_titles($search_list, $forum, $user, $min_timestamp, round($limit/7), $search_sort, $show_hidden_posts); @@ -65,9 +65,9 @@ if (count($threads)){ } -// Let's see if we can match anything in a post body as well: +// Look in a post content as well // -$posts = search_post_titles( +$posts = search_post_content( $search_list, $forum, $user, $min_timestamp, $limit, $search_sort, $show_hidden_posts ); diff --git a/html/user/forum_subscribe.php b/html/user/forum_subscribe.php index 3cbd25bb75..99bdc5e180 100644 --- a/html/user/forum_subscribe.php +++ b/html/user/forum_subscribe.php @@ -14,7 +14,8 @@ $category = BoincCategory::lookup_id($forum->category); function subscribe($category, $forum, $thread, $user) { if (BoincSubscription::replace($user->id, $thread->id)) { page_head("Subscription Successful"); - show_forum_title($user, $category, $forum, $thread, true); + show_forum_header($user); + show_forum_title($category, $forum, $thread); echo "

You are now subscribed to ", cleanup_title($thread->title), ". You will receive an email whenever someone posts to the thread."; } else { @@ -30,7 +31,8 @@ function unsubscribe($category, $forum, $thread, $user) { BoincSubscription::delete($user->id, $thread->id); if (!BoincSubscription::lookup($user->id, $thread->id)) { page_head("Unsubscription Successful"); - show_forum_title($user, $category, $forum, $thread, true); + show_forum_header($user); + show_forum_title($category, $forum, $thread); echo "

You are no longer subscribed to ", cleanup_title($thread->title), ". You will no longer receive notifications for this thread."; } else { diff --git a/html/user/forum_thread.php b/html/user/forum_thread.php index 9f06e4ea45..adb6d6b288 100644 --- a/html/user/forum_thread.php +++ b/html/user/forum_thread.php @@ -64,7 +64,8 @@ if ($logged_in_user && $logged_in_user->prefs->jump_to_unread){ $is_subscribed = $logged_in_user && BoincSubscription::lookup($logged_in_user->id, $thread->id); -show_forum_title($logged_in_user, $category, $forum, $thread, true); +show_forum_header($logged_in_user); +show_forum_title($category, $forum, $thread); if ($category->is_helpdesk && !$thread->status){ if ($logged_in_user){ @@ -152,7 +153,7 @@ if ($category->is_helpdesk && !$thread->status){ if ($reply_url) { show_button($reply_url, tra("Post to thread"), "Add a new message to this thread"); } - show_forum_title($user, $category, $forum, $thread, false); + show_forum_title($category, $forum, $thread); $thread->update("views=views+1"); page_tail();

", $category->name, "
", $category->name, "
'.$category->name.'