--- loncom/interface/loncoursequeueadmin.pm 2012/08/16 17:02:55 1.32 +++ loncom/interface/loncoursequeueadmin.pm 2013/12/25 09:52:42 1.39 @@ -1,7 +1,7 @@ # The LearningOnline Network # Utilities to administer domain course requests and course self-enroll requests # -# $Id: loncoursequeueadmin.pm,v 1.32 2012/08/16 17:02:55 raeburn Exp $ +# $Id: loncoursequeueadmin.pm,v 1.39 2013/12/25 09:52:42 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -224,6 +224,11 @@ 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}); + } } my @to_notify = split(/,/,$notifylist); my $numsent = 0; @@ -435,6 +440,7 @@ sub build_queue_display { official => 'Official course', unofficial => 'Unofficial course', community => 'Community', + textbook => 'Textbook course', ); $output .= ''.&mt('Type').''. ''.&mt('Date requested').''. @@ -533,15 +539,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; } @@ -608,6 +614,9 @@ sub update_request_queue { if (ref($domconfig{'requestcourses'}{'notify'}) eq 'HASH') { $notifylist = $domconfig{'requestcourses'}{'notify'}{'approval'}; } + if ($domconfig{'requestcourses'}{'uniquecode'}) { + $uniquecode = 1; + } } $approvalmsg{'course'} = [{ @@ -783,10 +792,10 @@ sub update_request_queue { $ownerdom,$ownername); if ((ref($history{'details'}) eq 'HASH') && ($history{'disposition'} eq $queue)) { - my ($logmsg,$newusermsg,$addresult,$enrollcount,$response,$keysmsg); + my ($logmsg,$newusermsg,$addresult,$enrollcount,$response,$keysmsg,$code); my $result = &course_creation($cdom,$cnum,$context,$history{'details'},\$logmsg, \$newusermsg,\$addresult,\$enrollcount, - \$response,\$keysmsg,\%domdefs,$longroles); + \$response,\$keysmsg,\%domdefs,$longroles,\$code); if ($result eq 'created') { if ($crstype eq 'community') { $approvedmsg = $approvalmsg{'community'}; @@ -798,6 +807,14 @@ 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; + } } push(@completed,$cnum); @@ -1047,6 +1064,9 @@ sub update_request_queue { } my $syllabuslink = &Apache::loncommon::syllabuswrapper($showcourse,$cnum,$cdom); + if ($uniquecode && $codes{$cnum}) { + $syllabuslink .= &mt('Unique code: [_1]',$codes{$cnum}); + } $output .= '
  • '.$syllabuslink.'
  • '; } $output .= '

    '; @@ -1256,7 +1276,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:").'