'label' => _("Message Viewing"),
'desc' => _("Configure how messages are displayed."),
'members' => array(
- 'filtering', 'strip_attachments', 'html_image_replacement',
- 'html_image_addrbook', 'highlight_text', 'highlight_simple_markup',
- 'show_quoteblocks', 'dim_signature', 'emoticons', 'parts_display',
- 'mail_hdr', 'default_msg_charset', 'disposition_send_mdn'
+ 'filtering', 'strip_attachments', 'alternative_display',
+ 'html_image_replacement', 'html_image_addrbook', 'highlight_text',
+ 'highlight_simple_markup', 'show_quoteblocks', 'dim_signature',
+ 'emoticons', 'parts_display', 'mail_hdr', 'default_msg_charset',
+ 'disposition_send_mdn'
)
);
'type' => 'checkbox',
'desc' => _("Show an icon to allow stripping of attachments from messages?"));
+// multipart/alternative part display choice
+$_prefs['alternative_display'] = array(
+ 'value' => 'html',
+ 'advanced' => true,
+ 'type' => 'enum',
+ 'enum' => array(
+ 'html' => _("HTML part"),
+ 'text' => _("Plaintext part")
+ ),
+ 'desc' => _("For messages with alternative representations of the text part, which part should we display?")
+);
+
// Replace image tags in inline viewed HTML messages with blank images?
$_prefs['html_image_replacement'] = array(
'value' => 1,
v5.0-git
--------
+[mms] Add preference to control displayed content for multipart/alternative
+ parts (Request #6711).
[mms] Allow multiple messages to be forwarded in a single outgoing message
(DIMP) (Request #9132).
[mms] Add personal recipient message filter (Request #8659).
* Render out the currently set contents.
*
* @param boolean $inline Are we viewing inline?
- * @param boolean $prefer_plain For MIMP, prefer text/plain part over
- * all others.
+ * @param boolean $prefer_plain Prefer text/plain part over all others.
*
* @return array See parent::render().
*/
- protected function _IMPrender($inline, $prefer_plain = true)
+ protected function _IMPrender($inline, $prefer_plain = null)
{
$base_id = $this->_mimepart->getMimeId();
$subparts = $this->_mimepart->contentTypeMap();
$base_ids = $display_ids = $ret = array();
- $is_mimp = (IMP::getViewMode() == 'mimp');
+ if (is_null($prefer_plain) &&
+ ($GLOBALS['prefs']->getValue('alternative_display') == 'text')) {
+ $prefer_plain = true;
+ }
/* Look for a displayable part. RFC: show the LAST choice that can be
* displayed inline. If an alternative is itself a multipart, the user
foreach ($subparts as $mime_id => $type) {
$ret[$mime_id] = null;
if ((strcmp($base_id, $mime_id) !== 0) &&
- $this->getConfigParam('imp_contents')->canDisplay($mime_id, $inline ? IMP_Contents::RENDER_INLINE : IMP_Contents::RENDER_FULL)) {
- if (!$is_mimp ||
- !$prefer_plain ||
- ($type == 'text/plain')) {
- $display_ids[strval($mime_id)] = true;
- }
+ $this->getConfigParam('imp_contents')->canDisplay($mime_id, $inline ? IMP_Contents::RENDER_INLINE : IMP_Contents::RENDER_FULL) &&
+ /* Show HTML if $prefer_plain is false-y or if
+ * alternative_display is not 'html'. */
+ (!$prefer_plain ||
+ (($type != 'text/html') &&
+ (strpos($type, 'text/') === 0)))) {
+ $display_ids[strval($mime_id)] = true;
}
}
/* If we found no IDs, return now. */
if (empty($display_ids)) {
- if ($is_mimp && $prefer_plain) {
+ if ($prefer_plain && (IMP::getViewMode() == 'mimp')) {
return $this->_IMPRender($inline, false);
}
+
$ret[$base_id] = array(
'data' => '',
'status' => array(
$v = $GLOBALS['injector']->getInstance('IMP_Mime_Viewer')->getViewer($mock_part);
if (!$v->canRender('inline')) {
+ $ui->suppress[] = 'alternative_display';
$ui->suppress[] = 'html_image_replacement';
$ui->suppress[] = 'html_image_addrbook';
}