=== modified file 'modules/menu/menu.admin.inc'
--- modules/menu/menu.admin.inc	2007-11-11 06:56:44 +0000
+++ modules/menu/menu.admin.inc	2007-11-17 16:04:48 +0000
@@ -229,19 +229,11 @@ function menu_edit_item(&$form_state, $t
   );
 
   // Generate a list of possible parents (not including this item or descendants).
-  $options = menu_parent_options(menu_get_menus(), $item);
   $default = $item['menu_name'] .':'. $item['plid'];
   if (!isset($options[$default])) {
     $default = 'navigation:0';
   }
-  $form['menu']['parent'] = array(
-    '#type' => 'select',
-    '#title' => t('Parent item'),
-    '#default_value' => $default,
-    '#options' => $options,
-    '#description' => t('The maximum depth for an item and all its children is fixed at !maxdepth.  Some menu items may not be available as parents if selecting them would exceed this limit.', array('!maxdepth' => MENU_MAX_DEPTH)),
-    '#attributes' => array('class' => 'menu-title-select'),
-  );
+  $form['menu'] += menu_parent_select($form_state, $item['mlid']);
   $form['menu']['weight'] = array(
     '#type' => 'weight',
     '#title' => t('Weight'),

=== modified file 'modules/menu/menu.module'
--- modules/menu/menu.module	2007-11-09 22:14:40 +0000
+++ modules/menu/menu.module	2007-11-17 16:04:48 +0000
@@ -189,54 +189,67 @@ function menu_load($menu_name) {
   return db_fetch_array(db_query("SELECT * FROM {menu_custom} WHERE menu_name = '%s'", $menu_name));
 }
 
-/**
- * Return a list of menu items that are valid possible parents for the given menu item.
- *
- * @param $menus
- *   An array of menu names and titles, such as from menu_get_menus().
- * @param $item
- *   The menu item for which to generate a list of parents.
- *   If $item['mlid'] == 0 then the complete tree is returned.
- * @return
- *   An array of menu link titles keyed on the a string containing the menu name
- *   and mlid. The list excludes the given item and its children.
- */
-function menu_parent_options($menus, $item) {
-
-  // If the item has children, there is an added limit to the depth of valid parents.
-  if (isset($item['parent_depth_limit'])) {
-    $limit = $item['parent_depth_limit'];
-  }
-  else {
-    $limit = _menu_parent_depth_limit($item);
-  }
-
-  foreach ($menus as $menu_name => $title) {
-    $tree = menu_tree_all_data($menu_name, NULL);
-    $options[$menu_name .':0'] = '<'. $title .'>';
-    _menu_parents_recurse($tree, $menu_name, '--', $options, $item['mlid'], $limit);
+function menu_parent_select(&$form_state, $mlid) {
+  $collapsed = TRUE;
+  if (isset($form_state['storage']['mlid'])) {
+    $mlid = $form_state['storage']['mlid'];
+    $collapsed = FALSE;
+    unset($form_state['storage']['mlid']);
+  }
+  $item = menu_link_load($mlid);
+  $tree = menu_tree_all_data($item['menu_name'], $item);
+  $form['parents'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Parents'),
+    '#collapsible' => TRUE,
+    '#collapsed' => $collapsed,
+  );
+  $form['parents'] += _menu_parent_select_recurse($tree);
+  $form['parents']['parent_submit'] = array(
+    '#type' => 'submit',
+    '#value' => t('Update'),
+    '#submit' => array('_menu_parent_selector_update'),
+  );
+  return $form;
+}
+
+function _menu_parent_select_recurse($tree) {
+  static $form = array('#tree' => TRUE);
+  foreach ($tree as $item) {
+    if (isset($item['link'])) {
+      $link = $item['link'];
+      if (!$link['hidden']) {
+        $plid = $link['plid'];
+        $mlid = $link['mlid'];
+        if (!isset($form[$plid])) {
+          $form[$plid]['select'] = array(
+            '#type' => 'select',
+            '#default_value' => -1,
+            '#options' => array(-1 => t('Disregard this level')),
+          );
+          $form[$plid]['#depth'] = $link['depth'];
+        }
+        $form[$plid]['select']['#options'][$mlid] = $link['title'];
+        if ($link['in_active_trail']) {
+          $form[$plid]['select']['#default_value'] = $mlid;
+        }
+      }
+    }
+    if (!empty($item['below'])) {
+      _menu_parent_select_recurse($item['below']);
+    }
   }
-  return $options;
+  return $form;
 }
 
-/**
- * Recursive helper function for menu_parent_options().
- */
-function _menu_parents_recurse($tree, $menu_name, $indent, &$options, $exclude, $depth_limit) {
-  foreach ($tree as $data) {
-    if ($data['link']['depth'] > $depth_limit) {
-      // Don't iterate through any links on this level.
-      break;
-    }
-    if ($data['link']['mlid'] != $exclude && $data['link']['hidden'] >= 0) {
-      $title = $indent .' '. truncate_utf8($data['link']['title'], 30, TRUE, FALSE);
-      if ($data['link']['hidden']) {
-        $title .= ' ('. t('disabled') .')';
-      }
-      $options[$menu_name .':'. $data['link']['mlid']] = $title;
-      if ($data['below']) {
-        _menu_parents_recurse($data['below'], $menu_name, $indent .'--', $options, $exclude, $depth_limit);
-      }
+function _menu_parent_selector_update($form, &$form_state) {
+  $form_state['rebuild'] = TRUE;
+  $min_depth = MENU_MAX_DEPTH + 1;
+  foreach (element_children($form['menu']['parents']) as $plid) {
+    $element = $form['menu']['parents'][$plid];
+    if (isset($element['select']) && $element['select']['#default_value'] != $element['select']['#value'] && $element['select']['#value'] > 0 && $element['#depth'] < $min_depth) {
+      $form_state['storage']['mlid'] = $element['select']['#value'];
+      $min_depth = $element['#depth'];
     }
   }
 }

