--- loncom/interface/courseprefs.pm 2022/02/20 22:18:23 1.49.2.28.2.5 +++ loncom/interface/courseprefs.pm 2022/04/05 18:19:33 1.49.2.28.2.9 @@ -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.5 2022/02/20 22:18:23 raeburn Exp $ +# $Id: courseprefs.pm,v 1.49.2.28.2.9 2022/04/05 18:19:33 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -586,10 +586,14 @@ sub handler { ); if (($phase eq 'process') && ($parm_permission->{'process'})) { my @allitems = &get_allitems(%prefs); - &Apache::lonconfigsettings::make_changes($r,$cdom,$phase,$context, - \@prefs_order,\%prefs,\%values, - $cnum,undef,\@allitems, - 'coursepref',$parm_permission); + my $result = &Apache::lonconfigsettings::make_changes($r,$cdom,$phase,$context, + \@prefs_order,\%prefs,\%values, + $cnum,undef,\@allitems, + 'coursepref',$parm_permission); + if ((ref($result) eq 'HASH') && (keys(%{$result}))) { + $r->rflush(); + &devalidate_remote_courseprefs($cdom,$cnum,$result); + } } elsif (($phase eq 'display') && ($parm_permission->{'display'})) { my $noedit; if (ref($parm_permission) eq 'HASH') { @@ -795,7 +799,7 @@ sub print_config_box { } sub process_changes { - my ($cdom,$cnum,$action,$values,$item,$changes,$allitems,$disallowed,$crstype) = @_; + my ($cdom,$cnum,$action,$values,$item,$changes,$allitems,$disallowed,$crstype,$lastactref) = @_; my (%newvalues,$errors); if (ref($item) eq 'HASH') { if (ref($changes) eq 'HASH') { @@ -964,7 +968,7 @@ sub process_changes { } } elsif ($action eq 'linkprot') { if (ref($values) eq 'HASH') { - $errors = &process_linkprot($cdom,$cnum,$values->{$action},$changes,'course'); + $errors = &process_linkprot($cdom,$cnum,$values->{$action},$changes,'course',$lastactref); } } else { foreach my $entry (@ordered) { @@ -1426,7 +1430,7 @@ sub process_changes { } sub process_linkprot { - my ($cdom,$cnum,$values,$changes,$context) = @_; + my ($cdom,$cnum,$values,$changes,$context,$lastactref) = @_; my ($home,$dest,$ltiauth,$privkey,$privnum,$cipher,$errors,%linkprot); if (ref($values) eq 'HASH') { foreach my $id (keys(%{$values})) { @@ -1621,6 +1625,9 @@ sub process_linkprot { foreach my $entry (keys(%haschanges)) { $changes->{$entry} = $linkprot{$entry}; } + if (ref($lastactref) eq 'HASH') { + $lastactref->{'courselti'} = 1; + } } return $errors; } @@ -2123,6 +2130,9 @@ sub store_linkprot { if (exists($oldlinkprot->{$id}{'usable'})) { $changes->{$id}->{'usable'} = 1; } + if (exists($oldlinkprot->{$id}{'cipher'})) { + $changes->{$id}->{'cipher'} = $oldlinkprot->{$id}{'cipher'}; + } } } } @@ -2731,6 +2741,16 @@ function toggleLinkProtReqUser(form,item } return; } + +function uncheckLinkProtMakeVis(item,num) { + if (document.getElementById('linkprot_'+item+'_'+num)) { + var currtype = document.getElementById('linkprot_'+item+'_'+num).type; + if (currtype.toLowerCase() == 'checkbox') { + document.getElementById('linkprot_'+item+'_'+num).checked = false; + } + } + return; +} ENDSCRIPT } @@ -5245,9 +5265,6 @@ sub menucollections_display { sub print_linkprotection { my ($cdom,$cnum,$settings,$rowtotal,$crstype,$noedit,$context) = @_; - unless (ref($settings) eq 'HASH') { - return; - } my %linkprotection; my $count = 0; @@ -5292,7 +5309,7 @@ sub print_linkprotection { } } - if (ref($settings->{'linkprot'}) eq 'HASH') { + if ((ref($settings) eq 'HASH') && (ref($settings->{'linkprot'}) eq 'HASH')) { if (keys(%{$settings->{'linkprot'}})) { my @current = sort { $a <=> $b } keys(%{$settings->{'linkprot'}}); $next += $current[-1]; @@ -5389,13 +5406,13 @@ sub print_linkprotection { '
'. ''.&mt('New Secret').':'. ''. - ''. + ''. ''; } else { $datatable .= ''.$desc{'secret'}.':'. ''. - ''. + ''. ''; } } @@ -5415,7 +5432,7 @@ sub print_linkprotection { $datatable .= '