version 1.8, 2005/02/17 08:29:42
|
version 1.12, 2006/03/29 19:56:28
|
Line 31 package Apache::lonchat;
|
Line 31 package Apache::lonchat;
|
use strict; |
use strict; |
use Apache::Constants qw(:common :http); |
use Apache::Constants qw(:common :http); |
use Apache::loncommon; |
use Apache::loncommon; |
|
use Apache::lonnet; |
|
|
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; |
if (! &Apache::lonnet::allowed('plc',$ENV{'request.course.id'}. |
|
($ENV{'request.course.sec'}?'/'.$ENV{'request.course.sec'}:'') |
&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) ) { |
|
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; |
return HTTP_NOT_ACCEPTABLE; |
|
} |
} |
} |
|
|
if ($ENV{'form.newchat'}) { |
if ($env{'form.newchat'}) { |
&Apache::lonnet::chatsend(&Apache::lonfeedback::clear_out_html($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(); |
my $latexHelp = Apache::loncommon::helpLatexCheatsheet(); |
my $html=&Apache::lonxml::xmlbegin(); |
my $loaditems = 'onLoad="this.document.chatentry.newchat.focus();"'; |
|
my $start_page = |
|
&Apache::loncommon::start_page('Chat',undef, |
|
{'only_body' => 1, |
|
'add_entries' => $loaditems,}); |
|
my $end_page = &Apache::loncommon::end_page(); |
$r->print(<<ENDDOCUMENT); |
$r->print(<<ENDDOCUMENT); |
$html |
$start_page |
<head> |
|
<title>The LearningOnline Network with CAPA</title> |
|
</head> |
|
<body bgcolor="#FFFFFF" onLoad="this.document.chatentry.newchat.focus();"> |
|
<form method="post" name="chatentry"> |
<form method="post" name="chatentry"> |
$latexHelp |
$latexHelp |
<input type="text" size="60" name="newchat"> |
<input type="text" size="60" name="newchat"> |
<input value="Post Anonymous" name="anonymous" type="submit"> |
<input value="Post Anonymous" name="anonymous" type="submit"> |
<input value="Post" name="newentry" type="submit"> |
<input value="Post" name="newentry" type="submit"> |
|
$group_elem |
</form> |
</form> |
</body> |
$end_page |
</html> |
|
ENDDOCUMENT |
ENDDOCUMENT |
return OK; |
return OK; |
} |
} |