mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-18 04:31:06 +01:00
* Mail: iCal attachments are shown as such, only meeting requests trigger calendar interface with accept/reject buttons
This commit is contained in:
parent
c7996ae42e
commit
d055de2e16
@ -4424,9 +4424,10 @@ class Mail
|
|||||||
* @param Horde_Mime_Part $_structure structure for parsing
|
* @param Horde_Mime_Part $_structure structure for parsing
|
||||||
* @param string $_htmlMode how to display a message, html, plain text, ...
|
* @param string $_htmlMode how to display a message, html, plain text, ...
|
||||||
* @param boolean $_preserveSeen flag to preserve the seenflag by using body.peek
|
* @param boolean $_preserveSeen flag to preserve the seenflag by using body.peek
|
||||||
|
* @param Horde_Mime_Part& $partCalendar =null on return text/calendar part, if one was contained or false
|
||||||
* @return array containing the desired part
|
* @return array containing the desired part
|
||||||
*/
|
*/
|
||||||
function getMultipartAlternative($_uid, Horde_Mime_Part $_structure, $_htmlMode, $_preserveSeen = false)
|
function getMultipartAlternative($_uid, Horde_Mime_Part $_structure, $_htmlMode, $_preserveSeen = false, &$partCalendar=null)
|
||||||
{
|
{
|
||||||
// a multipart/alternative has exactly 2 parts (text and html OR text and something else)
|
// a multipart/alternative has exactly 2 parts (text and html OR text and something else)
|
||||||
// sometimes there are 3 parts, when there is an ics/ical attached/included-> we want to show that
|
// sometimes there are 3 parts, when there is an ics/ical attached/included-> we want to show that
|
||||||
@ -4460,6 +4461,10 @@ class Mail
|
|||||||
case 'html':
|
case 'html':
|
||||||
if ($mimePart->getBytes() > 0) $partHTML = $mimePart;
|
if ($mimePart->getBytes() > 0) $partHTML = $mimePart;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'calendar':
|
||||||
|
if ($mimePart->getBytes() > 0) $partCalendar = $mimePart;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -4795,9 +4800,10 @@ class Mail
|
|||||||
* @param Horde_Mime_Part $_structure = null if given use structure for parsing
|
* @param Horde_Mime_Part $_structure = null if given use structure for parsing
|
||||||
* @param boolean $_preserveSeen flag to preserve the seenflag by using body.peek
|
* @param boolean $_preserveSeen flag to preserve the seenflag by using body.peek
|
||||||
* @param string $_folder folder to work on
|
* @param string $_folder folder to work on
|
||||||
|
* @param Horde_Mime_part& $calendar_part =null on return calendar-part or null, if there is none
|
||||||
* @return array containing the message body, mimeType and charset
|
* @return array containing the message body, mimeType and charset
|
||||||
*/
|
*/
|
||||||
function getMessageBody($_uid, $_htmlOptions='', $_partID=null, Horde_Mime_Part $_structure=null, $_preserveSeen = false, $_folder = '')
|
function getMessageBody($_uid, $_htmlOptions='', $_partID=null, Horde_Mime_Part $_structure=null, $_preserveSeen = false, $_folder = '', &$calendar_part=null)
|
||||||
{
|
{
|
||||||
if (self::$debug) echo __METHOD__."$_uid, $_htmlOptions, $_partID<br>";
|
if (self::$debug) echo __METHOD__."$_uid, $_htmlOptions, $_partID<br>";
|
||||||
if($_htmlOptions != '') {
|
if($_htmlOptions != '') {
|
||||||
@ -4849,7 +4855,7 @@ class Mail
|
|||||||
switch($_structure->getSubType())
|
switch($_structure->getSubType())
|
||||||
{
|
{
|
||||||
case 'alternative':
|
case 'alternative':
|
||||||
$bodyParts = array($this->getMultipartAlternative($_uid, $_structure, $this->htmlOptions, $_preserveSeen));
|
$bodyParts = array($this->getMultipartAlternative($_uid, $_structure, $this->htmlOptions, $_preserveSeen, $calendar_part));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'nil': // multipart with no Alternative
|
case 'nil': // multipart with no Alternative
|
||||||
|
@ -2853,33 +2853,24 @@ $filter['before']= date("d-M-Y", $cutoffdate2);
|
|||||||
if (empty($htmlOptions)) $htmlOptions = $this->mail_bo->htmlOptions;
|
if (empty($htmlOptions)) $htmlOptions = $this->mail_bo->htmlOptions;
|
||||||
// fetching structure now, to supply it to getMessageBody and getMessageAttachment, so it does not get fetched twice
|
// fetching structure now, to supply it to getMessageBody and getMessageAttachment, so it does not get fetched twice
|
||||||
$structure = $this->mail_bo->getStructure($uid, $partID, $mailbox, false);
|
$structure = $this->mail_bo->getStructure($uid, $partID, $mailbox, false);
|
||||||
$bodyParts = $this->mail_bo->getMessageBody($uid, ($htmlOptions?$htmlOptions:''), $partID, $structure, false, $mailbox);
|
$calendar_part = null;
|
||||||
|
$bodyParts = $this->mail_bo->getMessageBody($uid, ($htmlOptions?$htmlOptions:''), $partID, $structure, false, $mailbox, $calendar_part);
|
||||||
|
|
||||||
//error_log(__METHOD__.__LINE__.array2string($bodyParts));
|
// for meeting requests (multipart alternative with text/calendar part) let calendar render it
|
||||||
// attachments here are only fetched to determine if there is a meeting request
|
if ($calendar_part && isset($GLOBALS['egw_info']['user']['apps']['calendar']))
|
||||||
// and if. use the appropriate action. so we do not need embedded images
|
|
||||||
$fetchEmbeddedImages = false;
|
|
||||||
$attachments = (array)$this->mail_bo->getMessageAttachments($uid, $partID, $structure, $fetchEmbeddedImages, true,true,$mailbox);
|
|
||||||
//error_log(__METHOD__.__LINE__.array2string($attachments));
|
|
||||||
foreach ($attachments as &$attach)
|
|
||||||
{
|
{
|
||||||
if (strtolower($attach['mimeType']) == 'text/calendar' &&
|
$charset = $calendar_part->getContentTypeParameter('charset');
|
||||||
isset($GLOBALS['egw_info']['user']['apps']['calendar']) &&
|
$this->mail_bo->fetchPartContents($uid, $calendar_part);
|
||||||
($attachment = $this->mail_bo->getAttachment($uid, $attach['partID'],$attach['is_winmail'],(strtolower($attach['mimeType']) == 'text/calendar'?false:true))))
|
Api\Cache::setSession('calendar', 'ical', array(
|
||||||
{
|
'charset' => $charset ? $charset : 'utf-8',
|
||||||
//error_log(__METHOD__.__LINE__.array2string($attachment));
|
'attachment' => $calendar_part->getContents(),
|
||||||
Api\Cache::setSession('calendar', 'ical', array(
|
'method' => $calendar_part->getContentTypeParameter('method'),
|
||||||
'charset' => $attach['charset'] ? $attach['charset'] : 'utf-8',
|
));
|
||||||
'attachment' => $attachment['attachment'],
|
$this->mail_bo->htmlOptions = $bufferHtmlOptions;
|
||||||
'method' => $attach['method'],
|
Api\Translation::add_app('calendar');
|
||||||
'sender' => $mailbox,
|
return ExecMethod('calendar.calendar_uiforms.meeting',
|
||||||
));
|
array('event'=>null,'msg'=>'','useSession'=>true)
|
||||||
$this->mail_bo->htmlOptions = $bufferHtmlOptions;
|
);
|
||||||
Api\Translation::add_app('calendar');
|
|
||||||
return ExecMethod( 'calendar.calendar_uiforms.meeting',
|
|
||||||
array('event'=>null,'msg'=>'','useSession'=>true)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// Compose the content of the frame
|
// Compose the content of the frame
|
||||||
$frameHtml =
|
$frameHtml =
|
||||||
|
Loading…
Reference in New Issue
Block a user