svncommit
2008-04-15 8e5defd55f02cfd5f438cfdee823221bb3e8ed45
program/steps/mail/compose.inc
@@ -19,9 +19,6 @@
*/
require_once('Mail/mimeDecode.php');
require_once('lib/html2text.inc');
// define constants for message compose mode
define('RCUBE_COMPOSE_REPLY', 0x0106);
define('RCUBE_COMPOSE_FORWARD', 0x0107);
@@ -159,14 +156,14 @@
      }
        
      $allow_attrib = array('id', 'class', 'style', 'cols', 'rows', 'tabindex');
      $field_type = 'textarea';
      $field_type = 'html_textarea';
      break;
    case 'replyto':
    case 'reply-to':
      $fname = '_replyto';
      $allow_attrib = array('id', 'class', 'style', 'size', 'tabindex');
      $field_type = 'textfield';
      $field_type = 'html_inputfield';
      break;    
  }
 
@@ -231,7 +228,7 @@
    // create teaxtarea object
    $input = new $field_type($field_attrib);
    $out = $input->show($fvalue);
    $out = $input->show($fvalue);
  }
  
  if ($form_start)
@@ -285,7 +282,7 @@
    $a_signatures = array();
    $field_attrib['onchange'] = JS_OBJECT_NAME.".change_identity(this)";
    $select_from = new select($field_attrib);
    $select_from = new html_select($field_attrib);
    while ($sql_arr = $DB->fetch_assoc($sql_result))
    {
@@ -327,7 +324,7 @@
  }
  else
  {
    $input_from = new textfield($field_attrib);
    $input_from = new html_inputfield($field_attrib);
    $out = $input_from->show($_POST['_from']);
  }
  
@@ -413,25 +410,30 @@
    $body = rcmail_create_draft_body($body, $isHtml);
    }
  $tinylang = substr($_SESSION['user_lang'], 0, 2);
  if (!file_exists('program/js/tiny_mce/langs/'.$tinylang.'.js'))
    {
    $tinylang = 'en';
    }
  $OUTPUT->include_script('tiny_mce/tiny_mce.js');
  $OUTPUT->include_script("editor.js");
  $OUTPUT->add_script('rcmail_editor_init("$__skin_path");');
  $OUTPUT->add_script('rcmail_editor_init("$__skin_path", "'.$tinylang.'");');
  $out = $form_start ? "$form_start\n" : '';
  $saveid = new hiddenfield(array('name' => '_draft_saveid', 'value' => $compose_mode==RCUBE_COMPOSE_DRAFT ? str_replace(array('<','>'), "", $MESSAGE['headers']->messageID) : ''));
  $saveid = new html_hiddenfield(array('name' => '_draft_saveid', 'value' => $compose_mode==RCUBE_COMPOSE_DRAFT ? str_replace(array('<','>'), "", $MESSAGE['headers']->messageID) : ''));
  $out .= $saveid->show();
  $drafttoggle = new hiddenfield(array('name' => '_draft', 'value' => 'yes'));
  $drafttoggle = new html_hiddenfield(array('name' => '_draft', 'value' => 'yes'));
  $out .= $drafttoggle->show();
  $msgtype = new hiddenfield(array('name' => '_is_html', 'value' => ($isHtml?"1":"0")));
  $msgtype = new html_hiddenfield(array('name' => '_is_html', 'value' => ($isHtml?"1":"0")));
  $out .= $msgtype->show();
  // If desired, set this text area to be editable by TinyMCE
  if ($isHtml)
    $attrib['mce_editable'] = "true";
  $textarea = new textarea($attrib);
  if ($isHtml) $attrib['class'] = "mce_editor";
  $textarea = new html_textarea($attrib);
  $out .= $textarea->show($body);
  $out .= $form_end ? "\n$form_end" : '';
@@ -502,7 +504,7 @@
             $IMAP->decode_header($MESSAGE['headers']->from));
    // try to remove the signature
    if ($sp = strrstr($body, '-- '))
    if ($sp = strrpos($body, '-- '))
      {
      if ($body{$sp+3}==' ' || $body{$sp+3}=="\n" || $body{$sp+3}=="\r")
        $body = substr($body, 0, $sp-1);
@@ -622,7 +624,7 @@
  unset($attrib['form']);
  
  $attrib['name'] = '_subject';
  $textfield = new textfield($attrib);
  $textfield = new html_inputfield($attrib);
  $subject = '';
@@ -750,7 +752,7 @@
  unset($attrib['form']);
  
  $attrib['name'] = '_priority';
  $selector = new select($attrib);
  $selector = new html_select($attrib);
  $selector->add(array(rcube_label('lowest'),
                       rcube_label('low'),
@@ -781,7 +783,7 @@
  $attrib['name'] = '_receipt';
  $attrib['value'] = '1';
  $checkbox = new checkbox($attrib);
  $checkbox = new html_checkbox($attrib);
  $out = $form_start ? "$form_start\n" : '';
  $out .= $checkbox->show($MESSAGE['headers']->mdn_to ? 1 : 0);
@@ -802,9 +804,13 @@
  // determine whether HTML or plain text should be checked 
  if ($CONFIG['htmleditor'])
    {
    $useHtml = true;
    }
  else
    {
    $useHtml = false;
    }
  if ($compose_mode == RCUBE_COMPOSE_REPLY ||
      $compose_mode == RCUBE_COMPOSE_FORWARD ||
@@ -814,23 +820,19 @@
    $useHtml = ($hasHtml && $CONFIG['htmleditor']);
  }
  $chosenvalue = $useHtml ? 'html' : 'plain';
  $selector = '';
  
  $attrib['name'] = '_editorSelect';
  $attrib['onchange'] = 'return rcmail_toggle_editor(this)';
  foreach ($choices as $value => $text)
  {
    $checked = '';
    if ((($value == 'html') && $useHtml) ||
        (($value != 'html') && !$useHtml))
      $attrib['checked'] = 'true';
    else
      unset($attrib['checked']);
    $attrib['id'] = '_' . $value;
    $rb = new radiobutton($attrib);
    $attrib['value'] = $value;
    $rb = new html_radiobutton($attrib);
    $selector .= sprintf("%s<label for=\"%s\">%s</label>",
                         $rb->show($value),
                         $rb->show($chosenvalue),
                         $attrib['id'],
                         rcube_label($text));
  }
@@ -846,7 +848,7 @@
  $form_start = '';
  if (!strlen($MESSAGE_FORM))
  {
    $hiddenfields = new hiddenfield(array('name' => '_task', 'value' => $GLOBALS['_task']));
    $hiddenfields = new html_hiddenfield(array('name' => '_task', 'value' => $GLOBALS['_task']));
    $hiddenfields->add(array('name' => '_action', 'value' => 'send'));
    $form_start = empty($attrib['form']) ? '<form name="form" action="./" method="post">' : '';
@@ -862,7 +864,7 @@
  
  $MESSAGE_FORM = $form_name;
  return array($form_start, $form_end);
  return array($form_start, $form_end);
}
@@ -880,9 +882,6 @@
));
/****** get contacts for this user and add them to client scripts ********/
require_once('include/rcube_contacts.inc');
require_once('include/rcube_ldap.inc');
$CONTACTS = new rcube_contacts($DB, $USER->ID);
$CONTACTS->set_pagesize(1000);
@@ -928,5 +927,5 @@
  { 
    $OUTPUT->set_env('contacts', $a_contacts); 
  } 
parse_template('compose');
?>
$OUTPUT->send('compose');
?>