diff --git a/etemplate/js/et2_widget_description.js b/etemplate/js/et2_widget_description.js index 57a5b5cc30..063a1e9876 100644 --- a/etemplate/js/et2_widget_description.js +++ b/etemplate/js/et2_widget_description.js @@ -161,7 +161,7 @@ var et2_description = expose(et2_baseWidget.extend([et2_IDetachedDOM], .addClass("et2_label"); this.getSurroundings().insertDOMNode(this._labelContainer[0]); } - + // Clear the label container. this._labelContainer.empty(); @@ -194,7 +194,7 @@ var et2_description = expose(et2_baseWidget.extend([et2_IDetachedDOM], } this._labelContainer = null; } - + // Update the surroundings in order to reflect the change in the label this.getSurroundings().update(); @@ -245,7 +245,7 @@ var et2_description = expose(et2_baseWidget.extend([et2_IDetachedDOM], } else { - egw(window).open_link(self.options.mime_data || self.options.href, self.options.extra_link_title,self.options.extra_link_popup,null,null,self.options.mime); + egw(window).open_link(self.options.mime_data || self.options.href, self.options.extra_link_target, self.options.extra_link_popup, null, null, self.options.mime); } e.preventDefault(); return false; diff --git a/mail/inc/class.mail_hooks.inc.php b/mail/inc/class.mail_hooks.inc.php index 3f1ec938e6..6e81d895ea 100644 --- a/mail/inc/class.mail_hooks.inc.php +++ b/mail/inc/class.mail_hooks.inc.php @@ -93,6 +93,8 @@ class mail_hooks 'message/rfc822' => array( 'menuaction' => 'mail.mail_ui.importMessageFromVFS2DraftAndDisplay', 'mime_url' => 'formData[file]', + 'mime_data' => 'formData[data]', + 'formData[type]' => 'message/rfc822', 'mime_popup' => '870xavailHeight', ), ), diff --git a/mail/inc/class.mail_ui.inc.php b/mail/inc/class.mail_ui.inc.php index 3ced0369c5..fd82519396 100644 --- a/mail/inc/class.mail_ui.inc.php +++ b/mail/inc/class.mail_ui.inc.php @@ -2186,13 +2186,18 @@ class mail_ui if (strtoupper($value['mimeType']=='APPLICATION/OCTET-STREAM')) $value['mimeType'] = mime_magic::filename2mime($attachmentHTML[$key]['filename']); $attachmentHTML[$key]['type']=$value['mimeType']; $attachmentHTML[$key]['mimetype']=mime_magic::mime2label($value['mimeType']); + list(, $acc_id) = explode(self::$delimiter, $rowID); + + $attachmentHTML[$key]['mime_data'] = egw_link::set_data($value['mimeType'], 'emailadmin_imapbase::getAttachmentAccount', array( + $acc_id, $mailbox, $uid, $value['partID'], $value['is_winmail'], true + )); $attachmentHTML[$key]['size']=egw_vfs::hsize($value['size']); $attachmentHTML[$key]['attachment_number']=$key; $attachmentHTML[$key]['partID']=$value['partID']; $attachmentHTML[$key]['mail_id'] = $rowID; $attachmentHTML[$key]['winmailFlag']=$value['is_winmail']; $attachmentHTML[$key]['classSaveAllPossiblyDisabled'] = "mail_DisplayNone"; - + switch(strtoupper($value['mimeType'])) { case 'MESSAGE/RFC822': @@ -2266,9 +2271,14 @@ class mail_ui $linkView = "window.location.href = '".egw::link('/index.php',$linkData)."';"; break; } - $attachmentHTML[$key]['href_link'] = egw::link('/index.php',$linkData); + // we either use mime_data for server-side supported mime-types or mime_url for client-side or download + if (empty($attachmentHTML[$key]['mime_data'])) + { + $attachmentHTML[$key]['mime_url'] = egw::link('/index.php',$linkData); + unset($attachmentHTML[$key]['mime_data']); + } $attachmentHTML[$key]['windowName'] = $windowName; - + //error_log(__METHOD__.__LINE__.$linkView); $attachmentHTML[$key]['link_view'] = ''. ($value['name'] ? ( $filename ? $filename : $value['name'] ) : lang('(no subject)')). @@ -2549,8 +2559,7 @@ class mail_ui html::safe_content_header($attachment['attachment'], $filename, $attachment['type'], $size=0, True, $_GET['mode'] == "save"); echo $attachment['attachment']; - $GLOBALS['egw']->common->egw_exit(); - exit; + common::egw_exit(); } @@ -3303,8 +3312,6 @@ class mail_ui if ($importfailed === false) { $mailObject = new egw_mailer(); - $Header = ''; - $Body = ''; try { $this->mail_bo->parseFileIntoMailObject($mailObject, $tmpFileName); @@ -3389,15 +3396,20 @@ class mail_ui //error_log(__METHOD__.__LINE__.':'.array2string($formData).' Mode:'.$mode.'->'.function_backtrace()); $draftFolder = $this->mail_bo->getDraftFolder(false); $importID = mail_bo::getRandomString(); + + // handling for mime-data hash + if (!empty($formData['data'])) + { + $formData['file'] = 'egw-data://'.$formData['data']; + } // name should be set to meet the requirements of checkFileBasics - if (in_array(parse_url($formData['file'],PHP_URL_SCHEME), array('vfs', 'http', 'https')) && (!isset($formData['name']) || empty($formData['name']))) + if (parse_url($formData['file'],PHP_URL_SCHEME) == 'vfs' && empty($formData['name'])) { $buff = explode('/',$formData['file']); - $suffix = ''; if (is_array($buff)) $formData['name'] = array_pop($buff); // take the last part as name } // type should be set to meet the requirements of checkFileBasics - if (in_array(parse_url($formData['file'],PHP_URL_SCHEME), array('vfs', 'http', 'https')) && (!isset($formData['type']) || empty($formData['type']))) + if (parse_url($formData['file'],PHP_URL_SCHEME) == 'vfs' && empty($formData['type'])) { $buff = explode('.',$formData['file']); $suffix = ''; @@ -3405,7 +3417,7 @@ class mail_ui if (!empty($suffix)) $formData['type'] = mime_magic::ext2mime($suffix); } // size should be set to meet the requirements of checkFileBasics - if (in_array(parse_url($formData['file'],PHP_URL_SCHEME), array('vfs', 'http', 'https')) && !isset($formData['size'])) + if (parse_url($formData['file'],PHP_URL_SCHEME) == 'vfs' && !isset($formData['size'])) { $formData['size'] = strlen($formData['file']); // set some size, to meet requirements of checkFileBasics } @@ -3427,18 +3439,12 @@ class mail_ui { $linkData['mode']=$mode; } - + egw::redirect_link('/index.php',$linkData); } catch (egw_exception_wrong_userinput $e) { - $linkData = array - ( - 'menuaction' => 'mail.mail_ui.importMessage', - 'msg' => htmlspecialchars($e->getMessage()), - ); + egw_framework::window_close($e->getMessage()); } - egw::redirect_link('/index.php',$linkData); - exit; } /** diff --git a/mail/templates/default/display.xet b/mail/templates/default/display.xet index 4c73b01e89..8de96bb2af 100644 --- a/mail/templates/default/display.xet +++ b/mail/templates/default/display.xet @@ -19,7 +19,7 @@ - + @@ -51,7 +51,7 @@