--- loncom/interface/lonfeedback.pm 2013/01/03 20:41:45 1.362
+++ loncom/interface/lonfeedback.pm 2022/01/18 16:55:30 1.388
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Feedback
#
-# $Id: lonfeedback.pm,v 1.362 2013/01/03 20:41:45 raeburn Exp $
+# $Id: lonfeedback.pm,v 1.388 2022/01/18 16:55:30 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -44,8 +44,8 @@ use HTML::LCParser();
#use HTML::Tidy::libXML;
use Apache::lonspeller();
use Apache::longroup;
-use Cwd;
-use LONCAPA;
+use Archive::Zip qw( :ERROR_CODES );
+use LONCAPA qw(:DEFAULT :match);
sub discussion_open {
my ($status,$symb)=@_;
@@ -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 '
'.
- ' | ';
+ my $href = '/adm/feedback?allposts=1&symb='.$escsymb;
if ($newpostsflag) {
- $discussion .= '&previous='.$prevread;
+ $href .= '&previous='.$prevread;
}
- $discussion .= &group_args($group);
- $discussion .= '">'.&mt('Show all posts').' '.&mt('to display').' '.
- $numhidden.' ';
+ $href .= &group_args($group);
if ($showunmark) {
- $discussion .= &mt('posts previously marked read');
+ $discussion .= &mt('[_1]Show all posts[_2] to display [quant,_3,post] previously marked read',
+ '','',$numhidden);
} else {
- $discussion .= &mt('previously viewed posts');
+ $discussion .= &mt('[_1]Show all posts[_2] to display [quant,_3,post] previously viewed',
+ '','',$numhidden);
}
$discussion .= '
|
';
}
@@ -562,7 +581,7 @@ imscp_v1p1.xsd http://www.imsglobal.org/
my $postingfile;
my $postingfilename = $tempexport.'/'.$postfilename;
if ($postingfile = Apache::File->new('>'.$postingfilename)) {
- print $postingfile ''.
+ &mt('Unfortunately you will not be able to retrieve an archive of the discussion posts at this time, because there was a problem creating the zip file.').'
';
}
}
} else {
- $discussion .= ''.
+ &mt('Unfortunately you will not be able to retrieve an archive of the discussion posts at this time, because there was a problem creating a manifest file.').'
';
}
return $discussion;
}
@@ -759,33 +790,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;
@@ -840,7 +898,7 @@ sub send_feedback_link {
&discussion_link($ressymb,
'