--- loncom/interface/lonfeedback.pm 2022/11/16 14:46:16 1.370.2.5.2.4
+++ 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.370.2.5.2.4 2022/11/16 14:46:16 raeburn Exp $
+# $Id: lonfeedback.pm,v 1.388 2022/01/18 16:55:30 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1003,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
@@ -1307,8 +1312,9 @@ sub build_posting_display {
@{$$usernamesort{$contrib{$idx.':senderdomain'}}{$contrib{$idx.':sendername'}}} = ("$idx");
}
# Set up for sorting by last name, then first name
- my %names = &Apache::loncommon::getnames($contrib{$idx.':sendername'},
- $contrib{$idx.':senderdomain'});
+ my %names = &Apache::lonnet::get('environment',
+ ['firstname','lastname'],$contrib{$idx.':senderdomain'},
+ ,$contrib{$idx.':sendername'});
my $lastname = $names{'lastname'};
my $firstname = $names{'firstname'};
if ($lastname eq '') {
@@ -1688,8 +1694,9 @@ sub get_post_contents {
$$contrib{$idx.':sendername'},
$$contrib{$idx.':senderdomain'});
$$screenname=$$contrib{$idx.':screenname'};
- $$showaboutme = &Apache::loncommon::aboutme_on($$contrib{$idx.':sendername'},
- $$contrib{$idx.':senderdomain'});
+ $$showaboutme = &Apache::lonnet::usertools_access($$contrib{$idx.':sendername'},
+ $$contrib{$idx.':senderdomain'},
+ 'aboutme');
my $sender = $$plainname;
if ($$showaboutme) {
$sender = &Apache::loncommon::aboutmewrapper(
@@ -2108,7 +2115,7 @@ END
$r->print('');
}
$r->print(<
+
END
@@ -2756,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()';
@@ -2772,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'}
@@ -2783,7 +2793,7 @@ ENDFAILREDIR
sub redirect_back {
my ($r,$feedurl,$typestyle,$sendsomething,$sendposts,$blog,$status,$previous,$sort,
- $rolefilter,$statusfilter,$sectionpick,$grouppick,$numpicks,$group,$toolarge,$delay) = @_;
+ $rolefilter,$statusfilter,$sectionpick,$grouppick,$numpicks,$group,$toolarge) = @_;
my $sorttag = '';
my $roletag = '';
my $statustag = '';
@@ -2882,24 +2892,19 @@ sub redirect_back {
&Apache::lonenc::check_encrypt(\$feedurl);
my $logo=&Apache::loncommon::lonhttpdurl('/adm/lonIcons/lonlogos.gif');
my %parms=('only_body' => 1);
- if ($delay !~ /^\d+(|\.\d+)$/) {
- $delay = 0;
- }
if ($env{'form.modal'}) {
my $onload = 'document.forms.reldt.submit()';
- if ($delay) {
- my $js_delay = int(1000 * $delay);
- $onload = "setTimeout(function(){
- document.forms.reldt.submit();
- },$js_delay);";
- }
$parms{'add_entries'}={'onload' => $onload};
} else {
- $parms{'redirect'}=[$delay,$feedurl];
+ $parms{'redirect'}=[0,$feedurl];
}
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(<
@@ -2908,7 +2913,7 @@ $typestyle
$blog
$toolarge
$status
-
@@ -2952,6 +2960,7 @@ ENDFORM
$parms{'redirect'}=[$delay,$feedurl];
}
}
+
my $start_page=
&Apache::loncommon::start_page('Feedback not sent',undef,
\%parms);
@@ -2975,7 +2984,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');
@@ -2984,7 +2993,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');
@@ -3017,10 +3026,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');
}
}
@@ -3031,10 +3043,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') {
@@ -3044,8 +3056,8 @@ sub screen_header {
if ($fdbkoptions{$type}) {
$msgoptions .=
'
';
- }
+ ($optionhash?$optionhash:$default{$item}).'
';
+ }
}
}
if (keys(%discoptions)) {
@@ -3149,17 +3161,9 @@ sub feedback_available {
}
sub send_msg {
- my ($title,$feedurl,$email,$citations,$attachmenturl,$symb,$clientip,%to)=@_;
+ my ($title,$feedurl,$email,$citations,$attachmenturl,$symb,%to)=@_;
my $status='';
my $sendsomething=0;
- my $delay;
- my $senthide;
- my %setters;
- my ($startblock,$endblock,$triggerblock,$by_ip,$blockdom) =
- &Apache::loncommon::blockcheck(\%setters,'com',$clientip);
- if ($by_ip) {
- $senthide = 1;
- }
my $restitle = &get_resource_title($symb,$feedurl);
if ($title=~/^Error/) { $title=&mt('Feedback').': '.$title; }
unless ($title=~/\w/) { $title=&mt('Feedback'); }
@@ -3173,8 +3177,7 @@ sub send_msg {
} else {
unless (&Apache::lonmsg::user_normal_msg($user,$domain,
$title.' ['.$restitle.']',$email,$citations,$feedurl,
- $attachmenturl,undef,undef,$symb,$restitle,undef,
- undef,undef,undef,$senthide)=~/ok/) {
+ $attachmenturl,undef,undef,$symb,$restitle)=~/ok/) {
$status.='
'.&mt('Error sending message to').' '.$key.'
';
} else {
$sendsomething++;
@@ -3182,24 +3185,6 @@ sub send_msg {
}
}
}
- if ($sendsomething && $senthide) {
- if ($by_ip) {
- my $showdom = &Apache::lonnet::domain($blockdom);
- if ($showdom eq '') {
- $showdom = $blockdom;
- }
- $delay = 4;
- $status.='
'.&mt("Message content of feedback you send to instructor(s) from your current IP address: [_1] will be unavailable in your 'Sent' folder.",$clientip).
- '- '.
- &mt('This does not affect delivery of feedback to your instructor(s).').
- '
- '.
- &mt('Note: some types of communication functionality are blocked for certain IP address(es).').
- '
- '.
- &mt('This restriction was set by an administrator in the [_1] LON-CAPA domain.',
- $showdom).
- '
';
- }
- }
# Records of number of feedback messages are kept under the "symb" called "_feedback"
# There are two entries within the framework of a course:
@@ -3217,7 +3202,7 @@ sub send_msg {
}
}
}
- return ($status,$sendsomething,$delay);
+ return ($status,$sendsomething);
}
# Routine to get the complete feedback records
@@ -3641,7 +3626,7 @@ sub modify_attachments {
document.modattachments.action = document.modattachments.origpage.value;
document.modattachments.submit();
}
-
+
END
@@ -4173,11 +4158,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
@@ -4711,7 +4700,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;
}
@@ -4777,10 +4766,9 @@ ENDREDIR
my ($typestyle,%to) = &Apache::lonmsg::decide_receiver($feedurl);
# Actually send mail
- my $clientip = &Apache::lonnet::get_requestor_ip($r);
- my ($status,$numsent,$delay)=&send_msg(&clear_out_html($env{'form.subject'}),
- $feedurl,$email,$citations,
- $attachmenturl,$usersymb,$clientip,%to);
+ my ($status,$numsent)=&send_msg(&clear_out_html($env{'form.subject'}),
+ $feedurl,$email,$citations,
+ $attachmenturl,$usersymb,%to);
# Discussion? Store that.
my $numpost=0;
@@ -4788,7 +4776,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++;
@@ -4812,7 +4804,7 @@ ENDREDIR
# Receipt screen and redirect back to where came from
&redirect_back($r,$feedurl,$typestyle,$numsent,$numpost,$blog,$status,$env{'form.previous'},
- undef,undef,undef,undef,undef,undef,$group,$toolarge,$delay);
+ undef,undef,undef,undef,undef,undef,$group,$toolarge);
}
return OK;
}