1: <?php
2: /**
3: * Copyright 2009-2014 Horde LLC (http://www.horde.org/)
4: *
5: * See the enclosed file COPYING for license information (GPL). If you
6: * did not receive this file, see http://www.horde.org/licenses/gpl.
7: *
8: * @category Horde
9: * @copyright 2009-2014 Horde LLC
10: * @license http://www.horde.org/licenses/gpl GPL
11: * @package IMP
12: */
13:
14: /**
15: * Renderer that indicates that all subparts should be wrapped in a parent
16: * display DIV element.
17: *
18: * @author Michael Slusarz <slusarz@horde.org>
19: * @category Horde
20: * @copyright 2009-2014 Horde LLC
21: * @license http://www.horde.org/licenses/gpl GPL
22: * @package IMP
23: */
24: class IMP_Mime_Viewer_Rfc822 extends Horde_Mime_Viewer_Rfc822
25: {
26: /**
27: * This driver's display capabilities.
28: *
29: * @var array
30: */
31: protected $_capability = array(
32: 'full' => true,
33: 'info' => true,
34: 'inline' => false,
35: 'raw' => true
36: );
37:
38: /**
39: */
40: protected function _render()
41: {
42: /* Need to display raw text from server, since this is essentially
43: * a View Source action for the part and the current value of
44: * $_mimepart may contain altered data (e.g. data that has been
45: * content transfer decoded). */
46: return $this->_renderReturn(
47: $this->getConfigParam('imp_contents')->getBodyPart($this->_mimepart->getMimeId())->data,
48: 'text/plain; charset=' . $this->getConfigParam('charset')
49: );
50: }
51:
52: /**
53: */
54: protected function _renderInfo()
55: {
56: $ret = parent::_renderInfo();
57: if (!empty($ret)) {
58: $ret[$this->_mimepart->getMimeId()]['wrap'] = 'mimePartWrap';
59: }
60: return $ret;
61: }
62:
63: /**
64: */
65: protected function _renderRaw()
66: {
67: /* Needed for same reason as explained in _render(). */
68: return $this->_render();
69: }
70:
71: /**
72: */
73: protected function _getHeaderValue($ob, $header)
74: {
75: switch ($header) {
76: case 'date':
77: $date_ob = new IMP_Message_Date($ob->getValue('date'));
78: return $date_ob->format($date_ob::DATE_LOCAL);
79:
80: default:
81: return parent::_getHeaderValue($ob, $header);
82: }
83: }
84:
85: }
86: