Changeset 868deb5 in github
- Timestamp:
- Oct 6, 2010 1:15:38 PM (3 years ago)
- Branches:
- master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
- Children:
- 7f89041
- Parents:
- ace511a
- Files:
-
- 7 edited
-
CHANGELOG (modified) (1 diff)
-
config/main.inc.php.dist (modified) (1 diff)
-
installer/config.php (modified) (2 diffs)
-
program/include/rcube_message.php (modified) (4 diffs)
-
program/steps/mail/compose.inc (modified) (5 diffs)
-
program/steps/settings/func.inc (modified) (1 diff)
-
program/steps/settings/save_prefs.inc (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
CHANGELOG
race511a r868deb5 20 20 - Improve tabs to fixed width and add tabs in identities info (#1486974) 21 21 - Add unique index on users.username+users.mail_host 22 - Make htmleditor option more consistent and add option to use HTML on reply to HTML message (#1485840) 22 23 23 24 RELEASE 0.4.2 -
config/main.inc.php.dist
r6c6bb09 r868deb5 480 480 481 481 // compose html formatted messages by default 482 $rcmail_config['htmleditor'] = false; 482 // 0 - never, 1 - always, 2 - on reply to HTML message only 483 $rcmail_config['htmleditor'] = 0; 483 484 484 485 // show pretty dates as standard -
installer/config.php
r6c6bb09 r868deb5 15 15 'prefer_html' => 1, 16 16 'preview_pane' => 1, 17 'htmleditor' => 1,18 17 'debug_level' => 1, 19 18 ); … … 544 543 <dt class="propname">htmleditor <span class="userconf">*</span></dt> 545 544 <dd> 546 <?php 547 548 $check_htmlcomp = new html_checkbox(array('name' => '_htmleditor', 'id' => "cfghtmlcompose", 'value' => 1)); 549 echo $check_htmlcomp->show(intval($RCI->getprop('htmleditor'))); 550 551 ?> 552 <label for="cfghtmlcompose">Compose HTML formatted messages</label><br /> 545 <label for="cfghtmlcompose">Compose HTML formatted messages</label> 546 <?php 547 548 $select_htmlcomp = new html_select(array('name' => '_htmleditor', 'id' => "cfghtmlcompose")); 549 $select_htmlcomp->add('never', 0); 550 $select_htmlcomp->add('always', 1); 551 $select_htmlcomp->add('on reply to HTML message only', 2); 552 echo $select_htmlcomp->show(intval($RCI->getprop('htmleditor'))); 553 554 ?> 553 555 </dd> 554 556 -
program/include/rcube_message.php
r103ddcde r868deb5 215 215 * Return the first text part of this message 216 216 * 217 * @param rcube_message_part $part Reference to the part if found 217 218 * @return string Plain text message/part content 218 219 */ 219 function first_text_part( )220 function first_text_part(&$part=null) 220 221 { 221 222 // no message structure, return complete body … … 223 224 return $this->body; 224 225 225 $out = null;226 227 226 // check all message parts 228 227 foreach ($this->mime_parts as $mime_id => $part) { … … 230 229 231 230 if ($mimetype == 'text/plain') { 232 $out = $this->imap->get_message_part($this->uid, $mime_id, $part); 233 234 // re-format format=flowed content 235 if ($part->ctype_secondary == 'plain' && $part->ctype_parameters['format'] == 'flowed') 236 $out = self::unfold_flowed($out); 237 break; 231 return $this->imap->get_message_part($this->uid, $mime_id, $part); 238 232 } 239 233 else if ($mimetype == 'text/html') { … … 246 240 // create instance of html2text class 247 241 $txt = new html2text($out); 248 $out = $txt->get_text(); 249 } 250 } 251 252 return $out; 242 return $txt->get_text(); 243 } 244 } 245 246 $part = null; 247 return null; 253 248 } 254 249 -
program/steps/mail/compose.inc
re25a357 r868deb5 359 359 } 360 360 361 362 361 if ($fname && $field_type) 363 362 { … … 492 491 493 492 493 function rcmail_compose_editor_mode() 494 { 495 global $RCMAIL, $MESSAGE, $compose_mode; 496 static $useHtml; 497 498 if ($useHtml !== null) 499 return $useHtml; 500 501 $html_editor = intval($RCMAIL->config->get('htmleditor')); 502 503 if ($compose_mode == RCUBE_COMPOSE_DRAFT || $compose_mode == RCUBE_COMPOSE_EDIT) { 504 $useHtml = $MESSAGE->has_html_part(); 505 } 506 else if ($compose_mode == RCUBE_COMPOSE_REPLY) { 507 $useHtml = ($html_editor == 1 || ($html_editor == 2 && $MESSAGE->has_html_part())); 508 } 509 else { // RCUBE_COMPOSE_FORWARD or NEW 510 $useHtml = ($html_editor == 1); 511 } 512 513 return $useHtml; 514 } 515 516 494 517 function rcmail_prepare_message_body() 495 518 { 496 global $RCMAIL, $CONFIG, $MESSAGE, $compose_mode, $LINE_LENGTH, $HTML_MODE; 497 498 if ($CONFIG['htmleditor'] || (($compose_mode == RCUBE_COMPOSE_DRAFT || $compose_mode == RCUBE_COMPOSE_EDIT) && $MESSAGE->has_html_part())) 499 $isHtml = true; 500 else 501 $isHtml = false; 502 503 $body = ''; 519 global $RCMAIL, $MESSAGE, $compose_mode, $LINE_LENGTH, $HTML_MODE; 504 520 505 521 // use posted message body 506 if (!empty($_POST['_message'])) 507 { 522 if (!empty($_POST['_message'])) { 508 523 $body = get_input_value('_message', RCUBE_INPUT_POST, true); 509 }510 else if ($_SESSION['compose']['param']['body'])511 {524 $isHtml = (bool) get_input_value('_is_html', RCUBE_INPUT_POST); 525 } 526 else if ($_SESSION['compose']['param']['body']) { 512 527 $body = $_SESSION['compose']['param']['body']; 513 528 $isHtml = false; 514 529 } 515 else if ($compose_mode)516 {530 // reply/edit/draft/forward 531 else if ($compose_mode) { 517 532 $has_html_part = $MESSAGE->has_html_part(); 518 if (($isHtml || $compose_mode == RCUBE_COMPOSE_DRAFT) && $has_html_part) 519 { 520 $body = $MESSAGE->first_html_part(); 521 $isHtml = true; 522 } 523 else if ($has_html_part) 524 { 525 // use html part if it has been used for message (pre)viewing 526 // decrease line length for quoting 527 $len = $compose_mode == RCUBE_COMPOSE_REPLY ? $LINE_LENGTH-2 : $LINE_LENGTH; 528 $txt = new html2text($MESSAGE->first_html_part(), false, true, $len); 529 $body = $txt->get_text(); 530 $isHtml = false; 531 } 532 else 533 { 534 $body = $MESSAGE->first_text_part(); 535 $isHtml = false; 533 $isHtml = rcmail_compose_editor_mode(); 534 535 if ($isHtml) { 536 if ($has_html_part) { 537 $body = $MESSAGE->first_html_part(); 538 } 539 else { 540 $body = rcmail_plain_body($MESSAGE->first_text_part()); 541 if ($body) 542 $body = '<pre>' . $body . '</pre>'; 543 } 544 } 545 else { 546 if ($has_html_part) { 547 // use html part if it has been used for message (pre)viewing 548 // decrease line length for quoting 549 $len = $compose_mode == RCUBE_COMPOSE_REPLY ? $LINE_LENGTH-2 : $LINE_LENGTH; 550 $txt = new html2text($MESSAGE->first_html_part(), false, true, $len); 551 $body = $txt->get_text(); 552 } 553 else { 554 $body = $MESSAGE->first_text_part($part); 555 if ($body && $part && $part->ctype_secondary == 'plain' 556 && $part->ctype_parameters['format'] == 'flowed' 557 ) { 558 $body = rcube_message::unfold_flowed($body); 559 } 560 } 536 561 } 537 562 … … 545 570 else if ($compose_mode == RCUBE_COMPOSE_DRAFT || $compose_mode == RCUBE_COMPOSE_EDIT) 546 571 $body = rcmail_create_draft_body($body, $isHtml); 572 } 573 else { // new message 574 $isHtml = rcmail_compose_editor_mode(); 547 575 } 548 576 … … 1152 1180 1153 1181 // determine whether HTML or plain text should be checked 1154 if ($compose_mode) 1155 $useHtml = (($CONFIG['htmleditor'] || $compose_mode == RCUBE_COMPOSE_DRAFT || $compose_mode == RCUBE_COMPOSE_EDIT) 1156 && $MESSAGE->has_html_part()); 1157 else 1158 $useHtml = $CONFIG['htmleditor'] ? true : false; 1182 $useHtml = rcmail_compose_editor_mode(); 1159 1183 1160 1184 if (empty($attrib['editorid'])) … … 1173 1197 return $select->show($useHtml ? 'html' : 'plain'); 1174 1198 1175 foreach ($choices as $value => $text) 1176 { 1199 foreach ($choices as $value => $text) { 1177 1200 $attrib['id'] = '_' . $value; 1178 1201 $attrib['value'] = $value; -
program/steps/settings/func.inc
r6c6bb09 r868deb5 467 467 if (!isset($no_override['htmleditor'])) { 468 468 $field_id = 'rcmfd_htmleditor'; 469 $input_htmleditor = new html_checkbox(array('name' => '_htmleditor', 'id' => $field_id, 'value' => 1)); 469 $select_htmleditor = new html_select(array('name' => '_htmleditor', 'id' => $field_id)); 470 $select_htmleditor->add(rcube_label('never'), 0); 471 $select_htmleditor->add(rcube_label('always'), 1); 472 $select_htmleditor->add(rcube_label('htmlonreply'), 2); 470 473 471 474 $blocks['main']['options']['htmleditor'] = array( 472 475 'title' => html::label($field_id, Q(rcube_label('htmleditor'))), 473 'content' => $ input_htmleditor->show($config['htmleditor']?1:0),476 'content' => $select_htmleditor->show(intval($config['htmleditor'])), 474 477 ); 475 478 } -
program/steps/settings/save_prefs.inc
rb3660bb r868deb5 59 59 ); 60 60 61 62 61 break; 63 62 case 'compose': 64 63 $a_user_prefs = array( 65 'htmleditor' => i sset($_POST['_htmleditor']) ? TRUE : FALSE,64 'htmleditor' => intval($_POST['_htmleditor']), 66 65 'draft_autosave' => isset($_POST['_draft_autosave']) ? intval($_POST['_draft_autosave']) : 0, 67 66 'mime_param_folding' => isset($_POST['_mime_param_folding']) ? intval($_POST['_mime_param_folding']) : 0,
Note: See TracChangeset
for help on using the changeset viewer.
