--- loncom/interface/lonfeedback.pm 2023/09/15 23:02:08 1.370.2.7 +++ loncom/interface/lonfeedback.pm 2022/01/18 17:33:13 1.389 @@ -1,7 +1,7 @@ # The LearningOnline Network # Feedback # -# $Id: lonfeedback.pm,v 1.370.2.7 2023/09/15 23:02:08 raeburn Exp $ +# $Id: lonfeedback.pm,v 1.389 2022/01/18 17:33:13 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 '
"; + ($nofooter,$nodisclink,$nofdbklink) = &check_menucoll(); + if ($nofooter || $nofdbklink) { + return '
'; + } else { + &Apache::lonenc::check_encrypt(\$ressymb); + return '
"; + } } } if ($group ne '' && $mode eq 'board') { @@ -130,17 +136,27 @@ sub list_discussion { } } - my ($blocked,$blocktext) = - &Apache::loncommon::blocking_status('boards'); - if ($blocked) { - $blocktext = '
'; - }else{ - $blocktext.=""; + unless ($outputtarget eq 'export') { + ($nofooter,$nodisclink,$nofdbklink) = &check_menucoll(); + } + + unless ($nofooter) { + my ($blocked,$blocktext) = + &Apache::loncommon::blocking_status('boards'); + if ($blocked) { + my $footer = '
'; + return $footer; } - return $blocktext; } my @bgcols = ("LC_disc_old_item","LC_disc_new_item"); @@ -674,7 +690,7 @@ END $newpostsflag,$group, $prevread,$markondisp,$seehidden); $discussion .= "\n"; - } + } if ($outputtarget eq 'export') { if ($manifestok) { while ($currdepth > 0) { @@ -774,33 +790,60 @@ END &mt('This discussion is closed.').''; } } elsif ($outputtarget ne 'tex') { - $discussion.=''; } 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; @@ -960,9 +1003,14 @@ sub postingform_display { } } } + my $postanon; + if (&Apache::lonnet::allowed('pac',$env{'request.course.id'}. + ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))) { + $postanon = ''; + } $postingform .= (< - +$postanon @@ -2067,7 +2115,7 @@ END $r->print(''); } $r->print(< +

