Error when dynamically loading menu items in block

bardkerbie - February 27, 2007 - 22:36
Project:Taxonomy context
Version:HEAD
Component:User interface
Category:bug report
Priority:normal
Assigned:bardkerbie
Status:active
Description

Is there any way to implement the functionality of DHTML Menu in this module? I'm setting up a rather large taxonomy listing, and would like to reduce the number of page loads as much as possible.

For reference, DHTML Menu is available at http://www.drupal.org/project/dhtml_menu/

Thanks!

#1

nedjo - February 27, 2007 - 22:43

Try inistalling Javascript Tools, enable the activemenu module, enable a taxononomy context block that includes nested terms, and you'll get an AJAX-expanding block. This approach could be adapted to other places in taxonomy context. If you develop a clear spec - details of what you'd want to see - I'll look at it, though I don't know if I'll find time to impement it.

#2

StenBH - April 10, 2007 - 17:02

I'm also interested in this issue. I would find it most appealing if the menu was accessible in the core menu module instead of as a separate block. This is the approach of the taxonomy_menu module. As a result the taxonomy_menu works with dhtml_menu. Would this design be acceptable from other perspectives?

#3

bardkerbie - May 2, 2007 - 20:03
Category:feature request» bug report

This sort of works. If i install HEAD and JSTools, I can get parent categories to display child categories in a DHTML list. However, I cannot get child nodes to display unless I actively click on the category. I'll try to do a little debugging, but I feel like I'm in over my head.

Here's the error message:

arg has no properties
http://nfldmn.bpsi.net/misc/jquery.js
Line 2

([null])jquery.js (line 2)
e([null], true, 1, function())jquery.js (line 2)
e()jquery.js (line 2)
success(Object status=true)activemenu.js (line 54)
e(undefined)

Thoughts?

#4

nedjo - May 2, 2007 - 20:25

Are you using Internet Explorer? If so, it may be this issue:

http://drupal.org/node/140620

#5

bardkerbie - May 2, 2007 - 23:01

I'm using Firefox, though it appears to be a cross-platform issue. I'm going to try applying the JSTools patch listed to see if it fixes the issue; I'll let you know what happens.

#6

bardkerbie - May 3, 2007 - 20:56

Still no worky. However, I did a little poking about (I love FireBug) and discovered more specific symptoms.

Let's say I have a vocabulary with a few terms. The first term has two sub-terms, and each sub-term has two nodes apiece. This Taxonomy is displayed in a block:

Term 1
- Sub-Term A
- - Node 1
- - Node 2
- Sub-Term B
- - Node 3
- - Node 4
Term 2

When I click on Term 1, the browser POSTs

taxonomy/term/1

the server returns

{ "status": true, "content": "\x3cul class=\"menu\"\x3e\n\x3cli class=\"collapsed\"\x3e\x3ca href=\"/taxonomy/term/1\" title=\"View this section\"... }

and Sub-Term A and Sub-Term B are displayed.

When I click on Sub-Term A, the browser POSTs

taxonomy/term/8

but the server returns

{ "status": true, "content": null }

and all of the related JavaScript errors out.

Thoughts?

#7

nedjo - May 3, 2007 - 21:03

Thanks for this valuable debugging info. This does appear to be a bug in taxonomy context. I'll try to track it down when I get a chance. Meantime, help welcome.

#8

bardkerbie - May 4, 2007 - 16:16
Version:5.x-1.x-dev» HEAD

I think the problem might lie in the taxonomy_context_menu_tree() function. My thought is that the first time Activemenu makes a hook_activemenu call for the Taxonomy Context block, everything gets parsed properly. However, on the second call (for sub-terms and children), something is making taxonomy_context_menu_tree() think that it doesn't have a proper context, and therefore return "content: null".

Am I just making conjecture here, or does this make sense? :)

#9

bardkerbie - May 4, 2007 - 21:42
Assigned to:Anonymous» bardkerbie

#10

bardkerbie - May 8, 2007 - 19:27

I found it.

In the taxonomy_context_menu_tree() function,

$terms = $tid ? taxonomy_get_children($tid, $vid) : taxonomy_get_tree($vid, 0, -1, 1);

returns the tree proper when $tid = FALSE, but returns NULL for children when $tid = TRUE.

When we go to assemble the menu, and evaluate if ($terms), it evaluates to FALSE and NULL is returned as the function's output. Hence the error.

My question is this: Why does taxonomy_get_children() puke when run by the activemenu code, but work properly when run the old-fashioned way?

#11

bardkerbie - May 17, 2007 - 16:04

Any thoughts? I've tried slogging though this without any luck.

#12

dami - June 5, 2007 - 04:38

Sorry to interrupt, but I installed JStools and Taxonomy Context. Enabled a context block, however the block is not ajax-expandable like DHTML menu, it still needs page reload on every click...Did I miss anything? thanks.

#13

felixsmile - July 1, 2007 - 08:22

Interesting issue - subscribing

#14

nedjo - July 1, 2007 - 08:29
Title:DHTML in Taxonomy Context» Error when dynamically loading menu items in block

I can't reproduce the issue described here. The menus work for me. So I'm not able to troubleshoot.

@dami, have you enabled activemenu module? It's required for this behavior.

#15

felixsmile - July 1, 2007 - 20:01

Using taxonomy context and activemenu (both HEAD versions, otherwise, I don't get the js functionality in the taxonomy context block), I get an error for empty categories: an http error 404 occurrred /?q=activemenu/tc

Otherwise, I would also think it would be great to have an option that would integrate the context menu inside the navigation tree (well, it wouldn't really be context sensitive anymore, but still great...). I posted a feature request here: http://drupal.org/node/155938.

Have a nice day,

Felix.

#16

Summit - March 20, 2008 - 13:08

Very interested in DHTML menu functionality in taxonomy context.
Any progress in this field?
greetings,
Martijn

#17

Summit - March 20, 2008 - 14:28

Off course the AJAX functionality in the named modules that speeds up the loading time of the categories.
Greetings,
Martijn

 
 

Drupal is a registered trademark of Dries Buytaert.