--- menu.module.bak	2005-09-30 16:05:56.000000000 +1000
+++ menu.module	2005-09-30 20:44:01.000000000 +1000
@@ -65,10 +65,32 @@ function menu_help($section) {
       return t('<p>Enter the name for your new menu. Remember to enable the newly created block in the %blocks administration page.</p>', array('%blocks' => l(t('blocks'), 'admin/block')));
     case 'admin/menu/item/add':
       return t('<p>Enter the title, path, position and the weight for your new menu item.</p>');
+    case 'admin/settings/menu':
+      return t('<p>Customize the menu item settings available when editing nodes.</p>');
   }
 }
 
 /**
+ * Implementation of hook_settings().
+ */
+function menu_settings() {
+  drupal_set_title(t('menu'));
+  $output = '';
+
+  foreach (node_get_types() as $type => $name) {
+    $nodetypes[$type] = $name;
+  }
+  $output .= form_checkboxes(t('Show menu item settings on the following node types'), 'menu_nodes', variable_get('menu_nodes', array()), $nodetypes, t('Check the node types on which you want the menu items settings shown.'), NULL, FALSE);
+  $options = array(0 => t('Root'));
+  $options += menu_parent_options(0);
+  $output .= form_select(t('Available menu items'), 'menu_pid', variable_get('menu_pid', 1), $options, t('Choose the top-level menu item that will be available as a parent. Only this menu item and its children will be shown.'));
+  $output .= form_checkbox(t('Show weight'), 'menu_show_weight', 1, variable_get('menu_show_weight', 0), t('Allow users to set the weight of menu items.'));
+  $output .= form_checkbox(t('Default to expanded'), 'menu_default_expanded', 1, variable_get('menu_default_expanded', 0), t('New menu items will default to showing submenus.'));
+
+  return $output;
+}
+
+/**
  * Implementation of hook_block().
  */
 function menu_block($op = 'list', $delta = 0) {
@@ -99,9 +121,11 @@ function menu_nodeapi(&$node, $op) {
   if (user_access('administer menu')) {
     switch ($op) {
       case 'form post':
-        $edit = $_POST['edit'];
-        $edit['nid'] = $node->nid;
-        return menu_node_form($edit);
+        if (in_array($node->type, (array) variable_get('menu_nodes', ''))) {
+          $edit = $_POST['edit'];
+          $edit['nid'] = $node->nid;
+          return menu_node_form($edit);
+        }
         break;
 
       case 'insert':
@@ -549,12 +573,31 @@ function menu_node_form($edit = array())
   }
 
   $group = form_textfield(t('Title'), 'menu][title', $item['title'], 60, 128, t('The name to display for this link.'));
+  $group .= form_textfield(t('Description'), 'menu][description', $item['description'], 60, 128, t('The description displayed when hovering over a menu item.'));
+  $group .= form_hidden('menu][path', $item['path']);
+  $group .= form_checkbox(t('Expanded'), 'menu][expanded', 1, ($item['type'] & MENU_EXPANDED), t('If selected and this menu item has children, the menu will always appear expanded.'));
+
   // Generate a list of possible parents (not including this item or descendants).
-  $options = menu_parent_options($edit['mid']);
+  $pid = variable_get('menu_pid', 0);
+  $options = array();
+  // if $pid is not root, add it to the option list
+  if ($pid > 0 && isset($menu['items'][$pid])) {
+    $menu = menu_get_menu();
+    $title = $menu['items'][$pid]['title'];
+    if (!($menu['items'][$pid]['type'] & MENU_VISIBLE_IN_TREE)) {
+      $title .= ' ('. t('disabled') .')';
+    }
+    $options[$pid] = $title;
+  }
+  $options += menu_parent_options($edit['mid'], $pid, $depth);
   $group .= form_select(t('Parent item'), 'menu][pid', $item['pid'], $options);
-  $group .= form_hidden('menu][description', $item['description']);
-  $group .= form_hidden('menu][path', $item['path']);
-  $group .= form_hidden('menu][weight', ($item['weight']) ? $item['weight'] : 0);
+
+  if (variable_get('menu_show_weight', 0)) {
+    $group .= form_weight(t('Weight'), 'menu][weight', $item['weight'], 10, t('Optional. In the menu, the heavier items will sink and the lighter items will be positioned nearer the top.'));
+  }
+  else {
+    $group .= form_hidden('menu][weight', ($item['weight']) ? $item['weight'] : 0);
+  }
   $group .= form_hidden('menu][mid', ($item['mid']) ? $item['mid'] : 0);
   $group .= form_hidden('menu][type', ($item['type']) ? $item['type'] : MENU_CUSTOM_ITEM);
 