[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /interface lonrequestcourse.pm

raeburn raeburn at source.lon-capa.org
Wed Jul 3 18:34:22 EDT 2024


raeburn		Wed Jul  3 22:34:22 2024 EDT

  Modified files:              (Branch: version_2_11_X)
    /loncom/interface	lonrequestcourse.pm 
  Log:
  - For 2.11
    Backport 1.115 (modified), 1.116
  
  
Index: loncom/interface/lonrequestcourse.pm
diff -u loncom/interface/lonrequestcourse.pm:1.95.2.7 loncom/interface/lonrequestcourse.pm:1.95.2.8
--- loncom/interface/lonrequestcourse.pm:1.95.2.7	Tue Dec 14 02:54:52 2021
+++ loncom/interface/lonrequestcourse.pm	Wed Jul  3 22:34:22 2024
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Request a course
 #
-# $Id: lonrequestcourse.pm,v 1.95.2.7 2021/12/14 02:54:52 raeburn Exp $
+# $Id: lonrequestcourse.pm,v 1.95.2.8 2024/07/03 22:34:22 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -319,8 +319,6 @@
             $jscript = &Apache::lonhtmlcommon::set_form_elements($elementsref,\%stored);
             if ($state eq 'courseinfo') {
                 $jscript .= &cloning_javascript();
-            } elsif ($state eq 'process') {
-                $jscript .= &processing_javascript();
             }
         }
     }
@@ -432,17 +430,6 @@
 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);
@@ -720,9 +707,6 @@
         if ($state eq 'courseinfo') {
             $loaditems{'onload'} .= 'javascript:setCloneDisplay(document.requestcrs);';
         }
-        if ($state eq 'process') {
-            $loaditems{'onload'} .= 'javascript:hideProcessing();';
-        }
     }
     return \%loaditems;
 }
@@ -3638,6 +3622,19 @@
             }
         }
     }
+    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'}, 
@@ -3793,9 +3790,20 @@
             foreach my $role (@roles) {
                 $longroles{$role}=&Apache::lonnet::plaintext($role,$type);
             }
-            $r->print('<div id="processing" style="display:block;">'."\n".
-                      &mt('Your request is being processed; this page will update when processing is complete.').
-                      '</div>');
+            my $preamble = '<div id="LC_update" class="LC_info">'.
+                           '<br />'.
+                           &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();
             if (ref($details) eq 'HASH') {
                 if ($details->{'clonecrs'}) {
@@ -3820,6 +3828,8 @@
                                           'autocreate',$details,\$logmsg,\$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);
             if (ref($postprocess) eq 'HASH') {
                 $customized = $postprocess->{'createdcustomized'};
             }
@@ -5024,11 +5034,7 @@
             undef($clonedom);
         }
     }
-    my $js = &processing_javascript();
-    my $loaditems = { 
-                      onload => 'javascript:hideProcessing();',
-                    };
-    $r->print(&header('Course Creation',$js,$loaditems));
+    $r->print(&header('Course Creation'));
 
     if (ref($can_request) eq 'HASH') {
         unless ((scalar(keys(%{$can_request})) == 1) && ($can_request->{'textbook'})) {




More information about the LON-CAPA-cvs mailing list