mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-08 00:54:50 +01:00
# support for size options in url customfield
# support for size options in url-phone customfield # support for size options in url-email customfield # allowing additional parameters to be passed to the link created from the url-email
This commit is contained in:
parent
f4d11dc778
commit
7921ef5767
@ -322,9 +322,27 @@ class customfields_widget
|
||||
unset($widget);
|
||||
}
|
||||
break;
|
||||
case 'url': // other etemplate types, which are used just as is
|
||||
case 'url-email':
|
||||
list($max,$shown,$validation_type,$default) = explode(',',$field['len'],4);
|
||||
if (empty($max)) $max =128;
|
||||
if (empty($shown)) $shown = 28;
|
||||
if (empty($validation_type)) $validation_type = 1;
|
||||
$field['len'] = implode(',',array($shown, $max, $validation_type, $default));
|
||||
$input =& etemplate::empty_cell($field['type'],$this->prefix.$lname,array(
|
||||
'size' => $field['len']
|
||||
));
|
||||
break;
|
||||
case 'url':
|
||||
case 'url-phone':
|
||||
list($max,$shown,$validation_type) = explode(',',$field['len'],3);
|
||||
if (empty($max)) $max =128;
|
||||
if (empty($shown)) $shown = 28;
|
||||
$field['len']=implode(',',array( $shown, $max, $validation_type));
|
||||
$input =& etemplate::empty_cell($field['type'],$this->prefix.$lname,array(
|
||||
'size' => $field['len']
|
||||
));
|
||||
break;
|
||||
// other etemplate types, which are used just as is
|
||||
case 'checkbox' :
|
||||
$input =& etemplate::empty_cell($field['type'],$this->prefix.$lname);
|
||||
break;
|
||||
|
@ -100,8 +100,8 @@ class url_widget
|
||||
$cell['size'] .= '|[^<]+ ?<'.self::EMAIL_PREG.'>';
|
||||
}
|
||||
$cell['size'] .= ')$/i';
|
||||
}
|
||||
//_debug_array($cell);
|
||||
}
|
||||
#_debug_array($cell);
|
||||
break;
|
||||
}
|
||||
$rfc822 = $value;
|
||||
@ -118,17 +118,28 @@ class url_widget
|
||||
}
|
||||
elseif (strpos($email=$value,'@') !== false)
|
||||
{
|
||||
list($value) = explode('@',$value); // cut the domain off to get a shorter name, we show the complete email as tooltip
|
||||
$value .= '@...';
|
||||
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 .= '@...';
|
||||
}
|
||||
}
|
||||
$link = $this->email2link($email,$rfc822);
|
||||
//echo "<p>value='$value', email='$email', link=".print_r($link,true)."</p>\n";
|
||||
$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 : '');
|
||||
break;
|
||||
|
||||
case 'url': // options: [size[,max-size[,preg]]]
|
||||
list($size,$max_size,$preg) = explode(',',$cell['size'],3); // 3 = allow default to contain commas
|
||||
if (!$readonly)
|
||||
{
|
||||
$cell['type'] = 'text';
|
||||
@ -146,10 +157,13 @@ class url_widget
|
||||
}
|
||||
$cell['size'] = ','.$link.',,,_blank';
|
||||
}
|
||||
if (substr($value,0,7) == 'http://') $value = substr($value,7); // cut off http:// in display
|
||||
// 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) ? '...': '');
|
||||
break;
|
||||
|
||||
case 'url-phone': // options: [size[,max-size[,preg]]]
|
||||
list($size,$max_size,$preg) = explode(',',$cell['size'],3); // 3 = allow default to contain commas
|
||||
if (!$readonly)
|
||||
{
|
||||
$cell['type'] = 'text';
|
||||
|
Loading…
Reference in New Issue
Block a user