Index: revision_moderation.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/revision_moderation/revision_moderation.info,v
retrieving revision 1.1.2.1
diff -u -r1.1.2.1 revision_moderation.info
--- revision_moderation.info	18 Jun 2007 23:07:01 -0000	1.1.2.1
+++ revision_moderation.info	10 Dec 2007 22:12:24 -0000
@@ -1,4 +1,4 @@
-; $Id: revision_moderation.info,v 1.1.2.1 2007/06/18 23:07:01 dww Exp $
+; $Id$
 name = Revision Moderation
 description = Allows moderation of new node revisions while existing approved revisions stay visible.
-
+core = "6.x"
\ No newline at end of file
Index: revision_moderation.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/revision_moderation/revision_moderation.module,v
retrieving revision 1.26.2.12
diff -u -r1.26.2.12 revision_moderation.module
--- revision_moderation.module	7 Dec 2007 16:43:25 -0000	1.26.2.12
+++ revision_moderation.module	15 Dec 2007 19:34:57 -0000
@@ -1,5 +1,5 @@
 <?php
-// $Id: revision_moderation.module,v 1.26.2.12 2007/12/07 16:43:25 webchick Exp $
+// $Id$
 
 /**
  * @file
@@ -7,9 +7,7 @@
  */
 
 // Actions module support.
