From 7cc74e2836e65871d674bb91394d4992546556b7 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Fri, 7 Oct 2011 14:26:20 -0300 Subject: Fixing muamba status field handler --- muamba.handlers.inc | 15 ++++++ muamba.info | 1 + muamba.module | 3 +- muamba.views.inc | 110 ++++++++++++++++++++++++++++++++++++++++ views/muamba.handlers.inc | 16 ------ views/muamba.views.inc | 125 ---------------------------------------------- 6 files changed, 127 insertions(+), 143 deletions(-) create mode 100644 muamba.handlers.inc create mode 100644 muamba.views.inc delete mode 100644 views/muamba.handlers.inc delete mode 100644 views/muamba.views.inc diff --git a/muamba.handlers.inc b/muamba.handlers.inc new file mode 100644 index 0000000..2f5d9a7 --- /dev/null +++ b/muamba.handlers.inc @@ -0,0 +1,15 @@ +muamba_status); + } +} diff --git a/muamba.info b/muamba.info index 68ef7de..0ef5128 100644 --- a/muamba.info +++ b/muamba.info @@ -4,6 +4,7 @@ core = 7.x files[] = muamba.module files[] = muamba.install files[] = muamba.misc.inc +files[] = muamba.handlers.inc dependencies[] = features dependencies[] = strongarm dependencies[] = muamba_interface diff --git a/muamba.module b/muamba.module index ccaed41..5e3880a 100644 --- a/muamba.module +++ b/muamba.module @@ -275,7 +275,6 @@ function muamba_user_delete($account) { */ function muamba_views_api() { return array( - 'api' => 3, - 'path' => drupal_get_path('module', 'muamba') . '/views', + 'api' => 3, ); } diff --git a/muamba.views.inc b/muamba.views.inc new file mode 100644 index 0000000..05e2980 --- /dev/null +++ b/muamba.views.inc @@ -0,0 +1,110 @@ + 'mid', + 'title' => t('Muamba'), + 'help' => t("Muamba contains transaction data related to users and nodes"), + 'weight' => -10, + ); + + $data['muamba']['table']['join'] = array( + 'node' => array( + 'left_field' => 'nid', + 'field' => 'nid', + ), + ); + + // Transaction Id. + $data['muamba']['mid'] = array( + 'title' => t('Id'), + 'help' => t('Transaction Id'), + 'field' => array( + 'handler' => 'views_handler_field_numeric', + 'click sortable' => TRUE, + ), + 'filter' => array( + 'handler' => 'views_handler_filter_numeric', + ), + 'sort' => array( + 'handler' => 'views_handler_sort', + ), + ); + + // Node ID field. + $data['muamba']['nid'] = array( + 'title' => t('Muamba node asset'), + 'help' => t('The node in a muamba transaction.'), + 'relationship' => array( + 'base' => 'node', + 'field' => 'nid', + 'handler' => 'views_handler_relationship', + 'label' => t('Muamba node'), + ), + ); + + // User ID field. + $data['muamba']['uid'] = array( + 'title' => t('Muamba requester user'), + 'help' => t('The user that initiated a transaction.'), + 'relationship' => array( + 'base' => 'users', + 'field' => 'uid', + 'handler' => 'views_handler_relationship', + 'label' => t('Muamba requester'), + ), + ); + + // User ID field. + $data['muamba']['owner'] = array( + 'title' => t('Muamba asset owner'), + 'help' => t('The user that owns an asset.'), + 'relationship' => array( + 'base' => 'users', + 'field' => 'uid', + 'handler' => 'views_handler_relationship', + 'label' => t('Muamba item owner'), + ), + ); + + // Thread ID field. + $data['muamba']['thread_id'] = array( + 'title' => t('Thread'), + 'help' => t('The transaction negotiation thread.'), + 'relationship' => array( + 'base' => 'pm_index', + 'field' => 'thread_id', + 'handler' => 'views_handler_relationship', + 'label' => t('Muamba thread'), + ), + ); + + // Transaction status. + $data['muamba']['status'] = array( + 'title' => t('Status'), + 'help' => t('Transaction status'), + 'field' => array( + 'handler' => 'views_handler_field_muamba_status', + 'click sortable' => TRUE, + ), + 'filter' => array( + 'handler' => 'views_handler_filter_numeric', + ), + 'sort' => array( + 'handler' => 'views_handler_sort', + ), + ); + + return $data; +} diff --git a/views/muamba.handlers.inc b/views/muamba.handlers.inc deleted file mode 100644 index 9c5c6b9..0000000 --- a/views/muamba.handlers.inc +++ /dev/null @@ -1,16 +0,0 @@ - 'mid', - 'title' => t('Muamba'), - 'help' => t("Muamba contains transaction data related to users and nodes"), - 'weight' => -10, - ); - - $data['muamba']['table']['join'] = array( - 'node' => array( - 'left_field' => 'nid', - 'field' => 'nid', - ), - ); - - // Transaction Id. - $data['muamba']['mid'] = array( - 'title' => t('Id'), - 'help' => t('Transaction Id'), - 'field' => array( - 'handler' => 'views_handler_field_numeric', - 'click sortable' => TRUE, - ), - 'filter' => array( - 'handler' => 'views_handler_filter_numeric', - ), - 'sort' => array( - 'handler' => 'views_handler_sort', - ), - ); - - // Node ID field. - $data['muamba']['nid'] = array( - 'title' => t('Muamba node asset'), - 'help' => t('The node in a muamba transaction.'), - 'relationship' => array( - 'base' => 'node', - 'field' => 'nid', - 'handler' => 'views_handler_relationship', - 'label' => t('Muamba node'), - ), - ); - - // User ID field. - $data['muamba']['uid'] = array( - 'title' => t('Muamba requester user'), - 'help' => t('The user that initiated a transaction.'), - 'relationship' => array( - 'base' => 'users', - 'field' => 'uid', - 'handler' => 'views_handler_relationship', - 'label' => t('Muamba requester'), - ), - ); - - // User ID field. - $data['muamba']['owner'] = array( - 'title' => t('Muamba asset owner'), - 'help' => t('The user that owns an asset.'), - 'relationship' => array( - 'base' => 'users', - 'field' => 'uid', - 'handler' => 'views_handler_relationship', - 'label' => t('Muamba item owner'), - ), - ); - - // Thread ID field. - $data['muamba']['thread_id'] = array( - 'title' => t('Thread'), - 'help' => t('The transaction negotiation thread.'), - 'relationship' => array( - 'base' => 'pm_index', - 'field' => 'thread_id', - 'handler' => 'views_handler_relationship', - 'label' => t('Muamba thread'), - ), - ); - - // Transaction status. - $data['muamba']['status'] = array( - 'title' => t('Status'), - 'help' => t('Transaction status'), - 'field' => array( - 'handler' => 'views_handler_field_muamba_status', - 'click sortable' => TRUE, - ), - 'filter' => array( - 'handler' => 'views_handler_filter_numeric', - ), - 'sort' => array( - 'handler' => 'views_handler_sort', - ), - ); - - return $data; -} - -/** - * Implements hook_views_handlers() - */ -function muamba_views_handlers() { - $common = array( - 'parent' => 'views_handler_field', - 'file' => 'muamba.handlers.inc', - ); - return array( - 'handlers' => array( - 'views_handler_field_muamba_status' => $common, - ), - ); -} -- cgit v1.2.3