Only in mlm: .svn Common subdirectories: ../../../drupal-cvs/modules/contributions/modules/mlm/CVS and mlm/CVS Only in mlm: LICENSE.txt Common subdirectories: ../../../drupal-cvs/modules/contributions/modules/mlm/backend and mlm/backend diff -u ../../../drupal-cvs/modules/contributions/modules/mlm/mlm.inc mlm/mlm.inc --- ../../../drupal-cvs/modules/contributions/modules/mlm/mlm.inc 2006-03-24 17:48:14.000000000 -0500 +++ mlm/mlm.inc 2006-06-14 13:24:51.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) { @@ -489,8 +492,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 +667,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,18 +677,26 @@ $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, ); } diff -u ../../../drupal-cvs/modules/contributions/modules/mlm/mlm.module mlm/mlm.module --- ../../../drupal-cvs/modules/contributions/modules/mlm/mlm.module 2006-03-20 22:49:53.000000000 -0500 +++ mlm/mlm.module 2006-06-14 13:34:55.000000000 -0400 @@ -72,14 +72,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 +94,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; + } }