--- loncom/lonnet/perl/lonnet.pm 2003/08/22 16:24:45 1.398.2.1.2.1 +++ loncom/lonnet/perl/lonnet.pm 2003/08/12 19:46:04 1.399 @@ -1,7 +1,7 @@ # The LearningOnline Network # TCP networking package # -# $Id: lonnet.pm,v 1.398.2.1.2.1 2003/08/22 16:24:45 albertel Exp $ +# $Id: lonnet.pm,v 1.399 2003/08/12 19:46:04 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -377,8 +377,8 @@ sub userload { my $curtime=time; while ($filename=readdir(LONIDS)) { if ($filename eq '.' || $filename eq '..') {next;} - my ($mtime)=(stat($perlvar{'lonIDsDir'}.'/'.$filename))[9]; - if ($curtime-$mtime < 3600) { $numusers++; } + my ($atime)=(stat($perlvar{'lonIDsDir'}.'/'.$filename))[8]; + if ($curtime-$atime < 3600) { $numusers++; } } closedir(LONIDS); } @@ -1284,6 +1284,34 @@ sub get_course_adv_roles { return %returnhash; } +# ----------------------------------------------------- Frontpage Announcements +# +# + +sub postannounce { + my ($server,$text)=@_; + unless (&allowed('psa',$hostdom{$server})) { return 'refused'; } + unless ($text=~/\w/) { $text=''; } + return &reply('setannounce:'.&escape($text),$server); +} + +sub getannounce { + if (my $fh=Apache::File->new($perlvar{'lonDocRoot'}.'/announcement.txt')) { + my $announcement=''; + while (<$fh>) { $announcement .=$_; } + $fh->close(); + if ($announcement=~/\w/) { + return + '
'.$announcement.' |