From 58f315b5e6e8fdaea25bd5a4d8a6d8073f07e03e Mon Sep 17 00:00:00 2001 From: "Paul S. Owen" Date: Thu, 5 Feb 2004 14:43:23 +0000 Subject: [PATCH] Display active topic output for subfora if appropriate ... a little kludgy but works git-svn-id: file:///svn/phpbb/trunk@4802 89ea8834-ac86-4346-8a33-228a782c2dd0 --- .../subSilver/template/viewforum_body.html | 69 +++++++++++++++++++ phpBB/viewforum.php | 58 +++++++++------- 2 files changed, 101 insertions(+), 26 deletions(-) diff --git a/phpBB/styles/subSilver/template/viewforum_body.html b/phpBB/styles/subSilver/template/viewforum_body.html index 4c81b55ef2..63d896c1d5 100644 --- a/phpBB/styles/subSilver/template/viewforum_body.html +++ b/phpBB/styles/subSilver/template/viewforum_body.html @@ -14,6 +14,75 @@
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Active Topics
 {L_TOPICS}  {L_TOPICS}  {L_AUTHOR}  {L_REPLIES}  {L_VIEWS}  {L_LAST_POST} 
{topicrow.TOPIC_FOLDER_IMG}{topicrow.TOPIC_ICON_IMG} + + {UNAPPROVED_IMG}  + + + {REPORTED_IMG}  + +

{topicrow.NEWEST_POST_IMG} {topicrow.ATTACH_ICON_IMG} {topicrow.TOPIC_TITLE}

{topicrow.GOTO_PAGE}

{topicrow.TOPIC_AUTHOR}

{topicrow.REPLIES}

{topicrow.VIEWS}

+

{topicrow.LAST_POST_TIME}

+

+ + {topicrow.LAST_POST_AUTHOR} + + {topicrow.LAST_POST_AUTHOR} + + {topicrow.LAST_POST_IMG} +

+
{L_NO_TOPICS}{L_NO_TOPICS}
 
+ +
+ + + diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index 9d16557d28..2b1f6fc7ab 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -132,12 +132,12 @@ if (!$auth->acl_get('f_read', $forum_id)) generate_forum_nav($forum_data); // Do we have subforums? -$moderators = array(); +$active_forum_ary = $moderators = array(); if ($forum_data['left_id'] != $forum_data['right_id'] - 1) { include($phpbb_root_path . 'includes/functions_display.' . $phpEx); - display_forums($forum_data); + $active_forum_ary = display_forums($forum_data); } else { @@ -146,7 +146,7 @@ else get_moderators($moderators, $forum_id); // Output forum listing if it is postable -if ($forum_data['forum_type'] == FORUM_POST) +if ($forum_data['forum_type'] == FORUM_POST || ($forum_data['forum_flags'] & 16)) { // Handle marking posts if ($mark_read == 'topics') @@ -246,7 +246,7 @@ if ($forum_data['forum_type'] == FORUM_POST) $template->assign_vars(array( 'PAGINATION' => generate_pagination("viewforum.$phpEx$SID&f=$forum_id&st=$sort_days&sk=$sort_key&sd=$sort_dir", $topics_count, $config['topics_per_page'], $start), 'PAGE_NUMBER' => on_page($topics_count, $config['topics_per_page'], $start), - 'TOTAL_TOPICS' => ($topics_count == 1) ? $user->lang['VIEW_FORUM_TOPIC'] : sprintf($user->lang['VIEW_FORUM_TOPICS'], $topics_count), + 'TOTAL_TOPICS' => ($forum_data['forum_flags'] & 16) ? false : (($topics_count == 1) ? $user->lang['VIEW_FORUM_TOPIC'] : sprintf($user->lang['VIEW_FORUM_TOPICS'], $topics_count)), 'MODERATORS' => (!empty($moderators[$forum_id])) ? implode(', ', $moderators[$forum_id]) : '', 'POST_IMG' => ($forum_data['forum_status'] == ITEM_LOCKED) ? $user->img('btn_locked', $post_alt) : $user->img('btn_post', $post_alt), @@ -266,19 +266,21 @@ if ($forum_data['forum_type'] == FORUM_POST) 'L_NO_TOPICS' => ($forum_data['forum_status'] == ITEM_LOCKED) ? $user->lang['POST_FORUM_LOCKED'] : $user->lang['NO_TOPICS'], - 'S_IS_POSTABLE' => TRUE, + 'S_IS_POSTABLE' => ($forum_data['forum_type'] == FORUM_POST) ? true : false, + 'S_DISPLAY_ACTIVE' => ($forum_data['forum_type'] == FORUM_CAT && $forum_data['forum_flags'] & 16) ? true : false, 'S_SELECT_SORT_DIR' => $s_sort_dir, 'S_SELECT_SORT_KEY' => $s_sort_key, 'S_SELECT_SORT_DAYS' => $s_limit_days, - 'S_TOPIC_ICONS' => ($forum_data['enable_icons']) ? true : false, + 'S_TOPIC_ICONS' => ($forum_data['forum_type'] == FORUM_CAT && $forum_data['forum_flags'] & 16) ? max($active_forum_ary['enable_icons']) : (($forum_data['enable_icons']) ? true : false), 'S_WATCH_FORUM' => $s_watching_forum, 'S_FORUM_ACTION' => "viewforum.$phpExx$SIDx&f=$forum_id&start=$start", 'S_DISPLAY_SEARCHBOX' => ($auth->acl_get('f_search', $forum_id)) ? true : false, - 'S_SEARCHBOX_ACTION' => "search.$phpEx$SID&f=$forum_id", + 'S_SEARCHBOX_ACTION' => "search.$phpEx$SID&f[]=$forum_id", 'U_MCP' => ($auth->acl_gets('m_', $forum_id)) ? "mcp.$phpEx?sid=$user->session_id&f=$forum_id&mode=forum_view" : '', - 'U_POST_NEW_TOPIC' => "posting.$phpEx$SID&mode=post&f=$forum_id", - 'U_MARK_TOPICS' => "viewforum.$phpEx$SID&f=$forum_id&mark=topics") + 'U_POST_NEW_TOPIC' => "posting.$phpEx$SID&mode=post&f=$forum_id", + 'U_VIEW_FORUM' => "viewforum.$phpEx$SID&f=$forum_id&sk=$sort_key&sd=$sort_dir&st=$sort_days&start=$start", + 'U_MARK_TOPICS' => "viewforum.$phpEx$SID&f=$forum_id&mark=topics") ); // Grab icons @@ -300,20 +302,23 @@ if ($forum_data['forum_type'] == FORUM_POST) $sql_approved = ($auth->acl_get('m_approve', $forum_id)) ? '' : 'AND t.topic_approved = 1'; $sql_select = (($config['load_db_lastread'] || $config['load_db_track']) && $user->data['user_id'] != ANONYMOUS) ? ', tt.mark_type, tt.mark_time' : ''; - // Obtain announcements ... removed sort ordering, sort by time in all cases - $sql = "SELECT t.* $sql_select - FROM $sql_from - WHERE t.forum_id IN ($forum_id, 0) - AND t.topic_type IN (" . POST_ANNOUNCE . ', ' . POST_GLOBAL . ') - ORDER BY t.topic_time DESC'; - $result = $db->sql_query($sql); - - while ($row = $db->sql_fetchrow($result)) + if ($forum_data['forum_type'] == FORUM_POST) { - $rowset[$row['topic_id']] = $row; - $announcement_list[] = $row['topic_id']; + // Obtain announcements ... removed sort ordering, sort by time in all cases + $sql = "SELECT t.* $sql_select + FROM $sql_from + WHERE t.forum_id IN ($forum_id, 0) + AND t.topic_type IN (" . POST_ANNOUNCE . ', ' . POST_GLOBAL . ') + ORDER BY t.topic_time DESC'; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $rowset[$row['topic_id']] = $row; + $announcement_list[] = $row['topic_id']; + } + $db->sql_freeresult($result); } - $db->sql_freeresult($result); // If the user is trying to reach late pages, start searching from the end $store_reverse = FALSE; @@ -340,9 +345,10 @@ if ($forum_data['forum_type'] == FORUM_POST) // Obtain other topics // $sql_rownum = (SQL_LAYER != 'oracle') ? '' : ', ROWNUM rnum '; + $sql_where = ($forum_data['forum_type'] == FORUM_POST) ? "= $forum_id" : 'IN (' . implode(', ', $active_forum_ary['forum_id']) . ')'; $sql = "SELECT t.* $sql_select$sql_rownum FROM $sql_from - WHERE t.forum_id = $forum_id + WHERE t.forum_id $sql_where AND t.topic_type NOT IN (" . POST_ANNOUNCE . ', ' . POST_GLOBAL . ") $sql_approved $sql_limit_time @@ -485,7 +491,7 @@ if ($forum_data['forum_type'] == FORUM_POST) $times = 1; for($j = 0; $j < $replies + 1; $j += $config['posts_per_page']) { - $goto_page .= "$times"; + $goto_page .= "$times"; if ($times == 1 && $total_pages > 4) { $goto_page .= ' ... '; @@ -506,9 +512,9 @@ if ($forum_data['forum_type'] == FORUM_POST) } // Generate all the URIs ... - $view_topic_url = "viewtopic.$phpEx$SID&f=$forum_id&t=$topic_id"; + $view_topic_url = "viewtopic.$phpEx$SID&f=" . $row['forum_id'] . "&t=$topic_id"; - $last_post_img = "' . $user->img('icon_post_latest', 'VIEW_LATEST_POST') . ''; + $last_post_img = "' . $user->img('icon_post_latest', 'VIEW_LATEST_POST') . ''; $topic_author = ($row['topic_poster'] != ANONYMOUS) ? "' : ''; $topic_author .= ($row['topic_poster'] != ANONYMOUS) ? $row['topic_first_poster_name'] : (($row['topic_first_poster_name'] != '') ? $row['topic_first_poster_name'] : $user->lang['GUEST']); @@ -581,7 +587,7 @@ if ($forum_data['forum_type'] == FORUM_POST) // on all topics (as we do in 2.0.x). It looks for unread or new topics, if it doesn't find // any it updates the forum last read cookie. This requires that the user visit the forum // after reading a topic - if ($user->data['user_id'] != ANONYMOUS && $mark_forum_read) + if ($forum_data['forum_type'] == FORUM_POST && $user->data['user_id'] != ANONYMOUS && $mark_forum_read) { markread('mark', $forum_id); }