--- loncom/interface/lonfeedback.pm 2019/08/11 15:15:39 1.382
+++ loncom/interface/lonfeedback.pm 2021/10/18 22:29:20 1.385
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Feedback
#
-# $Id: lonfeedback.pm,v 1.382 2019/08/11 15:15:39 raeburn Exp $
+# $Id: lonfeedback.pm,v 1.385 2021/10/18 22:29:20 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -118,10 +118,16 @@ sub list_discussion {
$outputtarget = 'export';
}
}
+ my ($nofooter,$nodisclink,$nofdbklink);
if (not &discussion_visible($status)) {
if ($mode ne 'board') {
- &Apache::lonenc::check_encrypt(\$ressymb);
- return '
'.&send_message_link($ressymb)."
";
+ ($nofooter,$nodisclink,$nofdbklink) = &check_menucoll();
+ if ($nofooter || $nofdbklink) {
+ return '
';
+ } else {
+ &Apache::lonenc::check_encrypt(\$ressymb);
+ return '
'.&send_message_link($ressymb)."
";
+ }
}
}
if ($group ne '' && $mode eq 'board') {
@@ -136,13 +142,21 @@ sub list_discussion {
$blocktext = '
'.$blocktext."";
&Apache::lonenc::check_encrypt(\$ressymb);
if ($mode ne 'board') {
- $blocktext.=&send_message_link($ressymb).'
';
+ ($nofooter,$nodisclink,$nofdbklink) = &check_menucoll();
+ unless ($nofooter || $nofdbklink) {
+ $blocktext.=&send_message_link($ressymb);
+ }
+ $blocktext.='';
}else{
$blocktext.="";
}
return $blocktext;
}
+ unless ($outputtarget eq 'export') {
+ ($nofooter,$nodisclink,$nofdbklink) = &check_menucoll();
+ }
+
my @bgcols = ("LC_disc_old_item","LC_disc_new_item");
my $discussiononly=0;
if ($mode eq 'board') { $discussiononly=1; }
@@ -774,33 +788,60 @@ END
&mt('This discussion is closed.').'';
}
} elsif ($outputtarget ne 'tex') {
- $discussion.='';
- if (&discussion_open($status) &&
- &Apache::lonnet::allowed('pch',
- $env{'request.course.id'}.
- ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))) {
- $discussion.= &send_feedback_link($ressymb);
- if ($env{'request.role.adv'}) {
- my $close = &Apache::lonnet::EXT('resource.0.discussend',$ressymb);
- my $canvote = &Apache::lonnet::EXT('resource.0.discussvote',$ressymb);
- if (defined($close) && $close ne '' && $close < time) {
- if ($canvote eq 'notended') {
- $discussion .= ' '.&mt('(Posting and voting closed for [_1] roles)',
- &Apache::lonnet::plaintext('st',$crstype));
- } else {
- $discussion .= ' '.&mt('(Closed for [_1] roles)',
- &Apache::lonnet::plaintext('st',$crstype));
+ unless ($nofooter) {
+ $discussion.='
';
+ unless ($nodisclink) {
+ if (&discussion_open($status) &&
+ &Apache::lonnet::allowed('pch',
+ $env{'request.course.id'}.
+ ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))) {
+ $discussion.= &send_feedback_link($ressymb);
+ if ($env{'request.role.adv'}) {
+ my $close = &Apache::lonnet::EXT('resource.0.discussend',$ressymb);
+ my $canvote = &Apache::lonnet::EXT('resource.0.discussvote',$ressymb);
+ if (defined($close) && $close ne '' && $close < time) {
+ if ($canvote eq 'notended') {
+ $discussion .= ' '.&mt('(Posting and voting closed for [_1] roles)',
+ &Apache::lonnet::plaintext('st',$crstype));
+ } else {
+ $discussion .= ' '.&mt('(Closed for [_1] roles)',
+ &Apache::lonnet::plaintext('st',$crstype));
+ }
+ }
}
+ } else {
+ $discussion.= ''.&mt('This discussion is closed.').'';
}
}
- } else {
- $discussion.= ''.&mt('This discussion is closed.').'';
+ unless ($nofdbklink) {
+ $discussion.= &send_message_link($ressymb);
+ }
+ $discussion.='
';
}
- $discussion.= &send_message_link($ressymb).'
';
}
return $discussion;
}
+sub check_menucoll {
+ my ($nofooter,$nodisclink,$nofdbklink);
+ my ($menucoll,$deeplinkmenu,$menuref) = &Apache::loncommon::menucoll_in_effect();
+ if ($menucoll) {
+ if (ref($menuref) eq 'HASH') {
+ if ($menuref->{'foot'} eq 'n') {
+ $nofooter = 1;
+ } else {
+ unless ($menuref->{'disc'}) {
+ $nodisclink = 1;
+ }
+ unless ($menuref->{'fdbk'}) {
+ $nofdbklink = 1;
+ }
+ }
+ }
+ }
+ return ($nofooter,$nodisclink,$nofdbklink);
+}
+
sub can_see_hidden {
my ($mode,$ressymb,$feedurl,$group,$cdom,$cnum,$crs) = @_;
my $seehidden;
@@ -3183,7 +3224,7 @@ sub adddiscuss {
if (($symb) && ($email)) {
my $now = time;
if ($env{'form.editdisc'}) {
- $contrib{'ip'}=$ENV{'REMOTE_ADDR'};
+ $contrib{'ip'}=&Apache::lonnet::get_requestor_ip();
$contrib{'host'}=$Apache::lonnet::perlvar{'lonHostID'};
$contrib{'timestamp'} = $now;
$contrib{'history'} = '';
@@ -3561,7 +3602,7 @@ END
$r->print(&Apache::lonhtmlcommon::row_closure());
$r->print(&Apache::lonhtmlcommon::row_title($lt{'adda'}));
$r->print(''
- .''
+ .''
.' '.$attachmaxtext);
if(($idx)||(ref($currnewattach) eq 'ARRAY') && (@{$currnewattach} > 0)){