diff --git a/felamimail/inc/class.bocompose.inc.php b/felamimail/inc/class.bocompose.inc.php
index 5292357e2e..3ccc67d12b 100644
--- a/felamimail/inc/class.bocompose.inc.php
+++ b/felamimail/inc/class.bocompose.inc.php
@@ -344,6 +344,7 @@
#$bodyParts[$i]['body'] = nl2br($bodyParts[$i]['body']);
$bodyParts[$i]['body'] = "
translation->convert($bodyParts[$i]['body'], $bodyParts[$i]['charSet']);
+
+ if ($bodyParts[$i]['mimeType'] == 'text/html') {
+ // convert HTML to text, as we dont want HTML in infologs
+ $newBody = html::purify($newBody);
+ $newBody = $bofelamimail->convertHTMLToText($newBody,true);
+ $bofelamimail->getCleanHTML($newBody); // new Body passed by reference
+ $message .= $newBody;
+ continue;
+ }
+ $newBody = strip_tags($newBody);
+ $newBody = explode("\n",$newBody);
+ // create it new, with good line breaks
+ reset($newBody);
+ while(list($key,$value) = @each($newBody))
+ {
+ if (trim($value) != '') {
+ #if ($value != "\r") $value .= "\n";
+ } else {
+ // if you want to strip all empty lines uncomment the following
+ #continue;
+ }
+ $message .= $bofelamimail->wordwrap($value,75,"\n");
+ }
+ }
+ return $message;
+ }
}
diff --git a/felamimail/inc/class.uicompose.inc.php b/felamimail/inc/class.uicompose.inc.php
index edcd65e991..aabb41269b 100644
--- a/felamimail/inc/class.uicompose.inc.php
+++ b/felamimail/inc/class.uicompose.inc.php
@@ -107,6 +107,7 @@
$formData['mimeType'] = $this->bocompose->stripSlashes($_POST['mimeType']);
$formData['disposition'] = (bool)$_POST['disposition'];
$formData['to_infolog'] = $_POST['to_infolog'];
+ $formData['to_tracker'] = $_POST['to_tracker'];
//$formData['mailbox'] = $_GET['mailbox'];
if((bool)$_POST['printit'] == true) {
$formData['printit'] = 1;
@@ -404,8 +405,18 @@
$this->t->set_var('lang_save_as_infolog','');
$this->t->set_var('infolog_checkbox','');
}
+ if ($GLOBALS['egw_info']['user']['apps']['tracker'])
+ {
+ $this->t->set_var('trackerImage',html::image('felamimail','to_tracker',lang('Save as tracker'),'width="17px" height="17px" valign="middle"' ));
+ $this->t->set_var('lang_save_as_infolog',($GLOBALS['egw_info']['user']['apps']['infolog']?lang('Save:'):lang('Save as tracker')));
+ $this->t->set_var('tracker_checkbox','');
+ } else {
+ $this->t->set_var('trackerImage','');
+ $this->t->set_var('tracker_checkbox','');
+ }
$this->t->set_var('lang_no_recipient',lang('No recipient address given!'));
$this->t->set_var('lang_no_subject',lang('No subject given!'));
+ $this->t->set_var('lang_infolog_tracker_not_both',lang("You can either choose to save as infolog OR tracker, not both."));
$this->t->pparse("out","header");
// prepare signatures, the selected sig may be used on top of the body
diff --git a/felamimail/inc/class.uidisplay.inc.php b/felamimail/inc/class.uidisplay.inc.php
index ce5b9b42f8..ec702ab7fa 100644
--- a/felamimail/inc/class.uidisplay.inc.php
+++ b/felamimail/inc/class.uidisplay.inc.php
@@ -974,12 +974,11 @@
$senderAddress .= 'undisclosed-recipients';
continue;
}
-
if($addressData['PERSONAL_NAME'] != 'NIL') {
$newSenderAddress = $addressData['RFC822_EMAIL'] != 'NIL' ? $addressData['RFC822_EMAIL'] : $addressData['EMAIL'];
if ($decode) $newSenderAddress = bofelamimail::decode_header($newSenderAddress);
$decodedPersonalName = ($decode ? bofelamimail::decode_header($addressData['PERSONAL_NAME']):$addressData['PERSONAL_NAME']);
-
+ if ($decode) $addressData['EMAIL'] = bofelamimail::decode_header($addressData['EMAIL']);
$realName = $decodedPersonalName;
// add mailaddress
if ($allwaysShowMailAddress) {
@@ -1030,6 +1029,7 @@
lang('add to addressbook'));
}
} else {
+ if ($decode) $addressData['EMAIL'] = bofelamimail::decode_header($addressData['EMAIL']);
$linkData = array (
'menuaction' => 'felamimail.uicompose.compose',
'send_to' => base64_encode($addressData['EMAIL'])
@@ -1063,7 +1063,6 @@
}
}
}
-
return $senderAddress;
}
@@ -1229,6 +1228,7 @@
{
$singleBodyPart['body'] = preg_replace($sar,$rar,$singleBodyPart['body']);
}
+ if ($singleBodyPart['charSet']===false) $singleBodyPart['charSet'] = bofelamimail::detect_encoding($singleBodyPart['body']);
$singleBodyPart['body'] = $GLOBALS['egw']->translation->convert(
$singleBodyPart['body'],
strtolower($singleBodyPart['charSet'])
diff --git a/felamimail/inc/class.uiwidgets.inc.php b/felamimail/inc/class.uiwidgets.inc.php
index f3764af7b7..9eae1e854d 100644
--- a/felamimail/inc/class.uiwidgets.inc.php
+++ b/felamimail/inc/class.uiwidgets.inc.php
@@ -672,7 +672,7 @@
$image
|
-
+ |
".$this->navbarSeparator().$this->displayMessageActions($headerData, $_folderName, $_icServer,true)."
@@ -805,6 +805,16 @@
}
$to_infologURL = $GLOBALS['egw']->link('/index.php',$linkData);
+ $linkData = array(
+ 'menuaction' => 'tracker.tracker_ui.import_mail',
+ 'uid' => $_headerData['uid'],
+ 'mailbox' => base64_encode($_folderName)
+ );
+ if($_headerData['partid'] != '') {
+ $linkData['part'] = $_headerData['partid'];
+ }
+ $to_trackerURL = $GLOBALS['egw']->link('/index.php',$linkData);
+
// viewheader url
$linkData = array (
'menuaction' => 'felamimail.uidisplay.displayHeader',
@@ -845,7 +855,13 @@
'action' => "window.open('$to_infologURL','_blank','dependent=yes,width=".$i_width.",height=".$i_height.",scrollbars=yes,status=yes')",
'tooltip' => lang('save as infolog'));
}
-
+ if ($GLOBALS['egw_info']['user']['apps']['tracker'])
+ {
+ list($i_width,$i_height) = explode('x',egw_link::get_registry('tracker','add_popup'));
+ $navbarImages['to_tracker'] = array(
+ 'action' => "egw_openWindowCentered('$to_trackerURL','_blank',".$i_width.",".$i_height.")",
+ 'tooltip' => lang('save as tracker'));
+ }
// save email as
$navbarImages['fileexport'] = array(
'action' => ($_forceNewWindow ? "window.open('$saveMessageURL','_blank','dependent=yes,width=100,height=100,scrollbars=yes,status=yes')": "window.location.href = '$saveMessageURL'"),
diff --git a/felamimail/templates/default/composeForm.tpl b/felamimail/templates/default/composeForm.tpl
index e8b069eef5..131243d40a 100644
--- a/felamimail/templates/default/composeForm.tpl
+++ b/felamimail/templates/default/composeForm.tpl
@@ -38,6 +38,14 @@
alert("{lang_no_subject}");
return false;
}
+ // check to infolog/ to tracker. Only one can be checked.
+ var toinfolog = document.getElementById('to_infolog');
+ var totracker = document.getElementById('to_tracker');
+ if (toinfolog.checked==true && totracker.checked==true)
+ {
+ alert("{lang_infolog_tracker_not_both}");
+ return false;
+ }
return true;
}
@@ -81,6 +89,12 @@
|
{infolog_checkbox}
|
+
+
+ |
+
+ {tracker_checkbox}
+ |
|
diff --git a/felamimail/templates/default/images/to_tracker.png b/felamimail/templates/default/images/to_tracker.png
new file mode 100644
index 0000000000..6eb0151445
Binary files /dev/null and b/felamimail/templates/default/images/to_tracker.png differ
diff --git a/infolog/inc/class.infolog_ui.inc.php b/infolog/inc/class.infolog_ui.inc.php
index e029efe402..101ed09b4f 100644
--- a/infolog/inc/class.infolog_ui.inc.php
+++ b/infolog/inc/class.infolog_ui.inc.php
@@ -1523,7 +1523,7 @@ class infolog_ui
{
$bofelamimail->reopen($attachment['folder']);
- $mailcontent = self::get_mailcontent($bofelamimail,$attachment['uid'],$attachment['partID'],$attachment['folder']);
+ $mailcontent = bofelamimail::get_mailcontent($bofelamimail,$attachment['uid'],$attachment['partID'],$attachment['folder']);
//_debug_array($mailcontent['attachments']);
foreach($mailcontent['attachments'] as $tmpattach => $tmpval)
{
@@ -1557,7 +1557,7 @@ class infolog_ui
$toaddr = array();
foreach(array('to','cc','bcc') as $x) if (is_array($_to_emailAddress[$x]) && !empty($_to_emailAddress[$x])) $toaddr = array_merge($toaddr,$_to_emailAddress[$x]);
//_debug_array($attachments);
- $body = self::createHeaderInfoSection(array('FROM'=>$_to_emailAddress['from'],
+ $body = bofelamimail::createHeaderInfoSection(array('FROM'=>$_to_emailAddress['from'],
'TO'=>(!empty($_to_emailAddress['to'])?implode(',',$_to_emailAddress['to']):null),
'CC'=>(!empty($_to_emailAddress['cc'])?implode(',',$_to_emailAddress['cc']):null),
'BCC'=>(!empty($_to_emailAddress['bcc'])?implode(',',$_to_emailAddress['bcc']):null),
@@ -1575,7 +1575,7 @@ class infolog_ui
$bofelamimail->openConnection();
$bofelamimail->reopen($mailbox);
- $mailcontent = self::get_mailcontent($bofelamimail,$uid,$partid,$mailbox);
+ $mailcontent = bofelamimail::get_mailcontent($bofelamimail,$uid,$partid,$mailbox);
return $this->edit($this->bo->import_mail(
$mailcontent['mailaddress'],
@@ -1591,150 +1591,6 @@ class infolog_ui
exit;
}
- /**
- * fetches the actual mailcontent
- */
- static function get_mailcontent(&$bofelamimail,$uid,$partid='',$mailbox='')
- {
- //echo __METHOD__." called for $uid,$partid
";
- $headers = $bofelamimail->getMessageHeader($uid,$partid,true);
- // dont force retrieval of the textpart, let felamimail preferences decide
- $bodyParts = $bofelamimail->getMessageBody($uid,'',$partid);
- $attachments = $bofelamimail->getMessageAttachments($uid,$partid);
-
- if ($bofelamimail->isSentFolder($mailbox)) $mailaddress = $headers['TO'];
- elseif (isset($headers['FROM'])) $mailaddress = $headers['FROM'];
- elseif (isset($headers['SENDER'])) $mailaddress = $headers['SENDER'];
- if (isset($headers['CC'])) $mailaddress .= ','.$headers['CC'];
- //_debug_array($headers);
- $subject = $headers['SUBJECT'];
-
- $message = self::getdisplayableBody($bofelamimail, $bodyParts);
- $headdata = self::createHeaderInfoSection($headers);
- $message = $headdata.$message;
- //echo __METHOD__.'
';
- //_debug_array($attachments);
- if (is_array($attachments))
- {
- foreach ($attachments as $num => $attachment)
- {
- if ($attachment['mimeType'] == 'MESSAGE/RFC822')
- {
- //_debug_array($bofelamimail->getMessageHeader($uid, $attachment['partID']));
- //_debug_array($bofelamimail->getMessageBody($uid,'', $attachment['partID']));
- //_debug_array($bofelamimail->getMessageAttachments($uid, $attachment['partID']));
- $mailcontent = self::get_mailcontent($bofelamimail,$uid,$attachment['partID']);
- $headdata ='';
- if ($mailcontent['headers'])
- {
- $headdata = self::createHeaderInfoSection($mailcontent['headers']);
- }
- if ($mailcontent['message'])
- {
- $tempname =tempnam($GLOBALS['egw_info']['server']['temp_dir'],$GLOBALS['egw_info']['flags']['currentapp']."_");
- $attachedMessages[] = array(
- 'type' => 'TEXT/PLAIN',
- 'name' => $mailcontent['subject'].'.txt',
- 'tmp_name' => $tempname,
- );
- $tmpfile = fopen($tempname,'w');
- fwrite($tmpfile,$headdata.$mailcontent['message']);
- fclose($tmpfile);
- }
- foreach($mailcontent['attachments'] as $tmpattach => $tmpval)
- {
- $attachedMessages[] = $tmpval;
- }
- unset($attachments[$num]);
- }
- else
- {
- $attachments[$num] = array_merge($attachments[$num],$bofelamimail->getAttachment($uid, $attachment['partID']));
- if (isset($attachments[$num]['charset'])) {
- $GLOBALS['egw']->translation->convert($attachments[$num]['attachment'],$attachments[$num]['charset']);
- }
- $attachments[$num]['type'] = $attachments[$num]['mimeType'];
- $attachments[$num]['tmp_name'] = tempnam($GLOBALS['egw_info']['server']['temp_dir'],$GLOBALS['egw_info']['flags']['currentapp']."_");
- $tmpfile = fopen($attachments[$num]['tmp_name'],'w');
- fwrite($tmpfile,$attachments[$num]['attachment']);
- fclose($tmpfile);
- unset($attachments[$num]['attachment']);
- }
- }
- if (is_array($attachedMessages)) $attachments = array_merge($attachments,$attachedMessages);
- }
- return array(
- 'mailaddress'=>$mailaddress,
- 'subject'=>$subject,
- 'message'=>$message,
- 'attachments'=>$attachments,
- 'headers'=>$headers,
- );
- }
-
- static function createHeaderInfoSection($header)
- {
- $headdata = null;
- if ($header['SUBJECT']) $headdata = lang('subject').': '.$header['SUBJECT']."\n";
- if ($header['FROM']) $headdata .= lang('from').': '.$header['FROM']."\n";
- if ($header['SENDER']) $headdata .= lang('sender').': '.$header['SENDER']."\n";
- if ($header['TO']) $headdata .= lang('to').': '.$header['TO']."\n";
- if ($header['CC']) $headdata .= lang('cc').': '.$header['CC']."\n";
- if ($header['BCC']) $headdata .= lang('bcc').': '.$header['BCC']."\n";
- if ($header['DATE']) $headdata .= lang('date').': '.$header['DATE']."\n";
- if ($header['PRIORITY'] && $header['PRIORITY'] != 'normal') $headdata .= lang('priority').': '.$header['PRIORITY']."\n";
- if ($header['IMPORTANCE'] && $header['IMPORTANCE'] !='normal') $headdata .= lang('importance').': '.$header['IMPORTANCE']."\n";
- //if ($mailcontent['headers']['ORGANIZATION']) $headdata .= lang('organization').': '.$mailcontent['headers']['ORGANIZATION']."\
- if (!empty($headdata))
- {
- $headdata = "--------------------------------------------------------\n".$headdata;
- $headdata .= "--------------------------------------------------------\n";
- }
- else
- {
- $headdata = "--------------------------------------------------------\n";
- }
- return $headdata;
- }
-
- static function &getdisplayableBody(&$bofelamimail, $bodyParts)
- {
- for($i=0; $itranslation->convert($bodyParts[$i]['body'], $bodyParts[$i]['charSet']);
-
- if ($bodyParts[$i]['mimeType'] == 'text/html') {
- // convert HTML to text, as we dont want HTML in infologs
- $newBody = html::purify($newBody);
- $newBody = $bofelamimail->convertHTMLToText($newBody,true);
- $bofelamimail->getCleanHTML($newBody); // new Body passed by reference
- $message .= $newBody;
- continue;
- }
- $newBody = strip_tags($newBody);
- $newBody = explode("\n",$newBody);
- // create it new, with good line breaks
- reset($newBody);
- while(list($key,$value) = @each($newBody))
- {
- if (trim($value) != '') {
- #if ($value != "\r") $value .= "\n";
- } else {
- // if you want to strip all empty lines uncomment the following
- #continue;
- }
- $message .= $bofelamimail->wordwrap($value,75,"\n");
- }
- }
- return $message;
- }
/**
* return javascript to open compose window to print the Infolog