--- loncom/interface/lonrequestcourse.pm 2021/08/31 17:21:24 1.112
+++ loncom/interface/lonrequestcourse.pm 2023/03/29 16:01:13 1.117
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Request a course
#
-# $Id: lonrequestcourse.pm,v 1.112 2021/08/31 17:21:24 raeburn Exp $
+# $Id: lonrequestcourse.pm,v 1.117 2023/03/29 16:01:13 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -337,8 +337,6 @@ sub handler {
$jscript = &Apache::lonhtmlcommon::set_form_elements($elementsref,\%stored);
if ($state eq 'courseinfo') {
$jscript .= &cloning_javascript();
- } elsif ($state eq 'process') {
- $jscript .= &processing_javascript();
}
}
}
@@ -450,17 +448,6 @@ function setCloneDisplay(courseForm) {
END
}
-sub processing_javascript {
- return <<"END";
-function hideProcessing() {
- if (document.getElementById('processing')) {
- document.getElementById('processing').style.display="none";
- }
-}
-
-END
-}
-
sub get_breadcrumbs {
my ($dom,$action,$state,$states,$trail) = @_;
my ($crumb,$newinstcode,$codechk,$checkedcode,$numtitles,$description);
@@ -739,9 +726,6 @@ sub onload_action {
if ($state eq 'courseinfo') {
$loaditems{'onload'} .= 'javascript:setCloneDisplay(document.requestcrs);';
}
- if ($state eq 'process') {
- $loaditems{'onload'} .= 'javascript:hideProcessing();';
- }
}
return \%loaditems;
}
@@ -2742,7 +2726,7 @@ sub requestlog_display_filter {
my $nolink = 1;
my $output = '
'.
''.&mt('Records/page:').' '.
- &Apache::lonmeta::selectbox('show',$curr->{'show'},undef,
+ &Apache::lonmeta::selectbox('show',$curr->{'show'},'',undef,
(&mt('all'),5,10,20,50,100,1000,10000)).
' | | ';
my $startform =
@@ -3705,6 +3689,19 @@ 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 = {
owner => $env{'user.name'},
domain => $env{'user.domain'},
@@ -3865,9 +3862,20 @@ sub process_request {
foreach my $role (@roles) {
$longroles{$role}=&Apache::lonnet::plaintext($role,$type);
}
- $r->print(''."\n".
- &mt('Your request is being processed; this page will update when processing is complete.').
- '
');
+ my $preamble = ''.
+ '
'.
+ &mt("Please be patient while your request is processed").
+ '
'.
+ '';
+ my $closure = <
+//
+
+ENDCLOSE
+ my %prog_state = &Apache::lonhtmlcommon::Create_PrgWin($r,undef,$preamble);
+ &Apache::lonhtmlcommon::Update_PrgWin($r,\%prog_state,&mt('Processing ...'));
$r->rflush();
if (ref($details) eq 'HASH') {
if ($details->{'clonecrs'}) {
@@ -3892,6 +3900,9 @@ sub process_request {
'autocreate',$details,\$logmsg,$clonemsg,\$newusermsg,
\$addresult,\$enrollcount,\$response,\$keysmsg,\%domdefs,
\%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') {
$customized = $postprocess->{'createdcustomized'};
}
@@ -5146,15 +5157,11 @@ sub process_textbook_request {
undef($clonedom);
}
}
- my $js = &processing_javascript();
- my ($loaditems,$args);
- $loaditems = {
- onload => 'javascript:hideProcessing();',
- };
+ my $args;
if ($crstype eq 'lti') {
$args = { 'only_body' => 1};
}
- $r->print(&header('Course Creation',$js,$loaditems,undef,$args));
+ $r->print(&header('Course Creation','','',undef,$args));
unless ($crstype eq 'lti') {
if (ref($can_request) eq 'HASH') {
@@ -5226,9 +5233,18 @@ sub process_textbook_request {
'',$req_notifylist,[],$domconfig);
$r->print($output);
if ($crstype eq 'lti') {
- 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'} => $cnum },$dom);
+ my $storecrs;
+ if ($env{'request.lti.login'}) {
+ 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()) {
unless ($customized) {