From: Joao Ventura Date: Sat, 24 Jul 2010 16:01:31 +0000 (+0000) Subject: Add option to set default mail sending format X-Git-Tag: 7.x-1.0-alpha1~70 X-Git-Url: http://drupalcode.org/project/print.git/commitdiff_plain/39610ea7fab3a76bc3dfe450fd86f892544e0fbf Add option to set default mail sending format --- diff --git a/print_mail/print_mail.admin.inc b/print_mail/print_mail.admin.inc index 8e250ec..921c328 100644 --- a/print_mail/print_mail.admin.inc +++ b/print_mail/print_mail.admin.inc @@ -11,6 +11,9 @@ * @ingroup print */ +// Include MIME library +@include_once('Mail/mime.php'); + /** * Menu callback for the send by e-mail module settings form. * @@ -146,6 +149,20 @@ function print_mail_settings() { '#description' => t('If checked, the user will be able to choose between sending the full content or only the teaser at send time.'), ); + $form['settings']['print_mail_send_option_default'] = array( + '#type' => 'select', + '#title' => t('Default e-mail sending format'), + '#default_value' => variable_get('print_mail_send_option_default', PRINT_MAIL_SEND_OPTION_DEFAULT), + '#options' => array( + 'sendlink' => 'Link', + 'sendpage' => 'Inline HTML', + ), + ); + if (class_exists('Mail_mime')) { + $form['settings']['print_mail_send_option_default']['#options']['inline-attachment'] = 'Inline HTML with Attachment'; + $form['settings']['print_mail_send_option_default']['#options']['plain-attachment'] = 'Plain Text with Attachment'; + } + if (module_exists('job_queue')) { $form['settings']['print_mail_job_queue'] = array( '#type' => 'checkbox', diff --git a/print_mail/print_mail.inc b/print_mail/print_mail.inc index c9ef277..caabe33 100644 --- a/print_mail/print_mail.inc +++ b/print_mail/print_mail.inc @@ -99,14 +99,13 @@ function print_mail_form($form, &$form_state) { $form['fld_send_option'] = array( '#type' => 'select', '#title' => t('Send page as'), - '#default_value' => 'sendpage', + '#default_value' => variable_get('print_mail_send_option_default', PRINT_MAIL_SEND_OPTION_DEFAULT), '#options' => array( 'sendlink' => 'Link', 'sendpage' => 'Inline HTML', ), ); if (class_exists('Mail_mime')) { - $form['fld_send_option']['#default_value'] = 'plain-attachment'; $form['fld_send_option']['#options']['inline-attachment'] = 'Inline HTML with Attachment'; $form['fld_send_option']['#options']['plain-attachment'] = 'Plain Text with Attachment'; } diff --git a/print_mail/print_mail.module b/print_mail/print_mail.module index 5600ee9..c528ccb 100644 --- a/print_mail/print_mail.module +++ b/print_mail/print_mail.module @@ -25,6 +25,7 @@ define('PRINT_MAIL_BOOK_LINK_DEFAULT', 1); define('PRINT_MAIL_HOURLY_THRESHOLD', 3); define('PRINT_MAIL_TEASER_DEFAULT_DEFAULT', 1); define('PRINT_MAIL_TEASER_CHOICE_DEFAULT', 1); +define('PRINT_MAIL_SEND_OPTION_DEFAULT', 'sendpage'); define('PRINT_MAIL_JOB_QUEUE_DEFAULT', 0); /**