--- loncom/interface/domainprefs.pm 2024/07/14 16:08:04 1.442 +++ loncom/interface/domainprefs.pm 2025/01/12 18:26:16 1.447.2.2 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set domain-wide configuration settings # -# $Id: domainprefs.pm,v 1.442 2024/07/14 16:08:04 raeburn Exp $ +# $Id: domainprefs.pm,v 1.447.2.2 2025/01/12 18:26:16 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, @@ -616,14 +606,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 +867,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 +918,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') { @@ -1031,7 +1009,7 @@ sub print_config_box { ($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 'ltitools') || ($action eq 'usermodification')) { if ($action eq 'coursecategories') { $output .= &print_coursecategories('middle',$dom,$item,$settings,\$rowtotal); $colspan = ' colspan="2"'; @@ -1135,9 +1113,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')) { $output .= $item->{'print'}->('bottom',$dom,$settings,\$rowtotal); } elsif ($action eq 'scantron') { $output .= $item->{'print'}->($r,'bottom',$dom,$confname,$settings,\$rowtotal); @@ -1340,7 +1318,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 +1985,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 +1998,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 +2006,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 +2028,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 +2077,6 @@ sub role_defaults { } } else { %defaults = ( - img => $defaultdesign{$role.'.img'}, font => $defaultdesign{$role.'.font'}, fontmenu => $defaultdesign{$role.'.fontmenu'}, ); @@ -10724,6 +10694,15 @@ sub print_usermodification { $$rowtotal ++; $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') { $context = 'course'; $rowcount = 0; @@ -12137,7 +12116,11 @@ sub modifiable_userdata_row { my $hashref; if ($context eq 'lti') { 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') { my ($key,$inner) = split(/_/,$role); @@ -12148,7 +12131,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) { @@ -12229,6 +12212,8 @@ sub modifiable_userdata_row { } else { if ($context eq 'lti') { $prefix = 'lti'; + } elsif ($context eq 'coauthor') { + $prefix = 'cacanmodify'; } elsif ($context eq 'privacy') { $prefix = 'privacy'; } @@ -13121,7 +13106,6 @@ sub check_exempt_addresses { sub color_font_choices { my %choices = &Apache::lonlocal::texthash ( - img => "Header", bgs => "Background colors", links => "Link colors", images => "Images", @@ -13176,13 +13160,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; @@ -13715,11 +13701,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') { @@ -13737,7 +13727,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'}; } } @@ -16077,9 +16067,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); } } } @@ -16241,7 +16231,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}, @@ -16455,8 +16445,10 @@ sub modify_lti { $resulttext .= '