Port Admin Menu to 6.x
yched - March 30, 2007 - 17:22
| Project: | Drupal Administration Menu |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | task |
| Priority: | critical |
| Assigned: | sun |
| Status: | patch (code needs work) |
Description
Er, I know D6 is still very beta, so I might be just pushing it, but the absence of a nice admin menu makes it so tedious to develop for D6 currently, that it would be really neat to have the module updated for the new menu system :-)

#1
I had a quick look at the new menu system. First of all - bad news: The global variable
$_menudoes not exist anymore. It seems that there's no function yet designed to retrieve (and alter) the complete, expanded menu tree.This is shocking… Because until now the main advantage of admin_menu was that it doesn't alter the menu in any way. We might need to completely rewrite the module to extract administrative menu items to a new menu at installation time.
I'll greatly appreciate any input and/or patches from anyone having deeper insights into the new menu system.
#2
After talking to chx on IRC the new menu system will have a hook_menu_alter() that will allow the operations needed for admin_menu. However, the hook still is under heavy development, so we'll have to wait until there is a solid ground on which we can base this update.
#3
OK, thanks for following this :-)
#4
Since Drupal 6 beta is about to be released, Admin Menu should be available ASAP.
Currently, I'm very busy with several projects, so if anyone has successfully or unsuccessfully attempted to port Admin Menu for 6.x I would be glad to test, review, fix or commit any patch. :)
#5
First try. Includes plenty of debug code.
Critical issue: menu_links does not contain any local tasks. In this patch, I've tried to retrieve them manually through a crude database query. Even if this could work out somehow, we'd still have an unresolved issue regarding adding and altering menu items.
A completely different approach could be:
#6
subscribing and so sad to have started a multi install in d6 without checking on this module.. so sad..
#7
I just loaded up a brand spanking new multi-site dev environment based on D6. I'm no coder, but I 'm a big fan of this module and would love to contribute testing. Should I start with the patch posted here, which is probabably out-of-date already, or will a 6.x-dev be available sometime soon? FYI I"m windows based and have access to FF2, IE6, and IE7 for testing purposes.
#8
@WorldFallz: Patch in #5 should still apply, but the outlined problems remain.
#9
subscribing
#10
subscribing
#11
New patch with improvements by smk-ka. Displays some local tasks (not all).
#12
sorry to ask here, but i'm interested by the patch and this time there's just too many things to modify:
how can I apply a patch file to a module file? which software do you use to automatically remove/add the lines in the patch?
Cheers,
James
#13
@alliax: See http://drupal.org/patch/apply
#14
subscribing. cheers!
#15
Is it supposed to spit the menu out at the bottom in a unordered list format (does so with multiple core themes)? Just wondering, because my patch might of applied incorrectly. I didn't get any errors, but I had to get some old versions of files (admin_menu.info, .module, .inc) from CVS because the patch was out of date since it was created for an old dev version no longer available on the releases page.
#16
subscribing.
#17
i would be happy to test :) patching fails with 5.x-dev and 2.4 :(
#18
I also tried tthe patch on 2.4: 3 out of seven hunks failed :( Daniel, gib dir einen Ruck, wir wollen doch auch in Drupal 6 aminmenuisieren - sorry for the german interlude
#19
I would think you can do
<?php$item = db_fetch_array(db_query("SELECT mlid FROM {menu_links} WHERE link_path = 'admin' AND menu_name = 'navigation'"));
menu_tree_all_data('navigation', $item);
?>
#20
Yay! Admin Menu rules!
Subscribing. Patch in 11 failed for me on 5.x-2.x-dev
patch < admin_menu_7.patchpatching file admin_menu.inc
Hunk #1 FAILED at 19.
Hunk #2 succeeded at 171 with fuzz 1 (offset 3 lines).
Hunk #3 succeeded at 188 (offset 3 lines).
Hunk #4 succeeded at 208 (offset 3 lines).
Hunk #5 succeeded at 216 with fuzz 1 (offset 3 lines).
Hunk #6 FAILED at 227.
Hunk #7 succeeded at 270 with fuzz 2 (offset 18 lines).
2 out of 7 hunks FAILED -- saving rejects to file admin_menu.inc.rej
patching file admin_menu.info
Hunk #1 FAILED at 2.
1 out of 1 hunk FAILED -- saving rejects to file admin_menu.info.rej
patching file admin_menu.module
Hunk #1 succeeded at 14 with fuzz 1.
Hunk #2 FAILED at 29.
Hunk #3 FAILED at 71.
Hunk #4 FAILED at 97.
Hunk #5 succeeded at 345 with fuzz 1 (offset 36 lines).
Hunk #6 succeeded at 361 (offset 36 lines).
Hunk #7 succeeded at 410 (offset 34 lines).
3 out of 7 hunks FAILED -- saving rejects to file admin_menu.module.rej
#21
Re-rolled patch against latest HEAD.
@chx: Thanks for your input! I've added your proposed code to admin_menu_tree_all_data(), commented-out for now, because:
<?php$item_admin = db_fetch_array(db_query("SELECT * FROM {menu_links} WHERE router_path = 'admin'"));
menu_tree_all_data('navigation', $item_admin);
?>
returns all top level items of the 'navigation' menu instead of all items below the 'admin[ister]' menu item. However, we could work around this later.
The real question is: I do not understand, why the menu system only returns the top level items below 'admin' (i.e. "Content management", "Site building", aso.), but not all menu items below 'admin'.
If only 'mlid' is selected, it doesn't return any items below 'admin' at all.
#22
Patch fails for me on admin_menu.info
patch < admin_menu_8.patchpatching file admin_menu.inc
patching file admin_menu.info
Hunk #1 FAILED at 2.
1 out of 1 hunk FAILED -- saving rejects to file admin_menu.info.rej
patching file admin_menu.module
But I got it working by manually applying the changes (woo hoo!). Some notes:
Thanks for working on this! I'm just working on porting my site over to D6 and this will make it much easier!
#23
Subscribing. Any issues with the latest patch?
#24
hello,
As many others here I really miss the admin menu on drupal 6, so should we ALL send few dollars with Paypal to expect getting it faster?
As this is the only thread about admin menu that I read I don't know so much about the future development of this menu for Drupal 6, so, sorry if I wrote something that had been discussed before.
Thanks anyway for this great module!
#25
wwwoliondorcom, yes, that is probably the best idea to push this port. I've created a ChipIn for Drupal Administration Menu Port for D6, so everyone interested in this port can throw a few bucks in. I did not add a limit, however, due to the already identified issues regarding the new menu system this port will require a lot of hard work, maybe even a complete rewrite of the module.
#26
I use this patch for 2.4 but got the error message:
patching file admin_menu.incpatching file admin_menu.info
Hunk #1 FAILED at 2.
1 out of 1 hunk FAILED -- saving rejects to file admin_menu.info.rej
patching file admin_menu.module
And I also use this patch for 2008-Mar-20 version but still got error.
patching file admin_menu.incpatching file admin_menu.info
Hunk #1 FAILED at 2.
1 out of 1 hunk FAILED -- saving rejects to file admin_menu.info.rej
patching file admin_menu.module
Hunk #2 FAILED at 48.
1 out of 7 hunks FAILED -- saving rejects to file admin_menu.module.rej
#27
As written above, patch in #21 is against latest code in HEAD (in CVS).
#28
Sorry, I just download the CVS but still get error.
patching file admin_menu.incpatching file admin_menu.info
patching file admin_menu.module
Hunk #2 FAILED at 48.
1 out of 7 hunks FAILED -- saving rejects to file admin_menu.module.rej
#29
Re-rolled patch against latest HEAD. Applies on a fresh CVS checkout only.
#30
Applied patch in#29 to the latest CVS versions (cherry-picked from the repository since I don't know what I'm doing in there). No errors. The only issue I'm seeing at this point is that the favicon, logged users, and logout items are not displaying. Otherwise, the admin menus are working fine.
#31
I applied patch #29 too, I think it's ok, thanks. How about release a snapshot for D6 and more people can help to test.
#32
Sorry guys, it seems you got it wrong - please read comments #1 and #25 again. This port is far from complete, and if above patch partially works for you, that is caused by coincidence. In case you intend to use this on a production site, I do not recommend this, because there will be no support if something goes wrong.
#33
Daniel, my comment wasn't meant to indicate that the patched module works perfectly; it was meant to offset the prior 7 comments indicating problems with the patch. You'll be happy to know that beyond the issues I mentioned, some of the menus do not have all the submenus I expect. :-)
Still, it's worth using on my 6.x sites because I'm still more productive.
#34
Maybe we should chip in some money http://unleashedmind.chipin.com/drupal-administration-menu-port-for-d6 to give Daniel a strong incentive to investigate the depth of the new menu system ;) As seen from his comments, patches simply won't do. I fully understand that a maybe complete rewrite exceeds what he can do in his spare time.
#35
Definitely! I've added my few hundred cents to ti ;-)
#36
Just a reroll of patch #29 against HEAD (besides some fuzz, one hunk failed).
The port is still somewhat feature incomplete, but the most important things seem to work well enough for testing and maybe non-production usage.
#37
subscribing
#38
Subscribing.
#39
patch works for me... only basic functions, but it makes working so much nicer. Maybe we can release a first alpha version for D6 as I believe there will be lots of testers and a lot of users will appreciate it (even though some of the nice functionality is not in yet)
#40
+1 to the patch in #36. Without the bells and whistles of the added local tasks, but still far better than any other admin option out there.
#41
tracking
#42
yes, if someone could post somewhere on the net the latest dev module file with the patch applied on it, it will be so fine. Anything like admin menu on D6 will be better than nothing or than this other module, I forgot the name but it was not good.
#43
Last patch by Pancho (#36) was incomplete.
Re-rolled patch in #29 against latest HEAD. Applies on a fresh CVS checkout only.
I'll clean-up the existing code now and create a DRUPAL-6--1 branch, along with a development snapshot for 6.x. However, comment #32 still applies.
#44
http://drupal.org/node/251566 should be available within the next 12 hours.
#45
drupal.org/node/251566: access is denied to that node.
#46
> Last patch by Pancho (#36) was incomplete.
Not a big thing, but I can't see why my patch should have been incomplete. It's been just slightly smaller, because Eclipse doesn't support the -p flag in diff.
#47
@Pancho: Sorry, I was wrong. My diff tool was confused because the order of files in your patch was different.
#48
Thank you very much for putting something for D6 even if not as useful as for D5, it's a timesaver anyway! Thanks.
#49
great that a D6 version is available! even if it hasn't got all functionalities, I feel much more at home on my website again!
Joris
#50
smk-ka and I spent some hours on this port this evening. Attached patch re-introduces base-functionality of Drupal Administration Menu we already had in Drupal 4.7.x. This means all local tasks in the administrative menu are back again. Additional improvements like direct access to create content items and all other add-ons are still missing.
Beware that your database user needs to have sufficient permissions to create temporary tables, and, this patch requires the MyISAM table engine currently.
This will hopefully change in an upcoming code-sprint. Currently, we are investigating the idea to store a mix of menu_router, menu_links, and hook_admin_menu() items in a new admin_menu table to eliminate the need for a temporary table.
Additionally, caching has been re-enabled. This will save you approx. 100ms on each page request.
While I really would like to get some feedback on this patch, I recommend to not use it unless you know how to revert your module to the last official release.
#51
Since this port still needs much work and the previous ChipIn somehow ended too early:
http://unleashedmind.chipin.com/drupal-administration-menu-port-for-d6-2
Thanks to all who have contributed until now!