'.
+ &Apache::loncommon::end_page());
return;
}
}
- my @ENVvars = ('HTTP_HOST','HTTP_USER_AGENT','REMOTE_ADDR','SERVER_ADDR','SERVER_NAME');
+ 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 = ('browser.os','browser.type','browser.version','user.home','request.role');
my @loncvars = ('user.name','user.domain','request.course.sec','request.course.id');
my @cookievars;
@@ -693,25 +747,29 @@ sub print_request_receipt {
unless ($helpform{'phone'} eq 'no') {
$formvars{'phone'} = 1;
}
- unless ($helpform{'section'} eq 'no') {
+ unless (($helpform{'section'} eq 'no') || ($env{'request.lti.login'})) {
$formvars{'section'} = 1;
}
- unless ($helpform{'course'} eq 'no') {
+ unless (($helpform{'course'} eq 'no') || ($env{'request.lti.login'})) {
$formvars{'course'} = 1;
}
- unless ($helpform{'cc'} eq 'no') {
+ unless (($helpform{'cc'} eq 'no') || ($by_ip)) {
$formvars{'cc'} = 1;
}
unless ($helpform{'screenshot'} eq 'no') {
$formvars{'screenshot'} = 1;
}
- my $coursecode;
+ my ($coursecode,$sourceurl);
if ($formvars{'course'}) {
$coursecode = $env{'form.coursecode'};
if ($coursecode eq '') {
my $totcodes = 0;
- my %coursecodes;
- $totcodes = &Apache::courseclassifier::retrieve_instcodes(\%coursecodes,$defdom);
+ my $instcats = &Apache::lonnet::get_dom_instcats($defdom);
+ if (ref($instcats) eq 'HASH') {
+ if (ref($instcats->{'codes'}) eq 'HASH') {
+ $totcodes = scalar(keys(%{$instcats->{'codes'}}));
+ }
+ }
my @standardnames = &Apache::loncommon::get_standard_codeitems();
if ($totcodes > 0) {
my $noregexps = 1;
@@ -741,6 +799,8 @@ sub print_request_receipt {
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',
@@ -799,7 +859,15 @@ sub print_request_receipt {
$badccmsg .= ' '.&mt('The following Cc e-mail addresses are invalid: '). &Apache::loncommon::cleanup_html(join(', ',@bad_ccs));
}
}
- $env{'form.user'} = "'".$env{'form.uname'}.':'.$env{'form.udom'}."'";
+ if ($env{'request.lti.login'}) {
+ if (($env{'user.name'} ne '') && ($env{'user.domain'} ne '')) {
+ $env{'form.user'} = "'".$env{'user.name'}.':'.$env{'user.domain'}."'";
+ }
+ $sourceurl = &Apache::lonnet::absolute_url().$url;
+ } else {
+ $env{'form.user'} = "'".$env{'form.uname'}.':'.$env{'form.udom'}."'";
+ $sourceurl = $env{'form.sourceurl'};
+ }
if ($formvars{'course'}) {
$env{'form.crsi'} = $env{'form.title'};
if ($coursecode ne '') {
@@ -838,7 +906,7 @@ sub print_request_receipt {
}
$supportmsg .= "$lt{'subject'}: $env{'form.subject'}
$lt{'description'}: $env{'form.description'}
-$lt{'sourceurl'}: $env{'form.sourceurl'}
+$lt{'sourceurl'}: $sourceurl
$lt{'date'}: $reporttime
";
@@ -872,6 +940,7 @@ $lt{'date'}: $reporttime
next if ($helpform{$item} eq 'no');
}
next if (($item eq 'crsi') && ($helpform{'course'} eq 'no'));
+ next if (($item eq 'user') && ($env{'request.lti.login'}));
my $showitem = $env{'form.'.$item};
$showitem = &Apache::loncommon::cleanup_html($showitem);
$displaymsg .=
@@ -887,7 +956,7 @@ $lt{'date'}: $reporttime
$env{'form.'.$field} =~ s/\s+$//;
}
if ($env{'form.uname'} =~ /^$match_username$/) {
- $requdom = $env{'form.udom'};
+ $requname = $env{'form.uname'};
}
if ($env{'form.udom'} =~ /^$match_domain$/) {
$requdom = $env{'form.udom'};
@@ -909,18 +978,19 @@ $lt{'date'}: $reporttime
$displaymsg .= ''.
$lt{'date'}.': '.$reporttime.' '."\n";
-
- my $start_page =
- &Apache::loncommon::start_page('Support request recorded',undef,
- {'function' => $function,
- 'add_entries' => {
- topmargin => "0",
- marginheight => "0",
- },
- 'only_body' => 1,});
-
+ my $args = {'function' => $function,
+ 'add_entries' => {
+ topmargin => "0",
+ marginheight => "0",
+ },
+ 'only_body' => 1,};
+ (undef,undef,undef,my $clientmathml,my $clientunicode) =
+ &Apache::loncommon::decode_user_agent();
+ if ($clientunicode && !$clientmathml) {
+ $args->{'browser.unicode'} = 1;
+ }
+ $r->print(&Apache::loncommon::start_page('Support request recorded',undef,$args));
$r->print(<<"END");
-$start_page
@@ -960,17 +1030,19 @@ END
my $message;
if (!$bad_email) {
- $message = &Apache::lonhtmlcommon::confirm_success(
- &mt('A support request has been sent to [_1]',''.$to.''));
+ $message = &mt('A support request has been sent to [_1]',''.$to.'');
} else {
- $message = &Apache::lonhtmlcommon::confirm_success(
- $lt{'warn'}.' '
- .&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.',''.$to.'','','')
- .' '.&mt('Instead a copy has been sent to the LON-CAPA support team at Michigan State University.'),1);
- $to = 'helpdesk@lon-capa.org';
+ $message = $lt{'warn'}.' ';
+ 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.','','');
+ } 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.',''.$to.'','','');
+ }
+ }
+ $r->print('
');
+ if ($bad_email) {
+ $r->print(&Apache::loncommon::confirmwrapper(&Apache::lonhtmlcommon::confirm_success($message,$bad_email)).' ');
}
- $r->print(&Apache::loncommon::confirmwrapper($message));
-
if ($reqemail ne '') {
$from = $reqemail;
}
@@ -1024,6 +1096,18 @@ END
if ($$cookie{'lonLinkID'} =~ /lonLinkID=([a-f0-9]+_linked);/) {
$cookies{'lonLinkID'} = $1;
}
+ my $lti_info;
+ if (($env{'request.lti.login'}) && ($env{'request.course.id'})) {
+ my $ltidom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+ if ($ltidom) {
+ my %lti = &Apache::lonnet::get_domain_lti($ltidom,'provider');
+ if (ref($lti{$env{'request.lti.login'}}) eq 'HASH') {
+ if ($lti{$env{'request.lti.login'}}{'consumer'}) {
+ $lti_info = "LTI consumer: ".$lti{$env{'request.lti.login'}}{'consumer'}."\n";
+ }
+ }
+ }
+ }
if ($attachmentpath =~ m-/([^/]+)$-) {
$fname = $1;
$displaymsg .= ' '
@@ -1038,9 +1122,13 @@ END
foreach my $var(@ENVvars) {
$supportmsg .= "$var: $ENV{$var}\n";
}
+ $supportmsg .= "REMOTE_ADDR: $ip\n";
foreach my $var (@envvars) {
$supportmsg .= "$var: $env{$var}\n";
}
+ if ($lti_info) {
+ $supportmsg .= $lti_info;
+ }
}
my $cc_string;
@@ -1058,12 +1146,16 @@ END
foreach my $var (@ENVvars) {
$attachment_text .= "$var: $ENV{$var}\n";
}
+ $attachment_text .= "REMOTE_ADDR: $ip\n";
foreach my $var (@envvars) {
$attachment_text .= "$var: $env{$var}\n";
}
foreach my $var (@loncvars) {
$attachment_text .= "$var: $env{$var}\n";
}
+ if ($lti_info) {
+ $attachment_text .= $lti_info;
+ }
}
if ($addtext) {
@@ -1076,14 +1168,18 @@ END
}
}
- # Compose and send a MIME email
- &Apache::loncommon::mime_email($from, $to, $subject, $supportmsg, $cc_string, $bcc,
- $attachmentpath, $fname, $attachment_text);
-
+ if ($bad_email) {
+ $r->print(''.$lt{'belo'}.' '.
+ $lt{'ifyk'}."\n");
+ } else {
+ # Compose and send a MIME email
+ &Apache::loncommon::mime_email($from,'',$to,$subject,$supportmsg,$cc_string,
+ $bcc,$attachmentpath,$fname,$attachment_text);
+ $r->print(''.$lt{'your'}.':'."\n");
+ }
if ($attachmentpath =~ m|$Apache::lonnet::perlvar{'lonDaemons'}/tmp/helprequests/(\d+)/[^/]+|) {
unlink($attachmentpath);
}
- $r->print(''.$lt{'your'}.':
'."\n");
$r->print('
'.
&Apache::lonhtmlcommon::start_pick_box().
&Apache::lonhtmlcommon::row_title($lt{'info'},undef,'LC_oddrow_value')."\n".$displaymsg."\n".
@@ -1102,6 +1198,10 @@ END
$var.': '.$ENV{$var}.', ';
}
}
+ if ($ip ne '') {
+ $envmsg .= ''.
+ 'REMOTE_ADDR: '.$ip.', ';
+ }
foreach my $var (@envvars) {
if ($env{$var} ne '') {
$envmsg .= ''.
@@ -1112,7 +1212,11 @@ END
$r->print($envmsg."\n".
&Apache::lonhtmlcommon::row_closure(1)."\n".
&Apache::lonhtmlcommon::end_pick_box().
- "
|;
$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.');
@@ -1152,47 +1260,34 @@ sub print_header {
$loginhelp = '/adm/loginproblems.html';
}
$r->print(<<"END");
-