? comment_upload_views.patch
Index: comment_upload.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/comment_upload/comment_upload.module,v
retrieving revision 1.7.2.25
diff -u -p -r1.7.2.25 comment_upload.module
--- comment_upload.module	14 Jul 2009 20:00:58 -0000	1.7.2.25
+++ comment_upload.module	20 Sep 2009 03:27:00 -0000
@@ -94,6 +94,16 @@ function comment_upload_form_alter(&$for
 }
 
 /**
+ * Implementation of hook_views_api().
+ */
+function comment_upload_views_api() {
+  return array(
+    'api' => 2.0,
+    'path' => drupal_get_path('module', 'comment_upload') .'/views',
+  );
+}
+
+/**
  * Alter the comment form to support AHAH uploads.
  *
  * Note; not a hook implementation.
Index: views/comment_upload.views.inc
===================================================================
RCS file: views/comment_upload.views.inc
diff -N views/comment_upload.views.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ views/comment_upload.views.inc	20 Sep 2009 03:27:00 -0000
@@ -0,0 +1,80 @@
+<?php
+
+/**
+ * Implementation of hook_views_data().
+ */
+function comment_upload_views_data() {
+  $data = array();
+  $data['comment_upload']['table']['group'] = t('Comment Upload');
+
+  $data['comment_upload']['table']['join'] = array(
+    'comments' => array(
+      'left_field' => 'cid',
+      'field' => 'cid',
+    ),
+    'node' => array(
+      'left_field' => 'nid',
+      'field' => 'nid',
+    ),
+    'files' => array(
+      'left_field' => 'fid',
+      'field' => 'fid',
+    ),
+  );
+
+  $data['comment_upload']['nid'] = array(
+    'title' => t('Node'),
+    'help' => t('The parent node of the comment'),
+    'relationship' => array(
+      'label' => t('Node'),
+      'base' => 'node',
+      'base field' => 'nid',
+      'skip base' => array('node'),
+    ),
+  );
+
+  $data['comment_upload']['cid'] = array(
+    'title' => t('Comment'),
+    'help' => t('The comment that the file is attached to'),
+    'relationship' => array(
+      'label' => t('Comment'),
+      'base' => 'comments',
+      'base field' => 'cid',
+      'skip base' => array('comments'),
+    ),
+  );
+
+  // quantity field
+  $data['comment_upload']['fid'] = array(
+    'title' => t('File'),
+    'help' => t('The uploaded file.'),
+    'relationship' => array(
+      'label' => t('File'),
+      'base' => 'files',
+      'base field' => 'fid',
+      'skip base' => array('files'),
+    ),
+  );
+
+  // Color field    
+  $data['comment_upload']['description'] = array(
+    'title' => t('Description'),
+    'help' => t('Description of the uploaded file.'),
+
+    'field' => array(
+      'handler' => 'views_handler_field',
+      'click sortable' => FALSE,
+     ),
+     'filter' => array(
+      'handler' => 'views_handler_filter_string',
+     ),
+     'argument' => array(
+       'handler' => 'views_handler_argument_string',
+     ),
+     'sort' => array(
+      'handler' => 'views_handler_sort',
+     ),
+  );
+
+  return $data;
+}