END @@ -2715,7 +2763,7 @@ sub fail_redirect { my $logo=&Apache::loncommon::lonhttpdurl('/adm/lonIcons/lonlogos.gif'); my %parms=('only_body' => 1); if ($delay !~ /^\d+(|\.\d+)$/) { - $delay = 2; + $delay = 0; } if ($env{'form.modal'}) { my $onload = 'document.forms.reldt.submit()'; @@ -2731,6 +2779,9 @@ sub fail_redirect { } $r->print(&Apache::loncommon::start_page('Feedback not sent',undef,\%parms)); my $windowname = 'loncapaclient'; + if ($env{'request.lti.login'}) { + $windowname .= 'lti'; + } $r->print(<

$lt{'sorr'}

@@ -2859,6 +2910,10 @@ sub redirect_back { my $start_page= &Apache::loncommon::start_page('Feedback sent',undef,\%parms); my $end_page = &Apache::loncommon::end_page(); + my $windowname = 'loncapaclient'; + if ($env{'request.lti.login'}) { + $windowname .= 'lti'; + } $r->print(< @@ -2867,7 +2922,7 @@ $typestyle $blog $toolarge $status -
+ $prevtag $sorttag $statustag @@ -2901,6 +2956,9 @@ sub no_redirect_back { } $parms{'add_entries'}={'onload' => $onload}; my $windowname = 'loncapaclient'; + if ($env{'request.lti.login'}) { + $windowname .= 'lti'; + } $form_for_modal = < @@ -2911,6 +2969,7 @@ ENDFORM $parms{'redirect'}=[$delay,$feedurl]; } } + my $start_page= &Apache::loncommon::start_page('Feedback not sent',undef, \%parms); @@ -2934,7 +2993,7 @@ sub screen_header { question => 'Question about resource content', comment => 'Question/Comment/Feedback about course content', policy => 'Question/Comment/Feedback about course policy', - ); + ); my $contribdisc = &mt('Contribution to course discussion of resource'); my $anoncontrib = &mt('Anonymous contribution to course discussion of resource'); my $namevis = &mt('name only visible to course faculty'); @@ -2943,7 +3002,7 @@ sub screen_header { $crstype = &Apache::loncommon::course_type(); if ($crstype eq 'Community') { $default{'comment'} = &mt('Question/Comment/Feedback about community content'); - $default{'policy'} = &mt('Question/Comment/Feedback about community policy'); + $default{'policy'} = &mt('Question/Comment/Feedback about community policy'); $contribdisc = &mt('Contribution to community discussion of resource'); $anoncontrib = &mt('Anonymous contribution to community discussion of resource'); $namevis = &mt('name only visible to community facilitators'); @@ -2976,10 +3035,13 @@ sub screen_header { if (!$blocked && &discussion_open(undef,$realsymb) && (&Apache::lonnet::allowed('pch', $env{'request.course.id'}. - ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:'')) || + ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:'')) || (($group ne '') && ($symb =~ m{^bulletin___\d+___adm/wrapper/adm/\Q$cdom\E/\Q$cnum\E/\d+/bulletinboard$}) && (&check_group_priv($group,'pgd') eq 'ok')))) { $discoptions{'nonanon'} = 1; - $discoptions{'anon'} = 1; + if (&Apache::lonnet::allowed('pac',$env{'request.course.id'}. + ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))) { + $discoptions{'anon'} = 1; + } $blockblog = &Apache::loncommon::blocking_status('blogs'); } } @@ -2990,10 +3052,10 @@ sub screen_header { } if (keys(%fdbkoptions)) { if ($fdbkoptions{'author'}) { - $msgoptions = - '
'; - } + $msgoptions = + '
'; + } foreach my $item ('question','comment','policy') { my $type = $item; if ($item eq 'comment') { @@ -3003,8 +3065,8 @@ sub screen_header { if ($fdbkoptions{$type}) { $msgoptions .= '
'; - } + ($optionhash?$optionhash:$default{$item}).'
'; + } } } if (keys(%discoptions)) { @@ -3111,7 +3173,7 @@ sub send_msg { my ($title,$feedurl,$email,$citations,$attachmenturl,$symb,$clientip,%to)=@_; my $status=''; my $sendsomething=0; - my $delay; + my $delay; my $senthide; my %setters; my ($startblock,$endblock,$triggerblock,$by_ip,$blockdom) = @@ -3600,7 +3662,7 @@ sub modify_attachments { document.modattachments.action = document.modattachments.origpage.value; document.modattachments.submit(); } - + END @@ -4132,11 +4194,15 @@ sub handler { 'only_body' => 1, 'add_entries' => \%onload}); my $end_page = &Apache::loncommon::end_page(); + my $windowname = 'loncapaclient'; + if ($env{'request.lti.login'}) { + $windowname .= 'lti'; + } $r->print (< $textline -
+

$end_page @@ -4643,6 +4709,8 @@ ENDREDIR ($env{'request.course.id'} && ($feedurl!~m:^/adm:)) || ($env{'request.course.id'} && ($symb=~/^bulletin\_\_\_/)) + || + (($env{'request.course.id'}) && ($feedurl =~ /ext\.tool$/)) ) { &Apache::loncommon::content_type($r,'text/html'); $r->send_http_header; @@ -4668,7 +4736,7 @@ ENDREDIR if ($options) { &mail_screen($r,$feedurl,$options,$symb,$attachmax{'text'}); } else { - &fail_redirect($r,$feedurl,2); + &fail_redirect($r,$feedurl,1); } return OK; } @@ -4687,7 +4755,7 @@ ENDREDIR my $usersymb = &Apache::lonenc::check_encrypt($symb); my $useranswer= &Apache::loncommon::get_student_answers( - $symb,$env{'user.name'},$env{'user.domain'}, + $usersymb,$env{'user.name'},$env{'user.domain'}, $env{'request.course.id'}); &Apache::lonnet::delenv('allowed.vgr'); # Get attachments, if any, and not too large @@ -4745,7 +4813,11 @@ ENDREDIR && $env{'form.discuss'} !~ /^(?:author|question|course|policy)/) || $env{'form.anondiscuss'} ne '') { my $subject = &clear_out_html($env{'form.subject'}); - my $anonmode=($env{'form.discuss'} eq 'anon' || $env{'form.anondiscuss'} ); + my $anonmode; + if (&Apache::lonnet::allowed('pac',$env{'request.course.id'}. + ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))) { + $anonmode=($env{'form.discuss'} eq 'anon' || $env{'form.anondiscuss'} ); + } $typestyle.=&adddiscuss($symb,$message,$anonmode,$attachmenturl, $subject,$group); $numpost++;