--- loncom/interface/loncoursequeueadmin.pm 2010/12/08 03:49:34 1.12.2.12 +++ loncom/interface/loncoursequeueadmin.pm 2010/02/21 23:38:51 1.19 @@ -1,7 +1,7 @@ # The LearningOnline Network -# Utilities to administer domain course requests and course self-enroll requests +# Utilities to administer domain course requests and course self-enroll requests # -# $Id: loncoursequeueadmin.pm,v 1.12.2.12 2010/12/08 03:49:34 raeburn Exp $ +# $Id: loncoursequeueadmin.pm,v 1.19 2010/02/21 23:38:51 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -35,7 +35,7 @@ Apache::loncoursequeueadmin.pm Utilities used by domain coordinators to administer queued course creation requests, and by course coordinators for queued self-enrollment requests, and by general -users to display their queued self-enrollment requests. +users to display their queued self-enrollment requests. This is part of the LearningOnline Network with CAPA project described at http://www.lon-capa.org. @@ -55,9 +55,11 @@ described at http://www.lon-capa.org. =item course_creation() =item build_batchcreatehash() - + =item can_clone_course() +=item get_processtype() + =item queued_selfenrollment() =back @@ -72,7 +74,7 @@ use Apache::loncommon; use Apache::lonmsg; use Apache::lonlocal; use Apache::lonuserutils; -use LONCAPA; +use LONCAPA qw(:DEFAULT :match); sub send_selfserve_notification { my ($notifylist,$textstr,$cid,$contextdesc,$timestamp,$context,$sender, @@ -373,10 +375,9 @@ sub update_request_queue { $stucounts,$idx,$classlist,%requesthash,$cid,$hostname,$protocol, $domdesc,$now,$sender,$approvedmsg,$rejectedmsg,$beneficiary, @existing,@missingreq,@invalidusers,@limitexceeded,@completed, - @processing_errors,@warn_approves,@warn_rejects,@approvals, + @processing_errors,@warn_approves,@warn_rejects,@approvals,@warn_dels, @rejections,@rejectionerrors,@nopermissions,%courseroles, - %communityroles,%domdefs,%approvalmsg,%rejectionmsg,$crstype, - @warn_coursereqs,$firsturl); + %communityroles,%domdefs,%approvalmsg,%rejectionmsg,$crstype); @approvals = &Apache::loncommon::get_env_multiple('form.approvereq'); @rejections = &Apache::loncommon::get_env_multiple('form.rejectreq'); $now = time; @@ -390,12 +391,6 @@ sub update_request_queue { $hostname = &Apache::lonnet::hostname($chome); $protocol = $Apache::lonnet::protocol{$chome}; $protocol = 'http' if ($protocol ne 'https'); - my %domdefaults = &Apache::lonnet::get_domain_defaults($cdom); - if ($domdefaults{'portal_def'}) { - $firsturl = $domdefaults{'portal_def'}; - } else { - $firsturl = $protocol.'://'.$hostname; - } %requesthash = &Apache::lonnet::dump($namespace,$cdom,$cnum); $access_start = $env{'course.'.$cid.'.internal.selfenroll_start_access'}; $access_end = $env{'course.'.$cid.'.internal.selfenroll_end_access'}; @@ -408,7 +403,7 @@ sub update_request_queue { }, { mt => 'Visit [_1], to log-in and access the course', - args => [$firsturl], + args => [$protocol.'://'.$hostname], }]; $rejectedmsg = [{ mt => 'Your request for enrollment has not been approved.', @@ -422,12 +417,6 @@ sub update_request_queue { $hostname = &Apache::lonnet::hostname($chome); $protocol = $Apache::lonnet::protocol{$chome}; $protocol = 'http' if ($protocol ne 'https'); - my %domdefaults = &Apache::lonnet::get_domain_defaults($cdom); - if ($domdefaults{'portal_def'}) { - $firsturl = $domdefaults{'portal_def'}; - } else { - $firsturl = $protocol.'://'.$hostname; - } my %domconfig = &Apache::lonnet::get_dom('configuration',['requestcourses'],$cdom); if (ref($domconfig{'requestcourses'}) eq 'HASH') { if (ref($domconfig{'requestcourses'}{'notify'}) eq 'HASH') { @@ -440,7 +429,7 @@ sub update_request_queue { }, { mt => 'Visit [_1], to log-in and access the course', - args => [$firsturl], + args => [$protocol.'://'.$hostname], }]; $rejectionmsg{'course'} = [{ @@ -453,7 +442,7 @@ sub update_request_queue { }, { mt => 'Visit [_1], to log-in and access the community', - args => [$firsturl], + args => [$protocol.'://'.$hostname], }]; $rejectionmsg{'community'} = @@ -471,30 +460,12 @@ 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 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') { if (($classlist->{$uname.':'.$udom}->[$idx->{'status'}] eq 'Active') || @@ -540,15 +511,6 @@ sub update_request_queue { &Apache::lonnet::put($namespace,\%userrequest,$udom,$uname); if ($userresult ne 'ok') { push(@warn_approves,$uname.':'.$udom); - } elsif (ref($allnums{$udom}) eq 'HASH') { - my %changehash = ( - 'reqcrsotherdom.unofficial' => $udom.'test:autolimit=', - ); - my $reqresult = &Apache::lonnet::put('environment',\%changehash, - $udom,$uname); - if ($reqresult ne 'ok') { - push(@warn_coursereqs,$uname.':'.$udom); - } } } else { push(@processing_errors,$uname.':'.$udom); @@ -602,6 +564,10 @@ sub update_request_queue { $approvedmsg = $approvalmsg{'course'}; } push(@completed,$cnum); + + unless (&Apache::lonnet::del_dom($namespace,[$cnum.'_approval'],$cdom) eq 'ok') { + push(@warn_dels,$cnum); + } &send_selfserve_notification($ownername.':'.$ownerdom,$approvedmsg, $cid,$coursedesc,$now,$beneficiary,$sender,undef,undef,$crstype); my %reqhash = ( @@ -716,6 +682,9 @@ sub update_request_queue { } else { push(@warn_rejects,$cnum); } + unless (&Apache::lonnet::del_dom($namespace,[$cnum.'_approval'],$cdom) eq 'ok') { + push(@warn_dels,$cnum); + } } else { push(@warn_rejects,$cnum); } @@ -933,29 +902,20 @@ sub update_request_queue { $output .= '
'; } } - if (@warn_coursereqs) { - $output .= ''..&mt("For the following users, an error occurred when setting rights to request creation of Concept Test courses:").'
'.&mt("For the following course/community requests an error occurred when removing requests for the following from the pending queue:").'