maillog.views.inc 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. <?php
  2. /**
  3. * @file
  4. * Make the fields from node type 'Logged Mail' available in views
  5. */
  6. /**
  7. * Implementation of hook_views_data().
  8. */
  9. function maillog_views_data() {
  10. $data['maillog']['table']['group'] = t('Maillog');
  11. $data['maillog']['table']['base'] = array(
  12. 'field' => 'idmaillog',
  13. 'title' => t('Maillog'),
  14. 'help' => t("This table contains the logged e-mails."),
  15. 'weight' => -10,
  16. );
  17. $data['maillog']['idmaillog'] = array(
  18. 'title' => t('Maillog_ID'),
  19. 'help' => t('The primary key of the maillog table.'),
  20. 'field' => array(
  21. 'handler' => 'views_handler_field',
  22. 'click sortable' => TRUE,
  23. ),
  24. 'sort' => array(
  25. 'handler' => 'views_handler_sort',
  26. ),
  27. 'filter' => array(
  28. 'handler' => 'views_handler_filter_string',
  29. ),
  30. 'argument' => array(
  31. 'handler' => 'views_handler_argument_string',
  32. ),
  33. );
  34. $data['maillog']['header_message_id'] = array(
  35. 'title' => t('Message_ID'),
  36. 'help' => t("The 'Message_ID' e-mail address."),
  37. 'field' => array(
  38. 'handler' => 'views_handler_field',
  39. 'click sortable' => TRUE,
  40. ),
  41. 'sort' => array(
  42. 'handler' => 'views_handler_sort',
  43. ),
  44. 'filter' => array(
  45. 'handler' => 'views_handler_filter_string',
  46. ),
  47. 'argument' => array(
  48. 'handler' => 'views_handler_argument_string',
  49. ),
  50. );
  51. $data['maillog']['header_from'] = array(
  52. 'title' => t('From'),
  53. 'help' => t("The 'From' field of the e-mail address."),
  54. 'field' => array(
  55. 'handler' => 'views_handler_field',
  56. 'click sortable' => TRUE,
  57. ),
  58. 'sort' => array(
  59. 'handler' => 'views_handler_sort',
  60. ),
  61. 'filter' => array(
  62. 'handler' => 'views_handler_filter_string',
  63. ),
  64. 'argument' => array(
  65. 'handler' => 'views_handler_argument_string',
  66. ),
  67. );
  68. $data['maillog']['header_to'] = array(
  69. 'title' => t('To'),
  70. 'help' => t("The 'To' field of the e-mail address."),
  71. 'field' => array(
  72. 'handler' => 'views_handler_field',
  73. 'click sortable' => TRUE,
  74. ),
  75. 'sort' => array(
  76. 'handler' => 'views_handler_sort',
  77. ),
  78. 'filter' => array(
  79. 'handler' => 'views_handler_filter_string',
  80. ),
  81. 'argument' => array(
  82. 'handler' => 'views_handler_argument_string',
  83. ),
  84. );
  85. $data['maillog']['header_reply_to'] = array(
  86. 'title' => t('Reply To'),
  87. 'help' => t("The 'Reply-To' field of the e-mail address."),
  88. 'field' => array(
  89. 'handler' => 'views_handler_field',
  90. 'click sortable' => TRUE,
  91. ),
  92. 'sort' => array(
  93. 'handler' => 'views_handler_sort',
  94. ),
  95. 'filter' => array(
  96. 'handler' => 'views_handler_filter_string',
  97. ),
  98. 'argument' => array(
  99. 'handler' => 'views_handler_argument_string',
  100. ),
  101. );
  102. $data['maillog']['header_all'] = array(
  103. 'title' => t('Header'),
  104. 'help' => t("The 'Header' field of the e-mail."),
  105. 'field' => array(
  106. 'handler' => 'views_handler_field',
  107. 'click sortable' => TRUE,
  108. ),
  109. 'sort' => array(
  110. 'handler' => 'views_handler_sort',
  111. ),
  112. 'filter' => array(
  113. 'handler' => 'views_handler_filter_string',
  114. ),
  115. 'argument' => array(
  116. 'handler' => 'views_handler_argument_string',
  117. ),
  118. );
  119. $data['maillog']['body'] = array(
  120. 'title' => t('Body'),
  121. 'help' => t("The 'Body' field of the e-mail."),
  122. 'field' => array(
  123. 'handler' => 'views_handler_field',
  124. 'click sortable' => TRUE,
  125. ),
  126. 'sort' => array(
  127. 'handler' => 'views_handler_sort',
  128. ),
  129. 'filter' => array(
  130. 'handler' => 'views_handler_filter_string',
  131. ),
  132. 'argument' => array(
  133. 'handler' => 'views_handler_argument_string',
  134. ),
  135. );
  136. $data['maillog']['subject'] = array(
  137. 'title' => t('Subject'),
  138. 'help' => t("The 'Subject' field of the e-mail."),
  139. 'field' => array(
  140. 'handler' => 'views_handler_field',
  141. 'click sortable' => TRUE,
  142. ),
  143. 'sort' => array(
  144. 'handler' => 'views_handler_sort',
  145. ),
  146. 'filter' => array(
  147. 'handler' => 'views_handler_filter_string',
  148. ),
  149. 'argument' => array(
  150. 'handler' => 'views_handler_argument_string',
  151. ),
  152. );
  153. $data['maillog']['sent_date'] = array(
  154. 'title' => t('Date'),
  155. 'help' => t("The 'Date' field of the e-mail."),
  156. 'field' => array(
  157. 'handler' => 'views_handler_field_date',
  158. 'click sortable' => TRUE,
  159. ),
  160. 'sort' => array(
  161. 'handler' => 'views_handler_sort_date',
  162. ),
  163. 'filter' => array(
  164. 'handler' => 'views_handler_filter_date',
  165. ),
  166. 'argument' => array(
  167. 'handler' => 'views_handler_argument_string',
  168. ),
  169. );
  170. $data['maillog']['delete_maillog'] = array(
  171. 'field' => array(
  172. 'title' => t('Delete link'),
  173. 'help' => t('Provide a simple link to delete an eMail entry from the maillog table.'),
  174. 'handler' => 'maillog_handler_field_maillog_link_delete',
  175. ),
  176. );
  177. return $data;
  178. }
  179. /**
  180. * Implementation of hook_views_handlers() to register all of the basic handlers
  181. * views uses.
  182. */
  183. function maillog_views_handlers() {
  184. return array(
  185. 'info' => array(
  186. 'path' => drupal_get_path('module', 'maillog') . '/includes',
  187. ),
  188. 'handlers' => array(
  189. // field handlers
  190. 'maillog_handler_field_maillog_link_delete' => array(
  191. 'parent' => 'views_handler_field',
  192. ),
  193. ),
  194. );
  195. }