Postponed
Project:
Taxonomy Treemenu
Version:
6.x-7.1
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
26 Oct 2009 at 09:22 UTC
Updated:
17 Jun 2011 at 10:11 UTC
Don't know if this is a DHTML menu or Treemenu related bug, but here goes.
I have a Taxonomy Treemenu on which I have enabled the DHTML menus module.
It works just fine, except for one thing. When I click a node and go to the corresponding
page the DHTML menu is collapsed to its initial state which is rather annoying.
This is with DHTML Menu version 6.x-3.5.
Anyone else experiencing this problem?
Comments
Comment #1
rcrowther commentedBasicly - yes! I know! One of my sites works like this.
DHTML Menu version 6.x-3.5 is a shady affair, a radical revision of their approach which had a drastic effect on Treemenu's handling. Treemenu needed a complete re-write to support it. I saw I would need to do some module poking to support this feature, and just didn't have the time to walk that diversion.
If this is an immediate concern, I can't support it. I have a sort of need to know that DHTML Menu is not going to shift their base underneath me, particularly with Drupal 7 imminent. But supporting DHTML Menu is a stated and primary concern of this module, so you can be assured that I will get there, sooner or later.
If someone wants to dive in and figure out how DHTML expands, so how we can pass the data back in, please do!
Probably not the answer you were hoping for, but hopefully lets you consider your strategy with some information on hand.
Rob
Comment #2
joerichsen commentedThank you for your honest reply to my report :-)
I'm a developer myself, so if you give me some pointers on where to look in the code, maybe I could help resolve this problem?
/Jørgen
Comment #3
joerichsen commentedDived into the DHTML menu code and the
has the code
which cause the menu to collapse when a new page is loaded. Further inspection shows the $in_active_trail variable is never true? Is the $in_active_trail a variable passed by Taxonomy Tree Menu?
Comment #4
rcrowther commentedAt present TTM passes nothing back to DHTML Menu! It feeds a complete tree (like menu_all_data) to the screen, to let DHML Menu work its now sophisticated magic.
I recall, though I've never gone into it, that DHTML Menu uses the cookie to recall the current state of data.
Programming questions become - what is that variable? If we know where the tree is going (from the cookie), why do we need to know anything more about the trail? And where is the variable sourced?
And how about just hacking the variable true, to see what will happen?
Sorry my replies are slow - I have external concerns right now...
Rob
Comment #5
joerichsen commentedOK, I will try to explain what I see.
I have a taxonomy that looks like this
And with nodes and it looks like this
If I look at the HTML in Firebug when the tree has manually been fully expanded it looks like this
And the dhtml_menu cookie value is
_menu-126,_menu-128,_menu-127.When I click "Super Product 1" it displays the page for "Super Product 1" and the menu is collapsed.
The cookie still has the same values but the html looks like this
ie. the outermost menu item is collapsed and not expanded. One thing to note is that the "Subcategory" is in fact correctly expanded - but it is hidden by the collapsed "Product1" parent.
Why the outermost menu item is collapsed and the sub menu items seem to be expanded correctly is beyond me so any help is really appreciated :-)
Btw. wrt. your previous comment, if I set
$in_active_trailtotrueit expands the whole tree all the time./Jørgen
Comment #6
joerichsen commentedHmm, now I have a working hack. DHTML menus seem to have some sort of stack for the menus and if I comment out the line
if the function
dhtml_menu_theme_menu_item_linkin
dhtml_menu.moduleit seems to work.Further inspection shows that I have the "Show nodes" setting enabled, Treemenu will create menu items with an empty menu name, hence not pushing it onto the DHTML menu stack, but it will happily try to pop them from the stack, get a NULL value and this will eventually lead to the collapsed outermost menu level.
I don't know if what I just wrote makes any sense to anybody else but me, but feel free to ask questions :-)
/Jørgen
Comment #7
joerichsen commentedAnother way to fix this problem is to add
to line 3076 in
taxonomy_treemenu.moduleright after$node_element['mlid'] = $mlid;
/Jørgen
Comment #8
rcrowther commentedYou've got my attention alright! I would have love to turn Firebug loose on DHTML Menu, but I did see the stacking and so forth, which is why I backed off at the point I did. I had the new works-with-any-module menu routing to build.
Do you think this is a solid fix? Admit I don't understand it yet, or ramifications. "Treemenu will create menu items with an empty menu name" sounds like it could use a fix anyhow?
Rob
Comment #9
joerichsen commentedI am by no means an expert in Drupal's menu system but I think that adding a menu_name attribute to the node menu items should do no harm. And it fixes the problem so I'm happy :-)
The comment
just before the line I added, seems to suggest that adding menu_name could be useful.
/Jørgen
Comment #10
rcrowther commentedHi joerichsen,
Being an expert is no substitute for being thoughtful, and contributions, in my book!
Especially as you've done some work, I'd just like to explain why work on Treemenu is near impossible for me right now.
My flatmate and friend recently suffered a total physical collapse (in another country). She's been hospitalized, and apart from being troubled about her health, this means I am very close to loosing the flat, which would make me homeless.
Hope you don't mind the personal note.
So, I'm sure you'd like this tomorrow, but given my situation, would it be ok if we delay for a while? I can't say how long, but if you have some time, I'd appreciate it.
Rob
Comment #11
joerichsen commentedSorry about you friend :-(
I have patched my local copy of Treemenu and it works fine, so I'm not in a hurry.
Hope your friend gets better (and that you don't loose the flat).
Take care.
/Jørgen
Comment #12
fschaff commentedHi, I have the same problem
So I tried the #7 fix but it doesn't fix it.
No change
Is there something else to do ?
Thanks
Comment #13
fschaff commentedPlease, I really need your help
Have you got a fix ?
Thanks!
Comment #14
joerichsen commentedI have received a number of requests for my patched version.
It is based on 6.x-7.1 and can be downloaded here:
http://www.erichsen.net/taxonomy_treemenu.zip
/Jørgen
Comment #15
rcrowther commentedFirst, thankyou /Jørgen for making stuff available. Good work.
I've only just gained the internet again, and it's a bad connection. I've lost the Windows computer I shared for testing. The much regretted switch of ISP has left my development environments in disarray. Due to a Drupal security alert I havn't even re-established connection to my own cvs account (if you know what I'm talking about). The operating system me and my friend have left is Ubuntu, which we use as LTS, and is due for upgrade, so both of us have a massive amount of work to salvage and backup nearly three years of projects (far more than just TTM).
This is some of the background as to why /Jørgen's patch will not be committed soon - I can't test, let alone upload.
However, I have faith in /Jørgen's solution, we were talking about it when the real world came to get me, and I recommend anyone who would like this fix to try the download.
Rob
Comment #16
amin.nasiri commentedThanks for providing this fix. After adding this, all terms are always expanded, and there is no way to collapse them. I have a long menu and this is kinda annoying. Is this how the fix works? expands all items all the time? Or am I doing something wrong?
thanks a lot!
Comment #17
kiril-daedalus commentedunfortunatly, no change for me with this patch, the node link has the "active" class but the menu is still collapsed :(
any ideas ?
Comment #18
bekirdag commentedDrupal checks {menu_links} table to check if current page's path related with another. And in_active_trail returns true.
But drupal does not adds menu trails for terms of a node, so the menu shows collapsed in the node page.
Solution:
http://drupal.org/project/taxonomy_menu_trails
This module adds that trails for "taxonomy menu module". Works like a charm.
Comment #19
tedcamaro commentedI haven't had any luck with Taxonomy Menu Trails keeping my DHTML enabled Taxonomy Treemenu from collapsing when you click through to a node. Can you clarify whether or not you were using DHTML Menu and whether any customization or specific Taxonomy Menu Trails menu options that you found were successful?
Thanks