--- loncom/interface/loncoursequeueadmin.pm 2017/08/15 23:45:30 1.52.2.2.4.1 +++ loncom/interface/loncoursequeueadmin.pm 2020/04/06 22:32:32 1.52.2.2.6.1 @@ -1,7 +1,7 @@ # The LearningOnline Network # Utilities to administer domain course requests and course self-enroll requests # -# $Id: loncoursequeueadmin.pm,v 1.52.2.2.4.1 2017/08/15 23:45:30 raeburn Exp $ +# $Id: loncoursequeueadmin.pm,v 1.52.2.2.6.1 2020/04/06 22:32:32 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -105,13 +105,13 @@ sub send_selfserve_notification { $rawsubj = 'Self-enrollment requests processed'; push(@rawmsg,{ mt => 'Enrollment requests in the following course: [_1] have been processed.', - args => ["\n$contextdesc\n"], + args => ["\n$contextdesc"], }); } elsif ($context eq 'domainmanagers') { $rawsubj = 'Course/Community requests reviewed'; push(@rawmsg,{ - mt => 'Course/Community creation requests in the following domain: [_1] have been reviewed.', - args => ["\n$contextdesc\n"], + mt => 'Course/Community creation requests in the following domain: "[_1]" have been reviewed.', + args => ["\n$contextdesc"], }); if (ref($textstr) eq 'ARRAY') { push(@rawmsg,@{$textstr}); @@ -119,8 +119,8 @@ sub send_selfserve_notification { } elsif ($context eq 'authormanagers') { $rawsubj = 'Authoring Space requests reviewed'; push(@rawmsg,{ - mt => 'Authoring requests in the following domain: [_1] have been reviewed.', - args => ["\n$contextdesc\n"], + mt => 'Authoring requests in the following domain: "[_1]" have been reviewed.', + args => ["\n$contextdesc"], }); if (ref($textstr) eq 'ARRAY') { push(@rawmsg,@{$textstr}); @@ -128,8 +128,8 @@ sub send_selfserve_notification { } elsif ($context eq 'usernamemanagers') { $rawsubj = 'LON-CAPA account requests reviewed'; push(@rawmsg,{ - mt => 'Account requests in the following domain: [_1] have been reviewed.', - args => ["\n$contextdesc\n"], + mt => 'Account requests in the following domain: "[_1]" have been reviewed.', + args => ["\n$contextdesc"], }); if (ref($textstr) eq 'ARRAY') { push(@rawmsg,@{$textstr}); @@ -656,7 +656,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'}; @@ -685,7 +685,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.', }, @@ -710,7 +710,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.', }, @@ -879,10 +879,10 @@ sub update_request_queue { my $dbname = 'nohist_requestedusernames'; my $domconfiguser = &Apache::lonnet::get_domainconfiguser($cdom); my %curr = &Apache::lonnet::get($dbname,[$uname],$cdom,$domconfiguser); - + if (ref($curr{$uname}) eq 'HASH') { - my ($logtoken,$serverid,$encpass,$courseid,$id,$firstname, - $middlename,$lastname,$generation,$inststatus,$email); + my ($username,$logtoken,$serverid,$encpass,$courseid,$id,$firstname, + $middlename,$lastname,$generation,$inststatus); $curr{$uname}{'timestamp'} = $now; $curr{$uname}{'adjudicator'} = $env{'user.name'}.':'.$env{'user.domain'}; $courseid = $curr{$uname}{'courseid'}; @@ -893,35 +893,14 @@ sub update_request_queue { $generation = $curr{$uname}{'generation'}; $inststatus = $curr{$uname}{'inststatus'}; - if ($curr{$uname}{'email'} ne '') { - $email = $curr{$uname}{'email'}; - } elsif ($uname =~ /^[^\@]+\@[^\@]+$/) { - $email = $uname; - } - - my $upass; - if ($curr{$uname}{'tmpinfo'}) { - my ($key,$caller)=split(/&/,$curr{$uname}{'tmpinfo'}); - if ($caller eq 'createaccount') { - if ($curr{$uname}{'upass'} eq '') { - $upass = $curr{$uname}{'upass'}; - } else { - $upass = &Apache::loncommon::des_decrypt($key,$curr{$uname}{'upass'}); - } - } else { - push(@processing_errors,$uname); - } - } else { - $upass = $curr{$uname}{'upass'}; - } - if ($upass eq '') { - push(@processing_errors,$uname); - } else { + my ($key,$caller)=split(/&/,$curr{$uname}{'tmpinfo'}); + if ($caller eq 'createaccount') { + my $upass = &Apache::loncommon::des_decrypt($key,$curr{$uname}{'upass'}); undef($curr{$uname}{'upass'}); my $result = &Apache::lonnet::modifyuser($cdom,$uname,$id,'internal',$upass, $firstname,$middlename,$lastname, - $generation,undef,undef,$email); + $generation,undef,undef,$uname); if ($result eq 'ok') { $curr{$uname}{'status'} = 'created'; push(@completed,$uname); @@ -942,6 +921,8 @@ sub update_request_queue { } else { push(@processing_errors,$uname); } + } else { + push(@processing_errors,$uname); } } else { push(@invalidusers,$uname); @@ -1004,7 +985,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]; @@ -1588,22 +1569,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); @@ -2117,7 +2082,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;