Update to new render() return format.
authorMichael M Slusarz <slusarz@curecanti.org>
Wed, 12 Nov 2008 23:56:29 +0000 (16:56 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Wed, 12 Nov 2008 23:56:29 +0000 (16:56 -0700)
imp/lib/Mime/Viewer/enriched.php
imp/lib/Mime/Viewer/html.php
imp/lib/Mime/Viewer/images.php
imp/lib/Mime/Viewer/pdf.php
imp/lib/Mime/Viewer/plain.php
imp/lib/Mime/Viewer/tnef.php
imp/lib/Mime/Viewer/zip.php

index 9e2299e..7657f16 100644 (file)
@@ -21,7 +21,10 @@ class IMP_Horde_Mime_Viewer_enriched extends Horde_Mime_Viewer_enriched
     protected function _render()
     {
         $ret = parent::_render();
-        $ret['data'] = $this->_IMPformat($ret['data']);
+        if (!empty($ret)) {
+            reset($ret);
+            $ret[key($ret)]['data'] = $this->_IMPformat($ret[key($ret)]['data']);
+        }
         return $ret;
     }
 
@@ -33,7 +36,10 @@ class IMP_Horde_Mime_Viewer_enriched extends Horde_Mime_Viewer_enriched
     protected function _renderInline()
     {
         $ret = parent::_renderInline();
-        $ret['data'] = $this->_IMPformat($ret['data']);
+        if (!empty($ret)) {
+            reset($ret);
+            $ret[key($ret)]['data'] = $this->_IMPformat($ret[key($ret)]['data']);
+        }
         return $ret;
     }
 
index eec7e49..2beb780 100644 (file)
@@ -72,9 +72,11 @@ class IMP_Horde_Mime_Viewer_html extends Horde_Mime_Viewer_html
         $render = $this->_IMPrender(false);
 
         return array(
-            'data' => $render['html'],
-            'status' => $render['status'],
-            'type' => $this->_mimepart->getType(true)
+            $this->_mimepart->getMimeId() => array(
+                'data' => $render['html'],
+                'status' => $render['status'],
+                'type' => $this->_mimepart->getType(true)
+            )
         );
     }
 
@@ -88,8 +90,11 @@ class IMP_Horde_Mime_Viewer_html extends Horde_Mime_Viewer_html
         $render = $this->_IMPrender(true);
 
         return array(
-            'data' => $render['html'],
-            'status' => $render['status']
+            $this->_mimepart->getMimeId() => array(
+                'data' => $render['html'],
+                'status' => $render['status'],
+                'type' => 'text/html; charset=' . NLS::getCharset()
+            )
         );
     }
 
index b1f18dd..16493f7 100644 (file)
@@ -82,7 +82,11 @@ class IMP_Horde_Mime_Viewer_images extends Horde_Mime_Viewer_images
                 /* Viewing inline, and the browser can handle the image type
                  * directly. So output an <img> tag to load the image. */
                 return array(
-                    'data' => Horde::img($this->_params['contents']->urlView($this->_mimepart, 'view_attach', array('params' => array('img_data' => 1))), $this->_mimepart->getName(true), null, '')
+                    $this->_mimepart->getMimeId() => array(
+                        'data' => Horde::img($this->_params['contents']->urlView($this->_mimepart, 'view_attach', array('params' => array('img_data' => 1))), $this->_mimepart->getName(true), null, ''),
+                        'status' => array(),
+                        'type' => 'text/html; charset=' . NLS::getCharset()
+                    )
                 );
             } else {
                 return $this->_renderInfo();
@@ -101,10 +105,14 @@ class IMP_Horde_Mime_Viewer_images extends Horde_Mime_Viewer_images
         }
 
         return array(
-            'status' => array(
-                array(
-                    'text' => $status
-                )
+            $this->_mimepart->getMimeId() => array(
+                'data' => '',
+                'status' => array(
+                    array(
+                        'text' => $status
+                    )
+                ),
+                'type' => 'text/html; charset=' . NLS::getCharset()
             )
         );
     }
@@ -134,11 +142,15 @@ class IMP_Horde_Mime_Viewer_images extends Horde_Mime_Viewer_images
         }
 
         return array(
-            'status' => array(
-                array(
-                    'icon' => Horde::img('mime/image.png', _("Thumbnail of attached image")),
-                    'text' => $status
-                )
+            $this->_mimepart->getMimeId() => array(
+                'data' => '',
+                'status' => array(
+                    array(
+                        'icon' => Horde::img('mime/image.png', _("Thumbnail of attached image")),
+                        'text' => $status
+                    )
+                ),
+                'type' => 'text/html; charset=' . NLS::getCharset()
             )
         );
     }
