Diff for /loncom/interface/domainprefs.pm between versions 1.441 and 1.449

version 1.441, 2024/05/21 02:57:15 version 1.449, 2025/01/12 16:23:33
Line 472  sub handler { Line 472  sub handler {
                     header => [{col1 => 'Target user has role',                      header => [{col1 => 'Target user has role',
                                 col2 => 'User information updatable in author context'},                                  col2 => 'User information updatable in author context'},
                                {col1 => 'Target user has role',                                 {col1 => 'Target user has role',
                                   col2 => 'User information updatable by co-author manager'},
                                  {col1 => 'Target user has role',
                                 col2 => 'User information updatable in course context'}],                                  col2 => 'User information updatable in course context'}],
                     print => \&print_usermodification,                      print => \&print_usermodification,
                     modify => \&modify_usermodification,                      modify => \&modify_usermodification,
Line 1031  sub print_config_box { Line 1033  sub print_config_box {
             ($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 'privacy') || ($action eq 'passwords') || ($action eq 'lti') ||
             ($action eq 'ltitools')) {              ($action eq 'ltitools') || ($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 1135  sub print_config_box { Line 1137  sub print_config_box {
                 }                  }
             }              }
             $rowtotal ++;              $rowtotal ++;
         } elsif (($action eq 'usermodification') || ($action eq 'coursedefaults') ||          } elsif (($action eq 'coursedefaults') || ($action eq 'authordefaults') ||
                  ($action eq 'directorysrch') || ($action eq 'helpsettings') ||                   ($action eq 'directorysrch') || ($action eq 'helpsettings') ||
                  ($action eq 'wafproxy') || ($action eq 'authordefaults')) {                   ($action eq 'wafproxy')) {
             $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 2007  sub commblocktype_text { Line 2009  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 2019  sub print_rolecolors { Line 2022  sub print_rolecolors {
     my %choices = &color_font_choices();      my %choices = &color_font_choices();
     my @bgs = ('pgbg','tabbg','sidebg');      my @bgs = ('pgbg','tabbg','sidebg');
     my @links = ('link','alink','vlink');      my @links = ('link','alink','vlink');
     my @images = ('img');      my @images = ();
     my %alt_text = &Apache::lonlocal::texthash(img => "Banner for $role role");      my %alt_text = &Apache::lonlocal::texthash(img => "Banner for $role role");
     my %designhash = &Apache::loncommon::get_domainconf($dom);      my %designhash = &Apache::loncommon::get_domainconf($dom);
     my %defaultdesign = %Apache::loncommon::defaultdesign;      my %defaultdesign = %Apache::loncommon::defaultdesign;
Line 2027  sub print_rolecolors { Line 2030  sub print_rolecolors {
     my %defaults = &role_defaults($role,\@bgs,\@links,\@images);      my %defaults = &role_defaults($role,\@bgs,\@links,\@images);
     if (ref($settings) eq 'HASH') {      if (ref($settings) eq 'HASH') {
         if (ref($settings->{$role}) eq 'HASH') {          if (ref($settings->{$role}) eq 'HASH') {
             if ($settings->{$role}->{'img'} ne '') {  
                 $designs{'img'} = $settings->{$role}->{'img'};  
                 $is_custom{'img'} = 1;  
             }  
             if ($settings->{$role}->{'font'} ne '') {              if ($settings->{$role}->{'font'} ne '') {
                 $designs{'font'} = $settings->{$role}->{'font'};                  $designs{'font'} = $settings->{$role}->{'font'};
                 $is_custom{'font'} = 1;                  $is_custom{'font'} = 1;
Line 2053  sub print_rolecolors { Line 2052  sub print_rolecolors {
             }              }
         }          }
     } else {      } else {
         if ($designhash{$dom.'.'.$role.'.img'} ne '') {  
             $designs{img} = $designhash{$dom.'.'.$role.'.img'};  
             $is_custom{'img'} = 1;  
         }  
         if ($designhash{$dom.'.'.$role.'.fontmenu'} ne '') {          if ($designhash{$dom.'.'.$role.'.fontmenu'} ne '') {
             $designs{fontmenu} = $designhash{$dom.'.'.$role.'.fontmenu'};              $designs{fontmenu} = $designhash{$dom.'.'.$role.'.fontmenu'};
             $is_custom{'fontmenu'} = 1;               $is_custom{'fontmenu'} = 1; 
Line 2106  sub role_defaults { Line 2101  sub role_defaults {
         }          }
     } else {      } else {
         %defaults = (          %defaults = (
                        img => $defaultdesign{$role.'.img'},  
                        font => $defaultdesign{$role.'.font'},                         font => $defaultdesign{$role.'.font'},
                        fontmenu => $defaultdesign{$role.'.fontmenu'},                         fontmenu => $defaultdesign{$role.'.fontmenu'},
                     );                      );
Line 10724  sub print_usermodification { Line 10718  sub print_usermodification {
             $$rowtotal ++;              $$rowtotal ++;
             $rowcount ++;              $rowcount ++;
         }          }
       } elsif ($position eq 'middle') {
           $rowcount = 0;
           $context = 'coauthor';
           foreach my $role ('ca','aa') {
               $datatable .= &modifiable_userdata_row($context,$role,$settings,
                                                      $numinrow,$rowcount);
               $$rowtotal ++;
               $rowcount ++;
           }
     } elsif ($position eq 'bottom') {      } elsif ($position eq 'bottom') {
         $context = 'course';          $context = 'course';
         $rowcount = 0;          $rowcount = 0;
Line 12137  sub modifiable_userdata_row { Line 12140  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 12148  sub modifiable_userdata_row { Line 12155  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 12229  sub modifiable_userdata_row { Line 12236  sub modifiable_userdata_row {
         } else {          } else {
             if ($context eq 'lti') {              if ($context eq 'lti') {
                 $prefix = 'lti';                  $prefix = 'lti';
               } elsif ($context eq 'coauthor') {
                   $prefix = 'cacanmodify';
             } elsif ($context eq 'privacy') {              } elsif ($context eq 'privacy') {
                 $prefix = 'privacy';                  $prefix = 'privacy';
             }              }
Line 13121  sub check_exempt_addresses { Line 13130  sub check_exempt_addresses {
 sub color_font_choices {  sub color_font_choices {
     my %choices =      my %choices =
         &Apache::lonlocal::texthash (          &Apache::lonlocal::texthash (
             img => "Header",  
             bgs => "Background colors",              bgs => "Background colors",
             links => "Link colors",              links => "Link colors",
             images => "Images",              images => "Images",
Line 13176  sub modify_ipaccess { Line 13184  sub modify_ipaccess {
     foreach my $idx (@items) {      foreach my $idx (@items) {
         my $itemid = $itemids{$idx};          my $itemid = $itemids{$idx};
         next unless ($itemid);          next unless ($itemid);
         my %current;          my ($position,%current);
         unless ($idx eq 'add') {          if ($idx eq 'add') {
               $position = $env{'form.ipaccess_pos_add'};
           } else {
               $position = $env{'form.ipaccess_pos_'.$itemid};
             if (ref($domconfig{'ipaccess'}{$itemid}) eq 'HASH') {              if (ref($domconfig{'ipaccess'}{$itemid}) eq 'HASH') {
                 %current = %{$domconfig{'ipaccess'}{$itemid}};                  %current = %{$domconfig{'ipaccess'}{$itemid}};
             }              }
         }          }
         my $position = $env{'form.ipaccess_pos_'.$itemid};  
         $position =~ s/\D+//g;          $position =~ s/\D+//g;
         if ($position ne '') {          if ($position ne '') {
             $allpos[$position] = $itemid;              $allpos[$position] = $itemid;
Line 13715  sub modify_colors { Line 13725  sub modify_colors {
             @images = ('img','logo','domlogo','login');              @images = ('img','logo','domlogo','login');
             @bgs = ('pgbg','mainbg','sidebg');              @bgs = ('pgbg','mainbg','sidebg');
         } else {          } else {
             @images = ('img');              @images = ();
             @bgs = ('pgbg','tabbg','sidebg');              @bgs = ('pgbg','tabbg','sidebg');
         }          }
         my %defaults = &role_defaults($role,\@bgs,\@links,\@images,\@logintext);          my %defaults = &role_defaults($role,\@bgs,\@links,\@images,\@logintext);
         unless ($env{'form.'.$role.'_font'} eq $defaults{'font'}) {          $env{'form.'.$role.'_font'} = lc($env{'form.'.$role.'_font'});
           if ($env{'form.'.$role.'_font'} =~ /^\w+/) {
               $env{'form.'.$role.'_font'} = '#'.$env{'form.'.$role.'_font'};
           }
           unless ($env{'form.'.$role.'_font'} eq lc($defaults{'font'})) {
             $confhash->{$role}{'font'} = $env{'form.'.$role.'_font'};              $confhash->{$role}{'font'} = $env{'form.'.$role.'_font'};
         }          }
         if ($role eq 'login') {          if ($role eq 'login') {
Line 13737  sub modify_colors { Line 13751  sub modify_colors {
             if ($env{'form.'.$role.'_fontmenu'} =~ /^\w+/) {              if ($env{'form.'.$role.'_fontmenu'} =~ /^\w+/) {
                 $env{'form.'.$role.'_fontmenu'} = '#'.$env{'form.'.$role.'_fontmenu'};                  $env{'form.'.$role.'_fontmenu'} = '#'.$env{'form.'.$role.'_fontmenu'};
             }              }
             unless($env{'form.'.$role.'_fontmenu'} eq lc($defaults{'fontmenu'})) {              unless ($env{'form.'.$role.'_fontmenu'} eq lc($defaults{'fontmenu'})) {
                 $confhash->{$role}{'fontmenu'} = $env{'form.'.$role.'_fontmenu'};                  $confhash->{$role}{'fontmenu'} = $env{'form.'.$role.'_fontmenu'};
             }              }
         }          }
Line 14850  sub modify_quotas { Line 14864  sub modify_quotas {
                             $resulttext .= '<li>'.&mt('Validated course requests identified as processed by: [_1]',                              $resulttext .= '<li>'.&mt('Validated course requests identified as processed by: [_1]',
                                                      '<b>'.$changes{'validation'}{'dc'}.'</b>').'</li>';                                                       '<b>'.$changes{'validation'}{'dc'}.'</b>').'</li>';
                         }                          }
                           $resulttext .= '</ul></li>';
                     }                      }
                 }                  }
             }              }
Line 16076  sub modify_lti { Line 16091  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 16240  sub modify_lti { Line 16255  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 16454  sub modify_lti { Line 16469  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 19880  sub modify_usermodification { Line 19897  sub modify_usermodification {
             }              }
         }          }
     }      }
     my @contexts = ('author','course');      my @contexts = ('author','coauthor','course');
     my %context_title = (      my %context_title = (
                            author => 'In author context',                             author => 'In author context',
                              coauthor => 'As co-author manager',
                            course => 'In course context',                             course => 'In course context',
                         );                          );
     my @fields = ('lastname','firstname','middlename','generation',      my @fields = ('lastname','firstname','middlename','generation',
                   'permanentemail','id');                    'permanentemail','id');
     my %roles = (      my %roles = (
                   author => ['ca','aa'],                    author => ['ca','aa'],
                     coauthor => ['ca','aa'],
                   course => ['st','ep','ta','in','cr'],                    course => ['st','ep','ta','in','cr'],
                 );                  );
     my %fieldtitles = &Apache::loncommon::personal_data_fieldtitles();      my %fieldtitles = &Apache::loncommon::personal_data_fieldtitles();
     foreach my $context (@contexts) {      foreach my $context (@contexts) {
           my $prefix = 'canmodify';
           if ($context eq 'coauthor') {
               $prefix = 'cacanmodify';
           }
         foreach my $role (@{$roles{$context}}) {          foreach my $role (@{$roles{$context}}) {
             my @modifiable =  &Apache::loncommon::get_env_multiple('form.canmodify_'.$role);              my @modifiable =  &Apache::loncommon::get_env_multiple('form.'.$prefix.'_'.$role);
             foreach my $item (@fields) {              foreach my $item (@fields) {
                 if (grep(/^\Q$item\E$/,@modifiable)) {                  if (grep(/^\Q$item\E$/,@modifiable)) {
                     $modifyhash{$context}{$role}{$item} = 1;                      $modifyhash{$context}{$role}{$item} = 1;

Removed from v.1.441  
changed lines
  Added in v.1.449


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