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