-if (module_exists('actions')) {
-  include_once drupal_get_path('module', 'revision_moderation') .'/revision_moderation_actions.inc';
-}
+include_once drupal_get_path('module', 'revision_moderation') .'/revision_moderation_actions.inc';
 
 // Views module support.
 if (module_exists('views')) {
@@ -19,57 +17,58 @@
 /**
  * Implementation of hook_menu().
  */
-function revision_moderation_menu($may_cache) {
+function revision_moderation_menu() {
   $items = array();
 
-  if ($may_cache) {
-    // An admin page listing all nodes with revisions in moderation.
-    $items[] = array(
-      'path' => 'admin/content/node/revisions',
-      'title' => t('Pending revisions'),
-      'callback' => 'revision_moderation_pending_revisions_admin',
-      'type' => MENU_LOCAL_TASK,
-      'access' => user_access('administer nodes'),
-    );
-    $items[] = array(
-      'path' => 'admin/settings/revision_moderation',
-      'title' => t('Revision moderation'),
-      'description' => t('Configure revision publishing options.'),
-      'callback' => 'drupal_get_form',
-      'callback arguments' => array('revision_moderation_settings'),
-    );
-  }
-  else {
-    if (arg(0) == 'node' && is_numeric(arg(1))) {
-      $node = node_load(arg(1));
-      $access = user_access('administer nodes') || (user_access('view revisions') && node_access('update', $node));
-
-      // Callback to allow users to edit revisions.
-      $items[] = array(
-        'path' => 'node/'. arg(1) .'/revisions/'. arg(3) .'/edit',
-        'title' => t('Edit revision'),
-        'callback' => 'revision_moderation_edit',
-        'callback arguments' => array( arg(1), arg(3)),
-        'access' => $access,
-        'type' => MENU_CALLBACK,
-      );
+  // An admin page listing all nodes with revisions in moderation.
+  $items['admin/content/node/revisions'] = array(
+    'title' => t('Pending revisions'),
+    'page callback' => 'revision_moderation_pending_revisions_admin',
+    'access arguments' => array('administer nodes'),
+    'type' => MENU_LOCAL_TASK,
+  );
+  $items['admin/settings/revision_moderation'] = array(
+    'title' => t('Revision moderation'),
+    'description' => t('Configure revision publishing options.'),
+    'page callback' => 'drupal_get_form',
+    'page arguments' => array('revision_moderation_settings'),
+    'access arguments' => array('administer site configuration'),
+  );
+  // Callback to allow users to edit revisions.
+  $items['node/%/revisions/%/edit'] = array(
+    'title' => t('Edit revision'),
+    'page callback' => 'revision_moderation_edit',
+    'page arguments' => array(1, 3),
+    'access callback' => 'revision_moderation_admin_perm',
+    'access arguments' => array(1),
+    'file' => 'node.pages.inc',
+    'file path' => drupal_get_path('module', 'node'),
+    'type' => MENU_CALLBACK,
+  );
 
-      // Callback to allow users to publish revisions directly.
-      $items[] = array(
-        'path' => 'node/'. arg(1) .'/revisions/'. arg(3) .'/publish',
-        'title' => t('Publish revision'),
-        'callback' => 'revision_moderation_publish',
-        'callback arguments' => array(arg(1), arg(3)),
-        'access' => $access,
-        'type' => MENU_CALLBACK,
-      );
-    }
-  }
+  // Callback to allow users to publish revisions directly.
+  $items['node/%/revisions/%/publish'] = array(
+    'title' => t('Publish revision'),
+    'page callback' => 'revision_moderation_publish',
+    'page arguments' => array(1, 3),
+    'access callback' => 'revision_moderation_admin_perm',
+    'access arguments' => array(1),
+    'type' => MENU_CALLBACK,
+  );
 
   return $items;
 }
 
 /**
+ * Menu permission callback.
+ */
+function revision_moderation_admin_perm($nid) {
+  $node = node_load($nid);
+  $access = user_access('administer nodes') || (user_access('view revisions') && node_access('update', $node));
+  return $access;
+}
+
+/**
  * Menu callback; admin settings page.
  */
 function revision_moderation_settings() {
@@ -85,11 +84,11 @@
 /**
  * Implementation of hook_form_alter().
  */
-function revision_moderation_form_alter($form_id, &$form) {
-  // On node edit forms, add in the "New revisions in moderation" option.
-  if (isset($form['#base']) && $form['#base'] == 'node_form') {
+function revision_moderation_form_alter(&$form, $form_state, $form_id) {
+  // On node edit forms, add in the "New revisions in moderation" option
+  if (isset($form['nid']) && isset($form['#theme'][1]) && $form['#theme'][1] == 'node_form') {
     $default_value = in_array('revision_moderation', variable_get("node_options_{$form['type']['#value']}", array('status', 'promote')));
-    if ($form['nid']['#value']) {
+    if (isset($form['nid'])) {
       $result = db_result(db_query('SELECT revision_moderation FROM {revision_moderation} WHERE nid = %d', $form['nid']['#value']));
       if ($result !== FALSE) {
         $default_value = $result;
@@ -98,20 +97,20 @@
 
     // Only show the checkbox if user has 'administer nodes' privileges.
     if (user_access('administer nodes')) {
-      $form['options']['revision_moderation'] = array(
+      $form['revision_information']['revision_moderation'] = array(
         '#type' => 'checkbox',
         '#title' => t('New revisions in moderation'),
         '#default_value' => $default_value,
       );
     }
     else {
-      $form['revision_moderation'] = array(
+      $form['revision_information']['revision_moderation'] = array(
         '#type' => 'value',
         '#value' => $default_value,
       );
     }
   }
-  // Also add option to node settings form.
+  // Also add option to node settings form
   elseif ($form_id == 'node_type_form') {
     $form['workflow']['node_options']['#options']['revision_moderation'] = t('New revisions in moderation');
   }
@@ -171,7 +170,7 @@
 
   // Only do this logic for non-admin users on nodes with revision moderation
   // turned on.
-  if ($node->nid && $node->revision_moderation == 1 && (!user_access('administer nodes') || !variable_get('revision_moderation_exempt', 1))) {
+  if (isset($node->nid) && $node->revision_moderation == 1 && (!user_access('administer nodes') || !variable_get('revision_moderation_exempt', 1))) {
     switch ($op) {
       case 'prepare':
         // If user has a pending revision for this node, load the latest version of
@@ -187,13 +186,14 @@
           }
         }
         break;
-      case 'submit':
+      case 'presave':
         $current_vid = db_result(db_query('SELECT vid FROM {node} WHERE nid = %d', $node->nid));
         $node->original_node = node_load($node->nid, $current_vid);
         break;
       case 'update':
         if (isset($node->original_node)) {
           // Update node table's vid to the original value.
+
           db_query("UPDATE {node} SET vid = %d, title = '%s', status = %d, moderate = %d WHERE nid = %d", $node->original_node->vid, $node->original_node->title, $node->original_node->status, $node->original_node->moderate, $node->nid);
           drupal_set_message(t('Your changes have been submitted for moderation.'));
         }
@@ -308,7 +308,8 @@
 function revision_moderation_edit($nid, $vid) {
   $node = node_load($nid, $vid);
   drupal_set_message(t('You are currently editing a revision of this post created on @date by @author.', array('@date' => format_date($node->changed, 'small'), '@author' => $node->name)));
-  return drupal_get_form($node->type .'_node_form', $node);
+  $output = drupal_get_form($node->type .'_node_form', $node);
+  return $output;
 }
 
 /**
@@ -318,6 +319,6 @@
   $node = node_load($nid, $vid);
   db_query("UPDATE {node} SET vid = %d, title = '%s' WHERE nid = %d", $vid, $node->title, $nid);
   drupal_set_message('The selected revision has been published.');
-  watchdog('content', t('@type: published %title revision %revision', array('@type' => t($node->type), '%title' => $node->title, '%revision' => $vid)), WATCHDOG_NOTICE, l(t('view'), "node/$nid/revisions/$vid/view"));
+  watchdog('content', $node->type .': published '. $node->title .'revision'. $vid, WATCHDOG_NOTICE, l(t('view'), "node/$nid/revisions/$vid/view"));
   drupal_goto("node/$nid");
-}
+}
\ No newline at end of file
Index: revision_moderation_actions.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/revision_moderation/revision_moderation_actions.inc,v
retrieving revision 1.2
diff -u -r1.2 revision_moderation_actions.inc
--- revision_moderation_actions.inc	2 Nov 2006 04:37:49 -0000	1.2
+++ revision_moderation_actions.inc	16 Dec 2007 00:21:03 -0000
@@ -1,51 +1,52 @@
 <?php
-// $Id: revision_moderation_actions.inc,v 1.2 2006/11/02 04:37:49 webchick Exp $
+// $Id$
 
 /**
  * @file
- * Actions module support for revision moderation module.
+ * Actions support for revision moderation module.
  */
 
 /**
+ * Implementation of hook_action_info.
+ */
+function revision_moderation_action_info() {
+  $actions['revision_moderation_enable_action'] = array(
+    'type' => 'node',
+    'description' => t('Enable revision moderation on node'),
+    'configurable' => FALSE,
+    'hooks' => array(
+      'nodeapi' => array('presave', 'insert', 'update'),
+      'comment' => array('delete', 'insert', 'update')
+     ),
+  );
+  $actions['revision_moderation_disable_action'] = array(
+    'type' => 'node',
+    'description' => t('Disable revision moderation on node'),
+    'configurable' => FALSE,
+    'hooks' => array(
+      'nodeapi' => array('presave', 'insert', 'update'),
+      'comment' => array('delete', 'insert', 'update')
+     ),
+  );
+  return $actions;
+}
+
+/**
  * Implementation of a Drupal action; enables revision moderation
  * on a node.
  */
-function action_revision_moderation_enable($op, $edit = array(), &$node) {
-  switch ($op) {
-    case 'metadata':
-      return array(
-        'description' => t('Enable revision moderation on node'),
-        'type' => t('Node'),
-        'batchable' => true,
-        'configurable' => false,
-      );
-      break;
-    case 'do':
-      $node->revision_moderation = 1;
-      // Also enable "Create new revisions" option, in case it isn't yet.
-      $node->revision = 1;
-      node_save($node);
-      break;
-  }
+function revision_moderation_enable_action(&$node, $context) {
+  $node->revision_moderation = 1;
+  // Also enable "Create new revisions" option, in case it isn't yet.
+  $node->revision = 1;
+  node_save($node);
 }
 
 /**
  * Implementation of a Drupal action; disables revision moderation
  * on a node.
  */
-function action_revision_moderation_disable($op, $edit = array(), &$node) {
-  switch ($op) {
-    case 'metadata':
-      return array(
-        'description' => t('Disable revision moderation on node'),
-        'type' => t('Node'),
-        'batchable' => true,
-        'configurable' => false,
-      );
-      break;
-    case 'do':
-      $node->revision_moderation = 0;
-      node_save($node);
-      break;
-  }
+function revision_moderation_disable_action(&$node, $context) {
+  $node->revision_moderation = 0;
+  node_save($node);
 }
