[LON-CAPA-cvs] cvs: loncom /interface domainprefs.pm
raeburn
raeburn at source.lon-capa.org
Mon Nov 22 17:19:58 EST 2021
raeburn Mon Nov 22 22:19:58 2021 EDT
Modified files:
/loncom/interface domainprefs.pm
Log:
- Sanity checking in LTI Provider configuration, and retrieve correct form
item to update ordering of available providers.
Index: loncom/interface/domainprefs.pm
diff -u loncom/interface/domainprefs.pm:1.389 loncom/interface/domainprefs.pm:1.390
--- loncom/interface/domainprefs.pm:1.389 Wed Nov 3 13:49:57 2021
+++ loncom/interface/domainprefs.pm Mon Nov 22 22:19:58 2021
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set domain-wide configuration settings
#
-# $Id: domainprefs.pm,v 1.389 2021/11/03 13:49:57 raeburn Exp $
+# $Id: domainprefs.pm,v 1.390 2021/11/22 22:19:58 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -3177,14 +3177,16 @@
return $togglejs;
}
my (%ordered,$total,%jstext);
- $total = 0;
+ $total = scalar(keys(%{$settings}));
foreach my $item (keys(%{$settings})) {
if (ref($settings->{$item}) eq 'HASH') {
my $num = $settings->{$item}{'order'};
+ if ($num eq '') {
+ $num = $total - 1;
+ }
$ordered{$num} = $item;
}
}
- $total = scalar(keys(%{$settings}));
my @jsarray = ();
foreach my $item (sort {$a <=> $b } (keys(%ordered))) {
push(@jsarray,$ordered{$item});
@@ -5937,6 +5939,9 @@
foreach my $item (keys(%{$settings})) {
if (ref($settings->{$item}) eq 'HASH') {
my $num = $settings->{$item}{'order'};
+ if ($num eq '') {
+ $num = scalar(keys(%{$settings}));
+ }
$ordered{$num} = $item;
}
}
@@ -14747,15 +14752,15 @@
map { $deletions{$_} = 1; } @todelete;
}
my $maxnum = $env{'form.lti_maxnum'};
- for (my $i=0; $i<=$maxnum; $i++) {
+ for (my $i=0; $i<$maxnum; $i++) {
my $itemid = $env{'form.lti_id_'.$i};
$itemid =~ s/\D+//g;
if (ref($domconfig{$action}{$itemid}) eq 'HASH') {
if ($deletions{$itemid}) {
$changes{$itemid} = $domconfig{$action}{$itemid}{'consumer'};
} else {
- push(@items,$i);
- $itemids{$i} = $itemid;
+ push(@items,$i);
+ $itemids{$i} = $itemid;
}
}
}
@@ -14763,7 +14768,7 @@
foreach my $idx (@items) {
my $itemid = $itemids{$idx};
next unless ($itemid);
- my $position = $env{'form.lti_pos_'.$idx};
+ my $position = $env{'form.lti_pos_'.$itemid};
$position =~ s/\D+//g;
if ($position ne '') {
$allpos[$position] = $itemid;
@@ -15026,7 +15031,7 @@
if (ref($confhash{$itemid}) ne 'HASH') {
$resulttext .= '<li>'.&mt('Deleted: [_1]',$changes{$itemid}).'</li>';
} else {
- $resulttext .= '<li><b>'.$confhash{$itemid}{'consumer'}.'</b></li><ul>';
+ $resulttext .= '<li><b>'.$confhash{$itemid}{'consumer'}.'</b><ul>';
my $position = $pos + 1;
$resulttext .= '<li>'.&mt('Order: [_1]',$position).'</li>';
foreach my $item ('version','lifetime') {
More information about the LON-CAPA-cvs
mailing list