--- loncom/interface/lonfeedback.pm 2004/06/02 16:47:33 1.87 +++ loncom/interface/lonfeedback.pm 2004/06/04 22:54:36 1.93 @@ -1,7 +1,7 @@ # The LearningOnline Network # Feedback # -# $Id: lonfeedback.pm,v 1.87 2004/06/02 16:47:33 www Exp $ +# $Id: lonfeedback.pm,v 1.93 2004/06/04 22:54:36 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -37,14 +37,35 @@ use Apache::lontexconvert(); use Apache::lonlocal; # must not have () use Apache::lonhtmlcommon(); -sub list_discussion { - my ($mode,$status,$symb)=@_; -# &Apache::lonnet::logthis("status is $status"); - if (!($status eq 'CAN_ANSWER' || $status eq 'CANNOT_ANSWER' +sub discussion_open { + my ($status)=@_; + if (defined($status) && + !($status eq 'CAN_ANSWER' || $status eq 'CANNOT_ANSWER' || $status eq 'OPEN')) { - return ''; + return 0; + } + my $close=&Apache::lonnet::EXT('resource.0.discussend'); + if (defined($close) && $close ne '' && $close < time) { + return 0; } + return 1; +} + +sub discussion_visible { + my ($status)=@_; + 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; + } + } + return 1; +} + +sub list_discussion { + my ($mode,$status,$symb)=@_; + if (not &discussion_visible($status)) { return ''; } my @bgcols = ("#cccccc","#eeeeee"); my $discussiononly=0; if ($mode eq 'board') { $discussiononly=1; } @@ -248,7 +269,8 @@ sub list_discussion { $sender=''.$screenname.''; } } - if (&Apache::lonnet::allowed('pch', + if (&discussion_open($status) && + &Apache::lonnet::allowed('pch', $ENV{'request.course.id'}. ($ENV{'request.course.sec'}?'/'.$ENV{'request.course.sec'}:''))) { $sender.=' Note: in anonymous discussion, your name is visible only to course faculty
Title: 

- +

Attachment (128 KB max size):

@@ -420,7 +442,8 @@ Attachment (128 KB max size):


      • - #
        + #

        + # my %html=(B=>1, I=>1, P=>1, A=>1, LI=>1, OL=>1, UL=>1, EM=>1, BR=>1, TT=>1, STRONG=>1, BLOCKQUOTE=>1, DIV=>1, IMG=>1, - M=>1); + M=>1, SUB=>1, SUP=>1, SPAN=>1, + H1=>1, H2=>1, H3=>1, H4=>1, H5=>1); $message =~ s/\<(\/?\s*(\w+)[^\>\<]*)/ {($html{uc($2)}&&(length($1)<1000))?"\<$1":"\<$1"}/ge; @@ -816,7 +843,8 @@ sub send_msg { sub adddiscuss { my ($symb,$email,$anon,$attachmenturl,$subject)=@_; my $status=''; - if (&Apache::lonnet::allowed('pch',$ENV{'request.course.id'}. + if (&discussion_open() && + &Apache::lonnet::allowed('pch',$ENV{'request.course.id'}. ($ENV{'request.course.sec'}?'/'.$ENV{'request.course.sec'}:''))) { my %contrib=('message' => $email,