--- D:/abuse.module	Sat Oct 20 19:36:39 2007
+++ D:/Websites/localhost/onc/sites/all/modules/abuse/abuse.module	Sat Oct 20 19:05:14 2007
@@ -242,6 +242,10 @@
     '#rows' => 5,
     '#cols' => 50,
   );
+  $form['add_reason']['only_email'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Use just for email notice.'),
+  );
   $form['add_reason']['add'] = array(
     '#type' => 'submit',
     '#value' => t('add'),
@@ -274,6 +278,10 @@
         '#type' => 'item',
         '#value' => t('Email content') .': '. t($reason->argumentation)
       );
+      $form['reason_list']['field'. $count]['only_email'] = array(
+        '#type' => 'item',
+        '#value' => t('Email only') .': '. (($reason->only_email == 1)? t('yes'): t('no'))
+      );
     }
     $form['reason_list']['remove'] = array(
       '#type' => 'submit',
@@ -302,8 +310,8 @@
 
 function abuse_admin_configure_reasons_submit($form_id, $form_values) {
   if ($form_values['op'] == t('add')) {
-    db_query("INSERT INTO {abuse_reasons} (arid, reason, description, argumentation) VALUES (%d, '%s', '%s', '%s')", 
-      db_next_id('{abuse_reasons}_arid'), $form_values['short_form'], $form_values['description'], $form_values['email_notice']);
+    db_query("INSERT INTO {abuse_reasons} (arid, reason, description, argumentation, only_email ) VALUES (%d, '%s', '%s', '%s', '%d')", 
+      db_next_id('{abuse_reasons}_arid'), $form_values['short_form'], $form_values['description'], $form_values['email_notice'], $form_values['only_email']);
     drupal_set_message('Reason successfully added to list of reasons.');
   } 
   elseif ($form_values['op'] == t('remove')) {
@@ -543,7 +551,9 @@
   $reason_objects = _abuse_reasons();
   $reasons = array(0 => '');
   foreach ($reason_objects as $reason) {
-    $reasons[$reason->arid] = t($reason->reason);
+    if($reason->only_email == 0){
+      $reasons[$reason->arid] = t($reason->reason);
+    }
   }
   $form['reason'] = array(
     '#type' => 'select',
@@ -705,6 +715,10 @@
 }
 
 function abuse_warn_form($object, $op) {
+  $reasons =_abuse_reasons();
+  foreach ($reasons as $reason) {
+    $options[$reason->arid] = $reason->reason;  
+  };
   $form = array();
   $form['object_type'] = array(
     '#type' => 'value',
@@ -715,21 +729,35 @@
     '#value' => $object->oid
   );
   $form['subject'] = array(
+    '#type' => 'select',
+    '#title' => t('Warning type'),
+    '#options' =>  $options,
+    '#description' => t('Type of email warning.'),
+  );
+   $form['custom_warning'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Custom warning'),
+    '#collapsible' => TRUE,
+    '#collapsed' => TRUE,
+  );
+  $form['custom_warning']['custom_subject'] = array(
     '#type' => 'textfield',
     '#title' => t('Warning subject'),
     '#default_value' => t(variable_get('abuse_warn_subject', '')),
     '#cols' => 72,
     '#rows' => 10,
-    '#required' => TRUE,
   );
-  $form['body'] = array(
+  $form['custom_warning']['custom_body'] = array(
     '#type' => 'textarea',
-    '#title' => t('Warning subject'),
+    '#title' => t('Warning body'),
     '#default_value' => t(variable_get('abuse_warn_body', '')),
     '#size' => 72,
-    '#required' => TRUE,
     '#description' => t('available fields are !title, !url, and !name')
   );
+   $form['custom_warning']['use'] = array(
+    '#type' => 'checkbox',
+    '#title' => t('Use this warning.'),
+  );
   $form['warn'] = array(
     '#type' => 'submit',
     '#value' => t('Warn and '. ucfirst($op))
@@ -749,26 +777,32 @@
   else {
     $object = _abuse_load($form_values['object_type'], $form_values['object_oid']);
     $account = user_load(array('uid' => $object->uid));
-    $subject = ($form_values['subject']) ? $form_values['subject'] : variable_get('abuse_warn_subject', '');
-    $body = ($form_values['body']) ? $form_values['body'] : variable_get('abuse_warn_body', '');
-    $vars = array(
-      '!title' => $object->title,
-      '!url' => $object->link,
-      '!name' => $account->name
-    );
-    
-    $subject = strtr($subject, $vars);
-    $body = strtr($body, $vars);
-    $bcc = variable_get('abuse_warn_bcc', '');
-    $to = $account->mail;
-    $from = variable_get('site_mail', '');
-    $headers = array(
-      'From' => $from,
-      'Reply-to' => $from,
-      'X-Mailer' => t('Drupal'),
-      'Return-Path' => $from,
-      'Errors-to' => $from
-    );
+    if ($form_values['use']){
+      $subject = ($form_values['custom_subject']) ? $form_values['custom_subject'] : variable_get('abuse_warn_subject', '');
+      $body = ($form_values['custom_body']) ? $form_values['custom_body'] : variable_get('abuse_warn_body', '');
+      $vars = array(
+        '!title' => $object->title,
+        '!url' => $object->link,
+        '!name' => $account->name
+      );
+      $subject = strtr($subject, $vars);
+      $body = strtr($body, $vars);
+    } 
+    else{
+      $arg_body = _abuse_reasons($form_values['subject']);
+      $subject = $arg_body[0]->reason;
+      $body = $arg_body[0]->argumentation;
+    }
+      $bcc = variable_get('abuse_warn_bcc', '');
+      $to = $account->mail;
+      $from = variable_get('site_mail', '');
+      $headers = array(
+        'From' => $from,
+        'Reply-to' => $from,
+        'X-Mailer' => t('Drupal'),
+        'Return-Path' => $from,
+        'Errors-to' => $from
+      );
     if ($bcc) {
       $headers['Bcc'] = $bcc;
     }
