[LON-CAPA-cvs] cvs: loncom /interface lonmodifycourse.pm

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 10 Feb 2006 23:36:47 -0000


albertel		Fri Feb 10 18:36:47 2006 EDT

  Modified files:              
    /loncom/interface	lonmodifycourse.pm 
  Log:
  - eliminate some overuse of $1
  
  
Index: loncom/interface/lonmodifycourse.pm
diff -u loncom/interface/lonmodifycourse.pm:1.20 loncom/interface/lonmodifycourse.pm:1.21
--- loncom/interface/lonmodifycourse.pm:1.20	Thu Sep 29 16:17:06 2005
+++ loncom/interface/lonmodifycourse.pm	Fri Feb 10 18:36:47 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # automated enrollment course setup handler
 #
-# $Id: lonmodifycourse.pm,v 1.20 2005/09/29 20:17:06 albertel Exp $
+# $Id: lonmodifycourse.pm,v 1.21 2006/02/10 23:36:47 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -195,26 +195,31 @@
     $enrollvar{'autharg'} = '';
     $enrollvar{'authtype'} = '';
     foreach my $item (keys %settings) {
-        if ($item =~ m/^internal\.(.+)$/) {
-            if ( ($1 eq "autoadds") || ($1 eq "autodrops") ) {
+	if ($item =~ m/^internal\.(.+)$/) {
+	    my $type = $1;
+
+            if ( ($type eq "autoadds") || ($type eq "autodrops") ) {
 	        if ($settings{$item} == 1) {
-	            $enrollvar{$1} = "ON";
+	            $enrollvar{$type} = "ON";
 	        } else {
-	            $enrollvar{$1} = "OFF";
+	            $enrollvar{$type} = "OFF";
 	        }
-            } elsif ( ($1 eq "autostart") || ($1 eq "autoend") ) {
-	        if ( ($1 eq "autoend") && ($settings{$item} == 0) ) {
-	            $enrollvar{$1} = $lt{'noen'};
+            } elsif ( ($type eq "autostart") || ($type eq "autoend") ) {
+	        if ( ($type eq "autoend") && ($settings{$item} == 0) ) {
+	            $enrollvar{$type} = $lt{'noen'};
 	        } else {
-	            $enrollvar{$1} = localtime($settings{$item});
+	            $enrollvar{$type} = localtime($settings{$item});
 	        }
-            } elsif ($1 eq "courseowner" || $1 eq "authtype" || $1 eq "autharg" || $1 eq "sectionnums" || $1 eq "coursecode" || $1 eq "crosslistings") {
-	        $enrollvar{$1} = $settings{$item};
+            } elsif ($type eq "courseowner"   || $type eq "authtype" 
+		     || $type eq "autharg"    || $type eq "sectionums"
+		     || $type eq "coursecode" || $type eq "crosslistings") {
+	        $enrollvar{$type} = $settings{$item};
             }
         } elsif ($item =~ m/^default_enrollment_(start|end)_date$/) {
-            if ( ($1 eq 'end') && ($settings{$item} == 0) ) {
+	    my $type = $1;
+            if ( ($type eq 'end') && ($settings{$item} == 0) ) {
                 $enrollvar{$item} = $lt{'noen'};
-            } elsif ( ($1 eq 'start') && ($settings{$item} eq '') ) {
+            } elsif ( ($type eq 'start') && ($settings{$item} eq '') ) {
                 $enrollvar{$item} = 'When enrolled';
             } else {
                 $enrollvar{$item} = localtime($settings{$item});