[LON-CAPA-cvs] cvs: loncom /lti ltiutils.pm
raeburn
raeburn at source.lon-capa.org
Sat Aug 11 22:24:42 EDT 2018
raeburn Sun Aug 12 02:24:42 2018 EDT
Modified files:
/loncom/lti ltiutils.pm
Log:
- Bug 6754 LON-CAPA as LTI Provider
- create a real symb from the launch URL.
- calls to &sign_params() need to include 4 args before the fifth one
(params hashref).
Index: loncom/lti/ltiutils.pm
diff -u loncom/lti/ltiutils.pm:1.12 loncom/lti/ltiutils.pm:1.13
--- loncom/lti/ltiutils.pm:1.12 Wed May 30 17:22:30 2018
+++ loncom/lti/ltiutils.pm Sun Aug 12 02:24:42 2018
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Utility functions for managing LON-CAPA LTI interactions
#
-# $Id: ltiutils.pm,v 1.12 2018/05/30 17:22:30 raeburn Exp $
+# $Id: ltiutils.pm,v 1.13 2018/08/12 02:24:42 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -488,16 +488,18 @@
$scope = 'map';
$realuri = $tail;
} else {
- my ($map,$resid,$url) = &Apache::lonnet::decode_symb($tail);
+ my $symb = $tail;
+ $symb =~ s{^/}{};
+ my ($map,$resid,$url) = &Apache::lonnet::decode_symb($symb);
$realuri = &Apache::lonnet::clutter($url);
if ($url =~ /\.sequence$/) {
$scope = 'map';
} else {
$scope = 'resource';
- $realuri .= '?symb='.$tail;
- $passkey = $tail;
+ $realuri .= '?symb='.$symb;
+ $passkey = $symb;
if ($getunenc) {
- $unencsymb = $tail;
+ $unencsymb = $symb;
}
}
}
@@ -507,16 +509,18 @@
$scope = 'map';
$realuri = $tail;
} else {
- my ($map,$resid,$url) = &Apache::lonnet::decode_symb($tail);
+ my $symb = $tail;
+ $symb =~ s{^/?res/}{};
+ my ($map,$resid,$url) = &Apache::lonnet::decode_symb($symb);
$realuri = &Apache::lonnet::clutter($url);
if ($url =~ /\.sequence$/) {
$scope = 'map';
} else {
$scope = 'resource';
- $realuri .= '?symb='.$tail;
- $passkey = $tail;
+ $realuri .= '?symb='.$symb;
+ $passkey = $symb;
if ($getunenc) {
- $unencsymb = $tail;
+ $unencsymb = $symb;
}
}
}
@@ -562,7 +566,7 @@
} elsif (($tail =~ m{^/$cdom/$cnum$}) || ($tail eq '')) {
$scope = 'course';
$realuri = '/adm/navmaps';
- $passkey = $tail;
+ $passkey = '';
}
if ($scope eq 'map') {
$passkey = $realuri;
@@ -588,7 +592,7 @@
lti_message_type => 'basic-lis-readmembershipsforcontext',
ext_ims_lis_memberships_id => $id,
);
- my $hashref = &sign_params($url,$ckey,$secret,\%ltiparams);
+ my $hashref = &sign_params($url,$ckey,$secret,'',\%ltiparams);
if (ref($hashref) eq 'HASH') {
my $request=new HTTP::Request('POST',$url);
$request->content(join('&',map {
@@ -671,7 +675,7 @@
result_statusofresult => 'final',
result_date => $date,
);
- my $hashref = &sign_params($url,$ckey,$secret,\%ltiparams);
+ my $hashref = &sign_params($url,$ckey,$secret,'',\%ltiparams);
if (ref($hashref) eq 'HASH') {
my $request=new HTTP::Request('POST',$url);
$request->content(join('&',map {
More information about the LON-CAPA-cvs
mailing list