--- loncom/interface/domainprefs.pm 2025/01/11 16:10:31 1.447.2.1 +++ loncom/interface/domainprefs.pm 2025/01/12 18:26:16 1.447.2.2 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set domain-wide configuration settings # -# $Id: domainprefs.pm,v 1.447.2.1 2025/01/11 16:10:31 raeburn Exp $ +# $Id: domainprefs.pm,v 1.447.2.2 2025/01/12 18:26:16 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -12116,7 +12116,11 @@ sub modifiable_userdata_row { my $hashref; if ($context eq 'lti') { if (ref($settings) eq 'HASH') { - $hashref = $settings->{'instdata'}; + my %instdata; + if (ref($settings->{'instdata'}) eq 'ARRAY') { + map { $instdata{$_} = 1; } @{$settings->{'instdata'}}; + } + $hashref = \%instdata; } } elsif ($context eq 'privacy') { my ($key,$inner) = split(/_/,$role); @@ -12127,7 +12131,7 @@ sub modifiable_userdata_row { } } elsif (ref($settings->{$context}) eq 'HASH') { if (ref($settings->{$context}->{$role}) eq 'HASH') { - $hashref = $settings->{'lti_instdata'}; + $hashref = $settings->{$context}->{$role}; } if ($role eq 'emailusername') { if ($statustype) { @@ -16063,9 +16067,9 @@ sub modify_lti { } my @possinstdata = &Apache::loncommon::get_env_multiple('form.lti_instdata_'.$idx); if (@possinstdata) { - foreach my $field (@possinstdata) { + foreach my $field (sort(@possinstdata)) { if (exists($fieldtitles{$field})) { - push(@{$confhash{$itemid}{'instdata'}}); + push(@{$confhash{$itemid}{'instdata'}},$field); } } } @@ -16227,7 +16231,7 @@ sub modify_lti { } } unless ($changes{$itemid}) { - foreach my $field ('makeuser','lcmenu') { + foreach my $field ('makeuser','lcmenu','instdata') { if (ref($currlti{$field}) eq 'ARRAY') { if (ref($confhash{$itemid}{$field}) eq 'ARRAY') { my @diffs = &Apache::loncommon::compare_arrays($currlti{$field}, @@ -16441,8 +16445,10 @@ sub modify_lti { $resulttext .= '
  • '.&mt('Institutional data will be used when creating a new user for: [_1]', join(', ',map { $fieldtitles{$_}; } @{$confhash{$itemid}{'instdata'}})).'
  • '; } else { - $resulttext .= '
  • '.&mt('No institutional data used when creating a new user.').'
  • '; + $resulttext .= '
  • '.&mt('No institutional data used when creating a new user').'
  • '; } + } else { + $resulttext .= '
  • '.&mt('No institutional data used when creating a new user').'
  • '; } foreach my $item ('topmenu','inlinemenu') { $resulttext .= '
  • '.$lt{$item}.': ';