--- loncom/interface/loncommon.pm 2002/09/09 11:50:07 1.65 +++ loncom/interface/loncommon.pm 2002/09/13 20:46:09 1.67 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.65 2002/09/09 11:50:07 matthew Exp $ +# $Id: loncommon.pm,v 1.67 2002/09/13 20:46:09 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -974,13 +974,33 @@ sub plainname { return $name; } +# -------------------------------------------------------------------- Nickname + + +sub nickname { + my ($uname,$udom)=@_; + my %names=&Apache::lonnet::get('environment', + ['nickname','firstname','middlename','lastname','generation'],$udom,$uname); + my $name=&Apache::lonnet::unescape($names{'nickname'}); + if ($name) { + $name='"'.$name.'"'; + } else { + $name=$names{'firstname'}.' '.$names{'middlename'}.' '. + $names{'lastname'}.' '.$names{'generation'}; + $name=~s/\s+$//; + $name=~s/\s+/ /g; + } + return $name; +} + + # ------------------------------------------------------------------ Screenname sub screenname { my ($uname,$udom)=@_; my %names= &Apache::lonnet::get('environment',['screenname'],$udom,$uname); - return $names{'screenname'}; + return &Apache::lonnet::unescape($names{'screenname'}); } # ------------------------------------------------------------- Message Wrapper