version 1.104, 2022/02/16 15:58:28
|
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 1656 sub process_linkprot {
|
Line 1660 sub process_linkprot {
|
} |
} |
} else { |
} else { |
$linkprot{$itemid}{'secret'} = $current{'secret'}; |
$linkprot{$itemid}{'secret'} = $current{'secret'}; |
|
$linkprot{$itemid}{'cipher'} = $current{'cipher'}; |
} |
} |
} elsif ($env{$secretitem} ne '') { |
} elsif ($env{$secretitem} ne '') { |
if ($privnum && $cipher) { |
if ($privnum && $cipher) { |
Line 1672 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 2205 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 2815 function toggleLinkProtReqUser(form,item
|
Line 2826 function toggleLinkProtReqUser(form,item
|
} |
} |
return; |
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 |
ENDSCRIPT |
|
|
} |
} |
Line 5623 sub menucollections_display {
|
Line 5644 sub menucollections_display {
|
|
|
sub print_linkprotection { |
sub print_linkprotection { |
my ($cdom,$cnum,$settings,$rowtotal,$crstype,$noedit,$context) = @_; |
my ($cdom,$cnum,$settings,$rowtotal,$crstype,$noedit,$context) = @_; |
unless (ref($settings) eq 'HASH') { |
|
return; |
|
} |
|
|
|
my %linkprotection; |
my %linkprotection; |
my $count = 0; |
my $count = 0; |
Line 5670 sub print_linkprotection {
|
Line 5688 sub print_linkprotection {
|
} |
} |
} |
} |
|
|
if (ref($settings->{'linkprot'}) eq 'HASH') { |
if ((ref($settings) eq 'HASH') && (ref($settings->{'linkprot'}) eq 'HASH')) { |
if (keys(%{$settings->{'linkprot'}})) { |
if (keys(%{$settings->{'linkprot'}})) { |
my @current = sort { $a <=> $b } keys(%{$settings->{'linkprot'}}); |
my @current = sort { $a <=> $b } keys(%{$settings->{'linkprot'}}); |
$next += $current[-1]; |
$next += $current[-1]; |
Line 5756 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 5767 sub print_linkprotection {
|
Line 5786 sub print_linkprotection {
|
'</label> </span><div id="linkprot_divchgsecret_'.$i.'" style="display:none" />'. |
'</label> </span><div id="linkprot_divchgsecret_'.$i.'" style="display:none" />'. |
'<span class="LC_nobreak">'.&mt('New Secret').':'. |
'<span class="LC_nobreak">'.&mt('New Secret').':'. |
'<input type="password" size="20" name="linkprot_secret_'.$i.'" value="" autocomplete="off"'.$disabled.' />'. |
'<input type="password" size="20" name="linkprot_secret_'.$i.'" value="" autocomplete="off"'.$disabled.' />'. |
'<label><input type="checkbox" name="visible" onclick="if (this.checked) { this.form.linkprot_secret_'.$i.'.type='."'text'".' } else { this.form.linkprot_secret_'.$i.'.type='."'password'".' }"'.$disabled.' />'.&mt('Visible input').'</label>'. |
'<label><input type="checkbox" name="linkprot_visible_'.$i.'" id="linkprot_visible_'.$i.'" onclick="if (this.checked) { this.form.linkprot_secret_'.$i.'.type='."'text'".' } else { this.form.linkprot_secret_'.$i.'.type='."'password'".' }"'.$disabled.' />'.&mt('Visible input').'</label>'. |
'<input type="hidden" name="linkprot_id_'.$i.'" value="'.$num.'" /></span></div>'; |
'<input type="hidden" name="linkprot_id_'.$i.'" value="'.$num.'" /></span></div>'; |
} else { |
} else { |
$datatable .= |
$datatable .= |
'<span class="LC_nobreak">'.$desc{'secret'}.':'. |
'<span class="LC_nobreak">'.$desc{'secret'}.':'. |
'<input type="password" size="20" name="linkprot_secret_'.$i.'" value="" autocomplete="off"'.$disabled.' />'. |
'<input type="password" size="20" name="linkprot_secret_'.$i.'" value="" autocomplete="off"'.$disabled.' />'. |
'<label><input type="checkbox" name="visible" onclick="if (this.checked) { this.form.linkprot_secret_'.$i.'.type='."'text'".' } else { this.form.linkprot_secret_'.$i.'.type='."'password'".' }"'.$disabled.' />'.&mt('Visible input').'</label>'. |
'<label><input type="checkbox" name="linkprot_visible_'.$i.'" id="linkprot_visible_'.$i.'" onclick="if (this.checked) { this.form.linkprot_secret_'.$i.'.type='."'text'".' } else { this.form.linkprot_secret_'.$i.'.type='."'password'".' }"'.$disabled.' />'.&mt('Visible input').'</label>'. |
'<input type="hidden" name="linkprot_id_'.$i.'" value="'.$num.'" /></span>'; |
'<input type="hidden" name="linkprot_id_'.$i.'" value="'.$num.'" /></span>'; |
} |
} |
} |
} |
Line 5793 sub print_linkprotection {
|
Line 5812 sub print_linkprotection {
|
$datatable .= '<tr '.$css_class.'><td><span class="LC_nobreak">'."\n". |
$datatable .= '<tr '.$css_class.'><td><span class="LC_nobreak">'."\n". |
'<input type="hidden" name="linkprot_maxnum" value="'.$next.'" />'."\n". |
'<input type="hidden" name="linkprot_maxnum" value="'.$next.'" />'."\n". |
'<input type="checkbox" name="linkprot_add" value="1"'.$disabled.' />'.&mt('Add').'</span></td>'."\n". |
'<input type="checkbox" name="linkprot_add" value="1"'.$disabled.' />'.&mt('Add').'</span></td>'."\n". |
'<td>'; |
'<td width="100%">'; |
my ($usersty,$onclickrequser,%checkedrequser); |
my ($usersty,$onclickrequser,%checkedrequser); |
if ($ltiauth) { |
if ($ltiauth) { |
$usersty = 'display:none'; |
$usersty = 'display:none'; |
Line 5825 sub print_linkprotection {
|
Line 5844 sub print_linkprotection {
|
$datatable .= '<span class="LC_nobreak">'.$desc{'key'}.':<input type="text" size="25" name="linkprot_key_add" value="" autocomplete="off"'.$disabled.' /></span> '."\n". |
$datatable .= '<span class="LC_nobreak">'.$desc{'key'}.':<input type="text" size="25" name="linkprot_key_add" value="" autocomplete="off"'.$disabled.' /></span> '."\n". |
(' 'x2). |
(' 'x2). |
'<span class="LC_nobreak">'.$desc{'secret'}.':<input type="password" size="20" name="linkprot_secret_add" value="" autocomplete="off"'.$disabled.' />'. |
'<span class="LC_nobreak">'.$desc{'secret'}.':<input type="password" size="20" name="linkprot_secret_add" value="" autocomplete="off"'.$disabled.' />'. |
'<label><input type="checkbox" name="visible" onclick="if (this.checked) { this.form.linkprot_secret_add.type='."'text'".' } else { this.form.linkprot_secret_add.type='."'password'".' }"'.$disabled.' />'.&mt('Visible input').'</label></span> '."\n"; |
'<label><input type="checkbox" name="linkprot_visible_add" id="linkprot_visible_add" onclick="if (this.checked) { this.form.linkprot_secret_add.type='."'text'".' } else { this.form.linkprot_secret_add.type='."'password'".' }"'.$disabled.' />'.&mt('Visible input').'</label></span> '."\n"; |
} |
} |
if ($ltiauth) { |
if ($ltiauth) { |
$datatable .= '</fieldset>'. |
$datatable .= '</fieldset>'. |
Line 6543 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; |
} |
} |
|
|