From acd48d454260981e0bb50ea6b7ed1469b6a8093b Mon Sep 17 00:00:00 2001
From: Matthew Grasmick <madmatter23@gmail.com>
Date: Wed, 12 Sep 2012 13:03:19 -0400
Subject: [PATCH] exposing {forward_log} to views

---
 forward.views.inc |  135 ++++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 124 insertions(+), 11 deletions(-)

diff --git a/forward.views.inc b/forward.views.inc
index c68e8df..b5b80d2 100644
--- a/forward.views.inc
+++ b/forward.views.inc
@@ -12,33 +12,146 @@ function forward_views_data() {
     'group' => t('Forward'),
   );
 
-  // For other base tables, explain how we join
+  // For other base tables, explain how we join.
   $data['forward_statistics']['table']['join']['node'] = array(
     'left_field' => 'nid',
     'field' => 'nid',
   );
 
-  // Fields
+  // Forward statistics fields.
   $data['forward_statistics']['forward_count'] = array(
     'title' => t('forward count'),
     'help' => t('The module that associated a product with the node.'),
-    'field' => array('handler' => 'views_handler_field_numeric',),
-    'filter' => array('handler' => 'views_handler_filter_numeric',),
-    'sort' => array('handler' => 'views_handler_sort',),
+    'field' => array(
+      'handler' => 'views_handler_field_numeric',
+    ),
+    'filter' => array(
+      'handler' => 'views_handler_filter_numeric',
+    ),
+    'sort' => array(
+      'handler' => 'views_handler_sort',
+    ),
   );
   $data['forward_statistics']['clickthrough_count'] = array(
     'title' => t('clickthrough count'),
     'help' => t('The module that associated a product with the node.'),
-    'field' => array('handler' => 'views_handler_field_numeric',),
-    'filter' => array('handler' => 'views_handler_filter_numeric',),
-    'sort' => array('handler' => 'views_handler_sort',),
+    'field' => array(
+      'handler' => 'views_handler_field_numeric',
+    ),
+    'filter' => array(
+      'handler' => 'views_handler_filter_numeric',
+    ),
+    'sort' => array(
+      'handler' => 'views_handler_sort',
+    ),
   );
   $data['forward_statistics']['last_forward_timestamp'] = array(
     'title' => t('most recent timestamp'),
     'help' => t('The module that associated a product with the node.'),
-    'field' => array('handler' => 'views_handler_field_date',),
-    'filter' => array('handler' => 'views_handler_filter_timestamp',),
-    'sort' => array('handler' => 'views_handler_sort_date',),
+    'field' => array(
+      'handler' => 'views_handler_field_date',
+    ),
+    'filter' => array(
+      'handler' => 'views_handler_filter_timestamp',
+    ),
+    'sort' => array(
+      'handler' => 'views_handler_sort_date',
+    ),
+  );
+
+  // Forward log.
+  $data['forward_log']['table'] = array(
+    'group' => t('Forward'),
+    'base' => array(
+      'field' => 'uid',
+      'title' => t('Forward Log'),
+      'weight' => -10,
+    ),
+  );
+
+  // Forward log fields.
+  $data['forward_log']['path'] = array(
+    'title' => t('Forwarded Path'),
+    'help' => t('The path that was forwarded.'),
+    'field' => array(
+      'handler' => 'views_handler_field',
+      'click sortable' => TRUE,
+    ),
+    'filter' => array(
+      'handler' => 'views_handler_filter_string',
+    ),
+    'sort' => array(
+      'handler' => 'views_handler_sort',
+    ),
+  );
+  $data['forward_log']['type'] = array(
+    'title' => t('Type'),
+    'help' => t('Type.'),
+    'field' => array(
+      'handler' => 'views_handler_field',
+      'click sortable' => TRUE,
+    ),
+    'filter' => array(
+      'handler' => 'views_handler_filter_string',
+    ),
+    'sort' => array(
+      'handler' => 'views_handler_sort',
+    ),
+  );
+  $data['forward_log']['timestamp'] = array(
+    'title' => t('Timestamp'),
+    'help' => t('The date and time at which the path was forwarded.'),
+    'field' => array(
+      'handler' => 'views_handler_field_date',
+      'click sortable' => TRUE,
+    ),
+    'filter' => array(
+      'handler' => 'views_handler_filter_date',
+    ),
+    'sort' => array(
+      'handler' => 'views_handler_sort_date',
+    ),
+  );
+  $data['forward_log']['uid'] = array(
+    'title' => t('Uid'),
+    // The help that appears on the UI,
+    'help' => t('The user ID of the user that forwarded a path.'),
+    'field' => array(
+      'handler' => 'views_handler_field_user',
+      'click sortable' => TRUE,
+    ),
+    'argument' => array(
+      'handler' => 'views_handler_argument_user_uid',
+      // display this field in the summary
+      'name field' => 'name',
+    ),
+    'relationship' => array(
+      'base' => 'users',
+      'field' => 'uid',
+      'label' => 'User',
+      'help' => t('Bring in data about the user.'),
+    ),
+    'filter' => array(
+      'title' => t('Name'),
+      'handler' => 'views_handler_filter_user_name',
+    ),
+    'sort' => array(
+      'handler' => 'views_handler_sort',
+    ),
+  );
+  $data['forward_log']['hostname'] = array(
+    'title' => t('Hostname'),
+    'help' => t('Hostname of the user that forwarded a path.'),
+    'field' => array(
+      'handler' => 'views_handler_field',
+      'click sortable' => TRUE,
+    ),
+    'filter' => array(
+      'handler' => 'views_handler_filter_string',
+    ),
+    'sort' => array(
+      'handler' => 'views_handler_sort',
+    ),
   );
 
   return $data;
-- 
1.7.7.5 (Apple Git-26)

