'.
+&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 not been sent to the LON-CAPA support staff or administrator at your institution.',$to).' '.&mt('Instead a copy has been sent to the LON-CAPA support team at Michigan State University.'));
$to = 'helpdesk@lon-capa.org';
+ } else {
+ $r->print('
'.$lt{'asup'}.' '.$to.'
');
+ }
+ if (defined($env{'form.email'})) {
+ $env{'form.email'} =~ s/^\s+//;
+ $env{'form.email'} =~ s/\s+$//;
+ if ($env{'form.email'} =~ m/^[^\@]+\@[^\@]+$/) {
+ $from = $env{'form.email'};
}
}
- if (defined($ENV{'form.email'})) {
- if ($ENV{'form.email'} =~ m/^[^\@]+\@[^\@]+$/) {
- $from = $ENV{'form.email'};
+
+ if (defined($env{'form.cc'})) {
+ if ($badccmsg) {
+ $displaymsg .= $badccmsg;
}
}
- my $subject = $ENV{'form.subject'};
- $subject =~ s#(`)#'#g;
- $subject =~ s#\$#\(\$\)#g;
- $supportmsg =~ s#(`)#'#g;
- $supportmsg =~ s#\$#\(\$\)#g;
- $displaymsg =~ s#(`)#'#g;
- $displaymsg =~ s#\$#\(\$\)#g;
+ my $subject = $env{'form.subject'};
+ $subject =~ s/(`)/'/g;
+ $subject =~ s/\$/\(\$\)/g;
+ $supportmsg =~ s/(`)/'/g;
+ $supportmsg =~ s/\$/\(\$\)/g;
+ $displaymsg =~ s/(`)/'/g;
+ $displaymsg =~ s/\$/\(\$\)/g;
my $fname;
my $attachmentpath = '';
my $attachmentsize = '';
- if (defined($ENV{'user.name'})) {
- if ($ENV{'form.screenshot.filename'}) {
- $attachmentsize = length($ENV{'form.screenshot'});
+ if (defined($env{'user.name'})) {
+ if ($env{'form.screenshot.filename'}) {
+ $attachmentsize = length($env{'form.screenshot'});
if ($attachmentsize > 131072) {
- $displaymsg .= " The uploaded screenshot file ($attachmentsize bytes) included with your request exceeded the maximum allowed size - 128 KB, and has therefore been discarded.";
+ $displaymsg .= ' '.&mt('The uploaded screenshot file ([_1] bytes) included with your request exceeded the maximum allowed size - 128 KB, and has therefore been discarded.',$attachmentsize);
} else {
$attachmentpath=&Apache::lonnet::userfileupload('screenshot',undef,'helprequests');
}
}
}
+ my %cookies;
+ my $cookie=CGI::Cookie->parse($r->header_in('Cookie'));
+ if ($$cookie{'lonID'} =~ /lonID=($LONCAPA::handle_re);/) {
+ $cookies{'lonID'} = $1;
+ }
+
if ($attachmentpath =~ m-/([^/]+)$-) {
$fname = $1;
- $displaymsg .= " An uploaded screenshot file - $fname ($attachmentsize bytes) was included in the request sent by $ENV{'user.name'} from LON-CAPA domain: $ENV{'user.domain'}";
+ $displaymsg .= ' '
+ .&mt('An uploaded screenshot file [_1] ([_2] bytes) was included in the request sent by [_3].'
+ ,''.$fname.''
+ ,$attachmentsize
+ ,$env{'user.name'}.':'.$env{'user.domain'}
+ );
$supportmsg .= "\n";
- foreach (@envvars) {
- $supportmsg .= "$_: $ENV{$_}\n";
+ foreach my $var (@cookievars) {
+ $supportmsg .= "$var: $cookies{$var}\n";
+ }
+ foreach my $var(@ENVvars) {
+ $supportmsg .= "$var: $ENV{$var}\n";
+ }
+ foreach my $var (@envvars) {
+ $supportmsg .= "$var: $env{$var}\n";
}
}
@@ -683,6 +709,10 @@ END
Type =>'TEXT',
Data => $supportmsg,
);
+ if (@ok_ccs > 0) {
+ my $cc_string = join(', ',@ok_ccs);
+ $msg->add("Cc" => $cc_string);
+ }
if ($attachmentpath) {
my ($type, $encoding) = MIME::Types::by_suffix($attachmentpath);
@@ -693,395 +723,128 @@ END
} else {
my $envdata = '';
- foreach (@envvars) {
- $envdata .= "$_: $ENV{$_}\n";
+ foreach my $var (@cookievars) {
+ $envdata .= "$var: $cookies{$var}\n";
+ }
+ foreach my $var (@ENVvars) {
+ $envdata .= "$var: $ENV{$var}\n";
+ }
+ foreach my $var (@envvars) {
+ $envdata .= "$var: $env{$var}\n";
}
- foreach (@loncvars) {
- $envdata .= "$_: $ENV{$_}\n";
+ foreach my $var (@loncvars) {
+ $envdata .= "$var: $env{$var}\n";
}
$msg->attach(Type => 'TEXT',
Data => $envdata);
}
### Send it:
- # ->send can cause an sh launch which can pass all of %ENV along
- # which can be to large for /bin/sh's little mind
- my %oldENV=%ENV;
- undef(%ENV);
$msg->send('sendmail');
- %ENV=%oldENV;
- undef(%oldENV);
- if ($attachmentpath =~ m#$Apache::lonnet::perlvar{'lonDaemons'}/tmp/helprequests/(\d+)/[^/]+#) {
+ if ($attachmentpath =~ m|$Apache::lonnet::perlvar{'lonDaemons'}/tmp/helprequests/(\d+)/[^/]+|) {
unlink($attachmentpath);
}
- $r->print(qq|
- Your support request contained the following information:
|;
+ $reviewtext = &mt('Please review the information in "Log-in help" and the "Getting started" guide if you are unable to log-in.');
+ } else {
+ $reviewtext = &mt('Please review the information in "Log-in help" if you are unable to log-in.');
}
- $r->print("
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ $r->print(<
+
+
+
+
+
+
+
+
+END
+ if ($command ne 'process') {
+ $r->print('
+
+
'.$reviewtext.' '
+.&mt('If your problem is still unresolved, the form below can be used to send a question to the LON-CAPA helpdesk.').' '
+.''.&mt('Students').': '.&mt('Do not use this form to ask questions about course content.').' '
+.&mt('Contact your instructor instead.')
+.'