Diff for /loncom/interface/lonfeedback.pm between versions 1.388 and 1.389

version 1.388, 2022/01/18 16:55:30 version 1.389, 2022/01/18 17:33:13
Line 2793  ENDFAILREDIR Line 2793  ENDFAILREDIR
   
 sub redirect_back {  sub redirect_back {
   my ($r,$feedurl,$typestyle,$sendsomething,$sendposts,$blog,$status,$previous,$sort,    my ($r,$feedurl,$typestyle,$sendsomething,$sendposts,$blog,$status,$previous,$sort,
       $rolefilter,$statusfilter,$sectionpick,$grouppick,$numpicks,$group,$toolarge) = @_;        $rolefilter,$statusfilter,$sectionpick,$grouppick,$numpicks,$group,$toolarge,$delay) = @_;
   my $sorttag = '';    my $sorttag = '';
   my $roletag = '';    my $roletag = '';
   my $statustag = '';    my $statustag = '';
Line 2892  sub redirect_back { Line 2892  sub redirect_back {
   &Apache::lonenc::check_encrypt(\$feedurl);    &Apache::lonenc::check_encrypt(\$feedurl);
   my $logo=&Apache::loncommon::lonhttpdurl('/adm/lonIcons/lonlogos.gif');    my $logo=&Apache::loncommon::lonhttpdurl('/adm/lonIcons/lonlogos.gif');
   my %parms=('only_body'   => 1);    my %parms=('only_body'   => 1);
     if ($delay !~ /^\d+(|\.\d+)$/) {
         $delay = 0;
     }
   if ($env{'form.modal'}) {    if ($env{'form.modal'}) {
       my $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};        $parms{'add_entries'}={'onload' => $onload};
   } else {    } else {
       $parms{'redirect'}=[0,$feedurl];        $parms{'redirect'}=[$delay,$feedurl];
   }    }
   my $start_page=    my $start_page=
       &Apache::loncommon::start_page('Feedback sent',undef,\%parms);        &Apache::loncommon::start_page('Feedback sent',undef,\%parms);
Line 3161  sub feedback_available { Line 3170  sub feedback_available {
 }  }
   
 sub send_msg {  sub send_msg {
     my ($title,$feedurl,$email,$citations,$attachmenturl,$symb,%to)=@_;      my ($title,$feedurl,$email,$citations,$attachmenturl,$symb,$clientip,%to)=@_;
     my $status='';      my $status='';
     my $sendsomething=0;      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);      my $restitle = &get_resource_title($symb,$feedurl);
     if ($title=~/^Error/) { $title=&mt('Feedback').': '.$title; }      if ($title=~/^Error/) { $title=&mt('Feedback').': '.$title; }
     unless ($title=~/\w/) { $title=&mt('Feedback'); }      unless ($title=~/\w/) { $title=&mt('Feedback'); }
Line 3177  sub send_msg { Line 3194  sub send_msg {
     } else {      } else {
  unless (&Apache::lonmsg::user_normal_msg($user,$domain,   unless (&Apache::lonmsg::user_normal_msg($user,$domain,
  $title.' ['.$restitle.']',$email,$citations,$feedurl,   $title.' ['.$restitle.']',$email,$citations,$feedurl,
  $attachmenturl,undef,undef,$symb,$restitle)=~/ok/) {   $attachmenturl,undef,undef,$symb,$restitle,undef,
                                                            undef,undef,undef,$senthide)=~/ok/) {
     $status.='<br />'.&mt('Error sending message to').' '.$key.'<br />';      $status.='<br />'.&mt('Error sending message to').' '.$key.'<br />';
  } else {   } else {
     $sendsomething++;      $sendsomething++;
Line 3185  sub send_msg { Line 3203  sub send_msg {
     }      }
  }   }
     }      }
       if ($sendsomething && $senthide) {
           if ($by_ip) {
               my $showdom = &Apache::lonnet::domain($blockdom);
               if ($showdom eq '') {
                   $showdom = $blockdom;
               }
               $delay = 4;
               $status.='<br />'.&mt("Message content of feedback you send to instructor(s) from your current IP address: [_1] will be unavailable in your 'Sent' folder.",$clientip).
                        '<ul><li>'.
                        &mt('This does not affect delivery of feedback to your instructor(s).').
                        '</li><li>'.
                        &mt('Note: some types of communication functionality are blocked for certain IP address(es).').
                        '</li><li>'.
                        &mt('This restriction was set by an administrator in the [_1] LON-CAPA domain.',
                            $showdom).
                        '</li></ul><br />';
           }
       }
   
 # Records of number of feedback messages are kept under the "symb" called "_feedback"  # Records of number of feedback messages are kept under the "symb" called "_feedback"
 # There are two entries within the framework of a course:  # There are two entries within the framework of a course:
Line 3202  sub send_msg { Line 3238  sub send_msg {
     }      }
         }          }
     }      }
     return ($status,$sendsomething);      return ($status,$sendsomething,$delay);
 }  }
   
 # Routine to get the complete feedback records  # Routine to get the complete feedback records
Line 4766  ENDREDIR Line 4802  ENDREDIR
       my ($typestyle,%to) = &Apache::lonmsg::decide_receiver($feedurl);        my ($typestyle,%to) = &Apache::lonmsg::decide_receiver($feedurl);
   
 # Actually send mail  # Actually send mail
       my ($status,$numsent)=&send_msg(&clear_out_html($env{'form.subject'}),        my $clientip = &Apache::lonnet::get_requestor_ip($r);
       $feedurl,$email,$citations,        my ($status,$numsent,$delay)=&send_msg(&clear_out_html($env{'form.subject'}),
       $attachmenturl,$usersymb,%to);               $feedurl,$email,$citations,
                $attachmenturl,$usersymb,$clientip,%to);
   
 # Discussion? Store that.  # Discussion? Store that.
       my $numpost=0;        my $numpost=0;
Line 4804  ENDREDIR Line 4841  ENDREDIR
       
 # Receipt screen and redirect back to where came from  # Receipt screen and redirect back to where came from
       &redirect_back($r,$feedurl,$typestyle,$numsent,$numpost,$blog,$status,$env{'form.previous'},        &redirect_back($r,$feedurl,$typestyle,$numsent,$numpost,$blog,$status,$env{'form.previous'},
                      undef,undef,undef,undef,undef,undef,$group,$toolarge);                       undef,undef,undef,undef,undef,undef,$group,$toolarge,$delay);
   }    }
   return OK;    return OK;
 }  }

Removed from v.1.388  
changed lines
  Added in v.1.389


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>