version 1.5, 2003/08/27 18:20:11
|
version 1.11, 2004/09/22 15:00:04
|
Line 1
|
Line 1
|
#!/usr/bin/perl |
#!/usr/bin/perl |
$|=1; |
$|=1; |
# The LearningOnline Network with CAPA |
|
# User Status |
# User Status |
# (Versions |
# $Id$ |
# (Running loncron |
# |
# 09/06/01 Gerd Kortemeyer) |
# Copyright Michigan State University Board of Trustees |
# 02/18/02,02/19/02 Gerd Kortemeyer) |
# |
|
# 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 strict; |
use lib '/home/httpd/lib/perl/'; |
use lib '/home/httpd/lib/perl/'; |
Line 30 sub analyze_time {
|
Line 50 sub analyze_time {
|
my $userclass=$actl[0]; |
my $userclass=$actl[0]; |
if ($since>300) { $color="#222222"; } |
if ($since>300) { $color="#222222"; } |
if ($since>600) { $color="#444444"; } |
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>7200) { $color="#888888"; } |
if ($since>21600) { $color="#AAAAAA"; $userclass=$actl[2]; } |
if ($since>21600) { $color="#AAAAAA"; $userclass=$actl[2]; } |
return ($color,$userclass); |
return ($color,$userclass); |
Line 69 sub main {
|
Line 89 sub main {
|
my $sinceacc=$now-$atime; |
my $sinceacc=$now-$atime; |
unless ($oneline || $justsummary) { print ("\n\n<hr />"); } |
unless ($oneline || $justsummary) { print ("\n\n<hr />"); } |
my %userinfo; |
my %userinfo; |
my $fh=IO::File->new($$perlvar{'lonIDsDir'}.'/'.$filename); |
($userinfo{'user.name'},undef,$userinfo{'user.domain'})= |
while (my $line=<$fh>) { |
split('_',$filename); |
chomp($line); |
|
my ($name,$value)=split(/\=/,$line); |
|
$userinfo{$name}=$value; |
|
} |
|
$fh->close(); |
|
my ($color,$userclass)=&analyze_time($since); |
my ($color,$userclass)=&analyze_time($since); |
&add_count('Overall','all',$userclass); |
&add_count('Overall','all',$userclass); |
&add_count('Domain',$userinfo{'user.domain'},$userclass); |
&add_count('Domain',$userinfo{'user.domain'},$userclass); |
|
|
unless ($oneline) { |
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) { |
if (!$justsummary) { |
print '<font color="'.$color.'">'; |
print '<font color="'.$color.'">'; |
print '<h3>'.$userinfo{'environment.lastname'}.', '. |
print '<h3>'.$userinfo{'environment.lastname'}.', '. |
Line 90 sub main {
|
Line 112 sub main {
|
$userinfo{'user.name'}."\@".$userinfo{'user.domain'}. |
$userinfo{'user.name'}."\@".$userinfo{'user.domain'}. |
")</h3>\n<b>Login time:</b> ". |
")</h3>\n<b>Login time:</b> ". |
localtime($userinfo{'user.login.time'}). |
localtime($userinfo{'user.login.time'}). |
' <b>Browser</b>: '.$userinfo{'browser.type'}." <b>Client:</b> ". |
' <b>Browser</b>: '.$userinfo{'browser.type'}. |
|
" on ".$userinfo{'browser.os'}."<b>Client:</b> ". |
$userinfo{'request.host'}."<br />\n<b>Role: </b>". |
$userinfo{'request.host'}."<br />\n<b>Role: </b>". |
$userinfo{'request.role'}." "; |
$userinfo{'request.role'}." "; |
} |
} |
&add_count('Browser',$userinfo{'browser.type'},$userinfo{'browser.version'}); |
&add_count('Browser',$userinfo{'browser.type'},$userinfo{'browser.version'}); |
|
&add_count('OS',$userinfo{'browser.os'},$userinfo{'browser.type'}); |
if ($userinfo{'request.course.id'}) { |
if ($userinfo{'request.course.id'}) { |
my $cid=$userinfo{'request.course.id'}; |
my $cid=$userinfo{'request.course.id'}; |
my $coursename= $userinfo{'course.'.$cid.'.description'}. |
my $coursename= $userinfo{'course.'.$cid.'.description'}. |
Line 124 sub main {
|
Line 148 sub main {
|
&showact('Domain',%usercount); |
&showact('Domain',%usercount); |
&showact('Course',%usercount); |
&showact('Course',%usercount); |
&show('Browser',%usercount); |
&show('Browser',%usercount); |
|
&show('OS',%usercount); |
|
|
# print "\n</pre>"; |
# print "\n</pre>"; |
print "<b>Load Average:<b> ".$loadavg; |
print "<b>Load Average:<b> ".$loadavg; |
print "</body></html>"; |
print "</body></html>"; |
} else { |
} else { |
foreach (sort keys %usercount) { |
foreach my $l1 (sort keys %usercount) { |
print $_.'='.$usercount{$_}.'&'; |
foreach my $l2 (sort keys %{$usercount{$l1}}) { |
|
foreach my $l3 (sort keys %{$usercount{$l1}{$l2}}) { |
|
print $l1.'_'.$l2.'_'.$l3.'='.$usercount{$l1}{$l2}{$l3}.'&'; |
|
} |
|
} |
|
} |
|
#clusterstatus values |
|
foreach my $act (@actl) { |
|
print "$act=".$usercount{'Overall'}{'all'}{$act}.'&'; |
} |
} |
print 'loadavg='.$loadavg; |
print 'loadavg='.$loadavg; |
} |
} |