--- loncom/interface/domainprefs.pm 2024/04/17 01:02:47 1.439 +++ loncom/interface/domainprefs.pm 2025/01/14 13:38:26 1.447.2.5 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set domain-wide configuration settings # -# $Id: domainprefs.pm,v 1.439 2024/04/17 01:02:47 raeburn Exp $ +# $Id: domainprefs.pm,v 1.447.2.5 2025/01/14 13:38:26 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -222,10 +222,10 @@ sub handler { 'coursedefaults','usersessions','loadbalancing', 'requestauthor','selfenrollment','inststatus', 'ltitools','toolsec','ssl','trust','lti','ltisec', - 'privacy','passwords','proctoring','wafproxy', + 'privacy','passwords','wafproxy', 'ipaccess','authordefaults'],$dom); 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); if (ref($domconfig{'ltitools'}) eq 'HASH') { if (ref($encconfig{'ltitools'}) eq 'HASH') { @@ -288,24 +288,12 @@ 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', 'quotas','autoenroll','autoupdate','autocreate','directorysrch', 'contacts','privacy','usercreation','selfcreation', 'usermodification','scantron','requestcourses','requestauthor', 'coursecategories','serverstatuses','helpsettings','coursedefaults', - 'authordefaults','ltitools','proctoring','selfenrollment', + 'authordefaults','ltitools','selfenrollment', 'usersessions','ssl','trust','lti'); my %existing; if (ref($domconfig{'loadbalancing'}) eq 'HASH') { @@ -472,6 +460,8 @@ sub handler { header => [{col1 => 'Target user has role', col2 => 'User information updatable in author context'}, {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'}], print => \&print_usermodification, modify => \&modify_usermodification, @@ -573,11 +563,7 @@ sub handler { header => [{col1 => 'Role assigned in different domain', col2 => 'Approval options'}, {col1 => 'Role assigned in different domain to user of type', - 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'}], + col2 => 'User information available in that domain'}], print => \&print_privacy, modify => \&modify_privacy, }, @@ -616,14 +602,6 @@ sub handler { print => \&print_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' => {text => 'LON-CAPA Network (SSL)', help => 'Domain_Configuration_Network_SSL', @@ -885,8 +863,6 @@ sub process_changes { $output = &modify_loadbalancing($dom,%domconfig); } elsif ($action eq 'ltitools') { $output = &modify_ltitools($r,$dom,$action,$lastactref,%domconfig); - } elsif ($action eq 'proctoring') { - $output = &modify_proctoring($r,$dom,$action,$lastactref,%domconfig); } elsif ($action eq 'ssl') { $output = &modify_ssl($dom,$lastactref,%domconfig); } elsif ($action eq 'trust') { @@ -938,8 +914,6 @@ sub print_config_box { } elsif ($action eq 'lti') { $output .= &passwords_javascript('ltisecrets')."\n". <i_javascript($dom,$settings); - } elsif ($action eq 'proctoring') { - $output .= &proctoring_javascript($settings); } elsif ($action eq 'wafproxy') { $output .= &wafproxy_javascript($dom); } elsif ($action eq 'autoupdate') { @@ -1030,8 +1004,8 @@ sub print_config_box { ($action eq 'selfcreation') || ($action eq 'selfenrollment') || ($action eq 'usersessions') || ($action eq 'coursecategories') || ($action eq 'trust') || ($action eq 'contacts') || ($action eq 'defaults') || - ($action eq 'privacy') || ($action eq 'passwords') || ($action eq 'lti') || - ($action eq 'ltitools')) { + ($action eq 'passwords') || ($action eq 'lti') || ($action eq 'ltitools') || + ($action eq 'usermodification')) { if ($action eq 'coursecategories') { $output .= &print_coursecategories('middle',$dom,$item,$settings,\$rowtotal); $colspan = ' colspan="2"'; @@ -1101,8 +1075,8 @@ sub print_config_box { '."\n"; if ($action eq 'coursecategories') { $output .= &print_coursecategories('bottom',$dom,$item,$settings,\$rowtotal); - } elsif (($action eq 'contacts') || ($action eq 'privacy') || - ($action eq 'passwords') || ($action eq 'lti')) { + } elsif (($action eq 'contacts') || ($action eq 'passwords') || + ($action eq 'lti')) { if ($action eq 'passwords') { $output .= $item->{'print'}->('lower',$dom,$confname,$settings,\$rowtotal); } else { @@ -1135,9 +1109,9 @@ sub print_config_box { } } $rowtotal ++; - } elsif (($action eq 'usermodification') || ($action eq 'coursedefaults') || + } elsif (($action eq 'coursedefaults') || ($action eq 'authordefaults') || ($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); } elsif ($action eq 'scantron') { $output .= $item->{'print'}->($r,'bottom',$dom,$confname,$settings,\$rowtotal); @@ -1340,7 +1314,7 @@ sub print_config_box { $output .= &print_quotas($dom,$settings,\$rowtotal,$action); } elsif (($action eq 'autoenroll') || ($action eq 'autocreate') || ($action eq 'serverstatuses') || ($action eq 'loadbalancing') || - ($action eq 'proctoring') || ($action eq 'ipaccess')) { + ($action eq 'ipaccess')) { $output .= $item->{'print'}->($dom,$settings,\$rowtotal); } } @@ -2007,10 +1981,11 @@ sub commblocktype_text { 'passwd' => 'Change Password', 'grades' => 'Gradebook', 'search' => 'Course search', + 'index' => 'Course content index', 'wishlist' => 'Stored links', '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); } @@ -2019,7 +1994,7 @@ sub print_rolecolors { my %choices = &color_font_choices(); my @bgs = ('pgbg','tabbg','sidebg'); my @links = ('link','alink','vlink'); - my @images = ('img'); + my @images = (); my %alt_text = &Apache::lonlocal::texthash(img => "Banner for $role role"); my %designhash = &Apache::loncommon::get_domainconf($dom); my %defaultdesign = %Apache::loncommon::defaultdesign; @@ -2027,10 +2002,6 @@ sub print_rolecolors { my %defaults = &role_defaults($role,\@bgs,\@links,\@images); if (ref($settings) 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 '') { $designs{'font'} = $settings->{$role}->{'font'}; $is_custom{'font'} = 1; @@ -2053,10 +2024,6 @@ sub print_rolecolors { } } } else { - if ($designhash{$dom.'.'.$role.'.img'} ne '') { - $designs{img} = $designhash{$dom.'.'.$role.'.img'}; - $is_custom{'img'} = 1; - } if ($designhash{$dom.'.'.$role.'.fontmenu'} ne '') { $designs{fontmenu} = $designhash{$dom.'.'.$role.'.fontmenu'}; $is_custom{'fontmenu'} = 1; @@ -2106,7 +2073,6 @@ sub role_defaults { } } else { %defaults = ( - img => $defaultdesign{$role.'.img'}, font => $defaultdesign{$role.'.font'}, fontmenu => $defaultdesign{$role.'.fontmenu'}, ); @@ -7523,6 +7489,15 @@ sub print_authordefaults { } $datatable .= ''; $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; return $datatable; @@ -7546,6 +7521,7 @@ sub authordefaults_titles { none => 'No override set', overon => 'Override -- webDAV on', overoff => 'Override -- webDAV off', + archive => 'Authors can download tar.gz file of Authoring Space', ); } @@ -7809,7 +7785,7 @@ sub print_privacy { ($othertitle,$usertypes,$types) = &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); &build_location_hashes(\@intdoms,\%by_ip,\%by_location,\@instdoms); if ($position eq 'top') { @@ -7896,7 +7872,7 @@ sub print_privacy { $datatable .= &mt('Nothing to set here, as there are no other domains'); } $datatable .=''; - } elsif ($position eq 'middle') { + } elsif ($position eq 'bottom') { if ((@instdoms > 1) || (keys(%by_location) > 0)) { if ((ref($types) eq 'ARRAY') && (ref($usertypes) eq 'HASH')) { foreach my $item (@{$types}) { @@ -7933,19 +7909,6 @@ 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)) { $$rowtotal += $itemcount; @@ -7974,7 +7937,6 @@ sub print_passwords { min => 'Minimum password length', max => 'Maximum password length', chars => 'Required characters', - expire => 'Password expiration (days)', numsaved => 'Number of previous passwords to save and disallow reuse', ); if ($position eq 'top') { @@ -8301,7 +8263,7 @@ sub print_passwords { sub password_rules { my ($prefix,$itemcountref,$settings) = @_; - my ($min,$max,%chars,$expire,$numsaved,$numinrow); + my ($min,$max,%chars,$numsaved,$numinrow); my %titles; if ($prefix eq 'passwords') { %titles = &Apache::lonlocal::texthash ( @@ -8333,9 +8295,6 @@ sub password_rules { map { $chars{$_} = 1; } (@{$settings->{chars}}); } if ($prefix eq 'passwords') { - if ($settings->{expire}) { - $expire = $settings->{expire}; - } if ($settings->{numsaved}) { $numsaved = $settings->{numsaved}; } @@ -8397,17 +8356,8 @@ sub password_rules { $datatable .=''; $itemcount ++; if ($prefix eq 'passwords') { - $titles{'expire'} = &mt('Password expiration (days)'); $titles{'numsaved'} = &mt('Number of previous passwords to save and disallow reuse'); $css_class = $itemcount%2?' class="LC_odd_row"':''; - $datatable .= ''.$titles{'expire'}.''. - ''. - ''. - ' '.&mt('(Leave blank for no expiration)').''. - ''; - $itemcount ++; - $css_class = $itemcount%2?' class="LC_odd_row"':''; $datatable .= ''.$titles{'numsaved'}.''. ''. '{'instdata'}; + my %instdata; + if (ref($settings->{'instdata'}) eq 'ARRAY') { + map { $instdata{$_} = 1; } @{$settings->{'instdata'}}; + } + $hashref = \%instdata; } } elsif ($context eq 'privacy') { my ($key,$inner) = split(/_/,$role); @@ -12138,7 +12087,7 @@ sub modifiable_userdata_row { } } elsif (ref($settings->{$context}) eq 'HASH') { if (ref($settings->{$context}->{$role}) eq 'HASH') { - $hashref = $settings->{'lti_instdata'}; + $hashref = $settings->{$context}->{$role}; } if ($role eq 'emailusername') { if ($statustype) { @@ -12219,6 +12168,8 @@ sub modifiable_userdata_row { } else { if ($context eq 'lti') { $prefix = 'lti'; + } elsif ($context eq 'coauthor') { + $prefix = 'cacanmodify'; } elsif ($context eq 'privacy') { $prefix = 'privacy'; } @@ -13111,7 +13062,6 @@ sub check_exempt_addresses { sub color_font_choices { my %choices = &Apache::lonlocal::texthash ( - img => "Header", bgs => "Background colors", links => "Link colors", images => "Images", @@ -13166,13 +13116,15 @@ sub modify_ipaccess { foreach my $idx (@items) { my $itemid = $itemids{$idx}; next unless ($itemid); - my %current; - unless ($idx eq 'add') { + my ($position,%current); + if ($idx eq 'add') { + $position = $env{'form.ipaccess_pos_add'}; + } else { + $position = $env{'form.ipaccess_pos_'.$itemid}; if (ref($domconfig{'ipaccess'}{$itemid}) eq 'HASH') { %current = %{$domconfig{'ipaccess'}{$itemid}}; } } - my $position = $env{'form.ipaccess_pos_'.$itemid}; $position =~ s/\D+//g; if ($position ne '') { $allpos[$position] = $itemid; @@ -13428,9 +13380,10 @@ sub modify_authordefaults { 'editors' => ['edit','xml'], 'authorquota' => 500, 'webdav' => 0, + 'archive' => 'off', ); my %titles = &authordefaults_titles(); - foreach my $item ('nocodemirror','daxecollapse','domcoordacc') { + foreach my $item ('nocodemirror','daxecollapse','domcoordacc','archive') { if ($env{'form.'.$item} =~ /^(0|1)$/) { $confhash{$item} = $env{'form.'.$item}; } @@ -13474,7 +13427,7 @@ sub modify_authordefaults { $save_quotas{'webdav'}{'_LC_adv'} = $env{'form.webdav_LC_adv'}; } 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}) { $changes{$item} = 1; } @@ -13496,7 +13449,7 @@ sub modify_authordefaults { } } else { my @offon = ('off','on'); - foreach my $item ('nocodemirror','daxecollapse','domcoordacc') { + foreach my $item ('nocodemirror','daxecollapse','domcoordacc','archive') { if ($offon[$confhash{$item}] ne $staticdefaults{$item}) { $changes{$item} = 1; } @@ -13593,7 +13546,7 @@ sub modify_authordefaults { $resulttext .= ''; } 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})) { my $shown; unless ($domcoordoverride) { @@ -13625,6 +13578,9 @@ sub modify_authordefaults { } else { $shown = $titles{'none'}; } + } elsif ($key eq 'archive') { + $domdefaults{$key} = $confhash{$key}; + $shown = ($confhash{$key} ? &mt('Yes') : &mt('No')); } $resulttext .= '
  • '.&mt('[_1] set to: [_2]',$titles{$key},$shown).'
  • '; } @@ -13701,11 +13657,15 @@ sub modify_colors { @images = ('img','logo','domlogo','login'); @bgs = ('pgbg','mainbg','sidebg'); } else { - @images = ('img'); + @images = (); @bgs = ('pgbg','tabbg','sidebg'); } 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'}; } if ($role eq 'login') { @@ -13723,7 +13683,7 @@ sub modify_colors { if ($env{'form.'.$role.'_fontmenu'} =~ /^\w+/) { $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'}; } } @@ -14836,6 +14796,7 @@ sub modify_quotas { $resulttext .= '
  • '.&mt('Validated course requests identified as processed by: [_1]', ''.$changes{'validation'}{'dc'}.'').'
  • '; } + $resulttext .= ''; } } } @@ -16062,9 +16023,9 @@ sub modify_lti { } my @possinstdata = &Apache::loncommon::get_env_multiple('form.lti_instdata_'.$idx); if (@possinstdata) { - foreach my $field (@possinstdata) { + foreach my $field (sort(@possinstdata)) { if (exists($fieldtitles{$field})) { - push(@{$confhash{$itemid}{'instdata'}}); + push(@{$confhash{$itemid}{'instdata'}},$field); } } } @@ -16226,7 +16187,7 @@ sub modify_lti { } } unless ($changes{$itemid}) { - foreach my $field ('makeuser','lcmenu') { + foreach my $field ('makeuser','lcmenu','instdata') { if (ref($currlti{$field}) eq 'ARRAY') { if (ref($confhash{$itemid}{$field}) eq 'ARRAY') { my @diffs = &Apache::loncommon::compare_arrays($currlti{$field}, @@ -16440,8 +16401,10 @@ sub modify_lti { $resulttext .= '
  • '.&mt('Institutional data will be used when creating a new user for: [_1]', join(', ',map { $fieldtitles{$_}; } @{$confhash{$itemid}{'instdata'}})).'
  • '; } else { - $resulttext .= '
  • '.&mt('No institutional data used when creating a new user.').'
  • '; + $resulttext .= '
  • '.&mt('No institutional data used when creating a new user').'
  • '; } + } else { + $resulttext .= '
  • '.&mt('No institutional data used when creating a new user').'
  • '; } foreach my $item ('topmenu','inlinemenu') { $resulttext .= '
  • '.$lt{$item}.': '; @@ -17903,8 +17866,6 @@ sub modify_privacy { extdom => {}, }, 'othdom' => {}, - 'priv' => {}, - 'unpriv' => {}, ); foreach my $item (@items) { if (@instdoms > 1) { @@ -17935,39 +17896,6 @@ sub modify_privacy { $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)) { my @statuses; @@ -17991,6 +17919,8 @@ sub modify_privacy { if (@diffs > 0) { $changes{'othdom'} = 1; } + } elsif (@newvalues > 0) { + $changes{'othdom'} = 1; } } else { my @stdfields = ('lastname','firstname','middlename','generation','permanentemail'); @@ -18020,7 +17950,7 @@ sub modify_privacy { if ($putresult eq 'ok') { if (keys(%changes) > 0) { $resulttext = &mt('Changes made: ').'
      '; - foreach my $key ('approval','notify','othdom','priv','unpriv') { + foreach my $key ('approval','notify','othdom') { if ($changes{$key}) { $resulttext .= '
    • '.$titles{$key}.':
        '; if ($key eq 'approval') { @@ -18071,18 +18001,6 @@ sub modify_privacy { $resulttext .= ''; } } - } else { - foreach my $item (@items) { - if (ref($privacyhash{$key}{$item}) eq 'HASH') { - $resulttext .= '
      • '.$names{$item}.': '; - if (keys(%{$privacyhash{$key}{$item}})) { - $resulttext .= join(', ', map { $fieldnames{$_}; } (sort(keys(%{$privacyhash{$key}{$item}})))); - } else { - $resulttext .= &mt('none'); - } - $resulttext .= '
      • '; - } - } } $resulttext .= '
    • '; } @@ -18145,7 +18063,6 @@ sub modify_passwords { min => 'Minimum password length', max => 'Maximum password length', chars => 'Required characters', - expire => 'Password expiration (days)', numsaved => 'Number of previous passwords to save', reset => 'Resetting Forgotten Password', intauth => 'Encryption of Stored Passwords (Internal Auth)', @@ -18529,7 +18446,7 @@ sub modify_passwords { $resulttext .= '
    • '.&mt('[_1] set to "[_2]"',$titles{$key.'_'.$item},$value).'
    • '; } } elsif ($key eq 'rules') { - foreach my $rule ('min','max','expire','numsaved') { + foreach my $rule ('min','max','numsaved') { if ($confighash{'passwords'}{$rule} eq '') { if ($rule eq 'min') { $resulttext .= '
    • '.&mt('[_1] not set.',$titles{$rule}); @@ -18624,7 +18541,7 @@ sub password_rule_changes { (ref($changes) eq 'HASH')); my (@rules,%staticdefaults); if ($prefix eq 'passwords') { - @rules = ('min','max','expire','numsaved'); + @rules = ('min','max','numsaved'); } elsif (($prefix eq 'ltisecrets') || ($prefix eq 'toolsecrets')) { @rules = ('min','max'); } @@ -18632,12 +18549,7 @@ sub password_rule_changes { foreach my $rule (@rules) { $env{'form.'.$prefix.'_'.$rule} =~ s/^\s+|\s+$//g; my $ruleok; - if ($rule eq 'expire') { - if (($env{'form.'.$prefix.'_'.$rule} =~ /^\d+(|\.\d*)$/) && - ($env{'form.'.$prefix.'_'.$rule} ne '0')) { - $ruleok = 1; - } - } elsif ($rule eq 'min') { + if ($rule eq 'min') { if ($env{'form.'.$prefix.'_'.$rule} =~ /^\d+$/) { if ($env{'form.'.$prefix.'_'.$rule} >= $staticdefaults{$rule}) { $ruleok = 1; @@ -19866,21 +19778,27 @@ sub modify_usermodification { } } } - my @contexts = ('author','course'); + my @contexts = ('author','coauthor','course'); my %context_title = ( author => 'In author context', + coauthor => 'As co-author manager', course => 'In course context', ); my @fields = ('lastname','firstname','middlename','generation', 'permanentemail','id'); my %roles = ( author => ['ca','aa'], + coauthor => ['ca','aa'], course => ['st','ep','ta','in','cr'], ); my %fieldtitles = &Apache::loncommon::personal_data_fieldtitles(); foreach my $context (@contexts) { + my $prefix = 'canmodify'; + if ($context eq 'coauthor') { + $prefix = 'cacanmodify'; + } 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) { if (grep(/^\Q$item\E$/,@modifiable)) { $modifyhash{$context}{$role}{$item} = 1;