Index: admin_menu.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/admin_menu/admin_menu.inc,v
retrieving revision 1.55
diff -u -p -r1.55 admin_menu.inc
--- admin_menu.inc	22 Jul 2009 20:32:13 -0000	1.55
+++ admin_menu.inc	23 Jul 2009 22:12:59 -0000
@@ -3,10 +3,46 @@
 
 /**
  * @file
- * Menu build functions for Administration menu.
+ * Menu builder functions for Administration menu.
  */
 
 /**
+ * Build the administration menu as renderable menu links.
+ *
+ * @param $tree
+ *   A data structure representing the administration menu tree as returned from
+ *   menu_tree_all_data().
+ *
+ * @return
+ *   The complete administration menu, suitable for theme_admin_menu_links().
+ *
+ * @see theme_admin_menu_links()
+ * @see admin_menu_menu_alter()
+ */
+function admin_menu_links_menu($tree) {
+  $links = array();
+  foreach ($tree as $data) {
+    // Skip menu callbacks (mostly dynamic items).
+    if (isset($data['link']['type']) && $data['link']['type'] == MENU_CALLBACK) {
+      continue;
+    }
+    // Omit alias lookups.
+    $data['link']['localized_options']['alias'] = TRUE;
+
+    $links[$data['link']['mlid']] = array(
+      '#title' => $data['link']['title'],
+      '#href' => $data['link']['href'],
+      '#options' => $data['link']['localized_options'],
+      '#weight' => $data['link']['weight'],
+    );
+    if ($data['below']) {
+      $links[$data['link']['mlid']] += admin_menu_links_menu($data['below']);
+    }
+  }
+  return $links;
+}
+
+/**
  * Build icon menu links; mostly containing maintenance helpers.
  *
  * @see theme_admin_menu_links()
@@ -15,7 +51,8 @@ function admin_menu_links_icon() {
   $destination = drupal_get_destination();
 
   $links = array(
-    '#weight' => -10,
+    '#theme' => 'admin_menu_links',
+    '#weight' => -100,
   );
   $links['icon'] = array(
     '#title' => theme('admin_menu_icon'),
@@ -124,6 +161,10 @@ function admin_menu_links_icon() {
  * @see theme_admin_menu_links()
  */
 function admin_menu_links_user() {
+  $links = array(
+    '#theme' => 'admin_menu_links',
+    '#weight' => 100,
+  );
   // Add link to show current authenticated/anonymous users.
   $links['user-counter'] = array(
     '#title' => admin_menu_get_user_count(),
Index: admin_menu.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/admin_menu/admin_menu.module,v
retrieving revision 1.88
diff -u -p -r1.88 admin_menu.module
--- admin_menu.module	23 Jul 2009 10:52:29 -0000	1.88
+++ admin_menu.module	23 Jul 2009 22:13:50 -0000
@@ -418,18 +418,20 @@ function admin_menu_output() {
     $content['#prefix'] = '<div id="admin-menu" class="' . $class_site . '"><div id="admin-menu-wrapper"><ul>';
     $content['#suffix'] = '</ul></div></div>';
 
-    // Add menu additions.
+    // Load menu builder functions.
     module_load_include('inc', 'admin_menu');
-    $content['icon'] = admin_menu_links_icon();
-    $content['icon']['#theme'] = 'admin_menu_links';
-    $content['user'] = admin_menu_links_user();
-    $content['user']['#theme'] = 'admin_menu_links';
 
     // Add administration menu.
-    // @todo How can we use #theme here?
-    $content['menu'] = array(
-      '#markup' => admin_menu_tree_output(menu_tree_all_data('management')),
-    );
+    $content['menu'] = admin_menu_links_menu(menu_tree_all_data('management'));
+    $content['menu']['#theme'] = 'admin_menu_links';
+    // Ensure the menu tree is rendered between the icon and user links.
+    $content['menu']['#weight'] = 0;
+    // Do not sort the menu tree, since it already is sorted.
+    $content['menu']['#sorted'] = TRUE;
+
+    // Add menu additions.
+    $content['icon'] = admin_menu_links_icon();
+    $content['user'] = admin_menu_links_user();
 
     // Allow modules to alter the output.
     drupal_alter('admin_menu_output', $content);
@@ -552,82 +554,6 @@ function theme_admin_menu_links(&$elemen
 }
 
 /**
- * Return a rendered menu tree.
- *
- * @param $tree
- *   A data structure representing the tree as returned from
- *   menu_tree_all_data().
- * @param $depth
- *   Current recursion level; internal use only.
- *
- * @return
- *   The complete, rendered administration menu.
- */
-function admin_menu_tree_output($tree, $depth = 0) {
-  $output = '';
-
-  foreach ($tree as $data) {
-    // Skip menu callbacks (mostly dynamic items).
-    if (isset($data['link']['type']) && $data['link']['type'] == MENU_CALLBACK) {
-      continue;
-    }
-    $link = admin_menu_item_link($data['link']);
-
-    if ($data['below']) {
-      $output .= theme_admin_menu_item($link, $data['link']['has_children'], admin_menu_tree_output($data['below'], $depth + 1), $data['link']['in_active_trail']);
-    }
-    else {
-      $output .= theme_admin_menu_item($link, $data['link']['has_children'], '', $data['link']['in_active_trail']);
-    }
-  }
-  // @todo Use $element['#theme'] + $element['#children'] here instead.
-  if ($output) {
-    if ($depth > 0) {
-      $output = "\n<ul>" . $output . '</ul>';
-    }
-  }
-  return $output;
-}
-
-/**
- * High-performance implementation of theme_menu_item_link().
- *
- * This saves us a theme() call and does only the absolute minimum to get
- * the admin menu links rendered.
- *
- * @param $link
- *   A menu item link.
- */
-function admin_menu_item_link($link) {
-  // Omit alias lookups.
-  $link['localized_options']['alias'] = TRUE;
-
-  return '<a href="' . check_url(url($link['href'], $link['localized_options'])) . '">' . (!empty($link['localized_options']['html']) ? $link['title'] : check_plain($link['title'])) . '</a>';
-}
-
-/**
- * Generate the HTML output for a single menu item and submenu.
- *
- * @param $link
- *   A rendered menu item link.
- * @param $has_children
- *   Whether this item has children.
- * @param $menu
- *   A string containing any rendered children of this item.
- * @param $in_active_trail
- *   Whether this item is in the active menu trail.
- *
- * @see theme_menu_item()
- */
-function theme_admin_menu_item($link, $has_children, $menu = '', $in_active_trail = FALSE) {
-  $class = ($menu || $has_children ? 'expandable' : '');
-  if ($in_active_trail) {
-    $class .= ' active-trail';
-  }
-  return '<li' . (!empty($class) ? ' class="' . $class . '"' : '') . '>' . $link . $menu . '</li>';
-}
-
-/**
  * Implementation of hook_translated_menu_link_alter().
  *
  * Here is where we make changes to links that need dynamic information such
Index: admin_menu_toolbar/admin_menu_toolbar.css
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/admin_menu/admin_menu_toolbar/admin_menu_toolbar.css,v
retrieving revision 1.1
diff -u -p -r1.1 admin_menu_toolbar.css
--- admin_menu_toolbar/admin_menu_toolbar.css	19 Jul 2009 04:00:06 -0000	1.1
+++ admin_menu_toolbar/admin_menu_toolbar.css	23 Jul 2009 22:27:02 -0000
@@ -36,23 +36,28 @@ body.admin-menu {
 #admin-menu li.admin-menu-action a {
   border-left: 0;
 }
-#admin-menu ul a {
-  -moz-border-radius: 10px;
-  -webkit-border-radius: 10px;
+#admin-menu ul > li > a {
   border-right: 0;
   margin-bottom: 3px;
   padding: 3px 8px;
 }
-#admin-menu ul a.active-trail {
+#admin-menu ul li.admin-menu-toolbar-category > a {
+  -moz-border-radius: 10px;
+  -webkit-border-radius: 10px;
+}
+#admin-menu ul li.admin-menu-toolbar-category > a.active-trail {
   text-shadow: #333 0 1px 0;
   background: url(/modules/toolbar/toolbar.png) 0 0 repeat-x;
 }
-#admin-menu ul a:hover {
+#admin-menu ul li.admin-menu-toolbar-category > a:hover {
   background-color: #444;
 }
 #admin-menu ul li.admin-menu-tab a {
   border-right: 0;
 }
+#admin-menu li li.expandable ul {
+  margin: -23px 0 0 160px;
+}
 
 /* Shortcuts toggle */
 #admin-menu li.admin-menu-shortcuts {
Index: admin_menu_toolbar/admin_menu_toolbar.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/admin_menu/admin_menu_toolbar/admin_menu_toolbar.module,v
retrieving revision 1.2
diff -u -p -r1.2 admin_menu_toolbar.module
--- admin_menu_toolbar/admin_menu_toolbar.module	22 Jul 2009 20:32:13 -0000	1.2
+++ admin_menu_toolbar/admin_menu_toolbar.module	23 Jul 2009 22:18:14 -0000
@@ -40,6 +40,11 @@ function admin_menu_toolbar_init() {
  * Implementation of hook_admin_menu_output_alter().
  */
 function admin_menu_toolbar_admin_menu_output_alter(&$content) {
+  // Add a class to top-level items for styling.
+  foreach (element_children($content['menu']) as $link) {
+    $content['menu'][$link]['#attributes']['class'][] = 'admin-menu-toolbar-category';
+  }
+
   // Alter user account link.
   $content['user']['account']['#title'] = t('Hello <strong>@username</strong>', array('@username' => $content['user']['account']['#title']));
   $content['user']['account']['#options']['html'] = TRUE;
