Only in mlm: .svn
Only in mlm: CVS
Only in mlm.cvs: LICENSE.txt
Common subdirectories: mlm.cvs/backend and mlm/backend
diff -u mlm.cvs/mlm.inc mlm/mlm.inc
--- mlm.cvs/mlm.inc 2006-03-24 20:11:26.000000000 -0500
+++ mlm/mlm.inc 2006-07-03 13:16:23.000000000 -0400
@@ -47,28 +47,31 @@
return $types;
}
-function _mlm_user_form($user) {
+function _mlm_user_form($user, $category) {
+ if ($category == "mlm") {
$form = array();
- foreach (mlm_lists(null, null, $user) as $list) {
- if (!isset($form['mlm_register'])) {
- $form['mlm_register'] = array(
- '#type' => 'fieldset',
- '#title' => t('Mailing Lists'),
- '#collapsible' => TRUE,
- '#collapsed' => FALSE,
- '#weight' => 5,
- );
- $form['mlm_register']['mlm_lists'] = array( '#type' => 'checkboxes' );
- }
- $form['mlm_register']['mlm_lists'][$list->nid] = array(
- '#type' => 'checkbox',
- '#title' => $list->title,
- '#default_value' => (int) $list->subscribed,
- '#prefix' => '
',
- '#suffix' => '
',
- );
+ foreach (mlm_lists(null, null, $user) as $list) {
+ if (!isset($form['mlm_register'])) {
+ $form['mlm_register'] = array(
+ '#type' => 'fieldset',
+ '#title' => t('Mailing Lists'),
+ '#collapsible' => TRUE,
+ '#collapsed' => FALSE,
+ '#weight' => 5,
+ '#description' => variable_get('mlm_explanation', 'You can manage your mailing list subscriptions here.'),
+ );
+ $form['mlm_register']['mlm_lists'] = array( '#type' => 'checkboxes' );
+ }
+ $form['mlm_register']['mlm_lists'][$list->nid] = array(
+ '#type' => 'checkbox',
+ '#title' => $list->title,
+ '#default_value' => (int) $list->subscribed,
+ '#prefix' => '',
+ '#suffix' => '
',
+ );
+ }
+ return $form;
}
- return $form;
}
function _mlm_node_form(&$node) {
@@ -339,7 +342,7 @@
$rows[] = $row;
}
$output .= theme('table', $header, $rows);
- $output .= theme('pager', NULL, 50, 0, tablesort_pager());
+ $output .= theme('pager', NULL, 50, 0);
return $output;
}
return;
@@ -465,6 +468,7 @@
array('data' => t('Backend'), 'field' => 'backend'),
array('data' => t('Type'), 'field' => 'type'),
array('data' => t('Subscribers')),
+ array('data' => t('Visible')),
array('data' => t('Operations'), 'colspan' => '2')
);
$sql .= db_rewrite_sql(tablesort_sql($header));
@@ -474,12 +478,14 @@
while ($row = db_fetch_object($result)) {
$count = mlm_backend_call($row->backend, 'count',node_load($row->nid));
if ($count) $count = number_format((int) $count);
+ if($row->status == 1) {$published = t('Visable'); } else {$published = t('Hidden'); }
$rows[] = array(
l($row->title, 'node/'.$row->nid),
$row->status,
$backends[$row->backend]->name,
$row->list_type,
array('data'=>$count ? l($count, "admin/mlm/list/$row->nid") : '-', 'align'=>'right'),
+ $row->status ? ("visible") : ("hidden"),
l(t('edit'), "admin/mlm/form/$row->nid", array(), $destination).' ',
'',
);
@@ -489,8 +495,28 @@
$rows[] = array(array('data' => t('No lists available.'), 'colspan' => '4'));
}
- $output = theme('table', $header, $rows);
- $output .= theme('pager', NULL, 50, 0, tablesort_pager());
+ $form['mlm_settings'] = array(
+ '#type' => 'fieldset',
+ '#title' => t('MLM Settings'),
+ );
+
+ $form['mlm_settings']['mlm_explanation'] = array(
+ '#type' => 'textarea',
+ '#title' => t('Mailing Lists explanation'),
+ '#default_value' => variable_get('mlm_explanation', 'You can manage your mailing list subscriptions here.'),
+ '#description' => t("This text is displayed on the Edit User > Mailing List page."),
+ );
+ $form['mlm_settings']['submit'] = array(
+ '#type' => 'submit',
+ '#value' => t('Save')
+ );
+
+ // output MLM options
+ $output = drupal_get_form('mlm_options', $form);
+
+
+ $output .= theme('table', $header, $rows);
+ $output .= theme('pager', NULL, 50, 0);
return $output;
}
@@ -644,7 +670,7 @@
}
else {
$form['mlm_mail'] = array (
- '#type' => 'textfield',
+ '#type' => 'textfield',
'#title' => t('E-Mail Address'),
'#default_value' => $mail ? $mail : t('email address'),
'#size' => 20,
@@ -654,19 +680,27 @@
$form['mlm_mail']['#attributes'] = array('onclick' => "this.value='';");
}
}
- $form['mlm_lists'] = array(
- '#type' => 'checkboxes',
- '#title' => t('Mailing Lists'),
+
+ $form['mlm_options'] = array(
+ '#type' => 'fieldset',
+ '#title' => t('Mailing Lists'),
+ '#description' => variable_get('mlm_explanation', 'You can manage your mailing list subscriptions here.'),
);
+
+ $form['mlm_options']['mlm_lists'] = array(
+ '#type' => 'checkboxes',
+ '#title' => t('Available Lists'),
+ );
+
foreach ($lists as $l) {
- $form['mlm_lists'][$l->nid] = array(
- '#type' => 'checkbox',
- '#default_value' => (int) $l->subscribed,
- '#title' => l($l->title, 'node/'.$l->nid),
+ $form['mlm_options']['mlm_lists'][$l->nid] = array(
+ '#type' => 'checkbox',
+ '#default_value' => (int) $l->subscribed,
+ '#title' => l($l->title, 'node/'.$l->nid),
'#prefix' => '',
'#suffix' => '
',
- '#description' => $l->teaser,
- );
+ '#description' => $l->teaser,
+ );
}
$form['submit'] = array('#type' => 'submit', '#value' => t('Save Preferences'));
diff -u mlm.cvs/mlm.module mlm/mlm.module
--- mlm.cvs/mlm.module 2006-03-21 08:07:41.000000000 -0500
+++ mlm/mlm.module 2006-07-03 13:01:43.000000000 -0400
@@ -57,11 +57,13 @@
'title' => t('add list'),
'type' => MENU_LOCAL_TASK);
}
+
else {
$items[] = array('path' => 'admin/mlm/form',
'title' => t('add list'),
'type' => MENU_DEFAULT_LOCAL_TASK);
}
+
$items[] = array('path' => 'admin/mlm/backends',
'title' => t('backends'),
'type' => MENU_LOCAL_TASK);
@@ -72,14 +74,14 @@
/**
* Implementation of hook_user().
*/
-function mlm_user($op, &$edit, &$user) {
+function mlm_user($op, &$edit, &$user, $category = null) {
if (!user_access('subscribe to mailing lists')) return;
switch ($op) {
case 'form':
require_once dirname(__FILE__).'/mlm.inc';
- return _mlm_user_form($user);
+ return _mlm_user_form($user, $category);
case 'insert':
require_once dirname(__FILE__).'/mlm.inc';
@@ -94,6 +96,11 @@
case 'delete':
// if there are ever drupal-only lists, unsubscribe user here
return;
+
+ case 'categories':
+ return array(array('name' => 'mlm', 'title' => 'Mailing List Management', 'weight' => 10));
+ break;
+
}
}
@@ -308,7 +315,7 @@
return false;
}
-function mlm_lists($list_type=null, $backend=null, $mail=null) {
+function mlm_lists($list_type=null, $backend=null, $mail=null, $show_hidden=false) {
$lists = array();
if (is_object($mail)) $mail = $mail->mail;
@@ -322,7 +329,10 @@
if ($mail) {
$list->subscribed = mlm_is_subscribed($list, $mail);
}
- $lists[$list->nid] = $list;
+ // only return published lists unless otherwise instructed
+ if (($list->status != 0) || $show_hidden) {
+ $lists[$list->nid] = $list;
+ }
}
return $lists;
}