--- loncom/cgi/userstatus.pl 2003/02/26 14:10:38 1.2
+++ loncom/cgi/userstatus.pl 2003/07/29 20:17:52 1.3
@@ -14,8 +14,8 @@ use HTTP::Headers;
use IO::File;
-print "Content-type: text/html\n\n".
- "
\n";
+print "Content-type: text/html\n\n";
+
# -------------------- Read loncapa.conf (and by default, loncapa_apache.conf).
my $perlvarref=LONCAPA::Configuration::read_conf('loncapa.conf');
my %perlvar=%{$perlvarref};
@@ -23,7 +23,8 @@ undef $perlvarref; # remove since sensit
delete $perlvar{'lonReceipt'}; # remove since sensitive and not needed
delete $perlvar{'lonSqlAccess'}; # remove since sensitive and not needed
-print "User Status ".localtime()."
";
+my $oneline=($ENV{'QUERY_STRING'} eq 'simple');
+unless ($oneline) { print "\nUser Status ".localtime()."
"; }
my $filename;
opendir(DIR,$perlvar{'lonIDsDir'});
@@ -37,7 +38,7 @@ while ($filename=readdir(DIR)) {
$now=time;
$since=$now-$mtime;
$sinceacc=$now-$atime;
- print ("\n\n
");
+ unless ($oneline) { print ("\n\n
"); }
my %userinfo=();
undef $userinfo;
my $fh=IO::File->new($perlvar{'lonIDsDir'}.'/'.$filename);
@@ -56,6 +57,7 @@ while ($filename=readdir(DIR)) {
if ($since>21600) { $color="#AAAAAA"; $userclass="Inactive"; }
$usercount{$userclass}++;
$usercount{'in Domain '.$userinfo{'user.domain'}}++;
+ unless ($oneline) {
print '';
print ''.$userinfo{'environment.lastname'}.', '.
$userinfo{'environment.firstname'}.' '.
@@ -80,13 +82,19 @@ while ($filename=readdir(DIR)) {
print "
Last Transaction: ".localtime($mtime).
" (".$since." secs ago)
Last Access: ".localtime($atime).
" (".$sinceacc." secs ago)";
- print ("
");
+ print ("");
+ }
}
}
closedir(DIR);
+unless ($oneline) {
print "
User Count
";
foreach (sort keys %usercount) {
print "".$_.": ".$usercount{$_}."
";
}
-
print "";
+} else {
+foreach (sort keys %usercount) {
+ print $_.'='.$usercount{$_}.'&';
+}
+}