version 1.69, 2003/11/07 21:21:17
|
version 1.77, 2004/02/13 15:03:39
|
Line 25
|
Line 25
|
# |
# |
# http://www.lon-capa.org/ |
# http://www.lon-capa.org/ |
# |
# |
# (Internal Server Error Handler |
### |
# |
|
# (Login Screen |
|
# 5/21/99,5/22,5/25,5/26,5/31,6/2,6/10,7/12,7/14, |
|
# 1/14/00,5/29,5/30,6/1,6/29,7/1,11/9 Gerd Kortemeyer) |
|
# |
|
# 3/1/1 Gerd Kortemeyer) |
|
# |
|
# 3/1,2/3,2/5,2/6,2/8 Gerd Kortemeyer |
|
# 2/9 Guy Albertelli |
|
# 2/10 Gerd Kortemeyer |
|
# 2/13 Guy Albertelli |
|
# 7/25 Gerd Kortemeyer |
|
# 7/26 Guy Albertelli |
|
# 7/26,8/10,10/1,11/5,11/6,12/27,12/29 Gerd Kortemeyer |
|
# YEAR=2002 |
|
# 1/1,1/16 Gerd Kortemeyer |
|
# |
|
|
|
package Apache::lonfeedback; |
package Apache::lonfeedback; |
|
|
Line 55 use Apache::lonlocal;
|
Line 38 use Apache::lonlocal;
|
|
|
sub list_discussion { |
sub list_discussion { |
my ($mode,$status,$symb)=@_; |
my ($mode,$status,$symb)=@_; |
|
# &Apache::lonnet::logthis("status is $status"); |
|
if (!($status eq 'CAN_ANSWER' || $status eq 'CANNOT_ANSWER' |
|
|| $status eq 'OPEN')) { |
|
return ''; |
|
} |
my $discussiononly=0; |
my $discussiononly=0; |
if ($mode eq 'board') { $discussiononly=1; } |
if ($mode eq 'board') { $discussiononly=1; } |
unless ($ENV{'request.course.id'}) { return ''; } |
unless ($ENV{'request.course.id'}) { return ''; } |
Line 68 sub list_discussion {
|
Line 56 sub list_discussion {
|
} |
} |
unless ($symb) { return ''; } |
unless ($symb) { return ''; } |
my $seeid=&Apache::lonnet::allowed('rin',$crs); |
my $seeid=&Apache::lonnet::allowed('rin',$crs); |
my $viewgrades=&Apache::lonnet::allowed('vgr',$crs); |
my $viewgrades=(&Apache::lonnet::allowed('vgr',$crs) |
|
&& ($symb=~/\.(problem|exam|quiz|assess|survey|form)$/)); |
my @discussionitems=(); |
my @discussionitems=(); |
my %contrib=&Apache::lonnet::restore($symb,$ENV{'request.course.id'}, |
# backward compatibility (bulletin boards used to be 'wrapped') |
|
my $ressymb=$symb; |
|
if ($mode eq 'board') { |
|
$ressymb=~s|(bulletin___\d+___)|$1adm/wrapper|; |
|
} |
|
my %contrib=&Apache::lonnet::restore($ressymb,$ENV{'request.course.id'}, |
$ENV{'course.'.$ENV{'request.course.id'}.'.domain'}, |
$ENV{'course.'.$ENV{'request.course.id'}.'.domain'}, |
$ENV{'course.'.$ENV{'request.course.id'}.'.num'}); |
$ENV{'course.'.$ENV{'request.course.id'}.'.num'}); |
my $visible=0; |
my $visible=0; |
Line 147 sub list_discussion {
|
Line 141 sub list_discussion {
|
if ($seeid) { |
if ($seeid) { |
if ($hidden) { |
if ($hidden) { |
$sender.=' <a href="/adm/feedback?unhide='. |
$sender.=' <a href="/adm/feedback?unhide='. |
$symb.':::'.$idx.'">'.&mt('Make Visible').'</a>'; |
$ressymb.':::'.$idx.'">'.&mt('Make Visible').'</a>'; |
} else { |
} else { |
$sender.=' <a href="/adm/feedback?hide='. |
$sender.=' <a href="/adm/feedback?hide='. |
$symb.':::'.$idx.'">'.&mt('Hide').'</a>'; |
$ressymb.':::'.$idx.'">'.&mt('Hide').'</a>'; |
} |
} |
$sender.=' <a href="/adm/feedback?deldisc='. |
$sender.=' <a href="/adm/feedback?deldisc='. |
$symb.':::'.$idx.'">'.&mt('Delete').'</a>'; |
$ressymb.':::'.$idx.'">'.&mt('Delete').'</a>'; |
} |
|
if (&Apache::lonnet::allowed('pch', |
|
$ENV{'request.course.id'}. |
|
($ENV{'request.course.sec'}?'/'.$ENV{'request.course.sec'}:''))) { |
|
$sender.=' <a href="/adm/feedback?replydisc='. |
|
$symb.':::'.$idx.'" '.$target.'>'.&mt('Reply').'</a>'; |
|
} |
} |
} else { |
} else { |
if ($screenname) { |
if ($screenname) { |
$sender='<i>'.$screenname.'</i>'; |
$sender='<i>'.$screenname.'</i>'; |
} |
} |
} |
} |
|
if (&Apache::lonnet::allowed('pch', |
|
$ENV{'request.course.id'}. |
|
($ENV{'request.course.sec'}?'/'.$ENV{'request.course.sec'}:''))) { |
|
$sender.=' <a href="/adm/feedback?replydisc='. |
|
$ressymb.':::'.$idx.'" '.$target.'>'.&mt('Reply').'</a>'; |
|
} |
my $vgrlink; |
my $vgrlink; |
if ($viewgrades) { |
if ($viewgrades) { |
$vgrlink=&Apache::loncommon::submlink('Submissions', |
$vgrlink=&Apache::loncommon::submlink('Submissions', |
Line 215 sub list_discussion {
|
Line 209 sub list_discussion {
|
<form action="/adm/feedback" method="post" name="mailform" enctype="multipart/form-data"> |
<form action="/adm/feedback" method="post" name="mailform" enctype="multipart/form-data"> |
<input type="submit" name="discuss" value="Post Discussion" /> |
<input type="submit" name="discuss" value="Post Discussion" /> |
<input type="submit" name="anondiscuss" value="Post Anonymous Discussion" /> |
<input type="submit" name="anondiscuss" value="Post Anonymous Discussion" /> |
<input type="hidden" name="symb" value="$symb" /> |
<input type="hidden" name="symb" value="$ressymb" /> |
<input type="hidden" name="sendit" value="true" /> |
<input type="hidden" name="sendit" value="true" /> |
<br /> |
<br /> |
<font size="1">Note: in anonymous discussion, your name is visible only to |
<font size="1">Note: in anonymous discussion, your name is visible only to |
Line 227 Attachment (128 KB max size): <input typ
|
Line 221 Attachment (128 KB max size): <input typ
|
</form> |
</form> |
ENDDISCUSS |
ENDDISCUSS |
$discussion.=&generate_preview_button(); |
$discussion.=&generate_preview_button(); |
} |
} else { |
|
if (&Apache::lonnet::allowed('pch', |
|
$ENV{'request.course.id'}. |
|
($ENV{'request.course.sec'}?'/'.$ENV{'request.course.sec'}:''))) { |
|
$discussion.='<table bgcolor="#BBBBBB"><tr><td><a href="/adm/feedback?replydisc='. |
|
$symb.':::" '.$target.'>'. |
|
'<img src="/adm/lonMisc/chat.gif" border="0" />'. |
|
&mt('Post Discussion').'</a></td></tr></table>'; |
|
} |
|
} |
return $discussion; |
return $discussion; |
} |
} |
|
|
Line 250 sub mail_screen {
|
Line 253 sub mail_screen {
|
} |
} |
} |
} |
my $latexHelp = Apache::loncommon::helpLatexCheatsheet(); |
my $latexHelp = Apache::loncommon::helpLatexCheatsheet(); |
|
my $send=&mt('Send'); |
$r->print(<<ENDDOCUMENT); |
$r->print(<<ENDDOCUMENT); |
<html> |
<html> |
<head> |
<head> |
Line 318 Attachment (128 KB max size): <input typ
|
Line 322 Attachment (128 KB max size): <input typ
|
</p> |
</p> |
<p> |
<p> |
<input type="hidden" name="sendit" value="1" /> |
<input type="hidden" name="sendit" value="1" /> |
<input type="button" value="Send Feedback" onClick='gosubmit();' /> |
<input type="button" value="$send" onClick='gosubmit();' /> |
</p> |
</p> |
</form> |
</form> |
ENDDOCUMENT |
ENDDOCUMENT |
Line 327 $r->print(&generate_preview_button().'</
|
Line 331 $r->print(&generate_preview_button().'</
|
|
|
sub fail_redirect { |
sub fail_redirect { |
my ($r,$feedurl) = @_; |
my ($r,$feedurl) = @_; |
|
if ($feedurl=~/^\/adm\//) { $feedurl.='?register=1' }; |
$r->print (<<ENDFAILREDIR); |
$r->print (<<ENDFAILREDIR); |
|
<html> |
<head><title>Feedback not sent</title> |
<head><title>Feedback not sent</title> |
<meta http-equiv="pragma" content="no-cache" /> |
<meta http-equiv="pragma" content="no-cache" /> |
<meta HTTP-EQUIV="Refresh" CONTENT="2; url=$feedurl" /> |
<meta HTTP-EQUIV="Refresh" CONTENT="2; url=$feedurl" /> |
</head> |
</head> |
<html> |
|
<body bgcolor="#FFFFFF"> |
<body bgcolor="#FFFFFF"> |
<img align="right" src="/adm/lonIcons/lonlogos.gif" /> |
<img align="right" src="/adm/lonIcons/lonlogos.gif" /> |
<b>Sorry, no recipients ...</b> |
<b>Sorry, no recipients ...</b> |
Line 343 ENDFAILREDIR
|
Line 348 ENDFAILREDIR
|
|
|
sub redirect_back { |
sub redirect_back { |
my ($r,$feedurl,$typestyle,$sendsomething,$sendposts,$status) = @_; |
my ($r,$feedurl,$typestyle,$sendsomething,$sendposts,$status) = @_; |
|
if ($feedurl=~/^\/adm\//) { $feedurl.='?register=1' }; |
$r->print (<<ENDREDIR); |
$r->print (<<ENDREDIR); |
|
<html> |
<head> |
<head> |
<title>Feedback sent</title> |
<title>Feedback sent</title> |
<meta http-equiv="pragma" content="no-cache" /> |
<meta http-equiv="pragma" content="no-cache" /> |
<meta HTTP-EQUIV="Refresh" CONTENT="2; url=$feedurl"> |
<meta HTTP-EQUIV="Refresh" CONTENT="2; url=$feedurl"> |
</head> |
</head> |
<html> |
|
<body bgcolor="#FFFFFF" onLoad='if (window.name!="loncapaclient") { this.document.reldt.submit(); self.close(); }'> |
<body bgcolor="#FFFFFF" onLoad='if (window.name!="loncapaclient") { this.document.reldt.submit(); self.close(); }'> |
<img align="right" src="/adm/lonIcons/lonlogos.gif" /> |
<img align="right" src="/adm/lonIcons/lonlogos.gif" /> |
$typestyle |
$typestyle |
Line 365 ENDREDIR
|
Line 371 ENDREDIR
|
sub no_redirect_back { |
sub no_redirect_back { |
my ($r,$feedurl) = @_; |
my ($r,$feedurl) = @_; |
$r->print (<<ENDNOREDIR); |
$r->print (<<ENDNOREDIR); |
|
<html> |
<head><title>Feedback not sent</title> |
<head><title>Feedback not sent</title> |
<meta http-equiv="pragma" content="no-cache" /> |
<meta http-equiv="pragma" content="no-cache" /> |
ENDNOREDIR |
ENDNOREDIR |
Line 375 ENDNOREDIR
|
Line 382 ENDNOREDIR
|
|
|
$r->print (<<ENDNOREDIRTWO); |
$r->print (<<ENDNOREDIRTWO); |
</head> |
</head> |
<html> |
|
<body bgcolor="#FFFFFF" onLoad='if (window.name!="loncapaclient") { self.close(); }'> |
<body bgcolor="#FFFFFF" onLoad='if (window.name!="loncapaclient") { self.close(); }'> |
<img align="right" src="/adm/lonIcons/lonlogos.gif" /> |
<img align="right" src="/adm/lonIcons/lonlogos.gif" /> |
<b>Sorry, no feedback possible on this resource ...</b> |
<b>Sorry, no feedback possible on this resource ...</b> |
Line 414 sub screen_header {
|
Line 420 sub screen_header {
|
if (&Apache::lonnet::allowed('pch', |
if (&Apache::lonnet::allowed('pch', |
$ENV{'request.course.id'}. |
$ENV{'request.course.id'}. |
($ENV{'request.course.sec'}?'/'.$ENV{'request.course.sec'}:''))) { |
($ENV{'request.course.sec'}?'/'.$ENV{'request.course.sec'}:''))) { |
$discussoptions='<input type="checkbox" name="discuss" onClick="this.form.anondiscuss.checked=false;" /> '. |
$discussoptions='<input type="checkbox" name="discuss" onClick="this.form.anondiscuss.checked=false;" '. |
|
($ENV{'form.replydisc'}?' checked="1"':'').' /> '. |
&mt('Contribution to course discussion of resource'); |
&mt('Contribution to course discussion of resource'); |
$discussoptions.='<br /><input type="checkbox" name="anondiscuss" onClick="this.form.discuss.checked=false;" /> '. |
$discussoptions.='<br /><input type="checkbox" name="anondiscuss" onClick="this.form.discuss.checked=false;" /> '. |
&mt('Anonymous contribution to course discussion of resource'). |
&mt('Anonymous contribution to course discussion of resource'). |
' <i>('.&mt('name only visible to course faculty').')</i>'; |
' <i>('.&mt('name only visible to course faculty').')</i>'; |
} |
} |
} |
} |
if ($msgoptions) { $msgoptions='<h2>'.&mt('Sending Messages').'</h2>'.$msgoptions; } |
if ($msgoptions) { $msgoptions='<h2><img src="/adm/lonMisc/feedback.gif" />'.&mt('Sending Messages').'</h2>'.$msgoptions; } |
if ($discussoptions) { |
if ($discussoptions) { |
$discussoptions='<h2>'.&mt('Discussion Contributions').'</h2>'.$discussoptions; } |
$discussoptions='<h2><img src="/adm/lonMisc/chat.gif" />'.&mt('Discussion Contributions').'</h2>'.$discussoptions; } |
return $msgoptions.$discussoptions; |
return $msgoptions.$discussoptions; |
} |
} |
|
|
Line 648 onClick="this.form.comment.value=documen
|
Line 655 onClick="this.form.comment.value=documen
|
</form> |
</form> |
ENDPREVIEW |
ENDPREVIEW |
} |
} |
|
|
sub handler { |
sub handler { |
my $r = shift; |
my $r = shift; |
if ($r->header_only) { |
if ($r->header_only) { |
$r->content_type('text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
$r->send_http_header; |
$r->send_http_header; |
return OK; |
return OK; |
} |
} |
Line 663 sub handler {
|
Line 671 sub handler {
|
|
|
if (($ENV{'form.hide'}) || ($ENV{'form.unhide'})) { |
if (($ENV{'form.hide'}) || ($ENV{'form.unhide'})) { |
# ----------------------------------------------------------------- Hide/unhide |
# ----------------------------------------------------------------- Hide/unhide |
$r->content_type('text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
$r->send_http_header; |
$r->send_http_header; |
|
|
my $entry=$ENV{'form.hide'}?$ENV{'form.hide'}:$ENV{'form.unhide'}; |
my $entry=$ENV{'form.hide'}?$ENV{'form.hide'}:$ENV{'form.unhide'}; |
Line 692 sub handler {
|
Line 700 sub handler {
|
&redirect_back($r,&Apache::lonnet::clutter($url), |
&redirect_back($r,&Apache::lonnet::clutter($url), |
&mt('Changed discussion status').'<br />','0','0'); |
&mt('Changed discussion status').'<br />','0','0'); |
} elsif (($ENV{'form.threadedon'}) || ($ENV{'form.threadedoff'})) { |
} elsif (($ENV{'form.threadedon'}) || ($ENV{'form.threadedoff'})) { |
|
&Apache::loncommon::content_type($r,'text/html'); |
|
$r->send_http_header; |
if ($ENV{'form.threadedon'}) { |
if ($ENV{'form.threadedon'}) { |
&Apache::lonnet::put('environment',{'threadeddiscussion' => 'on'}); |
&Apache::lonnet::put('environment',{'threadeddiscussion' => 'on'}); |
&Apache::lonnet::appenv('environment.threadeddiscussion' => 'on'); |
&Apache::lonnet::appenv('environment.threadeddiscussion' => 'on'); |
} else { |
} else { |
&Apache::lonnet::del('environment',['threadeddiscussion']); |
&Apache::lonnet::del('environment',['threadeddiscussion']); |
&Apache::lonnet::delenv('environment\.threadeddiscussion'); |
&Apache::lonnet::delenv('environment\.threadeddiscussion'); |
} |
} |
my $symb=$ENV{'form.threadedon'}?$ENV{'form.threadedon'}:$ENV{'form.threadedoff'}; |
my $symb=$ENV{'form.threadedon'}?$ENV{'form.threadedon'}:$ENV{'form.threadedoff'}; |
my ($map,$ind,$url)=&Apache::lonnet::decode_symb($symb); |
my ($map,$ind,$url)=&Apache::lonnet::decode_symb($symb); |
&redirect_back($r,&Apache::lonnet::clutter($url), |
&redirect_back($r,&Apache::lonnet::clutter($url), |
&mt('Changed discussion view mode').'<br />','0','0'); |
&mt('Changed discussion view mode').'<br />','0','0'); |
} elsif ($ENV{'form.deldisc'}) { |
} elsif ($ENV{'form.deldisc'}) { |
# --------------------------------------------------------------- Hide for good |
# --------------------------------------------------------------- Hide for good |
$r->content_type('text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
$r->send_http_header; |
$r->send_http_header; |
|
|
my $entry=$ENV{'form.deldisc'}; |
my $entry=$ENV{'form.deldisc'}; |
Line 732 sub handler {
|
Line 742 sub handler {
|
&mt('Changed discussion status').'<br />','0','0'); |
&mt('Changed discussion status').'<br />','0','0'); |
} elsif ($ENV{'form.preview'}) { |
} elsif ($ENV{'form.preview'}) { |
# -------------------------------------------------------- User wants a preview |
# -------------------------------------------------------- User wants a preview |
|
$r->content_type('text/html'); |
|
$r->send_http_header; |
&show_preview($r); |
&show_preview($r); |
} else { |
} else { |
# ------------------------------------------------------------- Normal feedback |
# ------------------------------------------------------------- Normal feedback |
Line 760 sub handler {
|
Line 772 sub handler {
|
if ($feedurl=~/\.(problem|exam|quiz|assess|survey|form)$/) { |
if ($feedurl=~/\.(problem|exam|quiz|assess|survey|form)$/) { |
unless ($symb) { $goahead=0; } |
unless ($symb) { $goahead=0; } |
} |
} |
|
# backward compatibility (bulltin boards used to be 'wrapped') |
|
if ($feedurl=~m|^/adm/wrapper/adm/.*/bulletinboard$|) { |
|
$feedurl=~s|^/adm/wrapper||; |
|
} |
if ($goahead) { |
if ($goahead) { |
# Go ahead with feedback, no ambiguous reference |
# Go ahead with feedback, no ambiguous reference |
$r->content_type('text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
$r->send_http_header; |
$r->send_http_header; |
|
|
if ( |
if ( |