diff --git a/addressbook/inc/class.uiaddressbook.inc.php b/addressbook/inc/class.uiaddressbook.inc.php index e2d954c50c..fbe8832e27 100644 --- a/addressbook/inc/class.uiaddressbook.inc.php +++ b/addressbook/inc/class.uiaddressbook.inc.php @@ -548,8 +548,6 @@ $myowner = $entries[$i]['owner']; /* each entry column */ -// @reset($columns_to_display); -// while($column = @each($columns_to_display)) foreach($columns_to_display as $column => $nul) { $ref = $data=''; @@ -562,32 +560,16 @@ { $coldata = 'http://' . $coldata; } - $ref=''; + $ref=''; $data=$coldata.''; } - elseif(($column == 'email') || ($column == 'email_home')) + elseif(($column == 'email' || $column == 'email_home') && strstr($coldata,'@')) { - if($GLOBALS['egw_info']['user']['apps']['email']) - { - $ref = ''; - } - elseif($GLOBALS['egw_info']['user']['apps']['felamimail']) - { - $link_data = array( - 'menuaction' => 'felamimail.uicompose.compose', - 'send_to' => base64_encode($coldata) - ); - $ref = ''; - } - else - { - $ref = ''; - } - $data = $coldata . ''; + $link = $this->email2link($coldata); + if (is_array($link)) $link = $GLOBALS['egw']->link('/index.php',$link); + + $ref = ''; + $data = $coldata.''; } else /* But these do not */ { @@ -646,6 +628,33 @@ /* $GLOBALS['egw']->common->phpgw_footer(); */ } + /** + * convert email-address in compose link + * + * @param string $email email-addresse + * @return array/string array with get-params or mailto:$email, or '' or no mail addresse + */ + function email2link($email) + { + if (!strstr($email,'@')) return ''; + + if($GLOBALS['egw_info']['user']['apps']['felamimail']) + { + return array( + 'menuaction' => 'felamimail.uicompose.compose', + 'send_to' => base64_encode($email) + ); + } + if($GLOBALS['egw_info']['user']['apps']['email']) + { + return array( + 'menuaction' => 'email.uicompose.compose', + 'to' => $email, + ); + } + return 'mailto:' . $email; + } + function add_email() { $name = $_POST['name'] ? $_POST['name'] : $_GET['name']; diff --git a/addressbook/inc/class.uicontacts.inc.php b/addressbook/inc/class.uicontacts.inc.php index 184f1c5642..d43199a4fe 100644 --- a/addressbook/inc/class.uicontacts.inc.php +++ b/addressbook/inc/class.uicontacts.inc.php @@ -196,6 +196,24 @@ class uicontacts extends bocontacts $readonlys['button[edit]'] = !$this->check_perms(EGW_ACL_EDIT,$content); $this->tmpl->read('addressbook.edit'); + foreach(array('email','email_home','url') as $name) + { + if ($content[$name] ) + { + $url = $name == 'url' ? $content[$name] : $this->email2link($content[$name]); + if (!is_array($url)) + { + $this->tmpl->set_cell_attribute($name,'size','b,,1'); + } + elseif ($url) + { + $content[$name.'_link'] = $url; + $this->tmpl->set_cell_attribute($name,'size','b,@'.$name.'_link,,,_blank'); + } + $this->tmpl->set_cell_attribute($name,'type','label'); + $this->tmpl->set_cell_attribute($name,'no_lang',true); + } + } $this->tmpl->exec('addressbook.uicontacts.view',$content,$sel_options,$readonlys,array('id' => $content['id'])); $GLOBALS['egw']->hooks->process(array( @@ -204,6 +222,33 @@ class uicontacts extends bocontacts )); } + /** + * convert email-address in compose link + * + * @param string $email email-addresse + * @return array/string array with get-params or mailto:$email, or '' or no mail addresse + */ + function email2link($email) + { + if (!strstr($email,'@')) return ''; + + if($GLOBALS['egw_info']['user']['apps']['felamimail']) + { + return array( + 'menuaction' => 'felamimail.uicompose.compose', + 'send_to' => base64_encode($email) + ); + } + if($GLOBALS['egw_info']['user']['apps']['email']) + { + return array( + 'menuaction' => 'email.uicompose.compose', + 'to' => $email, + ); + } + return 'mailto:' . $email; + } + function search($content='') { $GLOBALS['egw_info']['flags']['app_header'] = lang('Addressbook'). ' - '. lang('Advanced search');