--- loncom/interface/loncoursequeueadmin.pm 2013/01/04 01:56:35 1.34 +++ loncom/interface/loncoursequeueadmin.pm 2014/01/08 17:18:11 1.42 @@ -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.42 2014/01/08 17:18:11 bisitz Exp $ # # Copyright Michigan State University Board of Trustees # @@ -116,7 +116,7 @@ sub send_selfserve_notification { push(@rawmsg,@{$textstr}); } } elsif ($context eq 'authormanagers') { - $rawsubj = 'Authoring space requests reviewed'; + $rawsubj = 'Authoring Space requests reviewed'; push(@rawmsg,{ mt => 'Authoring requests in the following domain: "[_1]" have been reviewed.', args => ["\n$contextdesc"], @@ -203,20 +203,19 @@ sub send_selfserve_notification { args => [" \n\n","\n"], }); } elsif ($context eq 'authorreq') { - $rawsubj = 'Authoring space request to review'; + $rawsubj = 'Authoring Space request to review'; $msgtxt = 'Assignment of an author role in the [_1] domain[_2]was requested by [_3] on [_4].'; push(@rawmsg,{ mt => $msgtxt, args => [$contextdesc,"\n",$textstr,$timestamp], }, { - 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.', + mt =>'[_1]As Domain Coordinator, use: [_2]Main Menu -> Create users or modify the roles and privileges of users -> Authoring Space requests[_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.'; + $rawsubj = 'Authoring Space request'; + $msgtxt = 'Your request for an Authoring Space requested on [_1]has been reviewed by a Domain Coordinator.'; push(@rawmsg,{ mt => $msgtxt, args => [$timestamp."\n"], @@ -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; @@ -370,7 +384,7 @@ sub display_queued_requests { '

'.&mt('Requests are validated against institutional data to confirm that the requestor is an instructor of record.').'
'. &mt('Validation is attempted when the request is submitted.').' '.&mt('If unvalidated, the request will be held in a queue.').' '.&mt('Validation of pending requests is automatically repeated daily.').'

'; } elsif ($context eq 'requestauthor') { - $output .= '

'.&mt('Requests for authoring space queued pending approval by a Domain Coordinator').'

'; + $output .= '

'.&mt('Requests for Authoring Space queued pending approval by a Domain Coordinator').'

'; } else { $output .= '

'.&mt('Course/Community requests queued pending approval by a Domain Coordinator').'

'; } @@ -383,7 +397,7 @@ sub display_queued_requests { } elsif ($context eq 'pending') { $output .= &mt('There are currently no requests for official courses awaiting validation.'); } elsif ($context eq 'requestauthor') { - $output .= &mt('There are currently no requests for authoring space awaiting approval.'); + $output .= &mt('There are currently no requests for Authoring Space awaiting approval.'); } elsif ($context eq 'domain') { $output .= &mt('There are currently no course or community requests awaiting approval.'); } @@ -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+:.*/) { @@ -584,14 +599,14 @@ sub update_request_queue { my $domconfiguser = &Apache::lonnet::get_domainconfiguser($cdom); $firsturl = &course_portal_url($domconfiguser,$cdom); $approvedmsg = [{ - mt => 'Your request for authoring space has been approved.', + mt => 'Your request for Authoring Space has been approved.', }, { mt => 'Visit [_1] to log-in and select your author role', args => [$firsturl], }]; $rejectedmsg = [{ - mt => 'Your request for authoring space has not been approved.', + mt => 'Your request for Authoring Space has not been approved.', }]; $domdesc = &Apache::lonnet::domain($cdom); } else { @@ -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); @@ -1006,7 +1050,7 @@ sub update_request_queue { $approvedlist,$rejectedlist,$crstype); } } elsif ($context eq 'requestauthor') { - $chgmsg = "'Action was taken on the following authoring space requests by [_1].',$namelink"; + $chgmsg = "'Action was taken on the following Authoring Space requests by [_1].',$namelink"; if (@completed) { $approvedlist = join("\n",@completed); $output .= '

'.&mt('The following requests were approved:').'

'; @@ -1081,7 +1128,7 @@ sub update_request_queue { } $output .= '

'; } elsif ($context eq 'requestauthor') { - $output .= '

'.&mt('Authoring space requests from the following users were deleted because one already exists:').'