Diff for /loncom/interface/lonsupportreq.pm between versions 1.79.2.8 and 1.79.2.12

version 1.79.2.8, 2021/01/04 03:46:06 version 1.79.2.12, 2024/07/15 17:13:06
Line 70  sub handler { Line 70  sub handler {
     }      }
     my $origurl = $env{'form.origurl'};      my $origurl = $env{'form.origurl'};
     if ($origurl =~ m{^https?://[^/]+(.*)$}) {      if ($origurl =~ m{^https?://[^/]+(.*)$}) {
         $origurl =~ $1;          $origurl = $1;
     }      }
     $origurl =~ s/(`)//g;      $origurl =~ s/(`)//g;
     $origurl =~ s/\$/\(\$\)/g;      $origurl =~ s/\$/\(\$\)/g;
Line 393  ENDJS Line 393  ENDJS
     $i = $num%2;      $i = $num%2;
     if ($knownuser) {      if ($knownuser) {
         if ($homeserver) {          if ($homeserver) {
             unless ($helpform{'cc'} eq 'no') {              my $ip = &Apache::lonnet::get_requestor_ip($r);
               my %setters;
               my ($startblock,$endblock,$triggerblock,$by_ip,$blockdom) =
                   &Apache::loncommon::blockcheck(\%setters,'com',$ip);
               unless (($helpform{'cc'} eq 'no') || ($by_ip)) {
                 $output .= &Apache::lonhtmlcommon::row_title($html_lt{'emac'},undef,$css[$i]).                  $output .= &Apache::lonhtmlcommon::row_title($html_lt{'emac'},undef,$css[$i]).
                            '<input type="text" size="50" name="cc" value="" /><br />'."\n".                             '<input type="text" size="50" name="cc" value="" /><br />'."\n".
                            &Apache::lonhtmlcommon::row_closure();                             &Apache::lonhtmlcommon::row_closure();
Line 462  ENDJS Line 466  ENDJS
             my $numtitles = @codetitles;              my $numtitles = @codetitles;
             if ($numtitles == 0) {              if ($numtitles == 0) {
                 $output .= $html_lt{'enin'}.':&nbsp;                  $output .= $html_lt{'enin'}.':&nbsp;
                   <input type="text" name="coursecode" size="15" value="" />'."\n";                    <input type="text" name="coursecode" size="15" value="'.&HTML::Entities::encode($ccode,'\'"&<>').'" />'."\n";
             } else {              } else {
                 my @standardnames = &Apache::loncommon::get_standard_codeitems();                  my @standardnames = &Apache::loncommon::get_standard_codeitems();
                 my $lasttitle = $numtitles;                  my $lasttitle = $numtitles;
Line 663  sub print_request_receipt { Line 667  sub print_request_receipt {
             return;              return;
         }          }
     }      }
     my $ip = &Apache::lonnet::get_requestor_ip();      my $ip = &Apache::lonnet::get_requestor_ip($r);
       my %setters;
       my ($startblock,$endblock,$triggerblock,$by_ip,$blockdom) =
           &Apache::loncommon::blockcheck(\%setters,'com',$ip);
     my @ENVvars = ('HTTP_HOST','HTTP_USER_AGENT','SERVER_ADDR','SERVER_NAME');      my @ENVvars = ('HTTP_HOST','HTTP_USER_AGENT','SERVER_ADDR','SERVER_NAME');
     my @envvars = ('browser.os','browser.type','browser.version','user.home','request.role');      my @envvars = ('browser.os','browser.type','browser.version','user.home','request.role');
     my @loncvars = ('user.name','user.domain','request.course.sec','request.course.id');      my @loncvars = ('user.name','user.domain','request.course.sec','request.course.id');
Line 709  sub print_request_receipt { Line 716  sub print_request_receipt {
     unless ($helpform{'course'} eq 'no') {      unless ($helpform{'course'} eq 'no') {
         $formvars{'course'} = 1;          $formvars{'course'} = 1;
     }      }
     unless ($helpform{'cc'} eq 'no') {      unless (($helpform{'cc'} eq 'no') || ($by_ip)) {
         $formvars{'cc'} = 1;          $formvars{'cc'} = 1;
     }      }
     unless ($helpform{'screenshot'} eq 'no') {      unless ($helpform{'screenshot'} eq 'no') {
Line 755  sub print_request_receipt { Line 762  sub print_request_receipt {
                  secn        => 'Section',                   secn        => 'Section',
                  warn        => 'Warning: Problem with support e-mail address',                   warn        => 'Warning: Problem with support e-mail address',
                  your        => 'Your support request contained the following information',                   your        => 'Your support request contained the following information',
                    belo        => 'Below is your support request which could not be sent',
                    ifyk        => 'If you know an IT support address for your institution, you could copy this information and send it to that email address.',
                  sect        => 'section',                   sect        => 'section',
                  info        => 'Information supplied',                   info        => 'Information supplied',
                  adin        => 'Additional information recorded',                   adin        => 'Additional information recorded',
Line 974  END Line 983  END
   
     my $message;      my $message;
     if (!$bad_email) {      if (!$bad_email) {
         $message = &Apache::lonhtmlcommon::confirm_success(          $message = &mt('A support request has been sent to [_1]','<tt>'.$to.'</tt>');
             &mt('A support request has been sent to [_1]','<tt>'.$to.'</tt>'));  
     } else {      } else {
         $message = &Apache::lonhtmlcommon::confirm_success(          $message = $lt{'warn'}.'<br />';
             $lt{'warn'}.'<br />'          if ($to eq '') {
            .&mt('As the e-mail address provided for this LON-CAPA server ([_1]) does not appear to be a valid e-mail address, your support request has [_2]not[_3] been sent to the LON-CAPA support staff or administrator at your institution.','<tt>'.$to.'</tt>','<b>','</b>')              $message .= &mt('For this LON-CAPA server no e-mail address has been configured to receive support requests, so your support request has [_1]not[_2] been sent to the LON-CAPA support staff or administrator at your institution.','<b>','</b>');
            .' '.&mt('Instead a copy has been sent to the LON-CAPA support team at Michigan State University.'),1);           } else {
         $to = 'helpdesk@lon-capa.org';              $message .= &mt('As the e-mail address provided for this LON-CAPA server ([_1]) does not appear to be a valid e-mail address, your support request has [_2]not[_3] been sent to the LON-CAPA support staff or administrator at your institution.','<tt>'.$to.'</tt>','<b>','</b>');
           }
     }      }
     $r->print(&Apache::loncommon::confirmwrapper($message));      $r->print(&Apache::loncommon::confirmwrapper(&Apache::lonhtmlcommon::confirm_success($message,$bad_email)));
   
     if ($reqemail ne '') {      if ($reqemail ne '') {
         $from = $reqemail;          $from = $reqemail;
Line 1092  END Line 1101  END
         }          }
     }      }
   
     my $msg = MIME::Lite->new(      unless ($bad_email) {
                  From    => $from,          my $msg = MIME::Lite->new(
                  To      => $to,                       From    => $from,
                  Subject => $subject,                       To      => $to,
                  Type    =>'TEXT',                       Subject => $subject,
                  Data    => $supportmsg,                       Type    =>'TEXT',
                  );                       Data    => $supportmsg,
     if ($homeserver) {                       );
         if (@ok_ccs > 0) {          if ($homeserver) {
             my $cc_string = join(', ',@ok_ccs);              if (@ok_ccs > 0) {
             $msg->add("Cc" => $cc_string);                  my $cc_string = join(', ',@ok_ccs);
                   $msg->add("Cc" => $cc_string);
               }
         }          }
     }          if ($bcc ne '') {
     if ($bcc ne '') {              $msg->add("Bcc" => $bcc);
         $msg->add("Bcc" => $bcc);          }
     }          $msg->attr("content-type"         => "text/plain");
     $msg->attr("content-type"         => "text/plain");          $msg->attr("content-type.charset" => "UTF-8");
     $msg->attr("content-type.charset" => "UTF-8");  
   
     if ($homeserver && $attachmentpath) {          if ($homeserver && $attachmentpath) {
         my ($type, $encoding) = MIME::Types::by_suffix($attachmentpath);              my ($type, $encoding) = MIME::Types::by_suffix($attachmentpath);
         $msg->attach(Type     => $type,              $msg->attach(Type     => $type,
                      Path     => $attachmentpath,                           Path     => $attachmentpath,
                      Filename => $fname                           Filename => $fname
                      );                           );
   
     } elsif ($attachment_text ne '') {          } elsif ($attachment_text ne '') {
         $msg->attach(Type => 'TEXT',              $msg->attach(Type => 'TEXT',
                      Data => $attachment_text);                           Data => $attachment_text);
     }          }
   
 ### Send it:          ### Send it:
     $msg->send('sendmail');          $msg->send('sendmail');
       }
   
     if ($attachmentpath =~ m|$Apache::lonnet::perlvar{'lonDaemons'}/tmp/helprequests/(\d+)/[^/]+|) {      if ($attachmentpath =~ m|$Apache::lonnet::perlvar{'lonDaemons'}/tmp/helprequests/(\d+)/[^/]+|) {
         unlink($attachmentpath);          unlink($attachmentpath);
     }      }
     $r->print('<b>'.$lt{'your'}.'</b>:<br /><br />'."\n");      if ($bad_email) {
           $r->print('<b>'.$lt{'belo'}.'</b><br />'.
                     $lt{'ifyk'}.'<br /><br />'."\n");
       } else {
           $r->print('<b>'.$lt{'your'}.'</b>:<br /><br />'."\n");
       }
     $r->print('<div style="width:620px;">'.      $r->print('<div style="width:620px;">'.
               &Apache::lonhtmlcommon::start_pick_box().                &Apache::lonhtmlcommon::start_pick_box().
               &Apache::lonhtmlcommon::row_title($lt{'info'},undef,'LC_oddrow_value')."\n".$displaymsg."\n".                &Apache::lonhtmlcommon::row_title($lt{'info'},undef,'LC_oddrow_value')."\n".$displaymsg."\n".

Removed from v.1.79.2.8  
changed lines
  Added in v.1.79.2.12


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