[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /interface lonsupportreq.pm

raeburn raeburn at source.lon-capa.org
Mon Jul 15 13:13:06 EDT 2024


raeburn		Mon Jul 15 17:13:06 2024 EDT

  Modified files:              (Branch: version_2_11_X)
    /loncom/interface	lonsupportreq.pm 
  Log:
  - For 2.11
    Backport 1.106
  
  
Index: loncom/interface/lonsupportreq.pm
diff -u loncom/interface/lonsupportreq.pm:1.79.2.11 loncom/interface/lonsupportreq.pm:1.79.2.12
--- loncom/interface/lonsupportreq.pm:1.79.2.11	Wed Jul  3 23:58:21 2024
+++ loncom/interface/lonsupportreq.pm	Mon Jul 15 17:13:06 2024
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Helpdesk request form
 #
-# $Id: lonsupportreq.pm,v 1.79.2.11 2024/07/03 23:58:21 raeburn Exp $
+# $Id: lonsupportreq.pm,v 1.79.2.12 2024/07/15 17:13:06 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -762,6 +762,8 @@
                  secn        => 'Section',
                  warn        => 'Warning: Problem with support e-mail address',
                  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',
                  info        => 'Information supplied',
                  adin        => 'Additional information recorded',
@@ -981,16 +983,16 @@
 
     my $message;
     if (!$bad_email) {
-        $message = &Apache::lonhtmlcommon::confirm_success(
-            &mt('A support request has been sent to [_1]','<tt>'.$to.'</tt>'));
+        $message = &mt('A support request has been sent to [_1]','<tt>'.$to.'</tt>');
     } else {
-        $message = &Apache::lonhtmlcommon::confirm_success(
-            $lt{'warn'}.'<br />'
-           .&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>')
-           .' '.&mt('Instead a copy has been sent to the LON-CAPA support team at Michigan State University.'),1); 
-        $to = 'helpdesk at lon-capa.org';
+        $message = $lt{'warn'}.'<br />';
+        if ($to eq '') {
+            $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>');
+        } else {
+            $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 '') {
         $from = $reqemail;
@@ -1099,44 +1101,51 @@
         }
     }
 
-    my $msg = MIME::Lite->new(
-                 From    => $from,
-                 To      => $to,
-                 Subject => $subject,
-                 Type    =>'TEXT',
-                 Data    => $supportmsg,
-                 );
-    if ($homeserver) {
-        if (@ok_ccs > 0) {
-            my $cc_string = join(', ', at ok_ccs);
-            $msg->add("Cc" => $cc_string);
+    unless ($bad_email) {
+        my $msg = MIME::Lite->new(
+                     From    => $from,
+                     To      => $to,
+                     Subject => $subject,
+                     Type    =>'TEXT',
+                     Data    => $supportmsg,
+                     );
+        if ($homeserver) {
+            if (@ok_ccs > 0) {
+                my $cc_string = join(', ', at ok_ccs);
+                $msg->add("Cc" => $cc_string);
+            }
         }
-    }
-    if ($bcc ne '') {
-        $msg->add("Bcc" => $bcc);
-    }
-    $msg->attr("content-type"         => "text/plain");
-    $msg->attr("content-type.charset" => "UTF-8");
+        if ($bcc ne '') {
+            $msg->add("Bcc" => $bcc);
+        }
+        $msg->attr("content-type"         => "text/plain");
+        $msg->attr("content-type.charset" => "UTF-8");
 
-    if ($homeserver && $attachmentpath) {
-        my ($type, $encoding) = MIME::Types::by_suffix($attachmentpath);
-        $msg->attach(Type     => $type,
-                     Path     => $attachmentpath,
-                     Filename => $fname
-                     );
+        if ($homeserver && $attachmentpath) {
+            my ($type, $encoding) = MIME::Types::by_suffix($attachmentpath);
+            $msg->attach(Type     => $type,
+                         Path     => $attachmentpath,
+                         Filename => $fname
+                         );
 
-    } elsif ($attachment_text ne '') {
-        $msg->attach(Type => 'TEXT',
-                     Data => $attachment_text);
-    }
+        } elsif ($attachment_text ne '') {
+            $msg->attach(Type => 'TEXT',
+                         Data => $attachment_text);
+        }
 
-### Send it:
-    $msg->send('sendmail');
+        ### Send it:
+        $msg->send('sendmail');
+    }
 
     if ($attachmentpath =~ m|$Apache::lonnet::perlvar{'lonDaemons'}/tmp/helprequests/(\d+)/[^/]+|) {
         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;">'.
               &Apache::lonhtmlcommon::start_pick_box().
               &Apache::lonhtmlcommon::row_title($lt{'info'},undef,'LC_oddrow_value')."\n".$displaymsg."\n".




More information about the LON-CAPA-cvs mailing list