--- /home/shenliang/Desktop/privatemsg.module	2010-04-12 21:13:16.000000000 +0800
+++ /var/www/svn/futurename/sites/all/modules/contrib/privatemsg/privatemsg.module	2010-07-26 10:28:34.000000000 +0800
@@ -518,6 +518,24 @@ function private_message_settings() {
     '#options'       => $amounts,
     '#weight'        => 20,
   );
+
+  $form['privatemsg_compose_form'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Compose settings'),
+    '#collapsible' => TRUE,
+    '#collapsed' => FALSE,
+  );
+  $form['privatemsg_compose_form']['privatemsg_display_format_selection'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Show format selection on compose form'),
+    '#default_value' => variable_get('privatemsg_display_format_selection', FALSE),
+  );
+  $form['privatemsg_compose_form']['privatemsg_display_preview_button'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Show preview button on compose form'),
+    '#default_value' => variable_get('privatemsg_display_preview_button', FALSE),
+  );
+
   drupal_add_js(drupal_get_path('module', 'privatemsg') .'/privatemsg-admin.js');
 
   $form['#submit'][] = 'private_message_settings_submit';
@@ -926,20 +944,27 @@ function privatemsg_new(&$form_state, $r
     '#default_value'      => $body,
     '#resizable'          => TRUE,
   );
-  $format = FILTER_FORMAT_DEFAULT;
-  // The input filter widget looses the format during preview, specify it
-  // explicitly.
-  if (isset($form_state['values']) && array_key_exists('format', $form_state['values'])) {
-    $format = $form_state['values']['format'];
+
+  if (variable_get('privatemsg_display_format_selection', FALSE)) {
+    $format = FILTER_FORMAT_DEFAULT;
+    // The input filter widget looses the format during preview, specify it
+    // explicitly.
+    if (isset($form_state['values']) && array_key_exists('format', $form_state['values'])) {
+      $format = $form_state['values']['format'];
+    }
+
+    $form['privatemsg']['format'] = filter_form($format);
+  }
+
+  if (variable_get('privatemsg_display_preview_button', FALSE)) {
+    $form['privatemsg']['preview'] = array(
+      '#type'               => 'submit',
+      '#value'              => t('Preview message'),
+      '#submit'             => array('pm_preview'),
+      '#validate'           => array('pm_send_validate'),
+      '#weight'             => 10,
+    );
   }
-  $form['privatemsg']['format'] = filter_form($format);
-  $form['privatemsg']['preview'] = array(
-    '#type'               => 'submit',
-    '#value'              => t('Preview message'),
-    '#submit'             => array('pm_preview'),
-    '#validate'           => array('pm_send_validate'),
-    '#weight'             => 10,
-  );
   $form['privatemsg']['submit'] = array(
     '#type'               => 'submit',
     '#value'              => t('Send message'),
@@ -2509,4 +2534,4 @@ function privatemsg_views_api() {
     'api' => 2,
     'path' => drupal_get_path('module', 'privatemsg') . '/views',
   );
-}
\ No newline at end of file
+}
