summaryrefslogtreecommitdiff
path: root/modules/node/node.module
diff options
context:
space:
mode:
authorNeil Drumm <drumm@3064.no-reply.drupal.org>2006-11-16 21:14:44 +0000
committerNeil Drumm <drumm@3064.no-reply.drupal.org>2006-11-16 21:14:44 +0000
commit1237159381d405b44c503691c591c4d9ca483b7f (patch)
tree6bd0eb8c57c098ad3d1aa368128044bc0b298c99 /modules/node/node.module
parentb4faaa3cad4728f75b9f3a4329cf4385130739e5 (diff)
downloadbrdo-1237159381d405b44c503691c591c4d9ca483b7f.tar.gz
brdo-1237159381d405b44c503691c591c4d9ca483b7f.tar.bz2
#87474 by webernet. Move the log message field from book to node module.
Diffstat (limited to 'modules/node/node.module')
-rw-r--r--modules/node/node.module22
1 files changed, 20 insertions, 2 deletions
diff --git a/modules/node/node.module b/modules/node/node.module
index c370c368a..5e35ddb9d 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -571,12 +571,18 @@ function node_save(&$node) {
// Split off revisions data to another structure
$revisions_table_values = array('nid' => $node->nid, 'vid' => $node->vid,
'title' => $node->title, 'body' => $node->body,
- 'teaser' => $node->teaser, 'log' => $node->log, 'timestamp' => $node->changed,
+ 'teaser' => $node->teaser, 'timestamp' => $node->changed,
'uid' => $user->uid, 'format' => $node->format);
$revisions_table_types = array('nid' => '%d', 'vid' => '%d',
'title' => "'%s'", 'body' => "'%s'",
- 'teaser' => "'%s'", 'log' => "'%s'", 'timestamp' => '%d',
+ 'teaser' => "'%s'", 'timestamp' => '%d',
'uid' => '%d', 'format' => '%d');
+ if (!empty($node->log)) {
+ // Only store the log message if there's something to store; this prevents existing
+ // log messages from being unintentionally overwritten by a blank message.
+ $revisions_table_values['log'] = $node->log;
+ $revisions_table_types['log'] = "'%s'";
+ }
$node_table_values = array('nid' => $node->nid, 'vid' => $node->vid,
'title' => $node->title, 'type' => $node->type, 'uid' => $node->uid,
'status' => $node->status, 'created' => $node->created,
@@ -1955,6 +1961,18 @@ function node_form($node, $form_values = NULL) {
}
$form['#node'] = $node;
+ // Add a log field if the "Create new revisions" option is checked, or if the
+ // current user has the ability to check that option.
+ if ($node->revision || user_access('administer nodes')) {
+ $form['log'] = array(
+ '#type' => 'textarea',
+ '#title' => t('Log message'),
+ '#rows' => 2,
+ '#weight' => 20,
+ '#description' => t('An explanation of the additions or updates being made to help other authors understand your motivations.'),
+ );
+ }
+
// Node author information for administrators
$form['author'] = array(
'#type' => 'fieldset',