Diff for /loncom/interface/domainprefs.pm between versions 1.439 and 1.447.2.6

version 1.439, 2024/04/17 01:02:47 version 1.447.2.6, 2025/03/15 01:07:42
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 472  sub handler { Line 460  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 573  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 616  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 885  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 938  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 1030  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')) {
             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 1101  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 1135  sub print_config_box { Line 1109  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') || ($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 1340  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 2007  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 2019  sub print_rolecolors { Line 1994  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 2002  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 2024  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 2073  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 5405  sub print_ltitools { Line 5371  sub print_ltitools {
     return $datatable;      return $datatable;
 }  }
   
 sub ltitools_names {  
     my %lt = &Apache::lonlocal::texthash(  
                                           'title'          => 'Title',  
                                           'version'        => 'Version',  
                                           'msgtype'        => 'Message Type',  
                                           'sigmethod'      => 'Signature Method',  
                                           'url'            => 'URL',  
                                           'key'            => 'Key',  
                                           'lifetime'       => 'Nonce lifetime (s)',  
                                           'secret'         => 'Secret',  
                                           'icon'           => 'Icon',  
                                           'user'           => 'User',  
                                           'fullname'       => 'Full Name',  
                                           'firstname'      => 'First Name',  
                                           'lastname'       => 'Last Name',  
                                           'email'          => 'E-mail',  
                                           'roles'          => 'Role',  
                                           'window'         => 'Window',  
                                           'tab'            => 'Tab',  
                                           'iframe'         => 'iFrame',  
                                           'height'         => 'Height',  
                                           'width'          => 'Width',  
                                           'linktext'       => 'Default Link Text',  
                                           'explanation'    => 'Default Explanation',  
                                           'passback'       => 'Tool can return grades:',  
                                           'roster'         => 'Tool can retrieve roster:',  
                                           'crstarget'      => 'Display target',  
                                           'crslabel'       => 'Course label',  
                                           'crstitle'       => 'Course title',  
                                           'crslinktext'    => 'Link Text',  
                                           'crsexplanation' => 'Explanation',  
                                           'crsappend'      => 'Provider URL',  
                                         );  
     return %lt;  
 }  
   
 sub secrets_form {  sub secrets_form {
     my ($dom,$context,$encrypt,$privkeys,$rowtotal) = @_;      my ($dom,$context,$encrypt,$privkeys,$rowtotal) = @_;
     my @ids=&Apache::lonnet::current_machine_ids();      my @ids=&Apache::lonnet::current_machine_ids();
Line 7523  sub print_authordefaults { Line 7453  sub print_authordefaults {
         }          }
         $datatable .= '</td></tr>';          $datatable .= '</td></tr>';
         $itemcount ++;          $itemcount ++;
           my %defchecked = (
                                   'archive' => 'off',
                                );
           my @toggles = ('archive');
           (my $archive,$itemcount) = &radiobutton_prefs($settings,['archive'],
                                                         {'archive' => 'off'},
                                                         \%titles,$itemcount);
           $datatable .= $archive."\n";
           $itemcount ++;
     }      }
     $$rowtotal += $itemcount;      $$rowtotal += $itemcount;
     return $datatable;      return $datatable;
Line 7546  sub authordefaults_titles { Line 7485  sub authordefaults_titles {
                none => 'No override set',                 none => 'No override set',
                overon => 'Override -- webDAV on',                 overon => 'Override -- webDAV on',
                overoff => 'Override -- webDAV off',                 overoff => 'Override -- webDAV off',
                  archive => 'Authors can download tar.gz file of Authoring Space',
     );      );
 }  }
   
