version 1.13, 2004/06/27 17:14:28
|
version 1.20, 2006/03/23 22:32:10
|
Line 37 use Apache::lonnet;
|
Line 37 use Apache::lonnet;
|
sub handler { |
sub handler { |
my $r = shift; |
my $r = shift; |
|
|
if (! &Apache::lonnet::allowed('pch',$ENV{'request.course.id'}. |
if (! &Apache::lonnet::allowed('pch',$env{'request.course.id'}. |
($ENV{'request.course.sec'}?'/'.$ENV{'request.course.sec'}:'')) |
($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:'')) |
) { |
) { |
return HTTP_NOT_ACCEPTABLE; |
return HTTP_NOT_ACCEPTABLE; |
} |
} |
Line 47 sub handler {
|
Line 47 sub handler {
|
if ($loaderror) { return $loaderror; } |
if ($loaderror) { return $loaderror; } |
$loaderror= |
$loaderror= |
&Apache::lonnet::overloaderror($r, |
&Apache::lonnet::overloaderror($r, |
$ENV{'course.'.$ENV{'request.course.id'}.'.home'}); |
$env{'course.'.$env{'request.course.id'}.'.home'}); |
if ($loaderror) { return $loaderror; } |
if ($loaderror) { return $loaderror; } |
|
|
$r->content_type('text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
$r->send_http_header; |
$r->send_http_header; |
return OK if $r->header_only; |
return OK if $r->header_only; |
|
|
# ------------------------------------------------------------ retrieve entries |
# ------------------------------------------------------------ retrieve entries |
|
|
my $cnum=$ENV{'course.'.$ENV{'request.course.id'}.'.num'}; |
my $cnum=$env{'course.'.$env{'request.course.id'}.'.num'}; |
my $cdom=$ENV{'course.'.$ENV{'request.course.id'}.'.domain'}; |
my $cdom=$env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $chome=$ENV{'course.'.$ENV{'request.course.id'}.'.home'}; |
my $chome=$env{'course.'.$env{'request.course.id'}.'.home'}; |
|
|
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)); |
# Figure out what the last valid entry-id is |
# Figure out what the last valid entry-id is |
my ($lastid,$thentime,$idnum); |
my ($lastid,$thentime,$idnum); |
foreach (@entries) { |
foreach (@entries) { |
Line 73 sub handler {
|
Line 73 sub handler {
|
} |
} |
} |
} |
# ----------------------------------------------------------- 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'}) { |
$crs.='_'.$ENV{'request.course.sec'}; |
$crs.='_'.$env{'request.course.sec'}; |
} |
} |
$crs=~s/\_/\//g; |
$crs=~s/\_/\//g; |
my $seeid=&Apache::lonnet::allowed('rin',$crs); |
my $seeid=&Apache::lonnet::allowed('rin',$crs); |
Line 84 sub handler {
|
Line 84 sub handler {
|
my $include=0; |
my $include=0; |
my $newstuff=''; |
my $newstuff=''; |
my $bottomid=''; |
my $bottomid=''; |
unless ($ENV{'form.lastid'}) { |
unless ($env{'form.lastid'}) { |
$include=1; |
$include=1; |
$newstuff='<html><body bgcolor="#FFFFFF">'; |
$newstuff .= |
|
&Apache::loncommon::start_page(undef,undef, |
|
{'only_body' => 1, |
|
'bgcolor' => '#FFFFFF', |
|
'js_ready' => 1,}); |
} |
} |
my @participants=(); |
my @participants=(); |
foreach (@entries) { |
foreach (@entries) { |
my ($id,$msg,$udom)=split(/\:/,&Apache::lonnet::unescape($_)); |
my ($id,$msg,$udom)=split(/\:/,&Apache::lonnet::unescape($_)); |
if ($id eq 'active_participant') { |
if ($id eq 'active_participant') { |
chomp($udom); |
chomp($udom); |
$participants[$#participants+1]= |
my $participant= &Apache::loncommon::nickname($msg,$udom); |
&Apache::loncommon::nickname($msg,$udom); |
unless ($participant=~/\w/) { $participant=$msg.'@'.$udom; } |
|
$participants[$#participants+1]=$participant; |
} elsif ($include) { |
} elsif ($include) { |
chomp($msg); |
chomp($msg); |
my ($msgtime,$msgnum)=split(/\_/,$id); |
my ($msgtime,$msgnum)=split(/\_/,$id); |
my ($sdom,$snum,$anon,$contrib)=split(/\:/, |
my ($sdom,$snum,$anon,$contrib)=split(/\:/, |
&Apache::lonnet::unescape($msg)); |
&Apache::lonnet::unescape($msg)); |
$contrib=&Apache::lonnet::unescape($contrib); |
$contrib=&Apache::lonnet::unescape($contrib); |
$contrib=~s/\n/\<br \/\>/g; |
&Apache::lonfeedback::newline_to_br(\$contrib); |
($contrib,my $errors)=&Apache::lontexconvert::msgtexconverted($contrib); |
($contrib,my $errors)=&Apache::lontexconvert::msgtexconverted($contrib); |
if ($errors) { $contrib.="[Message not fully displayed due to incorrect embedded TeX]"; } |
if ($errors) { $contrib.="[Message not fully displayed due to incorrect embedded TeX]"; } |
if ($errors && $snum eq $ENV{'user.name'} && |
if ($errors && $snum eq $env{'user.name'} && |
$sdom eq $ENV{'user.domain'} ) { |
$sdom eq $env{'user.domain'} ) { |
$contrib.="<br />[TeX error message: $errors]"; |
$contrib.="<br />[TeX error message: $errors]"; |
} |
} |
$contrib=~s/\n/ /g; |
$contrib=~s/\n/ /g; |
Line 117 sub handler {
|
Line 122 sub handler {
|
if (($nick) && ($nick ne $sender)) { |
if (($nick) && ($nick ne $sender)) { |
$sender.=' '.$nick; |
$sender.=' '.$nick; |
} |
} |
|
unless ($sender) { $sender=$snum.'@'.$sdom; } |
if ($anon) { $sender.=' [Anon]' }; |
if ($anon) { $sender.=' [Anon]' }; |
} elsif (!$anon) { |
} elsif (!$anon) { |
$sender=&Apache::loncommon::nickname($snum,$sdom); |
$sender=&Apache::loncommon::nickname($snum,$sdom); |
|
unless ($sender) { $sender=$snum.'@'.$sdom; } |
} else { |
} else { |
$sender=&Apache::loncommon::screenname($snum,$sdom); |
$sender=&Apache::loncommon::screenname($snum,$sdom); |
unless ($sender) { $sender="Anonymous"; } |
unless ($sender) { $sender="Anonymous"; } |
Line 142 sub handler {
|
Line 149 sub handler {
|
$bottomid=$id; |
$bottomid=$id; |
} else { |
} else { |
$_=~/^(\w+)/; |
$_=~/^(\w+)/; |
if ($1 eq $ENV{'form.lastid'}) { $include=1; } |
if ($1 eq $env{'form.lastid'}) { $include=1; } |
} |
} |
} |
} |
my $participant_output=join('<br />',sort @participants); |
my $participant_output=join('<br />',sort @participants); |
|
my $start_page = |
|
&Apache::loncommon::start_page('Chat',undef, |
|
{'redirect' => [5,"/adm/chatfetch?lastid=$lastid"], |
|
'only_body' => 1,}); |
|
my $end_page = &Apache::loncommon::end_page(); |
$r->print(<<ENDDOCUMENT); |
$r->print(<<ENDDOCUMENT); |
<html> |
$start_page |
<head> |
<script type="text/javascript"> |
<title>The LearningOnline Network with CAPA</title> |
|
<meta HTTP-EQUIV="Refresh" CONTENT="5; url=/adm/chatfetch?lastid=$lastid"> |
|
</head> |
|
<body bgcolor="#FFFFFF"> |
|
<script> |
|
parent.chatout.document.writeln('$newstuff'); |
parent.chatout.document.writeln('$newstuff'); |
parent.chatout.scroll(0,10000000); |
parent.chatout.scroll(0,10000000); |
</script> |
</script> |
$participant_output |
$participant_output |
</body> |
$end_page |
</html> |
|
ENDDOCUMENT |
ENDDOCUMENT |
return OK; |
return OK; |
} |
} |