version 1.111, 2021/05/04 18:47:36
|
version 1.118, 2025/01/10 22:45:55
|
Line 337 sub handler {
|
Line 337 sub handler {
|
$jscript = &Apache::lonhtmlcommon::set_form_elements($elementsref,\%stored); |
$jscript = &Apache::lonhtmlcommon::set_form_elements($elementsref,\%stored); |
if ($state eq 'courseinfo') { |
if ($state eq 'courseinfo') { |
$jscript .= &cloning_javascript(); |
$jscript .= &cloning_javascript(); |
} elsif ($state eq 'process') { |
|
$jscript .= &processing_javascript(); |
|
} |
} |
} |
} |
} |
} |
Line 450 function setCloneDisplay(courseForm) {
|
Line 448 function setCloneDisplay(courseForm) {
|
END |
END |
} |
} |
|
|
sub processing_javascript { |
|
return <<"END"; |
|
function hideProcessing() { |
|
if (document.getElementById('processing')) { |
|
document.getElementById('processing').style.display="none"; |
|
} |
|
} |
|
|
|
END |
|
} |
|
|
|
sub get_breadcrumbs { |
sub get_breadcrumbs { |
my ($dom,$action,$state,$states,$trail) = @_; |
my ($dom,$action,$state,$states,$trail) = @_; |
my ($crumb,$newinstcode,$codechk,$checkedcode,$numtitles,$description); |
my ($crumb,$newinstcode,$codechk,$checkedcode,$numtitles,$description); |
Line 739 sub onload_action {
|
Line 726 sub onload_action {
|
if ($state eq 'courseinfo') { |
if ($state eq 'courseinfo') { |
$loaditems{'onload'} .= 'javascript:setCloneDisplay(document.requestcrs);'; |
$loaditems{'onload'} .= 'javascript:setCloneDisplay(document.requestcrs);'; |
} |
} |
if ($state eq 'process') { |
|
$loaditems{'onload'} .= 'javascript:hideProcessing();'; |
|
} |
|
} |
} |
return \%loaditems; |
return \%loaditems; |
} |
} |
Line 2742 sub requestlog_display_filter {
|
Line 2726 sub requestlog_display_filter {
|
my $nolink = 1; |
my $nolink = 1; |
my $output = '<table><tr><td valign="top">'. |
my $output = '<table><tr><td valign="top">'. |
'<span class="LC_nobreak"><b>'.&mt('Records/page:').'</b></span><br />'. |
'<span class="LC_nobreak"><b>'.&mt('Records/page:').'</b></span><br />'. |
&Apache::lonmeta::selectbox('show',$curr->{'show'},undef, |
&Apache::lonmeta::selectbox('show',$curr->{'show'},'',undef, |
(&mt('all'),5,10,20,50,100,1000,10000)). |
(&mt('all'),5,10,20,50,100,1000,10000)). |
'</td><td> </td>'; |
'</td><td> </td>'; |
my $startform = |
my $startform = |
Line 3242 sub clone_form {
|
Line 3226 sub clone_form {
|
'</label><br /><label>'. |
'</label><br /><label>'. |
'<input type="radio" name="datemode" value="shift" checked="checked" /> '. |
'<input type="radio" name="datemode" value="shift" checked="checked" /> '. |
$lt{'shd'}.'</label>'. |
$lt{'shd'}.'</label>'. |
'<input type="text" size="5" name="dateshift" value="365" />'. |
'<input type="text" size="5" name="dateshift" value="364" />'. |
&Apache::lonhtmlcommon::row_closure(1). |
&Apache::lonhtmlcommon::row_closure(1). |
&Apache::lonhtmlcommon::row_title($lt{'dpl'}).'<label>'. |
&Apache::lonhtmlcommon::row_title($lt{'dpl'}).'<label>'. |
'<input type="radio" name="tinyurls" value="delete" /> '.$lt{'nsl'}. |
'<input type="radio" name="tinyurls" value="delete" /> '.$lt{'nsl'}. |
Line 3705 sub print_request_outcome {
|
Line 3689 sub print_request_outcome {
|
} |
} |
} |
} |
} |
} |
|
if ($env{'form.chome'} eq 'default') { |
|
my %servers = &Apache::lonnet::get_servers($dom,'library'); |
|
my $numlib = keys(%servers); |
|
if ($numlib) { |
|
my $loadm=10000000; |
|
my $chome; |
|
foreach my $tryserver (keys(%servers)) { |
|
($chome,$loadm) = |
|
&Apache::lonnet::compare_server_load($tryserver,$chome,$loadm); |
|
} |
|
$env{'form.chome'} = $chome; |
|
} |
|
} |
my $details = { |
my $details = { |
owner => $env{'user.name'}, |
owner => $env{'user.name'}, |
domain => $env{'user.domain'}, |
domain => $env{'user.domain'}, |
Line 3865 sub process_request {
|
Line 3862 sub process_request {
|
foreach my $role (@roles) { |
foreach my $role (@roles) { |
$longroles{$role}=&Apache::lonnet::plaintext($role,$type); |
$longroles{$role}=&Apache::lonnet::plaintext($role,$type); |
} |
} |
$r->print('<div id="processing" style="display:block;">'."\n". |
my $preamble = '<div id="LC_update" class="LC_info">'. |
&mt('Your request is being processed; this page will update when processing is complete.'). |
'<br />'. |
'</div>'); |
&mt("Please be patient while your request is processed"). |
|
'<br /></div>'. |
|
'<div style="padding:0;clear:both;margin:0;border:0"></div>'; |
|
my $closure = <<ENDCLOSE; |
|
<script type="text/javascript"> |
|
// <![CDATA[ |
|
\$("#LC_update").hide('slow'); |
|
// ]]> |
|
</script> |
|
ENDCLOSE |
|
my %prog_state = &Apache::lonhtmlcommon::Create_PrgWin($r,undef,$preamble); |
|
&Apache::lonhtmlcommon::Update_PrgWin($r,\%prog_state,&mt('Processing ...')); |
$r->rflush(); |
$r->rflush(); |
if (ref($details) eq 'HASH') { |
if (ref($details) eq 'HASH') { |
if ($details->{'clonecrs'}) { |
if ($details->{'clonecrs'}) { |
Line 3892 sub process_request {
|
Line 3900 sub process_request {
|
'autocreate',$details,\$logmsg,$clonemsg,\$newusermsg, |
'autocreate',$details,\$logmsg,$clonemsg,\$newusermsg, |
\$addresult,\$enrollcount,\$response,\$keysmsg,\%domdefs, |
\$addresult,\$enrollcount,\$response,\$keysmsg,\%domdefs, |
\%longroles,\$code,\%customitems); |
\%longroles,\$code,\%customitems); |
|
&Apache::lonhtmlcommon::Update_PrgWin($r,\%prog_state,&mt('Finished!')); |
|
&Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state); |
|
$r->print($closure); |
if (ref($postprocess) eq 'HASH') { |
if (ref($postprocess) eq 'HASH') { |
$customized = $postprocess->{'createdcustomized'}; |
$customized = $postprocess->{'createdcustomized'}; |
} |
} |
Line 3908 sub process_request {
|
Line 3919 sub process_request {
|
if (($code) || ((ref($postprocess) eq 'HASH') && |
if (($code) || ((ref($postprocess) eq 'HASH') && |
(($postprocess->{'createdweb'}) || ($postprocess->{'createdmsg'})))) { |
(($postprocess->{'createdweb'}) || ($postprocess->{'createdmsg'})))) { |
$output .= ¬ification_information($disposition,$env{'user.name'}.':'.$env{'user.domain'}, |
$output .= ¬ification_information($disposition,$env{'user.name'}.':'.$env{'user.domain'}, |
$dom,$cnum,$now,$code,$postprocess); |
$dom,$cnum,$now,$code,$postprocess,$crstype); |
} |
} |
if ($code) { |
if ($code) { |
$reqhash{'code'} = $code; |
$reqhash{'code'} = $code; |
Line 4021 sub process_request {
|
Line 4032 sub process_request {
|
unless ($disposition eq 'pending') { |
unless ($disposition eq 'pending') { |
$output .= '<br />'. |
$output .= '<br />'. |
¬ification_information($disposition,$req_notifylist, |
¬ification_information($disposition,$req_notifylist, |
$dom,$cnum,$now); |
$dom,$cnum,$now,'','',$crstype); |
} |
} |
} else { |
} else { |
$reqstatus = 'domainerror'; |
$reqstatus = 'domainerror'; |
Line 4054 sub process_request {
|
Line 4065 sub process_request {
|
$output .= '<p>'.&mt('Your course request has been updated').'</p>'; |
$output .= '<p>'.&mt('Your course request has been updated').'</p>'; |
} |
} |
if ($disposition eq 'approval') { |
if ($disposition eq 'approval') { |
$output .= ¬ification_information($disposition,$req_notifylist,$dom,$cnum,$now); |
$output .= ¬ification_information($disposition,$req_notifylist,$dom,$cnum,$now,'','',$crstype); |
} |
} |
} |
} |
if ($disposition eq 'approval') { |
if ($disposition eq 'approval') { |
if ((ref($postprocess) eq 'HASH') && |
if ((ref($postprocess) eq 'HASH') && |
((ref($postprocess->{'queuedmsg'}) eq 'HASH') || ($postprocess->{'queuedweb'}))) { |
((ref($postprocess->{'queuedmsg'}) eq 'HASH') || ($postprocess->{'queuedweb'}))) { |
¬ification_information($disposition,undef,$dom,$cnum,$now,undef,$postprocess); |
¬ification_information($disposition,undef,$dom,$cnum,$now,undef,$postprocess,$crstype); |
$customized = $postprocess->{'createdcustomized'}; |
$customized = $postprocess->{'createdcustomized'}; |
} |
} |
} elsif ($disposition eq 'pending') { |
} elsif ($disposition eq 'pending') { |
Line 4072 sub process_request {
|
Line 4083 sub process_request {
|
if ($pendingform) { |
if ($pendingform) { |
$output .= $pendingform; |
$output .= $pendingform; |
} else { |
} else { |
$output .= ¬ification_information($disposition,undef,$dom,$cnum,$now,undef,$postprocess); |
$output .= ¬ification_information($disposition,undef,$dom,$cnum,$now,undef,$postprocess,$crstype); |
} |
} |
if (ref($postprocess) eq 'HASH') { |
if (ref($postprocess) eq 'HASH') { |
$customized = $postprocess->{'createdcustomized'}; |
$customized = $postprocess->{'createdcustomized'}; |
Line 4270 sub update_requestors_roles {
|
Line 4281 sub update_requestors_roles {
|
} |
} |
|
|
sub notification_information { |
sub notification_information { |
my ($disposition,$req_notifylist,$dom,$cnum,$now,$code,$postprocess) = @_; |
my ($disposition,$req_notifylist,$dom,$cnum,$now,$code,$postprocess,$crstype) = @_; |
my %emails = &Apache::loncommon::getemails(); |
my %emails = &Apache::loncommon::getemails(); |
my $address; |
my $address; |
if (($emails{'permanentemail'} ne '') || ($emails{'notification'} ne '')) { |
if (($emails{'permanentemail'} ne '') || ($emails{'notification'} ne '')) { |
Line 4286 sub notification_information {
|
Line 4297 sub notification_information {
|
if ($address ne '') { |
if ($address ne '') { |
$output.= &mt('An e-mail will also be sent to: [_1] when this occurs.',$address).'<br />'; |
$output.= &mt('An e-mail will also be sent to: [_1] when this occurs.',$address).'<br />'; |
} |
} |
|
my %possemails; |
|
my $fullname = &Apache::loncommon::plainname($env{'user.name'}, |
|
$env{'user.domain'}); |
|
my $emailto = &Apache::loncommon::build_recipient_list(undef,'requestsmail',$dom); |
|
if ($emailto) { |
|
map { $possemails{$_} = 1; } (split(/,/,$emailto)); |
|
} |
if ($req_notifylist) { |
if ($req_notifylist) { |
my $fullname = &Apache::loncommon::plainname($env{'user.name'}, |
if ($emailto) { |
$env{'user.domain'}); |
foreach my $recip (split(/,/,$req_notifylist)) { |
|
my ($uname,$udom) = split(/:/,$recip); |
|
my %emails = &Apache::loncommon::getemails($uname,$udom); |
|
foreach my $type ('permanentemail','notification') { |
|
if ((exists($emails{$type})) && ($emails{$type} ne '')) { |
|
my @to = split(/,/,$emails{$type}); |
|
foreach my $addr (@to) { |
|
if (($addr ne '') && ($addr =~ m/\@/)) { |
|
if (exists($possemails{$addr})) { |
|
delete($possemails{$addr}); |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
my $sender = $env{'user.name'}.':'.$env{'user.domain'}; |
my $sender = $env{'user.name'}.':'.$env{'user.domain'}; |
&Apache::loncoursequeueadmin::send_selfserve_notification($req_notifylist,"$fullname ($env{'user.name'}:$env{'user.domain'})", |
&Apache::loncoursequeueadmin::send_selfserve_notification($req_notifylist,"$fullname ($env{'user.name'}:$env{'user.domain'})", |
'undef',$env{'form.cdescr'},$now,'coursereq',$sender); |
undef,$env{'form.cdescr'},$now,'coursereq',$sender,'','',$crstype); |
|
} |
|
# |
|
# If domain configuration for "E-mail addresses and helpform" has values set |
|
# for "E-mail from course requests requiring approval", send email to those |
|
# addresse(es) when a course request is queued, pending approval, unless |
|
# the email address will already receive a notification email, because of |
|
# values set for "Receive notification of course requests requiring approval" |
|
# in "Request creation of courses" configuration item. |
|
# |
|
if ($emailto && keys(%possemails)) { |
|
¬ify_admin($dom,$crstype,$env{'form.cdescr'},"$fullname ($env{'user.name'}:$env{'user.domain'})",$now,\%possemails); |
} |
} |
if (ref($postprocess) eq 'HASH') { |
if (ref($postprocess) eq 'HASH') { |
if (ref($postprocess->{'queuedmsg'}) eq 'ARRAY') { |
if (ref($postprocess->{'queuedmsg'}) eq 'ARRAY') { |
Line 4372 sub notification_information {
|
Line 4417 sub notification_information {
|
$type = 'uniquecode'; |
$type = 'uniquecode'; |
} |
} |
&Apache::loncoursequeueadmin::send_selfserve_notification($recipient,$addmsg,$dom.'_'.$cnum,$env{'form.cdescr'}, |
&Apache::loncoursequeueadmin::send_selfserve_notification($recipient,$addmsg,$dom.'_'.$cnum,$env{'form.cdescr'}, |
$now,$type,$sender); |
$now,$type,$sender,'','',$crstype); |
} |
} |
} |
} |
} else { |
} else { |
Line 4383 sub notification_information {
|
Line 4428 sub notification_information {
|
return $output; |
return $output; |
} |
} |
|
|
|
sub notify_admin { |
|
my ($dom,$crstype,$contextdesc,$textstr,$timestamp,$emailsref) = @_; |
|
if ((ref($emailsref) eq 'HASH') && (keys(%{$emailsref}))) { |
|
my $emailto = join(',',sort(keys(%{$emailsref}))); |
|
my (@rawmsg,$rawsubj,$msgtxt); |
|
if ($crstype eq 'community') { |
|
$rawsubj = 'Community request to review'; |
|
$msgtxt = 'Creation of the following community: [_1]was requested by [_2] on [_3].'; |
|
} else { |
|
$rawsubj = 'Course request to review'; |
|
$msgtxt = 'Creation of the following course: [_1]was requested by [_2] on [_3].'; |
|
} |
|
$timestamp =&Apache::lonlocal::locallocaltime($timestamp); |
|
push(@rawmsg,{ |
|
mt => $msgtxt, |
|
args => ["\n $contextdesc\n",$textstr,$timestamp], |
|
}, |
|
{ |
|
mt =>'[_1]A Domain Coordinator will use: [_2]Main Menu -> Course and community creation -> Approve or reject requests[_3]to display a list of pending requests, which can either be approved or rejected.', |
|
args => ["\n","\n\n","\n\n"], |
|
}); |
|
|
|
my $sender_lh = &Apache::loncommon::user_lang($env{'user.name'},$env{'user.domain'}); |
|
my $subject = &mt_user($sender_lh,$rawsubj); |
|
my $message = ''; |
|
foreach my $item (@rawmsg) { |
|
if (ref($item) eq 'HASH') { |
|
if (ref($item->{args}) eq 'ARRAY') { |
|
$message .= &mt_user($sender_lh,$item->{mt},@{$item->{args}})."\n"; |
|
} else { |
|
$message .= &mt_user($sender_lh,$item->{mt})."\n"; |
|
} |
|
} |
|
} |
|
my $chgmail = "To: $emailto\n". |
|
"Subject: $subject\n". |
|
"Content-type: text/plain\; charset=UTF-8\n". |
|
"MIME-Version: 1.0\n\n". |
|
"$message\n\n"; |
|
if (open(my $mailh, "|/usr/lib/sendmail -oi -t -odb")) { |
|
print $mailh $chgmail; |
|
close($mailh); |
|
} |
|
} |
|
} |
|
|
sub pending_validation_form { |
sub pending_validation_form { |
my ($r,$cdom,$cnum,$crstype,$now,$token,$lonhost,$cdesc) = @_; |
my ($r,$cdom,$cnum,$crstype,$now,$token,$lonhost,$cdesc) = @_; |
my $output; |
my $output; |
Line 4920 sub print_textbook_form {
|
Line 5011 sub print_textbook_form {
|
'</label><br /><label>'. |
'</label><br /><label>'. |
'<input type="radio" name="owndatemode" value="shift" checked="checked" /> '. |
'<input type="radio" name="owndatemode" value="shift" checked="checked" /> '. |
$lt{'shd'}.'</label>'. |
$lt{'shd'}.'</label>'. |
'<input type="text" size="5" name="owndateshift" value="365" />'. |
'<input type="text" size="5" name="owndateshift" value="364" />'. |
'</fieldset><fieldset style="display:inline-block">'. |
'</fieldset><fieldset style="display:inline-block">'. |
'<legend>'.$lt{'dpl'}.'</legend><label>'. |
'<legend>'.$lt{'dpl'}.'</legend><label>'. |
'<input type="radio" name="owntinyurls" value="delete" />'.$lt{'nsl'}. |
'<input type="radio" name="owntinyurls" value="delete" />'.$lt{'nsl'}. |
Line 4944 sub print_textbook_form {
|
Line 5035 sub print_textbook_form {
|
'</label><br /><label>'. |
'</label><br /><label>'. |
'<input type="radio" name="colldatemode" value="shift" checked="checked" /> '. |
'<input type="radio" name="colldatemode" value="shift" checked="checked" /> '. |
$lt{'shd'}.'</label>'. |
$lt{'shd'}.'</label>'. |
'<input type="text" size="5" name="colldateshift" value="365" />'. |
'<input type="text" size="5" name="colldateshift" value="364" />'. |
'</fieldset><fieldset style="display:inline-block">'. |
'</fieldset><fieldset style="display:inline-block">'. |
'<legend>'.$lt{'dpl'}.'</legend><label>'. |
'<legend>'.$lt{'dpl'}.'</legend><label>'. |
'<input type="radio" name="colltinyurls" value="delete" />'.$lt{'nsl'}. |
'<input type="radio" name="colltinyurls" value="delete" />'.$lt{'nsl'}. |
Line 5146 sub process_textbook_request {
|
Line 5237 sub process_textbook_request {
|
undef($clonedom); |
undef($clonedom); |
} |
} |
} |
} |
my $js = &processing_javascript(); |
my $args; |
my ($loaditems,$args); |
|
$loaditems = { |
|
onload => 'javascript:hideProcessing();', |
|
}; |
|
if ($crstype eq 'lti') { |
if ($crstype eq 'lti') { |
$args = { 'only_body' => 1}; |
$args = { 'only_body' => 1}; |
} |
} |
$r->print(&header('Course Creation',$js,$loaditems,undef,$args)); |
$r->print(&header('Course Creation','','',undef,$args)); |
|
|
unless ($crstype eq 'lti') { |
unless ($crstype eq 'lti') { |
if (ref($can_request) eq 'HASH') { |
if (ref($can_request) eq 'HASH') { |
Line 5226 sub process_textbook_request {
|
Line 5313 sub process_textbook_request {
|
'',$req_notifylist,[],$domconfig); |
'',$req_notifylist,[],$domconfig); |
$r->print($output); |
$r->print($output); |
if ($crstype eq 'lti') { |
if ($crstype eq 'lti') { |
my %consumers = &Apache::lonnet::get_dom('lticonsumers',[$env{'form.sourcecrs'}],$dom); |
my $storecrs; |
if (($env{'form.lti.sourcecrs'} ne '') && ($consumers{$env{'form.lti.sourcecrs'}} eq '') && ($cnum ne '')) { |
if ($env{'request.lti.login'}) { |
&Apache::lonnet::put_dom('lticonsumers',{ $env{'form.lti.sourcecrs'} => $cnum },$dom); |
my %lti = &Apache::lonnet::get_domain_lti($dom,'provider'); |
|
if (ref($lti{$env{'request.lti.login'}}) eq 'HASH') { |
|
$storecrs = $lti{$env{'request.lti.login'}}{'storecrs'}; |
|
} |
|
if ($storecrs) { |
|
my %consumers = &Apache::lonnet::get_dom('lticonsumers',[$env{'form.sourcecrs'}],$dom); |
|
if (($env{'form.lti.sourcecrs'} ne '') && ($consumers{$env{'form.lti.sourcecrs'}} eq '') && ($cnum ne '')) { |
|
&Apache::lonnet::put_dom('lticonsumers',{ $env{'form.lti.sourcecrs'} => $env{'request.lti.login'}.':'.$cnum },$dom); |
|
} |
|
} |
} |
} |
} elsif (&Apache::loncoursequeueadmin::author_prompt()) { |
} elsif (&Apache::loncoursequeueadmin::author_prompt()) { |
unless ($customized) { |
unless ($customized) { |