- activating email(_home) and url in view

- using felamimail as default over email
This commit is contained in:
Ralf Becker 2005-11-18 17:03:23 +00:00
parent e43a0ddf3f
commit 2ea764e672
2 changed files with 79 additions and 25 deletions

View File

@ -548,8 +548,6 @@
$myowner = $entries[$i]['owner']; $myowner = $entries[$i]['owner'];
/* each entry column */ /* each entry column */
// @reset($columns_to_display);
// while($column = @each($columns_to_display))
foreach($columns_to_display as $column => $nul) foreach($columns_to_display as $column => $nul)
{ {
$ref = $data=''; $ref = $data='';
@ -562,31 +560,15 @@
{ {
$coldata = 'http://' . $coldata; $coldata = 'http://' . $coldata;
} }
$ref='<a href="'.$coldata.'" target="_new">'; $ref='<a href="'.$coldata.'" target="_blank">';
$data=$coldata.'</a>'; $data=$coldata.'</a>';
} }
elseif(($column == 'email') || ($column == 'email_home')) elseif(($column == 'email' || $column == 'email_home') && strstr($coldata,'@'))
{ {
if($GLOBALS['egw_info']['user']['apps']['email']) $link = $this->email2link($coldata);
{ if (is_array($link)) $link = $GLOBALS['egw']->link('/index.php',$link);
$ref = '<a href="'
. $GLOBALS['egw']->link('/email/compose.php','to=' . urlencode($coldata)) $ref = '<a href="'.htmlspecialchars($link).'" target="_blank">';
. '" target="_new">';
}
elseif($GLOBALS['egw_info']['user']['apps']['felamimail'])
{
$link_data = array(
'menuaction' => 'felamimail.uicompose.compose',
'send_to' => base64_encode($coldata)
);
$ref = '<a href="'
. $GLOBALS['egw']->link('/index.php',$link_data)
. '" target="_new">';
}
else
{
$ref = '<a href="mailto:' . $coldata . '">';
}
$data = $coldata.'</a>'; $data = $coldata.'</a>';
} }
else /* But these do not */ else /* But these do not */
@ -646,6 +628,33 @@
/* $GLOBALS['egw']->common->phpgw_footer(); */ /* $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() function add_email()
{ {
$name = $_POST['name'] ? $_POST['name'] : $_GET['name']; $name = $_POST['name'] ? $_POST['name'] : $_GET['name'];

View File

@ -196,6 +196,24 @@ class uicontacts extends bocontacts
$readonlys['button[edit]'] = !$this->check_perms(EGW_ACL_EDIT,$content); $readonlys['button[edit]'] = !$this->check_perms(EGW_ACL_EDIT,$content);
$this->tmpl->read('addressbook.edit'); $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'])); $this->tmpl->exec('addressbook.uicontacts.view',$content,$sel_options,$readonlys,array('id' => $content['id']));
$GLOBALS['egw']->hooks->process(array( $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='') function search($content='')
{ {
$GLOBALS['egw_info']['flags']['app_header'] = lang('Addressbook'). ' - '. lang('Advanced search'); $GLOBALS['egw_info']['flags']['app_header'] = lang('Addressbook'). ' - '. lang('Advanced search');