--- loncom/interface/loncoursequeueadmin.pm 2015/05/21 23:40:09 1.51 +++ loncom/interface/loncoursequeueadmin.pm 2016/08/25 22:33:03 1.55 @@ -1,7 +1,7 @@ # The LearningOnline Network # Utilities to administer domain course requests and course self-enroll requests # -# $Id: loncoursequeueadmin.pm,v 1.51 2015/05/21 23:40:09 raeburn Exp $ +# $Id: loncoursequeueadmin.pm,v 1.55 2016/08/25 22:33:03 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -523,6 +523,7 @@ sub build_queue_display { unofficial => 'Unofficial course', community => 'Community', textbook => 'Textbook course', + placement => 'Placement test', ); $output .= ''.&mt('Type').''. ''.&mt('Date requested').''. @@ -651,7 +652,7 @@ sub update_request_queue { $beneficiary = 'enroller'; $cid = $env{'request.course.id'}; $crstype = lc(&Apache::loncommon::course_type()); - $firsturl = &course_portal_url($cnum,$cdom); + $firsturl = &Apache::lonnet::course_portal_url($cnum,$cdom); %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'}; @@ -680,7 +681,7 @@ sub update_request_queue { } } my $domconfiguser = &Apache::lonnet::get_domainconfiguser($cdom); - $firsturl = &course_portal_url($domconfiguser,$cdom); + $firsturl = &Apache::lonnet::course_portal_url($domconfiguser,$cdom); $approvedmsg = [{ mt => 'Your request for Authoring Space has been approved.', }, @@ -705,7 +706,7 @@ sub update_request_queue { } } my $domconfiguser = &Apache::lonnet::get_domainconfiguser($cdom); - $firsturl = &course_portal_url($domconfiguser,$cdom); + $firsturl = &Apache::lonnet::course_portal_url($domconfiguser,$cdom); $approvedmsg = [{ mt => 'Your request for a LON-CAPA account has been approved.', }, @@ -980,7 +981,7 @@ sub update_request_queue { } else { $approvedmsg = $approvalmsg{'course'}; } - my $firsturl = &course_portal_url($cnum,$cdom); + my $firsturl = &Apache::lonnet::course_portal_url($cnum,$cdom); if (ref($approvedmsg) eq 'ARRAY') { if (ref($approvedmsg->[1]) eq 'HASH') { $approvedmsg->[1]->{'args'} = [$firsturl]; @@ -1564,22 +1565,6 @@ sub update_request_queue { return $output; } -sub course_portal_url { - my ($cnum,$cdom) = @_; - my $chome = &Apache::lonnet::homeserver($cnum,$cdom); - my $hostname = &Apache::lonnet::hostname($chome); - my $protocol = $Apache::lonnet::protocol{$chome}; - $protocol = 'http' if ($protocol ne 'https'); - my %domdefaults = &Apache::lonnet::get_domain_defaults($cdom); - my $firsturl; - if ($domdefaults{'portal_def'}) { - $firsturl = $domdefaults{'portal_def'}; - } else { - $firsturl = $protocol.'://'.$hostname; - } - return $firsturl; -} - sub get_student_counts { my ($cdom,$cnum) = @_; my (%idx,%stucounts); @@ -1603,7 +1588,7 @@ sub course_creation { $keysmsg,$domdefs,$longroles,$coderef,$customhash) = @_; unless ((ref($details) eq 'HASH') && (ref($domdefs) eq 'HASH') && (ref($longroles) eq 'HASH')) { - return 'error: Invalid request'; + return ('error: Invalid request'); } my ($result,$ownername,$ownerdom); my $crstype = $details->{'crstype'}; @@ -1674,6 +1659,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'}) { @@ -1719,6 +1706,7 @@ sub build_batchcreatehash { $batchhash{'users'}{$owner}{lastname} = $owner_lastname; $batchhash{'users'}{$owner}{emailenc} = $emailenc; $batchhash{'users'}{$owner}{owneremail} = $owneremail; + $batchhash{'setcomment'} = 1; } return %batchhash; } @@ -1773,7 +1761,6 @@ sub can_clone_course { if (@code_order > 0) { if (&Apache::lonnet::check_instcode_cloning(\%codedefaults,\@code_order, $cloner,$clonefromcode,$instcode)) { -print STDERR "Z got check from $cloner,$clonefromcode,$instcode and ||".join('**',@code_order)."||\n"; $canclone = 1; last; } @@ -2093,7 +2080,7 @@ sub process_official_reqs { my $cid = $dom.'_'.$cnum; push(@{$newcids{$instcode}},$cid); if ($dcname && $dcdom) { - my $firsturl = &course_portal_url($cnum,$dom); + my $firsturl = &Apache::lonnet::course_portal_url($cnum,$dom); my $beneficiary = 'pendingrequestor'; my $now = time; my $owner = $ownername.':'.$ownerdom;