? admin_menu.content-types.patch
? admin_menu_14.patch
? cleanup-D6-132524-75.patch
? cleanup-D6-132524-78.patch
? cleanup-D6-132524-82.patch
? cleanup-D6-132524-84.patch
Index: admin_menu.inc
===================================================================
RCS file: /cvs/drupal/contributions/modules/admin_menu/admin_menu.inc,v
retrieving revision 1.12
diff -u -p -r1.12 admin_menu.inc
--- admin_menu.inc	7 Jun 2008 16:33:58 -0000	1.12
+++ admin_menu.inc	8 Jun 2008 01:28:20 -0000
@@ -19,7 +19,7 @@ function _admin_menu_rebuild_links() {
       }
     }
   }
-  admin_menu_adjust_items($menu_links, $sort);
+  $deleted = admin_menu_adjust_items($menu_links, $sort);
   if ($menu_links) {
     // Make sure no child comes before its parent.
     array_multisort($sort, SORT_NUMERIC, $menu_links);
@@ -33,7 +33,7 @@ function _admin_menu_rebuild_links() {
   // Allow modules to add more links. If you want to alter links saved by
   // admin_menu, use hook_menu_link_alter() and look for
   // $item['module'] == 'admin_menu'
-  $links = module_invoke_all('admin_menu');
+  $links = module_invoke_all('admin_menu', $deleted);
   foreach ($links as $item) {
     admin_menu_link_save($item);
   }
@@ -77,10 +77,15 @@ function admin_menu_link_save($item) {
 
 /**
  * Implementation of hook_admin_menu().
+ *
+ * @param &$deleted
+ *   Array of links under admin/* that were removed by admin_menu_adjust_items().
+ *   If one of these links is added back, it should be removed from the array.
  */
-function admin_menu_admin_menu() {
+function admin_menu_admin_menu(&$deleted) {
   global $base_url;
 
+  $links = array();
   $icon_path = drupal_get_normal_path(variable_get('site_frontpage', 'node'));
 
   // Add 'administer' item to the icon menu.
@@ -105,7 +110,15 @@ function admin_menu_admin_menu() {
     'parent_path' => $icon_path,
   );
 
-  // Add links to drupal.org.
+  // Move 'By module' item into Site configuration.
+  if (isset($deleted['admin/by-module'])) {
+    $deleted['admin/by-module']['parent_path'] = 'admin/settings';
+    $deleted['admin/by-module']['weight'] = -10;
+    $links[] = $deleted['admin/by-module'];
+    unset($deleted['admin/by-module']);
+  }
+
+  // Add link to drupal.org.
   $links[] = array(
     'title' => 'Drupal.org',
     'path' => 'http://drupal.org',
@@ -131,6 +144,7 @@ function admin_menu_admin_menu() {
       'parent_path' => 'http://drupal.org',
     );
   }
+
   // Add 'Create <content-type>' items to Content management menu.
   $links[] = array(
     'title' => 'Create content',
@@ -138,15 +152,38 @@ function admin_menu_admin_menu() {
     'weight' => -100,
     'parent_path' => 'admin/content',
   );
+  // Make sure longer paths are after shorter ones
+  ksort($deleted);
   foreach (node_get_types('types', NULL, TRUE) as $type) {
     $type_url_str = str_replace('_', '-', $type->type);
-    $path = 'node/add/'. $type_url_str;
     $links[] = array(
       'title' => $type->name,
-      'path' => $path,
+      'path' => 'node/add/'. $type_url_str,
       'weight' => -100,
       'parent_path' => 'node/add',
     );
+    $type_path = 'admin/content/node-type/'. $type_url_str;
+    $links[$type_path] = array(
+      'title' => 'Edit @nodetype',
+      'path' => $type_path,
+      'parent_path' => 'admin/content/types',
+      'options' => array('t' => array('@nodetype' => $type->name)),
+    );
+    unset($deleted['admin/content/node-type/'. $type_url_str .'/edit']);
+    // CCK and other modules adding to node types handled here
+    foreach($deleted as $path => $item) {
+      if (strpos($path, $type_path) !== FALSE) {
+        $i = $item['_number_parts'] - 1;
+        do {
+          $parent_path = implode('/', array_slice($item['_parts'], 0, $i));
+          --$i;
+        } while (!isset($links[$parent_path]) && $i);
+        // Logically, parent path can never go shorter than $type_path
+        $item['parent_path'] = $parent_path;
+        $links[$path] = $item;
+        unset($deleted[$path]);
+      }
+    }
   }
 
   // Add devel module links
@@ -195,21 +232,26 @@ function admin_menu_admin_menu() {
  * @param array $sort
  *   An array containing the # parts of each link - must be updated if a link
  *   is added.
+ * @return
+ *   An array of links that were removed from $menu_links.
  */
 function admin_menu_adjust_items(&$menu_links, &$sort) {
   global $user, $base_url;
   $links = array();
+  $deleted = array();
 
   // Change or remove items, or add new top-level items
-  $add_links['admin/by-module'] = $menu_links['admin/by-module'];
+  $deleted['admin/by-module'] = $menu_links['admin/by-module'];
   unset($menu_links['admin/by-module'], $sort['admin/by-module']);
+  $deleted['admin/by-task'] = $menu_links['admin/by-task'];
   unset($menu_links['admin/by-task'], $sort['admin/by-task']);
 
-  // Remove "edit" links
-  foreach (node_get_types('types', NULL, TRUE) as $type) {
-    $type_url_str = str_replace('_', '-', $type->type);
-    $path = 'admin/content/node-type/'. $type_url_str .'/edit';
-    unset($menu_links[$path], $sort[$path]);
+  // Remove links under admin/content/node-type/
+  foreach ($menu_links as $path => $link) {
+    if (strpos($path, '/content/node-type/')) {
+      $deleted[$path] = $link;
+      unset($menu_links[$path], $sort[$path]);
+    }
   }
 
   // Add the icon containing special links.
@@ -229,10 +271,10 @@ function admin_menu_adjust_items(&$menu_
     'options' => array('extra class' => 'admin-menu-action admin-menu-icon admin-menu-users', 'html' => TRUE),
   );
   $links[] = array(
-    'title' => 'Log out',
+    'title' => 'Log out @username',
     'path' => 'logout',
     'weight' => -100,
-    'options' => array('extra class' => 'admin-menu-action admin-menu-logout'),
+    'options' => array('extra class' => 'admin-menu-action admin-menu-logout', 't' => array('@username' => $GLOBALS['user']->name)),
   );
   foreach ($links as $item) {
     $path = $item['path'];
@@ -241,6 +283,6 @@ function admin_menu_adjust_items(&$menu_
     $sort[$path] = 1;
   }
 
-  return;
+  return $deleted;
 }
 
Index: admin_menu.module
===================================================================
RCS file: /cvs/drupal/contributions/modules/admin_menu/admin_menu.module,v
retrieving revision 1.44
diff -u -p -r1.44 admin_menu.module
--- admin_menu.module	7 Jun 2008 16:33:58 -0000	1.44
+++ admin_menu.module	8 Jun 2008 01:28:20 -0000
@@ -269,6 +269,10 @@ function admin_menu_translated_menu_link
   if ($extra = variable_get('admin_menu_display', 0)) {
     $item['title'] .= ' '. $extra[0] .': '. $item[$extra];
   }
+  // Handle items that need dynamic localization/replacement.
+  if (isset($item['options']['t'])) {
+    $item['title'] = t($item['title'], $item['options']['t']);
+  }
   if ($item['title'] == 'icon_users') {
     // Add count of active anonymous/authenticated users.
     // @see user_block(), user.module
