forked from extern/egroupware
reworked the size limitation for displaying email or url again a bit
This commit is contained in:
parent
23f038f74a
commit
c1c52cf797
@ -105,6 +105,7 @@ class url_widget
|
||||
break;
|
||||
}
|
||||
$rfc822 = $value;
|
||||
if (!(int)$size) $size = 22; // default size for display
|
||||
if (is_numeric($value))
|
||||
{
|
||||
$email = $GLOBALS['egw']->accounts->id2name($value,'account_email');
|
||||
@ -118,21 +119,17 @@ class url_widget
|
||||
}
|
||||
elseif (strpos($email=$value,'@') !== false)
|
||||
{
|
||||
if (strpos($email=$value,'&') !== false) {
|
||||
if (strpos($email=$value,'&') !== false)
|
||||
{
|
||||
list($email,$addoptions) = explode('&',$value,2);
|
||||
#echo $email."<br>";
|
||||
$rfc822 = $value = $email;
|
||||
}
|
||||
// use size (if set) to show only a Part of the email, or ...
|
||||
if (!empty($size)) {
|
||||
$value = substr($value, 0, $size).(strlen($value)>$size ? '...' : '');
|
||||
} else {
|
||||
list($value) = explode('@',$value); // cut the domain off to get a shorter name, we show the complete email as tooltip
|
||||
$value .= '@...';
|
||||
if (strlen($value) > $size) // shorten the name to size-2 plus '...'
|
||||
{
|
||||
$value = substr($value,0,$size-2).'...';
|
||||
}
|
||||
}
|
||||
$link = $this->email2link($email,$rfc822).($addoptions ? '&'.$addoptions : '');
|
||||
#echo "<p>value='$value', email='$email', link=".print_r($link,true)."</p>\n";
|
||||
|
||||
$cell['type'] = 'label';
|
||||
$cell['size'] = ','.$link.',,,,'.($link[0]=='f'?'700x750':'').($value != $email ? ','.$email : '');
|
||||
@ -146,6 +143,7 @@ class url_widget
|
||||
// todo: (optional) validation
|
||||
break;
|
||||
}
|
||||
if (!(int)$size) $size = 24; // default size for display
|
||||
$cell['type'] = 'label';
|
||||
if ($value)
|
||||
{
|
||||
@ -157,9 +155,14 @@ class url_widget
|
||||
}
|
||||
$cell['size'] = ','.$link.',,,_blank';
|
||||
}
|
||||
// cutting of the display in listview after 20 chars
|
||||
if (substr($value,0,7) == 'http://') $value = substr($value,7,($size ? $size : 20)).(strlen($value)> ($size ? $size+7 : 27) ? '...': ''); // cut off http:// in display
|
||||
else $value = substr($value,0, ($size ? $size : 20)).(strlen($value)> ($size ? $size : 20) ? '...': '');
|
||||
if (substr($value,0,7) == 'http://')
|
||||
{
|
||||
$value = substr($value,7); // cut off http:// in display
|
||||
}
|
||||
if (strlen($value) > $size) // shorten the name to size-2 plus '...'
|
||||
{
|
||||
$value = substr($value,0,$size-2).'...';
|
||||
}
|
||||
break;
|
||||
|
||||
case 'url-phone': // options: [size[,max-size[,preg]]]
|
||||
|
Loading…
Reference in New Issue
Block a user