1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15:
16: class IMP_Mime_Viewer_Appledouble extends Horde_Mime_Viewer_Base
17: {
18: 19: 20: 21: 22:
23: protected $_capability = array(
24: 'full' => false,
25: 'info' => true,
26: 'inline' => true,
27: 'raw' => false
28: );
29:
30: 31: 32: 33: 34:
35: protected $_metadata = array(
36: 'compressed' => false,
37: 'embedded' => false,
38: 'forceinline' => true
39: );
40:
41: 42: 43: 44: 45:
46: protected function _renderInline()
47: {
48: return $this->_IMPrender(true);
49: }
50:
51: 52: 53: 54: 55:
56: protected function _renderInfo()
57: {
58: return $this->_IMPrender(false);
59: }
60:
61: 62: 63: 64: 65: 66: 67:
68: protected function _IMPrender($inline)
69: {
70: 71: 72: 73: 74:
75:
76:
77: $mime_id = $this->_mimepart->getMimeId();
78: $parts_list = array_keys($this->_mimepart->contentTypeMap());
79: reset($parts_list);
80: $applefile_id = next($parts_list);
81: $data_id = Horde_Mime::mimeIdArithmetic($applefile_id, 'next');
82:
83: $applefile_part = $this->_mimepart->getPart($applefile_id);
84: $data_part = $this->_mimepart->getPart($data_id);
85:
86: $data_name = $this->getConfigParam('imp_contents')->getPartName($data_part);
87:
88: $status = new IMP_Mime_Status(array(
89: sprintf(_("This message contains a Macintosh file (named \"%s\")."), $data_name),
90: sprintf(_("The Macintosh resource fork can be downloaded %s."), $this->getConfigParam('imp_contents')->linkViewJS($applefile_part, 'download_attach', _("HERE"), array('jstext' => _("The Macintosh resource fork"))))
91: ));
92: $status->icon('mime/apple.png', _("Macintosh File"));
93:
94:
95: $ret = array();
96: if ($inline && (($disp = $this->getConfigParam('imp_contents')->canDisplay($data_part, IMP_Contents::RENDER_INLINE | IMP_Contents::RENDER_INFO)))) {
97: $ret = $this->getConfigParam('imp_contents')->renderMIMEPart($data_id, $disp);
98: }
99:
100: foreach ($parts_list as $val) {
101: if (!isset($ret[$val]) && (strcmp($val, $data_id) !== 0)) {
102: $ret[$val] = (strcmp($val, $mime_id) === 0)
103: ? array(
104: 'data' => '',
105: 'status' => $status,
106: 'type' => 'text/html; charset=' . $this->getConfigParam('charset'),
107: 'wrap' => 'mimePartWrap'
108: )
109: : null;
110: }
111: }
112:
113: return $ret;
114: }
115:
116: }
117: