? menu-and-path-keep-node-values-with-preview.patch
? sites/default/files
? sites/default/settings.php
Index: modules/menu/menu.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/menu/menu.module,v
retrieving revision 1.229
diff -u -p -r1.229 menu.module
--- modules/menu/menu.module	7 Mar 2010 07:55:14 -0000	1.229
+++ modules/menu/menu.module	15 May 2010 17:29:59 -0000
@@ -589,8 +589,17 @@ function menu_form_alter(&$form, $form_s
   if (!empty($form['#node_edit_form'])) {
     // Generate a list of possible parents.
     // @todo This must be handled in a #process handler.
-    $type = $form['#node']->type;
-    $options = menu_parent_options(menu_get_menus(), $type);
+
+    // If an updated node is in the $form_state then use it
+    // Otherwise just take the node from $form
+    if (isset($form_state['node'])) {
+      $node = (object)($form_state['node'] + (array)$form['#node']);
+    }
+    else {
+      $node = $form['#node'];
+    }
+
+    $options = menu_parent_options(menu_get_menus(), $node->type);
     // If no possible parent menu items were found, there is nothing to display.
     if (empty($options)) {
       return;
@@ -615,7 +624,7 @@ function menu_form_alter(&$form, $form_s
     $form['menu']['enabled'] = array(
       '#type' => 'checkbox',
       '#title' => t('Provide a menu link'),
-      '#default_value' => (int) (bool) $link['mlid'],
+      '#default_value' => ((isset($link['enabled']) && $link['enabled']) || (!isset($link['enabled']) && (bool)$link['mlid'])),
     );
     $form['menu']['link'] = array(
       '#type' => 'container',
@@ -638,7 +647,7 @@ function menu_form_alter(&$form, $form_s
       '#default_value' => $link['link_title'],
     );
 
-    $default = ($link['mlid'] ? $link['menu_name'] . ':' . $link['plid'] : variable_get('menu_parent_' . $type, 'main-menu:0'));
+    $default = ($link['mlid'] ? $link['menu_name'] . ':' . $link['plid'] : variable_get('menu_parent_' . $node->type, 'main-menu:0'));
     // @todo This will fail with the new selective menus per content type.
     if (!isset($options[$default])) {
       $default = 'navigation:0';
Index: modules/path/path.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/path/path.module,v
retrieving revision 1.183
diff -u -p -r1.183 path.module
--- modules/path/path.module	13 Feb 2010 21:41:58 -0000	1.183
+++ modules/path/path.module	15 May 2010 17:29:59 -0000
@@ -99,21 +99,33 @@ function path_menu() {
 function path_form_alter(&$form, $form_state, $form_id) {
   if (!empty($form['#node_edit_form'])) {
     $path = array();
-    if (!empty($form['#node']->nid)) {
-      $conditions = array('source' => 'node/' . $form['#node']->nid);
-      if ($form['#node']->language != LANGUAGE_NONE) {
-        $conditions['language'] = $form['#node']->language;
-      }
-      $path = path_load($conditions);
-      if ($path === FALSE) {
-        $path = array();
+
+    // If an updated node is in the $form_state then use it
+    // Otherwise just take the node from $form and load path info
+    if (isset($form_state['node'])) {
+      $node = (object)($form_state['node'] + (array)$form['#node']);
+      $path = $node->path;
+    }
+    else {
+      $node = $form['#node'];
+      if (!empty($node->nid)) {
+        $conditions = array('source' => 'node/' . $node->nid);
+        if ($node->language != LANGUAGE_NONE) {
+          $conditions['language'] = $node->language;
+        }
+        $path = path_load($conditions);
+        if ($path === FALSE) {
+          $path = array();
+        }
       }
+
     }
+
     $path += array(
       'pid' => NULL,
-      'source' => isset($form['#node']->nid) ? 'node/' . $form['#node']->nid : NULL,
+      'source' => isset($node->nid) ? 'node/' . $node->nid : NULL,
       'alias' => '',
-      'language' => isset($form['#node']->language) ? $form['#node']->language : LANGUAGE_NONE,
+      'language' => isset($node->language) ? $node->language : LANGUAGE_NONE,
     );
 
     $form['path'] = array(
