version 1.52.2.1, 2016/08/31 23:28:05
|
version 1.61, 2021/06/15 20:52:26
|
Line 105 sub send_selfserve_notification {
|
Line 105 sub send_selfserve_notification {
|
$rawsubj = 'Self-enrollment requests processed'; |
$rawsubj = 'Self-enrollment requests processed'; |
push(@rawmsg,{ |
push(@rawmsg,{ |
mt => 'Enrollment requests in the following course: [_1] have been processed.', |
mt => 'Enrollment requests in the following course: [_1] have been processed.', |
args => ["\n$contextdesc"], |
args => ["\n$contextdesc\n"], |
}); |
}); |
} elsif ($context eq 'domainmanagers') { |
} elsif ($context eq 'domainmanagers') { |
$rawsubj = 'Course/Community requests reviewed'; |
$rawsubj = 'Course/Community requests reviewed'; |
push(@rawmsg,{ |
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"], |
args => ["\n$contextdesc\n"], |
}); |
}); |
if (ref($textstr) eq 'ARRAY') { |
if (ref($textstr) eq 'ARRAY') { |
push(@rawmsg,@{$textstr}); |
push(@rawmsg,@{$textstr}); |
Line 119 sub send_selfserve_notification {
|
Line 119 sub send_selfserve_notification {
|
} elsif ($context eq 'authormanagers') { |
} elsif ($context eq 'authormanagers') { |
$rawsubj = 'Authoring Space requests reviewed'; |
$rawsubj = 'Authoring Space requests reviewed'; |
push(@rawmsg,{ |
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"], |
args => ["\n$contextdesc\n"], |
}); |
}); |
if (ref($textstr) eq 'ARRAY') { |
if (ref($textstr) eq 'ARRAY') { |
push(@rawmsg,@{$textstr}); |
push(@rawmsg,@{$textstr}); |
Line 128 sub send_selfserve_notification {
|
Line 128 sub send_selfserve_notification {
|
} elsif ($context eq 'usernamemanagers') { |
} elsif ($context eq 'usernamemanagers') { |
$rawsubj = 'LON-CAPA account requests reviewed'; |
$rawsubj = 'LON-CAPA account requests reviewed'; |
push(@rawmsg,{ |
push(@rawmsg,{ |
mt => 'Account requests in the following domain: "[_1]" have been reviewed.', |
mt => 'Account requests in the following domain: [_1] have been reviewed.', |
args => ["\n$contextdesc"], |
args => ["\n$contextdesc\n"], |
}); |
}); |
if (ref($textstr) eq 'ARRAY') { |
if (ref($textstr) eq 'ARRAY') { |
push(@rawmsg,@{$textstr}); |
push(@rawmsg,@{$textstr}); |
Line 304 sub send_selfserve_notification {
|
Line 304 sub send_selfserve_notification {
|
my $stamp = time; |
my $stamp = time; |
my $msgcount = &Apache::lonmsg::get_uniq(); |
my $msgcount = &Apache::lonmsg::get_uniq(); |
my $sender_lh = &Apache::loncommon::user_lang($uname,$udom,$cid); |
my $sender_lh = &Apache::loncommon::user_lang($uname,$udom,$cid); |
$subject = &Apache::lonlocal::mt_user($sender_lh,$rawsubj); |
$subject = &mt_user($sender_lh,$rawsubj); |
$message = ''; |
$message = ''; |
foreach my $item (@rawmsg) { |
foreach my $item (@rawmsg) { |
if (ref($item) eq 'HASH') { |
if (ref($item) eq 'HASH') { |
$message .= &Apache::lonlocal::mt_user($sender_lh,$item->{mt},@{$item->{args}})."\n"; |
$message .= &mt_user($sender_lh,$item->{mt},@{$item->{args}})."\n"; |
} |
} |
} |
} |
&Apache::lonmsg::process_sent_mail($subject,'',$numsent,$stamp,$uname,$udom,$msgcount,$cid,$$,$message, |
&Apache::lonmsg::process_sent_mail($subject,'',$numsent,$stamp,$uname,$udom,$msgcount,$cid,$$,$message, |
Line 322 sub send_selfserve_notification {
|
Line 322 sub send_selfserve_notification {
|
foreach my $recip (sort(keys(%{$msgcc}))) { |
foreach my $recip (sort(keys(%{$msgcc}))) { |
my ($ccname,$ccdom) = split(/:/,$recip); |
my ($ccname,$ccdom) = split(/:/,$recip); |
my $recip_lh = &Apache::loncommon::user_lang($ccname,$ccdom,$cid); |
my $recip_lh = &Apache::loncommon::user_lang($ccname,$ccdom,$cid); |
my $subject = &Apache::lonlocal::mt_user($sender_lh,$rawsubj); |
my $subject = &mt_user($sender_lh,$rawsubj); |
my $message = ''; |
my $message = ''; |
foreach my $item (@rawmsg) { |
foreach my $item (@rawmsg) { |
if (ref($item) eq 'HASH') { |
if (ref($item) eq 'HASH') { |
$message .= &Apache::lonlocal::mt_user($sender_lh,$item->{mt}, |
$message .= &mt_user($sender_lh,$item->{mt}, |
@{$item->{args}})."\n"; |
@{$item->{args}})."\n"; |
} |
} |
} |
} |
if ($context eq 'coursemanagers') { |
if ($context eq 'coursemanagers') { |
if ($approvedlist) { |
if ($approvedlist) { |
$message .= "\n\n".&Apache::lonlocal::mt_user($sender_lh,'Approved enrollments:')."\n".$approvedlist; |
$message .= "\n\n".&mt_user($sender_lh,'Approved enrollments:')."\n".$approvedlist; |
} |
} |
if ($rejectedlist) { |
if ($rejectedlist) { |
$message .= "\n\n".&Apache::lonlocal::mt_user($sender_lh,'Rejected enrollments:')."\n".$rejectedlist; |
$message .= "\n\n".&mt_user($sender_lh,'Rejected enrollments:')."\n".$rejectedlist; |
} |
} |
} elsif ($context eq 'domainmanagers') { |
} elsif ($context eq 'domainmanagers') { |
if ($approvedlist) { |
if ($approvedlist) { |
$message .= "\n\n".&Apache::lonlocal::mt_user($sender_lh,'Approved course requests:')."\n".$approvedlist; |
$message .= "\n\n".&mt_user($sender_lh,'Approved course requests:')."\n".$approvedlist; |
} |
} |
if ($rejectedlist) { |
if ($rejectedlist) { |
$message .= "\n\n".&Apache::lonlocal::mt_user($sender_lh,'Rejected course requests:')."\n".$rejectedlist; |
$message .= "\n\n".&mt_user($sender_lh,'Rejected course requests:')."\n".$rejectedlist; |
} |
} |
} elsif ($context eq 'authormanagers') { |
} elsif ($context eq 'authormanagers') { |
if ($approvedlist) { |
if ($approvedlist) { |
$message .= "\n\n".&Apache::lonlocal::mt_user($sender_lh,'Approved author role requests:')."\n".$approvedlist; |
$message .= "\n\n".&mt_user($sender_lh,'Approved author role requests:')."\n".$approvedlist; |
} |
} |
if ($rejectedlist) { |
if ($rejectedlist) { |
$message .= "\n\n".&Apache::lonlocal::mt_user($sender_lh,'Rejected author role requests:')."\n".$rejectedlist; |
$message .= "\n\n".&mt_user($sender_lh,'Rejected author role requests:')."\n".$rejectedlist; |
} |
} |
} elsif ($context eq 'usernamemanagers') { |
} elsif ($context eq 'usernamemanagers') { |
if ($approvedlist) { |
if ($approvedlist) { |
$message .= "\n\n".&Apache::lonlocal::mt_user($sender_lh,'Approved LON-CAPA account requests:')."\n".$approvedlist; |
$message .= "\n\n".&mt_user($sender_lh,'Approved LON-CAPA account requests:')."\n".$approvedlist; |
} |
} |
if ($rejectedlist) { |
if ($rejectedlist) { |
$message .= "\n\n".&Apache::lonlocal::mt_user($sender_lh,'Rejected LON-CAPA account requests:')."\n".$rejectedlist; |
$message .= "\n\n".&mt_user($sender_lh,'Rejected LON-CAPA account requests:')."\n".$rejectedlist; |
} |
} |
} |
} |
$status .= &Apache::lonmsg::user_normal_msg($ccname,$ccdom,$subject,$message,undef,undef,undef,1, |
$status .= &Apache::lonmsg::user_normal_msg($ccname,$ccdom,$subject,$message,undef,undef,undef,1, |
Line 396 sub display_queued_requests {
|
Line 396 sub display_queued_requests {
|
if ($context eq 'pending') { |
if ($context eq 'pending') { |
$disposition = 'pending'; |
$disposition = 'pending'; |
$nextphase = 'requestvalidation'; |
$nextphase = 'requestvalidation'; |
|
} elsif ($context eq 'displaypending') { |
|
$disposition = 'pending'; |
} |
} |
%requesthash = &Apache::lonnet::dump_dom($namespace,$dom,'_'.$disposition); |
%requesthash = &Apache::lonnet::dump_dom($namespace,$dom,'_'.$disposition); |
$nextelement = '<input type="hidden" name="phase" value="'.$nextphase.'" />'; |
$nextelement = '<input type="hidden" name="phase" value="'.$nextphase.'" />'; |
Line 422 sub display_queued_requests {
|
Line 424 sub display_queued_requests {
|
my ($cnum,$disposition) = split('_',$item); |
my ($cnum,$disposition) = split('_',$item); |
$entry = $cnum.':'.$requesthash{$item}{'ownername'}.':'. |
$entry = $cnum.':'.$requesthash{$item}{'ownername'}.':'. |
$requesthash{$item}{'ownerdom'}.':'; |
$requesthash{$item}{'ownerdom'}.':'; |
if ($context eq 'pending') { |
if (($context eq 'pending') || ($context eq 'displaypending')) { |
$entry .= $requesthash{$item}{'instcode'}; |
$entry .= $requesthash{$item}{'instcode'}; |
} else { |
} else { |
$entry .= $requesthash{$item}{'crstype'}; |
$entry .= $requesthash{$item}{'crstype'}; |
Line 441 sub display_queued_requests {
|
Line 443 sub display_queued_requests {
|
if (keys(%queue_by_date) > 0) { |
if (keys(%queue_by_date) > 0) { |
if ($context eq 'course') { |
if ($context eq 'course') { |
$output .= '<h3>'.&mt('Self-enrollment requests queued pending approval by a Coordinator').'</h3>'; |
$output .= '<h3>'.&mt('Self-enrollment requests queued pending approval by a Coordinator').'</h3>'; |
} elsif ($context eq 'pending') { |
} elsif (($context eq 'pending') || ($context eq 'displaypending')) { |
$output .= '<h3>'.&mt('Requests for official courses queued pending validation').'</h3>'. |
$output .= '<h3>'.&mt('Requests for official courses queued pending validation').'</h3>'. |
'<p>'.&mt('Requests are validated against institutional data to confirm that the requestor is an instructor of record.').'<br />'. |
'<p>'.&mt('Requests are validated against institutional data to confirm that the requestor is an instructor of record.').'<br />'. |
&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.').'</p>'; |
&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.').'</p>'; |
} elsif ($context eq 'requestauthor') { |
} elsif ($context eq 'requestauthor') { |
$output .= '<h3>'.&mt('Requests for Authoring Space queued pending approval by a Domain Coordinator').'</h3>'; |
$output .= '<h3>'.&mt('Requests for Authoring Space queued pending approval by a Domain Coordinator').'</h3>'; |
} elsif ($context eq 'requestusername') { |
} elsif ($context eq 'requestusername') { |
Line 472 sub display_queued_requests {
|
Line 476 sub display_queued_requests {
|
if ($context eq 'pending') { |
if ($context eq 'pending') { |
$output .= '<br /><input type="submit" name="validationcheck" value="'. |
$output .= '<br /><input type="submit" name="validationcheck" value="'. |
&mt('Validate').'" /><br />'."\n". |
&mt('Validate').'" /><br />'."\n". |
'<p>'.&mt('Any course/community requests which are successfully validated will be created immediately.').' '.&mt('Unvalidated requests will be listed for manual approval/rejection.').'</p>'; |
'<p>'.&mt('Any course/community requests which are successfully validated will be created immediately.').' '. |
} else { |
&mt('Unvalidated requests will be listed for manual approval/rejection.').'</p>'; |
|
} elsif (($context ne 'helpdesk') && ($context ne 'displaypending')) { |
$output .= '<br /><input type="submit" name="processqueue" value="'.&mt('Save').'" />'; |
$output .= '<br /><input type="submit" name="processqueue" value="'.&mt('Save').'" />'; |
} |
} |
$output .= '</form>'; |
$output .= '</form>'; |
Line 481 sub display_queued_requests {
|
Line 486 sub display_queued_requests {
|
$output .= '<div class="LC_info">'; |
$output .= '<div class="LC_info">'; |
if ($context eq 'course') { |
if ($context eq 'course') { |
$output .= &mt('There are currently no enrollment requests awaiting approval.'); |
$output .= &mt('There are currently no enrollment requests awaiting approval.'); |
} elsif ($context eq 'pending') { |
} elsif (($context eq 'pending') || ($context eq 'displaypending')) { |
$output .= &mt('There are currently no requests for official courses awaiting validation.'); |
$output .= &mt('There are currently no requests for official courses awaiting validation.'); |
} elsif ($context eq 'requestauthor') { |
} 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.'); |
Line 501 sub build_queue_display {
|
Line 506 sub build_queue_display {
|
my %crstypes; |
my %crstypes; |
my $output = &Apache::loncommon::start_data_table(). |
my $output = &Apache::loncommon::start_data_table(). |
&Apache::loncommon::start_data_table_header_row(); |
&Apache::loncommon::start_data_table_header_row(); |
unless ($context eq 'pending') { |
unless (($context eq 'pending') || ($context eq 'displaypending') || ($context eq 'helpdesk')) { |
$output .= '<th>'.&mt('Action').'</th>'; |
$output .= '<th>'.&mt('Action').'</th>'; |
} |
} |
$output .= '<th>'.&mt('Requestor').'</th>'; |
$output .= '<th>'.&mt('Requestor').'</th>'; |
Line 513 sub build_queue_display {
|
Line 518 sub build_queue_display {
|
} elsif ($context eq 'requestusername') { |
} elsif ($context eq 'requestusername') { |
$output .= '<th>'.&mt('Date requested').'</th>'. |
$output .= '<th>'.&mt('Date requested').'</th>'. |
'<th>'.&mt('Details').'</th>'; |
'<th>'.&mt('Details').'</th>'; |
} elsif ($context eq 'pending' || $context eq 'stillpending') { |
} elsif ($context eq 'pending' || $context eq 'displaypending' || $context eq 'stillpending') { |
$output .= '<th>'.&mt('Institutional code').'</th>'. |
$output .= '<th>'.&mt('Institutional code').'</th>'. |
'<th>'.&mt('Date requested').'</th>'. |
'<th>'.&mt('Date requested').'</th>'. |
'<th>'.&mt('Details').'</th>'; |
'<th>'.&mt('Details').'</th>'; |
Line 523 sub build_queue_display {
|
Line 528 sub build_queue_display {
|
unofficial => 'Unofficial course', |
unofficial => 'Unofficial course', |
community => 'Community', |
community => 'Community', |
textbook => 'Textbook course', |
textbook => 'Textbook course', |
|
placement => 'Placement test', |
); |
); |
$output .= '<th>'.&mt('Type').'</th>'. |
$output .= '<th>'.&mt('Type').'</th>'. |
'<th>'.&mt('Date requested').'</th>'. |
'<th>'.&mt('Date requested').'</th>'. |
Line 568 sub build_queue_display {
|
Line 574 sub build_queue_display {
|
} else { |
} else { |
my ($cnum,$ownername,$ownerdom,$type,$cdesc); |
my ($cnum,$ownername,$ownerdom,$type,$cdesc); |
my $queued = 'approval'; |
my $queued = 'approval'; |
if ($context eq 'pending' || $context eq 'stillpending') { |
if ($context eq 'pending' || $context eq 'displaypending' || $context eq 'stillpending') { |
($cnum,$ownername,$ownerdom,$instcode,$cdesc)=split(/:/,$request,5); |
($cnum,$ownername,$ownerdom,$instcode,$cdesc)=split(/:/,$request,5); |
$queued = 'pending'; |
$queued = 'pending'; |
} else { |
} else { |
Line 586 sub build_queue_display {
|
Line 592 sub build_queue_display {
|
&Apache::loncommon::plainname($ownername,$ownerdom), |
&Apache::loncommon::plainname($ownername,$ownerdom), |
$ownername,$ownerdom); |
$ownername,$ownerdom); |
} |
} |
unless ($context eq 'pending') { |
unless (($context eq 'pending') || ($context eq 'displaypending') || ($context eq 'helpdesk')) { |
$row = '<td><span class="LC_nobreak"><label>'. |
$row = '<td><span class="LC_nobreak"><label>'. |
'<input type="radio" value="'.$approve.'" name="'.$count.'radioreq" />'.&mt('Approve').'</label>'. |
'<input type="radio" value="'.$approve.'" name="'.$count.'radioreq" />'.&mt('Approve').'</label>'. |
'<label>'.(' 'x2). |
'<label>'.(' 'x2). |
Line 605 sub build_queue_display {
|
Line 611 sub build_queue_display {
|
$row .= '<td>'.$showtime.'</td>'."\n". |
$row .= '<td>'.$showtime.'</td>'."\n". |
'<td>'.$detailslink.'</td>'."\n"; |
'<td>'.$detailslink.'</td>'."\n"; |
} else { |
} else { |
if ($context eq 'pending' || $context eq 'stillpending') { |
if ($context eq 'pending' || $context eq 'displaypending' || $context eq 'stillpending') { |
$row .= '<td>'.$instcode.'</td>'."\n"; |
$row .= '<td>'.$instcode.'</td>'."\n"; |
} else { |
} else { |
$row .= '<td>'.$crstype.'</td>'."\n"; |
$row .= '<td>'.$crstype.'</td>'."\n"; |
Line 651 sub update_request_queue {
|
Line 657 sub update_request_queue {
|
$beneficiary = 'enroller'; |
$beneficiary = 'enroller'; |
$cid = $env{'request.course.id'}; |
$cid = $env{'request.course.id'}; |
$crstype = lc(&Apache::loncommon::course_type()); |
$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); |
%requesthash = &Apache::lonnet::dump($namespace,$cdom,$cnum); |
$access_start = $env{'course.'.$cid.'.internal.selfenroll_start_access'}; |
$access_start = $env{'course.'.$cid.'.internal.selfenroll_start_access'}; |
$access_end = $env{'course.'.$cid.'.internal.selfenroll_end_access'}; |
$access_end = $env{'course.'.$cid.'.internal.selfenroll_end_access'}; |
Line 680 sub update_request_queue {
|
Line 686 sub update_request_queue {
|
} |
} |
} |
} |
my $domconfiguser = &Apache::lonnet::get_domainconfiguser($cdom); |
my $domconfiguser = &Apache::lonnet::get_domainconfiguser($cdom); |
$firsturl = &course_portal_url($domconfiguser,$cdom); |
$firsturl = &Apache::lonnet::course_portal_url($domconfiguser,$cdom); |
$approvedmsg = [{ |
$approvedmsg = [{ |
mt => 'Your request for Authoring Space has been approved.', |
mt => 'Your request for Authoring Space has been approved.', |
}, |
}, |
Line 705 sub update_request_queue {
|
Line 711 sub update_request_queue {
|
} |
} |
} |
} |
my $domconfiguser = &Apache::lonnet::get_domainconfiguser($cdom); |
my $domconfiguser = &Apache::lonnet::get_domainconfiguser($cdom); |
$firsturl = &course_portal_url($domconfiguser,$cdom); |
$firsturl = &Apache::lonnet::course_portal_url($domconfiguser,$cdom); |
$approvedmsg = [{ |
$approvedmsg = [{ |
mt => 'Your request for a LON-CAPA account has been approved.', |
mt => 'Your request for a LON-CAPA account has been approved.', |
}, |
}, |
Line 874 sub update_request_queue {
|
Line 880 sub update_request_queue {
|
my $dbname = 'nohist_requestedusernames'; |
my $dbname = 'nohist_requestedusernames'; |
my $domconfiguser = &Apache::lonnet::get_domainconfiguser($cdom); |
my $domconfiguser = &Apache::lonnet::get_domainconfiguser($cdom); |
my %curr = &Apache::lonnet::get($dbname,[$uname],$cdom,$domconfiguser); |
my %curr = &Apache::lonnet::get($dbname,[$uname],$cdom,$domconfiguser); |
|
|
if (ref($curr{$uname}) eq 'HASH') { |
if (ref($curr{$uname}) eq 'HASH') { |
my ($username,$logtoken,$serverid,$encpass,$courseid,$id,$firstname, |
my ($logtoken,$serverid,$encpass,$courseid,$id,$firstname, |
$middlename,$lastname,$generation,$inststatus); |
$middlename,$lastname,$generation,$inststatus,$email); |
$curr{$uname}{'timestamp'} = $now; |
$curr{$uname}{'timestamp'} = $now; |
$curr{$uname}{'adjudicator'} = $env{'user.name'}.':'.$env{'user.domain'}; |
$curr{$uname}{'adjudicator'} = $env{'user.name'}.':'.$env{'user.domain'}; |
$courseid = $curr{$uname}{'courseid'}; |
$courseid = $curr{$uname}{'courseid'}; |
Line 888 sub update_request_queue {
|
Line 894 sub update_request_queue {
|
$generation = $curr{$uname}{'generation'}; |
$generation = $curr{$uname}{'generation'}; |
$inststatus = $curr{$uname}{'inststatus'}; |
$inststatus = $curr{$uname}{'inststatus'}; |
|
|
my ($key,$caller)=split(/&/,$curr{$uname}{'tmpinfo'}); |
if ($curr{$uname}{'email'} ne '') { |
if ($caller eq 'createaccount') { |
$email = $curr{$uname}{'email'}; |
my $upass = &Apache::loncommon::des_decrypt($key,$curr{$uname}{'upass'}); |
} 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 { |
undef($curr{$uname}{'upass'}); |
undef($curr{$uname}{'upass'}); |
my $result = |
my $result = |
&Apache::lonnet::modifyuser($cdom,$uname,$id,'internal',$upass, |
&Apache::lonnet::modifyuser($cdom,$uname,$id,'internal',$upass, |
$firstname,$middlename,$lastname, |
$firstname,$middlename,$lastname, |
$generation,undef,undef,$uname); |
$generation,undef,undef,$email); |
if ($result eq 'ok') { |
if ($result eq 'ok') { |
$curr{$uname}{'status'} = 'created'; |
$curr{$uname}{'status'} = 'created'; |
push(@completed,$uname); |
push(@completed,$uname); |
Line 916 sub update_request_queue {
|
Line 943 sub update_request_queue {
|
} else { |
} else { |
push(@processing_errors,$uname); |
push(@processing_errors,$uname); |
} |
} |
} else { |
|
push(@processing_errors,$uname); |
|
} |
} |
} else { |
} else { |
push(@invalidusers,$uname); |
push(@invalidusers,$uname); |
Line 957 sub update_request_queue {
|
Line 982 sub update_request_queue {
|
$ownerdom,$ownername); |
$ownerdom,$ownername); |
if ((ref($history{'details'}) eq 'HASH') && |
if ((ref($history{'details'}) eq 'HASH') && |
($history{'disposition'} eq $queue)) { |
($history{'disposition'} eq $queue)) { |
my ($logmsg,$newusermsg,$addresult,$enrollcount,$response,$keysmsg,$code,%customitems); |
my ($logmsg,$newusermsg,$addresult,$enrollcount,$response, |
|
$keysmsg,$code,%customitems); |
|
my $clonemsg = []; |
my $fullname = ''; |
my $fullname = ''; |
my $inprocess = &Apache::lonnet::auto_crsreq_update($cdom,$cnum,$crstype,'process',$ownername, |
my $inprocess = &Apache::lonnet::auto_crsreq_update($cdom,$cnum,$crstype,'process',$ownername, |
$ownerdom,$fullname,$coursedesc); |
$ownerdom,$fullname,$coursedesc); |
Line 971 sub update_request_queue {
|
Line 998 sub update_request_queue {
|
if ($history{'details'}{'clonecrs'}) { |
if ($history{'details'}{'clonecrs'}) { |
$customitems{'_LC_clonefrom'} = $history{'details'}{'clonedom'}.'_'.$history{'details'}{'clonecrs'}; |
$customitems{'_LC_clonefrom'} = $history{'details'}{'clonedom'}.'_'.$history{'details'}{'clonecrs'}; |
} |
} |
my ($result,$postprocess) = &course_creation($cdom,$cnum,$context,$history{'details'},\$logmsg, |
my ($result,$postprocess) = &course_creation($cdom,$cnum,$context,$history{'details'}, |
\$newusermsg,\$addresult,\$enrollcount, |
\$logmsg,$clonemsg,\$newusermsg,\$addresult,\$enrollcount, |
\$response,\$keysmsg,\%domdefs,$longroles,\$code,\%customitems); |
\$response,\$keysmsg,\%domdefs,$longroles,\$code,\%customitems); |
if ($result eq 'created') { |
if ($result eq 'created') { |
if ($crstype eq 'community') { |
if ($crstype eq 'community') { |
Line 980 sub update_request_queue {
|
Line 1007 sub update_request_queue {
|
} else { |
} else { |
$approvedmsg = $approvalmsg{'course'}; |
$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) eq 'ARRAY') { |
if (ref($approvedmsg->[1]) eq 'HASH') { |
if (ref($approvedmsg->[1]) eq 'HASH') { |
$approvedmsg->[1]->{'args'} = [$firsturl]; |
$approvedmsg->[1]->{'args'} = [$firsturl]; |
} |
} |
|
if ((ref($clonemsg) eq 'ARRAY') && (@{$clonemsg})) { |
|
push(@{$approvedmsg},@{$clonemsg}); |
|
} |
if ($code) { |
if ($code) { |
push(@{$approvedmsg}, |
push(@{$approvedmsg}, |
{ |
{ |
Line 1564 sub update_request_queue {
|
Line 1594 sub update_request_queue {
|
return $output; |
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 { |
sub get_student_counts { |
my ($cdom,$cnum) = @_; |
my ($cdom,$cnum) = @_; |
my (%idx,%stucounts); |
my (%idx,%stucounts); |
Line 1599 sub get_student_counts {
|
Line 1613 sub get_student_counts {
|
} |
} |
|
|
sub course_creation { |
sub course_creation { |
my ($dom,$cnum,$context,$details,$logmsg,$newusermsg,$addresult,$enrollcount,$output, |
my ($dom,$cnum,$context,$details,$logmsg,$clonemsg,$newusermsg,$addresult, |
$keysmsg,$domdefs,$longroles,$coderef,$customhash) = @_; |
$enrollcount,$output,$keysmsg,$domdefs,$longroles,$coderef,$customhash, |
|
$callercontext,$user_lh) = @_; |
unless ((ref($details) eq 'HASH') && (ref($domdefs) eq 'HASH') && |
unless ((ref($details) eq 'HASH') && (ref($domdefs) eq 'HASH') && |
(ref($longroles) eq 'HASH')) { |
(ref($longroles) eq 'HASH')) { |
return 'error: Invalid request'; |
return ('error: Invalid request'); |
} |
} |
my ($result,$ownername,$ownerdom); |
my ($result,$ownername,$ownerdom); |
my $crstype = $details->{'crstype'}; |
my $crstype = $details->{'crstype'}; |
Line 1632 sub course_creation {
|
Line 1647 sub course_creation {
|
$owneremail = $emails{$email}; |
$owneremail = $emails{$email}; |
last if ($owneremail ne ''); |
last if ($owneremail ne ''); |
} |
} |
my %reqdetails = &build_batchcreatehash($dom,$context,$details,$owneremail,$domdefs); |
my %reqdetails = &build_batchcreatehash($dom,$cnum,$context,$details,$owneremail,$domdefs); |
my $cid = &LONCAPA::batchcreatecourse::build_course($dom,$cnum,'requestcourses', |
my $cid = &LONCAPA::batchcreatecourse::build_course($dom,$cnum,'requestcourses', |
\%reqdetails,$longroles,$logmsg,$newusermsg,$addresult, |
\%reqdetails,$longroles,$logmsg,$clonemsg,$newusermsg,$addresult, |
$enrollcount,$output,$keysmsg,$ownerdom,$ownername,$cnum,$crstype,$coderef); |
$enrollcount,$output,$keysmsg,$ownerdom,$ownername,$cnum,$crstype, |
|
$coderef,$callercontext,$user_lh); |
my $postprocess; |
my $postprocess; |
if ($cid eq "/$dom/$cnum") { |
if ($cid eq "/$dom/$cnum") { |
$result = 'created'; |
$result = 'created'; |
Line 1653 sub course_creation {
|
Line 1669 sub course_creation {
|
} |
} |
|
|
sub build_batchcreatehash { |
sub build_batchcreatehash { |
my ($dom,$context,$details,$owneremail,$domdefs) = @_; |
my ($dom,$cnum,$context,$details,$owneremail,$domdefs) = @_; |
my %batchhash; |
my %batchhash; |
my @items = qw{owner domain coursehome clonecrs clonedom datemode dateshift enrollstart enrollend accessstart accessend sections crosslists users uniquecode}; |
my @items = qw{owner domain coursehome clonecrs clonedom datemode dateshift tinyurls enrollstart enrollend accessstart accessend sections users uniquecode}; |
if ((ref($details) eq 'HASH') && (ref($domdefs) eq 'HASH')) { |
if ((ref($details) eq 'HASH') && (ref($domdefs) eq 'HASH')) { |
my $emailenc = &escape($owneremail); |
my $emailenc = &escape($owneremail); |
my $owner = $details->{'owner'}.':'.$details->{'domain'}; |
my $owner = $details->{'owner'}.':'.$details->{'domain'}; |
foreach my $item (@items) { |
foreach my $item (@items) { |
$batchhash{$item} = $details->{$item}; |
$batchhash{$item} = $details->{$item}; |
} |
} |
|
if (ref($details->{'crosslists'}) eq 'HASH') { |
|
foreach my $key (keys(%{$details->{'crosslists'}})) { |
|
if (ref($details->{'crosslists'}->{$key}) eq 'HASH') { |
|
my $instsec = $details->{crosslists}->{$key}->{instsec}; |
|
$batchhash{'crosslists'}{$key}{'inst'} = $details->{crosslists}->{$key}->{instcode}; |
|
my $crskey = $cnum.':'.$batchhash{'crosslists'}{$key}{'inst'}; |
|
my %formatted = &Apache::lonnet::auto_instsec_reformat($dom,'clutter', |
|
{$crskey => [$instsec]}); |
|
if (ref($formatted{$crskey}) eq 'ARRAY') { |
|
$batchhash{'crosslists'}{$key}{'inst'} .= $formatted{$crskey}->[0]; |
|
} |
|
$batchhash{'crosslists'}{$key}{'loncapa'} = $details->{crosslists}->{$key}->{loncapa}; |
|
} |
|
} |
|
} |
$batchhash{'title'} = $details->{'cdescr'}; |
$batchhash{'title'} = $details->{'cdescr'}; |
$batchhash{'coursecode'} = $details->{'instcode'}; |
$batchhash{'coursecode'} = $details->{'instcode'}; |
if ($domdefs->{'officialcredits'} || $domdefs->{'unofficialcredits'}) { |
if ($domdefs->{'officialcredits'} || $domdefs->{'unofficialcredits'}) { |
Line 1674 sub build_batchcreatehash {
|
Line 1705 sub build_batchcreatehash {
|
$batchhash{'authparam'} = $domdefs->{'auth_arg_def'}; |
$batchhash{'authparam'} = $domdefs->{'auth_arg_def'}; |
if ($details->{'crstype'} eq 'community') { |
if ($details->{'crstype'} eq 'community') { |
$batchhash{'crstype'} = 'Community'; |
$batchhash{'crstype'} = 'Community'; |
|
} elsif ($details->{'crstype'} eq 'placement') { |
|
$batchhash{'crstype'} = 'Placement'; |
} else { |
} else { |
if ($details->{'crstype'} eq 'textbook') { |
if ($details->{'crstype'} eq 'textbook') { |
if ($details->{'clonecrs'} && $details->{'clonedom'}) { |
if ($details->{'clonecrs'} && $details->{'clonedom'}) { |
Line 2006 sub process_official_reqs {
|
Line 2039 sub process_official_reqs {
|
$longroles{$role}=&Apache::lonnet::plaintext($role); |
$longroles{$role}=&Apache::lonnet::plaintext($role); |
} |
} |
my %domdefs = &Apache::lonnet::get_domain_defaults($dom); |
my %domdefs = &Apache::lonnet::get_domain_defaults($dom); |
my ($output,$linefeed); |
my ($output,$linefeed,$user_lh); |
if ($context eq 'auto') { |
if ($context eq 'auto') { |
$linefeed = "\n"; |
$linefeed = "\n"; |
|
$user_lh = &Apache::loncommon::user_lang($dcname,$dcdom); |
} else { |
} else { |
$linefeed = '<br />'."\n"; |
$linefeed = '<br />'."\n"; |
} |
} |
Line 2070 sub process_official_reqs {
|
Line 2104 sub process_official_reqs {
|
$reqstatus = $disposition; |
$reqstatus = $disposition; |
if ($disposition eq 'process') { |
if ($disposition eq 'process') { |
my ($logmsg,$newusermsg,$addresult,$enrollcount,$response,$keysmsg,$code); |
my ($logmsg,$newusermsg,$addresult,$enrollcount,$response,$keysmsg,$code); |
|
my $clonemsg = []; |
my %customitems; |
my %customitems; |
my $fullname = &Apache::loncommon::plainname($ownername,$ownerdom); |
my $fullname = &Apache::loncommon::plainname($ownername,$ownerdom); |
my $inprocess = &Apache::lonnet::auto_crsreq_update($dom,$cnum,$crstype,'process',$ownername, |
my $inprocess = &Apache::lonnet::auto_crsreq_update($dom,$cnum,$crstype,'process',$ownername, |
Line 2085 sub process_official_reqs {
|
Line 2120 sub process_official_reqs {
|
$customitems{'_LC_clonefrom'} = $history{'details'}{'clonedom'}.'_'.$history{'details'}{'clonecrs'}; |
$customitems{'_LC_clonefrom'} = $history{'details'}{'clonedom'}.'_'.$history{'details'}{'clonecrs'}; |
} |
} |
my ($result,$postprocess) = |
my ($result,$postprocess) = |
&course_creation($dom,$cnum,'domain',$history{'details'},\$logmsg,\$newusermsg,\$addresult, |
&course_creation($dom,$cnum,'domain',$history{'details'},\$logmsg,$clonemsg,\$newusermsg, |
\$enrollcount,\$response,\$keysmsg,\%domdefs,\%longroles,\$code,\%customitems); |
\$addresult,\$enrollcount,\$response,\$keysmsg,\%domdefs,\%longroles, |
|
\$code,\%customitems,$context,$user_lh); |
if ($result eq 'created') { |
if ($result eq 'created') { |
$disposition = 'created'; |
$disposition = 'created'; |
$reqstatus = 'created'; |
$reqstatus = 'created'; |
my $cid = $dom.'_'.$cnum; |
my $cid = $dom.'_'.$cnum; |
push(@{$newcids{$instcode}},$cid); |
push(@{$newcids{$instcode}},$cid); |
if ($dcname && $dcdom) { |
if ($dcname && $dcdom) { |
my $firsturl = &course_portal_url($cnum,$dom); |
my $firsturl = &Apache::lonnet::course_portal_url($cnum,$dom); |
my $beneficiary = 'pendingrequestor'; |
my $beneficiary = 'pendingrequestor'; |
my $now = time; |
my $now = time; |
my $owner = $ownername.':'.$ownerdom; |
my $owner = $ownername.':'.$ownerdom; |
Line 2101 sub process_official_reqs {
|
Line 2137 sub process_official_reqs {
|
[{ |
[{ |
mt => 'Your requested course: [_1], (queued pending validation) has now been created.', |
mt => 'Your requested course: [_1], (queued pending validation) has now been created.', |
args => [$cdescr], |
args => [$cdescr], |
}, |
}]; |
|
if ((ref($clonemsg) eq 'ARRAY') && (@{$clonemsg})) { |
|
push(@{$approvedmsg},@{$clonemsg}); |
|
} |
|
push(@{$approvedmsg}, |
{ |
{ |
mt => 'Visit [_1] to log-in and access the course.', |
mt => 'Visit [_1] to log-in and access the course.', |
args => [$firsturl], |
args => [$firsturl], |
}, |
}, |
{ |
{ |
mt => 'If currently logged-in to LON-CAPA, log-out and log-in again to select your new course role.' |
mt => 'If currently logged-in to LON-CAPA, log-out and log-in again to select your new course role.', |
}]; |
args => [], |
|
} |
|
); |
my $sender = $dcname.':'.$dcdom; |
my $sender = $dcname.':'.$dcdom; |
if (ref($postprocess) eq 'HASH') { |
if (ref($postprocess) eq 'HASH') { |
if (ref($postprocess->{'createdmsg'}) eq 'ARRAY') { |
if (ref($postprocess->{'createdmsg'}) eq 'ARRAY') { |