--- loncom/interface/loncoursequeueadmin.pm 2012/08/14 15:45:06 1.30 +++ 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.30 2012/08/14 15:45:06 raeburn Exp $ +# $Id: loncoursequeueadmin.pm,v 1.42 2014/01/08 17:18:11 bisitz Exp $ # # Copyright Michigan State University Board of Trustees # @@ -70,6 +70,14 @@ described at http://www.lon-capa.org. =item process_official_reqs() +=item is_active_author() + +=item author_prompt() + +=item reqauthor_check() + +=item process_reqauthor() + =back =cut @@ -101,16 +109,16 @@ sub send_selfserve_notification { } elsif ($context eq 'domainmanagers') { $rawsubj = 'Course/Community requests reviewed'; push(@rawmsg,{ - mt => 'Course/Community creation requests in the following domain: [_1] have been reviewed.', + mt => 'Course/Community creation requests in the following domain: "[_1]" have been reviewed.', args => ["\n$contextdesc"], }); if (ref($textstr) eq 'ARRAY') { 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.', + mt => 'Authoring requests in the following domain: "[_1]" have been reviewed.', args => ["\n$contextdesc"], }); if (ref($textstr) eq 'ARRAY') { @@ -170,14 +178,14 @@ sub send_selfserve_notification { }, { mt =>'[_1]As Domain Coordinator, use: [_2]Main Menu -> Course and community creation -> Approve or reject requests[_3]to display a list of pending requests, which you can either approve or reject.', - args => ["\n","\n\n ","\n\n"], + args => ["\n","\n\n","\n\n"], }); } elsif ($context eq 'selfenrollreq') { $rawsubj = 'Self-enrollment request'; if ($crstype eq 'community') { - $msgtxt = 'Enrollment in the following community: [_1] was requested by [_2] on [_3].' + $msgtxt = 'Enrollment in the following community: [_1]was requested by [_2] on [_3].' } else { - $msgtxt = 'Enrollment in the following course: [_1] was requested by [_2] on [_3].' + $msgtxt = 'Enrollment in the following course: [_1]was requested by [_2] on [_3].' } push(@rawmsg,{ mt => $msgtxt, @@ -195,20 +203,19 @@ sub send_selfserve_notification { args => [" \n\n","\n"], }); } elsif ($context eq 'authorreq') { - $rawsubj = 'Authoring space request to review'; - $msgtxt = 'Assignment of an author role in the [_1] domain[_2] was requested by [_3] on [_4].'; + $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"], @@ -216,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; @@ -362,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').'

'; } @@ -375,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.'); } @@ -427,6 +449,7 @@ sub build_queue_display { official => 'Official course', unofficial => 'Unofficial course', community => 'Community', + textbook => 'Textbook course', ); $output .= ''.&mt('Type').''. ''.&mt('Date requested').''. @@ -525,15 +548,15 @@ 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+:.*/) { - push(@approvals,@course[0]); - } elsif (@course[0] =~ /^later:.*/) { + if ($course[0] =~ /^\d+:.*/) { + push(@approvals,$course[0]); + } elsif ($course[0] =~ /^later:.*/) { #decide later } else { - push(@rejections,@course[0]); + push(@rejections,$course[0]); } $count+=1; } @@ -576,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 { @@ -775,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'}; @@ -790,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); @@ -998,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:').'

'; @@ -1073,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:').'