version 1.12, 2008/07/17 12:22:28
|
version 1.13, 2008/07/17 20:08:17
|
Line 453 sub process_self_enroll {
|
Line 453 sub process_self_enroll {
|
sub user_can_selfenroll { |
sub user_can_selfenroll { |
my ($udom,$uname,$domenrolltypes) = @_; |
my ($udom,$uname,$domenrolltypes) = @_; |
my $selfenroll = 0; |
my $selfenroll = 0; |
my @info = ['inststatus']; |
my %userhash = &Apache::lonnet::userenvironment($udom,$uname,'inststatus'); |
my %userhash = &Apache::lonnet::userenvironment($udom,$uname,@info); |
|
my @inststatuses; |
my @inststatuses; |
if ($userhash{'inststatus'} eq '') { |
if ($userhash{'inststatus'} eq '') { |
push(@inststatuses,'other'); |
push(@inststatuses,'other'); |
} else { |
} else { |
my @esc_statuses = split(/:/,$userhash{'inststatus'}); |
@inststatuses = split(':',$userhash{'inststatus'}); |
@inststatuses = map { &unescape($_); } (@esc_statuses); |
|
} |
} |
foreach my $type (@inststatuses) { |
foreach my $type (@inststatuses) { |
if (ref($domenrolltypes) eq 'ARRAY') { |
if (ref($domenrolltypes) eq 'ARRAY') { |
Line 508 sub get_selfenroll_filters {
|
Line 506 sub get_selfenroll_filters {
|
if ($selfdom =~ /^$match_domain$/) { |
if ($selfdom =~ /^$match_domain$/) { |
if (&Apache::lonnet::domain($selfdom) ne '') { |
if (&Apache::lonnet::domain($selfdom) ne '') { |
my @types = split(/,/,$type_str); |
my @types = split(/,/,$type_str); |
|
my @unesc_types = map { &unescape($_); } @types; |
my ($othertitle,$usertypes,$types) = |
my ($othertitle,$usertypes,$types) = |
&Apache::loncommon::sorted_inst_types($selfdom); |
&Apache::loncommon::sorted_inst_types($selfdom); |
if (ref($usertypes) eq 'HASH') { |
if (ref($usertypes) eq 'HASH') { |
my $anytype = 1; |
my $anytype = 1; |
foreach my $key (keys(%{$usertypes})) { |
foreach my $key (keys(%{$usertypes})) { |
if (!grep(/^\Q$key\E$/,@types)) { |
if (!grep(/^\Q$key\E$/,@unesc_types)) { |
$anytype = 0; |
$anytype = 0; |
last; |
last; |
} |
} |
Line 525 sub get_selfenroll_filters {
|
Line 524 sub get_selfenroll_filters {
|
} |
} |
$usertypes->{'any'} = &mt('Any users'); |
$usertypes->{'any'} = &mt('Any users'); |
$usertypes->{'other'} = &mt('Others'); |
$usertypes->{'other'} = &mt('Others'); |
|
my @showtypes; |
if ($anytype) { |
if ($anytype) { |
@{$enrolltypes{$selfdom}} = ('any'); |
@{$enrolltypes{$selfdom}} = ('any'); |
|
@showtypes = ('any'); |
} else { |
} else { |
@{$enrolltypes{$selfdom}} = @types; |
@{$enrolltypes{$selfdom}} = @types; |
|
@showtypes = @unesc_types; |
} |
} |
@{$longtypes{$selfdom}} = |
@{$longtypes{$selfdom}} = |
map {$usertypes->{$_}} @{$enrolltypes{$selfdom}} |
map {$usertypes->{$_}} @showtypes; |
} |
} |
} |
} |
} |
} |