--- loncom/cgi/userstatus.pl 2003/08/27 20:35:24 1.6 +++ loncom/cgi/userstatus.pl 2006/06/02 21:36:21 1.13 @@ -1,16 +1,36 @@ #!/usr/bin/perl $|=1; -# The LearningOnline Network with CAPA # User Status -# (Versions -# (Running loncron -# 09/06/01 Gerd Kortemeyer) -# 02/18/02,02/19/02 Gerd Kortemeyer) +# $Id: userstatus.pl,v 1.13 2006/06/02 21:36:21 albertel Exp $ +# +# Copyright Michigan State University Board of Trustees +# +# This file is part of the LearningOnline Network with CAPA (LON-CAPA). +# +# LON-CAPA is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# LON-CAPA is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LON-CAPA; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# /home/httpd/html/adm/gpl.txt +# +# http://www.lon-capa.org/ +# + use strict; use lib '/home/httpd/lib/perl/'; use LONCAPA::Configuration; - +use LONCAPA; use HTTP::Headers; use IO::File; @@ -30,7 +50,7 @@ sub analyze_time { my $userclass=$actl[0]; if ($since>300) { $color="#222222"; } if ($since>600) { $color="#444444"; } - if ($since>3600) { $color="#666666"; $userclass=$actl[1]; } + if ($since>1800) { $color="#666666"; $userclass=$actl[1]; } if ($since>7200) { $color="#888888"; } if ($since>21600) { $color="#AAAAAA"; $userclass=$actl[2]; } return ($color,$userclass); @@ -60,6 +80,7 @@ sub main { my @allfiles=(sort(readdir(DIR))); foreach my $filename (@allfiles) { if ($filename=~/^\./) { next; } + if ($filename=~/^publicuser_/) { next; } my ($dev,$ino,$mode,$nlink, $uid,$gid,$rdev,$size, $atime,$mtime,$ctime, @@ -69,18 +90,22 @@ sub main { my $sinceacc=$now-$atime; unless ($oneline || $justsummary) { print ("\n\n
"); } 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); + $name = &unescape($name); + $value = &unescape($value); + $userinfo{$name}=$value; + } + $fh->close(); if (!$justsummary) { print ''; print '

'.$userinfo{'environment.lastname'}.', '. @@ -90,11 +115,13 @@ sub main { $userinfo{'user.name'}."\@".$userinfo{'user.domain'}. ")

\nLogin time: ". localtime($userinfo{'user.login.time'}). - ' Browser: '.$userinfo{'browser.type'}." Client: ". + ' Browser: '.$userinfo{'browser.type'}. + " on ".$userinfo{'browser.os'}."Client: ". $userinfo{'request.host'}."
\nRole: ". $userinfo{'request.role'}." "; } &add_count('Browser',$userinfo{'browser.type'},$userinfo{'browser.version'}); + &add_count('OS',$userinfo{'browser.os'},$userinfo{'browser.type'}); if ($userinfo{'request.course.id'}) { my $cid=$userinfo{'request.course.id'}; my $coursename= $userinfo{'course.'.$cid.'.description'}. @@ -124,6 +151,7 @@ sub main { &showact('Domain',%usercount); &showact('Course',%usercount); &show('Browser',%usercount); + &show('OS',%usercount); # print "\n"; print "Load Average: ".$loadavg;