--- loncom/interface/lonfeedback.pm 2003/11/24 16:00:45 1.70 +++ loncom/interface/lonfeedback.pm 2004/02/18 20:33:49 1.73.2.1 @@ -1,7 +1,7 @@ # The LearningOnline Network # Feedback # -# $Id: lonfeedback.pm,v 1.70 2003/11/24 16:00:45 www Exp $ +# $Id: lonfeedback.pm,v 1.73.2.1 2004/02/18 20:33:49 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -25,24 +25,7 @@ # # 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; @@ -68,9 +51,15 @@ sub list_discussion { } unless ($symb) { return ''; } 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 %contrib=&Apache::lonnet::restore($symb,$ENV{'request.course.id'}, + # backward compatability (bulltein 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'}.'.num'}); my $visible=0; @@ -147,25 +136,25 @@ sub list_discussion { if ($seeid) { if ($hidden) { $sender.=' '.&mt('Make Visible').''; + $ressymb.':::'.$idx.'">'.&mt('Make Visible').''; } else { $sender.=' '.&mt('Hide').''; + $ressymb.':::'.$idx.'">'.&mt('Hide').''; } $sender.=' '.&mt('Delete').''; - } - if (&Apache::lonnet::allowed('pch', - $ENV{'request.course.id'}. - ($ENV{'request.course.sec'}?'/'.$ENV{'request.course.sec'}:''))) { - $sender.=' '.&mt('Reply').''; + $ressymb.':::'.$idx.'">'.&mt('Delete').''; } } else { if ($screenname) { $sender=''.$screenname.''; } } + if (&Apache::lonnet::allowed('pch', + $ENV{'request.course.id'}. + ($ENV{'request.course.sec'}?'/'.$ENV{'request.course.sec'}:''))) { + $sender.=' '.&mt('Reply').''; + } my $vgrlink; if ($viewgrades) { $vgrlink=&Apache::loncommon::submlink('Submissions', @@ -215,7 +204,7 @@ sub list_discussion {
- +
Note: in anonymous discussion, your name is visible only to @@ -329,11 +318,11 @@ sub fail_redirect { my ($r,$feedurl) = @_; if ($feedurl=~/^\/adm\//) { $feedurl.='?register=1' }; $r->print (< Feedback not sent - Sorry, no recipients ... @@ -346,12 +335,12 @@ sub redirect_back { my ($r,$feedurl,$typestyle,$sendsomething,$sendposts,$status) = @_; if ($feedurl=~/^\/adm\//) { $feedurl.='?register=1' }; $r->print (< Feedback sent - $typestyle @@ -367,6 +356,7 @@ ENDREDIR sub no_redirect_back { my ($r,$feedurl) = @_; $r->print (< Feedback not sent ENDNOREDIR @@ -377,7 +367,6 @@ ENDNOREDIR $r->print (< - Sorry, no feedback possible on this resource ... @@ -650,10 +639,11 @@ onClick="this.form.comment.value=documen ENDPREVIEW } + sub handler { my $r = shift; if ($r->header_only) { - $r->content_type('text/html'); + &Apache::loncommon::content_type($r,'text/html'); $r->send_http_header; return OK; } @@ -665,7 +655,7 @@ sub handler { if (($ENV{'form.hide'}) || ($ENV{'form.unhide'})) { # ----------------------------------------------------------------- Hide/unhide - $r->content_type('text/html'); + &Apache::loncommon::content_type($r,'text/html'); $r->send_http_header; my $entry=$ENV{'form.hide'}?$ENV{'form.hide'}:$ENV{'form.unhide'}; @@ -694,20 +684,22 @@ sub handler { &redirect_back($r,&Apache::lonnet::clutter($url), &mt('Changed discussion status').'
','0','0'); } elsif (($ENV{'form.threadedon'}) || ($ENV{'form.threadedoff'})) { + &Apache::loncommon::content_type($r,'text/html'); + $r->send_http_header; if ($ENV{'form.threadedon'}) { &Apache::lonnet::put('environment',{'threadeddiscussion' => 'on'}); &Apache::lonnet::appenv('environment.threadeddiscussion' => 'on'); } else { &Apache::lonnet::del('environment',['threadeddiscussion']); &Apache::lonnet::delenv('environment\.threadeddiscussion'); - } + } my $symb=$ENV{'form.threadedon'}?$ENV{'form.threadedon'}:$ENV{'form.threadedoff'}; my ($map,$ind,$url)=&Apache::lonnet::decode_symb($symb); &redirect_back($r,&Apache::lonnet::clutter($url), &mt('Changed discussion view mode').'
','0','0'); } elsif ($ENV{'form.deldisc'}) { # --------------------------------------------------------------- Hide for good - $r->content_type('text/html'); + &Apache::loncommon::content_type($r,'text/html'); $r->send_http_header; my $entry=$ENV{'form.deldisc'}; @@ -734,6 +726,8 @@ sub handler { &mt('Changed discussion status').'
','0','0'); } elsif ($ENV{'form.preview'}) { # -------------------------------------------------------- User wants a preview + $r->content_type('text/html'); + $r->send_http_header; &show_preview($r); } else { # ------------------------------------------------------------- Normal feedback @@ -762,10 +756,13 @@ sub handler { if ($feedurl=~/\.(problem|exam|quiz|assess|survey|form)$/) { unless ($symb) { $goahead=0; } } - + # backward compatability (bulltein boards used to be 'wrapped') + if ($feedurl=~m|^/adm/wrapper/adm/.*/bulletinboard$|) { + $feedurl=~s|^/adm/wrapper||; + } if ($goahead) { # Go ahead with feedback, no ambiguous reference - $r->content_type('text/html'); + &Apache::loncommon::content_type($r,'text/html'); $r->send_http_header; if (