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

raeburn raeburn at source.lon-capa.org
Sun Jan 12 11:23:33 EST 2025


raeburn		Sun Jan 12 16:23:33 2025 EDT

  Modified files:              
    /loncom/interface	domainprefs.pm 
  Log:
  - Bug 6754 LON-CAPA as LTI Provider
    Display current settings for "Institutional data used (if available)" in
    "New user accounts created for LTI users" panel, and display updates when
    changes are made, and this is the only change in the configuration for an
    existing Consumer definition.
  
  
Index: loncom/interface/domainprefs.pm
diff -u loncom/interface/domainprefs.pm:1.448 loncom/interface/domainprefs.pm:1.449
--- loncom/interface/domainprefs.pm:1.448	Sun Jan 12 16:10:23 2025
+++ loncom/interface/domainprefs.pm	Sun Jan 12 16:23:33 2025
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set domain-wide configuration settings
 #
-# $Id: domainprefs.pm,v 1.448 2025/01/12 16:10:23 raeburn Exp $
+# $Id: domainprefs.pm,v 1.449 2025/01/12 16:23:33 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -12140,7 +12140,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);
@@ -16087,9 +16091,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);
                     }
                 }
             }
@@ -16251,7 +16255,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},
@@ -16465,8 +16469,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