Mailinglist
 All Data Structures Files Functions Variables Pages
Functions
mailinglist.pagecallback.inc File Reference

Mailinglist front end pages. More...

Go to the source code of this file.

Functions

 _mailinglist_pagecallback ()
 Page call back function for mailinglist. More...
 
 _mailinglist_list_pagecallback ($list= '', $oper= '', $p1= '', $p2= '', $p3= '', $p4= '')
 _mailinglist_list_pagecallback() More...
 
 mailinglist_operation_form ($form, &$form_state)
 mailinglit_operation_form(). More...
 
 mailinglist_operation_form_validate ($form, &$form_state)
 mailinglit_operationr_form_validate(). More...
 
 mailinglist_operation_form_submit ($form, &$form_state)
 mailinglit_operationr_form_submit(). More...
 

Detailed Description

Mailinglist front end pages.

Definition in file mailinglist.pagecallback.inc.

Function Documentation

_mailinglist_list_pagecallback (   $list = '',
  $oper = '',
  $p1 = '',
  $p2 = '',
  $p3 = '',
  $p4 = '' 
)

_mailinglist_list_pagecallback()

callback for $base/mailinglist_list

Definition at line 58 of file mailinglist.pagecallback.inc.

References mailinglist_operation_load().

59  {
60  $base = variable_get('mailinglist_base', 'mailinglist');
61  $breadcrumb = array(
62  l(t('Home'), '<front>'),
63  l(t('Mailing Lists'), $base),
64  );
65  drupal_set_breadcrumb($breadcrumb);
66 
67  $page = array();
68  if (!($list instanceof MailinglistListInterface) || !user_access('mailinglist ' . $list->admin_name)) {
69  drupal_set_title(t('Unknown Mailing List'));
70  $page = array("#markup" => "Unknown Mailing List.");
71  }
72  else {
73  $listname = $list->admin_name;
74  drupal_set_title($list->admin_title);
75  $page['oper'] = array(
76  '#theme' => 'item_list',
77  '#type' => 'ul',
78  '#attributes' => array('class' => 'mailinglist_list'),
79  );
80  foreach ($list->operations as $index => $enabled) {
81  if ($enabled) {
82  $oper = mailinglist_operation_load($index);
83  if ($oper->hasPermission($list)) {
84  $page['oper']['#items'][$index] = array('data' => l($oper->plugin['name'], "$base/$listname/$index"));
85  }
86  }
87  }
88  }
89  return $page;
90 }
Interface to a mailing list.
mailinglist_operation_load($oper)
@ name CTools Operation/******** operation

Here is the call graph for this function:

_mailinglist_pagecallback ( )

Page call back function for mailinglist.

address is of form /mailinglist/listname/operation/ (mailinglist can be replaced with a different path) if no listname, give general information with a list of mailing lists available if no operation, give list introduction with a list of operations operations looked up in via plugin.

Todo:
get node id of our introduction.

Definition at line 18 of file mailinglist.pagecallback.inc.

References mailinglist_list_load_all().

18  {
19  $base = variable_get('mailinglist_base', 'mailinglist');
20  $breadcrumb = array(
21  l(t('Home'), '<front>'),
22  );
23  drupal_set_breadcrumb($breadcrumb);
24 
25  $lists = mailinglist_list_load_all(false);
26  $page = array();
28 // $page['node'] = node_view(node_load(1));
29 // dpm($page);
30  if (empty($lists)) {
31  $page['list'] = array('#markup' => 'No Mailinglist defined');
32  }
33  else {
34  $page['head'] = array('#markup' => 'This is a listing of lists available');
35  $page['list'] = array(
36  '#theme' => 'item_list',
37  '#type' => 'ul',
38  '#attributes' => array('class' => 'mailinglist_list'),
39  );
40  foreach ($lists as $index => $list) {
41  // only show pages the user has access to
42  if (user_access('mailinglist ' . $index)) {
43  $admin_name = check_plain($list->admin_name);
44  $admin_title = check_plain($list->admin_title);
45  $markup = "<a href=/$base/$admin_name>$admin_title</a>";
46  $page['list']['#items'][$index] = array('data' => $markup);
47  }
48  }
49  }
50  return $page;
51 }
mailinglist_list_load_all($show_disabled=TRUE)
Load all mailinglists.

Here is the call graph for this function:

mailinglist_operation_form (   $form,
$form_state 
)

mailinglit_operation_form().

Implements hook_form();

Definition at line 97 of file mailinglist.pagecallback.inc.

97  {
98  watchdog('Mailinglist', "<pre>Form: @f \nState: @s</pre>",
99  array('@f' => print_r($form, TRUE), '@s' => print_r($form_state, TRUE)), WATCHDOG_INFO);
100  $list = $form_state['build_info']['args'][0];
101  $operation = $form_state['build_info']['args'][1];
102 
103  if (!($list instanceof MailinglistListInterface)) {
104  drupal_set_title(t('Unknown Mailing List'));
105  $form = array("#markup" => "Unknown Mailing List.");
106  return $form;
107  }
108 
109  if (!($operation instanceof MailinglistOperationInterface) || !$operation->hasPermission($list)) {
110  drupal_set_title(t('Unknown Operation'));
111  $form = array("#markup" => "Unknown Operation.");
112  return $form;
113  }
114  $base = variable_get('mailinglist_base', 'mailinglist');
115  $breadcrumb = array(
116  l(t('Home'), '<front>'),
117  l(t('Mailing Lists'), $base),
118  l($list->admin_title , $base . '/' . $list->admin_name),
119  );
120  drupal_set_breadcrumb($breadcrumb);
121  drupal_set_title($list->admin_title . ' - ' . $operation->plugin['name']);
122 
123  $operation->form($form, $form_state, $list);
124 
125  return $form;
126 }
Interface to a mailing list.
interface MailinglistOperationInterface
mailinglist_operation_form_submit (   $form,
$form_state 
)

mailinglit_operationr_form_submit().

Implements hook_form_submit();

Definition at line 152 of file mailinglist.pagecallback.inc.

152  {
153  watchdog('Mailinglist', "<pre>Submit: @f \nState: @s</pre>",
154  array('@f' => print_r($form, TRUE), '@s' => print_r($form_state, TRUE)), WATCHDOG_INFO);
155  $list = $form_state['build_info']['args'][0];
156  $operation = $form_state['build_info']['args'][1];
157  if ($operation instanceof MailinglistOperationInterface) {
158  $operation->submit($form, $form_state, $list);
159  }
160  else {
161  dpm(func_get_args(), 'submit?');
162  }
163 }
interface MailinglistOperationInterface
mailinglist_operation_form_validate (   $form,
$form_state 
)

mailinglit_operationr_form_validate().

Implements hook_form_validate();

Definition at line 133 of file mailinglist.pagecallback.inc.

133  {
134  watchdog('Mailinglist', "<pre>Validate: @f \nState: @s</pre>",
135  array('@f' => print_r($form, TRUE), '@s' => print_r($form_state, TRUE)), WATCHDOG_INFO);
136 // dpm($form_state, 'Validate');
137  $list = $form_state['build_info']['args'][0];
138  $operation = $form_state['build_info']['args'][1];
139  if ($operation instanceof MailinglistOperationInterface) {
140  $operation->validate($form, $form_state, $list);
141  }
142  else {
143  dpm(func_get_args(), 'validate?');
144  }
145 }
interface MailinglistOperationInterface