From fafd167dde6726df46cd3cd9523ec6ad8af22b13 Mon Sep 17 00:00:00 2001 From: Ludovic Arnaud Date: Fri, 11 Oct 2002 02:55:34 +0000 Subject: [PATCH] More jumpbox stuff, still not happy with the layout though =( git-svn-id: file:///svn/phpbb/trunk@2953 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions.php | 40 ++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 22a6dee881..07002056ed 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -186,7 +186,7 @@ function make_jumpbox($action, $forum_id = false) { global $auth, $template, $lang, $db, $nav_links, $phpEx; - $boxstring = ''; $sql = 'SELECT forum_id, forum_name, forum_status, left_id, right_id FROM ' . FORUMS_TABLE . ' @@ -194,6 +194,7 @@ function make_jumpbox($action, $forum_id = false) $result = $db->sql_query($sql); $right = 0; + $cat_right = 0; $padding = ''; $forum_list = ''; while ( $row = $db->sql_fetchrow($result) ) @@ -204,25 +205,31 @@ function make_jumpbox($action, $forum_id = false) } else if ( $row['left_id'] > $right + 1 ) { - $padding = substr($subforum, 0, -18 * ( $row['left_id'] - $right + 1 )); + $padding = substr($padding, 0, -13 * ( $row['left_id'] - $right + 1 )); } $right = $row['right_id']; - $linefeed = TRUE; + $linefeed = FALSE; if ( ( $auth->acl_get('f_list', $forum_id) || $auth->acl_get('a_') )) { - if ($row['forum_status'] == ITEM_CATEGORY) + $selected = ( $row['forum_id'] == $forum_id ) ? ' selected="selected"' : ''; + + if ($row['left_id'] > $cat_right) { - $linefeed = TRUE; - $boxstring .= ''; + $holding = ''; } - elseif ($row['parent_id'] == 0) + if ($row['parent_id'] == 0) { - if ($linefeed) + if ($row['forum_status'] == ITEM_CATEGORY) + { + $linefeed = TRUE; + $holding = ''; + } + elseif (!empty($linefeed)) { $linefeed = FALSE; - $boxstring .= ''; + $boxstring .= ''; } } else @@ -230,14 +237,21 @@ function make_jumpbox($action, $forum_id = false) $linefeed = TRUE; } - $selected = ( $row['forum_id'] == $forum_id ) ? ' selected="selected"' : ''; - $boxstring .= ''; - if ($row['forum_status'] == ITEM_CATEGORY) { - $boxstring .= ''; + $cat_right = max($cat_right, $row['right_id']); + + $holding .= ''; + } + else + { + $boxstring .= $holding . ''; + $holding = ''; } + // + // TODO: do not add empty categories to nav links + // $nav_links['chapter forum'][$row['forum_id']] = array ( 'url' => ($row['forum_status'] == ITEM_CATEGORY) ? "index.$phpEx$SIDc=" : "viewforum.$phpEx$SID&f=" . $row['forum_id'], 'title' => $row['forum_name']