Line 7809  sub print_privacy { Line 7749  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 7896  sub print_privacy { Line 7836  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 7933  sub print_privacy { Line 7873  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 7974  sub print_passwords { Line 7901  sub print_passwords {
         min            => 'Minimum password length',          min            => 'Minimum password length',
         max            => 'Maximum password length',          max            => 'Maximum password length',
         chars          => 'Required characters',          chars          => 'Required characters',
         expire         => 'Password expiration (days)',  
         numsaved       => 'Number of previous passwords to save and disallow reuse',          numsaved       => 'Number of previous passwords to save and disallow reuse',
     );      );
     if ($position eq 'top') {      if ($position eq 'top') {
Line 8301  sub print_passwords { Line 8227  sub print_passwords {
   
 sub password_rules {  sub password_rules {
     my ($prefix,$itemcountref,$settings) = @_;      my ($prefix,$itemcountref,$settings) = @_;
     my ($min,$max,%chars,$expire,$numsaved,$numinrow);      my ($min,$max,%chars,$numsaved,$numinrow);
     my %titles;      my %titles;
     if ($prefix eq 'passwords') {      if ($prefix eq 'passwords') {
         %titles = &Apache::lonlocal::texthash (          %titles = &Apache::lonlocal::texthash (
Line 8333  sub password_rules { Line 8259  sub password_rules {
             map { $chars{$_} = 1; } (@{$settings->{chars}});              map { $chars{$_} = 1; } (@{$settings->{chars}});
         }          }
         if ($prefix eq 'passwords') {          if ($prefix eq 'passwords') {
             if ($settings->{expire}) {  
                 $expire = $settings->{expire};  
             }  
             if ($settings->{numsaved}) {              if ($settings->{numsaved}) {
                 $numsaved = $settings->{numsaved};                  $numsaved = $settings->{numsaved};
             }              }
Line 8397  sub password_rules { Line 8320  sub password_rules {
     $datatable .='</table></td></tr>';      $datatable .='</table></td></tr>';
     $itemcount ++;      $itemcount ++;
     if ($prefix eq 'passwords') {      if ($prefix eq 'passwords') {
         $titles{'expire'} = &mt('Password expiration (days)');  
         $titles{'numsaved'} = &mt('Number of previous passwords to save and disallow reuse');          $titles{'numsaved'} = &mt('Number of previous passwords to save and disallow reuse');
         $css_class = $itemcount%2?' class="LC_odd_row"':'';          $css_class = $itemcount%2?' class="LC_odd_row"':'';
         $datatable .= '<tr'.$css_class.'><td>'.$titles{'expire'}.'</td>'.  
                       '<td class="LC_left_item"><span class="LC_nobreak">'.  
                       '<input type="text" name="'.$prefix.'_expire" value="'.$expire.'" size="4" '.  
                       'onblur="javascript:warnInt'.$prefix.'(this);" />'.  
                       '<span class="LC_fontsize_small"> '.&mt('(Leave blank for no expiration)').'</span>'.  
                       '</span></td></tr>';  
         $itemcount ++;  
         $css_class = $itemcount%2?' class="LC_odd_row"':'';  
         $datatable .= '<tr'.$css_class.'><td>'.$titles{'numsaved'}.'</td>'.          $datatable .= '<tr'.$css_class.'><td>'.$titles{'numsaved'}.'</td>'.
                       '<td class="LC_left_item"><span class="LC_nobreak">'.                        '<td class="LC_left_item"><span class="LC_nobreak">'.
                       '<input type="text" name="'.$prefix.'_numsaved" value="'.$numsaved.'" size="3" '.                        '<input type="text" name="'.$prefix.'_numsaved" value="'.$numsaved.'" size="3" '.
Line 10714  sub print_usermodification { Line 10628  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 11780  function warnInt$prefix(field) { Line 11703  function warnInt$prefix(field) {
             field.value = '';              field.value = '';
         }          }
         if (field.value != '') {          if (field.value != '') {
             if (field.name == '${prefix}_expire') {              if (!regexdigit.test(field.value)) {
                 var regexpposnum=/^\\d+(|\\.\\d*)\$/;                   if (field.name == '${prefix}_max') {
                 if (!regexpposnum.test(field.value)) {                      alert('$intalert{passmax}');
                     alert('$intalert{passexp}');  
                     field.value = '';  
                 } else {                  } else {
                     var expval = parseFloat(field.value);                      if (field.name == '${prefix}_numsaved') {
                     if (expval == 0) {                          alert('$intalert{passnum}');
                         alert('$intalert{passexp}');  
                         field.value = '';  
                     }                      }
                 }                  }
             } else {                  field.value = '';
                 if (!regexdigit.test(field.value)) {  
                     if (field.name == '${prefix}_max') {  
                         alert('$intalert{passmax}');  
                     } else {  
                         if (field.name == '${prefix}_numsaved') {  
                             alert('$intalert{passnum}');  
                         }  
                     }  
                     field.value = '';  
                 }  
             }              }
         }          }
     }      }
Line 12127  sub modifiable_userdata_row { Line 12036  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 12138  sub modifiable_userdata_row { Line 12051  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 12219  sub modifiable_userdata_row { Line 12132  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 13111  sub check_exempt_addresses { Line 13026  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 13166  sub modify_ipaccess { Line 13080  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 13428  sub modify_authordefaults { Line 13344  sub modify_authordefaults {
                            'editors'      => ['edit','xml'],                             'editors'      => ['edit','xml'],
                            'authorquota'  => 500,                             'authorquota'  => 500,
                            'webdav'       => 0,                             'webdav'       => 0,
                              'archive'      => 'off',
                          );                           );
     my %titles = &authordefaults_titles();      my %titles = &authordefaults_titles();
     foreach my $item ('nocodemirror','daxecollapse','domcoordacc') {      foreach my $item ('nocodemirror','daxecollapse','domcoordacc','archive') {
         if ($env{'form.'.$item} =~ /^(0|1)$/) {          if ($env{'form.'.$item} =~ /^(0|1)$/) {
             $confhash{$item} = $env{'form.'.$item};              $confhash{$item} = $env{'form.'.$item};
         }          }
Line 13474  sub modify_authordefaults { Line 13391  sub modify_authordefaults {
         $save_quotas{'webdav'}{'_LC_adv'} = $env{'form.webdav_LC_adv'};          $save_quotas{'webdav'}{'_LC_adv'} = $env{'form.webdav_LC_adv'};
     }      }
     if (ref($domconfig{'authordefaults'}) eq 'HASH') {      if (ref($domconfig{'authordefaults'}) eq 'HASH') {
         foreach my $item ('nocodemirror','daxecollapse','domcoordacc','copyright','sourceavail') {          foreach my $item ('nocodemirror','daxecollapse','domcoordacc','copyright','sourceavail','archive') {
             if ($domconfig{'authordefaults'}{$item} ne $confhash{$item}) {              if ($domconfig{'authordefaults'}{$item} ne $confhash{$item}) {
                 $changes{$item} = 1;                  $changes{$item} = 1;
              }               }
Line 13496  sub modify_authordefaults { Line 13413  sub modify_authordefaults {
         }          }
     } else {      } else {
         my @offon = ('off','on');          my @offon = ('off','on');
         foreach my $item ('nocodemirror','daxecollapse','domcoordacc') {          foreach my $item ('nocodemirror','daxecollapse','domcoordacc','archive') {
             if ($offon[$confhash{$item}] ne $staticdefaults{$item}) {              if ($offon[$confhash{$item}] ne $staticdefaults{$item}) {
                 $changes{$item} = 1;                   $changes{$item} = 1; 
             }              }
Line 13593  sub modify_authordefaults { Line 13510  sub modify_authordefaults {
                 $resulttext .= '</ul></li>';                  $resulttext .= '</ul></li>';
             }              }
             my $domcoordoverride;              my $domcoordoverride;
             foreach my $key ('editors','authorquota','webdav','webdav_LC_adv') {              foreach my $key ('editors','authorquota','webdav','webdav_LC_adv','archive') {
                 if (exists($changes{$key})) {                  if (exists($changes{$key})) {
                     my $shown;                      my $shown;
                     unless ($domcoordoverride) {                      unless ($domcoordoverride) {
Line 13625  sub modify_authordefaults { Line 13542  sub modify_authordefaults {
                         } else {                          } else {
                             $shown = $titles{'none'};                              $shown = $titles{'none'};
                         }                          }
                       } elsif ($key eq 'archive') {
                           $domdefaults{$key} = $confhash{$key};
                           $shown = ($confhash{$key} ? &mt('Yes') : &mt('No'));
                     }                      }
                     $resulttext .= '<li>'.&mt('[_1] set to: [_2]',$titles{$key},$shown).'</li>';                      $resulttext .= '<li>'.&mt('[_1] set to: [_2]',$titles{$key},$shown).'</li>';
                 }                  }
Line 13701  sub modify_colors { Line 13621  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 13723  sub modify_colors { Line 13647  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 14836  sub modify_quotas { Line 14760  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 16062  sub modify_lti { Line 15987  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 16226  sub modify_lti { Line 16151  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 16440  sub modify_lti { Line 16365  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 17903  sub modify_privacy { Line 17830  sub modify_privacy {
                                        extdom  => {},                                         extdom  => {},
                                      },                                       },
                        'othdom'   => {},                         'othdom'   => {},
                        'priv'     => {},  
                        'unpriv'   => {},  
                       );                        );
     foreach my $item (@items) {      foreach my $item (@items) {
         if (@instdoms > 1) {          if (@instdoms > 1) {
Line 17935  sub modify_privacy { Line 17860  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 17991  sub modify_privacy { Line 17883  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 18020  sub modify_privacy { Line 17914  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 18071  sub modify_privacy { Line 17965  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>';
                 }                  }
Line 18145  sub modify_passwords { Line 18027  sub modify_passwords {
         min            => 'Minimum password length',          min            => 'Minimum password length',
         max            => 'Maximum password length',          max            => 'Maximum password length',
         chars          => 'Required characters',          chars          => 'Required characters',
         expire         => 'Password expiration (days)',  
         numsaved       => 'Number of previous passwords to save',          numsaved       => 'Number of previous passwords to save',
         reset          => 'Resetting Forgotten Password',          reset          => 'Resetting Forgotten Password',
         intauth        => 'Encryption of Stored Passwords (Internal Auth)',          intauth        => 'Encryption of Stored Passwords (Internal Auth)',
Line 18529  sub modify_passwords { Line 18410  sub modify_passwords {
                             $resulttext .= '<li>'.&mt('[_1] set to "[_2]"',$titles{$key.'_'.$item},$value).'</li>';                              $resulttext .= '<li>'.&mt('[_1] set to "[_2]"',$titles{$key.'_'.$item},$value).'</li>';
                         }                          }
                     } elsif ($key eq 'rules') {                      } elsif ($key eq 'rules') {
                         foreach my $rule ('min','max','expire','numsaved') {                          foreach my $rule ('min','max','numsaved') {
                             if ($confighash{'passwords'}{$rule} eq '') {                              if ($confighash{'passwords'}{$rule} eq '') {
                                 if ($rule eq 'min') {                                  if ($rule eq 'min') {
                                     $resulttext .= '<li>'.&mt('[_1] not set.',$titles{$rule});                                      $resulttext .= '<li>'.&mt('[_1] not set.',$titles{$rule});
Line 18624  sub password_rule_changes { Line 18505  sub password_rule_changes {
                    (ref($changes) eq 'HASH'));                     (ref($changes) eq 'HASH'));
     my (@rules,%staticdefaults);      my (@rules,%staticdefaults);
     if ($prefix eq 'passwords') {      if ($prefix eq 'passwords') {
         @rules = ('min','max','expire','numsaved');          @rules = ('min','max','numsaved');
     } elsif (($prefix eq 'ltisecrets') || ($prefix eq 'toolsecrets')) {      } elsif (($prefix eq 'ltisecrets') || ($prefix eq 'toolsecrets')) {
         @rules = ('min','max');          @rules = ('min','max');
     }      }
Line 18632  sub password_rule_changes { Line 18513  sub password_rule_changes {
     foreach my $rule (@rules) {      foreach my $rule (@rules) {
         $env{'form.'.$prefix.'_'.$rule} =~ s/^\s+|\s+$//g;          $env{'form.'.$prefix.'_'.$rule} =~ s/^\s+|\s+$//g;
         my $ruleok;          my $ruleok;
         if ($rule eq 'expire') {          if ($rule eq 'min') {
             if (($env{'form.'.$prefix.'_'.$rule} =~ /^\d+(|\.\d*)$/) &&  
                 ($env{'form.'.$prefix.'_'.$rule} ne '0')) {  
                 $ruleok = 1;  
             }  
         } elsif ($rule eq 'min') {  
             if ($env{'form.'.$prefix.'_'.$rule} =~ /^\d+$/) {              if ($env{'form.'.$prefix.'_'.$rule} =~ /^\d+$/) {
                 if ($env{'form.'.$prefix.'_'.$rule} >= $staticdefaults{$rule}) {                  if ($env{'form.'.$prefix.'_'.$rule} >= $staticdefaults{$rule}) {
                     $ruleok = 1;                      $ruleok = 1;
Line 19866  sub modify_usermodification { Line 19742  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.439  
changed lines
  Added in v.1.447.2.6


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