version 1.18, 2009/08/19 20:12:04
|
version 1.19, 2009/08/20 21:15:37
|
Line 429 sub check_can_request {
|
Line 429 sub check_can_request {
|
my ($dom,$can_request) = @_; |
my ($dom,$can_request) = @_; |
my $canreq = 0; |
my $canreq = 0; |
my ($types,$typename) = &course_types(); |
my ($types,$typename) = &course_types(); |
|
my @options = ('approval','validate','autolimit'); |
|
my $optregex = join('|',@options); |
if ((ref($can_request) eq 'HASH') && (ref($types) eq 'ARRAY')) { |
if ((ref($can_request) eq 'HASH') && (ref($types) eq 'ARRAY')) { |
foreach my $type (@{$types}) { |
foreach my $type (@{$types}) { |
if (&Apache::lonnet::usertools_access($env{'user.name'}, |
if (&Apache::lonnet::usertools_access($env{'user.name'}, |
Line 444 sub check_can_request {
|
Line 446 sub check_can_request {
|
if (@curr > 0) { |
if (@curr > 0) { |
$canreq ++; |
$canreq ++; |
unless ($dom eq $env{'user.domain'}) { |
unless ($dom eq $env{'user.domain'}) { |
if (grep(/^\Q$dom\E$/,@curr)) { |
if (grep(/^\Q$dom\E:($optregex)(=?\d*)$/,@curr)) { |
$can_request->{$type} = 1; |
$can_request->{$type} = 1; |
} |
} |
} |
} |
Line 1749 sub coursecode_form {
|
Line 1751 sub coursecode_form {
|
|
|
sub get_course_dom { |
sub get_course_dom { |
my $codedom = &Apache::lonnet::default_login_domain(); |
my $codedom = &Apache::lonnet::default_login_domain(); |
|
if ($env{'form.showdom'} ne '') { |
|
if (&Apache::lonnet::domain($env{'form.showdom'}) ne '') { |
|
return $env{'form.showdom'}; |
|
} |
|
} |
if (($env{'user.domain'} ne '') && ($env{'user.domain'} ne 'public')) { |
if (($env{'user.domain'} ne '') && ($env{'user.domain'} ne 'public')) { |
|
my ($types,$typename) = &course_types(); |
|
if (ref($types) eq 'ARRAY') { |
|
foreach my $type (@{$types}) { |
|
if (&Apache::lonnet::usertools_access($env{'user.name'}, |
|
$env{'user.domain'},$type, |
|
undef,'requestcourses')) { |
|
return $env{'user.domain'}; |
|
} |
|
} |
|
my @possible_doms; |
|
foreach my $type (@{$types}) { |
|
my $dom_str = $env{'environment.reqcrsotherdom.'.$type}; |
|
if ($dom_str ne '') { |
|
my @domains = split(',',$dom_str); |
|
foreach my $entry (@domains) { |
|
my ($extdom,$extopt) = split(':',$entry); |
|
if ($extdom eq $env{'request.role.domain'}) { |
|
return $extdom; |
|
} |
|
unless(grep(/^\Q$extdom\E$/,@possible_doms)) { |
|
push(@possible_doms,$extdom); |
|
} |
|
} |
|
} |
|
} |
|
if (@possible_doms) { |
|
@possible_doms = sort(@possible_doms); |
|
return $possible_doms[0]; |
|
} |
|
} |
$codedom = $env{'user.domain'}; |
$codedom = $env{'user.domain'}; |
if ($env{'request.role.domain'} ne '') { |
if ($env{'request.role.domain'} ne '') { |
$codedom = $env{'request.role.domain'}; |
$codedom = $env{'request.role.domain'}; |
} |
} |
} |
} |
if ($env{'form.showdom'} ne '') { |
|
if (&Apache::lonnet::domain($env{'form.showdom'}) ne '') { |
|
$codedom = $env{'form.showdom'}; |
|
} |
|
} |
|
return $codedom; |
return $codedom; |
} |
} |
|
|
Line 1962 sub print_request_outcome {
|
Line 1994 sub print_request_outcome {
|
my $val = &get_processtype($dom,$crstype,\@inststatuses,\%domconfig); |
my $val = &get_processtype($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.'); |
} elsif ($crstype eq 'unofficial') { |
} elsif ($crstype eq 'unofficial') { |
$output = &mt('You are not permitted to request creation of unofficial courses'); |
$output = &mt('You are not permitted to request creation of unofficial courses.'); |
} elsif ($crstype eq 'community') { |
} elsif ($crstype eq 'community') { |
$output = &mt('You are not permitted to request creation of communities'); |
$output = &mt('You are not permitted to request creation of communities'); |
} else { |
} else { |
Line 2114 sub print_request_outcome {
|
Line 2146 sub print_request_outcome {
|
¬ification_information($disposition,$req_notifylist,$cnum,$now); |
¬ification_information($disposition,$req_notifylist,$cnum,$now); |
} |
} |
if ($validationerror ne '') { |
if ($validationerror ne '') { |
$output .= '<span class="LC_warning">'.&mt('An error occurred validating your request with institutional data sources: {_1].',$validationerror).'</p>'; |
$output .= '<span class="LC_warning">'.&mt('An error occurred validating your request with institutional data sources: [_1].',$validationerror).'</p>'; |
} |
} |
} |
} |
return $output; |
return $output; |
Line 2161 sub get_processtype {
|
Line 2193 sub get_processtype {
|
my ($dom,$crstype,$inststatuses,$domconfig) = @_; |
my ($dom,$crstype,$inststatuses,$domconfig) = @_; |
return unless ((ref($inststatuses) eq 'ARRAY') && (ref($domconfig) eq 'HASH')); |
return unless ((ref($inststatuses) eq 'ARRAY') && (ref($domconfig) eq 'HASH')); |
my (%userenv,%settings,$val); |
my (%userenv,%settings,$val); |
my @options = ('autolimit','validate','approve'); |
my @options = ('autolimit','validate','approval'); |
if ($dom eq $env{'user.domain'}) { |
if ($dom eq $env{'user.domain'}) { |
%userenv = |
%userenv = |
&Apache::lonnet::userenvironment($env{'user.domain'},$env{'user.name'}, |
&Apache::lonnet::userenvironment($env{'user.domain'},$env{'user.name'}, |
Line 2227 sub get_processtype {
|
Line 2259 sub get_processtype {
|
} else { |
} else { |
%userenv = &Apache::lonnet::userenvironment($env{'user.domain'}, |
%userenv = &Apache::lonnet::userenvironment($env{'user.domain'}, |
$env{'user.name'},'reqcrsotherdom.'.$env{'form.crstype'}); |
$env{'user.name'},'reqcrsotherdom.'.$env{'form.crstype'}); |
if ($userenv{'reqcrsotherdom'}) { |
if ($userenv{'reqcrsotherdom.'.$crstype}) { |
my @doms = split(',',$userenv{'reqcrsotherdom'}); |
my @doms = split(',',$userenv{'reqcrsotherdom.'.$crstype}); |
my $optregex = join('|',@options); |
my $optregex = join('|',@options); |
if (grep(/^\Q$dom\E:($optregex=?\d*)/,@doms)) { |
foreach my $item (@doms) { |
$val = $1; |
my ($extdom,$extopt) = split(':',$item); |
|
if ($extdom eq $dom) { |
|
if ($extopt =~ /^($optregex)(=?\d*)$/) { |
|
$val = $1.$2; |
|
} |
|
last; |
|
} |
} |
} |
@{$inststatuses} = ('_external_'); |
@{$inststatuses} = ('_external_'); |
} |
} |