--- loncom/interface/loncoursequeueadmin.pm 2010/02/26 23:39:01 1.12.2.8 +++ loncom/interface/loncoursequeueadmin.pm 2010/12/05 21:57:33 1.12.2.10 @@ -1,7 +1,7 @@ # The LearningOnline Network # Utilities to administer domain course requests and course self-enroll requests # -# $Id: loncoursequeueadmin.pm,v 1.12.2.8 2010/02/26 23:39:01 raeburn Exp $ +# $Id: loncoursequeueadmin.pm,v 1.12.2.10 2010/12/05 21:57:33 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -459,15 +459,29 @@ sub update_request_queue { } } + my %allnums = &Apache::loncommon::get_faculty_cnums(); foreach my $item (sort {$a <=> $b} @approvals) { if ($context eq 'course') { my ($num,$uname,$udom,$usec) = split(/:/,$item); my $uhome = &Apache::lonnet::homeserver($uname,$udom); if ($uhome ne 'no_host') { if (exists($requesthash{$uname.':'.$udom})) { - if ($cdom eq 'gci' && $cnum eq '9615072b469884921gcil1') { - my $enresult = &enable_gci_submission($udom,$uname, - $access_end,$access_start); + if ($cdom ne '' && ref($allnums{$cdom} eq 'HASH') { + my ($addothers,@others); + foreach my $key (%{$allnums{$cdom}}) { + if ($key eq $cnum) { + $addothers = 1; + } else { + push(@others,$key); + } + } + if ($addothers) { + foreach my $crs (@others) { + my $enresult = + &enable_additional_roles($cdom,$crs,$udom,$uname, + $access_end,$access_start); + } + } } if (exists($classlist->{$uname.':'.$udom})) { if (ref($classlist->{$uname.':'.$udom}) eq 'ARRAY') { @@ -514,9 +528,9 @@ sub update_request_queue { &Apache::lonnet::put($namespace,\%userrequest,$udom,$uname); if ($userresult ne 'ok') { push(@warn_approves,$uname.':'.$udom); - } elsif ($udom eq 'gci') { + } elsif (ref($allnums{$udom}) eq 'HASH') { my %changehash = ( - 'reqcrsotherdom.unofficial' => 'gcitest:autolimit=', + 'reqcrsotherdom.unofficial' => $udom.'test:autolimit=', ); my $reqresult = &Apache::lonnet::put('environment',\%changehash, $udom,$uname); @@ -917,10 +931,8 @@ sub update_request_queue { return $output; } -sub enable_gci_submission { - my ($udom,$uname,$access_end,$access_start) = @_; - my $cdom = 'gci'; - my $cnum = '1H96711d710194bfegcil1'; +sub enable_additional_roles { + my ($cdom,$cnum,$udom,$uname,$access_end,$access_start) = @_; my ($stucounts,$idx,$classlist) = &get_student_counts($cdom,$cnum); if (exists($classlist->{$uname.':'.$udom})) { if (ref($classlist->{$uname.':'.$udom}) eq 'ARRAY') { @@ -990,7 +1002,7 @@ sub build_batchcreatehash { my ($dom,$context,$details,$owneremail,$domdefs) = @_; my %batchhash; my @items = qw{owner domain coursehome clonecrs clonedom cloneroster datemode dateshift enrollstart enrollend accessstart accessend sections crosslists users}; - if ($dom eq 'gcitest') { + if ($dom =~ /^\w+citest$/) { push(@items,'firstres'); } if ((ref($details) eq 'HASH') && (ref($domdefs) eq 'HASH')) {