Index: drupalorg.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/drupalorg/drupalorg.module,v retrieving revision 1.28 diff -u -p -r1.28 drupalorg.module --- drupalorg.module 8 Sep 2008 18:23:28 -0000 1.28 +++ drupalorg.module 19 Sep 2008 17:10:17 -0000 @@ -138,6 +138,46 @@ function drupalorg_form_alter($form_id, elseif ($form_id == 'user_edit') { $form['#validate']['drupalorg_profile_user_edit_validate'] = array(); } + + // Add a log field if the "Create new revision" option is checked, or if the + // current user has the ability to check that option, and if this is not a + // new node being added. + // Make sure this is a node editing page. + if (arg(0) == 'node' && arg(2) == 'edit') { + // Check the node's revision state, which is stored in the variables table. + // Get the node's type. + $node_type = db_result(db_query('SELECT type FROM {node} WHERE nid = %d', arg(1))); + if ($node_type !== FALSE) { + // Get the node's options. + $node_options = variable_get('node_options_'. $node_type, ''); + if ($node_options != '') { + // Set the initial value. + $node_revision = FALSE; + foreach ($node_options as $node_option) { + // Check for the revision option. + if ($node_option == 'revision') { + $node_revision = TRUE; + } + } + } + } + // Make sure the node has the correct option set or the user has the + // correct permission. + if ($node_revision || user_access('administer nodes')) { + // Display the form. + $form['log'] = array( + '#type' => 'textarea', + '#title' => t('Revision log message'), + '#rows' => 2, + '#weight' => 20, + '#required' => $node_revision, + '#description' => t('Provide an explanation of the changes you are making to this content. This will help other authors understand your motivations.'), + ); + } + } + elseif (arg(0) == 'node' && arg(1) == 'add') { + unset($form['log']); + } } function drupalorg_register_mail_validate($form_id, $form_values) {