version 1.358, 2019/05/06 01:30:14
|
version 1.362, 2019/06/04 03:16:19
|
Line 5904 sub print_privacy {
|
Line 5904 sub print_privacy {
|
'',$othertitle); |
'',$othertitle); |
$itemcount ++; |
$itemcount ++; |
} else { |
} else { |
$datatable .= &mt('Nothing to set here, as there are no other domains'); |
my (@insttypes,%insttitles); |
|
if ((ref($types) eq 'ARRAY') && (ref($usertypes) eq 'HASH')) { |
|
@insttypes = @{$types}; |
|
%insttitles = %{$usertypes}; |
|
} |
|
foreach my $item (@insttypes,'default') { |
|
my $title; |
|
if ($item eq 'default') { |
|
$title = $othertitle; |
|
} else { |
|
$title = $insttitles{$item}; |
|
} |
|
$css_class = $itemcount%2?' class="LC_odd_row"':''; |
|
$datatable .= '<tr'.$css_class.'>'. |
|
'<td class="LC_left_item">'.$title.'</td>'. |
|
'<td class="LC_left_item">'. |
|
&mt('Nothing to set here, as there are no other domains'). |
|
'</td></tr>'; |
|
$itemcount ++; |
|
} |
} |
} |
} |
} |
} else { |
} else { |
Line 6300 sub print_passwords {
|
Line 6319 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 10747 sub check_configuser {
|
Line 10797 sub check_configuser {
|
my ($configuserok,%currroles); |
my ($configuserok,%currroles); |
if ($uhome eq 'no_host') { |
if ($uhome eq 'no_host') { |
srand( time() ^ ($$ + ($$ << 15)) ); # Seed rand. |
srand( time() ^ ($$ + ($$ << 15)) ); # Seed rand. |
my $configpass = &LONCAPA::Enrollment::create_password(); |
my $configpass = &LONCAPA::Enrollment::create_password($dom); |
$configuserok = |
$configuserok = |
&Apache::lonnet::modifyuser($dom,$confname,'','internal', |
&Apache::lonnet::modifyuser($dom,$confname,'','internal', |
$configpass,'','','','','',undef,$servadm); |
$configpass,'','','','','',undef,$servadm); |
Line 14588 sub modify_passwords {
|
Line 14638 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 14678 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 14859 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>'; |
Line 15636 sub modify_selfcreation {
|
Line 15728 sub modify_selfcreation {
|
$chgtext .= &mt('For self-created accounts verified by e-mail address, username is set as follows:'). |
$chgtext .= &mt('For self-created accounts verified by e-mail address, username is set as follows:'). |
'<ul>'; |
'<ul>'; |
foreach my $status (@statuses) { |
foreach my $status (@statuses) { |
if ($type eq 'default') { |
if ($status eq 'default') { |
$chgtext .= '<li>'.$othertitle.' -- '.$options{$cancreate{'emailverified'}{$status}}.'</li>'; |
$chgtext .= '<li>'.$othertitle.' -- '.$options{$cancreate{'emailverified'}{$status}}.'</li>'; |
} else { |
} else { |
$chgtext .= '<li>'.$usertypes{$status}.' -- '.$options{$cancreate{'emailverified'}{$status}}.'</li>'; |
$chgtext .= '<li>'.$usertypes{$status}.' -- '.$options{$cancreate{'emailverified'}{$status}}.'</li>'; |