version 1.92, 2009/04/22 12:42:16
|
version 1.93, 2009/04/22 14:09:13
|
Line 1299 sub print_directorysrch {
|
Line 1299 sub print_directorysrch {
|
$$rowtotal += 2; |
$$rowtotal += 2; |
if (ref($usertypes) eq 'HASH') { |
if (ref($usertypes) eq 'HASH') { |
if (keys(%{$usertypes}) > 0) { |
if (keys(%{$usertypes}) > 0) { |
$datatable .= &users_cansearch_row($settings,$types,$usertypes,$dom, |
$datatable .= &insttypes_row($settings,$types,$usertypes,$dom, |
$numinrow,$othertitle); |
$numinrow,$othertitle,'cansearch'); |
$cansrchrow = 1; |
$cansrchrow = 1; |
} |
} |
} |
} |
Line 1315 sub print_directorysrch {
|
Line 1315 sub print_directorysrch {
|
foreach my $title (@{$titleorder}) { |
foreach my $title (@{$titleorder}) { |
if (defined($searchtitles->{$title})) { |
if (defined($searchtitles->{$title})) { |
my $check = ' '; |
my $check = ' '; |
if (ref($settings) eq 'HASH') { |
if (ref($settings) eq 'HASH') { |
if (ref($settings->{'searchby'}) eq 'ARRAY') { |
if (ref($settings->{'searchby'}) eq 'ARRAY') { |
if (grep(/^\Q$title\E$/,@{$settings->{'searchby'}})) { |
if (grep(/^\Q$title\E$/,@{$settings->{'searchby'}})) { |
$check = ' checked="checked" '; |
$check = ' checked="checked" '; |
Line 1570 sub print_usercreation {
|
Line 1570 sub print_usercreation {
|
} |
} |
$datatable .= '</td></tr>'; |
$datatable .= '</td></tr>'; |
} |
} |
|
my ($othertitle,$usertypes,$types) = |
|
&Apache::loncommon::sorted_inst_types($dom); |
|
if (ref($usertypes) eq 'HASH') { |
|
if (keys(%{$usertypes}) > 0) { |
|
$datatable .= &insttypes_row($settings->{cancreate},$types,$usertypes, |
|
$dom,$numinrow,$othertitle, |
|
'statustocreate'); |
|
$$rowtotal ++; |
|
} |
|
} |
} else { |
} else { |
my @contexts = ('author','course','domain'); |
my @contexts = ('author','course','domain'); |
my @authtypes = ('int','krb4','krb5','loc'); |
my @authtypes = ('int','krb4','krb5','loc'); |
Line 2460 sub modifiable_userdata_row {
|
Line 2470 sub modifiable_userdata_row {
|
return $output; |
return $output; |
} |
} |
|
|
sub users_cansearch_row { |
sub insttypes_row { |
my ($settings,$types,$usertypes,$dom,$numinrow,$othertitle) = @_; |
my ($settings,$types,$usertypes,$dom,$numinrow,$othertitle,$context) = @_; |
|
my %lt = &Apache::lonlocal::texthash ( |
|
cansearch => 'Users allowed to search', |
|
statustocreate => 'Institutional affiliation(s) able to create own account (login/SSO)', |
|
); |
|
my $showdom; |
|
if ($context eq 'cansearch') { |
|
$showdom = ' ('.$dom.')'; |
|
} |
my $output = '<tr class="LC_odd_row">'. |
my $output = '<tr class="LC_odd_row">'. |
'<td>'.&mt('Users allowed to search').' ('.$dom.')'. |
'<td>'.$lt{$context}.$showdom. |
'</td><td class="LC_left_item" colspan="2"><table>'; |
'</td><td class="LC_left_item" colspan="2"><table>'; |
my $rem; |
my $rem; |
if (ref($types) eq 'ARRAY') { |
if (ref($types) eq 'ARRAY') { |
Line 2477 sub users_cansearch_row {
|
Line 2495 sub users_cansearch_row {
|
$output .= '<tr>'; |
$output .= '<tr>'; |
} |
} |
my $check = ' '; |
my $check = ' '; |
if (ref($settings->{'cansearch'}) eq 'ARRAY') { |
if (ref($settings->{$context}) eq 'ARRAY') { |
if (grep(/^\Q$types->[$i]\E$/,@{$settings->{'cansearch'}})) { |
if (grep(/^\Q$types->[$i]\E$/,@{$settings->{$context}})) { |
$check = ' checked="checked" '; |
$check = ' checked="checked" '; |
} |
} |
|
} elsif ($context eq 'statustocreate') { |
|
$check = ' checked="checked" '; |
} |
} |
$output .= '<td class="LC_left_item">'. |
$output .= '<td class="LC_left_item">'. |
'<span class="LC_nobreak"><label>'. |
'<span class="LC_nobreak"><label>'. |
'<input type="checkbox" name="cansearch" '. |
'<input type="checkbox" name="'.$context.'" '. |
'value="'.$types->[$i].'"'.$check.'/>'. |
'value="'.$types->[$i].'"'.$check.'/>'. |
$usertypes->{$types->[$i]}.'</label></span></td>'; |
$usertypes->{$types->[$i]}.'</label></span></td>'; |
} |
} |
Line 2499 sub users_cansearch_row {
|
Line 2519 sub users_cansearch_row {
|
$output .= '<td class="LC_left_item">'; |
$output .= '<td class="LC_left_item">'; |
} |
} |
my $defcheck = ' '; |
my $defcheck = ' '; |
if (ref($settings->{'cansearch'}) eq 'ARRAY') { |
if (ref($settings->{$context}) eq 'ARRAY') { |
if (grep(/^default$/,@{$settings->{'cansearch'}})) { |
if (grep(/^default$/,@{$settings->{$context}})) { |
$defcheck = ' checked="checked" '; |
$defcheck = ' checked="checked" '; |
} |
} |
|
} elsif ($context eq 'statustocreate') { |
|
$defcheck = ' checked="checked" '; |
} |
} |
$output .= '<span class="LC_nobreak"><label>'. |
$output .= '<span class="LC_nobreak"><label>'. |
'<input type="checkbox" name="cansearch" '. |
'<input type="checkbox" name="'.$context.'" '. |
'value="default"'.$defcheck.'/>'. |
'value="default"'.$defcheck.'/>'. |
$othertitle.'</label></span></td>'. |
$othertitle.'</label></span></td>'. |
'</tr></table></td></tr>'; |
'</tr></table></td></tr>'; |
Line 3978 sub modify_usercreation {
|
Line 4000 sub modify_usercreation {
|
$cancreate{$item} = $env{'form.can_createuser_'.$item}; |
$cancreate{$item} = $env{'form.can_createuser_'.$item}; |
} |
} |
} |
} |
|
my ($othertitle,$usertypes,$types) = |
|
&Apache::loncommon::sorted_inst_types($dom); |
|
if (ref($types) eq 'ARRAY') { |
|
if (@{$types} > 0) { |
|
@{$cancreate{'statustocreate'}} = |
|
&Apache::loncommon::get_env_multiple('form.statustocreate'); |
|
} |
|
push(@contexts,'statustocreate'); |
|
} |
if (ref($curr_usercreation{'cancreate'}) eq 'HASH') { |
if (ref($curr_usercreation{'cancreate'}) eq 'HASH') { |
foreach my $item (@contexts) { |
foreach my $item (@contexts) { |
if ($item eq 'selfcreate') { |
if (($item eq 'selfcreate') || ($item eq 'statustocreate')) { |
if (ref($curr_usercreation{'cancreate'}{$item}) eq 'ARRAY') { |
if (ref($curr_usercreation{'cancreate'}{$item}) eq 'ARRAY') { |
foreach my $curr (@{$curr_usercreation{'cancreate'}{$item}}) { |
foreach my $curr (@{$curr_usercreation{'cancreate'}{$item}}) { |
if (!grep(/^$curr$/,@{$cancreate{$item}})) { |
if (!grep(/^$curr$/,@{$cancreate{$item}})) { |
if (!grep(/^$item$/,@{$changes{'cancreate'}})) { |
if (!grep(/^$item$/,@{$changes{'cancreate'}})) { |
Line 4168 sub modify_usercreation {
|
Line 4199 sub modify_usercreation {
|
} |
} |
$chgtext .= '</ul>'; |
$chgtext .= '</ul>'; |
} |
} |
|
} elsif ($type eq 'statustocreate') { |
|
if (@{$cancreate{'selfcreate'}} > 0) { |
|
if (@{$cancreate{$type}} == 0) { |
|
if (!grep(/^email$/,@{$cancreate{'selfcreate'}})) { |
|
$chgtext .= &mt("However, no institutional affiliations (including 'other') are currently permitted to create accounts."); |
|
} |
|
} elsif (ref($usertypes) eq 'HASH') { |
|
if (grep(/^(login|sso)$/,@{$cancreate{'selfcreate'}})) { |
|
$chgtext .= &mt('creation of a new account for an institutional user is restricted to the following institutional affiliation(s):').'<ul>'; |
|
foreach my $case (@{$cancreate{$type}}) { |
|
if ($case eq 'default') { |
|
$chgtext .= '<li>'.$othertitle.'</li>'; |
|
} else { |
|
$chgtext .= '<li>'.$usertypes->{$case}.'</li>'; |
|
} |
|
} |
|
$chgtext .= '</ul>'; |
|
} |
|
} |
|
} |
} else { |
} else { |
if ($cancreate{$type} eq 'none') { |
if ($cancreate{$type} eq 'none') { |
$chgtext .= &mt('creation of new users is not permitted, except by a Domain Coordinator.'); |
$chgtext .= &mt('creation of new users is not permitted, except by a Domain Coordinator.'); |