? .DS_Store
? form-alter.patch
Index: revision_moderation.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/revision_moderation/revision_moderation.module,v
retrieving revision 1.7
diff -u -p -r1.7 revision_moderation.module
--- revision_moderation.module	13 Oct 2006 21:39:37 -0000	1.7
+++ revision_moderation.module	25 Oct 2006 05:53:44 -0000
@@ -47,11 +47,51 @@ function revision_moderation_menu($may_c
 }
 
 /**
+ * Implementation of hook_form_alter().
+ */
+function revision_moderation_form_alter($form_id, &$form) {
+  // On node settings or node edit forms, add in the "New revisions in moderation" option.
+  if (isset($form['type'])) {
+    $type = $form['type']['#value'];
+    if ($type .'_node_settings' == $form_id) {
+      $form['workflow']["node_options_$type"]['#options']['revision_moderation'] = t('New revisions in moderation');
+    }
+    elseif ($type .'_node_form' == $form_id) {
+      if ($form['nid']['#value']) {
+        $default_value = db_result(db_query('SELECT revision_moderation FROM {revision_moderation} WHERE nid = %d', $form['nid']['#value'])); 
+      }
+      else {
+        $default_value = in_array('revision_moderation', variable_get("node_options_$type", array('status', 'promote')));
+      }
+      $form['options']['revision_moderation'] = array(
+        '#type' => 'checkbox',
+        '#title' => t('New revisions in moderation'),
+        '#default_value' => $default_value,
+      );
+    }
+  }
+}
+
+/**
  * Implementation of hook_nodeapi().
  */
 function revision_moderation_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
-  // Only do this logic for nodes marked "in moderation" and "create new revision."
-  if ($node->nid && $node->moderate == 1) {
+  // Handle keeping track of the revision_moderation field for each node.
+  switch ($op) {
+    case 'insert':
+      db_query('INSERT INTO {revision_moderation} (nid, revision_moderation) VALUES (%d, %d)', $node->nid, $node->revision_moderation);
+      break;
+    case 'update':
+      db_query('DELETE FROM {revision_moderation} WHERE nid = %d', $node->nid);
+      db_query('INSERT INTO {revision_moderation} (nid, revision_moderation) VALUES (%d, %d)', $node->nid, $node->revision_moderation);
+      break;
+    case 'delete':
+      db_query('DELETE FROM {revision_moderation} WHERE nid = %d', $node->nid);
+      break;
+  }
+
+  // Only do this logic for nodes with revision moderation turned on.
+  if ($node->nid && $node->revision_moderation == 1) {
     switch ($op) {
       case 'view':
         // Display more descriptive message at top of revisions page.
