mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-31 02:21:28 +01:00
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;
|
break;
|
||||||
}
|
}
|
||||||
$rfc822 = $value;
|
$rfc822 = $value;
|
||||||
|
if (!(int)$size) $size = 22; // default size for display
|
||||||
if (is_numeric($value))
|
if (is_numeric($value))
|
||||||
{
|
{
|
||||||
$email = $GLOBALS['egw']->accounts->id2name($value,'account_email');
|
$email = $GLOBALS['egw']->accounts->id2name($value,'account_email');
|
||||||
@ -118,21 +119,17 @@ class url_widget
|
|||||||
}
|
}
|
||||||
elseif (strpos($email=$value,'@') !== false)
|
elseif (strpos($email=$value,'@') !== false)
|
||||||
{
|
{
|
||||||
if (strpos($email=$value,'&') !== false) {
|
if (strpos($email=$value,'&') !== false)
|
||||||
|
{
|
||||||
list($email,$addoptions) = explode('&',$value,2);
|
list($email,$addoptions) = explode('&',$value,2);
|
||||||
#echo $email."<br>";
|
|
||||||
$rfc822 = $value = $email;
|
$rfc822 = $value = $email;
|
||||||
}
|
}
|
||||||
// use size (if set) to show only a Part of the email, or ...
|
if (strlen($value) > $size) // shorten the name to size-2 plus '...'
|
||||||
if (!empty($size)) {
|
{
|
||||||
$value = substr($value, 0, $size).(strlen($value)>$size ? '...' : '');
|
$value = substr($value,0,$size-2).'...';
|
||||||
} else {
|
|
||||||
list($value) = explode('@',$value); // cut the domain off to get a shorter name, we show the complete email as tooltip
|
|
||||||
$value .= '@...';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$link = $this->email2link($email,$rfc822).($addoptions ? '&'.$addoptions : '');
|
$link = $this->email2link($email,$rfc822).($addoptions ? '&'.$addoptions : '');
|
||||||
#echo "<p>value='$value', email='$email', link=".print_r($link,true)."</p>\n";
|
|
||||||
|
|
||||||
$cell['type'] = 'label';
|
$cell['type'] = 'label';
|
||||||
$cell['size'] = ','.$link.',,,,'.($link[0]=='f'?'700x750':'').($value != $email ? ','.$email : '');
|
$cell['size'] = ','.$link.',,,,'.($link[0]=='f'?'700x750':'').($value != $email ? ','.$email : '');
|
||||||
@ -146,6 +143,7 @@ class url_widget
|
|||||||
// todo: (optional) validation
|
// todo: (optional) validation
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (!(int)$size) $size = 24; // default size for display
|
||||||
$cell['type'] = 'label';
|
$cell['type'] = 'label';
|
||||||
if ($value)
|
if ($value)
|
||||||
{
|
{
|
||||||
@ -157,9 +155,14 @@ class url_widget
|
|||||||
}
|
}
|
||||||
$cell['size'] = ','.$link.',,,_blank';
|
$cell['size'] = ','.$link.',,,_blank';
|
||||||
}
|
}
|
||||||
// cutting of the display in listview after 20 chars
|
if (substr($value,0,7) == 'http://')
|
||||||
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) ? '...': '');
|
$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;
|
break;
|
||||||
|
|
||||||
case 'url-phone': // options: [size[,max-size[,preg]]]
|
case 'url-phone': // options: [size[,max-size[,preg]]]
|
||||||
|
Loading…
Reference in New Issue
Block a user