--- listhandler.info 1969-12-31 19:00:00.000000000 -0500 +++ listhandler.info 2007-05-23 16:08:02.000000000 -0400 @@ -0,0 +1,5 @@ +; $Id $ +name = Listhandler +description = "Integrate with mailing lists." +version = "5.1-1.0" +dependencies = mailhandler --- listhandler.install 2006-09-26 19:35:23.000000000 -0400 +++ listhandler.install 2007-07-04 20:22:06.000000000 -0400 @@ -7,7 +7,7 @@ function listhandler_install() { switch ($GLOBALS['db_type']) { case 'mysql': case 'mysqli': - db_query("CREATE TABLE listhandler ( + db_query("CREATE TABLE {listhandler} ( lid int(10) unsigned not null auto_increment primary key, msgid varchar(255) not null, nid int(10) NOT NULL default '0', @@ -16,13 +16,35 @@ function listhandler_install() { uid int(10) NOT NULL default '0', mid int(10) NOT NULL default '0', tid int(10) NOT NULL default '0', + prefix varchar(255) NOT NULL DEFAULT'', key (lid) ) /*!40100 DEFAULT CHARACTER SET utf8 */;"); - db_query("ALTER TABLE mailhandler ADD prefix varchar(255) not null DEFAULT ''"); break; + case 'pgsql': + db_query("CREATE TABLE {listhandler} ( + lid serial, + msgid text not null, + nid integer NOT NULL default 0, + cid integer NOT NULL default 0, + pid integer NOT NULL default 0, + uid integer NOT NULL default 0, + mid integer NOT NULL default 0, + tid integer NOT NULL default 0, + prefix text NOT NULL DEFAULT '', + PRIMARY KEY (lid) + );"); + break; + } } +function listhandler_uninstall() { + db_query('DROP TABLE {listhandler}'); + variable_del('listhandler_from'); + variable_del('listhandler_strip_title'); + variable_del('listhandler_accountstatus'); +} + /** * Update database hooks */ --- listhandler.module 2007-02-14 06:25:57.000000000 -0500 +++ listhandler.module 2007-07-04 20:37:10.000000000 -0400 @@ -6,20 +6,21 @@ function listhandler_help($section) { switch($section) { case 'admin/help#listhandler': $output = '
'. t('The listhandler module allows you to connect mailing lists to forums and vice versa. It works in conjunction with the mailhandler module. Mailhandler receives an email and then asks listhandler if the received email is part of a list. If the email is from a mailing list associated with a forum on your site, then listhandler adds the recieved email to the forum.') .'
'; - $output .= '' .t('Listhandler administration allows you to set the email address of the list administrator. The email address is used as the From: field to check the address of messages sent by anonymous users. You can also enable and disable the listhandler for a list.') .'
'; + $output .= ''. t('Listhandler administration allows you to set the email address of the list administrator. The email address is used as the From: field to check the address of messages sent by anonymous users. You can also enable and disable the listhandler for a list.') .'
'; $output .= t('You can:
'. t('For more information please read the configuration and customization handbook Listhandler page.', array('%listhandler' => 'http://www.drupal.org/handbook/modules/listhandler/')) .'
'; +'. t('For more information please read the configuration and customization handbook Listhandler page.', array('!listhandler' => 'http://www.drupal.org/handbook/modules/listhandler/')) .'
'; return $output; - case 'admin/modules#description': + case 'admin/build/modules#description': $output = t('Connect your mailing lists to your drupal site and your drupal site to your mailing lists.'); break; - case 'admin/listhandler': - $output = t("First go to the mailhandler configuration screen and add some mailboxes. A mailbox becomes recognised as a mailing list if the 'Second E-mail address' is set. This is not optional for mailing lists.", array('%url' => url('admin/mailhandler'))); + case 'admin/content/listhandler': + $output = t("First go to the mailhandler configuration screen and add some mailboxes. A mailbox becomes recognised as a mailing list if the 'Second E-mail address' is set. This is not optional for mailing lists.", array('!url' => url('admin/content/mailhandler'))); break; } return $output; @@ -37,9 +38,11 @@ function listhandler_menu($may_cache) { $items = array(); if ($may_cache) { - $items[] = array('path' => 'admin/listhandler', - 'title' => t('listhandler'), - 'callback' => 'listhandler_admin', + $items[] = array('path' => 'admin/content/listhandler', + 'title' => t('Listhandler'), + 'description' => t('Manage mailing-lists subscriptions.'), + 'callback' => 'drupal_get_form', + 'callback arguments' => array('listhandler_admin_settings'), 'access' => user_access('administer listhandler')); } @@ -49,27 +52,28 @@ function listhandler_menu($may_cache) { /** * Configuration options for this module */ -function listhandler_admin_form() { +function listhandler_admin_settings() { + $form['#submit'] = array('listhandler_admin_settings_submit' => array()); $form['listhandler_from'] = array( - '#type' => 'textfield', - '#title' => t('Admin address'), - '#default_value' => variable_get('listhandler_from', ''), - '#size' => 50, - '#maxlength' => 100, - '#description' => t('The email address of the list administrator. Used as From: address of messages sent by anonymous users.')); + '#type' => 'textfield', + '#title' => t('Admin address'), + '#default_value' => variable_get('listhandler_from', ''), + '#size' => 50, + '#maxlength' => 100, + '#description' => t('The email address of the list administrator. Used as From: address of messages sent by anonymous users.')); $form['listhandler_strip_title'] = array( - '#type' => 'textfield', - '#title' => t('Strip title'), - '#default_value' => variable_get('listhandler_strip_title', 'Re: , AW:,[my list]'), - '#size' => 50, - '#maxlength' => 100, - '#description' => t("A comma delimited sequence of strings that should be stripped from the titles of topics and comments posted to the forums. You can use it to remove certain tags like 'Re: ' or '[My Mailinglist]'.")); + '#type' => 'textfield', + '#title' => t('Strip title'), + '#default_value' => variable_get('listhandler_strip_title', 'Re: , AW:,[my list]'), + '#size' => 50, + '#maxlength' => 100, + '#description' => t("A comma delimited sequence of strings that should be stripped from the titles of topics and comments posted to the forums. You can use it to remove certain tags like 'Re: ' or '[My Mailinglist]'.")); $form['listhandler_accountstatus'] = array( - '#type' => 'select', - '#title' => t('Account status'), - '#default_value' => variable_get('listhandler_accountstatus', 0), - '#options' => array(0 => t('blocked'), 1 => t('active')), - '#description' => t('The status of accounts created by listhandler.')); + '#type' => 'select', + '#title' => t('Account status'), + '#default_value' => variable_get('listhandler_accountstatus', 0), + '#options' => array(0 => t('blocked'), 1 => t('active')), + '#description' => t('The status of accounts created by listhandler.')); $form['listhandler_list']['#tree'] = TRUE; $form['listhandler_prefix']['#tree'] = TRUE; @@ -77,21 +81,16 @@ function listhandler_admin_form() { while ($mailbox = db_fetch_object($result)) { $form['listhandler_list'][$mailbox->mid] = array( - '#value' => ""); + '#value' => ""); $form['listhandler_prefix'][$mailbox->mid] = array( - '#type' => 'textfield', - '#title' => '', - '#default_value' => $mailbox->prefix, - '#size' => 50, - '#maxlength' => 100); + '#type' => 'textfield', + '#title' => $mailbox->mid, + '#default_value' => $mailbox->prefix, + '#size' => 50, + '#maxlength' => 100); } - $form[] = array( - '#type' => 'submit', - '#value' => t('Submit'), - ); - - return drupal_get_form('listhandler_settings', $form); + return system_settings_form($form); } /** @@ -99,15 +98,15 @@ function listhandler_admin_form() { */ function theme_listhandler_settings($form) { - $output = form_render($form['listhandler_from']); - $output .= form_render($form['listhandler_strip_title']); - $output .= form_render($form['listhandler_accountstatus']); + $output = drupal_render($form['listhandler_from']); + $output .= drupal_render($form['listhandler_strip_title']); + $output .= drupal_render($form['listhandler_accountstatus']); if (count($form['listhandler_list'])) { $rows = array(); foreach(element_children($form['listhandler_list']) as $mid) { $row = array(); - $row[] = form_render($form['listhandler_list'][$mid]); - $row[] = form_render($form['listhandler_prefix'][$mid]); + $row[] = drupal_render($form['listhandler_list'][$mid]); + $row[] = drupal_render($form['listhandler_prefix'][$mid]); $rows[] = $row; } $header = array(t('mailing list'), t('prefix')); @@ -115,28 +114,25 @@ function theme_listhandler_settings($for $output .= '