version 1.107, 2022/04/05 12:22:41
|
version 1.111, 2022/04/06 14:35:27
|
Line 601 sub handler {
|
Line 601 sub handler {
|
); |
); |
if (($phase eq 'process') && ($parm_permission->{'process'})) { |
if (($phase eq 'process') && ($parm_permission->{'process'})) { |
my @allitems = &get_allitems(%prefs); |
my @allitems = &get_allitems(%prefs); |
&Apache::lonconfigsettings::make_changes($r,$cdom,$phase,$context, |
my $result = &Apache::lonconfigsettings::make_changes($r,$cdom,$phase,$context, |
\@prefs_order,\%prefs,\%values, |
\@prefs_order,\%prefs,\%values, |
$cnum,undef,\@allitems, |
$cnum,undef,\@allitems, |
'coursepref',$parm_permission); |
'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'})) { |
} elsif (($phase eq 'display') && ($parm_permission->{'display'})) { |
my $noedit; |
my $noedit; |
if (ref($parm_permission) eq 'HASH') { |
if (ref($parm_permission) eq 'HASH') { |
Line 812 sub print_config_box {
|
Line 816 sub print_config_box {
|
} |
} |
|
|
sub process_changes { |
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); |
my (%newvalues,$errors); |
if (ref($item) eq 'HASH') { |
if (ref($item) eq 'HASH') { |
if (ref($changes) eq 'HASH') { |
if (ref($changes) eq 'HASH') { |
Line 981 sub process_changes {
|
Line 985 sub process_changes {
|
} |
} |
} elsif ($action eq 'linkprot') { |
} elsif ($action eq 'linkprot') { |
if (ref($values) eq 'HASH') { |
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 { |
} else { |
foreach my $entry (@ordered) { |
foreach my $entry (@ordered) { |
Line 1477 sub process_changes {
|
Line 1481 sub process_changes {
|
} |
} |
|
|
sub process_linkprot { |
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); |
my ($home,$dest,$ltiauth,$privkey,$privnum,$cipher,$errors,%linkprot); |
if (ref($values) eq 'HASH') { |
if (ref($values) eq 'HASH') { |
foreach my $id (keys(%{$values})) { |
foreach my $id (keys(%{$values})) { |
Line 1544 sub process_linkprot {
|
Line 1548 sub process_linkprot {
|
if (ref($values) eq 'HASH') { |
if (ref($values) eq 'HASH') { |
my @todelete = &Apache::loncommon::get_env_multiple('form.linkprot_del'); |
my @todelete = &Apache::loncommon::get_env_multiple('form.linkprot_del'); |
my $maxnum = $env{'form.linkprot_maxnum'}; |
my $maxnum = $env{'form.linkprot_maxnum'}; |
for (my $i=0; $i<=$maxnum; $i++) { |
for (my $i=0; $i<$maxnum; $i++) { |
my $itemid = $env{'form.linkprot_id_'.$i}; |
my $itemid = $env{'form.linkprot_id_'.$i}; |
$itemid =~ s/\D+//g; |
$itemid =~ s/\D+//g; |
if ($itemid) { |
if ($itemid) { |
Line 1673 sub process_linkprot {
|
Line 1677 sub process_linkprot {
|
foreach my $entry (keys(%haschanges)) { |
foreach my $entry (keys(%haschanges)) { |
$changes->{$entry} = $linkprot{$entry}; |
$changes->{$entry} = $linkprot{$entry}; |
} |
} |
|
if (ref($lastactref) eq 'HASH') { |
|
$lastactref->{'courselti'} = 1; |
|
} |
} |
} |
return $errors; |
return $errors; |
} |
} |
Line 2206 sub store_linkprot {
|
Line 2213 sub store_linkprot {
|
if (exists($oldlinkprot->{$id}{'usable'})) { |
if (exists($oldlinkprot->{$id}{'usable'})) { |
$changes->{$id}->{'usable'} = 1; |
$changes->{$id}->{'usable'} = 1; |
} |
} |
|
if (exists($oldlinkprot->{$id}{'cipher'})) { |
|
$changes->{$id}->{'cipher'} = $oldlinkprot->{$id}{'cipher'}; |
|
} |
} |
} |
} |
} |
} |
} |
Line 5764 sub print_linkprotection {
|
Line 5774 sub print_linkprotection {
|
} else { |
} else { |
$datatable .= '<span class="LC_nobreak">'.&mt('Secret required').' - '.$switchmessage.'</span>'."\n"; |
$datatable .= '<span class="LC_nobreak">'.&mt('Secret required').' - '.$switchmessage.'</span>'."\n"; |
} |
} |
|
$datatable .= '<input type="hidden" name="linkprot_id_'.$i.'" value="'.$num.'" />'; |
} else { |
} else { |
if ($values{'usable'} ne '') { |
if ($values{'usable'} ne '') { |
$datatable .= '<div id="linkprot_divcurrsecret_'.$i.'" style="display:inline-block" /><span class="LC_nobreak">'. |
$datatable .= '<div id="linkprot_divcurrsecret_'.$i.'" style="display:inline-block" /><span class="LC_nobreak">'. |
Line 6551 sub change_clone {
|
Line 6562 sub change_clone {
|
} |
} |
} |
} |
} |
} |
|
return; |
|
} |
|
|
|
sub devalidate_remote_courseprefs { |
|
my ($cdom,$cnum,$cachekeys) = @_; |
|
return unless (ref($cachekeys) eq 'HASH'); |
|
my %servers = &Apache::lonnet::internet_dom_servers($cdom); |
|
my %thismachine; |
|
map { $thismachine{$_} = 1; } &Apache::lonnet::current_machine_ids(); |
|
my @posscached = ('courselti'); |
|
if (keys(%servers)) { |
|
foreach my $server (keys(%servers)) { |
|
next if ($thismachine{$server}); |
|
my @cached; |
|
foreach my $name (@posscached) { |
|
if ($cachekeys->{$name}) { |
|
push(@cached,&escape($name).':'.&escape($cdom.'_'.$cnum)); |
|
} |
|
} |
|
if (@cached) { |
|
&Apache::lonnet::remote_devalidate_cache($server,\@cached); |
|
} |
|
} |
|
} |
return; |
return; |
} |
} |
|
|