version 1.8, 2003/03/28 23:16:25
|
version 1.10, 2003/06/23 19:59:54
|
Line 57 sub handler {
|
Line 57 sub handler {
|
my @entries=split(/\:/, |
my @entries=split(/\:/, |
&Apache::lonnet::reply( |
&Apache::lonnet::reply( |
"chatretr:$cdom:$cnum:$ENV{'user.domain'}:$ENV{'user.name'}",$chome)); |
"chatretr:$cdom:$cnum:$ENV{'user.domain'}:$ENV{'user.name'}",$chome)); |
my ($lastid)=($entries[$#entries]=~/^(\w+)/); |
# Figure out what the last valid entry-id is |
my ($thentime,$idnum)=split(/\_/,$lastid); |
my ($lastid,$thentime,$idnum); |
|
foreach (@entries) { |
|
$_=~/^(\w+)/; |
|
if ($1 ne 'active_participant') { |
|
$lastid=$1; |
|
($thentime,$idnum)=split(/\_/,$lastid); |
|
} |
|
} |
# ----------------------------------------------------------- Can see identity? |
# ----------------------------------------------------------- Can see identity? |
my $crs='/'.$ENV{'request.course.id'}; |
my $crs='/'.$ENV{'request.course.id'}; |
if ($ENV{'request.course.sec'}) { |
if ($ENV{'request.course.sec'}) { |
Line 75 sub handler {
|
Line 82 sub handler {
|
$include=1; |
$include=1; |
$newstuff='<html><body bgcolor="#FFFFFF">'; |
$newstuff='<html><body bgcolor="#FFFFFF">'; |
} |
} |
|
my @participants=(); |
foreach (@entries) { |
foreach (@entries) { |
if ($include) { |
my ($id,$msg,$udom)=split(/\:/,&Apache::lonnet::unescape($_)); |
my ($id,$msg,$uname)=split(/\:/,&Apache::lonnet::unescape($_)); |
if ($id eq 'active_participant') { |
if ($id eq 'active_participant') { |
chomp($udom); |
# $newstuff.='participant: '.$msg.' '.$uname; |
$participants[$#participants+1]= |
} else { |
&Apache::loncommon::nickname($msg,$udom); |
chomp($msg); |
} elsif ($include) { |
my ($msgtime,$msgnum)=split(/\_/,$id); |
chomp($msg); |
my ($sdom,$snum,$anon,$contrib)=split(/\:/, |
my ($msgtime,$msgnum)=split(/\_/,$id); |
&Apache::lonnet::unescape($msg)); |
my ($sdom,$snum,$anon,$contrib)=split(/\:/, |
$contrib=&Apache::lonnet::unescape($contrib); |
&Apache::lonnet::unescape($msg)); |
$contrib=~s/\n/\<br \/\>/g; |
$contrib=&Apache::lonnet::unescape($contrib); |
$contrib=&Apache::lontexconvert::msgtexconverted($contrib); |
$contrib=~s/\n/\<br \/\>/g; |
$contrib=~s/\n/ /g; |
$contrib=&Apache::lontexconvert::msgtexconverted($contrib); |
$contrib=~s/\'/\&\#39\;/g; |
$contrib=~s/\n/ /g; |
my $sender=''; |
$contrib=~s/\'/\&\#39\;/g; |
if ($seeid) { |
my $sender=''; |
$sender=&Apache::loncommon::plainname($snum,$sdom); |
if ($seeid) { |
my $nick=&Apache::loncommon::nickname($snum,$sdom); |
$sender=&Apache::loncommon::plainname($snum,$sdom); |
if (($nick) && ($nick ne $sender)) { |
my $nick=&Apache::loncommon::nickname($snum,$sdom); |
$sender.=' '.$nick; |
if (($nick) && ($nick ne $sender)) { |
} |
$sender.=' '.$nick; |
if ($anon) { $sender.=' [Anon]' }; |
|
} elsif (!$anon) { |
|
$sender=&Apache::loncommon::nickname($snum,$sdom); |
|
} else { |
|
$sender=&Apache::loncommon::screenname($snum,$sdom); |
|
unless ($sender) { $sender="Anonymous"; } |
|
} |
} |
$sender=~s/\'/\"/g; |
if ($anon) { $sender.=' [Anon]' }; |
my $color=$sender; |
} elsif (!$anon) { |
$color=~tr/a-j/0-9/; |
$sender=&Apache::loncommon::nickname($snum,$sdom); |
$color=~tr/A-J/0-9/; |
} else { |
$color=~tr/k-t/0-9/; |
$sender=&Apache::loncommon::screenname($snum,$sdom); |
$color=~tr/K-T/0-9/; |
unless ($sender) { $sender="Anonymous"; } |
$color=~tr/u-z/0-5/; |
|
$color=~tr/U-Z/0-5/; |
|
$color=~s/\D//g; |
|
$color=substr($color,0,6); |
|
my $timestamp=localtime($msgtime); |
|
my ($mhour,$mmin,$msec)=($timestamp=~/(\d\d)\:(\d\d)\:(\d\d)/); |
|
$newstuff.='<font color="#'.$color.'"><a name="'.$id.'"><b>'. |
|
$sender.'</b> ('.$mhour.':'.$mmin.':'.$msec.'): '. |
|
$contrib."</font><br>"; |
|
$bottomid=$id; |
|
} |
} |
} else { |
$sender=~s/\'/\"/g; |
$_=~/^(\w+)/; |
my $color=$sender; |
if ($1 eq $ENV{'form.lastid'}) { $include=1; } |
$color=~tr/a-j/0-9/; |
} |
$color=~tr/A-J/0-9/; |
|
$color=~tr/k-t/0-9/; |
|
$color=~tr/K-T/0-9/; |
|
$color=~tr/u-z/0-5/; |
|
$color=~tr/U-Z/0-5/; |
|
$color=~s/\D//g; |
|
$color=substr($color,0,6); |
|
my $timestamp=localtime($msgtime); |
|
my ($mhour,$mmin,$msec)=($timestamp=~/(\d\d)\:(\d\d)\:(\d\d)/); |
|
$newstuff.='<font color="#'.$color.'"><a name="'.$id.'"><b>'. |
|
$sender.'</b> ('.$mhour.':'.$mmin.':'.$msec.'): '. |
|
$contrib."</font><br>"; |
|
$bottomid=$id; |
|
} else { |
|
$_=~/^(\w+)/; |
|
if ($1 eq $ENV{'form.lastid'}) { $include=1; } |
|
} |
} |
} |
|
my $participant_output=join('<br />',sort @participants); |
$r->print(<<ENDDOCUMENT); |
$r->print(<<ENDDOCUMENT); |
<html> |
<html> |
<head> |
<head> |
Line 137 sub handler {
|
Line 146 sub handler {
|
parent.chatout.document.writeln('$newstuff'); |
parent.chatout.document.writeln('$newstuff'); |
parent.chatout.scroll(0,10000000); |
parent.chatout.scroll(0,10000000); |
</script> |
</script> |
|
$participant_output |
</body> |
</body> |
</html> |
</html> |
ENDDOCUMENT |
ENDDOCUMENT |