Changeset 2731 in subversion


Ignore:
Timestamp:
Jul 10, 2009 10:52:11 AM (4 years ago)
Author:
thomasb
Message:

Fix compose step: correctly choose html mode and attachments when in draft or edit mode

Location:
trunk/roundcubemail
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/roundcubemail/program/steps/mail/compose.inc

    r2646 r2731  
    3838  rcmail_compose_cleanup(); 
    3939  $_SESSION['compose'] = array( 
    40         'id' => uniqid(rand()), 
    41         'param' => array_map('strip_tags', $_GET), 
    42         'mailbox' => $IMAP->get_mailbox_name() 
     40    'id' => uniqid(rand()), 
     41    'param' => array_map('strip_tags', $_GET), 
     42    'mailbox' => $IMAP->get_mailbox_name(), 
    4343  ); 
    4444   
     
    8787  // similar as in program/steps/mail/show.inc 
    8888  // re-set 'prefer_html' to have possibility to use html part for compose 
    89   $CONFIG['prefer_html'] = $CONFIG['htmleditor']; 
     89  $CONFIG['prefer_html'] = $CONFIG['htmleditor'] || $compose_mode == RCUBE_COMPOSE_DRAFT || $compose_mode == RCUBE_COMPOSE_EDIT; 
    9090  $MESSAGE = new rcube_message($msg_uid); 
    9191   
     
    358358  $attrib['name'] = '_message'; 
    359359 
    360   if ($CONFIG['htmleditor']) 
     360  if ($CONFIG['htmleditor'] || (($compose_mode == RCUBE_COMPOSE_DRAFT || $compose_mode == RCUBE_COMPOSE_EDIT) && $MESSAGE->first_html_part())) 
    361361    $isHtml = true; 
    362362  else 
     
    563563      Q($MESSAGE->headers->date), 
    564564      htmlspecialchars(Q($MESSAGE->get_header('from'), 'replace'), ENT_COMPAT, $OUTPUT->get_charset()), 
    565         htmlspecialchars(Q($MESSAGE->get_header('to'), 'replace'), ENT_COMPAT, $OUTPUT->get_charset())); 
     565      htmlspecialchars(Q($MESSAGE->get_header('to'), 'replace'), ENT_COMPAT, $OUTPUT->get_charset())); 
    566566 
    567567    if ($MESSAGE->headers->replyto && $MESSAGE->headers->replyto != $MESSAGE->headers->from) 
    568568      $prefix .= sprintf("<tr><th align=\"right\" nowrap=\"nowrap\" valign=\"baseline\">Reply-To: </th><td>%s</td></tr>", 
    569         htmlspecialchars(Q($MESSAGE->get_header('replyto'), 'replace'), ENT_COMPAT, $OUTPUT->get_charset())); 
     569        htmlspecialchars(Q($MESSAGE->get_header('replyto'), 'replace'), ENT_COMPAT, $OUTPUT->get_charset())); 
    570570 
    571571    $prefix .= "</tbody></table><br>"; 
     
    584584   * sizeof($MESSAGE->mime_parts can be 1 - e.g. attachment, but no text! 
    585585   */ 
    586   if (!isset($_SESSION['compose']['forward_attachments']) 
     586  if (empty($_SESSION['compose']['forward_attachments']) 
    587587      && is_array($MESSAGE->mime_parts) 
    588588      && count($MESSAGE->mime_parts) > 0) 
     
    606606  foreach ((array)$message->mime_parts as $pid => $part) 
    607607  { 
    608     if (($part->ctype_primary != 'message' || !$bodyIsHtml) && $part->filename && 
    609         ($part->disposition=='attachment' || ($part->disposition=='inline' && $bodyIsHtml) || (empty($part->disposition)))) 
     608    if (($part->ctype_primary != 'message' || !$bodyIsHtml) && $part->ctype_primary != 'multipart' &&  
     609        ($part->disposition == 'attachment' || ($part->disposition == 'inline' && $bodyIsHtml) || $part->filename)) 
    610610    { 
    611611      if ($attachment = rcmail_save_attachment($message, $pid)) { 
    612612        $_SESSION['compose']['attachments'][$attachment['id']] = $attachment; 
    613         if ($bodyIsHtml && $part->filename && $part->content_id) { 
     613        if ($bodyIsHtml && $part->content_id) { 
    614614          $cid_map['cid:'.$part->content_id] = $OUTPUT->app->comm_path.'&_action=display-attachment&_file=rcmfile'.$attachment['id']; 
    615615        } 
     
    646646   
    647647  $attachment = array( 
    648     'name' => $part->filename, 
     648    'name' => $part->filename ? $part->filename : 'Part_'.$pid.'.'.$part->ctype_secondary, 
    649649    'mimetype' => $part->ctype_primary . '/' . $part->ctype_secondary, 
    650650    'content_id' => $part->content_id, 
  • trunk/roundcubemail/skins/default/templates/compose.html

    r2646 r2731  
    6969                <td class="title"><roundcube:label name="editortype" /></td> 
    7070                <td> 
    71                     <div id="editor-select"><roundcube:object name="editorSelector" editorid="compose-body" tabindex="7" /></div> 
     71                    <div id="editor-select"><roundcube:object name="editorSelector" editorid="compose-body" /></div> 
    7272                    <div id="spellcheck-control"></div> 
    7373                </td> 
     
    7777    </div> 
    7878    <div id="compose-div"> 
    79         <roundcube:object name="composeBody" id="compose-body" form="form" cols="70" rows="20" tabindex="8" /> 
     79        <roundcube:object name="composeBody" id="compose-body" form="form" cols="70" rows="20" tabindex="7" /> 
    8080        <table border="0" cellspacing="0" summary="" style="width:100%; margin-top: 5px;"><tbody> 
    8181            <tr> 
Note: See TracChangeset for help on using the changeset viewer.