--- loncom/interface/lonfeedback.pm 2003/11/07 21:21:17 1.69 +++ loncom/interface/lonfeedback.pm 2004/01/28 16:10:26 1.75 @@ -1,7 +1,7 @@ # The LearningOnline Network # Feedback # -# $Id: lonfeedback.pm,v 1.69 2003/11/07 21:21:17 www Exp $ +# $Id: lonfeedback.pm,v 1.75 2004/01/28 16:10:26 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -55,6 +55,10 @@ use Apache::lonlocal; sub list_discussion { my ($mode,$status,$symb)=@_; + &Apache::lonnet::logthis("status is $status"); + if (!($status eq 'CAN_ANSWER' || $status eq 'CANNOT_ANSWER')) { + return ''; + } my $discussiononly=0; if ($mode eq 'board') { $discussiononly=1; } unless ($ENV{'request.course.id'}) { return ''; } @@ -70,7 +74,12 @@ sub list_discussion { my $seeid=&Apache::lonnet::allowed('rin',$crs); my $viewgrades=&Apache::lonnet::allowed('vgr',$crs); 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'}.'.num'}); my $visible=0; @@ -215,7 +224,7 @@ sub list_discussion {
- +
Note: in anonymous discussion, your name is visible only to @@ -227,7 +236,16 @@ Attachment (128 KB max size): ENDDISCUSS $discussion.=&generate_preview_button(); - } + } else { + if (&Apache::lonnet::allowed('pch', + $ENV{'request.course.id'}. + ($ENV{'request.course.sec'}?'/'.$ENV{'request.course.sec'}:''))) { + $discussion.='
'. + ''. + &mt('Post Discussion').'
'; + } + } return $discussion; } @@ -250,6 +268,7 @@ sub mail_screen { } } my $latexHelp = Apache::loncommon::helpLatexCheatsheet(); + my $send=&mt('Send'); $r->print(< @@ -318,7 +337,7 @@ Attachment (128 KB max size):

- +

ENDDOCUMENT @@ -327,12 +346,13 @@ $r->print(&generate_preview_button().'print (< Feedback not sent - Sorry, no recipients ... @@ -343,13 +363,14 @@ ENDFAILREDIR sub redirect_back { my ($r,$feedurl,$typestyle,$sendsomething,$sendposts,$status) = @_; + if ($feedurl=~/^\/adm\//) { $feedurl.='?register=1' }; $r->print (< Feedback sent - $typestyle @@ -365,6 +386,7 @@ ENDREDIR sub no_redirect_back { my ($r,$feedurl) = @_; $r->print (< Feedback not sent ENDNOREDIR @@ -375,7 +397,6 @@ ENDNOREDIR $r->print (< - Sorry, no feedback possible on this resource ... @@ -414,16 +435,17 @@ sub screen_header { if (&Apache::lonnet::allowed('pch', $ENV{'request.course.id'}. ($ENV{'request.course.sec'}?'/'.$ENV{'request.course.sec'}:''))) { - $discussoptions=' '. + $discussoptions=' '. &mt('Contribution to course discussion of resource'); $discussoptions.='
'. &mt('Anonymous contribution to course discussion of resource'). ' ('.&mt('name only visible to course faculty').')'; } } - if ($msgoptions) { $msgoptions='

'.&mt('Sending Messages').'

'.$msgoptions; } + if ($msgoptions) { $msgoptions='

'.&mt('Sending Messages').'

'.$msgoptions; } if ($discussoptions) { - $discussoptions='

'.&mt('Discussion Contributions').'

'.$discussoptions; } + $discussoptions='

'.&mt('Discussion Contributions').'

'.$discussoptions; } return $msgoptions.$discussoptions; } @@ -648,10 +670,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; } @@ -663,7 +686,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'}; @@ -692,20 +715,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'}; @@ -760,10 +785,13 @@ sub handler { if ($feedurl=~/\.(problem|exam|quiz|assess|survey|form)$/) { 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) { # Go ahead with feedback, no ambiguous reference - $r->content_type('text/html'); + &Apache::loncommon::content_type($r,'text/html'); $r->send_http_header; if (