mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-28 10:53:39 +01:00
better control of subject length and preview Header region, adding addressbook add action to preview
This commit is contained in:
parent
befdacb962
commit
9012fb3133
@ -433,7 +433,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
function decode_header($_string)
|
||||
static function decode_header($_string)
|
||||
{
|
||||
return $GLOBALS['egw']->translation->decodeMailHeader($_string,self::$displayCharset);
|
||||
}
|
||||
|
@ -411,24 +411,24 @@
|
||||
// sent by a mailinglist??
|
||||
// parse the from header
|
||||
if($envelope['FROM'][0] != $envelope['SENDER'][0]) {
|
||||
$senderAddress = $this->emailAddressToHTML($envelope['SENDER']);
|
||||
$fromAddress = $this->emailAddressToHTML($envelope['FROM'], $organization);
|
||||
$senderAddress = self::emailAddressToHTML($envelope['SENDER']);
|
||||
$fromAddress = self::emailAddressToHTML($envelope['FROM'], $organization);
|
||||
$this->t->set_var("from_data",$senderAddress);
|
||||
$this->t->set_var("onbehalfof_data",$fromAddress);
|
||||
$this->t->parse('on_behalf_of_part','message_onbehalfof',True);
|
||||
} else {
|
||||
$fromAddress = $this->emailAddressToHTML($envelope['FROM'], $organization);
|
||||
$fromAddress = self::emailAddressToHTML($envelope['FROM'], $organization);
|
||||
$this->t->set_var("from_data", $fromAddress);
|
||||
$this->t->set_var('on_behalf_of_part','');
|
||||
}
|
||||
|
||||
// parse the to header
|
||||
$toAddress = $this->emailAddressToHTML($envelope['TO']);
|
||||
$toAddress = self::emailAddressToHTML($envelope['TO']);
|
||||
$this->t->set_var("to_data",$toAddress);
|
||||
|
||||
// parse the cc header
|
||||
if(count($envelope['CC'])) {
|
||||
$ccAddress = $this->emailAddressToHTML($envelope['CC']);
|
||||
$ccAddress = self::emailAddressToHTML($envelope['CC']);
|
||||
$this->t->set_var("cc_data",$ccAddress);
|
||||
$this->t->parse('cc_data_part','message_cc',True);
|
||||
} else {
|
||||
@ -437,7 +437,7 @@
|
||||
|
||||
// parse the bcc header
|
||||
if(count($envelope['BCC'])) {
|
||||
$bccAddress = $this->emailAddressToHTML($envelope['BCC']);
|
||||
$bccAddress = self::emailAddressToHTML($envelope['BCC']);
|
||||
$this->t->set_var("bcc_data",$bccAddress);
|
||||
$this->t->parse('bcc_data_part','message_bcc',True);
|
||||
} else {
|
||||
@ -755,7 +755,7 @@
|
||||
$GLOBALS['egw']->common->egw_header();
|
||||
}
|
||||
|
||||
function emailAddressToHTML($_emailAddress, $_organisation='', $allwaysShowMailAddress=false, $showAddToAdrdessbookLink=true) {
|
||||
static function emailAddressToHTML($_emailAddress, $_organisation='', $allwaysShowMailAddress=false, $showAddToAdrdessbookLink=true) {
|
||||
#_debug_array($_emailAddress);
|
||||
// create some nice formated HTML for senderaddress
|
||||
#if($_emailAddress['EMAIL'] == 'undisclosed-recipients: ;')
|
||||
@ -780,8 +780,8 @@
|
||||
|
||||
if($addressData['PERSONAL_NAME'] != 'NIL') {
|
||||
$newSenderAddress = $addressData['RFC822_EMAIL'] != 'NIL' ? $addressData['RFC822_EMAIL'] : $addressData['EMAIL'];
|
||||
$newSenderAddress = $this->bofelamimail->decode_header($newSenderAddress);
|
||||
$decodedPersonalName = $this->bofelamimail->decode_header($addressData['PERSONAL_NAME']);
|
||||
$newSenderAddress = bofelamimail::decode_header($newSenderAddress);
|
||||
$decodedPersonalName = bofelamimail::decode_header($addressData['PERSONAL_NAME']);
|
||||
|
||||
$realName = $decodedPersonalName;
|
||||
// add mailaddress
|
||||
@ -800,8 +800,8 @@
|
||||
$link = $GLOBALS['egw']->link('/index.php',$linkData);
|
||||
$senderAddress .= sprintf('<a href="%s" title="%s">%s</a>',
|
||||
$link,
|
||||
@htmlentities($newSenderAddress,ENT_QUOTES,$this->displayCharset),
|
||||
@htmlentities($realName, ENT_QUOTES, $this->displayCharset));
|
||||
@htmlentities($newSenderAddress,ENT_QUOTES,bofelamimail::$displayCharset),
|
||||
@htmlentities($realName, ENT_QUOTES, bofelamimail::$displayCharset));
|
||||
|
||||
$linkData = array (
|
||||
'menuaction' => 'addressbook.addressbook_ui.edit',
|
||||
@ -839,7 +839,7 @@
|
||||
);
|
||||
$link = $GLOBALS['egw']->link('/index.php',$linkData);
|
||||
$senderAddress .= sprintf('<a href="%s">%s</a>',
|
||||
$link,@htmlentities($addressData['EMAIL'], ENT_QUOTES, $this->displayCharset));
|
||||
$link,@htmlentities($addressData['EMAIL'], ENT_QUOTES, bofelamimail::$displayCharset));
|
||||
//TODO: This uses old addressbook code, which should be removed in Version 1.4
|
||||
//Please use addressbook.addressbook_ui.edit with proper paramenters
|
||||
$linkData = array
|
||||
@ -1196,24 +1196,24 @@
|
||||
$this->translate();
|
||||
|
||||
if($envelope['FROM'][0] != $envelope['SENDER'][0]) {
|
||||
$senderAddress = $this->emailAddressToHTML($envelope['SENDER'], '', true, false);
|
||||
$fromAddress = $this->emailAddressToHTML($envelope['FROM'], $organization, true, false);
|
||||
$senderAddress = self::emailAddressToHTML($envelope['SENDER'], '', true, false);
|
||||
$fromAddress = self::emailAddressToHTML($envelope['FROM'], $organization, true, false);
|
||||
$this->t->set_var("from_data",$senderAddress);
|
||||
$this->t->set_var("onbehalfof_data",$fromAddress);
|
||||
$this->t->parse('on_behalf_of_part','message_onbehalfof',True);
|
||||
} else {
|
||||
$fromAddress = $this->emailAddressToHTML($envelope['FROM'], $organization, true, false);
|
||||
$fromAddress = self::emailAddressToHTML($envelope['FROM'], $organization, true, false);
|
||||
$this->t->set_var("from_data", $fromAddress);
|
||||
$this->t->set_var('on_behalf_of_part','');
|
||||
}
|
||||
|
||||
// parse the to header
|
||||
$toAddress = $this->emailAddressToHTML($envelope['TO'], '', true, false);
|
||||
$toAddress = self::emailAddressToHTML($envelope['TO'], '', true, false);
|
||||
$this->t->set_var("to_data",$toAddress);
|
||||
|
||||
// parse the cc header
|
||||
if(count($envelope['CC'])) {
|
||||
$ccAddress = $this->emailAddressToHTML($envelope['CC'], '', true, false);
|
||||
$ccAddress = self::emailAddressToHTML($envelope['CC'], '', true, false);
|
||||
$this->t->set_var("cc_data",$ccAddress);
|
||||
$this->t->parse('cc_data_part','message_cc',True);
|
||||
} else {
|
||||
|
@ -513,20 +513,56 @@
|
||||
// sent or drafts or template folder
|
||||
if (!empty($headerData['to_name'])) {
|
||||
$sender_name = $headerData['to_name'];
|
||||
$full_address = $headerData['to_name'].' <'.$headerData['to_address'].'>';
|
||||
$sender_address = $headerData['to_address'];
|
||||
$full_address = $headerData['to_name'].' <'.$headerData['to_address'].'>';
|
||||
} else {
|
||||
$sender_name = $headerData['to_address'];
|
||||
$sender_address = $headerData['to_address'];
|
||||
$full_address = $headerData['to_address'];
|
||||
}
|
||||
} else {
|
||||
if (!empty($headerData['sender_name'])) {
|
||||
$sender_name = $headerData['sender_name'];
|
||||
$full_address = $headerData['sender_name'].' <'.$headerData['sender_address'].'>';
|
||||
$sender_address = $headerData['sender_address'];
|
||||
$full_address = $headerData['sender_name'].' <'.$headerData['sender_address'].'>';
|
||||
} else {
|
||||
$sender_name = $headerData['sender_address'];
|
||||
$sender_address = $headerData['sender_address'];
|
||||
$full_address = $headerData['sender_address'];
|
||||
}
|
||||
}
|
||||
//$fromAddress = uidisplay::emailAddressToHTML(array('PERSONAL_NAME'=>$sender_name,'EMAIL'=>$sender_address,'RFC822_EMAIL'=>$full_address),'');
|
||||
if ($GLOBALS['egw_info']['user']['apps']['addressbook']) {
|
||||
$addresslinkData = array (
|
||||
'menuaction' => 'addressbook.addressbook_ui.edit',
|
||||
'presets[email]' => $sender_address,
|
||||
'referer' => $_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING']
|
||||
);
|
||||
$decodedPersonalName = $sender_name;
|
||||
if (!empty($decodedPersonalName)) {
|
||||
if($spacePos = strrpos($decodedPersonalName, ' ')) {
|
||||
$addresslinkData['presets[n_family]'] = substr($decodedPersonalName, $spacePos+1);
|
||||
$addresslinkData['presets[n_given]'] = substr($decodedPersonalName, 0, $spacePos);
|
||||
} else {
|
||||
$addresslinkData['presets[n_family]'] = $decodedPersonalName;
|
||||
}
|
||||
$addresslinkData['presets[n_fn]'] = $decodedPersonalName;
|
||||
}
|
||||
|
||||
$urlAddToAddressbook = $GLOBALS['egw']->link('/index.php',$addresslinkData);
|
||||
$onClick = "window.open(this,this.target,'dependent=yes,width=850,height=440,location=no,menubar=no,toolbar=no,scrollbars=yes,status=yes'); return false;";
|
||||
$image = $GLOBALS['egw']->common->image('felamimail','sm_envelope');
|
||||
$fromAddress .= sprintf('<a href="%s" onClick="%s">
|
||||
<img src="%s" width="10" height="8" border="0"
|
||||
align="absmiddle" alt="%s"
|
||||
title="%s"></a>',
|
||||
$urlAddToAddressbook,
|
||||
$onClick,
|
||||
$image,
|
||||
lang('add to addressbook'),
|
||||
lang('add to addressbook'));
|
||||
}
|
||||
|
||||
$linkData = array (
|
||||
'menuaction' => 'felamimail.uidisplay.display',
|
||||
'showHeader' => 'false',
|
||||
@ -560,18 +596,20 @@
|
||||
);
|
||||
|
||||
//_debug_array($GLOBALS['egw']->link('/index.php',$linkData));
|
||||
$IFRAMEBody = "<TABLE BORDER=\"1\" rules=\"rows\" style=\"width:100%;\">
|
||||
<TR class=\"th\" style=\"width:73%;\">
|
||||
<TD nowrap valign=\"top\">
|
||||
".($_folderType > 0?lang('to'):lang('from')).':<b>'.$full_address .'</b><br> '.
|
||||
$IFRAMEBody = "<TABLE BORDER=\"1\" rules=\"rows\" style=\"table-layout:fixed;width:100%;\">
|
||||
<TR class=\"th\" style=\"width:100%;\">
|
||||
<TD nowrap valign=\"top\" style=\"overflow:hidden;\">
|
||||
".($_folderType > 0?lang('to'):lang('from')).':<b>'.$full_address.' '.($fromAddress?$fromAddress:'') .'</b><br> '.
|
||||
lang('date').':<b>'.$GLOBALS['egw']->common->show_date($headerData['date']/*,$GLOBALS['egw_info']['user']['preferences']['common']['dateformat']*/)."</b><br>
|
||||
".lang('subject').":<b>".$subject."</b>
|
||||
</TD>
|
||||
<td style=\"width:2%;\">
|
||||
<td style=\"width:20px;\" align=\"right\">
|
||||
$image
|
||||
</td>
|
||||
<td style=\"width:25%;\" align=\"right\">
|
||||
".$this->navbarSeparator().$this->displayMessageActions($headerData, $_folderName, $_icServer,true)."
|
||||
<td style=\"width:250px;\" align=\"right\">
|
||||
<nobr>
|
||||
".$this->navbarSeparator().$this->displayMessageActions($headerData, $_folderName, $_icServer,true)."
|
||||
</nobr>
|
||||
</td>
|
||||
</TR>
|
||||
<TR>
|
||||
|
Loading…
Reference in New Issue
Block a user