--- loncom/interface/lonfeedback.pm 2004/06/04 18:58:32 1.91
+++ loncom/interface/lonfeedback.pm 2004/06/04 19:27:33 1.92
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Feedback
#
-# $Id: lonfeedback.pm,v 1.91 2004/06/04 18:58:32 matthew Exp $
+# $Id: lonfeedback.pm,v 1.92 2004/06/04 19:27:33 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -37,25 +37,40 @@ use Apache::lontexconvert();
use Apache::lonlocal; # must not have ()
use Apache::lonhtmlcommon();
-sub discussion_closed {
+sub discussion_open {
my ($status)=@_;
- if (!($status eq 'CAN_ANSWER' || $status eq 'CANNOT_ANSWER'
+ if (defined($status) &&
+ !($status eq 'CAN_ANSWER' || $status eq 'CANNOT_ANSWER'
|| $status eq 'OPEN')) {
- return '1';
+ &Apache::lonnet::logthis(" no open due to status $status");
+ return 0;
}
my $close=&Apache::lonnet::EXT('resource.0.discussend');
if (defined($close) && $close ne '' && $close < time) {
- return '1'
+ &Apache::lonnet::logthis(" no open due to time ");
+ return 0;
}
- return 0;
+ &Apache::lonnet::logthis(" open ");
+ 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)) {
+ &Apache::lonnet::logthis(" hidden ");
+ return 0;
+ }
+ }
+ &Apache::lonnet::logthis(" visible ");
+ return 1;
}
sub list_discussion {
my ($mode,$status,$symb)=@_;
- if (&discussion_closed($status)) {
- return '';
- }
+ if (not &discussion_visible($status)) { return ''; }
my @bgcols = ("#cccccc","#eeeeee");
my $discussiononly=0;
if ($mode eq 'board') { $discussiononly=1; }
@@ -259,7 +274,7 @@ sub list_discussion {
$sender=''.$screenname.'';
}
}
- if (!&discussion_closed($status) &&
+ if (&discussion_open($status) &&
&Apache::lonnet::allowed('pch',
$ENV{'request.course.id'}.
($ENV{'request.course.sec'}?'/'.$ENV{'request.course.sec'}:''))) {
@@ -432,7 +447,7 @@ Attachment (128 KB max size):