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

sun - March 30, 2007 - 19:53
Title:update for D6 ?» Update Admin Menu for 6.x
Version:4.7.x-1.x-dev» 5.x-1.x-dev

I had a quick look at the new menu system. First of all - bad news: The global variable $_menu does 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

sun - April 2, 2007 - 17:30
Status:active» postponed

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

yched - April 2, 2007 - 17:40

OK, thanks for following this :-)

#4

sun - September 2, 2007 - 02:51
Title:Update Admin Menu for 6.x» Port Admin Menu to 6.x
Priority:normal» critical
Status:postponed» active

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

sun - December 9, 2007 - 17:34
Version:5.x-1.x-dev» 5.x-2.x-dev
Status:active» patch (code needs work)

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:

  1. Invoke menu_router_build() to get a "copy" of the current menu structure (cached).
  2. Perform alterations on this structure.
  3. Implement a fork of _menu_navigation_links_rebuild().
  4. Implement a magic function which turns this structure into a menu tree, like menu_tree_output() expects it.
AttachmentSize
admin_menu.patch20.81 KB

#6

alliax - February 16, 2008 - 00:36

subscribing and so sad to have started a multi install in d6 without checking on this module.. so sad..

#7

WorldFallz - February 18, 2008 - 21:20

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

sun - February 19, 2008 - 14:27

@WorldFallz: Patch in #5 should still apply, but the outlined problems remain.

#9

keesje76 - February 19, 2008 - 19:24

subscribing

#10

koorneef - February 21, 2008 - 08:49

subscribing

#11

sun - February 23, 2008 - 01:47

New patch with improvements by smk-ka. Displays some local tasks (not all).

AttachmentSize
admin_menu.patch19.73 KB

#12

alliax - February 23, 2008 - 06:16

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

sun - February 23, 2008 - 07:40

#14

ekendra - February 23, 2008 - 09:20

subscribing. cheers!

#15

manerhabe - February 26, 2008 - 04:46

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

derjochenmeyer - February 28, 2008 - 16:04

subscribing.

#17

derjochenmeyer - February 28, 2008 - 16:16

i would be happy to test :) patching fails with 5.x-dev and 2.4 :(

#18

eigentor - March 7, 2008 - 21:33

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

chx - March 12, 2008 - 21:36

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

cubbtech - March 12, 2008 - 23:29

Yay! Admin Menu rules!

Subscribing. Patch in 11 failed for me on 5.x-2.x-dev

patch < admin_menu_7.patch
patching 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

sun - March 13, 2008 - 19:04

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.

AttachmentSize
admin_menu.patch21.88 KB

#22

cubbtech - March 18, 2008 - 18:05

Patch fails for me on admin_menu.info

patch < admin_menu_8.patch
patching 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:

  • 'Tools' links to admin/build/views (not what I expected?)
  • 'Settings' links to admin/build/menu (again, not what I expected? just wondering if this functionality is by design)
  • Hovering over a menu item now shows the url in the status bar in Firefox 2 (sweet!)

Thanks for working on this! I'm just working on porting my site over to D6 and this will make it much easier!

#23

stephen.colson - March 26, 2008 - 18:27

Subscribing. Any issues with the latest patch?

#24

wwwoliondorcom - April 3, 2008 - 15:54

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

sun - April 3, 2008 - 17:30
Assigned to:Anonymous» sun

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

dennys - April 4, 2008 - 05:21

I use this patch for 2.4 but got the error message:

patching 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

And I also use this patch for 2008-Mar-20 version but still got error.

patching 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
Hunk #2 FAILED at 48.
1 out of 7 hunks FAILED -- saving rejects to file admin_menu.module.rej

#27

sun - April 4, 2008 - 17:55

As written above, patch in #21 is against latest code in HEAD (in CVS).

#28

dennys - April 4, 2008 - 23:45

Sorry, I just download the CVS but still get error.

patching file admin_menu.inc
patching 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

sun - April 6, 2008 - 15:36

Re-rolled patch against latest HEAD. Applies on a fresh CVS checkout only.

AttachmentSize
admin_menu.patch21.74 KB

#30

mrtoner - April 6, 2008 - 22:46

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

dennys - April 7, 2008 - 14:58

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

sun - April 7, 2008 - 20:38

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

mrtoner - April 8, 2008 - 02:21

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

eigentor - April 8, 2008 - 04:42

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

robertgarrigos - April 14, 2008 - 14:28

Definitely! I've added my few hundred cents to ti ;-)

#36

Pancho - April 17, 2008 - 13:29
Category:feature request» task

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.

AttachmentSize
admin_menu_d6.patch21.17 KB

#37

jamm - April 19, 2008 - 16:35

subscribing

#38

ardee - April 21, 2008 - 19:16

Subscribing.

#39

rapsli - April 22, 2008 - 13:14

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

WorldFallz - April 22, 2008 - 15:58

+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

IceCreamYou - April 25, 2008 - 22:40

tracking

#42

alliax - April 26, 2008 - 06:51

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

sun - April 26, 2008 - 15:38

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.

AttachmentSize
admin_menu.patch21.48 KB

#44

sun - April 26, 2008 - 16:40

http://drupal.org/node/251566 should be available within the next 12 hours.

#45

eigentor - April 26, 2008 - 21:33

drupal.org/node/251566: access is denied to that node.

#46

Pancho - April 27, 2008 - 16:57

> 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

sun - April 27, 2008 - 19:13

@Pancho: Sorry, I was wrong. My diff tool was confused because the order of files in your patch was different.

#48

alliax - April 27, 2008 - 21:01

Thank you very much for putting something for D6 even if not as useful as for D5, it's a timesaver anyway! Thanks.

#49

joris.verschueren - April 28, 2008 - 15:07

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

sun - May 3, 2008 - 04:17
Version:5.x-2.x-dev» 6.x-1.x-dev

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.

AttachmentSize
admin_menu.patch7.39 KB

#51

sun - May 7, 2008 - 23:21

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!

 
 

Drupal is a registered trademark of Dries Buytaert.