diff --git a/etemplate/inc/class.customfields_widget.inc.php b/etemplate/inc/class.customfields_widget.inc.php index b6c0e1b271..a986d6ae0b 100644 --- a/etemplate/inc/class.customfields_widget.inc.php +++ b/etemplate/inc/class.customfields_widget.inc.php @@ -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; diff --git a/etemplate/inc/class.url_widget.inc.php b/etemplate/inc/class.url_widget.inc.php index 18a51cd2bf..c147873954 100644 --- a/etemplate/inc/class.url_widget.inc.php +++ b/etemplate/inc/class.url_widget.inc.php @@ -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."
"; + $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 "

value='$value', email='$email', link=".print_r($link,true)."

\n"; + $link = $this->email2link($email,$rfc822).($addoptions ? '&'.$addoptions : ''); + #echo "

value='$value', email='$email', link=".print_r($link,true)."

\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';