/* Look for a displayable part. RFC 2046: show the LAST choice that
* can be displayed inline. */
- foreach ($subparts as $mime_id => $mime_type) {
+ foreach (array_keys($subparts) as $mime_id) {
if (is_null($last_id) || (strpos($mime_id, $last_id) !== 0)) {
$last_id = null;
- $viewer = Horde_Mime_Viewer::factory($mime_type);
-
- if ($viewer->canRender('inline')) {
- $mime_part = $this->_params['contents']->getMIMEPart($mime_id, array('nocontents' => true, 'nodecode' => true));
- if ($mime_part->getDisposition() == 'inline') {
- $display_id = $last_id = $mime_id;
- }
+ if ($this->_params['contents']->canDisplayInline($mime_id)) {
+ $display_id = $last_id = $mime_id;
}
}
}
$ids = array($mime_id, $applefile_id);
/* For inline viewing, attempt to display the data inline. */
- if ($inline) {
- $viewer = Horde_Mime_Viewer::factory($data_part->getType());
- if (($viewer->canRender('inline') &&
- ($data_part->getDisposition() == 'inline')) ||
- $viewer->canRender('info')) {
- $can_display = true;
- $status['text'][] = _("The contents of the Macintosh file are below.");
- }
+ if ($inline &&
+ $this->_params['contents']->canDisplayInline($data_part, true)) {
+ $can_display = true;
+ $status['text'][] = _("The contents of the Macintosh file are below.");
}
if (!$can_display) {
/* Only display if the start part (normally text/html) can be
* displayed inline -OR- we are viewing this part as an attachment. */
if (!$can_display) {
- $viewer = Horde_Mime_Viewer::factory($subparts[$id]);
- if ($viewer->canRender('inline')) {
- $mime_part = $this->_mimepart->getPart($id);
- $can_display = ($mime_part->getDisposition() == 'inline');
- }
+ $can_display = $this->_params['contents']->canDisplayInline($id);
}
if ($can_display) {