Index: openacs-4/contrib/packages/project-manager/tcl/project-manager-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/project-manager/tcl/Attic/project-manager-procs.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/contrib/packages/project-manager/tcl/project-manager-procs.tcl 12 Mar 2004 13:44:43 -0000 1.2 +++ openacs-4/contrib/packages/project-manager/tcl/project-manager-procs.tcl 27 Apr 2004 00:49:28 -0000 1.3 @@ -20,9 +20,42 @@ } { Extended nvl, for dates only } { - if { [string equal $value "{} {} {} {} {} {}"]} { + if {[string equal $value "{} {} {} {} {} {}"] \ + || [empty_string_p $value]} { return $value_if_null } else { return $value_if_not_null } } + + +ad_proc -public pm::util::string_truncate_and_pad { + -length + {-ellipsis "..."} + -string +} { + Truncates a string to a given length, or pads it to match a given length + + @author Jade Rubick (jader@bread.com) + @creation-date 2004-04-14 + + @param length + + @param ellipsis + + @param string + + @return + + @error +} { + + set new_string [string_truncate -len $length -ellipsis $ellipsis -- $string] + set new_string_length [string length $new_string] + + if {$new_string_length < $length} { + set new_string "$new_string[string repeat " " [expr $length - $new_string_length]]" + } + + return $new_string +}