--- loncom/interface/loncoursequeueadmin.pm 2013/01/04 01:56:35 1.34 +++ loncom/interface/loncoursequeueadmin.pm 2014/01/03 18:39:51 1.41 @@ -1,7 +1,7 @@ # The LearningOnline Network # Utilities to administer domain course requests and course self-enroll requests # -# $Id: loncoursequeueadmin.pm,v 1.34 2013/01/04 01:56:35 raeburn Exp $ +# $Id: loncoursequeueadmin.pm,v 1.41 2014/01/03 18:39:51 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -213,7 +213,6 @@ sub send_selfserve_notification { mt =>'[_1]As Domain Coordinator, use: [_2]Main Menu -> Create users or modify the roles and privileges of users -> Authoring space reqests[_3]to display a list of pending requests, which you can either approve or reject.', args => ["\n","\n\n ","\n\n"], }); - } elsif ($context eq 'requestauthor') { $rawsubj = 'Authoring space request'; $msgtxt = 'Your request for an authoring space requested on [_1]has been reviewed by a Domain Coordinator.'; @@ -224,6 +223,21 @@ sub send_selfserve_notification { if (ref($textstr) eq 'ARRAY') { push(@rawmsg,@{$textstr}); } + } elsif ($context eq 'uniquecode') { + $rawsubj = 'Course Identifier'; + if (ref($textstr) eq 'ARRAY') { + push(@rawmsg,@{$textstr}); + } + } elsif ($context eq 'queuedcrsreq') { + $rawsubj = 'Course Request Queued'; + if (ref($textstr) eq 'ARRAY') { + push(@rawmsg,@{$textstr}); + } + } elsif ($context eq 'createdcrsreq') { + $rawsubj = 'Course Creation Information'; + if (ref($textstr) eq 'ARRAY') { + push(@rawmsg,@{$textstr}); + } } my @to_notify = split(/,/,$notifylist); my $numsent = 0; @@ -435,6 +449,7 @@ sub build_queue_display { official => 'Official course', unofficial => 'Unofficial course', community => 'Community', + textbook => 'Textbook course', ); $output .= ''.&mt('Type').''. ''.&mt('Date requested').''. @@ -533,7 +548,7 @@ sub update_request_queue { @processing_errors,@warn_approves,@warn_rejects,@approvals,@warn_dels, @rejections,@rejectionerrors,@nopermissions,%courseroles,@toremove, %communityroles,%domdefs,%approvalmsg,%rejectionmsg,$crstype,$queue, - $firsturl); + $firsturl,$uniquecode,%codes); my $count=0; while (my @course = &Apache::loncommon::get_env_multiple('form.'.$count.'radioreq')) { if ($course[0] =~ /^\d+:.*/) { @@ -783,10 +798,20 @@ sub update_request_queue { $ownerdom,$ownername); if ((ref($history{'details'}) eq 'HASH') && ($history{'disposition'} eq $queue)) { - my ($logmsg,$newusermsg,$addresult,$enrollcount,$response,$keysmsg); - my $result = &course_creation($cdom,$cnum,$context,$history{'details'},\$logmsg, - \$newusermsg,\$addresult,\$enrollcount, - \$response,\$keysmsg,\%domdefs,$longroles); + my ($logmsg,$newusermsg,$addresult,$enrollcount,$response,$keysmsg,$code,%customitems); + my $fullname = ''; + my $inprocess = &Apache::lonnet::auto_crsreq_update($cdom,$cnum,$crstype,'process',$ownername, + $ownerdom,$fullname,$coursedesc); + if (ref($inprocess) eq 'HASH') { + foreach my $key (keys(%{$inprocess})) { + if (exists($history{'details'}{$key})) { + $customitems{$key} = $history{'details'}{$key}; + } + } + } + my ($result,$postprocess) = &course_creation($cdom,$cnum,$context,$history{'details'},\$logmsg, + \$newusermsg,\$addresult,\$enrollcount, + \$response,\$keysmsg,\%domdefs,$longroles,\$code,\%customitems); if ($result eq 'created') { if ($crstype eq 'community') { $approvedmsg = $approvalmsg{'community'}; @@ -798,6 +823,25 @@ sub update_request_queue { if (ref($approvedmsg->[1]) eq 'HASH') { $approvedmsg->[1]->{'args'} = [$firsturl]; } + if ($code) { + push(@{$approvedmsg}, + { + mt => 'Students can automatically select your course by entering this code: [_1]', + args => [$code], + }); + $codes{$cnum} = $code; + } + if (ref($postprocess) eq 'HASH') { + if (ref($postprocess->{'createdmsg'}) eq 'ARRAY') { + foreach my $item (@{$postprocess->{'createdmsg'}}) { + if (ref($item) eq 'HASH') { + if ($item->{'mt'} ne '') { + push(@{$approvedmsg},$item); + } + } + } + } + } } push(@completed,$cnum); @@ -1047,6 +1091,9 @@ sub update_request_queue { } my $syllabuslink = &Apache::loncommon::syllabuswrapper($showcourse,$cnum,$cdom); + if ($codes{$cnum}) { + $syllabuslink .= &mt('Unique code: [_1]',$codes{$cnum}); + } $output .= '
  • '.$syllabuslink.'
  • '; } $output .= '

    '; @@ -1256,7 +1303,7 @@ sub update_request_queue { } $output .= '

    '; } else { - $output .= '

    '.&mt("For the following course/community requests an error occurred when removing requests for the following from the pending queue:").'