fix id behavior for identities in compose, introduced long ago when trying to utilize taglist

This commit is contained in:
Klaus Leithoff 2013-10-07 16:33:56 +00:00
parent 147e469b02
commit 6950fb0cc9
2 changed files with 12 additions and 37 deletions

View File

@ -870,7 +870,6 @@ class mail_compose
foreach($allIdentities as $key => $singleIdentity) {
//$identities[$singleIdentity->id] = $singleIdentity->realName.' <'.$singleIdentity->emailAddress.'>';
$iS = mail_bo::generateIdentityString($singleIdentity);
$shortIDString = trim(mail_bo::generateIdentityString($singleIdentity,false));
if (mail_bo::$mailConfig['how2displayIdentities']=='' || count($allIdentities) ==1 || count($allIdentities) ==$globalIds)
{
$id_prepend ='';
@ -883,7 +882,7 @@ class mail_compose
if (array_search($id_prepend.$iS,$identities)===false)
{
$identities[$singleIdentity->id] = $id_prepend.$iS;
$sel_options['identity'][$iS] = $id_prepend.$iS;
$sel_options['identity'][$singleIdentity->id] = $id_prepend.$iS;
}
if(in_array($singleIdentity->id,$defaultIds) && $defaultIdentity==0)
{
@ -1059,10 +1058,14 @@ class mail_compose
// address stuff like from, to, cc, replyto
$destinationRows = 0;
foreach(self::$destinations as $destination) {
if (!is_array($content[$destination]))
{
if (!empty($content[$destination])) $content[$destination] = (array)$content[$destination];
}
foreach((array)$content[$destination] as $key => $value) {
if ($value=="NIL@NIL") continue;
if ($destination=='replyto' && str_replace('"','',$value) == str_replace('"','',$identities[($presetId ? $presetId : $defaultIdentity)])) continue;
//error_log(__METHOD__.__LINE__.array2string(array('key'=>$key,'value'=>$value)));
error_log(__METHOD__.__LINE__.array2string(array('key'=>$key,'value'=>$value)));
$value = htmlspecialchars_decode($value,ENT_COMPAT);
$value = str_replace("\"\"",'"',$value);
$address_array = imap_rfc822_parse_adrlist((get_magic_quotes_gpc()?stripslashes($value):$value), '');
@ -2453,37 +2456,6 @@ if (is_array($content['attachments']))error_log(__METHOD__.__LINE__.' Attachment
}
}
function ajax_searchIdentities() {
$_searchString = trim($_REQUEST['query']);
$allIdentities = $this->preferences->getIdentity();
foreach($allIdentities as $key => $singleIdentity)
{
/*
if($singleIdentity->default === true)
{
$selectedAddresses[$singleIdentity->emailAddress] = $singleIdentity->emailAddress;
}
*/
$idString = mail_bo::generateIdentityString($singleIdentity);
$shortIDString = mail_bo::generateIdentityString($singleIdentity,false);
if (empty($_searchString) || ($_searchString && stripos($idString,$_searchString)!==false))
{
//error_log(__METHOD__.__LINE__.$idString.'<->'.$shortIDString);
$predefinedAddresses[$idString] = array(
'id'=>$idString,
'label' => $idString,
// Add just name for nice display, with title for hover
'name' => $shortIDString,
'title' => $idString
);
}
}
if (is_array($predefinedAddresses)) asort($predefinedAddresses);
header('Content-Type: application/json; charset=utf-8');
echo json_encode($predefinedAddresses);
common::egw_exit();
}
function ajax_searchFolder($_searchStringLength=2, $_returnList=false) {
static $useCacheIfPossible;
if (is_null($useCacheIfPossible)) $useCacheIfPossible = true;

View File

@ -1917,14 +1917,16 @@ unset($query['actions']);
$newSenderAddress,
$realName);
/*
$linkData = array (
'menuaction' => 'addressbook.addressbook_ui.edit',
'presets[email]' => $addressData['EMAIL'],
'presets[org_name]' => $_organisation,
'referer' => $_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING']
);
*/
$decodedPersonalName = $realName;
/*
if (!empty($decodedPersonalName)) {
if($spacePos = strrpos($decodedPersonalName, ' ')) {
$linkData['presets[n_family]'] = substr($decodedPersonalName, $spacePos+1);
@ -1934,7 +1936,6 @@ unset($query['actions']);
}
$linkData['presets[n_fn]'] = $decodedPersonalName;
}
if ($showAddToAdrdessbookLink && $GLOBALS['egw_info']['user']['apps']['addressbook']) {
$urlAddToAddressbook = $GLOBALS['egw']->link('/index.php',$linkData);
$onClick = "window.open(this,this.target,'dependent=yes,width=850,height=440,location=no,menubar=no,toolbar=no,scrollbars=yes,status=yes'); return false;";
@ -1949,6 +1950,7 @@ unset($query['actions']);
lang('add to addressbook'),
lang('add to addressbook'));
}
*/
} else {
$addrEMailORG = $addrEMail = $addressData['EMAIL'];
$addAction = egw_link::get_registry('mail','add');
@ -1963,6 +1965,7 @@ unset($query['actions']);
$link,$senderEMail);
//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
(
'menuaction' => 'addressbook.addressbook_ui.edit',
@ -1970,7 +1973,6 @@ unset($query['actions']);
'presets[org_name]' => $_organisation,
'referer' => $_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING']
);
if ($showAddToAdrdessbookLink && $GLOBALS['egw_info']['user']['apps']['addressbook']) {
$urlAddToAddressbook = $GLOBALS['egw']->link('/index.php',$linkData);
$onClick = "window.open(this,this.target, 'dependent=yes, width=850, height=440, location=no, menubar=no, toolbar=no, scrollbars=yes, status=yes'); return false;";
@ -1985,6 +1987,7 @@ unset($query['actions']);
lang('add to addressbook'),
lang('add to addressbook'));
}
*/
}
}
return $senderAddress;