[LON-CAPA-cvs] cvs: loncom /enrollment Autoenroll.pl localenroll.pm /lonnet/perl lonnet.pm

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Mon, 14 May 2007 17:35:09 -0000


raeburn		Mon May 14 13:35:09 2007 EDT

  Modified files:              
    /loncom/enrollment	Autoenroll.pl localenroll.pm 
    /loncom/lonnet/perl	lonnet.pm 
  Log:
  Running of Autoenroll.pl and display of "Automated Enrollment Manager" link on ENRL menu now controlled by domain configuration setting.
  
  
Index: loncom/enrollment/Autoenroll.pl
diff -u loncom/enrollment/Autoenroll.pl:1.25 loncom/enrollment/Autoenroll.pl:1.26
--- loncom/enrollment/Autoenroll.pl:1.25	Fri Mar  2 16:38:18 2007
+++ loncom/enrollment/Autoenroll.pl	Mon May 14 13:35:01 2007
@@ -1,7 +1,7 @@
 #!/usr/bin/perl
 #
 #Automated Enrollment script
-# $Id: Autoenroll.pl,v 1.25 2007/03/02 21:38:18 raeburn Exp $
+# $Id: Autoenroll.pl,v 1.26 2007/05/14 17:35:01 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -49,8 +49,21 @@
 
 # For each domain ......
     foreach my $dom (@domains) {
-    #only run if configured to
-        if (! &localenroll::run($dom)) { next; }
+        #only run if configured to
+        my $run_enroll = 0;
+        my $settings;
+        my %domconfig =
+            &Apache::lonnet::get_dom('configuration',['autoenroll'],$dom);
+        if (ref($domconfig{'autoenroll'}) eq 'HASH') {
+            $settings = $domconfig{'autoenroll'};
+            if ($settings->{'run'} eq '1') {
+                $run_enroll = 1;
+            }
+        } else {
+            $run_enroll = &localenroll::run($dom);
+        }
+        next if ($run_enroll != 1);
+
         $env{'user.domain'} = $dom;
         # Initialize language handler
         &Apache::lonlocal::get_language_handle();
Index: loncom/enrollment/localenroll.pm
diff -u loncom/enrollment/localenroll.pm:1.18 loncom/enrollment/localenroll.pm:1.19
--- loncom/enrollment/localenroll.pm:1.18	Mon Feb 26 15:52:55 2007
+++ loncom/enrollment/localenroll.pm	Mon May 14 13:35:01 2007
@@ -1,6 +1,6 @@
 # functions to glue school database system into Lon-CAPA for 
 # automated enrollment
-# $Id: localenroll.pm,v 1.18 2007/02/26 20:52:55 raeburn Exp $
+# $Id: localenroll.pm,v 1.19 2007/05/14 17:35:01 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -31,6 +31,11 @@
 ################################
 # sub run
 # set this to return 1 if you want the auto enrollment to run
+#
+# Beginning with LON-CAPA version 2.4, use of this routine is
+# deprecated.  Whether or not Autoenroll.pl should run is set
+# by the Domain Coordinator via "Set domain configuration",
+# provided in the Domain Management section of the Main menu. 
 ################################
 
 sub run() {
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.875 loncom/lonnet/perl/lonnet.pm:1.876
--- loncom/lonnet/perl/lonnet.pm:1.875	Mon May 14 05:38:59 2007
+++ loncom/lonnet/perl/lonnet.pm	Mon May 14 13:35:08 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.875 2007/05/14 09:38:59 albertel Exp $
+# $Id: lonnet.pm,v 1.876 2007/05/14 17:35:08 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -4454,8 +4454,18 @@
 
 sub auto_run {
     my ($cnum,$cdom) = @_;
-    my $homeserver = &homeserver($cnum,$cdom);
-    my $response = &reply('autorun:'.$cdom,$homeserver);
+    my $response = 0;
+    my $settings;
+    my %domconfig = &get_dom('configuration',['autoenroll'],$cdom);
+    if (ref($domconfig{'autoenroll'}) eq 'HASH') {
+        $settings = $domconfig{'autoenroll'};
+        if ($settings->{'run'} eq '1') {
+            $response = 1;
+        }
+    } else {
+        my $homeserver = &homeserver($cnum,$cdom);
+        $response = &reply('autorun:'.$cdom,$homeserver);
+    }
     return $response;
 }