--- loncom/cgi/userstatus.pl 2003/08/27 20:35:24 1.6 +++ loncom/cgi/userstatus.pl 2021/03/06 19:09:03 1.22 @@ -1,36 +1,57 @@ #!/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.22 2021/03/06 19:09:03 raeburn 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 Apache::lonlocal; use LONCAPA::Configuration; - +use LONCAPA::loncgi; +use LONCAPA::lonauthcgi; use HTTP::Headers; -use IO::File; +use GDBM_File; +# -------------------- Read loncapa.conf (and by default, loncapa_apache.conf). +my $perlvar=&LONCAPA::Configuration::read_conf('loncapa.conf'); +print "Content-type: text/html\n\n"; my %usercount; my @actl=('Active','Moderately Active','Inactive'); - -print "Content-type: text/html\n\n"; - -# -------------------- Read loncapa.conf (and by default, loncapa_apache.conf). -&main(); +&main($perlvar); sub analyze_time { my ($since)=@_; my $color="#000000"; my $userclass=$actl[0]; - if ($since>300) { $color="#222222"; } + if ($since>300) { $color="#222222"; $userclass=$actl[1]; } if ($since>600) { $color="#444444"; } - if ($since>3600) { $color="#666666"; $userclass=$actl[1]; } + if ($since>1800) { $color="#666666"; } if ($since>7200) { $color="#888888"; } if ($since>21600) { $color="#AAAAAA"; $userclass=$actl[2]; } return ($color,$userclass); @@ -48,18 +69,76 @@ sub add_count { } sub main { - my $perlvar=LONCAPA::Configuration::read_conf('loncapa.conf'); + my ($perlvar) = @_; delete $$perlvar{'lonReceipt'}; # remove since sensitive and not needed delete $$perlvar{'lonSqlAccess'}; # remove since sensitive and not needed - my $oneline=($ENV{'QUERY_STRING'} eq 'simple'); - my $justsummary=($ENV{'QUERY_STRING'} eq 'summary'); - unless ($oneline) { print "
\n$filename
". + "$lt{'login'}: ". + &Apache::lonlocal::locallocaltime($userinfo{'user.login.time'}). + " $lt{'Browser'}: ".$userinfo{'browser.type'}. + " $lt{'on'} ".$userinfo{'browser.os'}." $lt{'Client'}:". + $userinfo{'request.host'}."\n"; - &showact('Overall',%usercount); - &showact('Domain',%usercount); - &showact('Course',%usercount); - &show('Browser',%usercount); + &showact('Overall',\%lt,%usercount); + &showact('Domain',\%lt,%usercount); + &showact('Course',\%lt,%usercount); + &show('Browser',\%lt,%usercount); + &show('OS',\%lt,%usercount); # print "\n"; - print "Load Average: ".$loadavg; + print "$lt{'load'}: ".$loadavg; print ""; } else { foreach my $l1 (sort keys %usercount) { @@ -145,8 +246,8 @@ sub main { } sub show { - my ($cat,%usercount)=@_; - print("
$type | "); print(join(" | ",sort(keys(%{$usercount{$cat}{$type}}))));
@@ -163,11 +264,11 @@ sub show {
}
sub showact {
- my ($cat,%usercount)=@_;
- print("$cat\n"); + my ($cat,$ltref,%usercount)=@_; + print("$ltref->{$cat}\n"); - print("
|
---|