[LON-CAPA-cvs] cvs: loncom /cgi userstatus.pl

albertel lon-capa-cvs@mail.lon-capa.org
Wed, 22 Sep 2004 15:00:05 -0000


albertel		Wed Sep 22 11:00:05 2004 EDT

  Modified files:              
    /loncom/cgi	userstatus.pl 
  Log:
  - make simple mode faster
  
  
Index: loncom/cgi/userstatus.pl
diff -u loncom/cgi/userstatus.pl:1.10 loncom/cgi/userstatus.pl:1.11
--- loncom/cgi/userstatus.pl:1.10	Tue Jan 13 20:42:09 2004
+++ loncom/cgi/userstatus.pl	Wed Sep 22 11:00:04 2004
@@ -1,7 +1,7 @@
 #!/usr/bin/perl
 $|=1;
 # User Status
-# $Id: userstatus.pl,v 1.10 2004/01/14 01:42:09 albertel Exp $
+# $Id: userstatus.pl,v 1.11 2004/09/22 15:00:04 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -89,18 +89,20 @@
 	my $sinceacc=$now-$atime;
 	unless ($oneline || $justsummary) { print ("\n\n<hr />"); }
 	my %userinfo;
-	my $fh=IO::File->new($$perlvar{'lonIDsDir'}.'/'.$filename);
-	while (my $line=<$fh>) {
-	    chomp($line);
-	    my ($name,$value)=split(/\=/,$line);
-	    $userinfo{$name}=$value;
-	}
-	$fh->close();
+	($userinfo{'user.name'},undef,$userinfo{'user.domain'})=
+	    split('_',$filename);
 	my ($color,$userclass)=&analyze_time($since);
 	&add_count('Overall','all',$userclass);
 	&add_count('Domain',$userinfo{'user.domain'},$userclass);
 	
 	unless ($oneline) {
+	    my $fh=IO::File->new($$perlvar{'lonIDsDir'}.'/'.$filename);
+	    while (my $line=<$fh>) {
+		chomp($line);
+		my ($name,$value)=split(/\=/,$line);
+		$userinfo{$name}=$value;
+	    }
+	    $fh->close();
 	    if (!$justsummary) {
 		print '<font color="'.$color.'">';
 		print '<h3>'.$userinfo{'environment.lastname'}.', '.