version 1.358, 2019/05/06 01:30:14
|
version 1.359, 2019/05/06 19:28:17
|
Line 6300 sub print_passwords {
|
Line 6300 sub print_passwords {
|
'<span class="LC_fontsize_small"> '.&mt('(Leave blank to not save previous passwords)').'</span>'. |
'<span class="LC_fontsize_small"> '.&mt('(Leave blank to not save previous passwords)').'</span>'. |
'</span></td></tr>'; |
'</span></td></tr>'; |
} else { |
} else { |
my $checkedon; |
my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom); |
my $checkedoff = ' checked="checked"'; |
my %ownerchg = ( |
|
by => {}, |
|
for => {}, |
|
); |
|
my %ownertitles = &Apache::lonlocal::texthash ( |
|
by => 'Course owner status(es) allowed', |
|
for => 'Student status(es) allowed', |
|
); |
if (ref($settings) eq 'HASH') { |
if (ref($settings) eq 'HASH') { |
if ($settings->{crsownerchg}) { |
if (ref($settings->{crsownerchg}) eq 'HASH') { |
$checkedon = $checkedoff; |
if (ref($settings->{crsownerchg}{'by'}) eq 'ARRAY') { |
$checkedoff = ''; |
map { $ownerchg{by}{$_} = 1; } (@{$settings->{crsownerchg}{'by'}}); |
|
} |
|
if (ref($settings->{crsownerchg}{'for'}) eq 'ARRAY') { |
|
map { $ownerchg{for}{$_} = 1; } (@{$settings->{crsownerchg}{'for'}}); |
|
} |
} |
} |
} |
} |
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
$datatable .= '<tr '.$css_class.'>'. |
$datatable .= '<tr '.$css_class.'>'. |
'<td>'. |
'<td>'. |
&mt('Requirements').'<ul>'. |
&mt('Requirements').'<ul>'. |
'<li>'.&mt("Course 'type' is not a Community").'</li>'. |
'<li>'.&mt("Course 'type' is not a Community or Placement Test").'</li>'. |
'<li>'.&mt('User is Course Coordinator and also course owner').'</li>'. |
'<li>'.&mt('User is Course Coordinator and also course owner').'</li>'. |
'<li>'.&mt("Student's only active roles are student role(s) in course(s) owned by this user").'</li>'. |
'<li>'.&mt("Student's only active roles are student role(s) in course(s) owned by this user").'</li>'. |
|
'<li>'.&mt('User, course, and student share same domain').'</li>'. |
'</ul>'. |
'</ul>'. |
'</td>'. |
'</td>'. |
'<td class="LC_left_item" colspan="2"><span class="LC_nobreak">'. |
'<td class="LC_left_item">'; |
'<label><input type="radio" name="passwords_crsowner" value="1"'.$checkedon.' />'.&mt('Yes').'</label></span> '. |
foreach my $item ('by','for') { |
'<span class="LC_nobreak"><label><input type="radio" name="passwords_crsowner" value="0"'.$checkedoff.' />'. |
$datatable .= '<fieldset style="display: inline-block;">'. |
&mt('No').'</label></span>'. |
'<legend>'.$ownertitles{$item}.'</legend>'; |
'</td></tr>'; |
if ((ref($types) eq 'ARRAY') && (ref($usertypes) eq 'HASH')) { |
|
foreach my $type (@{$types}) { |
|
my $checked; |
|
if ($ownerchg{$item}{$type}) { |
|
$checked = ' checked="checked"'; |
|
} |
|
$datatable .= '<span class="LC_nobreak"><label>'. |
|
'<input type="checkbox" name="passwords_crsowner_'.$item.'" value="'. |
|
$type.'"'.$checked.' />'.$usertypes->{$type}.'</label>'. |
|
'<span> '; |
|
} |
|
} |
|
my $checked; |
|
if ($ownerchg{$item}{'default'}) { |
|
$checked = ' checked="checked"'; |
|
} |
|
$datatable .= '<span class="LC_nobreak"><label><input type="checkbox" '. |
|
'name="passwords_crsowner_'.$item.'" value="default"'.$checked.' />'. |
|
$othertitle.'</label></span></fieldset>'; |
|
} |
|
$datatable .= '</td></tr>'; |
} |
} |
return $datatable; |
return $datatable; |
} |
} |
Line 14588 sub modify_passwords {
|
Line 14619 sub modify_passwords {
|
my $ruleok; |
my $ruleok; |
if ($rule eq 'expire') { |
if ($rule eq 'expire') { |
if ($env{'form.passwords_'.$rule} =~ /^\d+(|\.\d*)$/) { |
if ($env{'form.passwords_'.$rule} =~ /^\d+(|\.\d*)$/) { |
$ruleok = 1; |
$ruleok = 1; |
} |
} |
} elsif ($env{'form.passwords_'.$rule} =~ /^\d+$/) { |
} elsif ($env{'form.passwords_'.$rule} =~ /^\d+$/) { |
$ruleok = 1; |
$ruleok = 1; |
Line 14628 sub modify_passwords {
|
Line 14659 sub modify_passwords {
|
} |
} |
} |
} |
} |
} |
if ($env{'form.passwords_crsowner'}) { |
my %crsownerchg = ( |
$newvalues{'crsownerchg'} = 1; |
by => [], |
unless ($current{'crsownerchg'}) { |
for => [], |
$changes{'crsownerchg'} = 1; |
); |
|
foreach my $item ('by','for') { |
|
my @posstypes = &Apache::loncommon::get_env_multiple('form.passwords_crsowner_'.$item); |
|
foreach my $type (sort(@posstypes)) { |
|
if (grep(/^\Q$type\E$/,@oktypes)) { |
|
push(@{$crsownerchg{$item}},$type); |
|
} |
|
} |
|
} |
|
$newvalues{'crsownerchg'} = \%crsownerchg; |
|
if (ref($current{'crsownerchg'}) eq 'HASH') { |
|
foreach my $item ('by','for') { |
|
if (ref($current{'crsownerchg'}{$item}) eq 'ARRAY') { |
|
my @diffs = &Apache::loncommon::compare_arrays($current{'crsownerchg'}{$item},$crsownerchg{$item}); |
|
if (@diffs > 0) { |
|
$changes{'crsownerchg'} = 1; |
|
last; |
|
} |
|
} |
|
} |
|
} elsif (!exists($domconfig{passwords})) { |
|
foreach my $item ('by','for') { |
|
if (@{$crsownerchg{$item}} > 0) { |
|
$changes{'crsownerchg'} = 1; |
|
last; |
|
} |
} |
} |
} elsif ($current{'crsownerchg'}) { |
|
$changes{'crsownerchg'} = 1; |
|
} |
} |
|
|
my %confighash = ( |
my %confighash = ( |
Line 14786 sub modify_passwords {
|
Line 14840 sub modify_passwords {
|
} |
} |
} |
} |
} elsif ($key eq 'crsownerchg') { |
} elsif ($key eq 'crsownerchg') { |
if ($confighash{'passwords'}{'crsownerchg'}) { |
if (ref($confighash{'passwords'}{'crsownerchg'}) eq 'HASH') { |
$resulttext .= '<li>'.&mt('Course owner may change student passwords.').'</li>'; |
if ((@{$confighash{'passwords'}{'crsownerchg'}{'by'}} == 0) || |
|
(@{$confighash{'passwords'}{'crsownerchg'}{'for'}} == 0)) { |
|
$resulttext .= '<li>'.&mt('Course owner may not change student passwords.').'</li>'; |
|
} else { |
|
my %crsownerstr; |
|
foreach my $item ('by','for') { |
|
if (ref($confighash{'passwords'}{'crsownerchg'}{$item}) eq 'ARRAY') { |
|
foreach my $type (@{$confighash{'passwords'}{'crsownerchg'}{$item}}) { |
|
if ($type eq 'default') { |
|
$crsownerstr{$item} .= $othertitle.', '; |
|
} elsif ($usertypes->{$type} ne '') { |
|
$crsownerstr{$item} .= $usertypes->{$type}.', '; |
|
} |
|
} |
|
$crsownerstr{$item} =~ s/\Q, \E$//; |
|
} |
|
} |
|
$resulttext .= '<li>'.&mt('Course owner (with status: [_1]) may change passwords for students (with status: [_2]).', |
|
$crsownerstr{'by'},$crsownerstr{'for'}).'</li>'; |
|
} |
} else { |
} else { |
$resulttext .= '<li>'.&mt('Course owner may not change student passwords.'); |
$resulttext .= '<li>'.&mt('Course owner may not change student passwords.').'</li>'; |
} |
} |
} |
} |
$resulttext .= '</ul></li>'; |
$resulttext .= '</ul></li>'; |