version 1.36, 2009/09/13 03:13:55
|
version 1.37, 2009/10/24 03:24:13
|
Line 52 described at http://www.lon-capa.org.
|
Line 52 described at http://www.lon-capa.org.
|
|
|
=item onload_action() |
=item onload_action() |
|
|
=item check_can_request() |
|
|
|
=item course_types() |
|
|
|
=item print_main_menu() |
=item print_main_menu() |
|
|
=item request_administration() |
=item request_administration() |
Line 277 sub handler {
|
Line 273 sub handler {
|
my $loaditems = &onload_action($action,$state); |
my $loaditems = &onload_action($action,$state); |
|
|
my %can_request; |
my %can_request; |
my $canreq = &check_can_request($dom,\%can_request); |
my $canreq = &Apache::lonnet::check_can_request($dom,\%can_request); |
if ($action eq 'new') { |
if ($action eq 'new') { |
if ($canreq) { |
if ($canreq) { |
if ($state eq 'crstype') { |
if ($state eq 'crstype') { |
Line 594 sub onload_action {
|
Line 590 sub onload_action {
|
return \%loaditems; |
return \%loaditems; |
} |
} |
|
|
sub check_can_request { |
|
my ($dom,$can_request) = @_; |
|
my $canreq = 0; |
|
my ($types,$typename) = &course_types(); |
|
my @options = ('approval','validate','autolimit'); |
|
my $optregex = join('|',@options); |
|
if ((ref($can_request) eq 'HASH') && (ref($types) eq 'ARRAY')) { |
|
foreach my $type (@{$types}) { |
|
if (&Apache::lonnet::usertools_access($env{'user.name'}, |
|
$env{'user.domain'}, |
|
$type,undef,'requestcourses')) { |
|
$canreq ++; |
|
if ($dom eq $env{'user.domain'}) { |
|
$can_request->{$type} = 1; |
|
} |
|
} |
|
if ($env{'environment.reqcrsotherdom.'.$type} ne '') { |
|
my @curr = split(',',$env{'environment.reqcrsotherdom.'.$type}); |
|
if (@curr > 0) { |
|
$canreq ++; |
|
unless ($dom eq $env{'user.domain'}) { |
|
if (grep(/^\Q$dom\E:($optregex)(=?\d*)$/,@curr)) { |
|
$can_request->{$type} = 1; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
return $canreq; |
|
} |
|
|
|
sub course_types { |
|
my @types = ('official','unofficial','community'); |
|
my %typename = ( |
|
official => 'Official course', |
|
unofficial => 'Unofficial course', |
|
community => 'Community', |
|
); |
|
return (\@types,\%typename); |
|
} |
|
|
|
|
|
sub print_main_menu { |
sub print_main_menu { |
my ($r,$can_request,$states,$dom,$jscript,$loaditems,$crumb) = @_; |
my ($r,$can_request,$states,$dom,$jscript,$loaditems,$crumb) = @_; |
my ($types,$typename) = &course_types(); |
my ($types,$typename) = &Apache::loncommon::course_types(); |
my $onchange; |
my $onchange; |
unless ($env{'form.interface'} eq 'textual') { |
unless ($env{'form.interface'} eq 'textual') { |
$onchange = 1; |
$onchange = 1; |
Line 1751 sub print_request_status {
|
Line 1704 sub print_request_status {
|
my %statusinfo = &Apache::lonnet::dump('courserequests',$env{'user.domain'}, |
my %statusinfo = &Apache::lonnet::dump('courserequests',$env{'user.domain'}, |
$env{'user.name'},'^status:'.$dom); |
$env{'user.name'},'^status:'.$dom); |
my ($output,$formname,%queue_by_date); |
my ($output,$formname,%queue_by_date); |
my ($types,$typenames) = &course_types(); |
my ($types,$typenames) = &Apache::loncommon::course_types(); |
foreach my $key (keys(%statusinfo)) { |
foreach my $key (keys(%statusinfo)) { |
if (($statusinfo{$key} eq 'approval') || ($statusinfo{$key} eq 'pending')) { |
if (($statusinfo{$key} eq 'approval') || ($statusinfo{$key} eq 'pending')) { |
(undef,my($cdom,$cnum)) = split(':',$key); |
(undef,my($cdom,$cnum)) = split(':',$key); |
Line 1873 sub print_cancel_request {
|
Line 1826 sub print_cancel_request {
|
} |
} |
$output = &mt('No further action will be taken'); |
$output = &mt('No further action will be taken'); |
} elsif (ref($history{'details'}) eq 'HASH') { |
} elsif (ref($history{'details'}) eq 'HASH') { |
my ($types,$typename) = &course_types(); |
my ($types,$typename) = &Apache::loncommon::course_types(); |
my $showtype = $crstype; |
my $showtype = $crstype; |
if (defined($typename->{$crstype})) { |
if (defined($typename->{$crstype})) { |
$showtype = $typename->{$crstype}; |
$showtype = $typename->{$crstype}; |
Line 1959 sub print_request_logs {
|
Line 1912 sub print_request_logs {
|
sub print_review { |
sub print_review { |
my ($dom,$codetitles,$cat_titles,$cat_order,$code_order,$uname,$udom, |
my ($dom,$codetitles,$cat_titles,$cat_order,$code_order,$uname,$udom, |
$disallowed,$disallowmsg) = @_; |
$disallowed,$disallowmsg) = @_; |
my ($types,$typename) = &course_types(); |
my ($types,$typename) = &Apache::loncommon::course_types(); |
my ($owner,$ownername,$owneremail); |
my ($owner,$ownername,$owneremail); |
if ($uname eq '' || $udom eq '') { |
if ($uname eq '' || $udom eq '') { |
$uname = $env{'user.name'}; |
$uname = $env{'user.name'}; |
Line 2425 sub get_course_dom {
|
Line 2378 sub get_course_dom {
|
} |
} |
} |
} |
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(); |
my ($types,$typename) = &Apache::loncommon::course_types(); |
if (ref($types) eq 'ARRAY') { |
if (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 3090 sub check_autolimit {
|
Line 3043 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'}, |
'userroles',['active','future'],['cc'],[$dom]); |
'userroles',['active','future'],['cc'],[$dom]); |
my ($types,$typename) = &course_types(); |
my ($types,$typename) = &Apache::loncommon::course_types(); |
my %requests = &Apache::lonnet::dumpstore('courserequests',$udom,$uname); |
my %requests = &Apache::lonnet::dumpstore('courserequests',$udom,$uname); |
my %count; |
my %count; |
if (ref($types) eq 'ARRAY') { |
if (ref($types) eq 'ARRAY') { |