[LON-CAPA-cvs] cvs: loncom(version_2_12_X) /interface domainprefs.pm

raeburn raeburn at source.lon-capa.org
Sun Jan 12 13:26:16 EST 2025


raeburn		Sun Jan 12 18:26:16 2025 EDT

  Modified files:              (Branch: version_2_12_X)
    /loncom/interface	domainprefs.pm 
  Log:
  - For 2.12
    Backport 1.448, 1.449.
  
  
Index: loncom/interface/domainprefs.pm
diff -u loncom/interface/domainprefs.pm:1.447.2.1 loncom/interface/domainprefs.pm:1.447.2.2
--- loncom/interface/domainprefs.pm:1.447.2.1	Sat Jan 11 16:10:31 2025
+++ loncom/interface/domainprefs.pm	Sun Jan 12 18:26:16 2025
@@ -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 @@
         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 @@
             }
         } 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 @@
             }
             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 @@
                         }
                     }
                     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 @@
                                 $resulttext .= '<li>'.&mt('Institutional data will be used when creating a new user for: [_1]',
                                                           join(', ',map { $fieldtitles{$_}; } @{$confhash{$itemid}{'instdata'}})).'</li>';
                             } else {
-                                $resulttext .= '<li>'.&mt('No institutional data used when creating a new user.').'</li>';
+                                $resulttext .= '<li>'.&mt('No institutional data used when creating a new user').'</li>';
                             }
+                        } else {
+                            $resulttext .= '<li>'.&mt('No institutional data used when creating a new user').'</li>';
                         }
                         foreach my $item ('topmenu','inlinemenu') {
                             $resulttext .= '<li>'.$lt{$item}.': ';




More information about the LON-CAPA-cvs mailing list