diff options
author | Ludovic Arnaud <ludovic_arnaud@users.sourceforge.net> | 2002-10-11 02:55:34 +0000 |
---|---|---|
committer | Ludovic Arnaud <ludovic_arnaud@users.sourceforge.net> | 2002-10-11 02:55:34 +0000 |
commit | fafd167dde6726df46cd3cd9523ec6ad8af22b13 (patch) | |
tree | 394446358609965c59d27cf4d2ebff476aa3a76a /phpBB | |
parent | 1e52eafc800ab791010f77c1b4f39d9bdac69168 (diff) | |
download | forums-fafd167dde6726df46cd3cd9523ec6ad8af22b13.tar forums-fafd167dde6726df46cd3cd9523ec6ad8af22b13.tar.gz forums-fafd167dde6726df46cd3cd9523ec6ad8af22b13.tar.bz2 forums-fafd167dde6726df46cd3cd9523ec6ad8af22b13.tar.xz forums-fafd167dde6726df46cd3cd9523ec6ad8af22b13.zip |
More jumpbox stuff, still not happy with the layout though =(
git-svn-id: file:///svn/phpbb/trunk@2953 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB')
-rw-r--r-- | phpBB/includes/functions.php | 40 |
1 files 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 = '<select name="f" onChange="if(this.options[this.selectedIndex].value != -1){ forms[\'jumpbox\'].submit() }"><option value="-1">' . $lang['Select_forum'] . '</option>'; + $boxstring = '<select name="f" onChange="if(this.options[this.selectedIndex].value != -1){ forms[\'jumpbox\'].submit() }"><option value="-1">' . $lang['Select_forum'] . '</option><option value="-1"> </option>'; $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 .= '<option value="-1"> </option>'; + $holding = ''; } - elseif ($row['parent_id'] == 0) + if ($row['parent_id'] == 0) { - if ($linefeed) + if ($row['forum_status'] == ITEM_CATEGORY) + { + $linefeed = TRUE; + $holding = '<option value="-1"> </option>'; + } + elseif (!empty($linefeed)) { $linefeed = FALSE; - $boxstring .= '<option value="-1"> </option>'; + $boxstring .= '<option value="-1"> </option>'; } } else @@ -230,14 +237,21 @@ function make_jumpbox($action, $forum_id = false) $linefeed = TRUE; } - $selected = ( $row['forum_id'] == $forum_id ) ? ' selected="selected"' : ''; - $boxstring .= '<option value="' . (($row['forum_status'] == ITEM_CATEGORY) ? 'c' : '') . $row['forum_id'] . '"' . $selected . '>' . $padding . $row['forum_name'] . '</option>'; - if ($row['forum_status'] == ITEM_CATEGORY) { - $boxstring .= '<option value="-1">' . $padding . '----------------</option>'; + $cat_right = max($cat_right, $row['right_id']); + + $holding .= '<option value="c' . $row['forum_id'] . '"' . $selected . '>' . $padding . $row['forum_name'] . '</option><option value="-1">' . $padding . '----------------</option>'; + } + else + { + $boxstring .= $holding . '<option value="' . $row['forum_id'] . '"' . $selected . '>' . $padding . $row['forum_name'] . '</option>'; + $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'] |