Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
7bb88809
Commit
7bb88809
authored
Jul 06, 2004
by
Dries
Browse files
- Patch
#9049
by JonBob: fixed a number of tab issues.
parent
4bbc2778
Changes
6
Hide whitespace changes
Inline
Side-by-side
includes/menu.inc
View file @
7bb88809
...
...
@@ -100,7 +100,6 @@
*/
function
menu_get_menu
()
{
global
$_menu
;
global
$user
;
if
(
!
isset
(
$_menu
[
'items'
]))
{
// _menu_build() may indirectly call this function, so prevent infinite loops.
...
...
@@ -108,6 +107,20 @@ function menu_get_menu() {
_menu_build
();
}
return
$_menu
;
}
/**
* Return the local task tree.
*
* Unlike the rest of the menu structure, the local task tree cannot be cached
* nor determined too early in the page request, because the user's current
* location may be changed by a menu_set_location() call, and the tasks shown
* (just as the breadcrumb trail) need to reflect the changed location.
*/
function
menu_get_local_tasks
()
{
global
$_menu
;
// Don't cache the local task tree, as it varies by location and tasks are
// allowed to be dynamically determined.
if
(
!
isset
(
$_menu
[
'local tasks'
]))
{
...
...
@@ -117,7 +130,7 @@ function menu_get_menu() {
_menu_build_local_tasks
();
}
return
$_menu
;
return
$_menu
[
'local tasks'
]
;
}
/**
...
...
@@ -275,6 +288,24 @@ function menu_get_active_nontask_item() {
}
}
/**
* Returns the ID of the current menu item or, if the current item is a
* local task or subtask, the ID of the current local task (not subtask).
*/
function
menu_get_active_local_task
()
{
$menu
=
menu_get_menu
();
$mid
=
menu_get_active_item
();
// Find the first non-task item:
while
(
$mid
&&
(
$menu
[
'items'
][
$mid
][
'type'
]
&
MENU_LOCAL_SUBTASK
))
{
$mid
=
$menu
[
'items'
][
$mid
][
'pid'
];
}
if
(
$mid
)
{
return
$mid
;
}
}
/**
* Returns the title of the active menu item.
*/
...
...
@@ -434,20 +465,20 @@ function theme_menu_item($mid) {
* them as tabs.
*/
function
theme_menu_local_tasks
()
{
$
menu
=
menu_get_
menu
();
$
local_tasks
=
menu_get_
local_tasks
();
$output
=
''
;
if
(
count
(
$
menu
[
'
local
tasks
'
]
[
0
][
'children'
]))
{
if
(
count
(
$local
_
tasks
[
0
][
'children'
]))
{
$output
.
=
"<ul class=
\"
tabs primary
\"
>
\n
"
;
foreach
(
$
menu
[
'
local
tasks
'
]
[
0
][
'children'
]
as
$mid
)
{
$output
.
=
theme
(
'menu_local_task'
,
$mid
,
menu_
in
_active_
trail
(
$mid
));
foreach
(
$local
_
tasks
[
0
][
'children'
]
as
$mid
)
{
$output
.
=
theme
(
'menu_local_task'
,
$mid
,
$mid
==
menu_
get
_active_
local_task
(
));
}
$output
.
=
"</ul>
\n
"
;
foreach
(
$
menu
[
'
local
tasks
'
]
[
0
][
'children'
]
as
$mid
)
{
if
(
menu_
in
_active_
trail
(
$mid
)
&&
count
(
$
menu
[
'
local
tasks
'
]
[
$mid
][
'children'
]))
{
foreach
(
$local
_
tasks
[
0
][
'children'
]
as
$mid
)
{
if
(
$mid
==
menu_
get
_active_
local_task
(
)
&&
count
(
$local
_
tasks
[
$mid
][
'children'
]))
{
$output
.
=
"<ul class=
\"
tabs secondary
\"
>
\n
"
;
foreach
(
$
menu
[
'
local
tasks
'
]
[
$mid
][
'children'
]
as
$cid
)
{
foreach
(
$local
_
tasks
[
$mid
][
'children'
]
as
$cid
)
{
$output
.
=
theme
(
'menu_local_task'
,
$cid
,
menu_in_active_trail
(
$cid
));
}
$output
.
=
"</ul>
\n
"
;
...
...
@@ -699,9 +730,6 @@ function _menu_build_local_tasks() {
$mid
=
menu_get_active_nontask_item
();
if
(
$mid
)
{
$tasks
[
$mid
]
=
array
(
'title'
=>
$_menu
[
'items'
][
$mid
][
'title'
],
'path'
=>
$_menu
[
'items'
][
$mid
][
'path'
],
'children'
=>
array
());
$tasks
[
0
][
'children'
][]
=
$mid
;
// Find top-level tasks
if
(
$children
=
$_menu
[
'items'
][
$mid
][
'children'
])
{
foreach
(
$children
as
$cid
)
{
...
...
@@ -713,6 +741,9 @@ function _menu_build_local_tasks() {
}
usort
(
$tasks
[
0
][
'children'
],
'_menu_sort'
);
$tasks
[
$mid
]
=
array
(
'title'
=>
$_menu
[
'items'
][
$mid
][
'title'
],
'path'
=>
$_menu
[
'items'
][
$mid
][
'path'
],
'children'
=>
array
());
array_unshift
(
$tasks
[
0
][
'children'
],
$mid
);
// Find subtasks
foreach
(
$tasks
[
0
][
'children'
]
as
$mid
)
{
if
(
$children
=
$_menu
[
'items'
][
$mid
][
'children'
])
{
...
...
misc/drupal.css
View file @
7bb88809
...
...
@@ -420,8 +420,9 @@ ul.primary li a:hover {
border-bottom-color
:
#eee
;
}
ul
.secondary
{
padding
:
0
;
margin
:
0.5em
2em
1em
;
border-bottom
:
1px
solid
#bbb
;
padding
:
0.5em
1em
0.5em
1em
;
margin
:
5px
;
}
ul
.secondary
li
{
display
:
inline
;
...
...
modules/book.module
View file @
7bb88809
...
...
@@ -573,7 +573,7 @@ function book_navigation($node) {
foreach
(
$path
as
$level
)
{
$node
->
breadcrumb
[]
=
array
(
'path'
=>
'book/view/'
.
$level
->
nid
,
'title'
=>
$level
->
title
);
}
$node
->
breadcrumb
[]
=
array
(
'path'
=>
'
book/view
/'
.
$node
->
nid
);
$node
->
breadcrumb
[]
=
array
(
'path'
=>
'
node
/'
.
$node
->
nid
);
if
(
$node
->
nid
)
{
$output
.
=
'<div class="book">'
;
...
...
modules/book/book.module
View file @
7bb88809
...
...
@@ -573,7 +573,7 @@ function book_navigation($node) {
foreach
(
$path
as
$level
)
{
$node
->
breadcrumb
[]
=
array
(
'path'
=>
'book/view/'
.
$level
->
nid
,
'title'
=>
$level
->
title
);
}
$node
->
breadcrumb
[]
=
array
(
'path'
=>
'
book/view
/'
.
$node
->
nid
);
$node
->
breadcrumb
[]
=
array
(
'path'
=>
'
node
/'
.
$node
->
nid
);
if
(
$node
->
nid
)
{
$output
.
=
'<div class="book">'
;
...
...
modules/poll.module
View file @
7bb88809
...
...
@@ -304,9 +304,9 @@ function poll_teaser($node) {
*/
function
poll_view_voting
(
&
$node
,
$main
,
$page
,
$block
)
{
$url
=
request_uri
();
$output
.
=
'<div class="poll">'
;
$output
=
'<div class="poll">'
;
$form
.
=
'<div class="vote-form">'
;
$form
=
'<div class="vote-form">'
;
$form
.
=
'<div class="choices">'
;
if
(
$node
->
choice
)
{
$list
=
array
();
...
...
@@ -415,6 +415,7 @@ function poll_vote(&$node) {
*/
function
poll_view
(
&
$node
,
$main
=
0
,
$page
=
0
,
$block
=
0
)
{
global
$user
;
$output
=
''
;
if
(
$node
->
allowvotes
&&
(
$block
||
arg
(
2
)
!=
'results'
))
{
$output
.
=
poll_view_voting
(
$node
,
$main
,
$page
,
$block
);
...
...
modules/poll/poll.module
View file @
7bb88809
...
...
@@ -304,9 +304,9 @@ function poll_teaser($node) {
*/
function
poll_view_voting
(
&
$node
,
$main
,
$page
,
$block
)
{
$url
=
request_uri
();
$output
.
=
'<div class="poll">'
;
$output
=
'<div class="poll">'
;
$form
.
=
'<div class="vote-form">'
;
$form
=
'<div class="vote-form">'
;
$form
.
=
'<div class="choices">'
;
if
(
$node
->
choice
)
{
$list
=
array
();
...
...
@@ -415,6 +415,7 @@ function poll_vote(&$node) {
*/
function
poll_view
(
&
$node
,
$main
=
0
,
$page
=
0
,
$block
=
0
)
{
global
$user
;
$output
=
''
;
if
(
$node
->
allowvotes
&&
(
$block
||
arg
(
2
)
!=
'results'
))
{
$output
.
=
poll_view_voting
(
$node
,
$main
,
$page
,
$block
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment