[LON-CAPA-cvs] cvs: loncom /interface lonsupportreq.pm
raeburn
raeburn at source.lon-capa.org
Sun Jun 16 01:49:43 EDT 2019
raeburn Sun Jun 16 05:49:43 2019 EDT
Modified files:
/loncom/interface lonsupportreq.pm
Log:
- Course, section and URL fields not included in "Ask helpdesk" form when
LON-CAPA is LTI Provider. (LTI Consumer infoemation included instead).
Index: loncom/interface/lonsupportreq.pm
diff -u loncom/interface/lonsupportreq.pm:1.94 loncom/interface/lonsupportreq.pm:1.95
--- loncom/interface/lonsupportreq.pm:1.94 Sun Jun 16 05:33:45 2019
+++ loncom/interface/lonsupportreq.pm Sun Jun 16 05:49:43 2019
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Helpdesk request form
#
-# $Id: lonsupportreq.pm,v 1.94 2019/06/16 05:33:45 raeburn Exp $
+# $Id: lonsupportreq.pm,v 1.95 2019/06/16 05:49:43 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -395,7 +395,7 @@
}
}
}
- unless ($helpform{'user'} eq 'no') {
+ unless (($helpform{'user'} eq 'no') || ($env{'request.lti.login'})) {
$output .= &Apache::lonhtmlcommon::row_title("$html_lt{'unme'}/$html_lt{'doma'}",undef,$css[$i]);
my $udom_input = '<input type="hidden" name="udom" value="'.
&HTML::Entities::encode($udom,'"<>&').'" />'."\n";
@@ -432,12 +432,14 @@
}
$output .= &Apache::lonhtmlcommon::row_closure();
$num ++;
+ $i = $num%2;
+ }
+ unless ($env{'request.lti.login'}) {
+ $output .= &Apache::lonhtmlcommon::row_title("$html_lt{'urlp'}",undef,$css[$i]).
+ $server."\n".'<input type="hidden" name="sourceurl" value="'.
+ &HTML::Entities::encode($sourceurl,'"<>&').'" />'."\n".
+ &Apache::lonhtmlcommon::row_closure();
}
- $i = $num%2;
- $output .= &Apache::lonhtmlcommon::row_title("$html_lt{'urlp'}",undef,$css[$i]).
- $server."\n".'<input type="hidden" name="sourceurl" value="'.
- &HTML::Entities::encode($sourceurl,'"<>&').'" />'."\n".
- &Apache::lonhtmlcommon::row_closure();
unless ($helpform{'phone'} eq 'no') {
my $reqd;
if ($helpform{'phone'} eq 'req') {
@@ -449,7 +451,7 @@
$num ++;
$i = $num%2;
}
- unless ($helpform{'course'} eq 'no') {
+ unless (($helpform{'course'} eq 'no') || ($env{'request.lti.login'})) {
$output .= &Apache::lonhtmlcommon::row_title("$html_lt{'crsd'}$details_title",undef,$css[$i]);
if ($totcodes > 0) {
my $numtitles = @codetitles;
@@ -524,7 +526,7 @@
$num ++;
$i = $num%2;
}
- unless ($helpform{'section'} eq 'no') {
+ unless (($helpform{'section'} eq 'no') || ($env{'request.lti.login'})) {
$output .= &Apache::lonhtmlcommon::row_title($html_lt{'secn'},undef,$css[$i]);
if ($sectionlist) {
$output .= "<div id=\"LC_helpdesk_sectionlist\"><select name=\"sectionsel\">\n".
@@ -695,10 +697,10 @@
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') {
@@ -707,7 +709,7 @@
unless ($helpform{'screenshot'} eq 'no') {
$formvars{'screenshot'} = 1;
}
- my $coursecode;
+ my ($coursecode,$sourceurl);
if ($formvars{'course'}) {
$coursecode = $env{'form.coursecode'};
if ($coursecode eq '') {
@@ -801,7 +803,15 @@
$badccmsg .= '<br />'.&mt('The following Cc e-mail addresses are invalid: '). &Apache::loncommon::cleanup_html(join(', ', at 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 '') {
@@ -840,7 +850,7 @@
}
$supportmsg .= "$lt{'subject'}: $env{'form.subject'}
$lt{'description'}: $env{'form.description'}
-$lt{'sourceurl'}: $env{'form.sourceurl'}
+$lt{'sourceurl'}: $sourceurl
$lt{'date'}: $reporttime
";
@@ -874,6 +884,7 @@
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 .=
@@ -1026,6 +1037,18 @@
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 .= '<br />'
@@ -1043,6 +1066,9 @@
foreach my $var (@envvars) {
$supportmsg .= "$var: $env{$var}\n";
}
+ if ($lti_info) {
+ $supportmsg .= $lti_info;
+ }
}
my $cc_string;
@@ -1066,6 +1092,9 @@
foreach my $var (@loncvars) {
$attachment_text .= "$var: $env{$var}\n";
}
+ if ($lti_info) {
+ $attachment_text .= $lti_info;
+ }
}
if ($addtext) {
More information about the LON-CAPA-cvs
mailing list