From: Michael M Slusarz Date: Wed, 12 Nov 2008 23:56:29 +0000 (-0700) Subject: Update to new render() return format. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=97483e00ad7299a908c10ca19cd411563ba99306;p=horde.git Update to new render() return format. --- diff --git a/imp/lib/Mime/Viewer/enriched.php b/imp/lib/Mime/Viewer/enriched.php index 9e2299eff..7657f16b5 100644 --- a/imp/lib/Mime/Viewer/enriched.php +++ b/imp/lib/Mime/Viewer/enriched.php @@ -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; } diff --git a/imp/lib/Mime/Viewer/html.php b/imp/lib/Mime/Viewer/html.php index eec7e49a0..2beb7800e 100644 --- a/imp/lib/Mime/Viewer/html.php +++ b/imp/lib/Mime/Viewer/html.php @@ -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() + ) ); } diff --git a/imp/lib/Mime/Viewer/images.php b/imp/lib/Mime/Viewer/images.php index b1f18ddc9..16493f765 100644 --- a/imp/lib/Mime/Viewer/images.php +++ b/imp/lib/Mime/Viewer/images.php @@ -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 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 + ) ); } diff --git a/imp/lib/Mime/Viewer/pdf.php b/imp/lib/Mime/Viewer/pdf.php index 1eecbf232..61f1aa9d3 100644 --- a/imp/lib/Mime/Viewer/pdf.php +++ b/imp/lib/Mime/Viewer/pdf.php @@ -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 + ) ); } diff --git a/imp/lib/Mime/Viewer/plain.php b/imp/lib/Mime/Viewer/plain.php index 873fe2df5..9922a6da3 100644 --- a/imp/lib/Mime/Viewer/plain.php +++ b/imp/lib/Mime/Viewer/plain.php @@ -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 = ' ' . substr($text, 1); } - return array('data' => '
' . "\n" . $text . '
'); + return array( + $this->_mimepart->getMimeId() => array( + 'data' => '
' . "\n" . $text . '
', + 'status' => array(), + 'type' => 'text/html; charset=' . NLS::getCharset() + ) + ); } } diff --git a/imp/lib/Mime/Viewer/tnef.php b/imp/lib/Mime/Viewer/tnef.php index bd4287260..7395106ef 100644 --- a/imp/lib/Mime/Viewer/tnef.php +++ b/imp/lib/Mime/Viewer/tnef.php @@ -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'] = '' . $ret['data'] . ''; + reset($ret); + $ret[key($ret)]['data'] = '' . $ret[key($ret)]['data'] . ''; 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() + ) ); } } diff --git a/imp/lib/Mime/Viewer/zip.php b/imp/lib/Mime/Viewer/zip.php index b0287ed8c..4cb35f533 100644 --- a/imp/lib/Mime/Viewer/zip.php +++ b/imp/lib/Mime/Viewer/zip.php @@ -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' + ) ); } }