Mailinglist
 All Data Structures Files Functions Variables Pages
MailinglistRetrieveUI Class Reference

Represents an email mailbox (IMAP, POP3, etc...). More...

Inheritance diagram for MailinglistRetrieveUI:
Inheritance graph
[legend]
Collaboration diagram for MailinglistRetrieveUI:
Collaboration graph
[legend]

Public Member Functions

ctools_export_ui
 hook_menu (&$items)
 Implements ctools_export_ui::hook_form(). More...
 
 edit_form (&$form, &$form_state)
 Implements ctools_export_ui::edit_form(). More...
 
 list_header ($form_state)
 list_header() More...
 
 test_page ($js, $input, $mailbox)
 Callback to test a mailbox connection. More...
 
 process_page ($js, $input, $mailbox)
 process_page() More...
 
- Public Member Functions inherited from MailinglistExportUI
 edit_form (&$form, &$form_state)
 Implements ctools_export_ui::edit_form(). More...
 
 edit_form_validate (&$form, &$form_state)
 Implements ctools_export_ui::edit_form_validate(). More...
 
 edit_form_submit (&$form, &$form_state)
 Implements ctools_export_ui::edit_form_submit(). More...
 
 edit_save_form ($form_state)
 
 delete_form_submit (&$form_state)
 Implements ctools_export_ui::delete_form_submit(). More...
 

Detailed Description

Represents an email mailbox (IMAP, POP3, etc...).

Definition at line 11 of file MailinglistRetrieveUI.class.php.

Member Function Documentation

edit_form ( $form,
$form_state 
)

Implements ctools_export_ui::edit_form().

Definition at line 30 of file MailinglistRetrieveUI.class.php.

References _mailinglist_build_options(), and mailinglist_get_plugins().

30  {
31 
32  // All Retrievers will need some settings for connection.
33  $form['connection']['#tree'] = FALSE;
34  $form['connection']['#weight'] = 20;
35  $form['connection']['settings']= array(
36  '#type' => 'fieldset',
37  '#title' => 'Mailbox connection settings',
38  '#tree' => TRUE,
39  '#collapsible' => TRUE,
40  '#collapsed' => FALSE,
41  );
42 
43  $form['extra']['#tree'] = FALSE;
44  $form['extra']['#weight'] = 90;
45  $form['extra']['settings']= array(
46  '#type' => 'fieldset',
47  '#title' => 'More settings',
48  '#tree' => TRUE,
49  '#collapsible' => TRUE,
50  '#collapsed' => TRUE,
51  );
52 
53  parent::edit_form($form, $form_state);
54 
55  // object_type selection is not dependant on type of object
56 
57  $retrieve_plugins = mailinglist_get_plugins('mailinglist', 'retrieve');
58  /* Type of Mail Box */
59  $form['info']['object_type'] = array(
60  '#type' => 'select',
61  '#title' => t('Mailbox Type'),
62  '#options' => _mailinglist_build_options($retrieve_plugins),
63  '#default_value' => isset($form_state['item']->object_type) ? $form_state['item']->object_type : NULL,
64  '#description' => t('Plug in to use to read mailbox'),
65  '#required' => TRUE,
66  );
67  }
_mailinglist_build_options($source, $key_name= 'name')
Builds a Select control array from a menu form an array from a ctools_get_plugin. ...
mailinglist_get_plugins($module, $type)
Wrapper to load plugins.

Here is the call graph for this function:

hook_menu ( $items)

Implements ctools_export_ui::hook_form().

Definition at line 20 of file MailinglistRetrieveUI.class.php.

20  {
21  parent::hook_menu($items);
22  if (isset($items['admin/config/system/mailinglist/mailbox'])) {
23  $items['admin/config/system/mailinglist/mailbox']['type'] = MENU_LOCAL_TASK;
24  }
25  }
list_header (   $form_state)

list_header()

Definition at line 72 of file MailinglistRetrieveUI.class.php.

72  {
73  if (isset($form_state['input']['test_result'])) {
74  return $form_state['input']['test_result'];
75  }
76  }
process_page (   $js,
  $input,
  $mailbox 
)

process_page()

UI Callback for mailinglist_mailbox_ui process operation

Definition at line 96 of file MailinglistRetrieveUI.class.php.

References mailinglist_list_load_all().

96  {
97 // dpm($js);
98 // dpm($input);
99  dpm($mailbox, 'process_page');
100  $page['list'] = array(
101  '#theme' => 'table',
102  '#header' => array(
103  array('data' => 'Message', ),
104  array('data' => 'List'),
105  array('data' => 'Results', ),
106  array('data' => 'Subject', ),
107  ),
108  '#rows' => array(),
109  );
110 
111  drupal_set_title($this->get_page_title('process', $mailbox));
112 
113  // Check if we have a real mailbox object
114  if (method_exists($mailbox, 'get_message_list')) {
115  $lists = mailinglist_list_load_all();
116  $msg_list = $mailbox->get_message_list($mailbox->settings['limit']);
117  if (!$msg_list) {
118  // Avoid error message on error, maybe should log the error?
119  $msg_list = array();
120  }
121  foreach ($msg_list as $msg_idx => $msg_id) {
122  $msg = $mailbox->get_message($msg_id);
123  dpm($msg, $msg_id);
124  $handled = FALSE;
125  foreach ($lists as $list => $listobj) {
126  $handled = $listobj->processMessage($msg);
127  if ($handled) {
128  if ($mailbox->get_setting('delete_after_read', FALSE)) {
129  dpm('Purge', $msg_id);
130 // $mailbox -> purge_msg($msg_id);
131  }
132  break;
133  }
134  } // end of foreach ($lists), process handled code
135  if ($handled == FALSE) {
136  $list = "**None**";
137  $handled = "Unhandled";
138  }
139  if ($handled === TRUE) {
140  $handled = "Match";
141  }
142  $row = array($msg_id, $list, $handled, $msg->header('Subject'));
143  $msg_list[$msg_idx] = array($msg_id, $handled ? $list : 'Unhandled');
144  $page['list']['#rows'][$msg_idx] = $row;
145  }
146  $mailbox->close();
147  }
148  return $page;
149  }
mailinglist_list_load_all($show_disabled=TRUE)
Load all mailinglists.

Here is the call graph for this function:

test_page (   $js,
  $input,
  $mailbox 
)

Callback to test a mailbox connection.

Definition at line 81 of file MailinglistRetrieveUI.class.php.

References _mailinglist_mailbox_test_output().

81  {
82  $input['test_result'] = _mailinglist_mailbox_test_output($mailbox);
83  if (!$js) {
84  drupal_goto(ctools_export_ui_plugin_base_path($this->plugin));
85  }
86  else {
87  return $this->list_page($js, $input);
88  }
89  }
_mailinglist_mailbox_test_output($mailbox)
_mailinglist_mailbox_test_output()

Here is the call graph for this function:


The documentation for this class was generated from the following file: