--- loncom/interface/loncoursequeueadmin.pm 2020/08/22 02:11:46 1.52.2.3.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.3.2.3 2020/08/22 02:11:46 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 { @@ -1646,7 +1647,7 @@ sub course_creation { $owneremail = $emails{$email}; last if ($owneremail ne ''); } - my %reqdetails = &build_batchcreatehash($dom,$context,$details,$owneremail,$domdefs); + my %reqdetails = &build_batchcreatehash($dom,$cnum,$context,$details,$owneremail,$domdefs); my $cid = &LONCAPA::batchcreatecourse::build_course($dom,$cnum,'requestcourses', \%reqdetails,$longroles,$logmsg,$clonemsg,$newusermsg,$addresult, $enrollcount,$output,$keysmsg,$ownerdom,$ownername,$cnum,$crstype, @@ -1668,7 +1669,7 @@ sub course_creation { } sub build_batchcreatehash { - my ($dom,$context,$details,$owneremail,$domdefs) = @_; + my ($dom,$cnum,$context,$details,$owneremail,$domdefs) = @_; my %batchhash; my @items = qw{owner domain coursehome clonecrs clonedom datemode dateshift tinyurls enrollstart enrollend accessstart accessend sections users uniquecode}; if ((ref($details) eq 'HASH') && (ref($domdefs) eq 'HASH')) { @@ -1680,7 +1681,14 @@ sub build_batchcreatehash { if (ref($details->{'crosslists'}) eq 'HASH') { foreach my $key (keys(%{$details->{'crosslists'}})) { if (ref($details->{'crosslists'}->{$key}) eq 'HASH') { - $batchhash{'crosslists'}{$key}{'inst'} = $details->{crosslists}->{$key}->{instcode}.$details->{crosslists}->{$key}->{instsec}; + my $instsec = $details->{crosslists}->{$key}->{instsec}; + $batchhash{'crosslists'}{$key}{'inst'} = $details->{crosslists}->{$key}->{instcode}; + my $crskey = $cnum.':'.$batchhash{'crosslists'}{$key}{'inst'}; + my %formatted = &Apache::lonnet::auto_instsec_reformat($dom,'clutter', + {$crskey => [$instsec]}); + if (ref($formatted{$crskey}) eq 'ARRAY') { + $batchhash{'crosslists'}{$key}{'inst'} .= $formatted{$crskey}->[0]; + } $batchhash{'crosslists'}{$key}{'loncapa'} = $details->{crosslists}->{$key}->{loncapa}; } } @@ -1697,12 +1705,16 @@ 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'}) { my %clonedfrom = &Apache::lonnet::coursedescription($details->{'clonedom'}.'_'.$details->{'clonecrs'}); $batchhash{'textbook'} = $clonedfrom{'description'}; } + } elsif ($details->{'crstype'} eq 'lti') { + $batchhash{'lti'} = 1; } $batchhash{'crstype'} = 'Course'; } @@ -2112,7 +2124,7 @@ sub process_official_reqs { my ($result,$postprocess) = &course_creation($dom,$cnum,'domain',$history{'details'},\$logmsg,$clonemsg,\$newusermsg, \$addresult,\$enrollcount,\$response,\$keysmsg,\%domdefs,\%longroles, - \$code,\%customitems,$context,$user_lh); + \$code,\%customitems,$context,$user_lh); if ($result eq 'created') { $disposition = 'created'; $reqstatus = 'created';