mirror of https://github.com/BOINC/boinc.git
- 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() svn path=/trunk/boinc/; revision=14209
This commit is contained in:
parent
08c45ef7f1
commit
c83eeef1a5
|
@ -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
|
||||
|
|
|
@ -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 "<tr>\n";
|
||||
|
||||
// Search
|
||||
echo "<td><form action=\"forum_search_action.php\" method=\"POST\">
|
||||
<input type=\"hidden\" name=\"search_max_time\" value=\"30\">
|
||||
<input type=\"hidden\" name=\"search_forum\" value=\"-1\">
|
||||
<input type=\"hidden\" name=\"search_sort\" value=\"5\">
|
||||
<input type=\"text\" name=\"search_keywords\">
|
||||
<input class=\"btn\" title=\"Search for words in forum messages\" type=\"submit\" value=\"Search forums\"><br>
|
||||
<span class=\"smalltext\"><a href=\"forum_search.php\">Advanced search</a></span>
|
||||
</form>
|
||||
";
|
||||
// show a banner with search form on left and PM info on right
|
||||
//
|
||||
function show_forum_header($user) {
|
||||
start_table_noborder();
|
||||
echo "<tr>\n";
|
||||
|
||||
// Search
|
||||
echo "<td><form action=\"forum_search_action.php\" method=\"POST\">
|
||||
<input type=\"hidden\" name=\"search_max_time\" value=\"30\">
|
||||
<input type=\"hidden\" name=\"search_forum\" value=\"-1\">
|
||||
<input type=\"hidden\" name=\"search_sort\" value=\"5\">
|
||||
<input type=\"text\" name=\"search_keywords\">
|
||||
<input class=\"btn\" title=\"Search for words in forum messages\" type=\"submit\" value=\"Search forums\"><br>
|
||||
<span class=\"smalltext\"><a href=\"forum_search.php\">Advanced search</a></span>
|
||||
</form>
|
||||
";
|
||||
echo "</td>\n";
|
||||
|
||||
if ($user) {
|
||||
echo "<td align=\"right\">\n";
|
||||
echo "<p>", pm_notification($user);
|
||||
echo "</td>\n";
|
||||
|
||||
// Custom stuff for logged in user
|
||||
if ($user) {
|
||||
echo "<td align=\"right\">\n";
|
||||
|
||||
// Private messages
|
||||
echo "<p>", pm_notification($user);
|
||||
|
||||
echo "</td>\n";
|
||||
}
|
||||
echo "</tr>\n";
|
||||
end_table();
|
||||
}
|
||||
echo "</tr>\n";
|
||||
end_table();
|
||||
}
|
||||
|
||||
// Output the forum/thread title.
|
||||
//
|
||||
function show_forum_title($category, $forum, $thread) {
|
||||
echo "<p>\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
|
||||
){
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -46,7 +46,8 @@ if ($category->is_helpdesk){
|
|||
// Allow users with a linktab-browser to get some useful links
|
||||
echo '<link href="forum_index.php" rel="up" title="Forum Index">';
|
||||
|
||||
show_forum_title($user, $category, $forum, NULL, true);
|
||||
show_forum_header($user);
|
||||
show_forum_title($category, $forum, NULL);
|
||||
|
||||
echo '
|
||||
<table width="100%" cellspacing="0" cellpadding="0">
|
||||
|
|
|
@ -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 "<p>
|
|||
<a href=\"http://boinc.berkeley.edu/help.php\">BOINC Online Help</a>.</p>
|
||||
";
|
||||
|
||||
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 "
|
||||
<tr class=\"subtitle\">
|
||||
<td class=\"category\" colspan=\"4\">", $category->name, "</td>
|
||||
</tr>
|
||||
";
|
||||
if ($first) {
|
||||
$first = false;
|
||||
show_forum_title($category, null, null);
|
||||
start_forum_table(array("Topic", "# Questions", "Last post"));
|
||||
}
|
||||
if (strlen($category->name)) {
|
||||
echo "
|
||||
<tr class=\"subtitle\">
|
||||
<td class=\"category\" colspan=\"4\">", $category->name, "</td>
|
||||
</tr>
|
||||
";
|
||||
}
|
||||
|
||||
$forums = BoincForum::enum("category=$category->id order by orderID");
|
||||
foreach ($forums as $forum) {
|
||||
|
|
|
@ -47,16 +47,25 @@ echo "
|
|||
</p>
|
||||
";
|
||||
|
||||
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 '
|
||||
<tr class="subtitle">
|
||||
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 '
|
||||
<tr class="subtitle">
|
||||
<td class="category" colspan="4">'.$category->name.'</td>
|
||||
</tr>
|
||||
';
|
||||
</tr>
|
||||
';
|
||||
}
|
||||
$forums = BoincForum::enum("parent_type=0 and category=$category->id order by orderID");
|
||||
foreach ($forums as $forum) {
|
||||
echo forum_summary($forum);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
);
|
||||
|
|
|
@ -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 "<p>You are now subscribed to <b>", cleanup_title($thread->title), "</b>.
|
||||
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 "<p>You are no longer subscribed to <b>", cleanup_title($thread->title), "</b>.
|
||||
You will no longer receive notifications for this thread.";
|
||||
} else {
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue