--- loncom/interface/lonsupportreq.pm 2017/01/23 19:49:07 1.89
+++ loncom/interface/lonsupportreq.pm 2017/10/13 20:37:35 1.93
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Helpdesk request form
#
-# $Id: lonsupportreq.pm,v 1.89 2017/01/23 19:49:07 raeburn Exp $
+# $Id: lonsupportreq.pm,v 1.93 2017/10/13 20:37:35 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -657,14 +657,16 @@ sub print_request_receipt {
my @ENVvars = ('HTTP_HOST','HTTP_USER_AGENT','REMOTE_ADDR','SERVER_ADDR','SERVER_NAME');
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 @cookievars = ('lonID');
+ my @cookievars;
+ if ($ENV{'SERVER_PORT'} == 443) {
+ @cookievars = ('lonLinkID');
+ } else {
+ @cookievars = ('lonID');
+ }
my $admin = $Apache::lonnet::perlvar{'lonAdminMail'};
my $origmail = $Apache::lonnet::perlvar{'lonSupportEMail'};
my $defdom = &get_domain();
- my ($to,$bcc,$addtext) =
- &Apache::loncommon::build_recipient_list(undef,'helpdeskmail',
- $defdom,$origmail);
my $from = $admin;
my %helpform;
my %domconfig =
@@ -878,6 +880,33 @@ $lt{'date'}: $reporttime
}
}
}
+
+ my ($requname,$requdom,$reqemail);
+ foreach my $field ('uname','udom','email') {
+ $env{'form.'.$field} =~ s/^\s+//;
+ $env{'form.'.$field} =~ s/\s+$//;
+ }
+ if ($env{'form.uname'} =~ /^$match_username$/) {
+ $requdom = $env{'form.udom'};
+ }
+ if ($env{'form.udom'} =~ /^$match_domain$/) {
+ $requdom = $env{'form.udom'};
+ }
+ if ($env{'form.email'} =~ m/^[^\@]+\@[^\@]+$/) {
+ $reqemail = $env{'form.email'};
+ }
+
+ my $dom_in_effect;
+ unless ($env{'user.domain'} eq 'public') {
+ $dom_in_effect = $env{'user.domain'};
+ }
+ if ($dom_in_effect eq '') {
+ $dom_in_effect = $requdom;
+ }
+ if ($dom_in_effect eq '') {
+ $dom_in_effect = $defdom;
+ }
+
$displaymsg .= ''.
$lt{'date'}.': '.$reporttime.'
'."\n";
@@ -900,6 +929,11 @@ END
&print_header($r,$url,'process');
}
my $bad_email = 0;
+ my ($to,$bcc,$addtext) =
+ &Apache::loncommon::build_recipient_list(undef,'helpdeskmail',
+ $dom_in_effect,$origmail,
+ $requname,$requdom,
+ $reqemail);
if ($to =~ /,/) {
my @ok_email;
foreach my $email (split(/,/,$to)) {
@@ -937,12 +971,8 @@ END
}
$r->print(&Apache::loncommon::confirmwrapper($message));
- 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 ($reqemail ne '') {
+ $from = $reqemail;
}
if (defined($env{'form.cc'})) {
@@ -991,7 +1021,9 @@ END
if ($$cookie{'lonID'} =~ /lonID=($LONCAPA::handle_re);/) {
$cookies{'lonID'} = $1;
}
-
+ if ($$cookie{'lonLinkID'} =~ /lonLinkID=([a-f0-9]+_linked);/) {
+ $cookies{'lonLinkID'} = $1;
+ }
if ($attachmentpath =~ m-/([^/]+)$-) {
$fname = $1;
$displaymsg .= '
'
@@ -1018,22 +1050,20 @@ END
}
}
- my $attachment_text;
+ my $attachment_text = '';
unless ($homeserver && $attachmentpath) {
- my $envdata = '';
foreach my $var (@cookievars) {
- $envdata .= "$var: $cookies{$var}\n";
+ $attachment_text .= "$var: $cookies{$var}\n";
}
foreach my $var (@ENVvars) {
- $envdata .= "$var: $ENV{$var}\n";
+ $attachment_text .= "$var: $ENV{$var}\n";
}
foreach my $var (@envvars) {
- $envdata .= "$var: $env{$var}\n";
+ $attachment_text .= "$var: $env{$var}\n";
}
foreach my $var (@loncvars) {
- $envdata .= "$var: $env{$var}\n";
+ $attachment_text .= "$var: $env{$var}\n";
}
- $attachment_text = $envdata;
}
if ($addtext) {