Use canDisplayInline().
authorMichael M Slusarz <slusarz@curecanti.org>
Wed, 12 Nov 2008 21:45:16 +0000 (14:45 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Wed, 12 Nov 2008 21:45:16 +0000 (14:45 -0700)
imp/lib/Mime/Viewer/alternative.php
imp/lib/Mime/Viewer/appledouble.php
imp/lib/Mime/Viewer/related.php

index 2dd2d76..bec5621 100644 (file)
@@ -42,16 +42,11 @@ class IMP_Horde_Mime_Viewer_alternative extends Horde_Mime_Viewer_Driver
 
         /* 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;
                 }
             }
         }
index 794bcd0..2a68a3f 100644 (file)
@@ -85,14 +85,10 @@ class IMP_Horde_Mime_Viewer_appledouble extends Horde_Mime_Viewer_Driver
         $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) {
index d5217c9..4717008 100644 (file)
@@ -91,11 +91,7 @@ class IMP_Horde_Mime_Viewer_related extends Horde_Mime_Viewer_Driver
         /* 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) {