--- loncom/interface/loncoursequeueadmin.pm 2023/09/04 17:10:13 1.52.2.5.2.3 +++ loncom/interface/loncoursequeueadmin.pm 2021/11/24 04:25:02 1.62 @@ -1,7 +1,7 @@ # The LearningOnline Network # Utilities to administer domain course requests and course self-enroll requests # -# $Id: loncoursequeueadmin.pm,v 1.52.2.5.2.3 2023/09/04 17:10:13 raeburn Exp $ +# $Id: loncoursequeueadmin.pm,v 1.62 2021/11/24 04:25:02 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -506,7 +506,7 @@ sub build_queue_display { my %crstypes; my $output = &Apache::loncommon::start_data_table(). &Apache::loncommon::start_data_table_header_row(); - unless (($context eq 'pending') || ($context eq 'displaypending') || ($context eq 'helpdesk')) { + unless (($context eq 'pending') || ($context eq 'displaypending') || ($context eq 'helpdesk')) { $output .= ''.&mt('Action').''; } $output .= ''.&mt('Requestor').''; @@ -528,6 +528,7 @@ sub build_queue_display { unofficial => 'Unofficial course', community => 'Community', textbook => 'Textbook course', + placement => 'Placement test', ); $output .= ''.&mt('Type').''. ''.&mt('Date requested').''. @@ -609,7 +610,7 @@ sub build_queue_display { } elsif ($context eq 'requestusername') { $row .= ''.$showtime.''."\n". ''.$detailslink.''."\n"; - } else { + } else { if ($context eq 'pending' || $context eq 'displaypending' || $context eq 'stillpending') { $row .= ''.$instcode.''."\n"; } else { @@ -1619,12 +1620,12 @@ sub course_creation { (ref($longroles) eq 'HASH')) { return ('error: Invalid request'); } - my ($result,$ownername,$ownerdom,$autocoowner); + my ($result,$ownername,$ownerdom); my $crstype = $details->{'crstype'}; my $coursedesc = $details->{'cdescr'}; my $accessstart = $details->{'accessstart'}; my $accessend = $details->{'accessend'}; - my %domconfig = &Apache::lonnet::get_dom('configuration',['requestcourses','autoenroll'],$dom); + my %domconfig = &Apache::lonnet::get_dom('configuration',['requestcourses'],$dom); if (ref($domconfig{'requestcourses'}) eq 'HASH') { if (ref($domconfig{'requestcourses'}{'uniquecode'}) eq 'HASH') { if ($domconfig{'requestcourses'}{'uniquecode'}{$crstype}) { @@ -1632,9 +1633,6 @@ sub course_creation { } } } - if (ref($domconfig{'autoenroll'}) eq 'HASH') { - $autocoowner = $domconfig{'autoenroll'}{'co-owners'}; - } if ($context eq 'domain') { $ownername = $details->{'owner'}; $ownerdom = $details->{'domain'}; @@ -1664,66 +1662,6 @@ sub course_creation { $postprocess = &Apache::lonnet::auto_crsreq_update($dom,$cnum,$crstype,$result,$ownername, $ownerdom,$fullname,$coursedesc,$code, $accessstart,$accessend,$customhash); - if ($autocoowner) { - my $instcode = $details->{'instcode'}; - if (($instcode ne '') && (ref($reqdetails{'users'}) eq 'HASH')) { - my @posscoowners; - my $now = time; - foreach my $person (keys(%{$reqdetails{'users'}})) { - my ($uname,$udom) = split(/:/,$person); - next if (($udom ne $dom) || (($uname eq $ownername) && ($udom eq $ownerdom))); - if ((&Apache::lonnet::homeserver($uname,$udom,1) ne 'no_host') && - (ref($reqdetails{'users'}{$person}) eq 'HASH')) { - if ((grep(/^cc$/,keys(%{$reqdetails{'users'}{$person}}))) && - (ref($reqdetails{'users'}{$person}{'cc'}) eq 'HASH')) { - my $start = $reqdetails{'users'}{$person}{'cc'}{'start'}; - my $end = $reqdetails{'users'}{$person}{'cc'}{'end'}; - if ((($start eq '') || ($start <= $now)) && - (($end eq '') || ($end >= $now))) { - push(@posscoowners,$person); - } - } - } - } - my @coowners; - if (@posscoowners) { - foreach my $user (@posscoowners) { - my ($checkcc,$desc) = - &Apache::lonnet::auto_validate_instcode($cnum,$dom,$instcode,$user); - unless ($checkcc eq 'valid') { - if (ref($reqdetails{'crosslists'}) eq 'HASH') { - foreach my $key (keys(%{$reqdetails{'crosslists'}})) { - if (ref($reqdetails{'crosslists'}{$key}) eq 'HASH') { - my $inst_crosslist = $reqdetails{'crosslists'}{$key}{'inst'}; - if ($inst_crosslist ne '') { - $checkcc = - &Apache::lonnet::auto_validate_inst_crosslist($cnum,$dom,$instcode, - $inst_crosslist,$user); - last if ($checkcc eq 'valid'); - } - } - } - } - } - if ($checkcc eq 'valid') { - if (@coowners > 0) { - unless (grep(/^\Q$user\E$/,@coowners)) { - push(@coowners,$user); - } - } else { - push(@coowners,$user); - } - } - } - } - if (@coowners > 0) { - my $chome = &Apache::lonnet::homeserver($cnum,$dom); - unless ($chome eq 'no_host') { - &Apache::lonnet::store_coowners($dom,$cnum,$chome,'',@coowners); - } - } - } - } } else { $result = 'error: '.$cid; } @@ -1767,6 +1705,8 @@ sub build_batchcreatehash { $batchhash{'authparam'} = $domdefs->{'auth_arg_def'}; if ($details->{'crstype'} eq 'community') { $batchhash{'crstype'} = 'Community'; + } elsif ($details->{'crstype'} eq 'placement') { + $batchhash{'crstype'} = 'Placement'; } else { if ($details->{'crstype'} eq 'textbook') { if ($details->{'clonecrs'} && $details->{'clonedom'}) { @@ -2318,7 +2258,7 @@ sub postprocess_crsenv { my %needcrsidput = ( 'internal.selfenroll_types' => 1, 'internal.selfenroll_start_date' => 1, - 'internal.selfenroll_end_date' => 1, + 'internal. selfenroll_end_date' => 1, ); my (@needupdate,%newcrsenv); foreach my $key (keys(%{$postprocessenv})) {