From 6950fb0cc9c2f49b8858dfaa7396e3c21b8cc82b Mon Sep 17 00:00:00 2001 From: Klaus Leithoff Date: Mon, 7 Oct 2013 16:33:56 +0000 Subject: [PATCH] fix id behavior for identities in compose, introduced long ago when trying to utilize taglist --- mail/inc/class.mail_compose.inc.php | 40 +++++------------------------ mail/inc/class.mail_ui.inc.php | 9 ++++--- 2 files changed, 12 insertions(+), 37 deletions(-) diff --git a/mail/inc/class.mail_compose.inc.php b/mail/inc/class.mail_compose.inc.php index d6238f6e62..e4449fc2da 100644 --- a/mail/inc/class.mail_compose.inc.php +++ b/mail/inc/class.mail_compose.inc.php @@ -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; diff --git a/mail/inc/class.mail_ui.inc.php b/mail/inc/class.mail_ui.inc.php index 0c18443aee..5b163eafc2 100644 --- a/mail/inc/class.mail_ui.inc.php +++ b/mail/inc/class.mail_ui.inc.php @@ -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;