Diff for /loncom/interface/domainprefs.pm between versions 1.425 and 1.427

version 1.425, 2023/06/03 19:18:11 version 1.427, 2023/06/20 14:03:52
Line 568  sub handler { Line 568  sub handler {
                   modify => \&modify_selfenrollment,                    modify => \&modify_selfenrollment,
                  },                   },
         'privacy' =>           'privacy' => 
                  {text   => 'Availability of User Information',                   {text   => 'Role assignments and user privacy',
                   help   => 'Domain_Configuration_User_Privacy',                    help   => 'Domain_Configuration_User_Privacy',
                   header => [{col1 => 'Role assigned in different domain',                    header => [{col1 => 'Role assigned in different domain',
                               col2 => 'Approval options'},                                col2 => 'Approval options'},
Line 882  sub process_changes { Line 882  sub process_changes {
     } elsif ($action eq 'lti') {      } elsif ($action eq 'lti') {
         $output = &modify_lti($r,$dom,$action,$lastactref,%domconfig);          $output = &modify_lti($r,$dom,$action,$lastactref,%domconfig);
     } elsif ($action eq 'privacy') {      } elsif ($action eq 'privacy') {
         $output = &modify_privacy($dom,%domconfig);          $output = &modify_privacy($dom,$lastactref,%domconfig);
     } elsif ($action eq 'passwords') {      } elsif ($action eq 'passwords') {
         $output = &modify_passwords($r,$dom,$confname,$lastactref,%domconfig);          $output = &modify_passwords($r,$dom,$confname,$lastactref,%domconfig);
     } elsif ($action eq 'wafproxy') {      } elsif ($action eq 'wafproxy') {
Line 6782  sub ltimenu_titles { Line 6782  sub ltimenu_titles {
     );      );
 }  }
   
 sub check_switchserver {  
     my ($home) = @_;  
     my $switchserver;  
     if ($home ne '') {  
         my $allowed;  
         my @ids=&Apache::lonnet::current_machine_ids();  
         foreach my $id (@ids) { if ($id eq $home) { $allowed=1; } }  
         if (!$allowed) {  
             $switchserver='<a href="/adm/switchserver?otherserver='.$home.'&amp;role='.  
                           &HTML::Entities::encode($env{'request.role'},'\'<>"&').  
                           '&amp;destinationurl=/adm/domainprefs">'.&mt('Switch Server').'</a>';  
         }  
     }  
     return $switchserver;  
 }  
   
 sub print_coursedefaults {  sub print_coursedefaults {
     my ($position,$dom,$settings,$rowtotal) = @_;      my ($position,$dom,$settings,$rowtotal) = @_;
     my ($css_class,$datatable,%checkedon,%checkedoff,%defaultchecked,@toggles);      my ($css_class,$datatable,%checkedon,%checkedoff,%defaultchecked,@toggles);
Line 11715  sub modifiable_userdata_row { Line 11699  sub modifiable_userdata_row {
               '<td class="LC_left_item" colspan="2"><table>';                '<td class="LC_left_item" colspan="2"><table>';
     my $rem;      my $rem;
     my %checks;      my %checks;
     my %current;  
     if (ref($settings) eq 'HASH') {      if (ref($settings) eq 'HASH') {
         my $hashref;          my $hashref;
         if ($context eq 'lti') {          if ($context eq 'lti') {
Line 13492  sub check_switchserver { Line 13475  sub check_switchserver {
     my @ids=&Apache::lonnet::current_machine_ids();      my @ids=&Apache::lonnet::current_machine_ids();
     foreach my $id (@ids) { if ($id eq $home) { $allowed=1; } }      foreach my $id (@ids) { if ($id eq $home) { $allowed=1; } }
     if (!$allowed) {      if (!$allowed) {
  $switchserver='<a href="/adm/switchserver?otherserver='.$home.'&amp;role=dc./'.$dom.'/&amp;destinationurl=/adm/domainprefs">'.&mt('Switch Server').'</a>';   $switchserver='<a href="/adm/switchserver?otherserver='.$home.'&amp;role='.
                         &HTML::Entities::encode($env{'request.role'},'\'<>"&').
                         '&amp;destinationurl=/adm/domainprefs">'.&mt('Switch Server').'</a>';
     }      }
     return $switchserver;      return $switchserver;
 }  }
Line 17111  sub modify_contacts { Line 17096  sub modify_contacts {
 }  }
   
 sub modify_privacy {  sub modify_privacy {
     my ($dom,%domconfig) = @_;      my ($dom,$lastactref,%domconfig) = @_;
     my ($resulttext,%current,%changes);      my ($resulttext,%current,%changes);
     if (ref($domconfig{'privacy'}) eq 'HASH') {      if (ref($domconfig{'privacy'}) eq 'HASH') {
         %current = %{$domconfig{'privacy'}};          %current = %{$domconfig{'privacy'}};
Line 17347  sub modify_privacy { Line 17332  sub modify_privacy {
                 }                  }
             }              }
             $resulttext .= '</ul>';              $resulttext .= '</ul>';
               if ($changes{'approval'}) {
                   my %domdefaults = &Apache::lonnet::get_domain_defaults($dom);
                   delete($domdefaults{'userapprovals'});
                   if (ref($privacyhash{'approval'}) eq 'HASH') {
                       foreach my $domtype ('instdom','extdom') {
                           if (ref($privacyhash{'approval'}{$domtype}) eq 'HASH') {
                               foreach my $roletype ('domain','author','course','community') {
                                   if ($privacyhash{'approval'}{$domtype}{$roletype} eq 'user') {
                                       $domdefaults{'userapprovals'} = 1;
                                       last;
                                   }
                               }
                           }
                           last if ($domdefaults{'userapprovals'});               
                       }
                   }
                   my $cachetime = 24*60*60;
                   &Apache::lonnet::do_cache_new('domdefaults',$dom,\%domdefaults,$cachetime);
                   if (ref($lastactref) eq 'HASH') {
                       $lastactref->{'domdefaults'} = 1;
                   }
               }
         } else {          } else {
             $resulttext = &mt('No changes made to user information settings');              $resulttext = &mt('No changes made to user information settings');
         }          }

Removed from v.1.425  
changed lines
  Added in v.1.427


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