--- loncom/interface/lonfeedback.pm 2013/10/04 03:04:45 1.368
+++ loncom/interface/lonfeedback.pm 2023/09/15 23:02:08 1.370.2.7
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Feedback
#
-# $Id: lonfeedback.pm,v 1.368 2013/10/04 03:04:45 raeburn Exp $
+# $Id: lonfeedback.pm,v 1.370.2.7 2023/09/15 23:02:08 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)=@_;
@@ -336,12 +336,15 @@ sub list_discussion {
'aner' => 'An error occurred opening the manifest file.',
'difo' => 'Discussion for',
'aerr' => 'An error occurred opening the export file for posting',
+ 'discussions' => 'DISCUSSIONS'
+ );
+ my %js_lt = &Apache::lonlocal::texthash(
'aysu' => 'Are you sure you want to delete this post?',
'dpwn' => 'Deleted posts will no longer be visible to you and other students',
'bwco' => 'but will continue to be visible to your instructor',
'depo' => 'Deleted posts will no longer be visible to you or anyone else.',
- 'discussions' => 'DISCUSSIONS'
);
+ &js_escape(\%js_lt);
my $currdisp = $lt{'allposts'};
my $currmark = $lt{'onmark'};
@@ -447,12 +450,12 @@ imscp_v1p1.xsd http://www.imsglobal.org/
prevparm = "&previous="+previous
}
if (caller == 'studentdelete') {
- if (confirm("$lt{'aysu'}\\n$lt{'dpwn'},\\n$lt{'bwco'}")) {
+ if (confirm("$js_lt{'aysu'}\\n$js_lt{'dpwn'},\\n$js_lt{'bwco'}")) {
document.location.href = "/adm/feedback?hide="+symbparm+prevparm+groupparm
}
} else {
if (caller == 'seeiddelete') {
- if (confirm("$lt{'aysu'}\\n$lt{'depo'}")) {
+ if (confirm("$js_lt{'aysu'}\\n$js_lt{'depo'}")) {
document.location.href = "/adm/feedback?deldisc="+symbparm+prevparm+groupparm
}
}
@@ -562,7 +565,7 @@ imscp_v1p1.xsd http://www.imsglobal.org/
my $postingfile;
my $postingfilename = $tempexport.'/'.$postfilename;
if ($postingfile = Apache::File->new('>'.$postingfilename)) {
- print $postingfile '
Discussion Post '.
+ print $postingfile ''.&mt('Discussion Post').' '.
$imsitems{$alldiscussion{$post}}{'title'}.' '.
$imsitems{$alldiscussion{$post}}{'sender'}.
$imsitems{$alldiscussion{$post}}{'timestamp'}.' '.
@@ -693,22 +696,34 @@ END
#Create zip file in prtspool
- my $imszipfile = '/prtspool/'.
- $env{'user.name'}.'_'.$env{'user.domain'}.'_'.
- time.'_'.rand(1000000000).'.zip';
- my $cwd = &getcwd();
- my $imszip = '/home/httpd/'.$imszipfile;
- chdir $tempexport;
- open(OUTPUT, "zip -r $imszip * 2> /dev/null |");
- close(OUTPUT);
- chdir $cwd;
- $discussion .= &mt('Download the zip file from [_1]Discussion Posting Archive','').' ';
- if ($copyresult) {
- $discussion .= &mt('The following errors occurred during export').' - '.$copyresult;
+ if (($env{'user.name'} =~ /^$match_username$/)
+ && ($env{'user.domain'} =~ /^$match_domain$/)) {
+ my $now = time();
+ my $imszipfile = '/prtspool/'.
+ join('_',$env{'user.name'},$env{'user.domain'},$now).
+ '_'.rand(1000000000).'.zip';
+ my $zip = Archive::Zip->new();
+ $zip->addTree($tempexport);
+ my $imszip = '/home/httpd/'.$imszipfile;
+ if ($zip->writeToFileNamed($imszip) == AZ_OK) {
+ $discussion .= &mt('Download the zip file from [_1]Discussion Posting Archive[_2]',
+ '',' ').' ';
+ } else {
+ $discussion .= &mt('Failed to create zip file').' ';
+ }
+ if ($copyresult) {
+ $discussion .= ''.
+ &mt('The following errors occurred during export:').
+ ' '.$copyresult;
+ }
+ } 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 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.').' ';
+ $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;
}
@@ -840,7 +855,7 @@ sub send_feedback_link {
&discussion_link($ressymb,
' ',
+ '" />',
'replydisc').
'';
}
@@ -851,7 +866,7 @@ sub send_message_link {
&discussion_link($ressymb,
' ',
+ '" />',
'sendmessageonly').
'';
return $output;
@@ -926,7 +941,7 @@ sub postingform_display {
$currnewattach,$currdelold,$group,$crstype) = @_;
my $newattachmsg;
my %lt = &Apache::lonlocal::texthash(
- 'note' => 'Note: in anonymous discussion, your name is visible only to course faculty',
+ 'note' => 'Note: in anonymous discussion, your name is visible only to course faculty',
'title' => 'Title',
'podi' => 'Post Discussion',
'poan' => 'Post Anonymous Discussion',
@@ -1278,7 +1293,7 @@ sub build_posting_display {
if (&editing_allowed($escsymb.':::'.$idx,$group)) {
if (($env{'user.domain'} eq $contrib{$idx.':senderdomain'}) && ($env{'user.name'} eq $contrib{$idx.':sendername'})) {
$sender.=' '.
- &discussion_link($symb,&mt('Edit'),'editdisc',$idx,$$newpostsflag,$prevread,&group_args($group));
+ &discussion_link($ressymb,&mt('Edit'),'editdisc',$idx,$$newpostsflag,$prevread,&group_args($group));
unless ($seehidden) {
my $grpargs = &group_args($group);
$sender.=" '.
' '.
@@ -1505,12 +1521,12 @@ sub build_posting_display {
if ($userlikes{$idx}) {
$$discussionitems[$idx].=' ';
} else {
- $$discussionitems[$idx].=' '.&discussion_link($symb,' ','like',$idx,$$newpostsflag,$prevread,&group_args($group),&mt("Like this posting"));
+ $$discussionitems[$idx].=' '.&discussion_link($ressymb,' ','like',$idx,$$newpostsflag,$prevread,&group_args($group),&mt("Like this posting"));
}
if ($userunlikes{$idx}) {
$$discussionitems[$idx].=' ';
} else {
- $$discussionitems[$idx].=' '.&discussion_link($symb,' ','unlike',$idx,$$newpostsflag,$prevread,&group_args($group),&mt("Unlike this posting"));
+ $$discussionitems[$idx].=' '.&discussion_link($ressymb,' ','unlike',$idx,$$newpostsflag,$prevread,&group_args($group),&mt("Unlike this posting"));
}
}
}
@@ -1528,7 +1544,7 @@ sub build_posting_display {
$$discussionitems[$idx] .= ' '.&mt('This post has been edited by the author.');
if ($seehidden) {
$$discussionitems[$idx] .= ' '.
- &discussion_link($symb,&mt('Display all versions'),'allversions',$idx,$$newpostsflag,$prevread,&group_args($group));
+ &discussion_link($ressymb,&mt('Display all versions'),'allversions',$idx,$$newpostsflag,$prevread,&group_args($group));
}
$$discussionitems[$idx].=' '.&mt('Earlier version(s) were posted on: ');
if ($contrib{$idx.':history'} =~ m/:/) {
@@ -1760,14 +1776,11 @@ sub mail_screen {
my %lt = &Apache::lonlocal::texthash(
'myqu' => 'Question/comment/feedback:',
- 'title' => 'Title',
'reta' => 'Retained attachments',
'atta' => 'Attachment',
);
- if($env{'form.editdisc'} || $env{'form.replydisc'}){
- %lt = &Apache::lonlocal::texthash(
- 'myqu' => 'Post Discussion',
- );
+ if ($env{'form.editdisc'} || $env{'form.replydisc'}){
+ $lt{'myqu'} = &mt('Post Discussion');
}
my $restitle = &get_resource_title($caller_symb,$feedurl);
my $quote='';
@@ -1896,6 +1909,7 @@ END
my $latexHelp=&Apache::loncommon::helpLatexCheatsheet(undef,undef,1,($env{'form.modal'}?'popup':0));
my $send=&mt('Send');
my $alert = &mt('Please select a feedback type.');
+ &js_escape(\$alert);
my $js= <
//
+
END
my ($textareaheader,$textareaclass);
@@ -2040,7 +2055,8 @@ END
} else {
$r->print(<
-$lt{'atta'} $attachmaxtext:
+$lt{'atta'} $attachmaxtext:
+
END
}
@@ -2129,6 +2145,11 @@ sub print_display_options {
'yhni' => 'You have not indicated that you wish to change any of the discussion settings',
'ywbr' => 'You will be returned to the previous page if you click OK.'
);
+ my %js_lt = &Apache::lonlocal::texthash(
+ 'yhni' => 'You have not indicated that you wish to change any of the discussion settings',
+ 'ywbr' => 'You will be returned to the previous page if you click OK.'
+ );
+ &js_escape(\%js_lt);
my $dispchangeA = $lt{'unread'};
my $dispchangeB = $lt{'unmark'};
@@ -2222,7 +2243,7 @@ function setDisp() {
if (chktotal > 0) {
document.modifydisp.submit()
} else {
- if(confirm("$lt{'yhni'}. \\n$lt{'ywbr'}")) {
+ if(confirm("$js_lt{'yhni'}. \\n$js_lt{'ywbr'}")) {
if (prev > 0) {
location.href = "$feedurl?previous=$previous"
} else {
@@ -2682,29 +2703,46 @@ sub get_post_attachments {
$$attachments{'0'}{'filename'} = $attachmenturls;
$$attachments{'0'}{'0'} = 'n';
}
-
return;
}
sub fail_redirect {
- my ($r,$feedurl) = @_;
+ my ($r,$feedurl,$delay) = @_;
if ($feedurl=~/^\/adm\//) { $feedurl.='?register=1' };
my %lt = &Apache::lonlocal::texthash(
'sorr' => 'Sorry, no recipients ...',
);
my $logo=&Apache::loncommon::lonhttpdurl('/adm/lonIcons/lonlogos.gif');
- $r->print(&Apache::loncommon::start_page('Feedback not sent',undef,
- {'redirect' => [2,$feedurl],
- 'only_body' => 1,}));
+ my %parms=('only_body' => 1);
+ if ($delay !~ /^\d+(|\.\d+)$/) {
+ $delay = 2;
+ }
+ 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];
+ }
+ $r->print(&Apache::loncommon::start_page('Feedback not sent',undef,\%parms));
+ my $windowname = 'loncapaclient';
$r->print(<
$lt{'sorr'}
+
ENDFAILREDIR
$r->print(&Apache::loncommon::end_page());
}
sub redirect_back {
- my ($r,$feedurl,$typestyle,$sendsomething,$sendposts,$blog,$status,$previous,$sort,$rolefilter,$statusfilter,$sectionpick,$grouppick,$numpicks,$group,$toolarge) = @_;
+ my ($r,$feedurl,$typestyle,$sendsomething,$sendposts,$blog,$status,$previous,$sort,
+ $rolefilter,$statusfilter,$sectionpick,$grouppick,$numpicks,$group,$toolarge,$delay) = @_;
my $sorttag = '';
my $roletag = '';
my $statustag = '';
@@ -2803,10 +2841,20 @@ 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'}) {
- $parms{'add_entries'}={'onLoad' => 'document.forms.reldt.submit()'};
+ 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'}=[0,$feedurl];
+ $parms{'redirect'}=[$delay,$feedurl];
}
my $start_page=
&Apache::loncommon::start_page('Feedback sent',undef,\%parms);
@@ -2834,39 +2882,59 @@ ENDREDIR
}
sub no_redirect_back {
- my ($r,$feedurl) = @_;
+ my ($r,$feedurl,$delay) = @_;
my $nofeed=&mt('Sorry, no feedback possible on this resource ...');
-
- my %onload;
-
- my %body_options = ('only_body' => 1,
- 'bgcolor' => '#FFFFFF',
- 'add_entries' => \%onload,);
-
- if ($feedurl !~ m{^/adm/feedback}) {
- $body_options{'redirect'} = [2,$feedurl];
+ my $form_for_modal;
+ my %parms=('only_body' => 1,
+ 'bgcolor' => '#FFFFFF',);
+ if ($delay !~ /^\d+(|\.\d+)$/) {
+ $delay = 0;
+ }
+ if ($env{'form.modal'}) {
+ if (($feedurl !~ m{^/adm/feedback}) && ($feedurl ne '')) {
+ 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};
+ my $windowname = 'loncapaclient';
+ $form_for_modal = <
+
+ENDFORM
+ }
+ } else {
+ if (($feedurl !~ m{^/adm/feedback}) && ($feedurl ne '')) {
+ $parms{'redirect'}=[$delay,$feedurl];
+ }
}
my $start_page=
&Apache::loncommon::start_page('Feedback not sent',undef,
- \%body_options);
-
+ \%parms);
+
my $end_page = &Apache::loncommon::end_page();
- &Apache::lonenc::check_encrypt(\$feedurl);
my $logo=&Apache::loncommon::lonhttpdurl('/adm/lonIcons/lonlogos.gif');
$r->print (<
$nofeed
+$form_for_modal
$end_page
ENDNOREDIRTWO
}
sub screen_header {
my ($feedurl,$symb,$group) = @_;
- my $crscontent = &mt('Question/Comment/Feedback about course content');
- my $crspolicy = &mt('Question/Comment/Feedback about course policy');
+ my %default = &Apache::lonlocal::texthash (
+ 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');
@@ -2874,8 +2942,8 @@ sub screen_header {
if ($env{'request.course.id'}) {
$crstype = &Apache::loncommon::course_type();
if ($crstype eq 'Community') {
- $crscontent = &mt('Question/Comment/Feedback about community content');
- $crspolicy = &mt('Question/Comment/Feedback about community policy');
+ $default{'comment'} = &mt('Question/Comment/Feedback about community content');
+ $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');
@@ -2883,56 +2951,78 @@ sub screen_header {
}
my $msgoptions='';
my $discussoptions='';
+ my $checkradio = '';
+ my $blockblog;
+ my (%fdbkoptions,%discoptions);
unless (($env{'form.replydisc'}) || ($env{'form.editdisc'})) {
- if (($feedurl=~/^\/res\//) && ($feedurl!~/^\/res\/adm/) && ($env{'user.adv'})) {
- $msgoptions=
- ' '.
- &mt('Feedback to resource author').' ';
- }
- my %optionhash=();
- foreach my $type ('question','comment','policy') {
- $optionhash{$type}=$env{'course.'.$env{'request.course.id'}.'.'.$type.'.email.text'};
- }
- if (&feedback_available(1)) {
- $msgoptions.=
- ' '.
- ($optionhash{'question'}?$optionhash{'question'}:&mt('Question about resource content')).' ';
- }
- if (&feedback_available(0,1)) {
- $msgoptions.=
- ' '.
- ($optionhash{'comment'}?$optionhash{'comment'}:$crscontent).
- ' ';
- }
- if (&feedback_available(0,0,1)) {
- $msgoptions.=
- ' '.
- ($optionhash{'policy'}?$optionhash{'policy'}:$crspolicy).
- ' ';
- }
+ if (($feedurl=~/^\/res\//) && ($feedurl!~/^\/res\/adm/) && ($env{'user.adv'})) {
+ $fdbkoptions{'author'} = 1;
+ }
+ if (&feedback_available(1)) {
+ $fdbkoptions{'question'} = 1;
+ }
+ if (&feedback_available(0,1)) {
+ $fdbkoptions{'course'} = 1;
+ }
+ if (&feedback_available(0,0,1)) {
+ $fdbkoptions{'policy'} = 1;
+ }
}
if (($env{'request.course.id'}) && (!$env{'form.sendmessageonly'})) {
my ($blocked,$blocktext) = &Apache::loncommon::blocking_status('boards');
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
my $realsymb = &get_realsymb($symb);
- if (!$blocked && &discussion_open(undef,$realsymb) &&
- (&Apache::lonnet::allowed('pch',
- $env{'request.course.id'}.
- ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:'')) ||
+ if (!$blocked && &discussion_open(undef,$realsymb) &&
+ (&Apache::lonnet::allowed('pch',
+ $env{'request.course.id'}.
+ ($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')))) {
- $discussoptions=' '.
- $contribdisc.
- ' '.
- $anoncontrib.
- ' ('.$namevis.') '.
- ''.&mt('Change Screenname').' ';
- my $blockblog = &Apache::loncommon::blocking_status('blogs');
- if (!$blockblog) {
- $discussoptions.= &add_blog_checkbox($crstype);
+ $discoptions{'nonanon'} = 1;
+ $discoptions{'anon'} = 1;
+ $blockblog = &Apache::loncommon::blocking_status('blogs');
+ }
+ }
+ my $total = scalar(keys(%fdbkoptions)) + scalar(keys(%discoptions));
+ return if (!$total);
+ if ($total == 1) {
+ $checkradio = ' checked="checked"';
+ }
+ if (keys(%fdbkoptions)) {
+ if ($fdbkoptions{'author'}) {
+ $msgoptions =
+ ' '.
+ &mt('Feedback to resource author').' ';
+ }
+ foreach my $item ('question','comment','policy') {
+ my $type = $item;
+ if ($item eq 'comment') {
+ $type = 'course';
+ }
+ my $optionhash=$env{'course.'.$env{'request.course.id'}.'.'.$item.'.email.text'};
+ if ($fdbkoptions{$type}) {
+ $msgoptions .=
+ ' '.
+ ($optionhash?$optionhash:$default{$item}).' ';
}
}
}
+ if (keys(%discoptions)) {
+ if ($discoptions{'nonanon'}) {
+ $discussoptions=' '.
+ $contribdisc.
+ ' ';
+ }
+ if ($discoptions{'anon'}) {
+ $discussoptions .= ' '.
+ $anoncontrib.
+ ' ('.$namevis.') '.
+ ''.&mt('Change Screenname').' ';
+ }
+ if (!$blockblog) {
+ $discussoptions.= &add_blog_checkbox($crstype);
+ }
+ }
if ($msgoptions) {
$msgoptions=' '
.' '.&mt('Send Feedback').' '.&Apache::lonhtmlcommon::coursepreflink(&mt('Feedback Settings'),'feedback').' '.
@@ -3018,9 +3108,17 @@ sub feedback_available {
}
sub send_msg {
- my ($title,$feedurl,$email,$citations,$attachmenturl,$symb,%to)=@_;
+ my ($title,$feedurl,$email,$citations,$attachmenturl,$symb,$clientip,%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'); }
@@ -3034,7 +3132,8 @@ sub send_msg {
} else {
unless (&Apache::lonmsg::user_normal_msg($user,$domain,
$title.' ['.$restitle.']',$email,$citations,$feedurl,
- $attachmenturl,undef,undef,$symb,$restitle)=~/ok/) {
+ $attachmenturl,undef,undef,$symb,$restitle,undef,
+ undef,undef,undef,$senthide)=~/ok/) {
$status.=' '.&mt('Error sending message to').' '.$key.' ';
} else {
$sendsomething++;
@@ -3042,6 +3141,24 @@ 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:
@@ -3059,7 +3176,7 @@ sub send_msg {
}
}
}
- return ($status,$sendsomething);
+ return ($status,$sendsomething,$delay);
}
# Routine to get the complete feedback records
@@ -3149,7 +3266,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'} = '';
@@ -3483,7 +3600,8 @@ sub modify_attachments {
document.modattachments.action = document.modattachments.origpage.value;
document.modattachments.submit();
}
-
+
+
END
# Breadcrumbs
@@ -3525,7 +3643,10 @@ END
$r->print(''.$subject.' ');
$r->print(&Apache::lonhtmlcommon::row_closure());
$r->print(&Apache::lonhtmlcommon::row_title($lt{'adda'}));
- $r->print(' '.$attachmaxtext);
+ $r->print(' '
+ .' '
+ .' '.$attachmaxtext);
if(($idx)||(ref($currnewattach) eq 'ARRAY') && (@{$currnewattach} > 0)){
$r->print(&Apache::lonhtmlcommon::row_closure());
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Attachments')));
@@ -3866,8 +3987,9 @@ sub handler {
my $symb=(split(/\:\:\:/,$env{'form.editdisc'}))[0];
my ($map,$id,$url)=&Apache::lonnet::decode_symb($symb);
my $feedurl=&Apache::lonnet::clutter($url);
- &redirect_back($r,$feedurl,&mt('Editing not permitted').' ', '0','0','','',$env{'form.previous'},undef,undef,undef,
- undef,undef,undef,$group);
+ &redirect_back($r,$feedurl,&mt('Editing not permitted').' ',
+ '0','0','','',$env{'form.previous'},undef,undef,undef,
+ undef,undef,undef,$group);
return OK;
}
}
@@ -4074,7 +4196,7 @@ ENDREDIR
unless (($seehidden) || (&editing_allowed($env{'form.hide'},$group))) {
&redirect_back($r,$feedurl,&mt('Hiding not permitted').' ',
'0','0','','',$env{'form.previous'},'','','','',
- undef,undef,$group,);
+ undef,undef,$group);
return OK;
}
@@ -4506,6 +4628,12 @@ ENDREDIR
$r->internal_redirect('/adm/ambiguous');
return OK;
}
+ if ($feedurl eq '') {
+ &Apache::loncommon::content_type($r,'text/html');
+ $r->send_http_header;
+ &no_redirect_back($r);
+ return OK;
+ }
# Go ahead with feedback, no ambiguous reference
unless (
(
@@ -4520,7 +4648,7 @@ ENDREDIR
$r->send_http_header;
# Unable to give feedback
&Apache::lonenc::check_encrypt(\$feedurl);
- &no_redirect_back($r,$feedurl);
+ &no_redirect_back($r,$feedurl,2);
return OK;
}
# --------------------------------------------------- Print login screen header
@@ -4540,7 +4668,7 @@ ENDREDIR
if ($options) {
&mail_screen($r,$feedurl,$options,$symb,$attachmax{'text'});
} else {
- &fail_redirect($r,$feedurl);
+ &fail_redirect($r,$feedurl,2);
}
return OK;
}
@@ -4559,7 +4687,7 @@ ENDREDIR
my $usersymb = &Apache::lonenc::check_encrypt($symb);
my $useranswer=
&Apache::loncommon::get_student_answers(
- $usersymb,$env{'user.name'},$env{'user.domain'},
+ $symb,$env{'user.name'},$env{'user.domain'},
$env{'request.course.id'});
&Apache::lonnet::delenv('allowed.vgr');
# Get attachments, if any, and not too large
@@ -4606,9 +4734,10 @@ ENDREDIR
my ($typestyle,%to) = &Apache::lonmsg::decide_receiver($feedurl);
# Actually send mail
- my ($status,$numsent)=&send_msg(&clear_out_html($env{'form.subject'}),
- $feedurl,$email,$citations,
- $attachmenturl,$usersymb,%to);
+ 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);
# Discussion? Store that.
my $numpost=0;
@@ -4639,7 +4768,8 @@ 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);
+ &redirect_back($r,$feedurl,$typestyle,$numsent,$numpost,$blog,$status,$env{'form.previous'},
+ undef,undef,undef,undef,undef,undef,$group,$toolarge,$delay);
}
return OK;
}