--- loncom/interface/lonfeedback.pm 2004/06/03 14:28:39 1.88
+++ 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.88 2004/06/03 14:28:39 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.=' $email,
|