Index: translation.admin.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/translation/translation.admin.inc,v retrieving revision 1.6 diff -u -p -r1.6 translation.admin.inc --- translation.admin.inc 19 Jan 2011 17:11:49 -0000 1.6 +++ translation.admin.inc 1 Feb 2011 04:05:14 -0000 @@ -284,6 +284,48 @@ function translation_edit_form($form, $f } } + // Prepare revision field + node_object_prepare($entity); + $form['revision_information'] = array( + '#type' => 'fieldset', + '#title' => t('Revision information'), + '#collapsible' => TRUE, + // Collapsed by default when "Create new revision" is unchecked + '#collapsed' => !$entity->revision, + '#group' => 'additional_settings', + '#attributes' => array( + 'class' => array('node-form-revision-information'), + ), + '#attached' => array( + 'js' => array(drupal_get_path('module', 'node') . '/node.js'), + ), + '#weight' => 20, + '#access' => $entity->revision || user_access('administer nodes'), + ); + $form['revision_information']['revision'] = array( + '#type' => 'checkbox', + '#title' => t('Create new revision'), + '#default_value' => $entity->revision, + '#access' => user_access('administer nodes'), + ); + // Check the revision log checkbox when the log textarea is filled in. + // This must not happen if "Create new revision" is enabled by default, since + // the state would auto-disable the checkbox otherwise. + if (!$entity->revision) { + $form['revision_information']['revision']['#states'] = array( + 'checked' => array( + 'textarea[name="log"]' => array('empty' => FALSE), + ), + ); + } + $form['revision_information']['log'] = array( + '#type' => 'textarea', + '#title' => t('Revision log message'), + '#rows' => 4, + '#default_value' => !empty($entity->log) ? $entity->log : '', + '#description' => t('Provide an explanation of the changes you are making. This will help other authors understand your motivations.'), + ); + $form['actions'] = array('#type' => 'actions'); $form['actions']['submit'] = array( '#type' => 'submit', @@ -364,6 +406,23 @@ function translation_edit_form_source_la function translation_edit_form_save_submit($form, &$form_state) { $handler = $form['#handler']; + // A new node revision was requested, save a new revision + if (!empty($form['#entity']->revision)) { + global $user; + + $form['#entity']->changed = REQUEST_TIME; + $form['#entity']->timestamp = REQUEST_TIME; + + unset($form['#entity']->vid); + + _node_save_revision($form['#entity'], $user->uid); + + db_update('node') + ->fields(array('vid' => $form['#entity']->vid)) + ->condition('nid', $form['#entity']->nid) + ->execute(); + } + $translation = array( 'translate' => $form_state['values']['translation']['translate'], 'status' => $form_state['values']['translation']['status'],