--- loncom/interface/domainprefs.pm 2008/02/24 23:18:40 1.43 +++ loncom/interface/domainprefs.pm 2008/02/29 21:01:36 1.45 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set domain-wide configuration settings # -# $Id: domainprefs.pm,v 1.43 2008/02/24 23:18:40 raeburn Exp $ +# $Id: domainprefs.pm,v 1.45 2008/02/29 21:01:36 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1110,7 +1110,7 @@ ENDCOL sub print_quotas { my ($dom,$settings,$rowtotal) = @_; my $datatable; - my ($othertitle,$usertypes,$types) = &sorted_inst_types($dom); + my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom); my $typecount = 0; my $css_class; if (ref($types) eq 'ARRAY') { @@ -1240,7 +1240,7 @@ sub print_autoupdate { ''; $$rowtotal += 2; } else { - my ($othertitle,$usertypes,$types) = &sorted_inst_types($dom); + my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom); my @fields = ('lastname','firstname','middlename','gen', 'permanentemail','id'); my %fieldtitles = &Apache::loncommon::personal_data_fieldtitles(); @@ -1300,7 +1300,7 @@ sub print_directorysrch { } } my ($searchtitles,$titleorder) = &sorted_searchtitles(); - my ($othertitle,$usertypes,$types) = &sorted_inst_types($dom); + my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom); my $numinrow = 4; my $cansrchrow = 0; @@ -1509,7 +1509,7 @@ sub print_usercreation { $rowcount ++; } } elsif ($position eq 'middle') { - my @creators = ('author','course','selfenroll'); + my @creators = ('author','course','selfcreate'); my ($rules,$ruleorder) = &Apache::lonnet::inst_userrules($dom,'username'); my %lt = &usercreation_types(); @@ -1531,7 +1531,7 @@ sub print_usercreation { foreach my $item (@creators) { $rownum ++; if ($checked{$item} eq '') { - if ($item eq 'selfenroll') { + if ($item eq 'selfcreate') { $checked{$item} = 'none'; } else { $checked{$item} = 'any'; @@ -1547,7 +1547,7 @@ sub print_usercreation { ''.$lt{$item}. ''; my @options = ('any'); - if ($item eq 'selfenroll') { + if ($item eq 'selfcreate') { push(@options,('email','login','sso')); } else { if (ref($rules) eq 'HASH') { @@ -1626,7 +1626,7 @@ sub user_formats_row { my %text = ( 'username' => 'new usernames', 'id' => 'IDs', - 'email' => 'e-mail addresses of self-enrollers', + 'email' => 'self-created accounts (e-mail)', ); my $css_class = $rowcount%2?' class="LC_odd_row"':''; $output = ''. @@ -1677,7 +1677,7 @@ sub usercreation_types { my %lt = &Apache::lonlocal::texthash ( author => 'When adding a co-author', course => 'When adding a user to a course', - selfenroll => 'When a user is self-enrolling', + selfcreate => 'User creates own account', any => 'Any', official => 'Institutional only ', unofficial => 'Non-institutional only', @@ -1906,25 +1906,6 @@ sub users_cansearch_row { return $output; } -sub sorted_inst_types { - my ($dom) = @_; - my ($usertypes,$order) = &Apache::lonnet::retrieve_inst_usertypes($dom); - my $othertitle = &mt('All users'); - my @types; - if (ref($order) eq 'ARRAY') { - @types = @{$order}; - } - if (@types == 0) { - if (ref($usertypes) eq 'HASH') { - @types = sort(keys(%{$usertypes})); - } - } - if (keys(%{$usertypes}) > 0) { - $othertitle = &mt('Other users'); - } - return ($othertitle,$usertypes,\@types); -} - sub sorted_searchtitles { my %searchtitles = &Apache::lonlocal::texthash( 'uname' => 'username', @@ -2661,7 +2642,7 @@ END sub modify_quotas { my ($dom,%domconfig) = @_; my ($resulttext,%changes); - my ($othertitle,$usertypes,$types) = &sorted_inst_types($dom); + my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom); my %formhash; foreach my $key (keys(%env)) { if ($key =~ /^form\.quota_(.+)$/) { @@ -2796,7 +2777,7 @@ sub modify_autoupdate { run => 'Auto-update:', classlists => 'Updates to user information in classlists?' ); - my ($othertitle,$usertypes,$types) = &sorted_inst_types($dom); + my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom); my %fieldtitles = &Apache::lonlocal::texthash ( id => 'Student/Employee ID', permanentemail => 'E-mail address', @@ -2925,7 +2906,7 @@ sub modify_directorysrch { my @cansearch = &Apache::loncommon::get_env_multiple('form.cansearch'); my @searchby = &Apache::loncommon::get_env_multiple('form.searchby'); - my ($othertitle,$usertypes,$types) = &sorted_inst_types($dom); + my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom); if (keys(%{$usertypes}) == 0) { @cansearch = ('default'); } else { @@ -3200,10 +3181,10 @@ sub modify_usercreation { my @username_rule = &Apache::loncommon::get_env_multiple('form.username_rule'); my @id_rule = &Apache::loncommon::get_env_multiple('form.id_rule'); my @email_rule = &Apache::loncommon::get_env_multiple('form.email_rule'); - my @contexts = ('author','course','selfenroll'); + my @contexts = ('author','course','selfcreate'); foreach my $item(@contexts) { $cancreate{$item} = $env{'form.can_createuser_'.$item}; - if ($item eq 'selfenroll') { + if ($item eq 'selfcreate') { my %domdefaults = &Apache::lonnet::get_domain_defaults($dom); if (!((($domdefaults{'auth_def'} =~/^krb/) && ($domdefaults{'auth_arg_def'} ne '')) || ($domdefaults{'auth_def'} eq 'localauth'))) { if (($cancreate{$item} eq 'any') || ($cancreate{$item} eq 'login')) { @@ -3330,7 +3311,7 @@ sub modify_usercreation { my %lt = &usercreation_types(); foreach my $type (@{$changes{'cancreate'}}) { my $chgtext = $lt{$type}.', '; - if ($type eq 'selfenroll') { + if ($type eq 'selfcreate') { if ($cancreate{$type} eq 'none') { $chgtext .= &mt('creation of a new user account is not permitted.'); } elsif ($cancreate{$type} eq 'any') {