[LON-CAPA-cvs] cvs: loncom /homework lonhomework.pm structuretags.pm
raeburn
raeburn at source.lon-capa.org
Sat Jan 13 07:07:13 EST 2024
raeburn Sat Jan 13 12:07:13 2024 EDT
Modified files:
/loncom/homework structuretags.pm lonhomework.pm
Log:
- Bugs 6907 -- Return of grades to launcher CMS for resources or folders
accessed via LTI-mediated deep link.
- For deeplink parameter: scope is res, map, or rec, but equivalent pbscope
get_lti_score() is resource, nonrec, or map.
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.582 loncom/homework/structuretags.pm:1.583
--- loncom/homework/structuretags.pm:1.582 Tue Nov 28 04:48:15 2023
+++ loncom/homework/structuretags.pm Sat Jan 13 12:07:13 2024
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# definition of tags that give a structure to a document
#
-# $Id: structuretags.pm,v 1.582 2023/11/28 04:48:15 raeburn Exp $
+# $Id: structuretags.pm,v 1.583 2024/01/13 12:07:13 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1439,20 +1439,25 @@
$lti_in_use = $domlti{$itemnum};
}
my ($state,$others,$listed,$scope,$protect,$display,$target,$exit) = split(/,/,$deeplink);
- my $passback;
- if ($scope eq 'resource') {
+ my ($passback,$pbscope);
+ if ($scope eq 'res') {
if ($deeplink_symb eq $symb) {
$passback = 1;
+ $pbscope = 'resource';
}
} elsif ($scope eq 'map') {
if (&Apache::lonnet::clutter($deeplink_map) eq $map) {
$passback = 1;
+ $pbscope = 'nonrec';
+ }
+ } elsif ($scope eq 'rec') {
+ my @recurseup = &get_map_hierarchy($map,$env{'request.course.id'});
+ if (grep(/^\Q$deeplink_map\E$/, at recurseup)) {
+ $passback = 1;
+ $pbscope = 'map';
}
- } elsif ($scope eq 'recurse') {
-#FIXME check if $deeplink_map contains $map
- $passback = 1;
}
- return ($passback,$scope,$deeplink_map,$deeplink_symb,$crsdef,$itemnum,$lti_in_use);
+ return ($passback,$pbscope,$deeplink_map,$deeplink_symb,$crsdef,$itemnum,$lti_in_use);
}
}
}
Index: loncom/homework/lonhomework.pm
diff -u loncom/homework/lonhomework.pm:1.381 loncom/homework/lonhomework.pm:1.382
--- loncom/homework/lonhomework.pm:1.381 Mon Nov 27 22:44:20 2023
+++ loncom/homework/lonhomework.pm Sat Jan 13 12:07:13 2024
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Homework handler
#
-# $Id: lonhomework.pm,v 1.381 2023/11/27 22:44:20 raeburn Exp $
+# $Id: lonhomework.pm,v 1.382 2024/01/13 12:07:13 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -2000,8 +2000,8 @@
if ($scope eq 'resource') {
$total = $item->{'total'};
$possible = $item->{'possible'};
- } elsif ($scope eq 'map') {
- ($total,$possible) = &get_lti_score($uname,$udom,$map);
+ } elsif (($scope eq 'map') || ($scope eq 'nonrec')) {
+ ($total,$possible) = &get_lti_score($uname,$udom,$map,$scope);
} elsif ($scope eq 'course') {
($total,$possible) = &get_lti_score($uname,$udom);
}
@@ -2016,7 +2016,7 @@
}
sub get_lti_score {
- my ($uname,$udom,$mapurl) = @_;
+ my ($uname,$udom,$mapurl,$scope) = @_;
my $navmap = Apache::lonnavmaps::navmap->new($uname,$udom);
if (ref($navmap)) {
my $iterator;
@@ -2024,7 +2024,11 @@
my $map = $navmap->getResourceByUrl($mapurl);
my $firstres = $map->map_start();
my $finishres = $map->map_finish();
- $iterator = $navmap->getIterator($firstres,$finishres,undef,1);
+ my $recursive = 1;
+ if ($scope eq 'nonrec') {
+ $recursive = 0;
+ }
+ $iterator = $navmap->getIterator($firstres,$finishres,undef,$recursive);
} else {
$iterator = $navmap->getIterator(undef,undef,undef,1);
}
More information about the LON-CAPA-cvs
mailing list