@@ -203,8 +215,11 @@ EOD;
         }
 
         return array(
-            'data' => $str,
-            'type' => 'text/html; charset=' . NLS::getCharset()
+            $this->_mimepart->getMimeId() => array(
+                'data' => $str,
+                'status' => array(),
+                'type' => 'text/html; charset=' . NLS::getCharset()
+            )
         );
     }
 
@@ -233,8 +248,11 @@ EOD;
         }
 
         return array(
-            'data' => $data,
-            'type' => $type
+            $this->_mimepart->getMimeId() => array(
+                'data' => $data,
+                'status' => array(),
+                'type' => $type
+            )
         );
     }
 
index 1eecbf2..61f1aa9 100644 (file)
@@ -56,8 +56,11 @@ class IMP_Horde_Mime_Viewer_pdf extends Horde_Mime_Viewer_pdf
         }
 
         return array(
-            'data' => $data,
-            'type' => $type
+            $this->_mimepart->getMimeId() => array(
+                'data' => $data,
+                'status' => array(),
+                'type' => $type
+            )
         );
     }
 
index 873fe2d..9922a6d 100644 (file)
@@ -39,7 +39,13 @@ class IMP_Horde_Mime_Viewer_plain extends Horde_Mime_Viewer_plain
             require_once IMP_BASE . '/lib/Crypt/PGP.php';
             $imp_pgp = new IMP_PGP();
             if (($out = $imp_pgp->parseMessageOutput($this->_mimepart, $this->_params['contents']))) {
-                return array('data' => $out);
+                return array(
+                    $this->_mimepart->getMimeId() => array(
+                        'data' => $out,
+                        'status' => array(),
+                        'type' => 'text/html; charset=' . NLS::getCharset()
+                    )
+                );
             }
         }
 
@@ -106,6 +112,12 @@ class IMP_Horde_Mime_Viewer_plain extends Horde_Mime_Viewer_plain
             $text = '&nbsp;' . substr($text, 1);
         }
 
-        return array('data' => '<div class="fixed leftAlign">' . "\n" . $text . '</div>');
+        return array(
+            $this->_mimepart->getMimeId() => array(
+                'data' => '<div class="fixed leftAlign">' . "\n" . $text . '</div>',
+                'status' => array(),
+                'type' => 'text/html; charset=' . NLS::getCharset()
+            )
+        );
     }
 }
index bd42872..7395106 100644 (file)
@@ -39,7 +39,8 @@ class IMP_Horde_Mime_Viewer_tnef extends Horde_Mime_Viewer_tnef
     {
         if (!Util::getFormData('tnef_attachment')) {
             $ret = $this->_renderInfo();
-            $ret['data'] = '<html><body>' . $ret['data'] . '</body></html>';
+            reset($ret);
+            $ret[key($ret)]['data'] = '<html><body>' . $ret[key($ret)]['data'] . '</body></html>';
             return $ret;
         }
 
@@ -56,9 +57,12 @@ class IMP_Horde_Mime_Viewer_tnef extends Horde_Mime_Viewer_tnef
             $text = $tnefData[$tnefKey]['stream'];
             if (!empty($text)) {
                 return array(
-                    'data' => $text,
-                    'name' => $tnefData[$tnefKey]['name'],
-                    'type' => $tnefData[$tnefKey]['type'] . '/' . $tnefData[$tnefKey]['subtype']
+                    $this->_mimepart->getMimeId() => array(
+                        'data' => $text,
+                        'name' => $tnefData[$tnefKey]['name'],
+                        'status' => array(),
+                        'type' => $tnefData[$tnefKey]['type'] . '/' . $tnefData[$tnefKey]['subtype']
+                    )
                 );
             }
         }
@@ -109,9 +113,11 @@ class IMP_Horde_Mime_Viewer_tnef extends Horde_Mime_Viewer_tnef
         }
 
         return array(
-            'data' => $data,
-            'status' => array($status),
-            'type' => 'text/html; charset=' . NLS::getCharset()
+            $this->_mimepart->getMimeId() => array(
+                'data' => $data,
+                'status' => array($status),
+                'type' => 'text/html; charset=' . NLS::getCharset()
+            )
         );
     }
 }
index b0287ed..4cb35f5 100644 (file)
@@ -43,9 +43,12 @@ class IMP_Horde_Mime_Viewer_zip extends Horde_Mime_Viewer_zip
             $text = $zip->decompress($data, array('action' => HORDE_COMPRESS_ZIP_DATA, 'info' => &$zipInfo, 'key' => $fileKey));
             if (!empty($text)) {
                 return array(
-                    'data' => $text,
-                    'name' => basename($zipInfo[$fileKey]['name']),
-                    'type' => 'application/octet-stream'
+                    $this->_mimepart->getMimeId() => array(
+                        'data' => $text,
+                        'name' => basename($zipInfo[$fileKey]['name']),
+                        'status' => array(),
+                        'type' => 'application/octet-stream'
+                    )
                 );
             }
         }