--- modules/node.module.orig 2004-09-15 19:12:29.256351696 -0400 +++ modules/node.module 2004-09-15 19:51:39.938418146 -0400 @@ -701,6 +701,11 @@ function node_admin_edit($node) { return $output; } +function node_last_changed($nid) { + $node = db_fetch_object(db_query('SELECT changed FROM {node} WHERE nid = %d', $nid)); + return ($node->changed); +} + /** * Generate the content administration overview. */ @@ -1048,6 +1053,10 @@ function node_validate($node) { $node->teaser = node_teaser($node->body); } + if (node_last_changed($node->nid) > $node->changed) { + form_set_error('changed', t('This content has been modified by another user, unable to save changes.')); + } + // Create a new revision when required. $node = node_revision_create($node); @@ -1196,6 +1205,10 @@ function node_form($edit) { $output .= form_hidden('created', $edit->created); } + if ($edit->changed) { + $output .= form_hidden('changed', $edit->changed); + } + $output .= form_hidden('type', $edit->type); // Add the buttons. @@ -1322,7 +1335,6 @@ function node_preview($node) { if (empty($node->created)) { $node->created = time(); } - $node->changed = time(); // Extract a teaser: $node->teaser = node_teaser($node->body);