--- loncom/interface/lonfeedback.pm 2004/08/31 18:31:31 1.121 +++ loncom/interface/lonfeedback.pm 2004/08/31 22:27:10 1.122 @@ -1,7 +1,7 @@ # The LearningOnline Network # Feedback # -# $Id: lonfeedback.pm,v 1.121 2004/08/31 18:31:31 albertel Exp $ +# $Id: lonfeedback.pm,v 1.122 2004/08/31 22:27:10 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -41,13 +41,13 @@ use Apache::lonspeller(); use Cwd; sub discussion_open { - my ($status)=@_; + my ($status,$symb)=@_; if (defined($status) && !($status eq 'CAN_ANSWER' || $status eq 'CANNOT_ANSWER' || $status eq 'OPEN')) { return 0; } - my $close=&Apache::lonnet::EXT('resource.0.discussend'); + my $close=&Apache::lonnet::EXT('resource.0.discussend',$symb); if (defined($close) && $close ne '' && $close < time) { return 0; } @@ -59,7 +59,7 @@ sub discussion_visible { if (not &discussion_open($status)) { my $hidden=&Apache::lonnet::EXT('resource.0.discusshide'); if (lc($hidden) eq 'yes' or $hidden eq '' or !defined($hidden)) { - return 0; + if (!$ENV{'request.role.adv'}) { return 0; } } } return 1; @@ -626,7 +626,8 @@ END $attachnum += @currnewattach; } } - $discussion.=(< @@ -665,6 +666,7 @@ ENDDISCUSS $discussion.=$newattachmsg; $discussion.=&generate_preview_button(); } + } } else { if (&discussion_open($status) && &Apache::lonnet::allowed('pch', @@ -1977,45 +1979,6 @@ sub get_post_attachments { return; } -sub build_ims_export { - my ($r,$symb,$previous,$feedurl) = @_; - # backward compatibility (bulletin boards used to be 'wrapped') - if ($feedurl=~m|^/adm/wrapper/adm/.*/bulletinboard$|) { - $feedurl=~s|^/adm/wrapper||; - } - my %contrib=&Apache::lonnet::restore($symb,$ENV{'request.course.id'}, - $ENV{'course.'.$ENV{'request.course.id'}.'.domain'}, - $ENV{'course.'.$ENV{'request.course.id'}.'.num'}); - my @depth=(); - my %alldiscussion=(); - my @discussionitems=(); - my %usernamesort = (); - my %subjectsort = (); - my %namesort = (); - my %notshown = (); - my %newitem = (); - my %dischash = (); - my %shown = (); - my %roleinfo = (); - my @posters=(); - my $maxdepth=0; - my $visible=0; - my $newpostsflag=0; - my $status; - my $viewgrades; - my $seeid; - my $prevread; - my $sortposts; - my $ressymb; - my $target; - my $readkey; - my $showunmark; - my $showonlyunread; - -} - - - sub fail_redirect {; my ($r,$feedurl) = @_; if ($feedurl=~/^\/adm\//) { $feedurl.='?register=1' }; @@ -2334,7 +2297,13 @@ sub send_msg { sub adddiscuss { my ($symb,$email,$anon,$attachmenturl,$subject)=@_; my $status=''; - if (&discussion_open() && + my $realsymb; + if ($symb=~/^bulletin___/) { + my $filename=(&Apache::lonnet::decode_symb($symb))[2]; + $filename=~s|^adm/wrapper/||; + $realsymb=&Apache::lonnet::symbread($filename); + } + if (&discussion_open(undef,$realsymb) && &Apache::lonnet::allowed('pch',$ENV{'request.course.id'}. ($ENV{'request.course.sec'}?'/'.$ENV{'request.course.sec'}:''))) { @@ -2600,7 +2569,7 @@ sub generate_attachments_button { my $response = (< Click to add/remove attachments: print($bodytag.$discussion); return OK;