[LON-CAPA-cvs] cvs: loncom /interface loncommon.pm

albertel lon-capa-cvs@mail.lon-capa.org
Wed, 15 Sep 2004 06:11:40 -0000


albertel		Wed Sep 15 02:11:40 2004 EDT

  Modified files:              
    /loncom/interface	loncommon.pm 
  Log:
  - speed up kick why go do a get if we already have it
  
  
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.211 loncom/interface/loncommon.pm:1.212
--- loncom/interface/loncommon.pm:1.211	Fri Sep 10 04:42:21 2004
+++ loncom/interface/loncommon.pm	Wed Sep 15 02:11:40 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.211 2004/09/10 08:42:21 www Exp $
+# $Id: loncommon.pm,v 1.212 2004/09/15 06:11:40 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1765,8 +1765,19 @@
 
 sub nickname {
     my ($uname,$udom)=@_;
-    my %names=&Apache::lonnet::get('environment',
-  ['nickname','firstname','middlename','lastname','generation'],$udom,$uname);
+    my %names;
+    if ($uname eq $ENV{'user.name'} &&
+	$udom eq $ENV{'user.domain'}) {
+	%names=('nickname'   => $ENV{'environment.nickname'}  ,
+		'firstname'  => $ENV{'environment.firstname'} ,
+		'middlename' => $ENV{'environment.middlename'},
+		'lastname'   => $ENV{'environment.lastname'}  ,
+		'generation' => $ENV{'environment.generation'});
+    } else {
+	%names=&Apache::lonnet::get('environment',
+				    ['nickname','firstname','middlename',
+				     'lastname','generation'],$udom,$uname);
+    }
     my $name=$names{'nickname'};
     if ($name) {
        $name='"'.$name.'"'; 
@@ -1792,11 +1803,13 @@
 
 sub screenname {
     my ($uname,$udom)=@_;
-    my %names=
- &Apache::lonnet::get('environment',['screenname'],$udom,$uname);
+    if ($uname eq $ENV{'user.name'} &&
+	$udom eq $ENV{'user.domain'}) {return $ENV{'environment.screenname'};}
+    my %names=&Apache::lonnet::get('environment',['screenname'],$udom,$uname);
     return $names{'screenname'};
 }
 
+
 # ------------------------------------------------------------- Message Wrapper
 
 sub messagewrapper {