version 1.42, 2010/01/01 23:17:31
|
version 1.43, 2010/01/14 20:08:13
|
Line 94 described at http://www.lon-capa.org.
|
Line 94 described at http://www.lon-capa.org.
|
|
|
=item print_request_outcome() |
=item print_request_outcome() |
|
|
=item get_processtype() |
|
|
|
=item check_autolimit() |
=item check_autolimit() |
|
|
=item retrieve_settings() |
=item retrieve_settings() |
Line 2784 sub print_request_outcome {
|
Line 2782 sub print_request_outcome {
|
personnel => \%personnel, |
personnel => \%personnel, |
}; |
}; |
my (@inststatuses,$storeresult,$creationresult); |
my (@inststatuses,$storeresult,$creationresult); |
my $val = &get_processtype($dom,$crstype,\@inststatuses,\%domconfig); |
my $val = |
|
&Apache::loncoursequeueadmin::get_processtype($env{'user.name'},$env{'user.domain'}, |
|
$env{'user.adv'},$dom,$crstype,\@inststatuses,\%domconfig); |
if ($val eq '') { |
if ($val eq '') { |
if ($crstype eq 'official') { |
if ($crstype eq 'official') { |
$output = &mt('You are not permitted to request creation of official courses.'); |
$output = &mt('You are not permitted to request creation of official courses.'); |
Line 3145 sub notification_information {
|
Line 3145 sub notification_information {
|
return $output; |
return $output; |
} |
} |
|
|
sub get_processtype { |
|
my ($dom,$crstype,$inststatuses,$domconfig) = @_; |
|
return unless ((ref($inststatuses) eq 'ARRAY') && (ref($domconfig) eq 'HASH')); |
|
my (%userenv,%settings,$val); |
|
my @options = ('autolimit','validate','approval'); |
|
if ($dom eq $env{'user.domain'}) { |
|
%userenv = |
|
&Apache::lonnet::userenvironment($env{'user.domain'},$env{'user.name'}, |
|
'requestcourses.'.$crstype,'inststatus'); |
|
if ($userenv{'requestcourses.'.$crstype}) { |
|
$val = $userenv{'requestcourses.'.$crstype}; |
|
@{$inststatuses} = ('_custom_'); |
|
} else { |
|
my ($task,%alltasks); |
|
if (ref($domconfig->{'requestcourses'}) eq 'HASH') { |
|
%settings = %{$domconfig->{'requestcourses'}}; |
|
if (ref($settings{$crstype}) eq 'HASH') { |
|
if (($env{'user.adv'}) && ($settings{$crstype}{'_LC_adv'} ne '')) { |
|
$val = $settings{$crstype}{'_LC_adv'}; |
|
@{$inststatuses} = ('_LC_adv_'); |
|
} else { |
|
if ($userenv{'inststatus'} ne '') { |
|
@{$inststatuses} = split(',',$userenv{'inststatus'}); |
|
} else { |
|
@{$inststatuses} = ('default'); |
|
} |
|
foreach my $status (@{$inststatuses}) { |
|
if (exists($settings{$crstype}{$status})) { |
|
my $value = $settings{$crstype}{$status}; |
|
next unless ($value); |
|
unless (exists($alltasks{$value})) { |
|
if (ref($alltasks{$value}) eq 'ARRAY') { |
|
unless(grep(/^\Q$status\E$/,@{$alltasks{$value}})) { |
|
push(@{$alltasks{$value}},$status); |
|
} |
|
} else { |
|
@{$alltasks{$value}} = ($status); |
|
} |
|
} |
|
} |
|
} |
|
my $maxlimit = 0; |
|
|
|
foreach my $key (sort(keys(%alltasks))) { |
|
if ($key =~ /^autolimit=(\d*)$/) { |
|
if ($1 eq '') { |
|
$val ='autolimit='; |
|
last; |
|
} elsif ($1 > $maxlimit) { |
|
$maxlimit = $1; |
|
} |
|
} |
|
} |
|
if ($maxlimit) { |
|
$val = 'autolimit='.$maxlimit; |
|
} else { |
|
foreach my $option (@options) { |
|
if ($alltasks{$option}) { |
|
$val = $option; |
|
last; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} else { |
|
%userenv = &Apache::lonnet::userenvironment($env{'user.domain'}, |
|
$env{'user.name'},'reqcrsotherdom.'.$env{'form.crstype'}); |
|
if ($userenv{'reqcrsotherdom.'.$crstype}) { |
|
my @doms = split(',',$userenv{'reqcrsotherdom.'.$crstype}); |
|
my $optregex = join('|',@options); |
|
foreach my $item (@doms) { |
|
my ($extdom,$extopt) = split(':',$item); |
|
if ($extdom eq $dom) { |
|
if ($extopt =~ /^($optregex)(=?\d*)$/) { |
|
$val = $1.$2; |
|
} |
|
last; |
|
} |
|
} |
|
@{$inststatuses} = ('_external_'); |
|
} |
|
} |
|
return $val; |
|
} |
|
|
|
sub check_autolimit { |
sub check_autolimit { |
my ($uname,$udom,$dom,$crstype,$limit,$message) = @_; |
my ($uname,$udom,$dom,$crstype,$limit,$message) = @_; |
my %crsroles = &Apache::lonnet::get_my_roles($env{'user.name'},$env{'user.domain'}, |
my %crsroles = &Apache::lonnet::get_my_roles($env{'user.name'},$env{'user.domain'}, |