version 1.3, 2002/08/08 13:44:17
|
version 1.19, 2009/04/04 21:47:40
|
Line 29
|
Line 29
|
package Apache::lonchat; |
package Apache::lonchat; |
|
|
use strict; |
use strict; |
use Apache::Constants qw(:common); |
use Apache::Constants qw(:common :http); |
|
use Apache::loncommon; |
|
use Apache::lonnet; |
|
use Apache::lonlocal; |
|
|
sub handler { |
sub handler { |
my $r = shift; |
my $r = shift; |
$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; |
|
|
|
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['group']); |
|
my ($group,$group_elem); |
|
if (defined($env{'form.group'})) { |
|
$group = $env{'form.group'}; |
|
$group_elem = '<input type="hidden" name="group" value="'.$group.'" />'; |
|
if ((! &Apache::lonnet::allowed('pgc',$env{'request.course.id'}.'/'. |
|
$group)) |
|
&& (! &Apache::lonnet::allowed('vcg',$env{'request.course.id'}.($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:'')))) { |
|
return HTTP_NOT_ACCEPTABLE; |
|
} |
|
} else { |
|
if (! &Apache::lonnet::allowed('plc',$env{'request.course.id'}. |
|
($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:'') |
|
)) { |
|
return HTTP_NOT_ACCEPTABLE; |
|
} |
|
} |
|
|
if ($ENV{'form.newentry'}) { |
if ($env{'form.newchat'}) { |
&Apache::lonnet::chatsend($ENV{'form.newchat'},$ENV{'form.anonymous'}); |
&Apache::lonnet::chatsend(&Apache::lonfeedback::clear_out_html($env{'form.newchat'}),$env{'form.anonymous'},$group); |
} |
} |
# --------------------------------------------------- Print login screen header |
# --------------------------------------------------- Print login screen header |
|
my $latexHelp = Apache::loncommon::helpLatexCheatsheet(undef,undef,1); |
|
my %loaditems = (onload => 'this.document.chatentry.newchat.focus();'); |
|
my $start_page = |
|
&Apache::loncommon::start_page('Chat Room',undef, |
|
{'only_body' => 1, |
|
'add_entries' => \%loaditems,}); |
|
my $end_page = &Apache::loncommon::end_page(); |
|
my %lt = &Apache::lonlocal::texthash( |
|
anon => 'Post Anonymous', |
|
post => 'Post', |
|
); |
$r->print(<<ENDDOCUMENT); |
$r->print(<<ENDDOCUMENT); |
<html> |
$start_page |
<head> |
<form method="post" name="chatentry"> |
<title>The LearningOnline Network with CAPA</title> |
$latexHelp |
</head> |
<input type="text" size="60" name="newchat" /> |
<body bgcolor="#FFFFFF"> |
<input value="$lt{'anon'}" name="anonymous" type="submit" /> |
<form method="post"> |
<input value="$lt{'post'}" name="newentry" type="submit" /> |
<input type="text" size="60" name="newchat"> |
$group_elem |
<input type="checkbox" name="anonymous"> |
|
<input value="Post" name="newentry" type="submit"> |
|
</form> |
</form> |
</body> |
$end_page |
</html> |
|
ENDDOCUMENT |
ENDDOCUMENT |
return OK; |
return OK; |
} |
} |