--- loncom/interface/courseprefs.pm 2023/12/29 19:44:06 1.49.2.28.2.19 +++ loncom/interface/courseprefs.pm 2023/09/02 12:51:32 1.126 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set configuration settings for a course # -# $Id: courseprefs.pm,v 1.49.2.28.2.19 2023/12/29 19:44:06 raeburn Exp $ +# $Id: courseprefs.pm,v 1.126 2023/09/02 12:51:32 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -412,7 +412,7 @@ sub handler { my @prefs_order = ('courseinfo','localization','feedback','discussion', 'classlists','appearance','grading','printouts', 'menuitems','ltitools','linkprot','spreadsheet', - 'bridgetasks','other'); + 'bridgetasks','lti','other'); my %prefs = ( 'courseinfo' => { text => $lt{'gens'}, @@ -463,6 +463,7 @@ sub handler { { text => 'Discussion and Chat', help => 'Course_Prefs_Discussions', ordered => ['pch.roles.denied','pch.users.denied', + 'pac.roles.denied','pac.users.denied', 'plc.roles.denied','plc.users.denied', 'allow_limited_html_in_feedback', 'allow_discussion_post_editing', @@ -472,6 +473,8 @@ sub handler { 'pch.users.denied' => 'No Resource Discussion', 'plc.roles.denied' => 'No Chat room use', 'plc.users.denied' => 'No Chat room use', + 'pac.roles.denied' => 'No Anonymous Resource Discussion', + 'pac.users.denied' => 'No Anonymous Resource Discussion', allow_limited_html_in_feedback => 'Allow limited HTML in discussion', allow_discussion_post_editing => 'Users can edit/delete own discussion posts', discussion_post_fonts => 'Discussion post fonts based on likes/unlikes', @@ -540,7 +543,7 @@ sub handler { help => 'Course_Prefs_Printouts', ordered => ['problem_stream_switch','suppress_tries', 'default_paper_size','print_header_format', - 'disableexampointprint'], + 'disableexampointprint','canuse_pdfforms'], itemtext => { problem_stream_switch => 'Allow problems to be split over pages', suppress_tries => 'Suppress number of tries in printing', @@ -574,6 +577,18 @@ sub handler { suppress_embed_prompt => 'Hide upload references prompt if uploading file to portfolio', }, }, + 'lti' => + { + text => 'LTI provider settings', + help => 'Course_Prefs_LTIProvider', + ordered => ['lti.override','lti.topmenu','lti.inlinemenu','lti.lcmenu'], + itemtext => { + 'lti.override' => 'Override domain defaults', + 'lti.topmenu' => 'Display LON-CAPA page header', + 'lti.inlinemenu' => 'Display LON-CAPA inline menu', + 'lti.lcmenu' => 'Menu items', + }, + }, 'menuitems' => { text => 'Menu display', @@ -807,7 +822,7 @@ sub print_config_box { } elsif ($action eq 'appearance') { $output .= &print_appearance($cdom,$settings,$ordered,$itemtext,\$rowtotal,$crstype,$noedit); } elsif ($action eq 'grading') { - $output .= &print_grading($cdom,$cnum,$settings,$ordered,$itemtext,\$rowtotal,$crstype,$noedit); + $output .= &print_grading($cdom,$settings,$ordered,$itemtext,\$rowtotal,$crstype,$noedit); } elsif ($action eq 'printouts') { $output .= &print_printouts($cdom,$settings,$ordered,$itemtext,\$rowtotal,$crstype,$noedit); } elsif ($action eq 'spreadsheet') { @@ -820,6 +835,8 @@ sub print_config_box { $currtools = $settings->{'ltitools'}; } $output .= &print_ltitools($cdom,$cnum,$currtools,\$rowtotal,$crstype,$noedit,'course'); + } elsif ($action eq 'lti') { + $output .= &print_lti($cdom,$settings,$ordered,$itemtext,\$rowtotal,$crstype,$noedit); } elsif ($action eq 'menuitems') { $output .= &print_menuitems('bottom',$cdom,$settings,$itemtext,\$rowtotal,$crstype,$noedit); } elsif ($action eq 'linkprot') { @@ -1260,7 +1277,8 @@ sub process_changes { } } } - } elsif (($entry eq 'plc.roles.denied') || ($entry eq 'pch.roles.denied')) { + } elsif (($entry eq 'plc.roles.denied') || ($entry eq 'pch.roles.denied') || + ($entry eq 'pac.roles.denied')) { my @denied = &Apache::loncommon::get_env_multiple('form.'.$entry); @denied = sort(@denied); my $deniedstr = ''; @@ -1268,7 +1286,8 @@ sub process_changes { $deniedstr = join(',',@denied); } $newvalues{$entry} = $deniedstr; - } elsif (($entry eq 'plc.users.denied') || ($entry eq 'pch.users.denied')) { + } elsif (($entry eq 'plc.users.denied') || ($entry eq 'pch.users.denied') || + ($entry eq 'pac.users.denied')) { my $total = $env{'form.'.$entry.'_total'}; my $userstr = ''; my @denied; @@ -1456,6 +1475,38 @@ sub process_changes { $settings =~ s/,$//; } $newvalues{$entry} = $settings; + } elsif ($action eq 'lti') { + if ($entry eq 'lti.override') { + $newvalues{$entry} = $env{'form.'.$entry}; + } elsif (($entry eq 'lti.topmenu') || ($entry eq 'lti.inlinemenu')) { + if ($env{'form.lti.override'}) { + $newvalues{$entry} = $env{'form.'.$entry}; + } else { + $newvalues{$entry} = ''; + } + } elsif ($entry eq 'lti.lcmenu') { + if (($env{'form.lti.override'}) && + (($env{'form.lti.topmenu'}) || ($env{'form.lti.inlinemenu'}))) { + my @lcmenu = &Apache::loncommon::get_env_multiple('form.lti.lcmenu'); + my @newlcmenu; + if (@lcmenu) { + my @menuitems = ('fullname','coursetitle','role','logout','grades'); + foreach my $item (@menuitems) { + next if (($item eq 'grades') && (!$newvalues{'lti.inlinemenu'})); + if (grep(/^\Q$item\E$/,@lcmenu)) { + push(@newlcmenu,$item); + } + } + } + if (@newlcmenu) { + $newvalues{$entry} = join(',',@newlcmenu); + } else { + $newvalues{$entry} = 'none'; + } + } else { + $newvalues{$entry} = ''; + } + } } elsif ($entry eq 'extresource') { if ($env{'form.'.$entry} =~ /^iframe|tab|window$/) { $newvalues{$entry} = $env{'form.'.$entry}; @@ -1499,33 +1550,6 @@ sub process_changes { } elsif ($values->{$entry}) { $changes->{$entry} = ''; } - } elsif ($entry eq 'grading') { - if ($env{'form.'.$entry} eq 'standard') { - if ($env{'form.hidetotals'}) { - my %sections = &Apache::loncommon::get_sections($cdom,$cnum); - if (keys(%sections)) { - my @secs = &Apache::loncommon::get_env_multiple('form.hidetotals_sections'); - if (grep(/^all$/,@secs)) { - $newvalues{'hidetotals'} = 'all'; - } elsif (@secs) { - $newvalues{'hidetotals'} = ''; - foreach my $sec (sort {$a <=> $b} @secs) { - if (exists($sections{$sec})) { - $newvalues{'hidetotals'} .= $sec.',' - } - } - $newvalues{'hidetotals'} =~ s/,$//; - } - } else { - $newvalues{'hidetotals'} = 'all'; - } - } - } - if ($newvalues{'hidetotals'} ne $values->{'hidetotals'}) { - $changes->{'hidetotals'} = $newvalues{'hidetotals'}; - $changes->{'grading'} = $env{'form.'.$entry}; - } - $newvalues{$entry} = $env{'form.'.$entry}; } else { $newvalues{$entry} = $env{'form.'.$entry}; } @@ -2607,40 +2631,6 @@ sub store_changes { unless (($key eq 'co-owners') || ($key eq 'discussion_post_fonts') || ($key eq 'extresource')) { $displayval = $changes->{$item}{$key}; } - if (($item eq 'grading') && ($key eq 'grading')) { - if ($displayval eq 'standard') { - my $hidetotals; - if (exists($changes->{$item}{'hidetotals'})) { - if ($changes->{$item}{'hidetotals'} eq '') { - if (exists($values->{'hidetotals'})) { - push(@delkeys,'hidetotals'); - } - } else { - $hidetotals = $changes->{$item}{'hidetotals'}; - } - } elsif (exists($values->{'hidetotals'})) { - $hidetotals = $values->{'hidetotals'}; - } - if ($hidetotals eq '') { - $displayval = &mt('standard with "hide course totals" set to "No"'); - if (exists($values->{'hidetotals'})) { - push(@delkeys,'hidetotals'); - } - } elsif ($hidetotals =~ /^([\w,]+)$/) { - my $secstr = $1; - my @secs = split(/,/,$secstr); - if (grep(/^all$/,@secs)) { - $displayval = &mt('standard with "hide course totals" set to "Yes" for all users'); - $hidetotals = 'all'; - } else { - $displayval = &mt('standard with "hide course totals" set to "Yes" for users in section(s): [_1]',join(', ',@secs)); - } - $storehash{'hidetotals'} = $hidetotals; - } - } elsif (exists($values->{'hidetotals'})) { - push(@delkeys,'hidetotals'); - } - } if ($item eq 'feedback') { if ($key =~ /^(question|policy|comment)(\.email)\.text$/) { $text = $prefs->{$item}->{'itemtext'}{$1.$2}; @@ -2718,6 +2708,22 @@ sub store_changes { } } $displayname = &mt($text); + } elsif ($item eq 'lti') { + if ($key eq 'lti.lcmenu') { + if ($changes->{$item}{$key} eq 'none') { + $displayval = &mt('None of the configurable menu items displayed'); + } else { + my %ltititles = <imenu_titles(); + $displayval = join(', ', map { $ltititles{$_}; } split(/,/,$changes->{$item}{$key})); + } + } else { + if ($changes->{$item}{$key} eq '1') { + $displayval = &mt('Yes'); + } elsif ($changes->{$item}{$key} eq '') { + $displayval = &mt('No'); + } + } + $displayname = &mt($text); } elsif ($item eq 'menuitems') { unless ($changes->{$item}{$key} eq '') { if ($key eq 'menudefault') { @@ -2822,7 +2828,20 @@ sub store_changes { } } elsif ($changes->{$item}{$key} eq '') { push(@delkeys,$key); - if ($item eq 'menuitems') { + if ($item eq 'lti') { + if (($key eq 'lti.override') || (($key ne 'lti.override') && ($env{'form.lti.override'} ne ''))) { + if (($key eq 'lti.lcmenu') && + ((!$env{'form.lti.topmenu'}) && (!$env{'form.lti.inlinemenu'}))) { + $output .= '