Diff for /loncom/interface/domainprefs.pm between versions 1.446 and 1.447.2.4

version 1.446, 2024/12/31 18:51:53 version 1.447.2.4, 2025/01/14 13:20:29
Line 222  sub handler { Line 222  sub handler {
                 'coursedefaults','usersessions','loadbalancing',                  'coursedefaults','usersessions','loadbalancing',
                 'requestauthor','selfenrollment','inststatus',                  'requestauthor','selfenrollment','inststatus',
                 'ltitools','toolsec','ssl','trust','lti','ltisec',                  'ltitools','toolsec','ssl','trust','lti','ltisec',
                 'privacy','passwords','proctoring','wafproxy',                  'privacy','passwords','wafproxy',
                 'ipaccess','authordefaults'],$dom);                  'ipaccess','authordefaults'],$dom);
     my %encconfig =      my %encconfig =
         &Apache::lonnet::get_dom('encconfig',['ltitools','lti','proctoring','linkprot'],$dom,undef,1);          &Apache::lonnet::get_dom('encconfig',['ltitools','lti','linkprot'],$dom,undef,1);
     my ($checked_is_home,$is_home);      my ($checked_is_home,$is_home);
     if (ref($domconfig{'ltitools'}) eq 'HASH') {      if (ref($domconfig{'ltitools'}) eq 'HASH') {
         if (ref($encconfig{'ltitools'}) eq 'HASH') {          if (ref($encconfig{'ltitools'}) eq 'HASH') {
Line 288  sub handler { Line 288  sub handler {
             }              }
         }          }
     }      }
     if (ref($domconfig{'proctoring'}) eq 'HASH') {  
         if (ref($encconfig{'proctoring'}) eq 'HASH') {  
             foreach my $provider (keys(%{$domconfig{'proctoring'}})) {  
                 if ((ref($domconfig{'proctoring'}{$provider}) eq 'HASH') &&  
                     (ref($encconfig{'proctoring'}{$provider}) eq 'HASH')) {  
                     foreach my $item ('key','secret') {  
                         $domconfig{'proctoring'}{$provider}{$item} = $encconfig{'proctoring'}{$provider}{$item};  
                     }  
                 }  
             }  
         }  
     }  
     my @prefs_order = ('rolecolors','login','ipaccess','defaults','wafproxy','passwords',      my @prefs_order = ('rolecolors','login','ipaccess','defaults','wafproxy','passwords',
                        'quotas','autoenroll','autoupdate','autocreate','directorysrch',                         'quotas','autoenroll','autoupdate','autocreate','directorysrch',
                        'contacts','privacy','usercreation','selfcreation',                         'contacts','privacy','usercreation','selfcreation',
                        'usermodification','scantron','requestcourses','requestauthor',                         'usermodification','scantron','requestcourses','requestauthor',
                        'coursecategories','serverstatuses','helpsettings','coursedefaults',                         'coursecategories','serverstatuses','helpsettings','coursedefaults',
                        'authordefaults','ltitools','proctoring','selfenrollment',                         'authordefaults','ltitools','selfenrollment',
                        'usersessions','ssl','trust','lti');                         'usersessions','ssl','trust','lti');
     my %existing;      my %existing;
     if (ref($domconfig{'loadbalancing'}) eq 'HASH') {      if (ref($domconfig{'loadbalancing'}) eq 'HASH') {
Line 575  sub handler { Line 563  sub handler {
                   header => [{col1 => 'Role assigned in different domain',                    header => [{col1 => 'Role assigned in different domain',
                               col2 => 'Approval options'},                                col2 => 'Approval options'},
                              {col1 => 'Role assigned in different domain to user of type',                               {col1 => 'Role assigned in different domain to user of type',
                               col2 => 'User information available in that domain'},                                col2 => 'User information available in that domain'}],
                              {col1 => "Role assigned in user's domain",  
                               col2 => 'Information viewable by privileged user'},  
                              {col1 => "Role assigned in user's domain",  
                               col2 => 'Information viewable by unprivileged user'}],  
                   print => \&print_privacy,                    print => \&print_privacy,
                   modify => \&modify_privacy,                    modify => \&modify_privacy,
                  },                   },
Line 618  sub handler { Line 602  sub handler {
                   print => \&print_ltitools,                    print => \&print_ltitools,
                   modify => \&modify_ltitools,                    modify => \&modify_ltitools,
                  },                   },
         'proctoring' =>  
                  {text => 'Remote Proctoring Integration',  
                   help => 'Domain_Configuration_Proctoring',  
                   header => [{col1 => 'Name',  
                               col2 => 'Configuration'}],  
                   print => \&print_proctoring,  
                   modify => \&modify_proctoring,  
                  },  
         'ssl' =>          'ssl' =>
                  {text  => 'LON-CAPA Network (SSL)',                   {text  => 'LON-CAPA Network (SSL)',
                   help  => 'Domain_Configuration_Network_SSL',                    help  => 'Domain_Configuration_Network_SSL',
Line 887  sub process_changes { Line 863  sub process_changes {
         $output = &modify_loadbalancing($dom,%domconfig);          $output = &modify_loadbalancing($dom,%domconfig);
     } elsif ($action eq 'ltitools') {      } elsif ($action eq 'ltitools') {
         $output = &modify_ltitools($r,$dom,$action,$lastactref,%domconfig);          $output = &modify_ltitools($r,$dom,$action,$lastactref,%domconfig);
     } elsif ($action eq 'proctoring') {  
         $output = &modify_proctoring($r,$dom,$action,$lastactref,%domconfig);  
     } elsif ($action eq 'ssl') {      } elsif ($action eq 'ssl') {
         $output = &modify_ssl($dom,$lastactref,%domconfig);          $output = &modify_ssl($dom,$lastactref,%domconfig);
     } elsif ($action eq 'trust') {      } elsif ($action eq 'trust') {
Line 940  sub print_config_box { Line 914  sub print_config_box {
     } elsif ($action eq 'lti') {      } elsif ($action eq 'lti') {
         $output .= &passwords_javascript('ltisecrets')."\n".          $output .= &passwords_javascript('ltisecrets')."\n".
                    &lti_javascript($dom,$settings);                     &lti_javascript($dom,$settings);
     } elsif ($action eq 'proctoring') {  
         $output .= &proctoring_javascript($settings);  
     } elsif ($action eq 'wafproxy') {      } elsif ($action eq 'wafproxy') {
         $output .= &wafproxy_javascript($dom);          $output .= &wafproxy_javascript($dom);
     } elsif ($action eq 'autoupdate') {      } elsif ($action eq 'autoupdate') {
Line 1032  sub print_config_box { Line 1004  sub print_config_box {
             ($action eq 'selfcreation') || ($action eq 'selfenrollment') ||              ($action eq 'selfcreation') || ($action eq 'selfenrollment') ||
             ($action eq 'usersessions') || ($action eq 'coursecategories') ||               ($action eq 'usersessions') || ($action eq 'coursecategories') || 
             ($action eq 'trust') || ($action eq 'contacts') || ($action eq 'defaults') ||              ($action eq 'trust') || ($action eq 'contacts') || ($action eq 'defaults') ||
             ($action eq 'privacy') || ($action eq 'passwords') || ($action eq 'lti') ||              ($action eq 'passwords') || ($action eq 'lti') || ($action eq 'ltitools') ||
             ($action eq 'ltitools') || ($action eq 'usermodification')) {              ($action eq 'usermodification')) {
             if ($action eq 'coursecategories') {              if ($action eq 'coursecategories') {
                 $output .= &print_coursecategories('middle',$dom,$item,$settings,\$rowtotal);                  $output .= &print_coursecategories('middle',$dom,$item,$settings,\$rowtotal);
                 $colspan = ' colspan="2"';                  $colspan = ' colspan="2"';
Line 1103  sub print_config_box { Line 1075  sub print_config_box {
              </tr>'."\n";               </tr>'."\n";
                 if ($action eq 'coursecategories') {                  if ($action eq 'coursecategories') {
                     $output .= &print_coursecategories('bottom',$dom,$item,$settings,\$rowtotal);                      $output .= &print_coursecategories('bottom',$dom,$item,$settings,\$rowtotal);
                 } elsif (($action eq 'contacts') || ($action eq 'privacy') ||                   } elsif (($action eq 'contacts') || ($action eq 'passwords') || 
                          ($action eq 'passwords') || ($action eq 'lti')) {                           ($action eq 'lti')) {
                     if ($action eq 'passwords') {                      if ($action eq 'passwords') {
                         $output .= $item->{'print'}->('lower',$dom,$confname,$settings,\$rowtotal);                          $output .= $item->{'print'}->('lower',$dom,$confname,$settings,\$rowtotal);
                     } else {                      } else {
Line 1139  sub print_config_box { Line 1111  sub print_config_box {
             $rowtotal ++;              $rowtotal ++;
         } elsif (($action eq 'coursedefaults') || ($action eq 'authordefaults') ||          } elsif (($action eq 'coursedefaults') || ($action eq 'authordefaults') ||
                  ($action eq 'directorysrch') || ($action eq 'helpsettings') ||                   ($action eq 'directorysrch') || ($action eq 'helpsettings') ||
                  ($action eq 'wafproxy')) {                   ($action eq 'wafproxy') || ($action eq 'privacy')) {
             $output .= $item->{'print'}->('bottom',$dom,$settings,\$rowtotal);              $output .= $item->{'print'}->('bottom',$dom,$settings,\$rowtotal);
         } elsif ($action eq 'scantron') {          } elsif ($action eq 'scantron') {
             $output .= $item->{'print'}->($r,'bottom',$dom,$confname,$settings,\$rowtotal);              $output .= $item->{'print'}->($r,'bottom',$dom,$confname,$settings,\$rowtotal);
Line 1342  sub print_config_box { Line 1314  sub print_config_box {
             $output .= &print_quotas($dom,$settings,\$rowtotal,$action);              $output .= &print_quotas($dom,$settings,\$rowtotal,$action);
         } elsif (($action eq 'autoenroll') || ($action eq 'autocreate') ||           } elsif (($action eq 'autoenroll') || ($action eq 'autocreate') || 
                  ($action eq 'serverstatuses') || ($action eq 'loadbalancing') ||                    ($action eq 'serverstatuses') || ($action eq 'loadbalancing') || 
                  ($action eq 'proctoring') || ($action eq 'ipaccess')) {                   ($action eq 'ipaccess')) {
             $output .= $item->{'print'}->($dom,$settings,\$rowtotal);              $output .= $item->{'print'}->($dom,$settings,\$rowtotal);
         }          }
     }      }
Line 2009  sub commblocktype_text { Line 1981  sub commblocktype_text {
         'passwd' => 'Change Password',          'passwd' => 'Change Password',
         'grades' => 'Gradebook',          'grades' => 'Gradebook',
         'search' => 'Course search',          'search' => 'Course search',
           'index'  => 'Course content index',
         'wishlist' => 'Stored links',          'wishlist' => 'Stored links',
         'annotate' => 'Annotations',          'annotate' => 'Annotations',
     );      );
     my $typeorder = ['com','chat','boards','port','groups','blogs','about','wishlist','printout','grades','search','annotate','passwd'];      my $typeorder = ['com','chat','boards','port','groups','blogs','about','wishlist','printout','grades','search','index','annotate','passwd'];
     return ($typeorder,\%types);      return ($typeorder,\%types);
 }  }
   
Line 7812  sub print_privacy { Line 7785  sub print_privacy {
         ($othertitle,$usertypes,$types) =          ($othertitle,$usertypes,$types) =
             &Apache::loncommon::sorted_inst_types($dom);              &Apache::loncommon::sorted_inst_types($dom);
     }      }
     if (($position eq 'top') || ($position eq 'middle')) {      if (($position eq 'top') || ($position eq 'bottom')) {
         my (%by_ip,%by_location,@intdoms,@instdoms);          my (%by_ip,%by_location,@intdoms,@instdoms);
         &build_location_hashes(\@intdoms,\%by_ip,\%by_location,\@instdoms);          &build_location_hashes(\@intdoms,\%by_ip,\%by_location,\@instdoms);
         if ($position eq 'top') {          if ($position eq 'top') {
Line 7899  sub print_privacy { Line 7872  sub print_privacy {
                 $datatable .= &mt('Nothing to set here, as there are no other domains');                  $datatable .= &mt('Nothing to set here, as there are no other domains');
             }              }
             $datatable .='</td></tr>';              $datatable .='</td></tr>';
         } elsif ($position eq 'middle') {          } elsif ($position eq 'bottom') {
             if ((@instdoms > 1) || (keys(%by_location) > 0)) {              if ((@instdoms > 1) || (keys(%by_location) > 0)) {
                 if ((ref($types) eq 'ARRAY') && (ref($usertypes) eq 'HASH')) {                  if ((ref($types) eq 'ARRAY') && (ref($usertypes) eq 'HASH')) {
                     foreach my $item (@{$types}) {                      foreach my $item (@{$types}) {
Line 7936  sub print_privacy { Line 7909  sub print_privacy {
                 }                  }
             }              }
         }          }
     } else {  
         my $prefix;  
         if ($position eq 'lower') {  
             $prefix = 'priv';  
         } else {  
             $prefix = 'unpriv';  
         }  
         foreach my $item (@items) {  
             $datatable .= &modifiable_userdata_row('privacy',$prefix.'_'.$item,$settings,  
                                                    $numinrow,$itemcount,'','','','','',  
                                                    '',$names{$item});  
             $itemcount ++;  
         }  
     }      }
     if (ref($rowtotal)) {      if (ref($rowtotal)) {
         $$rowtotal += $itemcount;          $$rowtotal += $itemcount;
Line 12139  sub modifiable_userdata_row { Line 12099  sub modifiable_userdata_row {
         my $hashref;          my $hashref;
         if ($context eq 'lti') {          if ($context eq 'lti') {
             if (ref($settings) eq 'HASH') {              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') {          } elsif ($context eq 'privacy') {
             my ($key,$inner) = split(/_/,$role);              my ($key,$inner) = split(/_/,$role);
Line 12150  sub modifiable_userdata_row { Line 12114  sub modifiable_userdata_row {
             }              }
         } elsif (ref($settings->{$context}) eq 'HASH') {          } elsif (ref($settings->{$context}) eq 'HASH') {
             if (ref($settings->{$context}->{$role}) eq 'HASH') {              if (ref($settings->{$context}->{$role}) eq 'HASH') {
                 $hashref = $settings->{'lti_instdata'};                  $hashref = $settings->{$context}->{$role};
             }              }
             if ($role eq 'emailusername') {              if ($role eq 'emailusername') {
                 if ($statustype) {                  if ($statustype) {
Line 16086  sub modify_lti { Line 16050  sub modify_lti {
             }              }
             my @possinstdata =  &Apache::loncommon::get_env_multiple('form.lti_instdata_'.$idx);              my @possinstdata =  &Apache::loncommon::get_env_multiple('form.lti_instdata_'.$idx);
             if (@possinstdata) {              if (@possinstdata) {
                 foreach my $field (@possinstdata) {                  foreach my $field (sort(@possinstdata)) {
                     if (exists($fieldtitles{$field})) {                      if (exists($fieldtitles{$field})) {
                         push(@{$confhash{$itemid}{'instdata'}});                          push(@{$confhash{$itemid}{'instdata'}},$field);
                     }                      }
                 }                  }
             }              }
Line 16250  sub modify_lti { Line 16214  sub modify_lti {
                         }                          }
                     }                      }
                     unless ($changes{$itemid}) {                      unless ($changes{$itemid}) {
                         foreach my $field ('makeuser','lcmenu') {                          foreach my $field ('makeuser','lcmenu','instdata') {
                             if (ref($currlti{$field}) eq 'ARRAY') {                              if (ref($currlti{$field}) eq 'ARRAY') {
                                 if (ref($confhash{$itemid}{$field}) eq 'ARRAY') {                                  if (ref($confhash{$itemid}{$field}) eq 'ARRAY') {
                                     my @diffs = &Apache::loncommon::compare_arrays($currlti{$field},                                      my @diffs = &Apache::loncommon::compare_arrays($currlti{$field},
Line 16464  sub modify_lti { Line 16428  sub modify_lti {
                                 $resulttext .= '<li>'.&mt('Institutional data will be used when creating a new user for: [_1]',                                  $resulttext .= '<li>'.&mt('Institutional data will be used when creating a new user for: [_1]',
                                                           join(', ',map { $fieldtitles{$_}; } @{$confhash{$itemid}{'instdata'}})).'</li>';                                                            join(', ',map { $fieldtitles{$_}; } @{$confhash{$itemid}{'instdata'}})).'</li>';
                             } else {                              } 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') {                          foreach my $item ('topmenu','inlinemenu') {
                             $resulttext .= '<li>'.$lt{$item}.':&nbsp;';                              $resulttext .= '<li>'.$lt{$item}.':&nbsp;';
Line 17927  sub modify_privacy { Line 17893  sub modify_privacy {
                                        extdom  => {},                                         extdom  => {},
                                      },                                       },
                        'othdom'   => {},                         'othdom'   => {},
                        'priv'     => {},  
                        'unpriv'   => {},  
                       );                        );
     foreach my $item (@items) {      foreach my $item (@items) {
         if (@instdoms > 1) {          if (@instdoms > 1) {
Line 17959  sub modify_privacy { Line 17923  sub modify_privacy {
                 $changes{'approval'} = 1;                  $changes{'approval'} = 1;
             }              }
         }          }
         foreach my $status ('priv','unpriv') {  
             my @possibles = sort(&Apache::loncommon::get_env_multiple('form.privacy_'.$status.'_'.$item));  
             my @newvalues;  
             foreach my $field (@possibles) {  
                 if (grep(/^\Q$field\E$/,@fields)) {  
                     $privacyhash{$status}{$item}{$field} = 1;  
                     push(@newvalues,$field);  
                 }  
             }  
             @newvalues = sort(@newvalues);  
             if (ref($current{$status}) eq 'HASH') {  
                 if (ref($current{$status}{$item}) eq 'HASH') {  
                     my @currvalues = sort(keys(%{$current{$status}{$item}}));  
                     my @diffs = &Apache::loncommon::compare_arrays(\@currvalues,\@newvalues);  
                     if (@diffs > 0) {  
                         $changes{$status} = 1;  
                     }  
                 }  
             } else {  
                 my @stdfields;  
                 foreach my $field (@fields) {  
                     if ($field eq 'id') {  
                         next if ($status eq 'unpriv');  
                         next if (($status eq 'priv') && ($item eq 'community'));  
                     }  
                     push(@stdfields,$field);  
                 }  
                 my @diffs = &Apache::loncommon::compare_arrays(\@stdfields,\@newvalues);  
                 if (@diffs > 0) {  
                     $changes{$status} = 1;  
                 }  
             }  
         }  
     }      }
     if ((@instdoms > 1) || (keys(%by_location) > 0)) {      if ((@instdoms > 1) || (keys(%by_location) > 0)) {
         my @statuses;          my @statuses;
Line 18015  sub modify_privacy { Line 17946  sub modify_privacy {
                     if (@diffs > 0) {                      if (@diffs > 0) {
                         $changes{'othdom'} = 1;                          $changes{'othdom'} = 1;
                     }                      }
                   } elsif (@newvalues > 0) {
                       $changes{'othdom'} = 1;
                 }                  }
             } else {              } else {
                 my @stdfields = ('lastname','firstname','middlename','generation','permanentemail');                  my @stdfields = ('lastname','firstname','middlename','generation','permanentemail');
Line 18044  sub modify_privacy { Line 17977  sub modify_privacy {
     if ($putresult eq 'ok') {      if ($putresult eq 'ok') {
         if (keys(%changes) > 0) {          if (keys(%changes) > 0) {
             $resulttext = &mt('Changes made: ').'<ul>';              $resulttext = &mt('Changes made: ').'<ul>';
             foreach my $key ('approval','notify','othdom','priv','unpriv') {              foreach my $key ('approval','notify','othdom') {
                 if ($changes{$key}) {                  if ($changes{$key}) {
                     $resulttext .= '<li>'.$titles{$key}.':<ul>';                      $resulttext .= '<li>'.$titles{$key}.':<ul>';
                     if ($key eq 'approval') {                      if ($key eq 'approval') {
Line 18094  sub modify_privacy { Line 18027  sub modify_privacy {
                                 }                                  }
                                 $resulttext .= '</li>';                                  $resulttext .= '</li>';
                             }                              }
                         }  
                     } else {  
                         foreach my $item (@items) {  
                             if (ref($privacyhash{$key}{$item}) eq 'HASH') {  
                                 $resulttext .= '<li>'.$names{$item}.': ';  
                                 if (keys(%{$privacyhash{$key}{$item}})) {  
                                     $resulttext .= join(', ', map { $fieldnames{$_}; } (sort(keys(%{$privacyhash{$key}{$item}}))));  
                                 } else {  
                                     $resulttext .= &mt('none');  
                                 }  
                                 $resulttext .= '</li>';  
                             }  
                         }                          }
                     }                      }
                     $resulttext .= '</ul></li>';                      $resulttext .= '</ul></li>';

Removed from v.1.446  
changed lines
  Added in v.1.447.2.4


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>