*
* @return
*/
- public function renderMIMEPart($mime_id, $options = array())
+ public function renderMIMEPart($mime_id, $format, $options = array())
{
$mime_part = $this->getMIMEPart($mime_id);
$viewer = Horde_Mime_Viewer::factory(empty($options['type']) ? $mime_part->getType() : $options['type']);
$viewer->setMIMEPart($mime_part);
$viewer->setParams(array('contents' => &$this));
- switch($options['format']) {
- case 'inline':
- $data = $viewer->renderInline();
- break;
-
- case 'info':
- $data = $viewer->renderInfo();
- break;
-
- case 'full':
- $data = $viewer->render();
- return array('data' => $data['data'], 'name' => $mime_part->getName(true), 'type' => $data['type']);
- break;
- }
-
- return array('data' => $data, 'name' => $mime_part->getName(true), 'type' => null);
+ $ret = $viewer->render($format);
+ $ret['name'] => $mime_part->getName(true);
+ return $ret;
}
/**
$last_id = null;
$viewer = Horde_Mime_Viewer::factory($mime_type);
- if ($viewer->canDisplayInline() &&
+ if ($viewer->canRender('inline') &&
($mime_part->getDisposition() == 'inline')) {
$part['render_inline'] = true;
$info['render'][$mime_id] = 'inline';
$last_id = $mime_id;
- } elseif (is_null($last_id) && $viewer->canDisplayInfo()) {
- // TODO - Need way to show info while allowing display of
- // subparts.
+ } elseif (is_null($last_id) && $viewer->canRender('info')) {
$part['render_info'] = true;
$info['render'][$mime_id] = 'info';
- $last_id = $mime_id;
}
}
/isx';
/**
- * TODO
+ * Return the full rendered version of the Horde_Mime_Part object.
+ *
+ * @return array See Horde_Mime_Viewer_Driver::render().
*/
protected function _render()
{
}
/**
- * TODO
+ * Return the rendered inline version of the Horde_Mime_Part object.
+ *
+ * @return array See Horde_Mime_Viewer_Driver::render().
*/
protected function _renderInline()
{
class IMP_Horde_Mime_Viewer_plain extends Horde_Mime_Viewer_plain
{
/**
- * TODO
+ * Return the rendered inline version of the Horde_Mime_Part object.
+ *
+ * @return array See Horde_Mime_Viewer_Driver::render().
*/
protected function _renderInline()
{
// Trim extra whitespace in the text.
$text = rtrim($this->_mimepart->getContents());
if ($text == '') {
- return array(
- 'data' => '',
- 'status' => array()
- );
+ return array();
}
// If requested, scan the message for PGP data.
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,
- 'status' => array()
- );
+ return array('data' => $out);
}
}
$text = ' ' . substr($text, 1);
}
- return array(
- 'data' => '<div class="fixed leftAlign">' . "\n" . $text . '</div>',
- 'status' => array()
- );
+ return array('data' => '<div class="fixed leftAlign">' . "\n" . $text . '</div>');
}
}
$atc_display = $prefs->getValue('attachment_display');
$show_parts = (($atc_display == 'list') || ($atc_display == 'both'));
-$downloadall_link = empty($summary['message']['download_all'])
+$downloadall_link = empty($summary['info']['download_all'])
? false
- : $imp_contents->urlView($imp_contents->getMIMEMessage(), 'download_all', array('params' => array('download_ids' => serialize($summary['message']['download_all']))));
+ : $imp_contents->urlView($imp_contents->getMIMEMessage(), 'download_all', array('params' => array('download_ids' => serialize($summary['info']['download_all']))));
$hdrs = array();
$i = 1;
$val = '';
if ($show_parts) {
$part_info = array('icon', 'id', 'description', 'type', 'size');
- foreach (array('download_link', 'zip', 'img_save', 'strip') as $val) {
- if ($summary['message']['has_' . $val]) {
+ foreach (array('download', 'download_zip', 'img_save', 'strip') as $val) {
+ if (isset($summary['info']['has'][$val])) {
$part_info[] = $val;
}
}
$m_template->set('headers', $hdrs);
// TODO
-$m_template->set('msgtext', reset($inline_parts));
+//$m_template->set('msgtext', reset($inline_parts));
echo $m_template->fetch(IMP_TEMPLATES . '/message/message.html');
if (!$printer_friendly) {
break;
case 'download_render':
- $render = $contents->renderMIMEPart($id, array('format' => 'full', 'type' => $ctype));
+ $render = $contents->renderMIMEPart($id, 'full', array('type' => $ctype));
$body = $render['body'];
$type = $render['type'];
$name = $render['name'];
exit;
case 'view_attach':
- $render = $contents->renderMIMEPart($id, array('format' => 'full', 'type' => $ctype));
+ $render = $contents->renderMIMEPart($id, 'full', array('type' => $ctype));
$browser->downloadHeaders($render['name'], $render['type'], true, strlen($render['data']));
echo $render['data'];
exit;