Index: comment_cck.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/comment_cck/comment_cck.info,v
retrieving revision 1.1
diff -u -p -r1.1 comment_cck.info
--- comment_cck.info	8 Sep 2007 17:54:45 -0000	1.1
+++ comment_cck.info	2 May 2008 12:54:23 -0000
@@ -1,5 +1,6 @@
-; $Id: comment_cck.info,v 1.1 2007/09/08 17:54:45 dmitrig01 Exp $
 name = Comment CCK
 description = Allows comments to alter CCK fields
+dependencies[] = content
 package = CCK
+core = 6.x
 
Index: comment_cck.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/comment_cck/comment_cck.install,v
retrieving revision 1.1
diff -u -p -r1.1 comment_cck.install
--- comment_cck.install	8 Sep 2007 17:54:45 -0000	1.1
+++ comment_cck.install	2 May 2008 12:54:23 -0000
@@ -1,33 +1,35 @@
 <?php
-// $Id: comment_cck.install,v 1.1 2007/09/08 17:54:45 dmitrig01 Exp $
 
 /**
- * Implementation of hook_install().
- */
+* Implementation of hook_install().
+*/
 function comment_cck_install() {
-  switch ($GLOBALS['db_type']) {
-    case 'mysql':
-    case 'mysqli':
-      db_query("CREATE TABLE {comment_cck_revisions} (
-        cid int NOT NULL,
-        vid int NOT NULL,
-        nid int NOT NULL,
-        previous_vid int NOT NULL,
-        PRIMARY KEY (vid)
-      ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
-      
-      break;
+  // Create tables.
+  drupal_install_schema('comment_cck');
+}
+
+
+/**
+* Implementation of hook_schema().
+*/
+function comment_cck_schema() {
+  $schema['comment_cck_revisions'] = array(
+    'fields' => array(
+      'cid'          => array('type' => 'int', 'not null' => TRUE),
+      'vid'          => array('type' => 'int', 'not null' => TRUE),
+      'nid'          => array('type' => 'int', 'not null' => TRUE),
+      'previous_vid' => array('type' => 'int', 'not null' => TRUE),
+    ),
+    'primary key' => array('vid'),
+  );
 
-    case 'pgsql':
-      // TODO: write this
-      break;
-  }
+  return $schema;
 }
 
 /**
  * Implementation of hook_uninstall().
  */
 function comment_cck_uninstall() {
-  db_query('DROP TABLE {comment_cck_revisions}');
+  drupal_uninstall_schema('comment_cck');
   variable_del('comment_cck_block_author_fields');
 }
Index: comment_cck.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/comment_cck/comment_cck.module,v
retrieving revision 1.1.2.1
diff -u -p -r1.1.2.1 comment_cck.module
--- comment_cck.module	8 Sep 2007 18:21:49 -0000	1.1.2.1
+++ comment_cck.module	2 May 2008 12:54:23 -0000
@@ -12,7 +12,7 @@ function comment_cck_perm() {
 /**
  * Implementation of hook_form_alter.
  */
-function comment_cck_form_alter($form_id, &$form) {
+function comment_cck_form_alter(&$form, $form_state, $form_id) {
   if ($form_id == 'comment_form' && user_access('allow fields to be changed')) {
     $node = node_load($form['nid']['#value']);
     // Check if fields for this type are enabled
@@ -20,7 +20,12 @@ function comment_cck_form_alter($form_id
       // If so, get the fields
       $fields = variable_get('comment_cck_fields_'. $node->type, array());
       // Get the full form as well
-      $content_form = content_form($node);
+      $path = drupal_get_path('module', 'node');
+      include_once($path . '/node.pages.inc');
+      $node_form = node_form($form_state, $node);
+      $path = drupal_get_path('module', 'content');
+      include_once($path . '/includes/content.node_form.inc');
+      $content_form = content_form(&$node_form, &$form_state);
       // This will hold the form with only the fields we need
       $final_form = array();
 
@@ -46,30 +51,30 @@ function comment_cck_form_alter($form_id
       '#description' => t('If checked, comments can alter this CCK field.'),
       '#default_value' => in_array($form['field_name']['#value'], variable_get('comment_cck_fields_'. $form['type_name']['#value'], array())),
     );
-    $form['#submit']['_comment_cck_submit'] = array();
+    $form['#submit'][] = '_comment_cck_submit';
   }
 }
 
-function _comment_cck_submit($form_id, $form_values) {
-  if ($form_values['allow_comment_altering'] == TRUE) {
+function _comment_cck_submit($form, &$form_state) {
+  if ($form['form_id']['#value'] == '_content_admin_field') {
     // Allow it to alter comments on nodes with this type
-    variable_set('comment_cck_node_'. $form_values['type_name'], TRUE);
+    variable_set('comment_cck_node_'. $form_state['values']['type_name'], TRUE);
     // Merge other fields for this node type with the one currently being added.
     // $form_values['field_name'] is the key for two reasons: first of all,
     // it's much easier to remove fields, second it prevents duplicates
-    variable_set('comment_cck_fields_'. $form_values['type_name'], array_merge(array($form_values['field_name'] => $form_values['field_name']), variable_get('comment_cck_fields_'. $form_values['type_name'], array())));
+    variable_set('comment_cck_fields_'. $form_state['values']['type_name'], array_merge(array($form_state['values']['field_name'] => $form_state['values']['field_name']), variable_get('comment_cck_fields_'. $form_state['values']['type_name'], array())));
   }
   else {
     // Get the fields
-    $fields = variable_get('comment_cck_fields_'. $form_values['type_name'], array()  );
+    $fields = variable_get('comment_cck_fields_'. $form_state['values']['type_name'], array()  );
     // Unset the field
-    unset($fields[$form_values['field_name']]);
+    unset($fields[$form_state['values']['field_name']]);
     // And set it back again
-    variable_set('comment_cck_fields_'. $form_values['type_name'], $fields);
+    variable_set('comment_cck_fields_'. $form_state['values']['type_name'], $fields);
     // Check if there are any fields left
     if (empty($fields)) {
       // Make this false so that it doesn't try to add a form
-      variable_set('comment_cck_node_'. $form_values['type_name'], FALSE);
+      variable_set('comment_cck_node_'. $form_state['values']['type_name'], FALSE);
     }
   }
   return;
@@ -86,8 +91,6 @@ function comment_cck_comment($comment, $
       $previous_vid = $node->vid;
       // We want a new revision
       $node->revision = 1;
-      // Required to get the data in the right format
-      content_submit($node);
       // Save the node
       node_save($node);
       // Record that this comment added a revision
@@ -123,7 +126,8 @@ function comment_cck_comment($comment, $
               // Make sure they're different.
               if ($item != $previous[$delta]) {
                 // They're different.  Add them.
-                $result[] = array($cck_fields['fields'][$field]['widget']['label'] .':&nbsp', $previous[$delta]['view'], "&raquo;", $item['view']);
+                $cck_type = $cck_fields['fields'][$field]['type'];
+                $result[] = array($cck_fields['fields'][$field]['widget']['label'] .':&nbsp', $previous[$delta][$cck_type], "&raquo;", $item[$cck_type]);
               }
             }
           }
